@treasuredata/tdx 2026.8.0 → 2026.8.1

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 (252) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.d.ts +9 -0
  12. package/dist/commands/auth-command.d.ts.map +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-command.js.map +1 -1
  15. package/dist/commands/cas-command.js +1 -1
  16. package/dist/commands/cas-segment-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.d.ts +10 -1
  19. package/dist/commands/claude-command.d.ts.map +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-command.js.map +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/delivery-command.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  30. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  31. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  32. package/dist/commands/engage-campaign-pull-command.js +1 -1
  33. package/dist/commands/engage-campaign-push-command.js +1 -1
  34. package/dist/commands/engage-campaign-validate-command.js +1 -1
  35. package/dist/commands/engage-command.js +1 -1
  36. package/dist/commands/engage-template-pull-command.js +1 -1
  37. package/dist/commands/engage-template-push-command.js +1 -1
  38. package/dist/commands/engage-template-validate-command.js +1 -1
  39. package/dist/commands/job-command.js +1 -1
  40. package/dist/commands/journey-command.js +1 -1
  41. package/dist/commands/journey-validate-command.js +1 -1
  42. package/dist/commands/llm-command.js +1 -1
  43. package/dist/commands/mcp-command.js +1 -1
  44. package/dist/commands/parent-segment-command.js +1 -1
  45. package/dist/commands/policy-command.js +1 -1
  46. package/dist/commands/profile-command.js +1 -1
  47. package/dist/commands/profiles-command.js +1 -1
  48. package/dist/commands/query-command.js +1 -1
  49. package/dist/commands/schedule-command.js +1 -1
  50. package/dist/commands/segment-command.js +1 -1
  51. package/dist/commands/segment-create-command.js +1 -1
  52. package/dist/commands/segment-fields-command.js +1 -1
  53. package/dist/commands/segment-move-command.js +1 -1
  54. package/dist/commands/segment-pull-command.js +1 -1
  55. package/dist/commands/segment-push-command.js +1 -1
  56. package/dist/commands/segment-update-command.js +1 -1
  57. package/dist/commands/segment-use-command.js +1 -1
  58. package/dist/commands/segment-validate-command.js +1 -1
  59. package/dist/commands/segments.js +1 -1
  60. package/dist/commands/show.js +1 -1
  61. package/dist/commands/status-command.js +1 -1
  62. package/dist/commands/table-deleted.js +1 -1
  63. package/dist/commands/tables.js +1 -1
  64. package/dist/commands/unset-command.js +1 -1
  65. package/dist/commands/upgrade-command.js +1 -1
  66. package/dist/commands/use-command.js +1 -1
  67. package/dist/commands/user-command.js +1 -1
  68. package/dist/commands/work-command.js +1 -1
  69. package/dist/commands/workflow-command.js +1 -1
  70. package/dist/core/auth.js +1 -1
  71. package/dist/core/command-output.js +1 -1
  72. package/dist/core/config.js +1 -1
  73. package/dist/core/connection-cache.js +1 -1
  74. package/dist/core/constants.js +1 -1
  75. package/dist/core/credential-cache.js +1 -1
  76. package/dist/core/global-context.js +1 -1
  77. package/dist/core/keychain.js +1 -1
  78. package/dist/core/oauth-keychain.js +1 -1
  79. package/dist/core/oauth.js +1 -1
  80. package/dist/core/profile.js +1 -1
  81. package/dist/core/project-config.js +1 -1
  82. package/dist/core/session.js +1 -1
  83. package/dist/core/site-mismatch.js +1 -1
  84. package/dist/core/user-cache.js +1 -1
  85. package/dist/core/version.js +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/mcp/server.js +1 -1
  88. package/dist/mcp/tools/index.js +1 -1
  89. package/dist/mcp/tools/tdx-run.js +1 -1
  90. package/dist/mcp/tools/tdx-search.js +1 -1
  91. package/dist/mcp/tools/work-create-item.js +1 -1
  92. package/dist/mcp/utils.js +1 -1
  93. package/dist/proxy/claude-usage-tracker.js +1 -1
  94. package/dist/proxy/passthrough-server.js +1 -1
  95. package/dist/proxy/sse-usage-parser.js +1 -1
  96. package/dist/sdk/agent/agent-config.js +1 -1
  97. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  98. package/dist/sdk/agent/agent-yaml.js +1 -1
  99. package/dist/sdk/agent/test/evaluator.js +1 -1
  100. package/dist/sdk/agent/test/executor.js +1 -1
  101. package/dist/sdk/agent/test/index.js +1 -1
  102. package/dist/sdk/agent/test/output.js +1 -1
  103. package/dist/sdk/agent/test/parser.js +1 -1
  104. package/dist/sdk/agent/tool-target-registry.js +1 -1
  105. package/dist/sdk/api.js +1 -1
  106. package/dist/sdk/auth-token.d.ts +23 -0
  107. package/dist/sdk/auth-token.d.ts.map +1 -0
  108. package/dist/sdk/auth-token.js +1 -0
  109. package/dist/sdk/auth-token.js.map +1 -0
  110. package/dist/sdk/cas/cas-api-client.js +1 -1
  111. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  112. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  113. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  114. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  115. package/dist/sdk/cas/index.js +1 -1
  116. package/dist/sdk/cas/pull-workflow.js +1 -1
  117. package/dist/sdk/cas/push-workflow.js +1 -1
  118. package/dist/sdk/cas/validate-files.js +1 -1
  119. package/dist/sdk/client/cdp-api-client.js +1 -1
  120. package/dist/sdk/client/delivery-api-client.js +1 -1
  121. package/dist/sdk/client/endpoints.js +1 -1
  122. package/dist/sdk/client/engage-api-client.js +1 -1
  123. package/dist/sdk/client/http-client.js +1 -1
  124. package/dist/sdk/client/llm-api-client.js +1 -1
  125. package/dist/sdk/client/oauth-refresh.js +1 -1
  126. package/dist/sdk/client/rate-limiter.js +1 -1
  127. package/dist/sdk/client/td-api-client.js +1 -1
  128. package/dist/sdk/client/trino-api-client.js +1 -1
  129. package/dist/sdk/client/workflow-client.js +1 -1
  130. package/dist/sdk/connection-validator.js +1 -1
  131. package/dist/sdk/connection.js +1 -1
  132. package/dist/sdk/delivery.js +1 -1
  133. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  134. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  135. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  136. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  137. package/dist/sdk/engage/campaign-pull.js +1 -1
  138. package/dist/sdk/engage/campaign-push.js +1 -1
  139. package/dist/sdk/engage/campaign-validator.js +1 -1
  140. package/dist/sdk/engage/campaign-yaml.js +1 -1
  141. package/dist/sdk/engage/template-pull.js +1 -1
  142. package/dist/sdk/engage/template-push.js +1 -1
  143. package/dist/sdk/engage/template-validator.js +1 -1
  144. package/dist/sdk/engage/template-yaml.js +1 -1
  145. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  146. package/dist/sdk/engage/types/campaign-def.js +1 -1
  147. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  148. package/dist/sdk/engage/types/template-schema.js +1 -1
  149. package/dist/sdk/engage.js +1 -1
  150. package/dist/sdk/errors.js +1 -1
  151. package/dist/sdk/index.js +1 -1
  152. package/dist/sdk/io/index.js +1 -1
  153. package/dist/sdk/io/node-filesystem.js +1 -1
  154. package/dist/sdk/job.js +1 -1
  155. package/dist/sdk/journey.js +1 -1
  156. package/dist/sdk/llm/chat-cache.js +1 -1
  157. package/dist/sdk/llm/index.js +1 -1
  158. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  159. package/dist/sdk/llm/model-factors.js +1 -1
  160. package/dist/sdk/llm/user-settings.js +1 -1
  161. package/dist/sdk/personalization.js +1 -1
  162. package/dist/sdk/policy.js +1 -1
  163. package/dist/sdk/query/deleted-table-validation.js +1 -1
  164. package/dist/sdk/query/index.js +1 -1
  165. package/dist/sdk/query/sql-parser.js +1 -1
  166. package/dist/sdk/realtime.js +1 -1
  167. package/dist/sdk/schedule.js +1 -1
  168. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  169. package/dist/sdk/segment/fields-display.js +1 -1
  170. package/dist/sdk/segment/file-discovery.js +1 -1
  171. package/dist/sdk/segment/journey-utils.js +1 -1
  172. package/dist/sdk/segment/journey-validator.js +1 -1
  173. package/dist/sdk/segment/journey-yaml.js +1 -1
  174. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  175. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  176. package/dist/sdk/segment/pull-workflow.js +1 -1
  177. package/dist/sdk/segment/push-recovery.js +1 -1
  178. package/dist/sdk/segment/push-workflow.js +1 -1
  179. package/dist/sdk/segment/resolution-context.js +1 -1
  180. package/dist/sdk/segment/segment-path-parser.js +1 -1
  181. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  182. package/dist/sdk/segment/segment-validator.js +1 -1
  183. package/dist/sdk/segment/target-resolution.js +1 -1
  184. package/dist/sdk/segment/tdx-config.js +1 -1
  185. package/dist/sdk/segment/types/activation-schema.js +1 -1
  186. package/dist/sdk/segment/types/journey-def.js +1 -1
  187. package/dist/sdk/segment/types/journey-schema.js +1 -1
  188. package/dist/sdk/segment/types/segment-def.js +1 -1
  189. package/dist/sdk/segment/types/segment-schema.js +1 -1
  190. package/dist/sdk/segment/validate-files.js +1 -1
  191. package/dist/sdk/segment/yaml-validator.js +1 -1
  192. package/dist/sdk/segment.js +1 -1
  193. package/dist/sdk/types/index.js +1 -1
  194. package/dist/sdk/types/progress.js +1 -1
  195. package/dist/sdk/types/workspace.js +1 -1
  196. package/dist/sdk/user.js +1 -1
  197. package/dist/sdk/util/format-detector.js +1 -1
  198. package/dist/sdk/util/formatters.js +1 -1
  199. package/dist/sdk/util/index.js +1 -1
  200. package/dist/sdk/util/paginate.js +1 -1
  201. package/dist/sdk/util/tree-formatter.js +1 -1
  202. package/dist/sdk/util/tree-search.js +1 -1
  203. package/dist/sdk/workflow/archive-validation.js +1 -1
  204. package/dist/sdk/workflow/clone-workflow.js +1 -1
  205. package/dist/sdk/workflow/index.js +1 -1
  206. package/dist/sdk/workflow/pull-workflow.js +1 -1
  207. package/dist/sdk/workflow/push-workflow.js +1 -1
  208. package/dist/sdk/workflow/task-graph.js +1 -1
  209. package/dist/sdk/workflow/tdx-config.js +1 -1
  210. package/dist/sdk/workflow/workflow-utils.js +1 -1
  211. package/dist/sdk/workspace/access-tracker.js +1 -1
  212. package/dist/sdk/workspace/frontmatter.js +1 -1
  213. package/dist/sdk/workspace/git.js +1 -1
  214. package/dist/sdk/workspace/index.js +1 -1
  215. package/dist/sdk/workspace/templates.js +1 -1
  216. package/dist/sdk/workspace/weekly.js +1 -1
  217. package/dist/sdk/workspace/wikilinks.js +1 -1
  218. package/dist/test-utils/command-runner.js +1 -1
  219. package/dist/test-utils/factories.js +1 -1
  220. package/dist/test-utils/fixtures.js +1 -1
  221. package/dist/test-utils/http-mock.js +1 -1
  222. package/dist/test-utils/index.js +1 -1
  223. package/dist/utils/async.js +1 -1
  224. package/dist/utils/claude-code-state.js +1 -1
  225. package/dist/utils/colors.js +1 -1
  226. package/dist/utils/diff.js +1 -1
  227. package/dist/utils/file-permissions.js +1 -1
  228. package/dist/utils/file-reader.js +1 -1
  229. package/dist/utils/github-releases.js +1 -1
  230. package/dist/utils/global-cache.js +1 -1
  231. package/dist/utils/json-loader.js +1 -1
  232. package/dist/utils/local-cache.js +1 -1
  233. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  234. package/dist/utils/logger/formatters/index.js +1 -1
  235. package/dist/utils/logger/handlers/console-handler.js +1 -1
  236. package/dist/utils/logger/handlers/file-handler.js +1 -1
  237. package/dist/utils/logger/handlers/index.js +1 -1
  238. package/dist/utils/logger/handlers/null-handler.js +1 -1
  239. package/dist/utils/logger/index.js +1 -1
  240. package/dist/utils/logger/logger.js +1 -1
  241. package/dist/utils/logger/types.js +1 -1
  242. package/dist/utils/option-validation.js +1 -1
  243. package/dist/utils/process.js +1 -1
  244. package/dist/utils/prompt.js +1 -1
  245. package/dist/utils/proxy-fetch.js +1 -1
  246. package/dist/utils/spinner.js +1 -1
  247. package/dist/utils/sse-parser.js +1 -1
  248. package/dist/utils/string-utils.js +1 -1
  249. package/dist/utils/table-ref-parser.js +1 -1
  250. package/dist/utils/tdx-logger.js +1 -1
  251. package/dist/utils/version-check.js +1 -1
  252. package/package.json +1 -1
@@ -1 +1 @@
1
- const a168_0x5cf043=a168_0x51ba;(function(_0x4a76cd,_0x3af289){const _0x57b75f=a168_0x51ba,_0x289498=_0x4a76cd();while(!![]){try{const _0x313817=parseInt(_0x57b75f(0x13d))/0x1*(-parseInt(_0x57b75f(0xf7))/0x2)+parseInt(_0x57b75f(0x182))/0x3*(parseInt(_0x57b75f(0x1d0))/0x4)+-parseInt(_0x57b75f(0x1b9))/0x5+parseInt(_0x57b75f(0x14a))/0x6*(-parseInt(_0x57b75f(0x1c1))/0x7)+-parseInt(_0x57b75f(0x148))/0x8*(-parseInt(_0x57b75f(0x18f))/0x9)+-parseInt(_0x57b75f(0x12e))/0xa+-parseInt(_0x57b75f(0x195))/0xb*(parseInt(_0x57b75f(0x163))/0xc);if(_0x313817===_0x3af289)break;else _0x289498['push'](_0x289498['shift']());}catch(_0x34b727){_0x289498['push'](_0x289498['shift']());}}}(a168_0x5e19,0xa466b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a168_0x5cf043(0x1a0));function a168_0x51ba(_0x145301,_0x4e6b14){_0x145301=_0x145301-0xdb;const _0x5e19dd=a168_0x5e19();let _0x51bad9=_0x5e19dd[_0x145301];return _0x51bad9;}export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a168_0x5cf043(0x188);export function createPendingSegmentId(_0x4439cd){return''+PENDING_SEGMENT_PREFIX+_0x4439cd+'__';}export function isPendingSegmentId(_0x2699d6){const _0x2cf4ac=a168_0x5cf043;return _0x2699d6['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x2699d6[_0x2cf4ac(0xfc)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x541901){const _0x5168b9=a168_0x5cf043;return _0x541901[_0x5168b9(0x1d5)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x746c12){return''+PENDING_ACTIVATION_PREFIX+_0x746c12+'__';}export function isPendingActivationId(_0x42ed19){const _0x2d6179=a168_0x5cf043;return _0x42ed19[_0x2d6179(0xfc)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x467d7c){const _0x369dbf=a168_0x5cf043;return _0x467d7c[_0x369dbf(0x1d5)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x508b7f,_0x5ddef6){const _0xa6b842=a168_0x5cf043,_0x528478=_0x508b7f+'::'+(_0x5ddef6[_0xa6b842(0x146)]()||_0xa6b842(0x160)),_0x15509d=createHash('sha1')['update'](_0x528478)['digest']('hex')[_0xa6b842(0x1c8)](0x0,0xc);return _0xa6b842(0x102)+_0x15509d;}export function ensureJourneyDefaults(_0x3b4407){const _0x45cd9b=a168_0x5cf043;!_0x3b4407[_0x45cd9b(0x1cb)]&&(_0x3b4407[_0x45cd9b(0x1cb)]=''),!_0x3b4407[_0x45cd9b(0xf6)]&&(_0x3b4407[_0x45cd9b(0xf6)]=_0x45cd9b(0x149));}export function injectExistingStageIds(_0x573da5,_0x309bba){const _0x468bc5=a168_0x5cf043,_0x11d8ad=new Map(_0x309bba[_0x468bc5(0xe6)](_0x2a4f64=>[_0x2a4f64[_0x468bc5(0x170)],_0x2a4f64['id']]));for(const _0x432bef of _0x573da5){if(!_0x432bef['id']){const _0x296075=_0x11d8ad['get'](_0x432bef[_0x468bc5(0x170)]);_0x296075&&(_0x432bef['id']=_0x296075);}}}export function resolveTDFolderPath(_0x3f5157,_0x32eaa8,_0x2fda92){const _0x256e7d=a168_0x5cf043;if(!_0x32eaa8)return _0x3f5157;if(_0x3f5157===_0x2fda92||_0x3f5157[_0x256e7d(0xfc)](_0x2fda92+'/'))return _0x3f5157;return _0x3f5157?_0x2fda92+'/'+_0x3f5157:_0x2fda92;}export function addFoldersToCreate(_0x5f0610,_0x470172,_0x249259){const _0x5a1ebd=a168_0x5cf043;if(!_0x5f0610)return;if(_0x470172[_0x5a1ebd(0x15a)](_0x5f0610))return;const _0x15e8d9=_0x5f0610[_0x5a1ebd(0xdb)]('/');let _0x51b55f='';for(const _0x821fbb of _0x15e8d9){_0x51b55f=_0x51b55f?_0x51b55f+'/'+_0x821fbb:_0x821fbb,!_0x470172[_0x5a1ebd(0x15a)](_0x51b55f)&&_0x249259['add'](_0x51b55f);}}export function sortFoldersByDepth(_0x11e951){const _0x4f3378=a168_0x5cf043;return[..._0x11e951][_0x4f3378(0x13e)]((_0x4eddd9,_0x2e2249)=>{const _0x2904e4=_0x4f3378,_0x409d58=(_0x4eddd9[_0x2904e4(0x1ba)](/\//g)||[])['length'],_0x1622e2=(_0x2e2249['match'](/\//g)||[])[_0x2904e4(0xdc)];return _0x409d58-_0x1622e2;});}import*as a168_0x54cead from'yaml';import{readFileSync}from'fs';import a168_0x1426cc from'path';import{isJourneyDef,parseYamlString as a168_0x2e04ad,toYamlString as a168_0x25b02b,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(_0x4d40d2){const _0x434de2=a168_0x5cf043;if(Array[_0x434de2(0x175)](_0x4d40d2))return'['+_0x4d40d2[_0x434de2(0xe6)](_0x59310b=>stableStringify(_0x59310b))['join'](',')+']';if(_0x4d40d2&&typeof _0x4d40d2==='object'){const _0x3bcf25=_0x4d40d2,_0x309eda=Object['keys'](_0x3bcf25)['sort'](),_0x655a47=_0x309eda[_0x434de2(0xe6)](_0xb24fef=>'\x22'+_0xb24fef+'\x22:'+stableStringify(_0x3bcf25[_0xb24fef]));return'{'+_0x655a47[_0x434de2(0x1b4)](',')+'}';}const _0x35229d=JSON[_0x434de2(0x10b)](_0x4d40d2);return _0x35229d===undefined?_0x434de2(0x194):_0x35229d;}function activationSignature(_0x50a3a7){const _0x3921a5=a168_0x5cf043,_0x337d1b={'connection':_0x50a3a7[_0x3921a5(0x1c5)],..._0x50a3a7[_0x3921a5(0x18d)]!==undefined&&{'all_columns':_0x50a3a7['all_columns']},..._0x50a3a7[_0x3921a5(0x19f)]!==undefined&&{'columns':_0x50a3a7[_0x3921a5(0x19f)]},..._0x50a3a7[_0x3921a5(0x1c9)]!==undefined&&{'behavior':_0x50a3a7[_0x3921a5(0x1c9)]},..._0x50a3a7[_0x3921a5(0x197)]!==undefined&&{'behaviors':_0x50a3a7[_0x3921a5(0x197)]},..._0x50a3a7[_0x3921a5(0xfb)]!==undefined&&{'schedule':_0x50a3a7[_0x3921a5(0xfb)]},..._0x50a3a7[_0x3921a5(0x111)]!==undefined&&{'notification':_0x50a3a7[_0x3921a5(0x111)]},..._0x50a3a7[_0x3921a5(0x107)]!==undefined&&{'connector_config':_0x50a3a7[_0x3921a5(0x107)]},..._0x50a3a7[_0x3921a5(0x1d6)]!==undefined&&{'activation_template_id':_0x50a3a7[_0x3921a5(0x1d6)]}};return stableStringify(_0x337d1b);}async function fetchSegment(_0x12610a,_0x2ad920,_0x2ac65b,_0x13a0ed){const _0xb4156d=a168_0x5cf043,_0x1c5730=_0x13a0ed?.[_0xb4156d(0x11b)](_0x2575d1=>_0x2575d1['id']===_0x2ac65b);if(_0x1c5730)return _0x1c5730;try{return await _0x12610a[_0xb4156d(0x160)][_0xb4156d(0x13c)](_0x2ad920,_0x2ac65b);}catch(_0x202092){logger[_0xb4156d(0x142)](_0xb4156d(0x199)+_0x2ac65b+_0xb4156d(0x192)+_0x202092);try{return await _0x12610a[_0xb4156d(0x160)]['getSegmentEntity'](_0x2ac65b);}catch(_0x4aaac4){return logger[_0xb4156d(0x142)](_0xb4156d(0x1b5)+_0x2ac65b+':\x20'+_0x4aaac4),null;}}}function recoverSegmentIdsFromPushRecovery(_0x485fb7,_0x26fb8f,_0x53f306){const _0x3e0c35=a168_0x5cf043,_0x849992=readPushRecovery(_0x485fb7[_0x3e0c35(0x139)]);if(_0x849992?.[_0x3e0c35(0x120)]===_0x485fb7[_0x3e0c35(0x152)][_0x3e0c35(0x170)])for(const [_0x134652,_0xf1f8c0]of Object[_0x3e0c35(0x1ad)](_0x849992[_0x3e0c35(0x17e)])){const _0x9a32cf=generateDeterministicJourneySegmentName(_0x485fb7['yamlConfig'][_0x3e0c35(0x170)],_0x134652);_0xf1f8c0[_0x3e0c35(0xfa)]===_0x9a32cf&&(_0x26fb8f[_0x3e0c35(0x1ce)](_0x134652,_0xf1f8c0[_0x3e0c35(0x14b)]),_0x53f306[_0x3e0c35(0x1ce)](_0x134652,_0xf1f8c0[_0x3e0c35(0x14b)]));}}async function createOrRecoverEmbeddedSegment(_0x1c6fc4,_0x3da9c8,_0x2c6968,_0x4a4317){const _0x355c4f=a168_0x5cf043;let _0x32ba6a;try{_0x32ba6a=await _0x1c6fc4[_0x355c4f(0x160)][_0x355c4f(0x168)]({'name':_0x2c6968['uniqueSegmentName'],'description':_0x2c6968[_0x355c4f(0x1cb)],'journeyId':_0x2c6968['journeyId'],'rule':_0x4a4317(_0x2c6968['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x2c6968['folderId'],'audienceId':_0x2c6968[_0x355c4f(0x180)]});}catch(_0x605f1d){const _0x4fb381=_0x605f1d instanceof Error&&_0x605f1d['message'][_0x355c4f(0xe1)](_0x355c4f(0x1a4));if(_0x4fb381){const _0x55acc1=readPushRecovery(_0x3da9c8[_0x355c4f(0x139)]),_0x170400=_0x55acc1?.['journeyName']===_0x3da9c8['yamlConfig'][_0x355c4f(0x170)]?_0x55acc1[_0x355c4f(0x17e)][_0x2c6968[_0x355c4f(0x113)]]:undefined;if(_0x170400?.['uniqueServerName']===_0x2c6968[_0x355c4f(0xed)])await _0x1c6fc4[_0x355c4f(0x160)][_0x355c4f(0xff)](_0x2c6968[_0x355c4f(0x180)],_0x170400[_0x355c4f(0x14b)],{'description':_0x2c6968['description'],'rule':_0x4a4317(_0x2c6968[_0x355c4f(0xe2)],!![]),'countPopulation':!![]}),_0x32ba6a=_0x170400[_0x355c4f(0x14b)];else throw new SDKError(ErrorCode[_0x355c4f(0x109)],'Embedded\x20segment\x20\x27'+_0x2c6968[_0x355c4f(0x113)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x355c4f(0x145)+_0x3da9c8['absolutePath'][_0x355c4f(0x1d5)](/([^/]+)$/,_0x355c4f(0x17b))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x605f1d);}else throw _0x605f1d;}return saveSegmentToPushRecovery(_0x3da9c8['absolutePath'],_0x3da9c8[_0x355c4f(0x152)][_0x355c4f(0x170)],_0x2c6968[_0x355c4f(0x113)],{'segmentId':_0x32ba6a,'uniqueServerName':_0x2c6968['uniqueSegmentName'],'createdAt':new Date()[_0x355c4f(0x143)]()}),_0x32ba6a;}export async function prepareSegmentFiles(_0x1bc919,_0x95fad8,_0x4e93bb,_0x83f607,_0x151519){const _0x29d9bd=a168_0x5cf043,{activationDefToCreateRequest:_0x44842d}=await import(_0x29d9bd(0x173)),_0x329084=[],_0xa6743d=new Set();for(const {yamlConfig:_0x4b082e,folderPath:_0x3c484a,sourcePath:_0x32ca30}of _0x1bc919){const _0x345874=resolveTDFolderPath(_0x3c484a,_0x83f607,_0x151519),_0xdc6e05=_0x345874+':'+_0x4b082e[_0x29d9bd(0x170)],_0x4c8978=_0x95fad8[_0x29d9bd(0x18c)]['get'](_0xdc6e05),_0x5529e9=_0x4c8978?_0x95fad8[_0x29d9bd(0x172)][_0x29d9bd(0x11e)](_0x4c8978['id'])||[]:[];addFoldersToCreate(_0x345874,_0x95fad8[_0x29d9bd(0x136)],_0xa6743d);const _0x2d9d98=calculateActivationActions(_0x4b082e[_0x29d9bd(0x1d9)]||[],_0x5529e9,_0x95fad8['idToEmailMap'],_0x95fad8[_0x29d9bd(0x156)]);for(const _0x654c46 of _0x2d9d98){(_0x654c46['type']===_0x29d9bd(0x10f)||_0x654c46[_0x29d9bd(0xe9)]===_0x29d9bd(0xfd))&&_0x654c46[_0x29d9bd(0x17f)]&&(_0x654c46['validatedRequest']=await _0x44842d(_0x654c46['yamlActivation'],_0x4e93bb));}const _0x4b1cc2=calculateSegmentDiff(_0x4b082e,_0x4c8978,_0x5529e9,_0x95fad8['idToEmailMap'],_0x95fad8[_0x29d9bd(0x156)]);_0x329084['push']({'relativePath':_0x4b082e[_0x29d9bd(0x170)],'absolutePath':_0x32ca30,'yamlConfig':_0x4b082e,'folderPath':_0x345874,'existingSegment':_0x4c8978,'existingActivations':_0x5529e9,'isNew':_0x4b1cc2[_0x29d9bd(0x1c4)],'hasChanges':_0x4b1cc2['hasChanges'],'diff':_0x4b1cc2['diff'],'activationActions':_0x2d9d98});}return{'segmentFiles':_0x329084,'foldersToCreate':_0xa6743d};}export async function prepareJourneyFiles(_0x3b3d3e,_0x51659d,_0x7963b3,_0x45355c){const _0x4cc796=a168_0x5cf043,_0x3afacd=[],_0x34ff78=new Set();for(const {yamlConfig:_0x2ae3aa,folderPath:_0x3b68c8,sourcePath:_0x3c1cc8}of _0x3b3d3e){const _0x432ae5=resolveTDFolderPath(_0x3b68c8,_0x7963b3,_0x45355c),_0x599dd0=_0x432ae5+':'+_0x2ae3aa[_0x4cc796(0x170)],_0x5241ef=_0x51659d[_0x4cc796(0xf2)][_0x4cc796(0x11e)](_0x599dd0);let _0x593350,_0x413c5c;if(_0x5241ef&&_0x5241ef[_0x4cc796(0xdc)]>0x0){const _0x1cdd21=buildLocalExpandedRuleMappings(_0x2ae3aa),{createYamlContext:_0x5c7965,prefetchJourneySegments:_0x4db13a}=createPushYamlContextForBundle(_0x51659d[_0x4cc796(0x114)],_0x51659d['parentId'],_0x51659d[_0x4cc796(0x169)],_0x1cdd21,_0x51659d[_0x4cc796(0x196)],_0x51659d[_0x4cc796(0x156)],_0x51659d[_0x4cc796(0x13b)],_0x51659d[_0x4cc796(0x11a)]);await _0x4db13a(_0x5241ef['map'](_0x2ed6f4=>_0x2ed6f4['id']));const _0x49ec97=await _0x51659d[_0x4cc796(0x114)][_0x4cc796(0x12b)][_0x4cc796(0x14e)](_0x5241ef[0x0][_0x4cc796(0x191)]),_0x35a202=hasMultipleVersions(_0x2ae3aa),_0x327e9c=async _0x5abcd5=>{const _0xa087ab=_0x4cc796,_0xe16f0b=_0x51659d[_0xa087ab(0x11a)]?.[_0xa087ab(0x11e)](_0x5abcd5);if(_0xe16f0b)return _0xe16f0b;return _0x51659d['fetchJourney']({'journeyId':_0x5abcd5,'journeyName':_0x2ae3aa[_0xa087ab(0x170)],'isMultiVersion':_0x5241ef['length']>0x1});};if(_0x35a202&&_0x5241ef[_0x4cc796(0xdc)]>0x1){const _0x457bbc=[];for(const _0x59ecc3 of _0x5241ef){const _0xb79c0c=_0x59ecc3[_0x4cc796(0x11f)]||0x1;_0x51659d[_0x4cc796(0x155)]?.[_0x4cc796(0xfd)]('Fetching\x20'+_0x2ae3aa[_0x4cc796(0x170)]+'\x20v'+_0xb79c0c);const _0x3e90bf=await _0x327e9c(_0x59ecc3['id']),_0xdded05=_0x5c7965(_0x59ecc3['id']),_0x318fc1=await journeyResponseToDef(_0x3e90bf,_0xdded05);_0x457bbc[_0x4cc796(0x164)]({'item':_0x59ecc3,'yaml':_0x318fc1});}const _0x187500=buildLocalRuleToNameMappingFromJourney(_0x2ae3aa);_0x413c5c=buildMergedJourneyDef(_0x457bbc,_0x187500,_0x49ec97);const _0x19d0d3=Math[_0x4cc796(0x190)](..._0x457bbc[_0x4cc796(0xe6)](_0x2613af=>_0x2613af['item'][_0x4cc796(0x11f)]||0x0)),_0x4f2faf=_0x5241ef[_0x4cc796(0x11b)](_0x561a1a=>(_0x561a1a[_0x4cc796(0x11f)]||0x0)===_0x19d0d3);_0x4f2faf&&(_0x51659d['progress']?.[_0x4cc796(0xfd)](_0x4cc796(0x126)+_0x2ae3aa[_0x4cc796(0x170)]+'\x20v'+_0x19d0d3),_0x593350=await _0x327e9c(_0x4f2faf['id']));}else{const _0x27e0b6=_0x5241ef[_0x5241ef[_0x4cc796(0xdc)]-0x1];_0x51659d['progress']?.[_0x4cc796(0xfd)](_0x4cc796(0x126)+_0x2ae3aa[_0x4cc796(0x170)]),_0x593350=await _0x327e9c(_0x27e0b6['id']);const _0x28df19=_0x5c7965(_0x27e0b6['id']),_0x4962d1=await journeyResponseToDef(_0x593350,_0x28df19),_0x215467=buildLocalRuleToNameMappingFromJourney(_0x2ae3aa);_0x413c5c=buildMergedJourneyDef([{'item':_0x27e0b6,'yaml':_0x4962d1}],_0x215467,_0x49ec97);}}addFoldersToCreate(_0x432ae5,_0x51659d['folderPathToId'],_0x34ff78);const _0x5375db=calculateJourneyDiff(_0x2ae3aa,_0x413c5c);_0x3afacd['push']({'relativePath':_0x2ae3aa['name'],'absolutePath':_0x3c1cc8,'yamlConfig':_0x2ae3aa,'folderPath':_0x432ae5,'existingJourney':_0x593350,'isNew':_0x5375db['isNew'],'hasChanges':_0x5375db[_0x4cc796(0x1a7)],'diff':_0x5375db['diff']});}return{'journeyFiles':_0x3afacd,'foldersToCreate':_0x34ff78};}export function calculateActivationActions(_0x1023a0,_0x532b81,_0x14fa0e,_0x3ad99a){const _0x113710=a168_0x5cf043,_0x28cfe0=[],_0x2a1cdf=new Map();for(const _0x4e29fe of _0x532b81){_0x2a1cdf[_0x113710(0x1ce)](_0x4e29fe['name'],_0x4e29fe);}const _0x24aea2=new Map();for(const _0x33dc87 of _0x1023a0){_0x24aea2[_0x113710(0x1ce)](_0x33dc87[_0x113710(0x170)],_0x33dc87);}for(const _0x517981 of _0x1023a0){const _0x40b5cf=_0x2a1cdf[_0x113710(0x11e)](_0x517981[_0x113710(0x170)]);if(!_0x40b5cf)_0x28cfe0[_0x113710(0x164)]({'type':_0x113710(0x10f),'name':_0x517981[_0x113710(0x170)],'yamlActivation':_0x517981});else{const _0x3d8f1a=activationResponseToDef(_0x40b5cf,_0x14fa0e,_0x3ad99a),_0x334862=a168_0x54cead[_0x113710(0x10b)](_0x3d8f1a),_0x11ca26=a168_0x54cead[_0x113710(0x10b)](_0x517981);_0x334862!==_0x11ca26&&_0x28cfe0['push']({'type':_0x113710(0xfd),'name':_0x517981[_0x113710(0x170)],'yamlActivation':_0x517981,'existingActivation':_0x40b5cf});}}for(const _0x206b78 of _0x532b81){!_0x24aea2['has'](_0x206b78['name'])&&_0x28cfe0[_0x113710(0x164)]({'type':_0x113710(0xdf),'name':_0x206b78[_0x113710(0x170)],'existingActivation':_0x206b78});}return _0x28cfe0;}function calculateYamlDiff(_0x57c84e,_0x3a4589){if(_0x3a4589){const _0x865e32=generateDiff(_0x3a4589,_0x57c84e),_0x59dd65=hasChanges(_0x865e32);return{'isNew':![],'hasChanges':_0x59dd65,'diff':_0x59dd65?formatDiffWithColors(_0x865e32):undefined};}const _0x4b3e5a=generateDiff('',_0x57c84e);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4b3e5a)};}export function calculateSegmentDiff(_0x5dee8e,_0x417ee8,_0x1469f6,_0x40004b,_0x2088bd){const _0x3fa0ad=segmentToYamlString(_0x5dee8e),_0x89310e=_0x417ee8?segmentToYamlString(segmentWithActivationsToYaml(_0x417ee8,_0x1469f6,undefined,_0x40004b,_0x2088bd)):undefined;return calculateYamlDiff(_0x3fa0ad,_0x89310e);}export function calculateJourneyDiff(_0x2802be,_0x557eee){const _0x3e9999=normalizeJourneyDef(_0x2802be,_0x2802be),_0x53abde=a168_0x25b02b(_0x3e9999),_0x454cad=_0x557eee?a168_0x25b02b(normalizeJourneyDef(_0x557eee,_0x2802be)):undefined;return calculateYamlDiff(_0x53abde,_0x454cad);}export function findSegmentsToDelete(_0x531f3a,_0x705f88,_0x3e5007,_0x237e22,_0xa0d5ed){const _0x47f14e=a168_0x5cf043,_0x12a152=new Set();for(const {yamlConfig:_0x50940b,folderPath:_0x40941a}of _0x705f88){_0x12a152[_0x47f14e(0x16c)](_0x40941a+':'+_0x50940b[_0x47f14e(0x170)]);}return _0x531f3a['filter'](_0x136537=>{const _0x5e85e7=_0x47f14e,_0x8144b8=_0x136537[_0x5e85e7(0x150)]?_0x3e5007[_0x5e85e7(0x11e)](_0x136537[_0x5e85e7(0x150)][_0x5e85e7(0x178)]())||'':'',_0x4313e0=_0x8144b8+':'+_0x136537[_0x5e85e7(0x170)];if(_0x12a152[_0x5e85e7(0x15a)](_0x4313e0))return![];if(_0xa0d5ed)return _0x8144b8===_0x237e22||_0x8144b8[_0x5e85e7(0xfc)](_0x237e22+'/');return!![];});}export function findJourneysToDelete(_0x49bca5,_0x3dd1ba,_0x41ef9f,_0x4bc9c7,_0xc18b20){const _0x5c3b9a=a168_0x5cf043,_0xee11fd=new Set();for(const {yamlConfig:_0x5370ff,folderPath:_0x55b734}of _0x3dd1ba){_0xee11fd[_0x5c3b9a(0x16c)](_0x55b734+':'+_0x5370ff['name']);}return _0x49bca5['filter'](_0xa6d3df=>{const _0x58756a=_0x5c3b9a,_0x282ea3=_0xa6d3df[_0x58756a(0x15f)]?_0x41ef9f[_0x58756a(0x11e)](_0xa6d3df[_0x58756a(0x15f)])||'':'',_0x42f523=_0x282ea3+':'+_0xa6d3df[_0x58756a(0x138)];if(_0xee11fd[_0x58756a(0x15a)](_0x42f523))return![];if(_0xc18b20)return _0x282ea3===_0x4bc9c7||_0x282ea3[_0x58756a(0xfc)](_0x4bc9c7+'/');return!![];});}export function buildSegmentLookupMap(_0x4b74b7,_0x50da9a){const _0x2c110f=a168_0x5cf043,_0x4f2a6f=new Map();for(const _0x4a5e79 of _0x4b74b7){const _0x279a9a=_0x4a5e79[_0x2c110f(0x150)]?_0x50da9a['get'](_0x4a5e79[_0x2c110f(0x150)][_0x2c110f(0x178)]())||'':'',_0x29851a=_0x279a9a+':'+_0x4a5e79[_0x2c110f(0x170)];_0x4f2a6f[_0x2c110f(0x1ce)](_0x29851a,_0x4a5e79);}return _0x4f2a6f;}export function buildSegmentNameToIdMap(_0x4aec0e){const _0x1f1420=a168_0x5cf043,_0x1d61c6=new Map();for(const _0x1ac2f6 of _0x4aec0e){_0x1d61c6[_0x1f1420(0x1ce)](_0x1ac2f6[_0x1f1420(0x170)],_0x1ac2f6['id']);}return _0x1d61c6;}export function buildJourneyBundleLookupMap(_0x4d4116,_0x41eaeb){const _0x42c932=a168_0x5cf043,_0x3c4ab2=new Map();for(const _0x97743f of _0x4d4116){const _0x265eb3=_0x97743f[_0x42c932(0x15f)]?_0x41eaeb[_0x42c932(0x11e)](_0x97743f[_0x42c932(0x15f)])||'':'',_0x5de2e1=_0x265eb3+':'+_0x97743f[_0x42c932(0x138)];!_0x3c4ab2[_0x42c932(0x15a)](_0x5de2e1)&&_0x3c4ab2['set'](_0x5de2e1,[]),_0x3c4ab2[_0x42c932(0x11e)](_0x5de2e1)[_0x42c932(0x164)](_0x97743f);}for(const _0x385f02 of _0x3c4ab2[_0x42c932(0x12a)]()){_0x385f02['sort']((_0x4a8f8a,_0x3c613f)=>(_0x4a8f8a[_0x42c932(0x11f)]||0x0)-(_0x3c613f[_0x42c932(0x11f)]||0x0));}return _0x3c4ab2;}export function collectFoldersToCreate(_0x1203aa,_0xb4ec){const _0x3207c6=a168_0x5cf043,_0x49bd2b=new Set();for(const _0x506851 of _0x1203aa){if(!_0x506851)continue;if(_0xb4ec[_0x3207c6(0x15a)](_0x506851))continue;const _0x446932=_0x506851['split']('/');let _0x5eeffc='';for(const _0x52ce00 of _0x446932){_0x5eeffc=_0x5eeffc?_0x5eeffc+'/'+_0x52ce00:_0x52ce00,!_0xb4ec[_0x3207c6(0x15a)](_0x5eeffc)&&_0x49bd2b['add'](_0x5eeffc);}}return _0x49bd2b;}export function parseAndClassifyYamlFiles(_0x3da1b1,_0x3b7f03,_0x44b084){const _0x3605a9=a168_0x5cf043,_0x56f843=[],_0x154a54=[];for(const _0x15c297 of _0x3da1b1){const _0xd68242=a168_0x1426cc[_0x3605a9(0x158)](_0x3b7f03,a168_0x1426cc[_0x3605a9(0x1d2)](_0x15c297)),_0x438b87=_0xd68242==='.'?'':_0xd68242[_0x3605a9(0x1d5)](/\\/g,'/'),_0x263d98=readFileSync(_0x15c297,_0x3605a9(0x19d)),_0x4d950b=a168_0x54cead['parse'](_0x263d98);if(isJourneyDef(_0x4d950b,_0x15c297)){const _0x8c4cd6=a168_0x2e04ad(_0x263d98);_0x154a54[_0x3605a9(0x164)]({'yamlConfig':_0x8c4cd6,'folderPath':_0x438b87,'sourcePath':_0x15c297});}else{if(!_0x44b084?.[_0x3605a9(0x141)]){const _0x148437=parseSegmentYamlFile(_0x263d98),_0x23bdd5=normalizeChildSegmentYaml(_0x148437);_0x56f843[_0x3605a9(0x164)]({'yamlConfig':_0x23bdd5,'folderPath':_0x438b87,'sourcePath':_0x15c297});}}}return{'segments':_0x56f843,'journeys':_0x154a54};}export function validateParsedFiles(_0x1bb764,_0x5aaa55){const _0x58f636=a168_0x5cf043,_0x51c76c=[];for(const {yamlConfig:_0x4b2df5,sourcePath:_0x46265b}of _0x1bb764[_0x58f636(0x17e)]){const _0x1db5a6=readFileSync(_0x46265b,_0x58f636(0x19d)),_0x2f37c0=a168_0x54cead[_0x58f636(0x1b6)](_0x1db5a6),_0x34875c=validateSegmentDef(_0x4b2df5,{'source':_0x1db5a6,'document':_0x2f37c0},{'skipSchema':!![]});if(!_0x34875c[_0x58f636(0x179)]){const _0x5a52ed=a168_0x1426cc[_0x58f636(0x158)](_0x5aaa55,_0x46265b);_0x51c76c[_0x58f636(0x164)]({'filePath':_0x5a52ed,'source':_0x1db5a6,'result':_0x34875c,'isJourney':![]});}}for(const {yamlConfig:_0x16be9d,sourcePath:_0x571a0f}of _0x1bb764[_0x58f636(0x108)]){const _0x40cd17=readFileSync(_0x571a0f,_0x58f636(0x19d)),_0x4305fd=a168_0x54cead[_0x58f636(0x1b6)](_0x40cd17),_0x551bd7=validateJourneyDef(_0x16be9d,{'source':_0x40cd17,'document':_0x4305fd},{'skipSchema':!![]});if(!_0x551bd7['valid']){const _0x5ab347=a168_0x1426cc[_0x58f636(0x158)](_0x5aaa55,_0x571a0f);_0x51c76c[_0x58f636(0x164)]({'filePath':_0x5ab347,'source':_0x40cd17,'result':_0x551bd7,'isJourney':!![]});}}return _0x51c76c;}export function formatValidationErrors(_0x5d8682){const _0x4e89de=a168_0x5cf043,_0x507cff=[];for(const {filePath:_0x3ee463,source:_0x18a57b,result:_0x10e7bb,isJourney:_0x209d6c}of _0x5d8682){const _0x201c19=_0x209d6c?_0x4e89de(0x12b):'segment';_0x507cff[_0x4e89de(0x164)]('\x0a'+_0x3ee463+'\x20('+_0x201c19+_0x4e89de(0xee)+_0x10e7bb[_0x4e89de(0x1b1)][_0x4e89de(0xdc)]+'\x20error(s)'),_0x507cff[_0x4e89de(0x164)](formatValidationResult(_0x10e7bb,_0x18a57b,_0x3ee463));}return _0x507cff[_0x4e89de(0x1b4)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x27b487){const _0x49393c=a168_0x5cf043,_0x5bd342=new Set(),_0x455b15=new Map(),_0xbfdc9=collectSegmentUsageCounts(_0x27b487);if(_0x27b487[_0x49393c(0x17e)])for(const [_0x102909,_0x385b4f]of Object[_0x49393c(0x1ad)](_0x27b487['segments'])){_0x5bd342['add'](_0x102909);if(_0x385b4f[_0x49393c(0x116)]){const _0x3593ec=yamlRuleToApi(_0x385b4f['rule']),_0x3df486=apiRuleToYaml(_0x3593ec);_0x455b15[_0x49393c(0x1ce)](_0x102909,_0x3df486);}}const _0x56f637=new Map();let _0x24b841=0x0;for(const [_0x1e1325,_0x7e02a]of _0x455b15){const _0xd6ff29=serializeExpandedRule(_0x7e02a,_0x455b15),_0x3c49b1=_0x56f637['get'](_0xd6ff29)||[];_0x3c49b1['push']({'name':_0x1e1325,'index':_0x24b841}),_0x56f637[_0x49393c(0x1ce)](_0xd6ff29,_0x3c49b1),_0x24b841++;}const _0x1f5b2d=new Map();for(const [_0x53545e,_0x20678d]of _0x56f637){const _0x3ff8fa=_0x20678d[_0x49393c(0x1c8)]()[_0x49393c(0x13e)]((_0x5eb75e,_0x6c8fc0)=>{const _0x54c21b=_0x49393c,_0x12cdf0=_0xbfdc9[_0x54c21b(0x11e)](_0x5eb75e['name'])||0x0,_0x3774a1=_0xbfdc9[_0x54c21b(0x11e)](_0x6c8fc0[_0x54c21b(0x170)])||0x0;if(_0x12cdf0!==_0x3774a1)return _0x3774a1-_0x12cdf0;return _0x5eb75e[_0x54c21b(0x183)]-_0x6c8fc0[_0x54c21b(0x183)];})['map'](_0x2330bb=>_0x2330bb[_0x49393c(0x170)]),_0x3c0e66=[];for(const _0x27cad3 of _0x3ff8fa){const _0x411b3a=_0xbfdc9[_0x49393c(0x11e)](_0x27cad3)||0x0,_0x3f2b9e=Math[_0x49393c(0x190)](_0x411b3a,0x1);for(let _0x18ea67=0x0;_0x18ea67<_0x3f2b9e;_0x18ea67++){_0x3c0e66[_0x49393c(0x164)](_0x27cad3);}}_0x1f5b2d[_0x49393c(0x1ce)](_0x53545e,_0x3c0e66);}return{'existingLocalSegmentNames':_0x5bd342,'localSegmentRules':_0x455b15,'localExpandedRuleToNames':_0x1f5b2d};}export function createSegmentIdResolver(_0xd4f03d,_0x49d232){return async _0x29f939=>{const _0x486ec3=a168_0x51ba,_0x45b23a=_0xd4f03d['get'](_0x29f939);if(!_0x45b23a)throw new SDKError(ErrorCode[_0x486ec3(0xeb)],'Segment\x20not\x20found:\x20'+_0x29f939+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x49d232+'\x27)');return _0x45b23a;};}export function extractRootFolderId(_0x4480c9){const _0x3b05f8=a168_0x5cf043;return _0x4480c9['relationships']?.[_0x3b05f8(0x1ac)]?.[_0x3b05f8(0x1d3)]?.['id']||_0x4480c9[_0x3b05f8(0x1d4)]?.['parentFolder']?.[_0x3b05f8(0x1d3)]?.['id'];}export function buildConnectionMaps(_0x4ca390){const _0x392eff=a168_0x5cf043,_0xc2b9c0=new Map(),_0x393df5=new Map(),_0x2a6a29=new Map();for(const _0x4b0126 of _0x4ca390){_0xc2b9c0[_0x392eff(0x1ce)](_0x4b0126['name'],parseInt(_0x4b0126['id'],0xa)),_0x393df5['set'](_0x4b0126['id'],_0x4b0126['name']),_0x2a6a29[_0x392eff(0x1ce)](_0x4b0126['name'],_0x4b0126[_0x392eff(0xe9)]);}return{'nameToId':_0xc2b9c0,'idToName':_0x393df5,'nameToType':_0x2a6a29};}function a168_0x5e19(){const _0x59a3b2=['Deleted\x20activation\x20\x27','uniqueSegmentName','):\x20','idToName','\x27\x20not\x20found\x20in\x20journey\x20\x27','conditionTimeoutUnit','journeyBundlesByFolderAndName','resolveSegment','getActivation','folderPath','state','1398nYfKaF','Failed\x20to\x20fetch\x20referenced\x20segment\x20','existingJourney','uniqueServerName','schedule','startsWith','update','existingActivation','updateSegmentById','branches','Deleting\x20activation\x20\x27','journey_entry_criteria_','goal\x20criteria','attributes','\x27\x20wait\x20condition','folder','connector_config','journeys','SEGMENT_UPDATE_ERROR','Segment\x20not\x20found','stringify','deleteActivation','goal','Updating\x20segment\x20\x27','create','segment_deleting','notification','filter','localName','deps','Failed\x20to\x20','rule','logInfo','Updating\x20activation\x20\x27','WaitStep','journeyById','find','embeddedSegmentNameToId','\x27\x20milestone','get','versionNumber','journeyName','steps','logSuccess','toLowerCase','created','conditionTimeoutDuration','Fetching\x20','createdSegmentIds','conditionSegmentId','entry_criteria','values','journey','\x0a\x20\x20','createdSegmentId','285720BEaHjB','NOT_FOUND','ACTIVATION_SYNTAX_ERROR','Updated\x20activation\x20\x27','Stage\x20\x27','Failed\x20to\x20resolve\x20segment\x20','kind','Updated\x20journey\x20\x27','folderPathToId','createSegment','journeyBundleName','absolutePath','with','activationStepsById','getSegment','419IueGGH','sort','Created\x20activation\x20\x27','buildUserMaps','skipSegments','debug','toISOString','unchanged','Delete\x20the\x20push\x20recovery\x20file\x20(','trim','keys','16OlRrlb','draft','1757040KyUkvs','segmentId','\x27...','verbose','getLatestJourneyId','Segment\x20not\x20found:\x20','segmentFolderId','\x27\x20to\x20local\x20\x27','yamlConfig','\x27\x20exit\x20criteria','ACTIVATION_UPDATE_ERROR','progress','connectionIdToNameMap','validatedRequest','relative','from','has','journey_updating','journey_created','Creating\x20activation\x20\x27','deleted','folderId','segment','Entry\x20criteria:\x20','stages','2388USHvmU','push','rootFolderId','activation_updating','getJourney','createJourneySegment','existingSegments','Updated\x20segment\x20\x27','entry','add','user','journeyActivationStepId','JOURNEY_UPDATE_ERROR','name','action','activationsBySegmentId','./child-segment-yaml.js','all','isArray','some','Deleted\x20segment\x20\x27','toString','valid','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','.$1.push-recovery.json','list','Journey\x20\x27','segments','yamlActivation','parentId','journeyActivationNameToId','172461IPMQAa','index','Matched\x20server\x20segment\x20\x27','entryCriteria','Condition','conditions','__pending_act_','updated','segmentNameToId','../../utils/async.js','segmentByFolderAndName','all_columns','journeyId','4119273zgQeVo','max','journeyBundleId',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','embedded_activation_creating','null','23859WoGVEB','idToEmailMap','behaviors','withProgress','getSegment\x20failed\x20for\x20','folder_created','results','logDeleted','utf-8','journeyStages','columns','tdx.sdk.push-workflow','Created\x20journey\x20\x27','activation_creating','folder_creating','Name\x20has\x20already\x20been\x20taken','DecisionPoint','\x20journey\x20from\x20file:\x20','hasChanges','./journey-yaml.js','activationActions','\x27\x20entry\x20criteria','Activation','parentSegmentFolder','entries','INTERNAL','Creating\x20segment\x20\x27','\x27\x20from\x20file:\x20','errors','run_after_journey_refresh','existingSegment','join','getSegmentEntity\x20also\x20failed\x20for\x20','parseDocument','reduce','listActivations','2016550NTktRl','match','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','embedded_segment_creating','segment_deleted','waitStepUnit','activationParams','SEGMENT_SYNTAX_ERROR','7pFxcga','Created\x20segment\x20\x27','logWarning','isNew','connection','\x20(referenced\x20in\x20journey\x20','milestone','slice','behavior','size','description','flatMap','segment_created','set','effectiveFolderId','84jRnDPq','Duration','dirname','data','relationships','replace','activation_template_id','createActivation','nameToId','activations','split','length','exitCriterias','waitStep','delete','activation_deleting','includes','resolvedRule','activationContext','resolveJourneyId','onProgress','map','stage\x20\x27','waitStepType','type','embedded_segment_created','SEGMENT_NOT_FOUND'];a168_0x5e19=function(){return _0x59a3b2;};return a168_0x5e19();}export function calculatePushStats(_0x408f0f,_0x4d9cb7,_0x216b83,_0x2b42cf,_0x294ce4,_0x2c5e85,_0x1cbd14){const _0x39fa17=a168_0x5cf043,_0x5a5e93=_0x408f0f['filter'](_0x4ffa35=>_0x4ffa35['isNew']),_0x1d20c1=_0x408f0f[_0x39fa17(0x112)](_0x5f2b67=>!_0x5f2b67[_0x39fa17(0x1c4)]&&_0x5f2b67[_0x39fa17(0x1a7)]),_0x57a08d=_0x408f0f[_0x39fa17(0x112)](_0x4be8c8=>!_0x4be8c8[_0x39fa17(0x1c4)]&&!_0x4be8c8[_0x39fa17(0x1a7)]),_0x44657a=_0x2c5e85?_0x2b42cf:[],_0x25b27e=_0x4d9cb7[_0x39fa17(0x112)](_0x3c869c=>_0x3c869c[_0x39fa17(0x1c4)]),_0x246cbf=_0x4d9cb7[_0x39fa17(0x112)](_0x1aafba=>!_0x1aafba[_0x39fa17(0x1c4)]&&_0x1aafba[_0x39fa17(0x1a7)]),_0x49480d=_0x4d9cb7[_0x39fa17(0x112)](_0x1b90bd=>!_0x1b90bd[_0x39fa17(0x1c4)]&&!_0x1b90bd[_0x39fa17(0x1a7)]),_0x2d7390=_0x2c5e85?_0x294ce4:[],_0x134e05=_0x408f0f[_0x39fa17(0x1cc)](_0x3c3c12=>_0x3c3c12['activationActions']),_0x41efed=_0x134e05[_0x39fa17(0x112)](_0x4ff0b6=>_0x4ff0b6[_0x39fa17(0xe9)]===_0x39fa17(0x10f)),_0x2dc9b6=_0x134e05[_0x39fa17(0x112)](_0x3624c0=>_0x3624c0['type']===_0x39fa17(0xfd)),_0x14db0e=_0x134e05[_0x39fa17(0x112)](_0x3b435a=>_0x3b435a[_0x39fa17(0xe9)]===_0x39fa17(0xdf)),_0x310282=Array[_0x39fa17(0x159)](_0x216b83)[_0x39fa17(0x13e)](),_0xf294ab=_0x1cbd14?![]:_0x5a5e93[_0x39fa17(0xdc)]>0x0||_0x1d20c1[_0x39fa17(0xdc)]>0x0||_0x44657a[_0x39fa17(0xdc)]>0x0,_0x11fe2e=_0x25b27e[_0x39fa17(0xdc)]>0x0||_0x246cbf[_0x39fa17(0xdc)]>0x0||_0x2d7390[_0x39fa17(0xdc)]>0x0,_0x246afe=_0x1cbd14?![]:_0x134e05[_0x39fa17(0xdc)]>0x0,_0x4eeb35=_0x310282['length']>0x0;return{'segments':{'new':_0x5a5e93,'changed':_0x1d20c1,'unchanged':_0x57a08d,'toDelete':_0x44657a},'journeys':{'new':_0x25b27e,'changed':_0x246cbf,'unchanged':_0x49480d,'toDelete':_0x2d7390},'activations':{'all':_0x134e05,'toCreate':_0x41efed,'toUpdate':_0x2dc9b6,'toDelete':_0x14db0e},'folders':{'toCreate':_0x310282},'counts':{'segments':{'new':_0x5a5e93[_0x39fa17(0xdc)],'changed':_0x1d20c1['length'],'unchanged':_0x57a08d[_0x39fa17(0xdc)],'toDelete':_0x44657a[_0x39fa17(0xdc)]},'journeys':{'new':_0x25b27e['length'],'changed':_0x246cbf[_0x39fa17(0xdc)],'unchanged':_0x49480d[_0x39fa17(0xdc)],'toDelete':_0x2d7390['length']},'activations':{'create':_0x41efed[_0x39fa17(0xdc)],'update':_0x2dc9b6[_0x39fa17(0xdc)],'delete':_0x14db0e[_0x39fa17(0xdc)]},'folders':_0x310282['length']},'hasChanges':_0xf294ab||_0x11fe2e||_0x246afe||_0x4eeb35};}export async function buildPushExecutionContext(_0x80ab30,_0x54aee0,_0xf3ab79,_0x475693,_0x36c4b0,_0x269810){const _0xd737c8=a168_0x5cf043,_0x4ed12a=extractRootFolderId(_0xf3ab79),{pathToId:_0x1f0979,idToPath:_0x11588e}=buildFolderMaps(_0x36c4b0),_0x4ca5db=buildSegmentNameToIdMap(_0x475693),_0x29d44c=new Map(),{batchAsync:_0x3b4f88}=await import(_0xd737c8(0x18b)),[_0x50a5ef,_0x5d3f14]=await Promise[_0xd737c8(0x174)]([_0x80ab30[_0xd737c8(0x16d)][_0xd737c8(0x140)](),_0x80ab30[_0xd737c8(0x1c5)][_0xd737c8(0x17c)](),((async()=>{const _0x18620f=_0xd737c8;!_0x269810&&_0x475693[_0x18620f(0xdc)]>0x0&&await _0x3b4f88(_0x475693,async _0x538458=>{const _0x269824=_0x18620f,_0x3f3fb8=await _0x80ab30[_0x269824(0x160)][_0x269824(0x1b8)](_0x54aee0,_0x538458['id']);_0x29d44c[_0x269824(0x1ce)](_0x538458['id'],_0x3f3fb8);});})())]),{emailToId:_0x4ef16b,idToEmail:_0x2d95a7}=_0x50a5ef,_0xfc9d89=buildConnectionMaps(_0x5d3f14);return{'rootFolderId':_0x4ed12a,'folderPathToId':_0x1f0979,'folderIdToPath':_0x11588e,'segmentNameToId':_0x4ca5db,'activationsBySegmentId':_0x29d44c,'emailToIdMap':_0x4ef16b,'idToEmailMap':_0x2d95a7,'connectionNameToIdMap':_0xfc9d89[_0xd737c8(0x1d8)],'connectionIdToNameMap':_0xfc9d89[_0xd737c8(0xef)],'connectionNameToTypeMap':_0xfc9d89['nameToType']};}export function createPushYamlContextForBundle(_0x22ae8e,_0x35baf6,_0x24eebc,_0x92085e,_0x1f2d2f,_0x922461,_0xac0fd9,_0x40f930){const {existingLocalSegmentNames:_0x541f83,localExpandedRuleToNames:_0xf37207}=_0x92085e,_0x1c2124=new Set(),_0x36956a=new Map(),_0x3998c6=new Map(),_0xacc52f=new Map(),_0x40acff=createJumpTargetCache(),_0x2dcd15=new Map(),_0x4a01e6=new Map(),_0x34bc55=new Set();let _0x444267;const _0x3d2eb7=_0x49a97c=>{const _0x49a935={'resolveSegment':async _0xcf53a9=>{const _0x45792b=a168_0x51ba,_0x345f1f=_0xacc52f[_0x45792b(0x11e)](_0xcf53a9);if(_0x345f1f!==undefined)return{'name':_0x345f1f,'isJourneyLocal':!![]};try{const _0x33ec05=await fetchSegment(_0x22ae8e,_0x35baf6,_0xcf53a9,_0x24eebc);if(!_0x33ec05)throw new Error(_0x45792b(0x10a));const _0x24064e=generateJourneyLocalName(_0x33ec05[_0x45792b(0x170)]),_0x5c4b55=_0x33ec05[_0x45792b(0x134)]===SEGMENT_KIND_JOURNEY&&_0x24064e!==undefined;let _0x2bac69=_0x33ec05[_0x45792b(0x170)],_0x34c437;if(_0x5c4b55&&_0x33ec05[_0x45792b(0x116)]){const _0x4189c0=apiRuleToYaml(_0x33ec05['rule']);_0x4a01e6[_0x45792b(0x1ce)](_0xcf53a9,_0x4189c0);const _0x2cf199=async _0x5a95bf=>{const _0x4dec5e=_0x45792b,_0xf1a0c5=collectSegmentRefsFromRule(_0x5a95bf);for(const _0x5c91b1 of _0xf1a0c5){if(!_0x4a01e6[_0x4dec5e(0x15a)](_0x5c91b1))try{const _0x461b25=await fetchSegment(_0x22ae8e,_0x35baf6,_0x5c91b1,_0x24eebc);if(_0x461b25?.[_0x4dec5e(0x116)]){const _0x1e60c3=apiRuleToYaml(_0x461b25[_0x4dec5e(0x116)]);_0x4a01e6[_0x4dec5e(0x1ce)](_0x5c91b1,_0x1e60c3),await _0x2cf199(_0x1e60c3);}}catch(_0xc6ff3){logger['debug'](_0x4dec5e(0xf8)+_0x5c91b1+':\x20'+_0xc6ff3);}}};await _0x2cf199(_0x4189c0);const _0xf07af9=serializeExpandedRule(_0x4189c0,_0x4a01e6),_0x50770d=_0xf37207[_0x45792b(0x11e)](_0xf07af9);if(_0x50770d&&_0x50770d[_0x45792b(0xdc)]>0x0){const _0x33a4e6=_0x36956a['get'](_0xf07af9)||0x0,_0x1ca255=_0x50770d[_0x33a4e6]||_0x50770d[_0x50770d[_0x45792b(0xdc)]-0x1];_0x36956a[_0x45792b(0x1ce)](_0xf07af9,_0x33a4e6+0x1),_0x2bac69=_0x1ca255,_0x1c2124['add'](_0x2bac69),_0xacc52f['set'](_0xcf53a9,_0x2bac69);const _0x7bd921=await resolveRuleSegmentRefs(_0x4189c0,async _0x4b764e=>{const _0x11956d=_0x45792b,_0x454703=_0xacc52f[_0x11956d(0x11e)](_0x4b764e);if(_0x454703)return _0x454703;const _0x4af0d5=await _0x444267[_0x11956d(0xf3)](_0x4b764e);return _0x4af0d5[_0x11956d(0x170)];});_0x34c437={'description':_0x33ec05['description'],'rule':_0x7bd921};}else{const _0x38319c=_0x2dcd15[_0x45792b(0x11e)](_0xf07af9);if(_0x38319c)_0x2bac69=_0x38319c,_0xacc52f[_0x45792b(0x1ce)](_0xcf53a9,_0x2bac69);else{if(_0x24064e){let _0x72d2c9=_0x24064e,_0x2794d9=0x2;while(_0x1c2124[_0x45792b(0x15a)](_0x72d2c9)||_0x541f83[_0x45792b(0x15a)](_0x72d2c9)){_0x72d2c9=_0x24064e+'_'+_0x2794d9,_0x2794d9++;}_0x1c2124[_0x45792b(0x16c)](_0x72d2c9),_0x2bac69=_0x72d2c9;}_0xacc52f[_0x45792b(0x1ce)](_0xcf53a9,_0x2bac69),_0x2dcd15[_0x45792b(0x1ce)](_0xf07af9,_0x2bac69);const _0x517ebe=await resolveRuleSegmentRefs(_0x4189c0,async _0x3d3548=>{const _0x7381db=_0x45792b,_0x4aa335=_0xacc52f[_0x7381db(0x11e)](_0x3d3548);if(_0x4aa335)return _0x4aa335;const _0x4deb47=await _0x444267['resolveSegment'](_0x3d3548);return _0x4deb47[_0x7381db(0x170)];});_0x34c437={'description':_0x33ec05['description'],'rule':_0x517ebe};}}}return{'name':_0x2bac69,'isJourneyLocal':_0x5c4b55,'definition':_0x34c437};}catch(_0x211be9){return logger[_0x45792b(0x142)](_0x45792b(0x133)+_0xcf53a9+':\x20'+_0x211be9),{'name':_0xcf53a9,'isJourneyLocal':![]};}},'resolveActivation':async _0x2b1a91=>{const _0x3ec0bf=a168_0x51ba,_0x894e43=_0x3998c6[_0x3ec0bf(0x11e)](_0x2b1a91);if(_0x894e43!==undefined)return{'name':_0x894e43,'isJourneyLocal':!![]};try{let _0x4590d6=_0xac0fd9?.[_0x3ec0bf(0x11e)](_0x2b1a91);!_0x4590d6&&(_0x4590d6=await _0x22ae8e[_0x3ec0bf(0x12b)][_0x3ec0bf(0xf4)](_0x49a97c,_0x2b1a91));const _0x512c5b=_0x4590d6[_0x3ec0bf(0x104)][_0x3ec0bf(0x1bf)][_0x3ec0bf(0x170)]||_0x2b1a91,_0x41c766=sanitizeYamlKey(_0x512c5b)||'activation_'+_0x2b1a91,_0x1c8400=_0x41c766;_0x3998c6['set'](_0x2b1a91,_0x1c8400);const _0x1a3c4f=journeyActivationStepToYaml(_0x4590d6,_0x1f2d2f,_0x922461);return{'name':_0x1c8400,'isJourneyLocal':!![],'definition':_0x1a3c4f};}catch(_0x597c45){return logger[_0x3ec0bf(0x142)]('Failed\x20to\x20resolve\x20activation\x20'+_0x2b1a91+':\x20'+_0x597c45),{'name':_0x2b1a91,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xea22dc,_0x57e591)=>resolveJumpTarget(_0xea22dc,_0x57e591,_0x40acff,async _0x2ee192=>{const _0x2c14e8=a168_0x51ba,_0x441798=_0x40f930?.[_0x2c14e8(0x11e)](_0x2ee192);if(_0x441798)return _0x441798;return _0x22ae8e['journey'][_0x2c14e8(0x167)](_0x2ee192);})};return _0x444267=_0x49a935,_0x49a935;},_0x240eb5=async _0xc298=>{const _0x205457=a168_0x51ba,{collectSegmentIdsFromJourneyApi:_0x38dd9c}=await import(_0x205457(0x1a8)),{batchAsync:_0x33ee08}=await import(_0x205457(0x18b)),_0x4c2288=new Set();for(const _0x16f470 of _0xc298){let _0x52748d=_0x40f930?.[_0x205457(0x11e)](_0x16f470);!_0x52748d&&(_0x52748d=await _0x22ae8e[_0x205457(0x12b)]['getJourney'](_0x16f470));const _0x4ac2eb=_0x38dd9c(_0x52748d);for(const _0x4ae821 of _0x4ac2eb){_0x4c2288[_0x205457(0x16c)](_0x4ae821);}}let _0x3c32b1=Array[_0x205457(0x159)](_0x4c2288);while(_0x3c32b1[_0x205457(0xdc)]>0x0){const _0x2214d7=_0x3c32b1[_0x205457(0x112)](_0x14f182=>!_0x34bc55['has'](_0x14f182));if(_0x2214d7['length']===0x0)break;const _0x36b94b=await _0x33ee08(_0x2214d7,async _0x1a04e4=>{const _0xa7de7d=_0x205457;_0x34bc55[_0xa7de7d(0x16c)](_0x1a04e4);const _0x3eb3bb=await fetchSegment(_0x22ae8e,_0x35baf6,_0x1a04e4,_0x24eebc);if(!_0x3eb3bb)return null;return{'segmentId':_0x1a04e4,'segment':_0x3eb3bb};},0xa),_0x56ab59=new Set();for(const _0x590165 of _0x36b94b){if(!_0x590165?.[_0x205457(0x160)]?.[_0x205457(0x116)])continue;const _0x4157a9=apiRuleToYaml(_0x590165[_0x205457(0x160)][_0x205457(0x116)]);_0x4a01e6[_0x205457(0x1ce)](_0x590165[_0x205457(0x14b)],_0x4157a9);const _0x3c58dd=collectSegmentRefsFromRule(_0x4157a9);for(const _0x2c4249 of _0x3c58dd){!_0x34bc55[_0x205457(0x15a)](_0x2c4249)&&_0x56ab59[_0x205457(0x16c)](_0x2c4249);}}_0x3c32b1=Array['from'](_0x56ab59);}};return{'createYamlContext':_0x3d2eb7,'prefetchJourneySegments':_0x240eb5};}export async function executePushSegments(_0x56be91,_0x3607ec,_0x14ae1a,_0x345bd5,_0x1f214f){const _0x523323=a168_0x5cf043,{segmentDefToCreateRequest:_0x4a93c4,segmentDefToUpdateRequest:_0x39c549}=await import('./child-segment-yaml.js'),_0x314186=_0x14ae1a['folderPathToId'],_0x30acf3=0x5,_0x339106=async _0x380eee=>{const _0x18ccbf=a168_0x51ba,_0x2e42ba=_0x380eee[_0x18ccbf(0xf5)]?_0x314186['get'](_0x380eee[_0x18ccbf(0xf5)]):undefined;let _0x265a6a;const _0x401ba0={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0xb49b49=_0x380eee[_0x18ccbf(0x152)];if(_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x116)]){const _0x2b01db=createSegmentIdResolver(_0x14ae1a[_0x18ccbf(0x18a)],_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]),_0x3bc7fb=await resolveRuleSegmentIds(_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x116)],_0x2b01db);_0xb49b49={..._0x380eee[_0x18ccbf(0x152)],'rule':_0x3bc7fb};}try{if(_0x380eee['isNew']){_0x1f214f[_0x18ccbf(0xe5)]?.({'type':'segment_creating','name':_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]});const _0x3aa895=_0x4a93c4(_0xb49b49,_0x2e42ba),_0x5c3035=await _0x1f214f['withProgress'](_0x18ccbf(0x1af)+_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]+_0x18ccbf(0x14c),()=>_0x56be91[_0x18ccbf(0x160)][_0x18ccbf(0x137)](_0x345bd5[_0x18ccbf(0x180)],_0x3aa895));_0x265a6a=_0x5c3035[_0x18ccbf(0x1d3)]['id'],_0x14ae1a[_0x18ccbf(0x18a)][_0x18ccbf(0x1ce)](_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)],_0x265a6a),_0x401ba0[_0x18ccbf(0x12d)]={'name':_0x380eee['yamlConfig']['name'],'id':_0x265a6a},_0x1f214f['onProgress']?.({'type':_0x18ccbf(0x1cd),'name':_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)],'segmentId':_0x265a6a}),_0x1f214f[_0x18ccbf(0x122)]?.(_0x18ccbf(0x1c2)+_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]+'\x27'),_0x401ba0['created']=0x1;}else{if(_0x380eee['hasChanges']){_0x1f214f[_0x18ccbf(0xe5)]?.({'type':'segment_updating','name':_0x380eee['yamlConfig']['name']});const _0x2ab9f1=_0x39c549(_0xb49b49);_0x2e42ba!==_0x380eee[_0x18ccbf(0x1b3)]?.[_0x18ccbf(0x150)]&&(_0x2ab9f1[_0x18ccbf(0x150)]=_0x2e42ba?parseInt(_0x2e42ba,0xa):undefined),await _0x1f214f['withProgress'](_0x18ccbf(0x10e)+_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]+_0x18ccbf(0x14c),()=>_0x56be91[_0x18ccbf(0x160)][_0x18ccbf(0xff)](_0x345bd5['parentId'],_0x380eee[_0x18ccbf(0x1b3)]['id'],_0x2ab9f1)),_0x265a6a=_0x380eee[_0x18ccbf(0x1b3)]['id'],_0x1f214f[_0x18ccbf(0xe5)]?.({'type':'segment_updated','name':_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]}),_0x1f214f[_0x18ccbf(0x122)]?.(_0x18ccbf(0x16a)+_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)]+'\x27'),_0x401ba0['updated']=0x1;}else _0x265a6a=_0x380eee[_0x18ccbf(0x1b3)]['id'];}}catch(_0x165809){const _0x16eb46=isHttp400Error(_0x165809),_0x36e5fb=_0x16eb46?ErrorCode[_0x18ccbf(0x1c0)]:ErrorCode[_0x18ccbf(0x109)],_0x538872=getErrorMessage(_0x165809);throw new SDKError(_0x36e5fb,_0x18ccbf(0x115)+(_0x380eee[_0x18ccbf(0x1c4)]?_0x18ccbf(0x10f):'update')+'\x20segment\x20from\x20file:\x20'+_0x380eee[_0x18ccbf(0x139)]+_0x18ccbf(0x12c)+_0x538872,_0x165809);}try{const _0x2cbcb3=await syncActivationsForSegment(_0x56be91,_0x345bd5['parentId'],_0x265a6a,_0x380eee[_0x18ccbf(0x152)][_0x18ccbf(0x170)],_0x380eee[_0x18ccbf(0x1a9)],_0x1f214f,_0x380eee[_0x18ccbf(0x139)]);_0x401ba0[_0x18ccbf(0x1d9)]=_0x2cbcb3;}catch(_0xb4867d){if(_0xb4867d instanceof SDKError)throw _0xb4867d;throw new SDKError(ErrorCode[_0x18ccbf(0x154)],_0x18ccbf(0x1bb)+_0x380eee[_0x18ccbf(0x152)]['name']+_0x18ccbf(0x1b0)+_0x380eee['absolutePath']+'\x0a\x20\x20'+getErrorMessage(_0xb4867d),_0xb4867d);}return _0x401ba0;},_0x1a95ed=await batchAsync(_0x3607ec,_0x339106,_0x30acf3),_0x29e993={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x59dd34 of _0x1a95ed){_0x29e993[_0x523323(0x124)]+=_0x59dd34['created'],_0x29e993[_0x523323(0x189)]+=_0x59dd34[_0x523323(0x189)],_0x59dd34['createdSegmentId']&&_0x29e993[_0x523323(0x127)][_0x523323(0x1ce)](_0x59dd34['createdSegmentId'][_0x523323(0x170)],_0x59dd34[_0x523323(0x12d)]['id']),_0x29e993['activations'][_0x523323(0x124)]+=_0x59dd34[_0x523323(0x1d9)]['created'],_0x29e993[_0x523323(0x1d9)][_0x523323(0x189)]+=_0x59dd34[_0x523323(0x1d9)][_0x523323(0x189)],_0x29e993[_0x523323(0x1d9)][_0x523323(0x15e)]+=_0x59dd34[_0x523323(0x1d9)][_0x523323(0x15e)];}return _0x29e993;}async function syncActivationsForSegment(_0x2c14b6,_0x1fd0c7,_0x182e7f,_0x13e9cf,_0x3f7d4a,_0x1569bd,_0x5a3bd3){const _0x436b56=a168_0x5cf043,_0x33d6b7={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x23e011 of _0x3f7d4a){try{if(_0x23e011['type']===_0x436b56(0x10f)&&_0x23e011[_0x436b56(0x157)])_0x1569bd[_0x436b56(0xe5)]?.({'type':_0x436b56(0x1a2),'segmentName':_0x13e9cf,'activationName':_0x23e011[_0x436b56(0x170)]}),await _0x1569bd['withProgress'](_0x436b56(0x15d)+_0x23e011['name']+_0x436b56(0x14c),()=>_0x2c14b6[_0x436b56(0x160)][_0x436b56(0x1d7)](_0x1fd0c7,_0x182e7f,_0x23e011[_0x436b56(0x157)])),_0x1569bd[_0x436b56(0xe5)]?.({'type':'activation_created','segmentName':_0x13e9cf,'activationName':_0x23e011[_0x436b56(0x170)]}),_0x1569bd[_0x436b56(0x122)]?.(_0x436b56(0x13f)+_0x23e011['name']+'\x27'),_0x33d6b7[_0x436b56(0x124)]++;else{if(_0x23e011[_0x436b56(0xe9)]==='update'&&_0x23e011[_0x436b56(0x157)]&&_0x23e011[_0x436b56(0xfe)])_0x1569bd['onProgress']?.({'type':_0x436b56(0x166),'segmentName':_0x13e9cf,'activationName':_0x23e011['name']}),await _0x1569bd[_0x436b56(0x198)](_0x436b56(0x118)+_0x23e011[_0x436b56(0x170)]+_0x436b56(0x14c),()=>_0x2c14b6['segment']['updateActivation'](_0x1fd0c7,_0x182e7f,_0x23e011[_0x436b56(0xfe)]['id'],_0x23e011[_0x436b56(0x157)])),_0x1569bd[_0x436b56(0xe5)]?.({'type':'activation_updated','segmentName':_0x13e9cf,'activationName':_0x23e011[_0x436b56(0x170)]}),_0x1569bd[_0x436b56(0x122)]?.(_0x436b56(0x131)+_0x23e011[_0x436b56(0x170)]+'\x27'),_0x33d6b7[_0x436b56(0x189)]++;else _0x23e011['type']===_0x436b56(0xdf)&&_0x23e011[_0x436b56(0xfe)]&&(_0x1569bd[_0x436b56(0xe5)]?.({'type':_0x436b56(0xe0),'segmentName':_0x13e9cf,'activationName':_0x23e011[_0x436b56(0x170)]}),await _0x1569bd[_0x436b56(0x198)](_0x436b56(0x101)+_0x23e011[_0x436b56(0x170)]+_0x436b56(0x14c),()=>_0x2c14b6['segment'][_0x436b56(0x10c)](_0x1fd0c7,_0x182e7f,_0x23e011['existingActivation']['id'])),_0x1569bd[_0x436b56(0xe5)]?.({'type':'activation_deleted','segmentName':_0x13e9cf,'activationName':_0x23e011[_0x436b56(0x170)]}),_0x1569bd[_0x436b56(0x19c)]?.(_0x436b56(0xec)+_0x23e011[_0x436b56(0x170)]+'\x27'),_0x33d6b7[_0x436b56(0x15e)]++);}}catch(_0x8aada7){const _0x4cbee0=isHttp400Error(_0x8aada7),_0x2333cb=_0x4cbee0?ErrorCode[_0x436b56(0x130)]:ErrorCode[_0x436b56(0x154)],_0x5e5c84=getErrorMessage(_0x8aada7);throw new SDKError(_0x2333cb,_0x436b56(0x115)+_0x23e011[_0x436b56(0xe9)]+'\x20activation\x20\x27'+_0x23e011[_0x436b56(0x170)]+_0x436b56(0x1b0)+_0x5a3bd3+'\x0a\x20\x20'+_0x5e5c84,_0x8aada7);}}return _0x33d6b7;}export async function executePushFolders(_0x219cc6,_0x37fa11,_0x3bc246,_0x2df356,_0x4d02d5){const _0x3b93c6=a168_0x5cf043,_0x17793d=new Map(_0x3bc246),_0x5f374c=sortFoldersByDepth(_0x37fa11);for(const _0x9813b3 of _0x5f374c){const _0x3954f3=_0x9813b3[_0x3b93c6(0xdb)]('/'),_0x2a5f33=_0x3954f3[_0x3954f3['length']-0x1],_0x312a67=_0x3954f3[_0x3b93c6(0x1c8)](0x0,-0x1)[_0x3b93c6(0x1b4)]('/'),_0x47da2c=_0x17793d[_0x3b93c6(0x11e)](_0x312a67);_0x4d02d5['onProgress']?.({'type':_0x3b93c6(0x1a3),'folder':_0x9813b3});const _0x5ea425={'name':_0x2a5f33,'parentFolderId':_0x47da2c},_0x410129=await _0x4d02d5[_0x3b93c6(0x198)]('Creating\x20folder\x20\x27'+_0x9813b3+_0x3b93c6(0x14c),()=>_0x219cc6[_0x3b93c6(0x160)]['createFolder'](_0x2df356[_0x3b93c6(0x180)],_0x5ea425));_0x17793d[_0x3b93c6(0x1ce)](_0x9813b3,_0x410129[_0x3b93c6(0x1d3)]['id']),_0x4d02d5['onProgress']?.({'type':_0x3b93c6(0x19a),'folder':_0x9813b3,'folderId':_0x410129['data']['id']}),_0x4d02d5[_0x3b93c6(0x117)]?.('Created\x20folder\x20\x27'+_0x9813b3+'\x27');}return _0x17793d;}export async function executePushSegmentDeletions(_0x2ae188,_0x472ef5,_0x4c7904){const _0x5067d3=a168_0x5cf043;if(_0x472ef5['length']===0x0)return 0x0;const {batchAsync:_0x1fef19}=await import(_0x5067d3(0x18b)),_0x9f7082=0x5,_0x2e8106=await _0x1fef19(_0x472ef5,async _0x212e84=>{const _0x5ed354=_0x5067d3;return _0x4c7904['onProgress']?.({'type':_0x5ed354(0x110),'name':_0x212e84['name']}),await _0x2ae188['segment']['deleteSegment'](_0x212e84['id']),_0x4c7904[_0x5ed354(0xe5)]?.({'type':_0x5ed354(0x1bd),'name':_0x212e84[_0x5ed354(0x170)]}),_0x4c7904[_0x5ed354(0x19c)]?.(_0x5ed354(0x177)+_0x212e84['name']+'\x27'),0x1;},_0x9f7082);return _0x2e8106[_0x5067d3(0x1b7)]((_0x5af1b9,_0x2a09ac)=>_0x5af1b9+_0x2a09ac,0x0);}export async function executePushJourneys(_0x4fb1af,_0x129214,_0x1a94a5,_0x3e285d,_0x181290){const _0x48985e=a168_0x5cf043,{journeyDefToRequest:_0x175dc3}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x1b908c,yamlRuleToApi:_0x4a3c2e,validateSegmentRule:_0x2987f6}=await import(_0x48985e(0x173)),_0xae3c89={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x30f0dd=new Map(_0x1a94a5[_0x48985e(0x18a)]),_0x1c764e=0x5;for(let _0x4f4741=0x0;_0x4f4741<_0x129214['length'];_0x4f4741+=_0x1c764e){const _0x57a9b6=_0x129214[_0x48985e(0x1c8)](_0x4f4741,_0x4f4741+_0x1c764e),_0x3218a9=await Promise['all'](_0x57a9b6['map'](async _0x4c4dc9=>{const _0xe2036a=_0x48985e;if(!_0x4c4dc9[_0xe2036a(0x1c4)]&&!_0x4c4dc9[_0xe2036a(0x1a7)])return{'action':_0xe2036a(0x144),'name':_0x4c4dc9[_0xe2036a(0x152)][_0xe2036a(0x170)],'journeyId':_0x4c4dc9[_0xe2036a(0xf9)]?.['id']};const _0x370d2e=_0x4c4dc9[_0xe2036a(0xf5)]?_0x1a94a5[_0xe2036a(0x136)][_0xe2036a(0x11e)](_0x4c4dc9[_0xe2036a(0xf5)]):undefined;_0x181290[_0xe2036a(0xe5)]?.({'type':_0x4c4dc9[_0xe2036a(0x1c4)]?'journey_creating':_0xe2036a(0x15b),'name':_0x4c4dc9[_0xe2036a(0x152)][_0xe2036a(0x170)]});try{const _0x12e930=await executeSingleJourneyPush(_0x4fb1af,_0x4c4dc9,{..._0x1a94a5,'segmentNameToId':_0x30f0dd},{'parentId':_0x3e285d[_0xe2036a(0x180)],'rootFolderId':_0x3e285d[_0xe2036a(0x165)],'folderId':_0x370d2e,'verbose':_0x3e285d[_0xe2036a(0x14d)]},_0x181290,{'journeyDefToRequest':_0x175dc3,'activationDefToCreateRequest':_0x1b908c,'yamlRuleToApi':_0x4a3c2e,'validateSegmentRule':_0x2987f6});for(const [_0x5e958d,_0x32df47]of _0x12e930[_0xe2036a(0x11c)]){_0x30f0dd[_0xe2036a(0x1ce)](_0x5e958d,_0x32df47),_0xae3c89[_0xe2036a(0x11c)][_0xe2036a(0x1ce)](_0x5e958d,_0x32df47);}if(_0x12e930['action']==='created')_0x181290['onProgress']?.({'type':_0xe2036a(0x15c),'name':_0x4c4dc9['yamlConfig']['name'],'journeyId':_0x12e930[_0xe2036a(0x18e)]}),_0x181290[_0xe2036a(0x122)]?.(_0xe2036a(0x1a1)+_0x4c4dc9[_0xe2036a(0x152)][_0xe2036a(0x170)]+'\x27'),_0xae3c89[_0xe2036a(0x124)]++;else _0x12e930[_0xe2036a(0x171)]===_0xe2036a(0x189)&&(_0x181290[_0xe2036a(0xe5)]?.({'type':'journey_updated','name':_0x4c4dc9[_0xe2036a(0x152)][_0xe2036a(0x170)]}),_0x181290['logSuccess']?.(_0xe2036a(0x135)+_0x4c4dc9[_0xe2036a(0x152)]['name']+'\x27'),_0xae3c89[_0xe2036a(0x189)]++);return{'action':_0x12e930['action'],'name':_0x4c4dc9[_0xe2036a(0x152)][_0xe2036a(0x170)],'journeyId':_0x12e930['journeyId']};}catch(_0x4f9e63){const _0x55dd39=isHttp400Error(_0x4f9e63),_0x274cf0=_0x55dd39?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0xe2036a(0x16f)],_0x269fc0=getErrorMessage(_0x4f9e63);throw new SDKError(_0x274cf0,_0xe2036a(0x115)+(_0x4c4dc9[_0xe2036a(0x1c4)]?'create':_0xe2036a(0xfd))+_0xe2036a(0x1a6)+_0x4c4dc9[_0xe2036a(0x139)]+_0xe2036a(0x12c)+_0x269fc0,_0x4f9e63);}}));_0xae3c89[_0x48985e(0x19b)][_0x48985e(0x164)](..._0x3218a9);}return _0xae3c89;}async function matchExistingJourneySegments(_0x5ad924,_0x89bf2a,_0x58d4cf,_0x145c7c,_0xa23727){const _0x273bfe=a168_0x5cf043;if(!_0x89bf2a['existingJourney']||!_0x89bf2a[_0x273bfe(0x152)][_0x273bfe(0x17e)])return;const _0x37b815=new Map(),_0x5af66d=new Set();for(const _0x47b835 of Object[_0x273bfe(0x147)](_0x89bf2a[_0x273bfe(0x152)][_0x273bfe(0x17e)])){const _0x5d90e6=generateDeterministicJourneySegmentName(_0x89bf2a['yamlConfig'][_0x273bfe(0x170)],_0x47b835);_0x37b815['set'](_0x5d90e6,_0x47b835),_0x5af66d['add'](_0x47b835);}const _0x112a5a=[],_0x4900f3=collectSegmentIdsFromJourneyApi(_0x89bf2a[_0x273bfe(0xf9)]);for(const _0x4491d8 of _0x4900f3){const _0x1d692d=await fetchSegment(_0x5ad924,_0x58d4cf,_0x4491d8,_0x145c7c);if(!_0x1d692d?.[_0x273bfe(0x170)])continue;const _0x417253=_0x37b815[_0x273bfe(0x11e)](_0x1d692d['name']);_0x417253?(_0xa23727[_0x273bfe(0x1ce)](_0x417253,_0x4491d8),_0x5af66d[_0x273bfe(0xdf)](_0x417253)):_0x112a5a[_0x273bfe(0x164)]({'id':_0x4491d8,'seg':_0x1d692d});}if(_0x5af66d[_0x273bfe(0x1ca)]>0x0&&_0x112a5a[_0x273bfe(0xdc)]>0x0){const {localExpandedRuleToNames:_0x14d7c6}=buildLocalExpandedRuleMappings(_0x89bf2a['yamlConfig']),_0x4782aa=new Map();for(const {id:_0x4c5ce5,seg:_0x5a25e9}of _0x112a5a){if(_0x5a25e9[_0x273bfe(0x116)]){const _0x357695=apiRuleToYaml(_0x5a25e9['rule']);_0x4782aa[_0x273bfe(0x1ce)](_0x4c5ce5,_0x357695);}}for(const {id:_0x1497e7,seg:_0xa97560}of _0x112a5a){if(!_0xa97560[_0x273bfe(0x116)])continue;const _0x123799=_0x4782aa[_0x273bfe(0x11e)](_0x1497e7);if(!_0x123799)continue;const _0x4b8d5f=serializeExpandedRule(_0x123799,_0x4782aa),_0x33c563=_0x14d7c6[_0x273bfe(0x11e)](_0x4b8d5f);if(_0x33c563){const _0x304216=_0x33c563[_0x273bfe(0x11b)](_0x397965=>_0x5af66d['has'](_0x397965));_0x304216&&(_0xa23727[_0x273bfe(0x1ce)](_0x304216,_0x1497e7),_0x5af66d['delete'](_0x304216),logger[_0x273bfe(0x142)](_0x273bfe(0x184)+_0xa97560[_0x273bfe(0x170)]+_0x273bfe(0x151)+_0x304216+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0xc19731,_0x3bc658,_0x413b01,_0x24202e,_0x1cf7fd,_0x5da938){const _0x333a62=a168_0x5cf043,{journeyDefToRequest:_0x52dcc6,activationDefToCreateRequest:_0x48ee5f,yamlRuleToApi:_0xbcc4d8,validateSegmentRule:_0x430093}=_0x5da938,_0xc32e38=new Map(),_0x45ca67=new Map();recoverSegmentIdsFromPushRecovery(_0x3bc658,_0xc32e38,_0x413b01[_0x333a62(0x18a)]);const _0x3a75cd=new Map(),_0x566e5b=new Map(),_0x3c7771=new Map();let _0x46643c;const _0x112ba8=async()=>{const _0x4b4110=_0x333a62;if(_0x46643c)return;_0x46643c=new Map();if(!_0x3bc658[_0x4b4110(0xf9)])return;const _0x4e12d8=await _0xc19731['journey']['listActivations'](_0x3bc658[_0x4b4110(0xf9)]['id']);for(const _0x4225f1 of _0x4e12d8){const _0x41d246=journeyActivationStepToYaml(_0x4225f1,_0x413b01['idToEmailMap'],_0x413b01[_0x4b4110(0x156)]),_0x3d3ea1=activationSignature(_0x41d246);!_0x46643c[_0x4b4110(0x15a)](_0x3d3ea1)&&_0x46643c[_0x4b4110(0x1ce)](_0x3d3ea1,_0x4225f1['id']),_0x41d246[_0x4b4110(0x170)]&&_0x45ca67['set'](_0x41d246[_0x4b4110(0x170)],_0x4225f1['id']);}};await matchExistingJourneySegments(_0xc19731,_0x3bc658,_0x24202e[_0x333a62(0x180)],_0x413b01[_0x333a62(0x169)],_0x413b01[_0x333a62(0x18a)]);const _0x185d60={'resolveSegmentId':async _0x2644f9=>{const _0x13c1c3=_0x333a62,_0x145eca=_0x413b01[_0x13c1c3(0x18a)][_0x13c1c3(0x11e)](_0x2644f9);if(!_0x145eca)throw new SDKError(ErrorCode[_0x13c1c3(0xeb)],_0x13c1c3(0x14f)+_0x2644f9+'\x20(referenced\x20in\x20journey\x20'+_0x3bc658[_0x13c1c3(0x152)]['name']+')');return _0x145eca;},'resolveEmbeddedSegmentId':async(_0x267ae5,_0x200a4a)=>{const _0x26e0e4=_0x333a62,_0xf7be2e=_0x413b01[_0x26e0e4(0x18a)][_0x26e0e4(0x11e)](_0x267ae5);if(_0xf7be2e)return _0xf7be2e;const _0x5a18e7=_0x413b01[_0x26e0e4(0x169)][_0x26e0e4(0x11b)](_0x2054dc=>_0x2054dc['name']===_0x267ae5);if(_0x5a18e7)return _0x413b01[_0x26e0e4(0x18a)]['set'](_0x267ae5,_0x5a18e7['id']),_0x5a18e7['id'];if(_0x3bc658[_0x26e0e4(0x1c4)]){const {stageName:_0x185227,criteriaName:_0x4e123c}=findSegmentCriteriaLocation(_0x3bc658[_0x26e0e4(0x152)],_0x267ae5);return _0x430093(_0x267ae5,_0x200a4a[_0x26e0e4(0x116)]),_0x566e5b[_0x26e0e4(0x1ce)](_0x267ae5,{'definition':_0x200a4a,'stageName':_0x185227,'criteriaName':_0x4e123c}),createPendingSegmentId(_0x267ae5);}const _0x27f043=_0x3bc658[_0x26e0e4(0xf9)]?.['id'];if(!_0x27f043)throw new SDKError(ErrorCode[_0x26e0e4(0x1ae)],_0x26e0e4(0x17a));const _0x21699d=_0x3a75cd['get'](_0x267ae5);if(_0x21699d)return _0x21699d;const _0xce3757=((async()=>{const _0x6fb576=_0x26e0e4;_0x430093(_0x267ae5,_0x200a4a[_0x6fb576(0x116)]);const _0x101176=generateDeterministicJourneySegmentName(_0x3bc658[_0x6fb576(0x152)][_0x6fb576(0x170)],_0x267ae5),_0x44ef34=_0x413b01[_0x6fb576(0x169)][_0x6fb576(0x11b)](_0xfb5560=>_0xfb5560[_0x6fb576(0x170)]===_0x101176),_0xeb5dd9=createSegmentIdResolver(_0x413b01[_0x6fb576(0x18a)],_0x267ae5),_0x1e9051=await resolveRuleSegmentIds(_0x200a4a['rule'],_0xeb5dd9);let _0x40a05c;return _0x44ef34?(await _0xc19731[_0x6fb576(0x160)][_0x6fb576(0xff)](_0x24202e[_0x6fb576(0x180)],_0x44ef34['id'],{'description':_0x200a4a[_0x6fb576(0x1cb)]||_0x6fb576(0x161)+_0x267ae5,'rule':_0xbcc4d8(_0x1e9051),'countPopulation':!![]}),_0x40a05c=_0x44ef34['id'],saveSegmentToPushRecovery(_0x3bc658['absolutePath'],_0x3bc658[_0x6fb576(0x152)][_0x6fb576(0x170)],_0x267ae5,{'segmentId':_0x40a05c,'uniqueServerName':_0x101176,'createdAt':new Date()[_0x6fb576(0x143)]()})):_0x40a05c=await createOrRecoverEmbeddedSegment(_0xc19731,_0x3bc658,{'localName':_0x267ae5,'uniqueSegmentName':_0x101176,'description':_0x200a4a[_0x6fb576(0x1cb)]||_0x6fb576(0x161)+_0x267ae5,'journeyId':_0x27f043,'resolvedRule':_0x1e9051,'parentId':_0x24202e[_0x6fb576(0x180)],'folderId':_0x24202e[_0x6fb576(0x165)]||''},_0xbcc4d8),_0x413b01[_0x6fb576(0x18a)]['set'](_0x267ae5,_0x40a05c),_0xc32e38[_0x6fb576(0x1ce)](_0x267ae5,_0x40a05c),_0x40a05c;})());_0x3a75cd[_0x26e0e4(0x1ce)](_0x267ae5,_0xce3757);try{return await _0xce3757;}finally{_0x3a75cd[_0x26e0e4(0xdf)](_0x267ae5);}},'resolveActivationId':async _0x91ca1=>{const _0x4dcc8b=_0x333a62,_0x274bac=_0x45ca67[_0x4dcc8b(0x11e)](_0x91ca1);if(_0x274bac)return _0x274bac;if(_0x3bc658[_0x4dcc8b(0xf9)]){await _0x112ba8();const _0x5596ac=_0x45ca67[_0x4dcc8b(0x11e)](_0x91ca1);if(_0x5596ac)return _0x5596ac;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x91ca1+_0x4dcc8b(0x1c6)+_0x3bc658[_0x4dcc8b(0x152)][_0x4dcc8b(0x170)]+').\x20'+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x3c11e9,_0x18a38e)=>{const _0xa8b82=_0x333a62,_0x57fa16=_0x45ca67[_0xa8b82(0x11e)](_0x3c11e9);if(_0x57fa16)return _0x57fa16;if(_0x3bc658[_0xa8b82(0x1c4)])return _0x3c7771[_0xa8b82(0x1ce)](_0x3c11e9,_0x18a38e),createPendingActivationId(_0x3c11e9);if(_0x3bc658['existingJourney']){await _0x112ba8();const _0x1d6b93=_0x45ca67[_0xa8b82(0x11e)](_0x18a38e[_0xa8b82(0x170)]);if(_0x1d6b93)return _0x45ca67[_0xa8b82(0x1ce)](_0x3c11e9,_0x1d6b93),_0x1d6b93;const _0x31fdb6=activationSignature(_0x18a38e),_0x7cdf64=_0x46643c?.[_0xa8b82(0x11e)](_0x31fdb6);if(_0x7cdf64)return _0x45ca67[_0xa8b82(0x1ce)](_0x3c11e9,_0x7cdf64),_0x7cdf64;const _0x4436c9=await _0x48ee5f(_0x18a38e,_0x413b01[_0xa8b82(0xe3)]),_0x155427={..._0x4436c9,..._0x18a38e[_0xa8b82(0x1b2)]!==undefined&&{'runAfterJourneyRefresh':_0x18a38e['run_after_journey_refresh']}},_0x6d3e2b=await _0xc19731[_0xa8b82(0x12b)][_0xa8b82(0x1d7)](_0x3bc658[_0xa8b82(0xf9)]['id'],_0x155427);return _0x45ca67[_0xa8b82(0x1ce)](_0x3c11e9,_0x6d3e2b['id']),_0x6d3e2b['id'];}throw new SDKError(ErrorCode[_0xa8b82(0x1ae)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x39ef11=>{const _0x44157d=_0x333a62;try{return await _0xc19731[_0x44157d(0x12b)][_0x44157d(0xe4)](_0x24202e['parentId'],_0x39ef11);}catch(_0x3e747f){throw new SDKError(ErrorCode[_0x44157d(0x12f)],_0x44157d(0x17d)+_0x39ef11+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x3bc658['yamlConfig'][_0x44157d(0x170)]+'\x27)',_0x3e747f);}},'resolveStageId':async(_0x112433,_0x5c5c45)=>{const _0x6083b=_0x333a62,_0x1be62f=await _0xc19731[_0x6083b(0x12b)][_0x6083b(0x167)](_0x112433),_0x474911=_0x1be62f['attributes'][_0x6083b(0x19e)][_0x6083b(0x11b)](_0x500c39=>_0x500c39['name']['toLowerCase']()===_0x5c5c45[_0x6083b(0x123)]());if(!_0x474911?.['id'])throw new SDKError(ErrorCode[_0x6083b(0x12f)],_0x6083b(0x132)+_0x5c5c45+_0x6083b(0xf0)+(_0x1be62f[_0x6083b(0x104)][_0x6083b(0x138)]||_0x1be62f[_0x6083b(0x104)][_0x6083b(0x170)])+'\x27');return _0x474911['id'];}},_0x3a9371=await _0x52dcc6(_0x3bc658[_0x333a62(0x152)],_0x24202e['parentId'],_0x185d60),_0x340f1c=_0x24202e[_0x333a62(0x15f)]||_0x24202e[_0x333a62(0x165)];_0x340f1c&&(_0x3a9371[_0x333a62(0x1d4)]={'parentFolder':{'data':{'id':_0x340f1c,'type':_0x333a62(0x106)}}});if(_0x3bc658[_0x333a62(0x1c4)]){if(_0x566e5b['size']>0x0||_0x3c7771['size']>0x0)return await executeThreeStepJourneyCreate(_0xc19731,_0x3bc658,_0x3a9371,{'pendingEmbeddedSegments':_0x566e5b,'pendingEmbeddedActivations':_0x3c7771,'embeddedSegmentNameToId':_0xc32e38,'journeyActivationNameToId':_0x45ca67},{..._0x24202e,'effectiveFolderId':_0x340f1c},_0x413b01,_0x1cf7fd,_0x5da938);else{ensureJourneyDefaults(_0x3a9371['attributes']);const _0x2d558d=await _0xc19731['journey'][_0x333a62(0x10f)](_0x3a9371);return deletePushRecovery(_0x3bc658[_0x333a62(0x139)]),{'action':'created','journeyId':_0x2d558d['id'],'embeddedSegmentNameToId':_0xc32e38};}}else{if(_0x3bc658[_0x333a62(0x1a7)]&&_0x3bc658[_0x333a62(0xf9)]){_0x3a9371['id']=_0x3bc658[_0x333a62(0xf9)]['id'];const _0xd7564b=_0x3a9371['attributes'];_0x3bc658[_0x333a62(0xf9)][_0x333a62(0x104)]?.[_0x333a62(0x138)]&&(_0xd7564b['journeyBundleName']=_0x3bc658[_0x333a62(0xf9)][_0x333a62(0x104)][_0x333a62(0x138)]);const _0xd8a934=_0x3bc658[_0x333a62(0xf9)][_0x333a62(0x104)]?.[_0x333a62(0x19e)];return _0xd8a934&&_0x3a9371[_0x333a62(0x104)][_0x333a62(0x19e)]&&injectExistingStageIds(_0x3a9371[_0x333a62(0x104)][_0x333a62(0x19e)],_0xd8a934),ensureJourneyDefaults(_0xd7564b),await _0xc19731[_0x333a62(0x12b)]['update'](_0x3bc658[_0x333a62(0xf9)]['id'],_0x3a9371),deletePushRecovery(_0x3bc658[_0x333a62(0x139)]),{'action':_0x333a62(0x189),'journeyId':_0x3bc658[_0x333a62(0xf9)]['id'],'embeddedSegmentNameToId':_0xc32e38};}}return deletePushRecovery(_0x3bc658['absolutePath']),{'action':'unchanged','journeyId':_0x3bc658[_0x333a62(0xf9)]?.['id'],'embeddedSegmentNameToId':_0xc32e38};}function findSegmentCriteriaLocation(_0x17c28a,_0x1e4171){const _0x296bb4=a168_0x5cf043,_0xaee381=_0x17c28a[_0x296bb4(0x162)]||_0x17c28a['journeys']?.[0x0]?.[_0x296bb4(0x162)]||[];let _0x2891b9=_0x296bb4(0x16b),_0x509e73=_0x1e4171;const _0x1ed0f7=_0x17c28a[_0x296bb4(0x10d)]||_0x17c28a['journeys']?.[0x0]?.[_0x296bb4(0x10d)];if(_0x1ed0f7?.['segment']===_0x1e4171)return{'stageName':_0x296bb4(0x10d),'criteriaName':_0x1ed0f7[_0x296bb4(0x170)]||_0x1e4171};_0x194a80:for(const _0x102329 of _0xaee381){if(_0x102329[_0x296bb4(0x129)]?.[_0x296bb4(0x160)]===_0x1e4171){_0x2891b9=_0x102329[_0x296bb4(0x170)],_0x509e73=_0x102329['entry_criteria'][_0x296bb4(0x170)]||_0x1e4171;break;}if(_0x102329['steps'])for(const _0x16d8a8 of _0x102329['steps']){if(_0x16d8a8[_0x296bb4(0xe9)]==='decision_point'&&_0x16d8a8[_0x296bb4(0x13a)]?.[_0x296bb4(0x100)])for(const _0x4671c8 of _0x16d8a8[_0x296bb4(0x13a)]['branches']){if(_0x4671c8[_0x296bb4(0x160)]===_0x1e4171){_0x2891b9=_0x102329[_0x296bb4(0x170)],_0x509e73=_0x4671c8['name']||_0x1e4171;break _0x194a80;}}}}return{'stageName':_0x2891b9,'criteriaName':_0x509e73};}async function executeThreeStepJourneyCreate(_0x34248c,_0x24800,_0x1a102c,_0x6150c0,_0x4f4b19,_0x35f6b5,_0x13a189,_0x804d80){const _0x1c3faa=a168_0x5cf043,{activationDefToCreateRequest:_0x106865,yamlRuleToApi:_0x1f0964}=_0x804d80,{pendingEmbeddedSegments:_0x4d2b49,pendingEmbeddedActivations:_0x2888a1,embeddedSegmentNameToId:_0xad4558}=_0x6150c0,_0x437b20=JSON['parse'](JSON['stringify'](_0x1a102c));ensureJourneyDefaults(_0x437b20[_0x1c3faa(0x104)]),stripPendingIds(_0x437b20);const _0x385c7e=await _0x34248c['journey'][_0x1c3faa(0x10f)](_0x437b20),_0x37052a=_0x385c7e['id'],_0x49e9bc=new Map();for(const _0x55b3e2 of _0x385c7e[_0x1c3faa(0x104)][_0x1c3faa(0x19e)]){_0x49e9bc[_0x1c3faa(0x1ce)](_0x55b3e2[_0x1c3faa(0x170)][_0x1c3faa(0x123)](),_0x55b3e2['id']);}recoverSegmentIdsFromPushRecovery(_0x24800,_0xad4558,_0x35f6b5['segmentNameToId']);for(const [_0x4f0e27,{definition:_0xbfccdc}]of _0x4d2b49){if(_0xad4558[_0x1c3faa(0x15a)](_0x4f0e27)){_0x13a189[_0x1c3faa(0xe5)]?.({'type':_0x1c3faa(0xea),'journeyName':_0x24800['yamlConfig'][_0x1c3faa(0x170)],'segmentName':_0x4f0e27});continue;}const _0x552838=generateDeterministicJourneySegmentName(_0x24800[_0x1c3faa(0x152)][_0x1c3faa(0x170)],_0x4f0e27);_0x13a189['onProgress']?.({'type':_0x1c3faa(0x1bc),'journeyName':_0x24800[_0x1c3faa(0x152)][_0x1c3faa(0x170)],'segmentName':_0x4f0e27});const _0x10f1c5=createSegmentIdResolver(_0x35f6b5[_0x1c3faa(0x18a)],_0x4f0e27),_0x1b44fe=await resolveRuleSegmentIds(_0xbfccdc[_0x1c3faa(0x116)],_0x10f1c5),_0xee5158=await createOrRecoverEmbeddedSegment(_0x34248c,_0x24800,{'localName':_0x4f0e27,'uniqueSegmentName':_0x552838,'description':_0xbfccdc['description']||_0x1c3faa(0x161)+_0x4f0e27,'journeyId':_0x37052a,'resolvedRule':_0x1b44fe,'parentId':_0x4f4b19[_0x1c3faa(0x180)],'folderId':_0x4f4b19[_0x1c3faa(0x1cf)]||''},_0x1f0964);_0xad4558['set'](_0x4f0e27,_0xee5158),_0x35f6b5['segmentNameToId'][_0x1c3faa(0x1ce)](_0x4f0e27,_0xee5158),_0x13a189['onProgress']?.({'type':_0x1c3faa(0xea),'journeyName':_0x24800['yamlConfig'][_0x1c3faa(0x170)],'segmentName':_0x4f0e27});}const _0x4e2123=new Map();for(const [_0x395a7f,_0x43bf29]of _0x2888a1){_0x13a189[_0x1c3faa(0xe5)]?.({'type':_0x1c3faa(0x193),'journeyName':_0x24800['yamlConfig'][_0x1c3faa(0x170)],'activationName':_0x395a7f});const _0x3598c3=await _0x106865(_0x43bf29,_0x35f6b5[_0x1c3faa(0xe3)]),_0x3ecb49={..._0x3598c3,..._0x43bf29[_0x1c3faa(0x1b2)]!==undefined&&{'runAfterJourneyRefresh':_0x43bf29[_0x1c3faa(0x1b2)]}},_0x39456b=await _0x34248c[_0x1c3faa(0x12b)][_0x1c3faa(0x1d7)](_0x37052a,_0x3ecb49);_0x4e2123[_0x1c3faa(0x1ce)](_0x395a7f,_0x39456b['id']),_0x6150c0[_0x1c3faa(0x181)]['set'](_0x395a7f,_0x39456b['id']),_0x13a189[_0x1c3faa(0xe5)]?.({'type':'embedded_activation_created','journeyName':_0x24800[_0x1c3faa(0x152)][_0x1c3faa(0x170)],'activationName':_0x395a7f});}const _0x4d1fe4=JSON['parse'](JSON[_0x1c3faa(0x10b)](_0x1a102c));return _0x4d1fe4['id']=_0x37052a,ensureJourneyDefaults(_0x4d1fe4[_0x1c3faa(0x104)]),resolvePendingIdsInRequest(_0x4d1fe4,_0x1a102c,_0x49e9bc,_0xad4558,_0x4e2123,_0x13a189),await _0x34248c[_0x1c3faa(0x12b)][_0x1c3faa(0xfd)](_0x37052a,_0x4d1fe4),deletePushRecovery(_0x24800['absolutePath']),{'action':_0x1c3faa(0x124),'journeyId':_0x37052a,'embeddedSegmentNameToId':_0xad4558};}export function stripWaitStepPendingIds(_0x80f659){const _0x53b4c6=a168_0x5cf043,_0x443e57=_0x80f659['conditionSegmentId']&&isPendingSegmentId(_0x80f659[_0x53b4c6(0x128)]),_0x96ea5f=_0x80f659[_0x53b4c6(0x187)]?.[_0x53b4c6(0x176)](_0x257d69=>_0x257d69['segmentId']&&isPendingSegmentId(_0x257d69[_0x53b4c6(0x14b)]));(_0x443e57||_0x96ea5f)&&(_0x80f659[_0x53b4c6(0xe8)]=_0x53b4c6(0x1d1),_0x80f659[_0x53b4c6(0xde)]=0x1,_0x80f659[_0x53b4c6(0x1be)]='day',delete _0x80f659['conditionSegmentId'],delete _0x80f659['conditionTimeoutDuration'],delete _0x80f659[_0x53b4c6(0xf1)],delete _0x80f659['conditions']);}export function resolveWaitStepPendingIds(_0x3d7d87,_0x124e77,_0x317238,_0x205af2){const _0x245a9f=a168_0x5cf043;if(_0x124e77['conditionSegmentId']&&isPendingSegmentId(_0x124e77[_0x245a9f(0x128)])){const _0x733a08=_0x317238(_0x124e77[_0x245a9f(0x128)],_0x245a9f(0xe7)+_0x205af2+'\x27\x20wait\x20condition');_0x733a08&&(_0x3d7d87['waitStepType']='Condition',_0x3d7d87[_0x245a9f(0x128)]=_0x733a08,delete _0x3d7d87[_0x245a9f(0xde)],delete _0x3d7d87['waitStepUnit'],_0x124e77[_0x245a9f(0x125)]!==undefined&&(_0x3d7d87[_0x245a9f(0x125)]=_0x124e77[_0x245a9f(0x125)]),_0x124e77[_0x245a9f(0xf1)]&&(_0x3d7d87[_0x245a9f(0xf1)]=_0x124e77[_0x245a9f(0xf1)]));}if(_0x124e77[_0x245a9f(0x187)]){const _0x504f91=_0x124e77[_0x245a9f(0x187)][_0x245a9f(0x176)](_0x272d3f=>_0x272d3f['segmentId']&&isPendingSegmentId(_0x272d3f[_0x245a9f(0x14b)]));if(_0x504f91){const _0x4ebd95=_0x124e77[_0x245a9f(0x187)]['map'](_0x4b3445=>{const _0x9d9c40=_0x245a9f;if(_0x4b3445[_0x9d9c40(0x14b)]&&isPendingSegmentId(_0x4b3445['segmentId'])){const _0x1908a0=_0x317238(_0x4b3445[_0x9d9c40(0x14b)],'stage\x20\x27'+_0x205af2+_0x9d9c40(0x105));return{..._0x4b3445,'segmentId':_0x1908a0||_0x4b3445[_0x9d9c40(0x14b)]};}return{..._0x4b3445};});_0x3d7d87['waitStepType']=_0x245a9f(0x186),_0x3d7d87[_0x245a9f(0x187)]=_0x4ebd95,delete _0x3d7d87['waitStep'],delete _0x3d7d87['waitStepUnit'],delete _0x3d7d87['conditionSegmentId'],delete _0x3d7d87[_0x245a9f(0x125)],delete _0x3d7d87[_0x245a9f(0xf1)];}}}function stripPendingIds(_0x132bc8){const _0x1254ef=a168_0x5cf043;_0x132bc8[_0x1254ef(0x104)][_0x1254ef(0x10d)]?.[_0x1254ef(0x14b)]&&isPendingSegmentId(_0x132bc8[_0x1254ef(0x104)]['goal']['segmentId'])&&delete _0x132bc8[_0x1254ef(0x104)][_0x1254ef(0x10d)];for(const _0x5afe6e of _0x132bc8['attributes']['journeyStages']||[]){_0x5afe6e[_0x1254ef(0x185)]?.[_0x1254ef(0x14b)]&&isPendingSegmentId(_0x5afe6e[_0x1254ef(0x185)]['segmentId'])&&delete _0x5afe6e[_0x1254ef(0x185)];_0x5afe6e[_0x1254ef(0x1c7)]?.['segmentId']&&isPendingSegmentId(_0x5afe6e[_0x1254ef(0x1c7)][_0x1254ef(0x14b)])&&delete _0x5afe6e[_0x1254ef(0x1c7)];_0x5afe6e[_0x1254ef(0xdd)]&&(_0x5afe6e['exitCriterias']=_0x5afe6e['exitCriterias'][_0x1254ef(0x112)](_0x283c04=>!_0x283c04[_0x1254ef(0x14b)]||!isPendingSegmentId(_0x283c04[_0x1254ef(0x14b)])));if(_0x5afe6e[_0x1254ef(0x121)])for(const _0x2d7abe of Object[_0x1254ef(0x147)](_0x5afe6e[_0x1254ef(0x121)])){const _0x4d1db7=_0x5afe6e['steps'][_0x2d7abe];_0x4d1db7[_0x1254ef(0xe9)]===_0x1254ef(0x1ab)&&_0x4d1db7['journeyActivationStepId']&&isPendingActivationId(_0x4d1db7['journeyActivationStepId'])&&(_0x4d1db7[_0x1254ef(0x16e)]='');if(_0x4d1db7[_0x1254ef(0xe9)]==='DecisionPoint'&&_0x4d1db7[_0x1254ef(0x100)])for(const _0x115b68 of _0x4d1db7[_0x1254ef(0x100)]){_0x115b68[_0x1254ef(0x14b)]&&isPendingSegmentId(_0x115b68[_0x1254ef(0x14b)])&&(_0x115b68[_0x1254ef(0x14b)]='');}_0x4d1db7[_0x1254ef(0xe9)]==='WaitStep'&&stripWaitStepPendingIds(_0x4d1db7);}}}function resolvePendingIdsInRequest(_0x732e8e,_0x18ba14,_0x59cd0b,_0x4957fd,_0x23459a,_0x4db761){const _0x4b43d3=a168_0x5cf043,_0x42539f=(_0x5e7b37,_0x223c71)=>{const _0x4201aa=a168_0x51ba;if(!isPendingSegmentId(_0x5e7b37))return _0x5e7b37;const _0x486737=extractPendingSegmentName(_0x5e7b37),_0x30f2ba=_0x4957fd[_0x4201aa(0x11e)](_0x486737);return!_0x30f2ba&&_0x4db761[_0x4201aa(0x1c3)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x486737+'\x27\x20for\x20'+_0x223c71),_0x30f2ba;};if(_0x732e8e[_0x4b43d3(0x104)][_0x4b43d3(0x10d)]?.[_0x4b43d3(0x14b)]&&isPendingSegmentId(_0x732e8e[_0x4b43d3(0x104)][_0x4b43d3(0x10d)]['segmentId'])){const _0x2bae5e=_0x42539f(_0x732e8e[_0x4b43d3(0x104)][_0x4b43d3(0x10d)][_0x4b43d3(0x14b)],_0x4b43d3(0x103));_0x2bae5e&&(_0x732e8e[_0x4b43d3(0x104)][_0x4b43d3(0x10d)][_0x4b43d3(0x14b)]=_0x2bae5e);}for(const _0x334e99 of _0x732e8e[_0x4b43d3(0x104)][_0x4b43d3(0x19e)]||[]){const _0x37f7bb=_0x59cd0b[_0x4b43d3(0x11e)](_0x334e99[_0x4b43d3(0x170)][_0x4b43d3(0x123)]());_0x37f7bb&&(_0x334e99['id']=_0x37f7bb);if(_0x334e99['entryCriteria']?.[_0x4b43d3(0x14b)]&&isPendingSegmentId(_0x334e99[_0x4b43d3(0x185)][_0x4b43d3(0x14b)])){const _0x478a58=_0x42539f(_0x334e99[_0x4b43d3(0x185)][_0x4b43d3(0x14b)],_0x4b43d3(0xe7)+_0x334e99[_0x4b43d3(0x170)]+_0x4b43d3(0x1aa));_0x478a58&&(_0x334e99[_0x4b43d3(0x185)]['segmentId']=_0x478a58);}if(_0x334e99[_0x4b43d3(0xdd)])for(const _0x3e00ba of _0x334e99['exitCriterias']){if(_0x3e00ba[_0x4b43d3(0x14b)]&&isPendingSegmentId(_0x3e00ba[_0x4b43d3(0x14b)])){const _0x45b5c9=_0x42539f(_0x3e00ba[_0x4b43d3(0x14b)],_0x4b43d3(0xe7)+_0x334e99[_0x4b43d3(0x170)]+_0x4b43d3(0x153));_0x45b5c9&&(_0x3e00ba['segmentId']=_0x45b5c9);}}if(_0x334e99[_0x4b43d3(0x1c7)]?.[_0x4b43d3(0x14b)]&&isPendingSegmentId(_0x334e99[_0x4b43d3(0x1c7)][_0x4b43d3(0x14b)])){const _0x37a6a8=_0x42539f(_0x334e99[_0x4b43d3(0x1c7)][_0x4b43d3(0x14b)],_0x4b43d3(0xe7)+_0x334e99[_0x4b43d3(0x170)]+_0x4b43d3(0x11d));_0x37a6a8&&(_0x334e99[_0x4b43d3(0x1c7)][_0x4b43d3(0x14b)]=_0x37a6a8);}if(_0x334e99['steps']){const _0x4725f8=_0x9105de=>_0x18ba14[_0x4b43d3(0x104)][_0x4b43d3(0x19e)]?.[_0x4b43d3(0x11b)](_0x19902b=>_0x19902b[_0x4b43d3(0x170)][_0x4b43d3(0x123)]()===_0x334e99[_0x4b43d3(0x170)][_0x4b43d3(0x123)]())?.[_0x4b43d3(0x121)]?.[_0x9105de];for(const _0x465a38 of Object[_0x4b43d3(0x147)](_0x334e99[_0x4b43d3(0x121)])){const _0x5bc473=_0x334e99['steps'][_0x465a38],_0x3f9de3=_0x4725f8(_0x465a38);if(_0x5bc473['type']===_0x4b43d3(0x1ab)&&_0x5bc473[_0x4b43d3(0x16e)]&&(isPendingActivationId(_0x5bc473['journeyActivationStepId'])||_0x5bc473['journeyActivationStepId']==='')){if(_0x3f9de3?.[_0x4b43d3(0x16e)]&&isPendingActivationId(_0x3f9de3[_0x4b43d3(0x16e)])){const _0x3e12c4=extractPendingActivationName(_0x3f9de3[_0x4b43d3(0x16e)]),_0x3229d7=_0x23459a[_0x4b43d3(0x11e)](_0x3e12c4);_0x3229d7&&(_0x5bc473[_0x4b43d3(0x16e)]=_0x3229d7);}}if(_0x5bc473['type']===_0x4b43d3(0x1a5)&&_0x5bc473[_0x4b43d3(0x100)]&&_0x3f9de3?.[_0x4b43d3(0x100)])for(let _0x5471b8=0x0;_0x5471b8<_0x5bc473[_0x4b43d3(0x100)][_0x4b43d3(0xdc)];_0x5471b8++){const _0x485585=_0x5bc473[_0x4b43d3(0x100)][_0x5471b8],_0x5c92d0=_0x3f9de3[_0x4b43d3(0x100)][_0x5471b8];if(_0x5c92d0?.['segmentId']&&isPendingSegmentId(_0x5c92d0['segmentId'])){const _0x205371=_0x42539f(_0x5c92d0['segmentId'],_0x4b43d3(0xe7)+_0x334e99[_0x4b43d3(0x170)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x485585[_0x4b43d3(0x170)]||_0x5471b8)+'\x27');_0x205371&&(_0x485585[_0x4b43d3(0x14b)]=_0x205371);}}_0x5bc473['type']===_0x4b43d3(0x119)&&_0x3f9de3?.['type']==='WaitStep'&&resolveWaitStepPendingIds(_0x5bc473,_0x3f9de3,_0x42539f,_0x334e99[_0x4b43d3(0x170)]);}}}}
1
+ const a169_0x1f83a4=a169_0x4225;(function(_0xa80314,_0x45288){const _0x41ac02=a169_0x4225,_0x19bbd0=_0xa80314();while(!![]){try{const _0x3d0132=parseInt(_0x41ac02(0x289))/0x1*(-parseInt(_0x41ac02(0x2b8))/0x2)+parseInt(_0x41ac02(0x25e))/0x3*(-parseInt(_0x41ac02(0x1da))/0x4)+-parseInt(_0x41ac02(0x1d6))/0x5*(-parseInt(_0x41ac02(0x2bc))/0x6)+-parseInt(_0x41ac02(0x27e))/0x7+parseInt(_0x41ac02(0x280))/0x8+parseInt(_0x41ac02(0x27c))/0x9+parseInt(_0x41ac02(0x1d8))/0xa;if(_0x3d0132===_0x45288)break;else _0x19bbd0['push'](_0x19bbd0['shift']());}catch(_0x3f5147){_0x19bbd0['push'](_0x19bbd0['shift']());}}}(a169_0xcd17,0x41d5a));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a169_0x1f83a4(0x1dc);export const PENDING_ACTIVATION_PREFIX=a169_0x1f83a4(0x28e);export function createPendingSegmentId(_0x937ec8){return''+PENDING_SEGMENT_PREFIX+_0x937ec8+'__';}export function isPendingSegmentId(_0xc1ce04){const _0x4ff73b=a169_0x1f83a4;return _0xc1ce04[_0x4ff73b(0x28b)](PENDING_SEGMENT_PREFIX)&&!_0xc1ce04['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x25f95e){const _0x56532a=a169_0x1f83a4;return _0x25f95e[_0x56532a(0x251)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x2403e0){return''+PENDING_ACTIVATION_PREFIX+_0x2403e0+'__';}export function isPendingActivationId(_0x56197e){const _0x2dba9e=a169_0x1f83a4;return _0x56197e[_0x2dba9e(0x28b)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x74a5b9){const _0x29d010=a169_0x1f83a4;return _0x74a5b9[_0x29d010(0x251)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1eff10,_0x27792d){const _0x1a8375=a169_0x1f83a4,_0x439e56=_0x1eff10+'::'+(_0x27792d[_0x1a8375(0x20d)]()||'segment'),_0x1d4a0e=createHash(_0x1a8375(0x2a0))[_0x1a8375(0x211)](_0x439e56)[_0x1a8375(0x245)]('hex')['slice'](0x0,0xc);return _0x1a8375(0x23b)+_0x1d4a0e;}export function ensureJourneyDefaults(_0x39abd8){const _0x1978b7=a169_0x1f83a4;!_0x39abd8[_0x1978b7(0x2b0)]&&(_0x39abd8[_0x1978b7(0x2b0)]=''),!_0x39abd8[_0x1978b7(0x2bf)]&&(_0x39abd8[_0x1978b7(0x2bf)]=_0x1978b7(0x283));}export function injectExistingStageIds(_0x48b31a,_0x28820d){const _0x5c2476=a169_0x1f83a4,_0x597839=new Map(_0x28820d[_0x5c2476(0x257)](_0x42d561=>[_0x42d561[_0x5c2476(0x1ed)],_0x42d561['id']]));for(const _0x522ab5 of _0x48b31a){if(!_0x522ab5['id']){const _0x29a7b7=_0x597839[_0x5c2476(0x272)](_0x522ab5['name']);_0x29a7b7&&(_0x522ab5['id']=_0x29a7b7);}}}export function resolveTDFolderPath(_0x4f0c8c,_0x51739e,_0x304c35){const _0xceb68b=a169_0x1f83a4;if(!_0x51739e)return _0x4f0c8c;if(_0x4f0c8c===_0x304c35||_0x4f0c8c[_0xceb68b(0x28b)](_0x304c35+'/'))return _0x4f0c8c;return _0x4f0c8c?_0x304c35+'/'+_0x4f0c8c:_0x304c35;}export function addFoldersToCreate(_0x2b3028,_0x237991,_0x390818){const _0x5f6ee2=a169_0x1f83a4;if(!_0x2b3028)return;if(_0x237991[_0x5f6ee2(0x230)](_0x2b3028))return;const _0x187dea=_0x2b3028['split']('/');let _0x234c78='';for(const _0x42aa2d of _0x187dea){_0x234c78=_0x234c78?_0x234c78+'/'+_0x42aa2d:_0x42aa2d,!_0x237991[_0x5f6ee2(0x230)](_0x234c78)&&_0x390818[_0x5f6ee2(0x29a)](_0x234c78);}}export function sortFoldersByDepth(_0x49f27d){return[..._0x49f27d]['sort']((_0x3bf5e3,_0x143f78)=>{const _0x5845cf=a169_0x4225,_0x15a515=(_0x3bf5e3[_0x5845cf(0x2b1)](/\//g)||[])['length'],_0x22084d=(_0x143f78['match'](/\//g)||[])[_0x5845cf(0x2cf)];return _0x15a515-_0x22084d;});}import*as a169_0x65009a from'yaml';import{readFileSync}from'fs';import a169_0x458f55 from'path';import{isJourneyDef,parseYamlString as a169_0x361d77,toYamlString as a169_0x20519e,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(_0x17e400){const _0x502f34=a169_0x1f83a4;if(Array[_0x502f34(0x26b)](_0x17e400))return'['+_0x17e400['map'](_0x577431=>stableStringify(_0x577431))[_0x502f34(0x212)](',')+']';if(_0x17e400&&typeof _0x17e400==='object'){const _0x3133d2=_0x17e400,_0x249ea1=Object['keys'](_0x3133d2)['sort'](),_0x2c9f2e=_0x249ea1['map'](_0x1cc95d=>'\x22'+_0x1cc95d+'\x22:'+stableStringify(_0x3133d2[_0x1cc95d]));return'{'+_0x2c9f2e[_0x502f34(0x212)](',')+'}';}const _0x54d3e3=JSON[_0x502f34(0x203)](_0x17e400);return _0x54d3e3===undefined?'null':_0x54d3e3;}function activationSignature(_0x7226bd){const _0x451bfd=a169_0x1f83a4,_0x20d7ae={'connection':_0x7226bd['connection'],..._0x7226bd[_0x451bfd(0x265)]!==undefined&&{'all_columns':_0x7226bd[_0x451bfd(0x265)]},..._0x7226bd[_0x451bfd(0x215)]!==undefined&&{'columns':_0x7226bd[_0x451bfd(0x215)]},..._0x7226bd[_0x451bfd(0x227)]!==undefined&&{'behavior':_0x7226bd[_0x451bfd(0x227)]},..._0x7226bd[_0x451bfd(0x268)]!==undefined&&{'behaviors':_0x7226bd['behaviors']},..._0x7226bd[_0x451bfd(0x1f2)]!==undefined&&{'schedule':_0x7226bd['schedule']},..._0x7226bd[_0x451bfd(0x1e7)]!==undefined&&{'notification':_0x7226bd[_0x451bfd(0x1e7)]},..._0x7226bd[_0x451bfd(0x27f)]!==undefined&&{'connector_config':_0x7226bd[_0x451bfd(0x27f)]},..._0x7226bd[_0x451bfd(0x2cd)]!==undefined&&{'activation_template_id':_0x7226bd[_0x451bfd(0x2cd)]}};return stableStringify(_0x20d7ae);}async function fetchSegment(_0x3c3563,_0x1cbc6f,_0x2a790d,_0x54dcae){const _0x26ccda=a169_0x1f83a4,_0x26e4b3=_0x54dcae?.[_0x26ccda(0x262)](_0x5f5b4c=>_0x5f5b4c['id']===_0x2a790d);if(_0x26e4b3)return _0x26e4b3;try{return await _0x3c3563['segment'][_0x26ccda(0x1f1)](_0x1cbc6f,_0x2a790d);}catch(_0x4ec4ab){logger[_0x26ccda(0x2cb)](_0x26ccda(0x1dd)+_0x2a790d+_0x26ccda(0x22e)+_0x4ec4ab);try{return await _0x3c3563['segment'][_0x26ccda(0x291)](_0x2a790d);}catch(_0x3c5a44){return logger[_0x26ccda(0x2cb)](_0x26ccda(0x248)+_0x2a790d+':\x20'+_0x3c5a44),null;}}}function recoverSegmentIdsFromPushRecovery(_0x25a059,_0x1e47fe,_0x384bd2){const _0xdeb5b7=a169_0x1f83a4,_0x513e58=readPushRecovery(_0x25a059[_0xdeb5b7(0x1fe)]);if(_0x513e58?.['journeyName']===_0x25a059['yamlConfig'][_0xdeb5b7(0x1ed)])for(const [_0x59d070,_0x393cad]of Object[_0xdeb5b7(0x2b4)](_0x513e58['segments'])){const _0x18c9be=generateDeterministicJourneySegmentName(_0x25a059[_0xdeb5b7(0x2a8)]['name'],_0x59d070);_0x393cad[_0xdeb5b7(0x1f7)]===_0x18c9be&&(_0x1e47fe[_0xdeb5b7(0x2aa)](_0x59d070,_0x393cad[_0xdeb5b7(0x232)]),_0x384bd2['set'](_0x59d070,_0x393cad[_0xdeb5b7(0x232)]));}}async function createOrRecoverEmbeddedSegment(_0x8b667f,_0x20bd05,_0x3d51e9,_0x2450f3){const _0xc49ef=a169_0x1f83a4;let _0x57517c;try{_0x57517c=await _0x8b667f['segment'][_0xc49ef(0x2be)]({'name':_0x3d51e9[_0xc49ef(0x2c9)],'description':_0x3d51e9[_0xc49ef(0x2b0)],'journeyId':_0x3d51e9[_0xc49ef(0x2a3)],'rule':_0x2450f3(_0x3d51e9[_0xc49ef(0x263)],!![]),'countPopulation':!![],'parentFolderId':_0x3d51e9['folderId'],'audienceId':_0x3d51e9[_0xc49ef(0x2d0)]});}catch(_0x2e5256){const _0x36ec39=_0x2e5256 instanceof Error&&_0x2e5256[_0xc49ef(0x2ac)][_0xc49ef(0x279)](_0xc49ef(0x29d));if(_0x36ec39){const _0x5aed8e=readPushRecovery(_0x20bd05[_0xc49ef(0x1fe)]),_0x35a18c=_0x5aed8e?.[_0xc49ef(0x223)]===_0x20bd05[_0xc49ef(0x2a8)][_0xc49ef(0x1ed)]?_0x5aed8e[_0xc49ef(0x2ad)][_0x3d51e9['localName']]:undefined;if(_0x35a18c?.['uniqueServerName']===_0x3d51e9['uniqueSegmentName'])await _0x8b667f[_0xc49ef(0x25f)]['updateSegmentById'](_0x3d51e9['parentId'],_0x35a18c[_0xc49ef(0x232)],{'description':_0x3d51e9['description'],'rule':_0x2450f3(_0x3d51e9[_0xc49ef(0x263)],!![]),'countPopulation':!![]}),_0x57517c=_0x35a18c[_0xc49ef(0x232)];else throw new SDKError(ErrorCode[_0xc49ef(0x23e)],'Embedded\x20segment\x20\x27'+_0x3d51e9[_0xc49ef(0x2bb)]+_0xc49ef(0x254)+(_0xc49ef(0x2ba)+_0x20bd05['absolutePath']['replace'](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0xc49ef(0x210),_0x2e5256);}else throw _0x2e5256;}return saveSegmentToPushRecovery(_0x20bd05[_0xc49ef(0x1fe)],_0x20bd05[_0xc49ef(0x2a8)][_0xc49ef(0x1ed)],_0x3d51e9[_0xc49ef(0x2bb)],{'segmentId':_0x57517c,'uniqueServerName':_0x3d51e9['uniqueSegmentName'],'createdAt':new Date()[_0xc49ef(0x26e)]()}),_0x57517c;}export async function prepareSegmentFiles(_0x3396da,_0x2a02ef,_0x12396d,_0xe40b2,_0x2bd0cd){const _0x3ce172=a169_0x1f83a4,{activationDefToCreateRequest:_0x3aa558}=await import(_0x3ce172(0x231)),_0x12c07f=[],_0x181be4=new Set();for(const {yamlConfig:_0x4ec466,folderPath:_0x1f9aea,sourcePath:_0x4faeb4}of _0x3396da){const _0x1b128e=resolveTDFolderPath(_0x1f9aea,_0xe40b2,_0x2bd0cd),_0x2791fa=_0x1b128e+':'+_0x4ec466['name'],_0x21b425=_0x2a02ef[_0x3ce172(0x29b)][_0x3ce172(0x272)](_0x2791fa),_0x3ad510=_0x21b425?_0x2a02ef['activationsBySegmentId'][_0x3ce172(0x272)](_0x21b425['id'])||[]:[];addFoldersToCreate(_0x1b128e,_0x2a02ef[_0x3ce172(0x2c8)],_0x181be4);const _0x2ea39c=calculateActivationActions(_0x4ec466[_0x3ce172(0x1ea)]||[],_0x3ad510,_0x2a02ef[_0x3ce172(0x2a4)],_0x2a02ef[_0x3ce172(0x244)]);for(const _0x904b44 of _0x2ea39c){(_0x904b44[_0x3ce172(0x2bd)]==='create'||_0x904b44[_0x3ce172(0x2bd)]===_0x3ce172(0x211))&&_0x904b44['yamlActivation']&&(_0x904b44[_0x3ce172(0x221)]=await _0x3aa558(_0x904b44['yamlActivation'],_0x12396d));}const _0x3a0d4b=calculateSegmentDiff(_0x4ec466,_0x21b425,_0x3ad510,_0x2a02ef[_0x3ce172(0x2a4)],_0x2a02ef['connectionIdToNameMap']);_0x12c07f[_0x3ce172(0x20e)]({'relativePath':_0x4ec466[_0x3ce172(0x1ed)],'absolutePath':_0x4faeb4,'yamlConfig':_0x4ec466,'folderPath':_0x1b128e,'existingSegment':_0x21b425,'existingActivations':_0x3ad510,'isNew':_0x3a0d4b[_0x3ce172(0x292)],'hasChanges':_0x3a0d4b[_0x3ce172(0x20f)],'diff':_0x3a0d4b['diff'],'activationActions':_0x2ea39c});}return{'segmentFiles':_0x12c07f,'foldersToCreate':_0x181be4};}export async function prepareJourneyFiles(_0x131fe6,_0x227b3f,_0x51f2cf,_0x1e7744){const _0x54384f=a169_0x1f83a4,_0x16c2d1=[],_0x178a68=new Set();for(const {yamlConfig:_0x22a968,folderPath:_0x2b27da,sourcePath:_0x1257a0}of _0x131fe6){const _0x30fef0=resolveTDFolderPath(_0x2b27da,_0x51f2cf,_0x1e7744),_0x2efde7=_0x30fef0+':'+_0x22a968[_0x54384f(0x1ed)],_0x1eb9c6=_0x227b3f[_0x54384f(0x2b3)]['get'](_0x2efde7);let _0x238bd6,_0x31c171;if(_0x1eb9c6&&_0x1eb9c6[_0x54384f(0x2cf)]>0x0){const _0x56365e=buildLocalExpandedRuleMappings(_0x22a968),{createYamlContext:_0x2436ae,prefetchJourneySegments:_0x495fd3}=createPushYamlContextForBundle(_0x227b3f['deps'],_0x227b3f[_0x54384f(0x2d0)],_0x227b3f[_0x54384f(0x253)],_0x56365e,_0x227b3f['idToEmailMap'],_0x227b3f[_0x54384f(0x244)],_0x227b3f['activationStepsById'],_0x227b3f[_0x54384f(0x297)]);await _0x495fd3(_0x1eb9c6[_0x54384f(0x257)](_0x33767a=>_0x33767a['id']));const _0x204e5f=await _0x227b3f[_0x54384f(0x271)][_0x54384f(0x284)][_0x54384f(0x2b6)](_0x1eb9c6[0x0]['journeyBundleId']),_0x1cd984=hasMultipleVersions(_0x22a968),_0x180f76=async _0x2309c3=>{const _0x33840f=_0x54384f,_0x28bf16=_0x227b3f[_0x33840f(0x297)]?.[_0x33840f(0x272)](_0x2309c3);if(_0x28bf16)return _0x28bf16;return _0x227b3f[_0x33840f(0x299)]({'journeyId':_0x2309c3,'journeyName':_0x22a968['name'],'isMultiVersion':_0x1eb9c6['length']>0x1});};if(_0x1cd984&&_0x1eb9c6[_0x54384f(0x2cf)]>0x1){const _0xb42058=[];for(const _0x198631 of _0x1eb9c6){const _0x21c596=_0x198631[_0x54384f(0x1e8)]||0x1;_0x227b3f[_0x54384f(0x1e3)]?.[_0x54384f(0x211)](_0x54384f(0x2ca)+_0x22a968[_0x54384f(0x1ed)]+'\x20v'+_0x21c596);const _0xce2a43=await _0x180f76(_0x198631['id']),_0x1ed6d2=_0x2436ae(_0x198631['id']),_0x53d872=await journeyResponseToDef(_0xce2a43,_0x1ed6d2);_0xb42058[_0x54384f(0x20e)]({'item':_0x198631,'yaml':_0x53d872});}const _0x37a5fc=buildLocalRuleToNameMappingFromJourney(_0x22a968);_0x31c171=buildMergedJourneyDef(_0xb42058,_0x37a5fc,_0x204e5f);const _0x4d79a6=Math['max'](..._0xb42058[_0x54384f(0x257)](_0x5e30a8=>_0x5e30a8['item'][_0x54384f(0x1e8)]||0x0)),_0x3e8007=_0x1eb9c6[_0x54384f(0x262)](_0x4dcc50=>(_0x4dcc50[_0x54384f(0x1e8)]||0x0)===_0x4d79a6);_0x3e8007&&(_0x227b3f['progress']?.['update'](_0x54384f(0x2ca)+_0x22a968[_0x54384f(0x1ed)]+'\x20v'+_0x4d79a6),_0x238bd6=await _0x180f76(_0x3e8007['id']));}else{const _0x1e95ee=_0x1eb9c6[_0x1eb9c6['length']-0x1];_0x227b3f[_0x54384f(0x1e3)]?.[_0x54384f(0x211)](_0x54384f(0x2ca)+_0x22a968['name']),_0x238bd6=await _0x180f76(_0x1e95ee['id']);const _0x453228=_0x2436ae(_0x1e95ee['id']),_0x1caee1=await journeyResponseToDef(_0x238bd6,_0x453228),_0x57bc32=buildLocalRuleToNameMappingFromJourney(_0x22a968);_0x31c171=buildMergedJourneyDef([{'item':_0x1e95ee,'yaml':_0x1caee1}],_0x57bc32,_0x204e5f);}}addFoldersToCreate(_0x30fef0,_0x227b3f[_0x54384f(0x2c8)],_0x178a68);const _0x55bed8=calculateJourneyDiff(_0x22a968,_0x31c171);_0x16c2d1[_0x54384f(0x20e)]({'relativePath':_0x22a968[_0x54384f(0x1ed)],'absolutePath':_0x1257a0,'yamlConfig':_0x22a968,'folderPath':_0x30fef0,'existingJourney':_0x238bd6,'isNew':_0x55bed8[_0x54384f(0x292)],'hasChanges':_0x55bed8[_0x54384f(0x20f)],'diff':_0x55bed8[_0x54384f(0x1fc)]});}return{'journeyFiles':_0x16c2d1,'foldersToCreate':_0x178a68};}export function calculateActivationActions(_0x52572f,_0x39270c,_0x552c7a,_0x43bc2f){const _0x41b150=a169_0x1f83a4,_0x2a29cf=[],_0x1ad7d5=new Map();for(const _0x177cd5 of _0x39270c){_0x1ad7d5[_0x41b150(0x2aa)](_0x177cd5['name'],_0x177cd5);}const _0x3afdfa=new Map();for(const _0x5aacb1 of _0x52572f){_0x3afdfa[_0x41b150(0x2aa)](_0x5aacb1[_0x41b150(0x1ed)],_0x5aacb1);}for(const _0x29c7f8 of _0x52572f){const _0x4f4d7d=_0x1ad7d5['get'](_0x29c7f8[_0x41b150(0x1ed)]);if(!_0x4f4d7d)_0x2a29cf[_0x41b150(0x20e)]({'type':_0x41b150(0x202),'name':_0x29c7f8[_0x41b150(0x1ed)],'yamlActivation':_0x29c7f8});else{const _0x1147bc=activationResponseToDef(_0x4f4d7d,_0x552c7a,_0x43bc2f),_0x42b8c9=a169_0x65009a[_0x41b150(0x203)](_0x1147bc),_0x12de6=a169_0x65009a[_0x41b150(0x203)](_0x29c7f8);_0x42b8c9!==_0x12de6&&_0x2a29cf[_0x41b150(0x20e)]({'type':_0x41b150(0x211),'name':_0x29c7f8['name'],'yamlActivation':_0x29c7f8,'existingActivation':_0x4f4d7d});}}for(const _0xd5a89c of _0x39270c){!_0x3afdfa['has'](_0xd5a89c[_0x41b150(0x1ed)])&&_0x2a29cf[_0x41b150(0x20e)]({'type':_0x41b150(0x1f8),'name':_0xd5a89c[_0x41b150(0x1ed)],'existingActivation':_0xd5a89c});}return _0x2a29cf;}function calculateYamlDiff(_0x37191a,_0x1f40d8){if(_0x1f40d8){const _0x23d3b=generateDiff(_0x1f40d8,_0x37191a),_0xcd4b73=hasChanges(_0x23d3b);return{'isNew':![],'hasChanges':_0xcd4b73,'diff':_0xcd4b73?formatDiffWithColors(_0x23d3b):undefined};}const _0x259a7c=generateDiff('',_0x37191a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x259a7c)};}export function calculateSegmentDiff(_0x4565b7,_0x10a62b,_0x450e36,_0x2ea609,_0x418eef){const _0x1e1adb=segmentToYamlString(_0x4565b7),_0x492e26=_0x10a62b?segmentToYamlString(segmentWithActivationsToYaml(_0x10a62b,_0x450e36,undefined,_0x2ea609,_0x418eef)):undefined;return calculateYamlDiff(_0x1e1adb,_0x492e26);}export function calculateJourneyDiff(_0x7bbe7b,_0x272a54){const _0x5307d7=normalizeJourneyDef(_0x7bbe7b,_0x7bbe7b),_0x9d4c7f=a169_0x20519e(_0x5307d7),_0x1dd33d=_0x272a54?a169_0x20519e(normalizeJourneyDef(_0x272a54,_0x7bbe7b)):undefined;return calculateYamlDiff(_0x9d4c7f,_0x1dd33d);}export function findSegmentsToDelete(_0x310dc1,_0x1693c9,_0x4c83c0,_0xcf8f33,_0x2f3ab1){const _0x49b661=a169_0x1f83a4,_0x230bda=new Set();for(const {yamlConfig:_0xa14dba,folderPath:_0x3c7b4a}of _0x1693c9){_0x230bda[_0x49b661(0x29a)](_0x3c7b4a+':'+_0xa14dba[_0x49b661(0x1ed)]);}return _0x310dc1[_0x49b661(0x234)](_0x5de5ca=>{const _0xa1468c=_0x49b661,_0x239326=_0x5de5ca[_0xa1468c(0x27d)]?_0x4c83c0['get'](_0x5de5ca['segmentFolderId'][_0xa1468c(0x250)]())||'':'',_0xad8099=_0x239326+':'+_0x5de5ca[_0xa1468c(0x1ed)];if(_0x230bda['has'](_0xad8099))return![];if(_0x2f3ab1)return _0x239326===_0xcf8f33||_0x239326[_0xa1468c(0x28b)](_0xcf8f33+'/');return!![];});}export function findJourneysToDelete(_0x4765f8,_0x4e6ff2,_0x4dd566,_0x52d7de,_0x7c56df){const _0x42b9f3=a169_0x1f83a4,_0x5e6775=new Set();for(const {yamlConfig:_0x320cd4,folderPath:_0x2755e3}of _0x4e6ff2){_0x5e6775['add'](_0x2755e3+':'+_0x320cd4['name']);}return _0x4765f8[_0x42b9f3(0x234)](_0xd8f788=>{const _0x11e724=_0x42b9f3,_0x4f5e15=_0xd8f788[_0x11e724(0x29e)]?_0x4dd566[_0x11e724(0x272)](_0xd8f788[_0x11e724(0x29e)])||'':'',_0x4f5196=_0x4f5e15+':'+_0xd8f788[_0x11e724(0x205)];if(_0x5e6775[_0x11e724(0x230)](_0x4f5196))return![];if(_0x7c56df)return _0x4f5e15===_0x52d7de||_0x4f5e15[_0x11e724(0x28b)](_0x52d7de+'/');return!![];});}export function buildSegmentLookupMap(_0x4f0a38,_0x1839f7){const _0x44fba7=a169_0x1f83a4,_0x5edf11=new Map();for(const _0x27a7f3 of _0x4f0a38){const _0x3387fb=_0x27a7f3['segmentFolderId']?_0x1839f7['get'](_0x27a7f3['segmentFolderId'][_0x44fba7(0x250)]())||'':'',_0x1b2b1f=_0x3387fb+':'+_0x27a7f3[_0x44fba7(0x1ed)];_0x5edf11[_0x44fba7(0x2aa)](_0x1b2b1f,_0x27a7f3);}return _0x5edf11;}export function buildSegmentNameToIdMap(_0x28db0d){const _0x1b3e55=a169_0x1f83a4,_0x427147=new Map();for(const _0x309238 of _0x28db0d){_0x427147[_0x1b3e55(0x2aa)](_0x309238[_0x1b3e55(0x1ed)],_0x309238['id']);}return _0x427147;}export function buildJourneyBundleLookupMap(_0x5918d7,_0x460003){const _0x278754=a169_0x1f83a4,_0x50b929=new Map();for(const _0xa0ab9c of _0x5918d7){const _0xc7f86f=_0xa0ab9c[_0x278754(0x29e)]?_0x460003[_0x278754(0x272)](_0xa0ab9c[_0x278754(0x29e)])||'':'',_0x3d9fda=_0xc7f86f+':'+_0xa0ab9c[_0x278754(0x205)];!_0x50b929[_0x278754(0x230)](_0x3d9fda)&&_0x50b929[_0x278754(0x2aa)](_0x3d9fda,[]),_0x50b929[_0x278754(0x272)](_0x3d9fda)[_0x278754(0x20e)](_0xa0ab9c);}for(const _0x1ff499 of _0x50b929[_0x278754(0x1df)]()){_0x1ff499[_0x278754(0x1f4)]((_0x1c4134,_0x5cc597)=>(_0x1c4134[_0x278754(0x1e8)]||0x0)-(_0x5cc597[_0x278754(0x1e8)]||0x0));}return _0x50b929;}export function collectFoldersToCreate(_0xeb4fa1,_0x47dac7){const _0x2fc031=a169_0x1f83a4,_0x14728b=new Set();for(const _0x4ecac4 of _0xeb4fa1){if(!_0x4ecac4)continue;if(_0x47dac7[_0x2fc031(0x230)](_0x4ecac4))continue;const _0x237a05=_0x4ecac4[_0x2fc031(0x20c)]('/');let _0x37fb66='';for(const _0x33d52a of _0x237a05){_0x37fb66=_0x37fb66?_0x37fb66+'/'+_0x33d52a:_0x33d52a,!_0x47dac7['has'](_0x37fb66)&&_0x14728b[_0x2fc031(0x29a)](_0x37fb66);}}return _0x14728b;}export function parseAndClassifyYamlFiles(_0x492caa,_0x17cf9e,_0x55c475){const _0x29c20d=a169_0x1f83a4,_0xf8a1d1=[],_0x1add54=[];for(const _0x5f1acc of _0x492caa){const _0x15211d=a169_0x458f55[_0x29c20d(0x204)](_0x17cf9e,a169_0x458f55[_0x29c20d(0x2ce)](_0x5f1acc)),_0x16a899=_0x15211d==='.'?'':_0x15211d[_0x29c20d(0x251)](/\\/g,'/'),_0x48b3ad=readFileSync(_0x5f1acc,_0x29c20d(0x2a9)),_0xfad10=a169_0x65009a[_0x29c20d(0x1d7)](_0x48b3ad);if(isJourneyDef(_0xfad10,_0x5f1acc)){const _0x33cad8=a169_0x361d77(_0x48b3ad);_0x1add54['push']({'yamlConfig':_0x33cad8,'folderPath':_0x16a899,'sourcePath':_0x5f1acc});}else{if(!_0x55c475?.[_0x29c20d(0x1d9)]){const _0x3cc3ad=parseSegmentYamlFile(_0x48b3ad),_0x170a03=normalizeChildSegmentYaml(_0x3cc3ad);_0xf8a1d1[_0x29c20d(0x20e)]({'yamlConfig':_0x170a03,'folderPath':_0x16a899,'sourcePath':_0x5f1acc});}}}return{'segments':_0xf8a1d1,'journeys':_0x1add54};}export function validateParsedFiles(_0x482f67,_0x43efb8){const _0x3912a3=a169_0x1f83a4,_0x14e762=[];for(const {yamlConfig:_0x4f7f5c,sourcePath:_0x402b65}of _0x482f67['segments']){const _0x20d00d=readFileSync(_0x402b65,_0x3912a3(0x2a9)),_0x43171c=a169_0x65009a[_0x3912a3(0x20a)](_0x20d00d),_0x4810ae=validateSegmentDef(_0x4f7f5c,{'source':_0x20d00d,'document':_0x43171c},{'skipSchema':!![]});if(!_0x4810ae[_0x3912a3(0x23c)]){const _0xc08b5d=a169_0x458f55['relative'](_0x43efb8,_0x402b65);_0x14e762['push']({'filePath':_0xc08b5d,'source':_0x20d00d,'result':_0x4810ae,'isJourney':![]});}}for(const {yamlConfig:_0x54454e,sourcePath:_0x55fefc}of _0x482f67[_0x3912a3(0x233)]){const _0x4a582a=readFileSync(_0x55fefc,_0x3912a3(0x2a9)),_0x5a3b85=a169_0x65009a[_0x3912a3(0x20a)](_0x4a582a),_0x3a63ab=validateJourneyDef(_0x54454e,{'source':_0x4a582a,'document':_0x5a3b85},{'skipSchema':!![]});if(!_0x3a63ab[_0x3912a3(0x23c)]){const _0x2acd3e=a169_0x458f55['relative'](_0x43efb8,_0x55fefc);_0x14e762[_0x3912a3(0x20e)]({'filePath':_0x2acd3e,'source':_0x4a582a,'result':_0x3a63ab,'isJourney':!![]});}}return _0x14e762;}export function formatValidationErrors(_0xfd511a){const _0x49293e=a169_0x1f83a4,_0x2bf4c8=[];for(const {filePath:_0x250d38,source:_0x507c14,result:_0x2a7828,isJourney:_0x14ed4b}of _0xfd511a){const _0xcb19aa=_0x14ed4b?_0x49293e(0x284):'segment';_0x2bf4c8[_0x49293e(0x20e)]('\x0a'+_0x250d38+'\x20('+_0xcb19aa+_0x49293e(0x1e1)+_0x2a7828['errors'][_0x49293e(0x2cf)]+_0x49293e(0x1e6)),_0x2bf4c8[_0x49293e(0x20e)](formatValidationResult(_0x2a7828,_0x507c14,_0x250d38));}return _0x2bf4c8[_0x49293e(0x212)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x19f32f){const _0x48e9e3=a169_0x1f83a4,_0x3ab590=new Set(),_0x1f530d=new Map(),_0x431393=collectSegmentUsageCounts(_0x19f32f);if(_0x19f32f[_0x48e9e3(0x2ad)])for(const [_0x16df8b,_0x55ffa9]of Object[_0x48e9e3(0x2b4)](_0x19f32f['segments'])){_0x3ab590['add'](_0x16df8b);if(_0x55ffa9[_0x48e9e3(0x286)]){const _0x4dae3c=yamlRuleToApi(_0x55ffa9[_0x48e9e3(0x286)]),_0x2dd020=apiRuleToYaml(_0x4dae3c);_0x1f530d[_0x48e9e3(0x2aa)](_0x16df8b,_0x2dd020);}}const _0x2d1225=new Map();let _0x3c7b4=0x0;for(const [_0x4648fc,_0x662024]of _0x1f530d){const _0x2a5d0a=serializeExpandedRule(_0x662024,_0x1f530d),_0x56068d=_0x2d1225[_0x48e9e3(0x272)](_0x2a5d0a)||[];_0x56068d['push']({'name':_0x4648fc,'index':_0x3c7b4}),_0x2d1225[_0x48e9e3(0x2aa)](_0x2a5d0a,_0x56068d),_0x3c7b4++;}const _0xb8534c=new Map();for(const [_0x5c3960,_0x10490a]of _0x2d1225){const _0x25f4ef=_0x10490a[_0x48e9e3(0x1f6)]()[_0x48e9e3(0x1f4)]((_0x28d55a,_0x244f0d)=>{const _0xb9f7b0=_0x48e9e3,_0x200c91=_0x431393[_0xb9f7b0(0x272)](_0x28d55a['name'])||0x0,_0x55dd26=_0x431393[_0xb9f7b0(0x272)](_0x244f0d[_0xb9f7b0(0x1ed)])||0x0;if(_0x200c91!==_0x55dd26)return _0x55dd26-_0x200c91;return _0x28d55a[_0xb9f7b0(0x1e2)]-_0x244f0d['index'];})['map'](_0x5c9103=>_0x5c9103[_0x48e9e3(0x1ed)]),_0x44f824=[];for(const _0x29a43a of _0x25f4ef){const _0x10cbde=_0x431393[_0x48e9e3(0x272)](_0x29a43a)||0x0,_0x5399f9=Math[_0x48e9e3(0x2af)](_0x10cbde,0x1);for(let _0x516460=0x0;_0x516460<_0x5399f9;_0x516460++){_0x44f824[_0x48e9e3(0x20e)](_0x29a43a);}}_0xb8534c[_0x48e9e3(0x2aa)](_0x5c3960,_0x44f824);}return{'existingLocalSegmentNames':_0x3ab590,'localSegmentRules':_0x1f530d,'localExpandedRuleToNames':_0xb8534c};}export function createSegmentIdResolver(_0x4d5763,_0x17cd50){return async _0x43ee49=>{const _0xa4dd7c=a169_0x4225,_0x11ade5=_0x4d5763[_0xa4dd7c(0x272)](_0x43ee49);if(!_0x11ade5)throw new SDKError(ErrorCode[_0xa4dd7c(0x1e4)],_0xa4dd7c(0x26c)+_0x43ee49+_0xa4dd7c(0x266)+_0x17cd50+'\x27)');return _0x11ade5;};}export function extractRootFolderId(_0x563561){const _0x31a399=a169_0x1f83a4;return _0x563561[_0x31a399(0x276)]?.[_0x31a399(0x222)]?.[_0x31a399(0x2d3)]?.['id']||_0x563561['relationships']?.[_0x31a399(0x228)]?.[_0x31a399(0x2d3)]?.['id'];}export function buildConnectionMaps(_0x4bbef0){const _0x5be8b4=a169_0x1f83a4,_0x5bb524=new Map(),_0x390e11=new Map(),_0x584e39=new Map();for(const _0x15a613 of _0x4bbef0){_0x5bb524[_0x5be8b4(0x2aa)](_0x15a613['name'],parseInt(_0x15a613['id'],0xa)),_0x390e11[_0x5be8b4(0x2aa)](_0x15a613['id'],_0x15a613[_0x5be8b4(0x1ed)]),_0x584e39[_0x5be8b4(0x2aa)](_0x15a613[_0x5be8b4(0x1ed)],_0x15a613[_0x5be8b4(0x2bd)]);}return{'nameToId':_0x5bb524,'idToName':_0x390e11,'nameToType':_0x584e39};}export function calculatePushStats(_0x154780,_0x286472,_0x46a37c,_0xf9f2b6,_0x58926c,_0x32abc2,_0x465b9c){const _0x17ae29=a169_0x1f83a4,_0x8355de=_0x154780[_0x17ae29(0x234)](_0x2002f7=>_0x2002f7[_0x17ae29(0x292)]),_0x5c4fb9=_0x154780[_0x17ae29(0x234)](_0x232807=>!_0x232807[_0x17ae29(0x292)]&&_0x232807['hasChanges']),_0x4b6ec4=_0x154780['filter'](_0x341684=>!_0x341684['isNew']&&!_0x341684[_0x17ae29(0x20f)]),_0x1dca22=_0x32abc2?_0xf9f2b6:[],_0x1506f4=_0x286472['filter'](_0xd8db77=>_0xd8db77[_0x17ae29(0x292)]),_0x19c2db=_0x286472[_0x17ae29(0x234)](_0x53d643=>!_0x53d643[_0x17ae29(0x292)]&&_0x53d643['hasChanges']),_0x371932=_0x286472[_0x17ae29(0x234)](_0x210ecd=>!_0x210ecd[_0x17ae29(0x292)]&&!_0x210ecd[_0x17ae29(0x20f)]),_0x80667d=_0x32abc2?_0x58926c:[],_0x51e065=_0x154780[_0x17ae29(0x219)](_0x9bd529=>_0x9bd529['activationActions']),_0x4d1e23=_0x51e065['filter'](_0x549613=>_0x549613['type']===_0x17ae29(0x202)),_0xde4c66=_0x51e065['filter'](_0xd1dc00=>_0xd1dc00[_0x17ae29(0x2bd)]===_0x17ae29(0x211)),_0x420612=_0x51e065[_0x17ae29(0x234)](_0x101cf6=>_0x101cf6[_0x17ae29(0x2bd)]===_0x17ae29(0x1f8)),_0x398af9=Array[_0x17ae29(0x2b5)](_0x46a37c)[_0x17ae29(0x1f4)](),_0x1b64bd=_0x465b9c?![]:_0x8355de[_0x17ae29(0x2cf)]>0x0||_0x5c4fb9[_0x17ae29(0x2cf)]>0x0||_0x1dca22[_0x17ae29(0x2cf)]>0x0,_0x29db7e=_0x1506f4[_0x17ae29(0x2cf)]>0x0||_0x19c2db[_0x17ae29(0x2cf)]>0x0||_0x80667d[_0x17ae29(0x2cf)]>0x0,_0x2cc4e1=_0x465b9c?![]:_0x51e065['length']>0x0,_0x153d17=_0x398af9[_0x17ae29(0x2cf)]>0x0;return{'segments':{'new':_0x8355de,'changed':_0x5c4fb9,'unchanged':_0x4b6ec4,'toDelete':_0x1dca22},'journeys':{'new':_0x1506f4,'changed':_0x19c2db,'unchanged':_0x371932,'toDelete':_0x80667d},'activations':{'all':_0x51e065,'toCreate':_0x4d1e23,'toUpdate':_0xde4c66,'toDelete':_0x420612},'folders':{'toCreate':_0x398af9},'counts':{'segments':{'new':_0x8355de[_0x17ae29(0x2cf)],'changed':_0x5c4fb9[_0x17ae29(0x2cf)],'unchanged':_0x4b6ec4['length'],'toDelete':_0x1dca22[_0x17ae29(0x2cf)]},'journeys':{'new':_0x1506f4['length'],'changed':_0x19c2db[_0x17ae29(0x2cf)],'unchanged':_0x371932[_0x17ae29(0x2cf)],'toDelete':_0x80667d[_0x17ae29(0x2cf)]},'activations':{'create':_0x4d1e23[_0x17ae29(0x2cf)],'update':_0xde4c66['length'],'delete':_0x420612['length']},'folders':_0x398af9[_0x17ae29(0x2cf)]},'hasChanges':_0x1b64bd||_0x29db7e||_0x2cc4e1||_0x153d17};}export async function buildPushExecutionContext(_0x565b8a,_0x356def,_0x187584,_0x41fa91,_0x2299a8,_0x6b4cb7){const _0x42bd0e=a169_0x1f83a4,_0x6d2879=extractRootFolderId(_0x187584),{pathToId:_0x445380,idToPath:_0x146606}=buildFolderMaps(_0x2299a8),_0x197d59=buildSegmentNameToIdMap(_0x41fa91),_0x4ff61e=new Map(),{batchAsync:_0x3c37a2}=await import(_0x42bd0e(0x282)),[_0x1cbe5a,_0x868cc]=await Promise[_0x42bd0e(0x264)]([_0x565b8a['user'][_0x42bd0e(0x23f)](),_0x565b8a[_0x42bd0e(0x2a1)][_0x42bd0e(0x20b)](),((async()=>{!_0x6b4cb7&&_0x41fa91['length']>0x0&&await _0x3c37a2(_0x41fa91,async _0x308483=>{const _0x58047d=a169_0x4225,_0x2626a3=await _0x565b8a[_0x58047d(0x25f)]['listActivations'](_0x356def,_0x308483['id']);_0x4ff61e[_0x58047d(0x2aa)](_0x308483['id'],_0x2626a3);});})())]),{emailToId:_0x118225,idToEmail:_0x840b08}=_0x1cbe5a,_0x3b89d0=buildConnectionMaps(_0x868cc);return{'rootFolderId':_0x6d2879,'folderPathToId':_0x445380,'folderIdToPath':_0x146606,'segmentNameToId':_0x197d59,'activationsBySegmentId':_0x4ff61e,'emailToIdMap':_0x118225,'idToEmailMap':_0x840b08,'connectionNameToIdMap':_0x3b89d0[_0x42bd0e(0x1db)],'connectionIdToNameMap':_0x3b89d0[_0x42bd0e(0x2d2)],'connectionNameToTypeMap':_0x3b89d0[_0x42bd0e(0x24e)]};}function a169_0xcd17(){const _0x31b277=['folderPath','Matched\x20server\x20segment\x20\x27','size','diff','created','absolutePath','conditionTimeoutUnit','ACTIVATION_UPDATE_ERROR','Condition','create','stringify','relative','journeyBundleName','embedded_segment_created','attributes','\x20segment\x20from\x20file:\x20','\x0a\x20\x20','parseDocument','list','split','trim','push','hasChanges','and\x20the\x20server\x20segment,\x20then\x20retry.','update','join','branches','deleteSegment','columns','some','Updated\x20activation\x20\x27','DecisionPoint','flatMap','logSuccess','updateSegmentById','run_after_journey_refresh','activation_updating','Deleted\x20segment\x20\x27','activationActions','results','validatedRequest','parentSegmentFolder','journeyName','existingActivation','logInfo','activation_updated','behavior','parentFolder','folder','embedded_activation_created','Failed\x20to\x20resolve\x20segment\x20','steps','\x27\x20not\x20found\x20in\x20journey\x20\x27',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','folder_creating','has','./child-segment-yaml.js','segmentId','journeys','filter','unchanged','Deleted\x20activation\x20\x27','waitStepUnit','journey_updated','Creating\x20activation\x20\x27','goal','journey_entry_criteria_','valid','conditionSegmentId','SEGMENT_UPDATE_ERROR','buildUserMaps','Creating\x20folder\x20\x27','\x27\x20for\x20','embedded_activation_creating','activation_created','connectionIdToNameMap','digest','Failed\x20to\x20','embeddedSegmentNameToId','getSegmentEntity\x20also\x20failed\x20for\x20','SEGMENT_SYNTAX_ERROR','action','journey_updating','logDeleted','Creating\x20segment\x20\x27','nameToType','JOURNEY_UPDATE_ERROR','toString','replace','activationContext','existingSegments','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','toLowerCase','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','map','Updated\x20journey\x20\x27','Failed\x20to\x20fetch\x20referenced\x20segment\x20','Updating\x20segment\x20\x27','journey_created','\x27\x20entry\x20criteria','existingJourney','9495uiWsYr','segment','onProgress','existingSegment','find','resolvedRule','all','all_columns','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','updated','behaviors','conditionTimeoutDuration','segment_updated','isArray','Segment\x20not\x20found:\x20','journeyStages','toISOString','./journey-yaml.js','getJourney','deps','get','Updated\x20segment\x20\x27','resolveJourneyId','Journey\x20\x27','relationships','createdSegmentId','\x27\x20exit\x20criteria','includes','\x27...',').\x20','1040526CgZtBd','segmentFolderId','117754tNqAbO','connector_config','246328LyOBPS','journeyActivationNameToId','../../utils/async.js','draft','journey','createSegment','rule','exitCriterias','journeyActivationStepId','335164mIwCrw','decision_point','startsWith','journey_creating','\x27\x20by\x20rule\x20content','__pending_act_','deleteActivation','stages','getSegmentEntity','isNew','resolveSegment','entry_criteria','conditions','INTERNAL','journeyById','NOT_FOUND','fetchJourney','add','segmentByFolderAndName','segment_updating','Name\x20has\x20already\x20been\x20taken','folderId','createActivation','sha1','connection','Updating\x20activation\x20\x27','journeyId','idToEmailMap','Created\x20activation\x20\x27','activation_','Created\x20journey\x20\x27','yamlConfig','utf-8','set','createdSegmentIds','message','segments','Failed\x20to\x20resolve\x20activation\x20','max','description','match','reduce','journeyBundlesByFolderAndName','entries','from','getLatestJourneyId','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','2IvXiLl','\x27\x20milestone','Delete\x20the\x20push\x20recovery\x20file\x20(','localName','18KITOyP','type','createJourneySegment','state','waitStepType','segment_creating','Entry\x20criteria:\x20','effectiveFolderId','folder_created','logWarning','Activation\x20not\x20found:\x20','segmentNameToId','folderPathToId','uniqueSegmentName','Fetching\x20','debug','activation_deleted','activation_template_id','dirname','length','parentId','milestone','idToName','data','Activation','\x27\x20decision\x20point\x20branch\x20\x27','kind','withProgress','40845IJOFDG','parse','9254820NzSNYB','skipSegments','600RTOtdN','nameToId','__pending_','getSegment\x20failed\x20for\x20','waitStep','values','entryCriteria','):\x20','index','progress','SEGMENT_NOT_FOUND','WaitStep','\x20error(s)','notification','versionNumber','keys','activations','Stage\x20\x27','goal\x20criteria','name','Segment\x20not\x20found','stage\x20\x27','\x27\x20wait\x20condition','getSegment','schedule','activationParams','sort','rootFolderId','slice','uniqueServerName','delete'];a169_0xcd17=function(){return _0x31b277;};return a169_0xcd17();}export function createPushYamlContextForBundle(_0x5e71c7,_0x53cfa9,_0x14406d,_0x3d966d,_0x1dc80e,_0x18ed90,_0x5ec91d,_0x15f2ad){const {existingLocalSegmentNames:_0x1f3ae8,localExpandedRuleToNames:_0x593df1}=_0x3d966d,_0x462042=new Set(),_0x4a5df2=new Map(),_0x3e2dc4=new Map(),_0x4488da=new Map(),_0x189d14=createJumpTargetCache(),_0x44889b=new Map(),_0xb558cb=new Map(),_0x3c64ef=new Set();let _0x137be3;const _0x4f1dfa=_0x5af42c=>{const _0x3880a6={'resolveSegment':async _0x4b1b3c=>{const _0x3e97f5=a169_0x4225,_0x43b42f=_0x4488da[_0x3e97f5(0x272)](_0x4b1b3c);if(_0x43b42f!==undefined)return{'name':_0x43b42f,'isJourneyLocal':!![]};try{const _0x1313c4=await fetchSegment(_0x5e71c7,_0x53cfa9,_0x4b1b3c,_0x14406d);if(!_0x1313c4)throw new Error(_0x3e97f5(0x1ee));const _0x512423=generateJourneyLocalName(_0x1313c4[_0x3e97f5(0x1ed)]),_0x1884ca=_0x1313c4[_0x3e97f5(0x2d6)]===SEGMENT_KIND_JOURNEY&&_0x512423!==undefined;let _0x47729f=_0x1313c4['name'],_0x17a9ef;if(_0x1884ca&&_0x1313c4[_0x3e97f5(0x286)]){const _0x22b6e2=apiRuleToYaml(_0x1313c4[_0x3e97f5(0x286)]);_0xb558cb[_0x3e97f5(0x2aa)](_0x4b1b3c,_0x22b6e2);const _0x4cea15=async _0x36f3d8=>{const _0x198156=_0x3e97f5,_0x5764c4=collectSegmentRefsFromRule(_0x36f3d8);for(const _0xc9d72f of _0x5764c4){if(!_0xb558cb['has'](_0xc9d72f))try{const _0x2fcbe6=await fetchSegment(_0x5e71c7,_0x53cfa9,_0xc9d72f,_0x14406d);if(_0x2fcbe6?.[_0x198156(0x286)]){const _0x25c80c=apiRuleToYaml(_0x2fcbe6[_0x198156(0x286)]);_0xb558cb['set'](_0xc9d72f,_0x25c80c),await _0x4cea15(_0x25c80c);}}catch(_0x199eb5){logger['debug'](_0x198156(0x259)+_0xc9d72f+':\x20'+_0x199eb5);}}};await _0x4cea15(_0x22b6e2);const _0x127c42=serializeExpandedRule(_0x22b6e2,_0xb558cb),_0x3196c3=_0x593df1['get'](_0x127c42);if(_0x3196c3&&_0x3196c3['length']>0x0){const _0x2383e0=_0x4a5df2[_0x3e97f5(0x272)](_0x127c42)||0x0,_0x248e9e=_0x3196c3[_0x2383e0]||_0x3196c3[_0x3196c3[_0x3e97f5(0x2cf)]-0x1];_0x4a5df2[_0x3e97f5(0x2aa)](_0x127c42,_0x2383e0+0x1),_0x47729f=_0x248e9e,_0x462042[_0x3e97f5(0x29a)](_0x47729f),_0x4488da[_0x3e97f5(0x2aa)](_0x4b1b3c,_0x47729f);const _0x2e8089=await resolveRuleSegmentRefs(_0x22b6e2,async _0x19c74b=>{const _0x3d1e62=_0x3e97f5,_0x5e16f8=_0x4488da[_0x3d1e62(0x272)](_0x19c74b);if(_0x5e16f8)return _0x5e16f8;const _0x1aed52=await _0x137be3[_0x3d1e62(0x293)](_0x19c74b);return _0x1aed52['name'];});_0x17a9ef={'description':_0x1313c4[_0x3e97f5(0x2b0)],'rule':_0x2e8089};}else{const _0x17727f=_0x44889b[_0x3e97f5(0x272)](_0x127c42);if(_0x17727f)_0x47729f=_0x17727f,_0x4488da[_0x3e97f5(0x2aa)](_0x4b1b3c,_0x47729f);else{if(_0x512423){let _0x1ad45a=_0x512423,_0x1acb8d=0x2;while(_0x462042[_0x3e97f5(0x230)](_0x1ad45a)||_0x1f3ae8[_0x3e97f5(0x230)](_0x1ad45a)){_0x1ad45a=_0x512423+'_'+_0x1acb8d,_0x1acb8d++;}_0x462042[_0x3e97f5(0x29a)](_0x1ad45a),_0x47729f=_0x1ad45a;}_0x4488da[_0x3e97f5(0x2aa)](_0x4b1b3c,_0x47729f),_0x44889b[_0x3e97f5(0x2aa)](_0x127c42,_0x47729f);const _0x4d4de3=await resolveRuleSegmentRefs(_0x22b6e2,async _0x12b517=>{const _0x1dcd35=_0x3e97f5,_0x51940b=_0x4488da[_0x1dcd35(0x272)](_0x12b517);if(_0x51940b)return _0x51940b;const _0xc22071=await _0x137be3[_0x1dcd35(0x293)](_0x12b517);return _0xc22071['name'];});_0x17a9ef={'description':_0x1313c4[_0x3e97f5(0x2b0)],'rule':_0x4d4de3};}}}return{'name':_0x47729f,'isJourneyLocal':_0x1884ca,'definition':_0x17a9ef};}catch(_0x4d95bf){return logger[_0x3e97f5(0x2cb)](_0x3e97f5(0x22b)+_0x4b1b3c+':\x20'+_0x4d95bf),{'name':_0x4b1b3c,'isJourneyLocal':![]};}},'resolveActivation':async _0x2188bf=>{const _0x1a9426=a169_0x4225,_0x491b9b=_0x3e2dc4[_0x1a9426(0x272)](_0x2188bf);if(_0x491b9b!==undefined)return{'name':_0x491b9b,'isJourneyLocal':!![]};try{let _0x5ee1b3=_0x5ec91d?.[_0x1a9426(0x272)](_0x2188bf);!_0x5ee1b3&&(_0x5ee1b3=await _0x5e71c7[_0x1a9426(0x284)]['getActivation'](_0x5af42c,_0x2188bf));const _0x5854a1=_0x5ee1b3[_0x1a9426(0x207)][_0x1a9426(0x1f3)][_0x1a9426(0x1ed)]||_0x2188bf,_0x128bff=sanitizeYamlKey(_0x5854a1)||_0x1a9426(0x2a6)+_0x2188bf,_0x4a5e60=_0x128bff;_0x3e2dc4[_0x1a9426(0x2aa)](_0x2188bf,_0x4a5e60);const _0x26be5c=journeyActivationStepToYaml(_0x5ee1b3,_0x1dc80e,_0x18ed90);return{'name':_0x4a5e60,'isJourneyLocal':!![],'definition':_0x26be5c};}catch(_0x5aec2e){return logger[_0x1a9426(0x2cb)](_0x1a9426(0x2ae)+_0x2188bf+':\x20'+_0x5aec2e),{'name':_0x2188bf,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x23db78,_0x3a9e2b)=>resolveJumpTarget(_0x23db78,_0x3a9e2b,_0x189d14,async _0x248016=>{const _0x4d4487=a169_0x4225,_0x2d1ebf=_0x15f2ad?.['get'](_0x248016);if(_0x2d1ebf)return _0x2d1ebf;return _0x5e71c7[_0x4d4487(0x284)][_0x4d4487(0x270)](_0x248016);})};return _0x137be3=_0x3880a6,_0x3880a6;},_0x288782=async _0x421ea7=>{const _0xa6ebeb=a169_0x4225,{collectSegmentIdsFromJourneyApi:_0x590bfb}=await import(_0xa6ebeb(0x26f)),{batchAsync:_0x561489}=await import(_0xa6ebeb(0x282)),_0x2b98d5=new Set();for(const _0x51aceb of _0x421ea7){let _0x4c0644=_0x15f2ad?.['get'](_0x51aceb);!_0x4c0644&&(_0x4c0644=await _0x5e71c7[_0xa6ebeb(0x284)][_0xa6ebeb(0x270)](_0x51aceb));const _0x115d31=_0x590bfb(_0x4c0644);for(const _0x5b3fd0 of _0x115d31){_0x2b98d5[_0xa6ebeb(0x29a)](_0x5b3fd0);}}let _0x1bd4fa=Array['from'](_0x2b98d5);while(_0x1bd4fa['length']>0x0){const _0x43e13b=_0x1bd4fa[_0xa6ebeb(0x234)](_0x27847e=>!_0x3c64ef[_0xa6ebeb(0x230)](_0x27847e));if(_0x43e13b[_0xa6ebeb(0x2cf)]===0x0)break;const _0x4b15ce=await _0x561489(_0x43e13b,async _0x99e286=>{_0x3c64ef['add'](_0x99e286);const _0x4d34fb=await fetchSegment(_0x5e71c7,_0x53cfa9,_0x99e286,_0x14406d);if(!_0x4d34fb)return null;return{'segmentId':_0x99e286,'segment':_0x4d34fb};},0xa),_0x39a042=new Set();for(const _0x1096ea of _0x4b15ce){if(!_0x1096ea?.['segment']?.[_0xa6ebeb(0x286)])continue;const _0x55ee84=apiRuleToYaml(_0x1096ea[_0xa6ebeb(0x25f)]['rule']);_0xb558cb[_0xa6ebeb(0x2aa)](_0x1096ea['segmentId'],_0x55ee84);const _0x4de5cf=collectSegmentRefsFromRule(_0x55ee84);for(const _0xc3b978 of _0x4de5cf){!_0x3c64ef['has'](_0xc3b978)&&_0x39a042['add'](_0xc3b978);}}_0x1bd4fa=Array['from'](_0x39a042);}};return{'createYamlContext':_0x4f1dfa,'prefetchJourneySegments':_0x288782};}function a169_0x4225(_0x8d656,_0x2ed897){_0x8d656=_0x8d656-0x1d6;const _0xcd1720=a169_0xcd17();let _0x422543=_0xcd1720[_0x8d656];return _0x422543;}export async function executePushSegments(_0x47d7e0,_0x25b46e,_0x2490e0,_0x4dcdd2,_0x2784c3){const _0x577e76=a169_0x1f83a4,{segmentDefToCreateRequest:_0x4673fe,segmentDefToUpdateRequest:_0x18e03a}=await import('./child-segment-yaml.js'),_0x5000a4=_0x2490e0[_0x577e76(0x2c8)],_0x337d36=0x5,_0x51503c=async _0x5be6ef=>{const _0x197fda=_0x577e76,_0x4bfbb0=_0x5be6ef['folderPath']?_0x5000a4[_0x197fda(0x272)](_0x5be6ef[_0x197fda(0x1f9)]):undefined;let _0x33ca05;const _0x59f983={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x6922a5=_0x5be6ef[_0x197fda(0x2a8)];if(_0x5be6ef[_0x197fda(0x2a8)]['rule']){const _0x152563=createSegmentIdResolver(_0x2490e0[_0x197fda(0x2c7)],_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x1ed)]),_0x21442b=await resolveRuleSegmentIds(_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x286)],_0x152563);_0x6922a5={..._0x5be6ef[_0x197fda(0x2a8)],'rule':_0x21442b};}try{if(_0x5be6ef[_0x197fda(0x292)]){_0x2784c3[_0x197fda(0x260)]?.({'type':_0x197fda(0x2c1),'name':_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x1ed)]});const _0x30155c=_0x4673fe(_0x6922a5,_0x4bfbb0),_0x229c42=await _0x2784c3[_0x197fda(0x2d7)](_0x197fda(0x24d)+_0x5be6ef['yamlConfig'][_0x197fda(0x1ed)]+_0x197fda(0x27a),()=>_0x47d7e0[_0x197fda(0x25f)][_0x197fda(0x285)](_0x4dcdd2[_0x197fda(0x2d0)],_0x30155c));_0x33ca05=_0x229c42[_0x197fda(0x2d3)]['id'],_0x2490e0['segmentNameToId']['set'](_0x5be6ef[_0x197fda(0x2a8)]['name'],_0x33ca05),_0x59f983[_0x197fda(0x277)]={'name':_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x1ed)],'id':_0x33ca05},_0x2784c3[_0x197fda(0x260)]?.({'type':'segment_created','name':_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x1ed)],'segmentId':_0x33ca05}),_0x2784c3[_0x197fda(0x21a)]?.('Created\x20segment\x20\x27'+_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x1ed)]+'\x27'),_0x59f983[_0x197fda(0x1fd)]=0x1;}else{if(_0x5be6ef['hasChanges']){_0x2784c3['onProgress']?.({'type':_0x197fda(0x29c),'name':_0x5be6ef[_0x197fda(0x2a8)]['name']});const _0x433b15=_0x18e03a(_0x6922a5);_0x4bfbb0!==_0x5be6ef['existingSegment']?.[_0x197fda(0x27d)]&&(_0x433b15[_0x197fda(0x27d)]=_0x4bfbb0?parseInt(_0x4bfbb0,0xa):undefined),await _0x2784c3[_0x197fda(0x2d7)](_0x197fda(0x25a)+_0x5be6ef[_0x197fda(0x2a8)]['name']+_0x197fda(0x27a),()=>_0x47d7e0[_0x197fda(0x25f)]['updateSegmentById'](_0x4dcdd2[_0x197fda(0x2d0)],_0x5be6ef[_0x197fda(0x261)]['id'],_0x433b15)),_0x33ca05=_0x5be6ef[_0x197fda(0x261)]['id'],_0x2784c3[_0x197fda(0x260)]?.({'type':_0x197fda(0x26a),'name':_0x5be6ef[_0x197fda(0x2a8)]['name']}),_0x2784c3[_0x197fda(0x21a)]?.(_0x197fda(0x273)+_0x5be6ef['yamlConfig'][_0x197fda(0x1ed)]+'\x27'),_0x59f983[_0x197fda(0x267)]=0x1;}else _0x33ca05=_0x5be6ef[_0x197fda(0x261)]['id'];}}catch(_0x5a9b65){const _0x563af9=isHttp400Error(_0x5a9b65),_0x33debb=_0x563af9?ErrorCode[_0x197fda(0x249)]:ErrorCode[_0x197fda(0x23e)],_0x490a6a=getErrorMessage(_0x5a9b65);throw new SDKError(_0x33debb,'Failed\x20to\x20'+(_0x5be6ef['isNew']?_0x197fda(0x202):'update')+_0x197fda(0x208)+_0x5be6ef[_0x197fda(0x1fe)]+_0x197fda(0x209)+_0x490a6a,_0x5a9b65);}try{const _0x1c6d37=await syncActivationsForSegment(_0x47d7e0,_0x4dcdd2[_0x197fda(0x2d0)],_0x33ca05,_0x5be6ef[_0x197fda(0x2a8)][_0x197fda(0x1ed)],_0x5be6ef[_0x197fda(0x21f)],_0x2784c3,_0x5be6ef[_0x197fda(0x1fe)]);_0x59f983[_0x197fda(0x1ea)]=_0x1c6d37;}catch(_0x526857){if(_0x526857 instanceof SDKError)throw _0x526857;throw new SDKError(ErrorCode[_0x197fda(0x200)],_0x197fda(0x2b7)+_0x5be6ef[_0x197fda(0x2a8)]['name']+'\x27\x20from\x20file:\x20'+_0x5be6ef[_0x197fda(0x1fe)]+'\x0a\x20\x20'+getErrorMessage(_0x526857),_0x526857);}return _0x59f983;},_0x554f8f=await batchAsync(_0x25b46e,_0x51503c,_0x337d36),_0x3c2e7d={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4d0dcd of _0x554f8f){_0x3c2e7d[_0x577e76(0x1fd)]+=_0x4d0dcd[_0x577e76(0x1fd)],_0x3c2e7d[_0x577e76(0x267)]+=_0x4d0dcd[_0x577e76(0x267)],_0x4d0dcd['createdSegmentId']&&_0x3c2e7d[_0x577e76(0x2ab)][_0x577e76(0x2aa)](_0x4d0dcd['createdSegmentId'][_0x577e76(0x1ed)],_0x4d0dcd[_0x577e76(0x277)]['id']),_0x3c2e7d[_0x577e76(0x1ea)]['created']+=_0x4d0dcd['activations'][_0x577e76(0x1fd)],_0x3c2e7d[_0x577e76(0x1ea)][_0x577e76(0x267)]+=_0x4d0dcd[_0x577e76(0x1ea)][_0x577e76(0x267)],_0x3c2e7d['activations']['deleted']+=_0x4d0dcd[_0x577e76(0x1ea)]['deleted'];}return _0x3c2e7d;}async function syncActivationsForSegment(_0x4a3cc0,_0x614b61,_0x4a63a9,_0x23c2c8,_0x30810c,_0x4e4326,_0x21527e){const _0x1debc7=a169_0x1f83a4,_0x238ab6={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3410a5 of _0x30810c){try{if(_0x3410a5['type']===_0x1debc7(0x202)&&_0x3410a5[_0x1debc7(0x221)])_0x4e4326[_0x1debc7(0x260)]?.({'type':'activation_creating','segmentName':_0x23c2c8,'activationName':_0x3410a5[_0x1debc7(0x1ed)]}),await _0x4e4326[_0x1debc7(0x2d7)](_0x1debc7(0x239)+_0x3410a5['name']+'\x27...',()=>_0x4a3cc0[_0x1debc7(0x25f)][_0x1debc7(0x29f)](_0x614b61,_0x4a63a9,_0x3410a5['validatedRequest'])),_0x4e4326['onProgress']?.({'type':_0x1debc7(0x243),'segmentName':_0x23c2c8,'activationName':_0x3410a5['name']}),_0x4e4326[_0x1debc7(0x21a)]?.(_0x1debc7(0x2a5)+_0x3410a5[_0x1debc7(0x1ed)]+'\x27'),_0x238ab6[_0x1debc7(0x1fd)]++;else{if(_0x3410a5['type']==='update'&&_0x3410a5['validatedRequest']&&_0x3410a5['existingActivation'])_0x4e4326[_0x1debc7(0x260)]?.({'type':_0x1debc7(0x21d),'segmentName':_0x23c2c8,'activationName':_0x3410a5[_0x1debc7(0x1ed)]}),await _0x4e4326[_0x1debc7(0x2d7)](_0x1debc7(0x2a2)+_0x3410a5[_0x1debc7(0x1ed)]+_0x1debc7(0x27a),()=>_0x4a3cc0[_0x1debc7(0x25f)]['updateActivation'](_0x614b61,_0x4a63a9,_0x3410a5[_0x1debc7(0x224)]['id'],_0x3410a5[_0x1debc7(0x221)])),_0x4e4326[_0x1debc7(0x260)]?.({'type':_0x1debc7(0x226),'segmentName':_0x23c2c8,'activationName':_0x3410a5[_0x1debc7(0x1ed)]}),_0x4e4326[_0x1debc7(0x21a)]?.(_0x1debc7(0x217)+_0x3410a5[_0x1debc7(0x1ed)]+'\x27'),_0x238ab6[_0x1debc7(0x267)]++;else _0x3410a5[_0x1debc7(0x2bd)]===_0x1debc7(0x1f8)&&_0x3410a5['existingActivation']&&(_0x4e4326[_0x1debc7(0x260)]?.({'type':'activation_deleting','segmentName':_0x23c2c8,'activationName':_0x3410a5[_0x1debc7(0x1ed)]}),await _0x4e4326[_0x1debc7(0x2d7)]('Deleting\x20activation\x20\x27'+_0x3410a5['name']+_0x1debc7(0x27a),()=>_0x4a3cc0[_0x1debc7(0x25f)][_0x1debc7(0x28f)](_0x614b61,_0x4a63a9,_0x3410a5[_0x1debc7(0x224)]['id'])),_0x4e4326['onProgress']?.({'type':_0x1debc7(0x2cc),'segmentName':_0x23c2c8,'activationName':_0x3410a5[_0x1debc7(0x1ed)]}),_0x4e4326['logDeleted']?.(_0x1debc7(0x236)+_0x3410a5['name']+'\x27'),_0x238ab6['deleted']++);}}catch(_0x5d410c){const _0x18ce16=isHttp400Error(_0x5d410c),_0x4385f7=_0x18ce16?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x1bbc9a=getErrorMessage(_0x5d410c);throw new SDKError(_0x4385f7,_0x1debc7(0x246)+_0x3410a5[_0x1debc7(0x2bd)]+'\x20activation\x20\x27'+_0x3410a5[_0x1debc7(0x1ed)]+'\x27\x20from\x20file:\x20'+_0x21527e+_0x1debc7(0x209)+_0x1bbc9a,_0x5d410c);}}return _0x238ab6;}export async function executePushFolders(_0x4b3220,_0x359471,_0x5c808c,_0x44814e,_0x3238ad){const _0x226dc2=a169_0x1f83a4,_0x1d9b39=new Map(_0x5c808c),_0x3a3bbf=sortFoldersByDepth(_0x359471);for(const _0x108a0a of _0x3a3bbf){const _0x4681c7=_0x108a0a['split']('/'),_0x538dd4=_0x4681c7[_0x4681c7[_0x226dc2(0x2cf)]-0x1],_0xab3674=_0x4681c7['slice'](0x0,-0x1)[_0x226dc2(0x212)]('/'),_0x53a396=_0x1d9b39[_0x226dc2(0x272)](_0xab3674);_0x3238ad['onProgress']?.({'type':_0x226dc2(0x22f),'folder':_0x108a0a});const _0x4b442c={'name':_0x538dd4,'parentFolderId':_0x53a396},_0xa0add7=await _0x3238ad['withProgress'](_0x226dc2(0x240)+_0x108a0a+_0x226dc2(0x27a),()=>_0x4b3220[_0x226dc2(0x25f)]['createFolder'](_0x44814e['parentId'],_0x4b442c));_0x1d9b39[_0x226dc2(0x2aa)](_0x108a0a,_0xa0add7['data']['id']),_0x3238ad[_0x226dc2(0x260)]?.({'type':_0x226dc2(0x2c4),'folder':_0x108a0a,'folderId':_0xa0add7[_0x226dc2(0x2d3)]['id']}),_0x3238ad[_0x226dc2(0x225)]?.('Created\x20folder\x20\x27'+_0x108a0a+'\x27');}return _0x1d9b39;}export async function executePushSegmentDeletions(_0x28b396,_0x851848,_0x324a8e){const _0x1669e9=a169_0x1f83a4;if(_0x851848[_0x1669e9(0x2cf)]===0x0)return 0x0;const {batchAsync:_0x33ebee}=await import(_0x1669e9(0x282)),_0x5d4b14=0x5,_0x3a5698=await _0x33ebee(_0x851848,async _0x55c357=>{const _0x354328=_0x1669e9;return _0x324a8e[_0x354328(0x260)]?.({'type':'segment_deleting','name':_0x55c357[_0x354328(0x1ed)]}),await _0x28b396[_0x354328(0x25f)][_0x354328(0x214)](_0x55c357['id']),_0x324a8e[_0x354328(0x260)]?.({'type':'segment_deleted','name':_0x55c357['name']}),_0x324a8e[_0x354328(0x24c)]?.(_0x354328(0x21e)+_0x55c357[_0x354328(0x1ed)]+'\x27'),0x1;},_0x5d4b14);return _0x3a5698[_0x1669e9(0x2b2)]((_0xf5e96f,_0x464854)=>_0xf5e96f+_0x464854,0x0);}export async function executePushJourneys(_0x3ca592,_0x4635f0,_0x852974,_0x29c2c3,_0x4d8121){const _0x58ef4b=a169_0x1f83a4,{journeyDefToRequest:_0x1d33c7}=await import(_0x58ef4b(0x26f)),{activationDefToCreateRequest:_0x2015d1,yamlRuleToApi:_0x74ff16,validateSegmentRule:_0xe9db94}=await import('./child-segment-yaml.js'),_0x223ac6={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4c80c6=new Map(_0x852974[_0x58ef4b(0x2c7)]),_0x34995d=0x5;for(let _0x4fc7ec=0x0;_0x4fc7ec<_0x4635f0[_0x58ef4b(0x2cf)];_0x4fc7ec+=_0x34995d){const _0x2c658a=_0x4635f0[_0x58ef4b(0x1f6)](_0x4fc7ec,_0x4fc7ec+_0x34995d),_0x12f7fb=await Promise[_0x58ef4b(0x264)](_0x2c658a[_0x58ef4b(0x257)](async _0x1789db=>{const _0x454431=_0x58ef4b;if(!_0x1789db['isNew']&&!_0x1789db[_0x454431(0x20f)])return{'action':_0x454431(0x235),'name':_0x1789db[_0x454431(0x2a8)]['name'],'journeyId':_0x1789db[_0x454431(0x25d)]?.['id']};const _0x4e2f04=_0x1789db[_0x454431(0x1f9)]?_0x852974[_0x454431(0x2c8)][_0x454431(0x272)](_0x1789db['folderPath']):undefined;_0x4d8121[_0x454431(0x260)]?.({'type':_0x1789db[_0x454431(0x292)]?_0x454431(0x28c):_0x454431(0x24b),'name':_0x1789db[_0x454431(0x2a8)][_0x454431(0x1ed)]});try{const _0x21102e=await executeSingleJourneyPush(_0x3ca592,_0x1789db,{..._0x852974,'segmentNameToId':_0x4c80c6},{'parentId':_0x29c2c3[_0x454431(0x2d0)],'rootFolderId':_0x29c2c3[_0x454431(0x1f5)],'folderId':_0x4e2f04,'verbose':_0x29c2c3['verbose']},_0x4d8121,{'journeyDefToRequest':_0x1d33c7,'activationDefToCreateRequest':_0x2015d1,'yamlRuleToApi':_0x74ff16,'validateSegmentRule':_0xe9db94});for(const [_0x31f5ff,_0x1a9607]of _0x21102e[_0x454431(0x247)]){_0x4c80c6[_0x454431(0x2aa)](_0x31f5ff,_0x1a9607),_0x223ac6['embeddedSegmentNameToId'][_0x454431(0x2aa)](_0x31f5ff,_0x1a9607);}if(_0x21102e['action']===_0x454431(0x1fd))_0x4d8121[_0x454431(0x260)]?.({'type':_0x454431(0x25b),'name':_0x1789db[_0x454431(0x2a8)][_0x454431(0x1ed)],'journeyId':_0x21102e[_0x454431(0x2a3)]}),_0x4d8121[_0x454431(0x21a)]?.(_0x454431(0x2a7)+_0x1789db[_0x454431(0x2a8)][_0x454431(0x1ed)]+'\x27'),_0x223ac6[_0x454431(0x1fd)]++;else _0x21102e['action']===_0x454431(0x267)&&(_0x4d8121[_0x454431(0x260)]?.({'type':_0x454431(0x238),'name':_0x1789db[_0x454431(0x2a8)][_0x454431(0x1ed)]}),_0x4d8121[_0x454431(0x21a)]?.(_0x454431(0x258)+_0x1789db[_0x454431(0x2a8)][_0x454431(0x1ed)]+'\x27'),_0x223ac6['updated']++);return{'action':_0x21102e[_0x454431(0x24a)],'name':_0x1789db[_0x454431(0x2a8)][_0x454431(0x1ed)],'journeyId':_0x21102e[_0x454431(0x2a3)]};}catch(_0x4da737){const _0x51447a=isHttp400Error(_0x4da737),_0x103915=_0x51447a?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x454431(0x24f)],_0x45742c=getErrorMessage(_0x4da737);throw new SDKError(_0x103915,_0x454431(0x246)+(_0x1789db[_0x454431(0x292)]?_0x454431(0x202):_0x454431(0x211))+'\x20journey\x20from\x20file:\x20'+_0x1789db[_0x454431(0x1fe)]+_0x454431(0x209)+_0x45742c,_0x4da737);}}));_0x223ac6[_0x58ef4b(0x220)]['push'](..._0x12f7fb);}return _0x223ac6;}async function matchExistingJourneySegments(_0x2b1f61,_0x35aab1,_0x1ff356,_0x399836,_0x557b1e){const _0x551b61=a169_0x1f83a4;if(!_0x35aab1[_0x551b61(0x25d)]||!_0x35aab1[_0x551b61(0x2a8)]['segments'])return;const _0x2d339f=new Map(),_0x7d9f7=new Set();for(const _0x25ba82 of Object[_0x551b61(0x1e9)](_0x35aab1[_0x551b61(0x2a8)][_0x551b61(0x2ad)])){const _0x3e032d=generateDeterministicJourneySegmentName(_0x35aab1[_0x551b61(0x2a8)][_0x551b61(0x1ed)],_0x25ba82);_0x2d339f[_0x551b61(0x2aa)](_0x3e032d,_0x25ba82),_0x7d9f7[_0x551b61(0x29a)](_0x25ba82);}const _0x471104=[],_0x299797=collectSegmentIdsFromJourneyApi(_0x35aab1[_0x551b61(0x25d)]);for(const _0x1d8f3a of _0x299797){const _0x483626=await fetchSegment(_0x2b1f61,_0x1ff356,_0x1d8f3a,_0x399836);if(!_0x483626?.[_0x551b61(0x1ed)])continue;const _0xb469ba=_0x2d339f[_0x551b61(0x272)](_0x483626[_0x551b61(0x1ed)]);_0xb469ba?(_0x557b1e[_0x551b61(0x2aa)](_0xb469ba,_0x1d8f3a),_0x7d9f7[_0x551b61(0x1f8)](_0xb469ba)):_0x471104[_0x551b61(0x20e)]({'id':_0x1d8f3a,'seg':_0x483626});}if(_0x7d9f7['size']>0x0&&_0x471104['length']>0x0){const {localExpandedRuleToNames:_0x132341}=buildLocalExpandedRuleMappings(_0x35aab1[_0x551b61(0x2a8)]),_0x10177f=new Map();for(const {id:_0x4e264e,seg:_0x50745c}of _0x471104){if(_0x50745c['rule']){const _0x400f55=apiRuleToYaml(_0x50745c[_0x551b61(0x286)]);_0x10177f[_0x551b61(0x2aa)](_0x4e264e,_0x400f55);}}for(const {id:_0x481b1a,seg:_0x1cd1ed}of _0x471104){if(!_0x1cd1ed[_0x551b61(0x286)])continue;const _0x433a0d=_0x10177f[_0x551b61(0x272)](_0x481b1a);if(!_0x433a0d)continue;const _0x278b6c=serializeExpandedRule(_0x433a0d,_0x10177f),_0x4349cf=_0x132341[_0x551b61(0x272)](_0x278b6c);if(_0x4349cf){const _0x2ba4f7=_0x4349cf[_0x551b61(0x262)](_0x1e501d=>_0x7d9f7[_0x551b61(0x230)](_0x1e501d));_0x2ba4f7&&(_0x557b1e[_0x551b61(0x2aa)](_0x2ba4f7,_0x481b1a),_0x7d9f7['delete'](_0x2ba4f7),logger[_0x551b61(0x2cb)](_0x551b61(0x1fa)+_0x1cd1ed[_0x551b61(0x1ed)]+'\x27\x20to\x20local\x20\x27'+_0x2ba4f7+_0x551b61(0x28d)));}}}}async function executeSingleJourneyPush(_0x5b49e5,_0xb8bece,_0x2f5c49,_0x1f91f4,_0x544eea,_0x3ec375){const _0x28d678=a169_0x1f83a4,{journeyDefToRequest:_0x5127f8,activationDefToCreateRequest:_0x42e531,yamlRuleToApi:_0x3319ae,validateSegmentRule:_0x2d2df2}=_0x3ec375,_0x96039=new Map(),_0x2ea271=new Map();recoverSegmentIdsFromPushRecovery(_0xb8bece,_0x96039,_0x2f5c49[_0x28d678(0x2c7)]);const _0x235773=new Map(),_0x3a584f=new Map(),_0x33bcd5=new Map();let _0x5d82c9;const _0xae7b04=async()=>{const _0x26e9a9=_0x28d678;if(_0x5d82c9)return;_0x5d82c9=new Map();if(!_0xb8bece[_0x26e9a9(0x25d)])return;const _0x193055=await _0x5b49e5[_0x26e9a9(0x284)]['listActivations'](_0xb8bece[_0x26e9a9(0x25d)]['id']);for(const _0x57bab8 of _0x193055){const _0x9e5405=journeyActivationStepToYaml(_0x57bab8,_0x2f5c49['idToEmailMap'],_0x2f5c49[_0x26e9a9(0x244)]),_0x29a955=activationSignature(_0x9e5405);!_0x5d82c9['has'](_0x29a955)&&_0x5d82c9[_0x26e9a9(0x2aa)](_0x29a955,_0x57bab8['id']),_0x9e5405[_0x26e9a9(0x1ed)]&&_0x2ea271[_0x26e9a9(0x2aa)](_0x9e5405['name'],_0x57bab8['id']);}};await matchExistingJourneySegments(_0x5b49e5,_0xb8bece,_0x1f91f4[_0x28d678(0x2d0)],_0x2f5c49['existingSegments'],_0x2f5c49['segmentNameToId']);const _0x1ba594={'resolveSegmentId':async _0x18d53f=>{const _0x15b548=_0x28d678,_0xefbe94=_0x2f5c49[_0x15b548(0x2c7)]['get'](_0x18d53f);if(!_0xefbe94)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x18d53f+'\x20(referenced\x20in\x20journey\x20'+_0xb8bece[_0x15b548(0x2a8)][_0x15b548(0x1ed)]+')');return _0xefbe94;},'resolveEmbeddedSegmentId':async(_0x3e188e,_0x3740a1)=>{const _0x4a20be=_0x28d678,_0x3f8261=_0x2f5c49[_0x4a20be(0x2c7)][_0x4a20be(0x272)](_0x3e188e);if(_0x3f8261)return _0x3f8261;const _0x3f7514=_0x2f5c49[_0x4a20be(0x253)][_0x4a20be(0x262)](_0x370127=>_0x370127['name']===_0x3e188e);if(_0x3f7514)return _0x2f5c49[_0x4a20be(0x2c7)][_0x4a20be(0x2aa)](_0x3e188e,_0x3f7514['id']),_0x3f7514['id'];if(_0xb8bece[_0x4a20be(0x292)]){const {stageName:_0x3c16c7,criteriaName:_0x178eb6}=findSegmentCriteriaLocation(_0xb8bece['yamlConfig'],_0x3e188e);return _0x2d2df2(_0x3e188e,_0x3740a1[_0x4a20be(0x286)]),_0x3a584f[_0x4a20be(0x2aa)](_0x3e188e,{'definition':_0x3740a1,'stageName':_0x3c16c7,'criteriaName':_0x178eb6}),createPendingSegmentId(_0x3e188e);}const _0x3efd30=_0xb8bece[_0x4a20be(0x25d)]?.['id'];if(!_0x3efd30)throw new SDKError(ErrorCode[_0x4a20be(0x296)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x43aef2=_0x235773['get'](_0x3e188e);if(_0x43aef2)return _0x43aef2;const _0x4bab8d=((async()=>{const _0x54783a=_0x4a20be;_0x2d2df2(_0x3e188e,_0x3740a1[_0x54783a(0x286)]);const _0x58a3be=generateDeterministicJourneySegmentName(_0xb8bece['yamlConfig'][_0x54783a(0x1ed)],_0x3e188e),_0x45e2cb=_0x2f5c49[_0x54783a(0x253)][_0x54783a(0x262)](_0x3c19eb=>_0x3c19eb[_0x54783a(0x1ed)]===_0x58a3be),_0x3353ec=createSegmentIdResolver(_0x2f5c49[_0x54783a(0x2c7)],_0x3e188e),_0x4d049a=await resolveRuleSegmentIds(_0x3740a1['rule'],_0x3353ec);let _0x30a647;return _0x45e2cb?(await _0x5b49e5[_0x54783a(0x25f)][_0x54783a(0x21b)](_0x1f91f4['parentId'],_0x45e2cb['id'],{'description':_0x3740a1['description']||_0x54783a(0x2c2)+_0x3e188e,'rule':_0x3319ae(_0x4d049a),'countPopulation':!![]}),_0x30a647=_0x45e2cb['id'],saveSegmentToPushRecovery(_0xb8bece['absolutePath'],_0xb8bece[_0x54783a(0x2a8)]['name'],_0x3e188e,{'segmentId':_0x30a647,'uniqueServerName':_0x58a3be,'createdAt':new Date()[_0x54783a(0x26e)]()})):_0x30a647=await createOrRecoverEmbeddedSegment(_0x5b49e5,_0xb8bece,{'localName':_0x3e188e,'uniqueSegmentName':_0x58a3be,'description':_0x3740a1[_0x54783a(0x2b0)]||_0x54783a(0x2c2)+_0x3e188e,'journeyId':_0x3efd30,'resolvedRule':_0x4d049a,'parentId':_0x1f91f4[_0x54783a(0x2d0)],'folderId':_0x1f91f4[_0x54783a(0x1f5)]||''},_0x3319ae),_0x2f5c49['segmentNameToId'][_0x54783a(0x2aa)](_0x3e188e,_0x30a647),_0x96039[_0x54783a(0x2aa)](_0x3e188e,_0x30a647),_0x30a647;})());_0x235773[_0x4a20be(0x2aa)](_0x3e188e,_0x4bab8d);try{return await _0x4bab8d;}finally{_0x235773[_0x4a20be(0x1f8)](_0x3e188e);}},'resolveActivationId':async _0x3db77f=>{const _0x12a739=_0x28d678,_0x7912b8=_0x2ea271['get'](_0x3db77f);if(_0x7912b8)return _0x7912b8;if(_0xb8bece[_0x12a739(0x25d)]){await _0xae7b04();const _0x5831c5=_0x2ea271['get'](_0x3db77f);if(_0x5831c5)return _0x5831c5;}throw new SDKError(ErrorCode[_0x12a739(0x298)],_0x12a739(0x2c6)+_0x3db77f+'\x20(referenced\x20in\x20journey\x20'+_0xb8bece[_0x12a739(0x2a8)][_0x12a739(0x1ed)]+_0x12a739(0x27b)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x48f3d6,_0x5e1006)=>{const _0x50f17b=_0x28d678,_0x4423b5=_0x2ea271[_0x50f17b(0x272)](_0x48f3d6);if(_0x4423b5)return _0x4423b5;if(_0xb8bece['isNew'])return _0x33bcd5[_0x50f17b(0x2aa)](_0x48f3d6,_0x5e1006),createPendingActivationId(_0x48f3d6);if(_0xb8bece[_0x50f17b(0x25d)]){await _0xae7b04();const _0x175ada=_0x2ea271['get'](_0x5e1006[_0x50f17b(0x1ed)]);if(_0x175ada)return _0x2ea271[_0x50f17b(0x2aa)](_0x48f3d6,_0x175ada),_0x175ada;const _0x4abf5f=activationSignature(_0x5e1006),_0xfe5041=_0x5d82c9?.[_0x50f17b(0x272)](_0x4abf5f);if(_0xfe5041)return _0x2ea271[_0x50f17b(0x2aa)](_0x48f3d6,_0xfe5041),_0xfe5041;const _0x332101=await _0x42e531(_0x5e1006,_0x2f5c49[_0x50f17b(0x252)]),_0x2efd17={..._0x332101,..._0x5e1006['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x5e1006[_0x50f17b(0x21c)]}},_0x40a702=await _0x5b49e5[_0x50f17b(0x284)][_0x50f17b(0x29f)](_0xb8bece['existingJourney']['id'],_0x2efd17);return _0x2ea271[_0x50f17b(0x2aa)](_0x48f3d6,_0x40a702['id']),_0x40a702['id'];}throw new SDKError(ErrorCode['INTERNAL'],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x331f6c=>{const _0xb93a9c=_0x28d678;try{return await _0x5b49e5[_0xb93a9c(0x284)][_0xb93a9c(0x274)](_0x1f91f4[_0xb93a9c(0x2d0)],_0x331f6c);}catch(_0xeeab03){throw new SDKError(ErrorCode[_0xb93a9c(0x298)],_0xb93a9c(0x275)+_0x331f6c+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0xb8bece[_0xb93a9c(0x2a8)][_0xb93a9c(0x1ed)]+'\x27)',_0xeeab03);}},'resolveStageId':async(_0x3b3f1e,_0x2c281f)=>{const _0x173b60=_0x28d678,_0x5d0e68=await _0x5b49e5[_0x173b60(0x284)][_0x173b60(0x270)](_0x3b3f1e),_0x3d38f7=_0x5d0e68[_0x173b60(0x207)][_0x173b60(0x26d)][_0x173b60(0x262)](_0x514290=>_0x514290[_0x173b60(0x1ed)][_0x173b60(0x255)]()===_0x2c281f[_0x173b60(0x255)]());if(!_0x3d38f7?.['id'])throw new SDKError(ErrorCode[_0x173b60(0x298)],_0x173b60(0x1eb)+_0x2c281f+_0x173b60(0x22d)+(_0x5d0e68['attributes'][_0x173b60(0x205)]||_0x5d0e68[_0x173b60(0x207)][_0x173b60(0x1ed)])+'\x27');return _0x3d38f7['id'];}},_0xe1be6b=await _0x5127f8(_0xb8bece[_0x28d678(0x2a8)],_0x1f91f4[_0x28d678(0x2d0)],_0x1ba594),_0x4084fd=_0x1f91f4['folderId']||_0x1f91f4['rootFolderId'];_0x4084fd&&(_0xe1be6b[_0x28d678(0x276)]={'parentFolder':{'data':{'id':_0x4084fd,'type':_0x28d678(0x229)}}});if(_0xb8bece[_0x28d678(0x292)]){if(_0x3a584f[_0x28d678(0x1fb)]>0x0||_0x33bcd5[_0x28d678(0x1fb)]>0x0)return await executeThreeStepJourneyCreate(_0x5b49e5,_0xb8bece,_0xe1be6b,{'pendingEmbeddedSegments':_0x3a584f,'pendingEmbeddedActivations':_0x33bcd5,'embeddedSegmentNameToId':_0x96039,'journeyActivationNameToId':_0x2ea271},{..._0x1f91f4,'effectiveFolderId':_0x4084fd},_0x2f5c49,_0x544eea,_0x3ec375);else{ensureJourneyDefaults(_0xe1be6b[_0x28d678(0x207)]);const _0x120bb9=await _0x5b49e5[_0x28d678(0x284)]['create'](_0xe1be6b);return deletePushRecovery(_0xb8bece[_0x28d678(0x1fe)]),{'action':_0x28d678(0x1fd),'journeyId':_0x120bb9['id'],'embeddedSegmentNameToId':_0x96039};}}else{if(_0xb8bece[_0x28d678(0x20f)]&&_0xb8bece[_0x28d678(0x25d)]){_0xe1be6b['id']=_0xb8bece[_0x28d678(0x25d)]['id'];const _0x2a9c03=_0xe1be6b['attributes'];_0xb8bece[_0x28d678(0x25d)][_0x28d678(0x207)]?.['journeyBundleName']&&(_0x2a9c03[_0x28d678(0x205)]=_0xb8bece[_0x28d678(0x25d)][_0x28d678(0x207)][_0x28d678(0x205)]);const _0x1e6cc0=_0xb8bece[_0x28d678(0x25d)][_0x28d678(0x207)]?.[_0x28d678(0x26d)];return _0x1e6cc0&&_0xe1be6b['attributes'][_0x28d678(0x26d)]&&injectExistingStageIds(_0xe1be6b[_0x28d678(0x207)][_0x28d678(0x26d)],_0x1e6cc0),ensureJourneyDefaults(_0x2a9c03),await _0x5b49e5[_0x28d678(0x284)][_0x28d678(0x211)](_0xb8bece[_0x28d678(0x25d)]['id'],_0xe1be6b),deletePushRecovery(_0xb8bece[_0x28d678(0x1fe)]),{'action':'updated','journeyId':_0xb8bece[_0x28d678(0x25d)]['id'],'embeddedSegmentNameToId':_0x96039};}}return deletePushRecovery(_0xb8bece[_0x28d678(0x1fe)]),{'action':'unchanged','journeyId':_0xb8bece[_0x28d678(0x25d)]?.['id'],'embeddedSegmentNameToId':_0x96039};}function findSegmentCriteriaLocation(_0x1dc2d3,_0x35d99c){const _0x46228f=a169_0x1f83a4,_0x4cdecd=_0x1dc2d3[_0x46228f(0x290)]||_0x1dc2d3[_0x46228f(0x233)]?.[0x0]?.[_0x46228f(0x290)]||[];let _0xe609e9='entry',_0x313ae2=_0x35d99c;const _0x4fcafd=_0x1dc2d3[_0x46228f(0x23a)]||_0x1dc2d3[_0x46228f(0x233)]?.[0x0]?.['goal'];if(_0x4fcafd?.['segment']===_0x35d99c)return{'stageName':_0x46228f(0x23a),'criteriaName':_0x4fcafd[_0x46228f(0x1ed)]||_0x35d99c};_0xc30cff:for(const _0xb4b4bb of _0x4cdecd){if(_0xb4b4bb[_0x46228f(0x294)]?.[_0x46228f(0x25f)]===_0x35d99c){_0xe609e9=_0xb4b4bb[_0x46228f(0x1ed)],_0x313ae2=_0xb4b4bb[_0x46228f(0x294)][_0x46228f(0x1ed)]||_0x35d99c;break;}if(_0xb4b4bb['steps'])for(const _0x8fd72c of _0xb4b4bb['steps']){if(_0x8fd72c[_0x46228f(0x2bd)]===_0x46228f(0x28a)&&_0x8fd72c['with']?.[_0x46228f(0x213)])for(const _0x2f0c5e of _0x8fd72c['with'][_0x46228f(0x213)]){if(_0x2f0c5e['segment']===_0x35d99c){_0xe609e9=_0xb4b4bb[_0x46228f(0x1ed)],_0x313ae2=_0x2f0c5e[_0x46228f(0x1ed)]||_0x35d99c;break _0xc30cff;}}}}return{'stageName':_0xe609e9,'criteriaName':_0x313ae2};}async function executeThreeStepJourneyCreate(_0x289d9e,_0x228b44,_0x298e72,_0x59ad48,_0x59f5bf,_0x305363,_0x2bfaa3,_0x108a4b){const _0x5d86c0=a169_0x1f83a4,{activationDefToCreateRequest:_0x54623e,yamlRuleToApi:_0x4320a2}=_0x108a4b,{pendingEmbeddedSegments:_0x303ec3,pendingEmbeddedActivations:_0x20a3db,embeddedSegmentNameToId:_0x3952c4}=_0x59ad48,_0x8ca8c7=JSON[_0x5d86c0(0x1d7)](JSON[_0x5d86c0(0x203)](_0x298e72));ensureJourneyDefaults(_0x8ca8c7['attributes']),stripPendingIds(_0x8ca8c7);const _0xd0ffad=await _0x289d9e[_0x5d86c0(0x284)][_0x5d86c0(0x202)](_0x8ca8c7),_0xf13e47=_0xd0ffad['id'],_0xb37f61=new Map();for(const _0x27dcb5 of _0xd0ffad[_0x5d86c0(0x207)]['journeyStages']){_0xb37f61[_0x5d86c0(0x2aa)](_0x27dcb5[_0x5d86c0(0x1ed)][_0x5d86c0(0x255)](),_0x27dcb5['id']);}recoverSegmentIdsFromPushRecovery(_0x228b44,_0x3952c4,_0x305363[_0x5d86c0(0x2c7)]);for(const [_0x34a3be,{definition:_0xd4111a}]of _0x303ec3){if(_0x3952c4['has'](_0x34a3be)){_0x2bfaa3[_0x5d86c0(0x260)]?.({'type':_0x5d86c0(0x206),'journeyName':_0x228b44[_0x5d86c0(0x2a8)]['name'],'segmentName':_0x34a3be});continue;}const _0x2bb2cb=generateDeterministicJourneySegmentName(_0x228b44[_0x5d86c0(0x2a8)]['name'],_0x34a3be);_0x2bfaa3[_0x5d86c0(0x260)]?.({'type':'embedded_segment_creating','journeyName':_0x228b44[_0x5d86c0(0x2a8)][_0x5d86c0(0x1ed)],'segmentName':_0x34a3be});const _0x3ce395=createSegmentIdResolver(_0x305363['segmentNameToId'],_0x34a3be),_0x3dbf02=await resolveRuleSegmentIds(_0xd4111a['rule'],_0x3ce395),_0x4d5cdd=await createOrRecoverEmbeddedSegment(_0x289d9e,_0x228b44,{'localName':_0x34a3be,'uniqueSegmentName':_0x2bb2cb,'description':_0xd4111a[_0x5d86c0(0x2b0)]||_0x5d86c0(0x2c2)+_0x34a3be,'journeyId':_0xf13e47,'resolvedRule':_0x3dbf02,'parentId':_0x59f5bf['parentId'],'folderId':_0x59f5bf[_0x5d86c0(0x2c3)]||''},_0x4320a2);_0x3952c4[_0x5d86c0(0x2aa)](_0x34a3be,_0x4d5cdd),_0x305363[_0x5d86c0(0x2c7)][_0x5d86c0(0x2aa)](_0x34a3be,_0x4d5cdd),_0x2bfaa3[_0x5d86c0(0x260)]?.({'type':_0x5d86c0(0x206),'journeyName':_0x228b44['yamlConfig'][_0x5d86c0(0x1ed)],'segmentName':_0x34a3be});}const _0x824874=new Map();for(const [_0x59473f,_0x54feb1]of _0x20a3db){_0x2bfaa3['onProgress']?.({'type':_0x5d86c0(0x242),'journeyName':_0x228b44[_0x5d86c0(0x2a8)]['name'],'activationName':_0x59473f});const _0x2208ef=await _0x54623e(_0x54feb1,_0x305363[_0x5d86c0(0x252)]),_0x4344c3={..._0x2208ef,..._0x54feb1[_0x5d86c0(0x21c)]!==undefined&&{'runAfterJourneyRefresh':_0x54feb1[_0x5d86c0(0x21c)]}},_0x378fb7=await _0x289d9e[_0x5d86c0(0x284)][_0x5d86c0(0x29f)](_0xf13e47,_0x4344c3);_0x824874[_0x5d86c0(0x2aa)](_0x59473f,_0x378fb7['id']),_0x59ad48[_0x5d86c0(0x281)][_0x5d86c0(0x2aa)](_0x59473f,_0x378fb7['id']),_0x2bfaa3[_0x5d86c0(0x260)]?.({'type':_0x5d86c0(0x22a),'journeyName':_0x228b44['yamlConfig'][_0x5d86c0(0x1ed)],'activationName':_0x59473f});}const _0x5d9200=JSON[_0x5d86c0(0x1d7)](JSON[_0x5d86c0(0x203)](_0x298e72));return _0x5d9200['id']=_0xf13e47,ensureJourneyDefaults(_0x5d9200[_0x5d86c0(0x207)]),resolvePendingIdsInRequest(_0x5d9200,_0x298e72,_0xb37f61,_0x3952c4,_0x824874,_0x2bfaa3),await _0x289d9e['journey'][_0x5d86c0(0x211)](_0xf13e47,_0x5d9200),deletePushRecovery(_0x228b44[_0x5d86c0(0x1fe)]),{'action':'created','journeyId':_0xf13e47,'embeddedSegmentNameToId':_0x3952c4};}export function stripWaitStepPendingIds(_0x1a6169){const _0x401708=a169_0x1f83a4,_0x3eb89e=_0x1a6169[_0x401708(0x23d)]&&isPendingSegmentId(_0x1a6169[_0x401708(0x23d)]),_0xd39ceb=_0x1a6169['conditions']?.[_0x401708(0x216)](_0x34c91c=>_0x34c91c[_0x401708(0x232)]&&isPendingSegmentId(_0x34c91c[_0x401708(0x232)]));(_0x3eb89e||_0xd39ceb)&&(_0x1a6169['waitStepType']='Duration',_0x1a6169[_0x401708(0x1de)]=0x1,_0x1a6169[_0x401708(0x237)]='day',delete _0x1a6169['conditionSegmentId'],delete _0x1a6169[_0x401708(0x269)],delete _0x1a6169[_0x401708(0x1ff)],delete _0x1a6169[_0x401708(0x295)]);}export function resolveWaitStepPendingIds(_0x336b13,_0x46eb24,_0xbb674f,_0x1bb4e0){const _0x5a8621=a169_0x1f83a4;if(_0x46eb24[_0x5a8621(0x23d)]&&isPendingSegmentId(_0x46eb24[_0x5a8621(0x23d)])){const _0x16ff09=_0xbb674f(_0x46eb24[_0x5a8621(0x23d)],'stage\x20\x27'+_0x1bb4e0+_0x5a8621(0x1f0));_0x16ff09&&(_0x336b13[_0x5a8621(0x2c0)]='Condition',_0x336b13[_0x5a8621(0x23d)]=_0x16ff09,delete _0x336b13['waitStep'],delete _0x336b13[_0x5a8621(0x237)],_0x46eb24[_0x5a8621(0x269)]!==undefined&&(_0x336b13[_0x5a8621(0x269)]=_0x46eb24['conditionTimeoutDuration']),_0x46eb24[_0x5a8621(0x1ff)]&&(_0x336b13['conditionTimeoutUnit']=_0x46eb24['conditionTimeoutUnit']));}if(_0x46eb24[_0x5a8621(0x295)]){const _0x3a104b=_0x46eb24['conditions']['some'](_0x5e1fc2=>_0x5e1fc2['segmentId']&&isPendingSegmentId(_0x5e1fc2[_0x5a8621(0x232)]));if(_0x3a104b){const _0x105aa1=_0x46eb24[_0x5a8621(0x295)][_0x5a8621(0x257)](_0x2e31f4=>{const _0xc06421=_0x5a8621;if(_0x2e31f4[_0xc06421(0x232)]&&isPendingSegmentId(_0x2e31f4[_0xc06421(0x232)])){const _0xb4d9=_0xbb674f(_0x2e31f4[_0xc06421(0x232)],_0xc06421(0x1ef)+_0x1bb4e0+'\x27\x20wait\x20condition');return{..._0x2e31f4,'segmentId':_0xb4d9||_0x2e31f4[_0xc06421(0x232)]};}return{..._0x2e31f4};});_0x336b13[_0x5a8621(0x2c0)]=_0x5a8621(0x201),_0x336b13[_0x5a8621(0x295)]=_0x105aa1,delete _0x336b13['waitStep'],delete _0x336b13[_0x5a8621(0x237)],delete _0x336b13['conditionSegmentId'],delete _0x336b13[_0x5a8621(0x269)],delete _0x336b13[_0x5a8621(0x1ff)];}}}function stripPendingIds(_0x2cd2e6){const _0x4d9d7d=a169_0x1f83a4;_0x2cd2e6['attributes'][_0x4d9d7d(0x23a)]?.[_0x4d9d7d(0x232)]&&isPendingSegmentId(_0x2cd2e6[_0x4d9d7d(0x207)][_0x4d9d7d(0x23a)][_0x4d9d7d(0x232)])&&delete _0x2cd2e6[_0x4d9d7d(0x207)][_0x4d9d7d(0x23a)];for(const _0x29817c of _0x2cd2e6[_0x4d9d7d(0x207)][_0x4d9d7d(0x26d)]||[]){_0x29817c[_0x4d9d7d(0x1e0)]?.[_0x4d9d7d(0x232)]&&isPendingSegmentId(_0x29817c[_0x4d9d7d(0x1e0)][_0x4d9d7d(0x232)])&&delete _0x29817c[_0x4d9d7d(0x1e0)];_0x29817c['milestone']?.[_0x4d9d7d(0x232)]&&isPendingSegmentId(_0x29817c['milestone'][_0x4d9d7d(0x232)])&&delete _0x29817c[_0x4d9d7d(0x2d1)];_0x29817c['exitCriterias']&&(_0x29817c[_0x4d9d7d(0x287)]=_0x29817c[_0x4d9d7d(0x287)][_0x4d9d7d(0x234)](_0xd00329=>!_0xd00329['segmentId']||!isPendingSegmentId(_0xd00329[_0x4d9d7d(0x232)])));if(_0x29817c[_0x4d9d7d(0x22c)])for(const _0x4d4683 of Object['keys'](_0x29817c['steps'])){const _0x1063a7=_0x29817c[_0x4d9d7d(0x22c)][_0x4d4683];_0x1063a7[_0x4d9d7d(0x2bd)]===_0x4d9d7d(0x2d4)&&_0x1063a7[_0x4d9d7d(0x288)]&&isPendingActivationId(_0x1063a7[_0x4d9d7d(0x288)])&&(_0x1063a7[_0x4d9d7d(0x288)]='');if(_0x1063a7['type']===_0x4d9d7d(0x218)&&_0x1063a7[_0x4d9d7d(0x213)])for(const _0x27946d of _0x1063a7[_0x4d9d7d(0x213)]){_0x27946d[_0x4d9d7d(0x232)]&&isPendingSegmentId(_0x27946d[_0x4d9d7d(0x232)])&&(_0x27946d[_0x4d9d7d(0x232)]='');}_0x1063a7[_0x4d9d7d(0x2bd)]==='WaitStep'&&stripWaitStepPendingIds(_0x1063a7);}}}function resolvePendingIdsInRequest(_0x56f947,_0x4f13f9,_0x4021bd,_0x171729,_0x13dc97,_0x7419b2){const _0x366d90=a169_0x1f83a4,_0x3a384a=(_0x559b36,_0x32a098)=>{const _0x5ed400=a169_0x4225;if(!isPendingSegmentId(_0x559b36))return _0x559b36;const _0x246ea7=extractPendingSegmentName(_0x559b36),_0x3bf021=_0x171729[_0x5ed400(0x272)](_0x246ea7);return!_0x3bf021&&_0x7419b2[_0x5ed400(0x2c5)]?.(_0x5ed400(0x256)+_0x246ea7+_0x5ed400(0x241)+_0x32a098),_0x3bf021;};if(_0x56f947[_0x366d90(0x207)][_0x366d90(0x23a)]?.[_0x366d90(0x232)]&&isPendingSegmentId(_0x56f947[_0x366d90(0x207)][_0x366d90(0x23a)]['segmentId'])){const _0x36dfe5=_0x3a384a(_0x56f947['attributes']['goal']['segmentId'],_0x366d90(0x1ec));_0x36dfe5&&(_0x56f947['attributes'][_0x366d90(0x23a)][_0x366d90(0x232)]=_0x36dfe5);}for(const _0x41efb7 of _0x56f947['attributes'][_0x366d90(0x26d)]||[]){const _0x23e199=_0x4021bd[_0x366d90(0x272)](_0x41efb7[_0x366d90(0x1ed)][_0x366d90(0x255)]());_0x23e199&&(_0x41efb7['id']=_0x23e199);if(_0x41efb7[_0x366d90(0x1e0)]?.['segmentId']&&isPendingSegmentId(_0x41efb7['entryCriteria']['segmentId'])){const _0x1cbeca=_0x3a384a(_0x41efb7[_0x366d90(0x1e0)][_0x366d90(0x232)],_0x366d90(0x1ef)+_0x41efb7[_0x366d90(0x1ed)]+_0x366d90(0x25c));_0x1cbeca&&(_0x41efb7[_0x366d90(0x1e0)][_0x366d90(0x232)]=_0x1cbeca);}if(_0x41efb7['exitCriterias'])for(const _0x2d9bcd of _0x41efb7[_0x366d90(0x287)]){if(_0x2d9bcd['segmentId']&&isPendingSegmentId(_0x2d9bcd[_0x366d90(0x232)])){const _0x317f53=_0x3a384a(_0x2d9bcd['segmentId'],_0x366d90(0x1ef)+_0x41efb7[_0x366d90(0x1ed)]+_0x366d90(0x278));_0x317f53&&(_0x2d9bcd[_0x366d90(0x232)]=_0x317f53);}}if(_0x41efb7[_0x366d90(0x2d1)]?.['segmentId']&&isPendingSegmentId(_0x41efb7[_0x366d90(0x2d1)][_0x366d90(0x232)])){const _0x3a1cb0=_0x3a384a(_0x41efb7['milestone'][_0x366d90(0x232)],'stage\x20\x27'+_0x41efb7[_0x366d90(0x1ed)]+_0x366d90(0x2b9));_0x3a1cb0&&(_0x41efb7['milestone']['segmentId']=_0x3a1cb0);}if(_0x41efb7[_0x366d90(0x22c)]){const _0x40b770=_0x3fb92b=>_0x4f13f9['attributes']['journeyStages']?.[_0x366d90(0x262)](_0x36370a=>_0x36370a[_0x366d90(0x1ed)]['toLowerCase']()===_0x41efb7[_0x366d90(0x1ed)][_0x366d90(0x255)]())?.[_0x366d90(0x22c)]?.[_0x3fb92b];for(const _0x1e2d64 of Object[_0x366d90(0x1e9)](_0x41efb7['steps'])){const _0x513b97=_0x41efb7['steps'][_0x1e2d64],_0x40d05f=_0x40b770(_0x1e2d64);if(_0x513b97['type']===_0x366d90(0x2d4)&&_0x513b97[_0x366d90(0x288)]&&(isPendingActivationId(_0x513b97[_0x366d90(0x288)])||_0x513b97[_0x366d90(0x288)]==='')){if(_0x40d05f?.[_0x366d90(0x288)]&&isPendingActivationId(_0x40d05f[_0x366d90(0x288)])){const _0x5a9a57=extractPendingActivationName(_0x40d05f['journeyActivationStepId']),_0x667cee=_0x13dc97[_0x366d90(0x272)](_0x5a9a57);_0x667cee&&(_0x513b97[_0x366d90(0x288)]=_0x667cee);}}if(_0x513b97[_0x366d90(0x2bd)]==='DecisionPoint'&&_0x513b97[_0x366d90(0x213)]&&_0x40d05f?.[_0x366d90(0x213)])for(let _0x5cad60=0x0;_0x5cad60<_0x513b97[_0x366d90(0x213)]['length'];_0x5cad60++){const _0xd0589a=_0x513b97['branches'][_0x5cad60],_0x1888ec=_0x40d05f[_0x366d90(0x213)][_0x5cad60];if(_0x1888ec?.['segmentId']&&isPendingSegmentId(_0x1888ec[_0x366d90(0x232)])){const _0x581f2f=_0x3a384a(_0x1888ec[_0x366d90(0x232)],_0x366d90(0x1ef)+_0x41efb7['name']+_0x366d90(0x2d5)+(_0xd0589a[_0x366d90(0x1ed)]||_0x5cad60)+'\x27');_0x581f2f&&(_0xd0589a[_0x366d90(0x232)]=_0x581f2f);}}_0x513b97[_0x366d90(0x2bd)]===_0x366d90(0x1e5)&&_0x40d05f?.['type']===_0x366d90(0x1e5)&&resolveWaitStepPendingIds(_0x513b97,_0x40d05f,_0x3a384a,_0x41efb7[_0x366d90(0x1ed)]);}}}}
@@ -1 +1 @@
1
- (function(_0x136566,_0x4d44c1){const _0x337967=a169_0x4cf2,_0x2ec916=_0x136566();while(!![]){try{const _0x330945=-parseInt(_0x337967(0x1b2))/0x1*(-parseInt(_0x337967(0x1ae))/0x2)+-parseInt(_0x337967(0x1bb))/0x3+parseInt(_0x337967(0x1b7))/0x4*(parseInt(_0x337967(0x1b9))/0x5)+-parseInt(_0x337967(0x1ab))/0x6+-parseInt(_0x337967(0x1ba))/0x7+parseInt(_0x337967(0x1ac))/0x8*(parseInt(_0x337967(0x1b6))/0x9)+-parseInt(_0x337967(0x1b8))/0xa*(-parseInt(_0x337967(0x1b1))/0xb);if(_0x330945===_0x4d44c1)break;else _0x2ec916['push'](_0x2ec916['shift']());}catch(_0x253fd7){_0x2ec916['push'](_0x2ec916['shift']());}}}(a169_0x305a,0x1cf32));export function buildFolderIdToPathMap(_0x47bad0){const _0x5c253e=a169_0x4cf2,_0xceb18b=new Map(),_0x43d615=new Map();for(const _0x3df524 of _0x47bad0){_0x43d615[_0x5c253e(0x1af)](_0x3df524['id'],_0x3df524);}const _0x314b5d=new Set();for(const _0x239cc9 of _0x47bad0){!_0x239cc9[_0x5c253e(0x1b4)]&&_0x314b5d[_0x5c253e(0x1b3)](_0x239cc9['id']);}function _0x3df08c(_0xf812dd){const _0x5439df=_0x5c253e;if(_0xceb18b['has'](_0xf812dd['id']))return _0xceb18b[_0x5439df(0x1b5)](_0xf812dd['id']);if(_0x314b5d[_0x5439df(0x1ad)](_0xf812dd['id']))return _0xceb18b[_0x5439df(0x1af)](_0xf812dd['id'],''),'';if(_0xf812dd[_0x5439df(0x1b4)]){const _0x3cf1da=_0x43d615[_0x5439df(0x1b5)](_0xf812dd[_0x5439df(0x1b4)]);if(_0x3cf1da){const _0x122a8e=_0x3df08c(_0x3cf1da),_0x493aec=_0x122a8e?_0x122a8e+'/'+_0xf812dd['name']:_0xf812dd['name'];return _0xceb18b[_0x5439df(0x1af)](_0xf812dd['id'],_0x493aec),_0x493aec;}}const _0x56d26a=_0xf812dd['name'];return _0xceb18b[_0x5439df(0x1af)](_0xf812dd['id'],_0x56d26a),_0x56d26a;}for(const _0x590cb4 of _0x47bad0){_0x3df08c(_0x590cb4);}return _0xceb18b;}export function buildFolderPathToIdMap(_0x25cedc){const _0x106152=a169_0x4cf2,_0x202d3a=new Map(),_0x2be276=new Map();for(const _0x4b6347 of _0x25cedc){_0x2be276['set'](_0x4b6347['id'],_0x4b6347);}const _0x1ced9c=new Set();for(const _0x46dbde of _0x25cedc){!_0x46dbde[_0x106152(0x1b4)]&&_0x1ced9c[_0x106152(0x1b3)](_0x46dbde['id']);}function _0x3a46fd(_0xa3df16){const _0x11f9dc=_0x106152;if(_0x1ced9c[_0x11f9dc(0x1ad)](_0xa3df16['id']))return'';if(_0xa3df16[_0x11f9dc(0x1b4)]){const _0x2b001c=_0x2be276['get'](_0xa3df16['parentFolderId']);if(_0x2b001c){const _0x1135b0=_0x3a46fd(_0x2b001c);return _0x1135b0?_0x1135b0+'/'+_0xa3df16[_0x11f9dc(0x1b0)]:_0xa3df16['name'];}}return _0xa3df16['name'];}for(const _0x568605 of _0x25cedc){const _0x34cb33=_0x3a46fd(_0x568605);_0x202d3a[_0x106152(0x1af)](_0x34cb33,_0x568605['id']);}return _0x202d3a;}function a169_0x4cf2(_0x5e73c8,_0x1f5f64){_0x5e73c8=_0x5e73c8-0x1ab;const _0x305aa6=a169_0x305a();let _0x4cf2c8=_0x305aa6[_0x5e73c8];return _0x4cf2c8;}function a169_0x305a(){const _0x5d6ffe=['834309UPzlyV','578721IXGsQb','641124YutTIa','305464zkgXjv','has','219108mwGcGS','set','name','88209VcliKL','1zDUDHV','add','parentFolderId','get','27BnYPBP','4TTcmHg','360fcWkvx','123695fZAZuP'];a169_0x305a=function(){return _0x5d6ffe;};return a169_0x305a();}export function buildFolderMaps(_0x2f0423){const _0x4b0b6b=buildFolderIdToPathMap(_0x2f0423),_0xdee6ff=new Map();for(const [_0x3ae025,_0x3f7596]of _0x4b0b6b){_0xdee6ff['set'](_0x3f7596,_0x3ae025);}return{'idToPath':_0x4b0b6b,'pathToId':_0xdee6ff};}export function getFolderPath(_0x23d3b8,_0x1e991d){const _0x18454a=a169_0x4cf2;if(!_0x23d3b8)return'';return _0x1e991d[_0x18454a(0x1b5)](_0x23d3b8)??'';}
1
+ (function(_0x517615,_0x1c8fbf){const _0x73ebc2=a170_0xd1c5,_0x47ea9a=_0x517615();while(!![]){try{const _0x34467f=parseInt(_0x73ebc2(0xb7))/0x1+-parseInt(_0x73ebc2(0xb9))/0x2+parseInt(_0x73ebc2(0xb2))/0x3*(parseInt(_0x73ebc2(0xb8))/0x4)+-parseInt(_0x73ebc2(0xb1))/0x5*(parseInt(_0x73ebc2(0xbc))/0x6)+parseInt(_0x73ebc2(0xb3))/0x7+parseInt(_0x73ebc2(0xb0))/0x8*(parseInt(_0x73ebc2(0xbb))/0x9)+parseInt(_0x73ebc2(0xae))/0xa*(-parseInt(_0x73ebc2(0xba))/0xb);if(_0x34467f===_0x1c8fbf)break;else _0x47ea9a['push'](_0x47ea9a['shift']());}catch(_0x2924b8){_0x47ea9a['push'](_0x47ea9a['shift']());}}}(a170_0x4d9c,0xc8539));export function buildFolderIdToPathMap(_0x443afa){const _0x5a3f2f=a170_0xd1c5,_0x51ffbb=new Map(),_0x571a5a=new Map();for(const _0x486cbb of _0x443afa){_0x571a5a['set'](_0x486cbb['id'],_0x486cbb);}const _0x17e7cb=new Set();for(const _0x2f5763 of _0x443afa){!_0x2f5763[_0x5a3f2f(0xaf)]&&_0x17e7cb[_0x5a3f2f(0xbe)](_0x2f5763['id']);}function _0x2dc8b7(_0x2d70b6){const _0x553f40=_0x5a3f2f;if(_0x51ffbb[_0x553f40(0xbd)](_0x2d70b6['id']))return _0x51ffbb['get'](_0x2d70b6['id']);if(_0x17e7cb[_0x553f40(0xbd)](_0x2d70b6['id']))return _0x51ffbb[_0x553f40(0xb6)](_0x2d70b6['id'],''),'';if(_0x2d70b6[_0x553f40(0xaf)]){const _0x1b692e=_0x571a5a['get'](_0x2d70b6[_0x553f40(0xaf)]);if(_0x1b692e){const _0x316db5=_0x2dc8b7(_0x1b692e),_0x56c4fb=_0x316db5?_0x316db5+'/'+_0x2d70b6[_0x553f40(0xb4)]:_0x2d70b6[_0x553f40(0xb4)];return _0x51ffbb[_0x553f40(0xb6)](_0x2d70b6['id'],_0x56c4fb),_0x56c4fb;}}const _0x31616d=_0x2d70b6[_0x553f40(0xb4)];return _0x51ffbb[_0x553f40(0xb6)](_0x2d70b6['id'],_0x31616d),_0x31616d;}for(const _0x6e8c1b of _0x443afa){_0x2dc8b7(_0x6e8c1b);}return _0x51ffbb;}function a170_0xd1c5(_0x5dae94,_0x2fd68e){_0x5dae94=_0x5dae94-0xae;const _0x4d9c23=a170_0x4d9c();let _0xd1c537=_0x4d9c23[_0x5dae94];return _0xd1c537;}function a170_0x4d9c(){const _0x5dd6a2=['249fevQOq','2046366OtPHJH','name','get','set','1616550tdEYlG','72188PwEdkZ','157458DRQEnV','308WLcLEJ','8003601BXkIUZ','1614QIUxSm','has','add','926470KIbxFV','parentFolderId','8MweDhm','14920hcOWUB'];a170_0x4d9c=function(){return _0x5dd6a2;};return a170_0x4d9c();}export function buildFolderPathToIdMap(_0x518f74){const _0x5319d2=a170_0xd1c5,_0x4fa6e5=new Map(),_0x33e8ba=new Map();for(const _0x30a77f of _0x518f74){_0x33e8ba[_0x5319d2(0xb6)](_0x30a77f['id'],_0x30a77f);}const _0x2e8332=new Set();for(const _0x536991 of _0x518f74){!_0x536991[_0x5319d2(0xaf)]&&_0x2e8332[_0x5319d2(0xbe)](_0x536991['id']);}function _0x1255d2(_0x599195){const _0x444157=_0x5319d2;if(_0x2e8332['has'](_0x599195['id']))return'';if(_0x599195[_0x444157(0xaf)]){const _0x847b66=_0x33e8ba[_0x444157(0xb5)](_0x599195[_0x444157(0xaf)]);if(_0x847b66){const _0x26eb20=_0x1255d2(_0x847b66);return _0x26eb20?_0x26eb20+'/'+_0x599195['name']:_0x599195[_0x444157(0xb4)];}}return _0x599195[_0x444157(0xb4)];}for(const _0x5eadfe of _0x518f74){const _0x5b2034=_0x1255d2(_0x5eadfe);_0x4fa6e5[_0x5319d2(0xb6)](_0x5b2034,_0x5eadfe['id']);}return _0x4fa6e5;}export function buildFolderMaps(_0x467b3c){const _0x1ae166=a170_0xd1c5,_0x19a519=buildFolderIdToPathMap(_0x467b3c),_0x5b1aa2=new Map();for(const [_0x2df242,_0x1d262f]of _0x19a519){_0x5b1aa2[_0x1ae166(0xb6)](_0x1d262f,_0x2df242);}return{'idToPath':_0x19a519,'pathToId':_0x5b1aa2};}export function getFolderPath(_0x53ce73,_0x19c220){const _0x1277c7=a170_0xd1c5;if(!_0x53ce73)return'';return _0x19c220[_0x1277c7(0xb5)](_0x53ce73)??'';}
@@ -1 +1 @@
1
- (function(_0x29bf1e,_0x114610){const _0x53eaf3=a170_0x50f0,_0x3d2475=_0x29bf1e();while(!![]){try{const _0x589055=parseInt(_0x53eaf3(0x196))/0x1+parseInt(_0x53eaf3(0x197))/0x2*(-parseInt(_0x53eaf3(0x185))/0x3)+parseInt(_0x53eaf3(0x18f))/0x4*(-parseInt(_0x53eaf3(0x192))/0x5)+parseInt(_0x53eaf3(0x1a5))/0x6*(-parseInt(_0x53eaf3(0x18e))/0x7)+-parseInt(_0x53eaf3(0x19d))/0x8*(-parseInt(_0x53eaf3(0x1a2))/0x9)+parseInt(_0x53eaf3(0x191))/0xa+-parseInt(_0x53eaf3(0x1a9))/0xb;if(_0x589055===_0x114610)break;else _0x3d2475['push'](_0x3d2475['shift']());}catch(_0x55f62b){_0x3d2475['push'](_0x3d2475['shift']());}}}(a170_0x59c4,0x2707e));import a170_0x4c10e0 from'path';function a170_0x50f0(_0x24ee7d,_0x3b61f4){_0x24ee7d=_0x24ee7d-0x182;const _0x59c4bd=a170_0x59c4();let _0x50f032=_0x59c4bd[_0x24ee7d];return _0x50f032;}import{parse as a170_0x24916d}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';import{isJourneyDef}from'./journey-yaml.js';export function parsePath(_0x506e83){const _0x884653=a170_0x50f0;if(!_0x506e83||_0x506e83[_0x884653(0x183)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x17e80b=_0x506e83[_0x884653(0x183)]();if(_0x17e80b==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x506e83};const _0x38f2b2=_0x17e80b['startsWith']('/')?_0x17e80b[_0x884653(0x1a8)](0x1):_0x17e80b,_0x6d0cba=_0x38f2b2[_0x884653(0x19e)]('/')[_0x884653(0x182)](_0x2346d2=>_0x2346d2!=='');if(_0x6d0cba[_0x884653(0x19c)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x5f218b=_0x17e80b['startsWith']('/')||!isRelativePathSegment(_0x6d0cba[0x0]);for(const _0x3fddf3 of _0x6d0cba){validatePathSegment(_0x3fddf3);}return{'segments':_0x6d0cba,'isAbsolute':_0x5f218b,'raw':_0x506e83};}function a170_0x59c4(){const _0x21330a=['name','Path\x20attempts\x20to\x20navigate\x20above\x20root','.yaml','endsWith','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','isAbsolute','7qzJNhs','554876KhKNhQ','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','3150310IRjTqm','5NpwmVY','File\x20not\x20found:\x20','pop','Cannot\x20split\x20empty\x20path','234885nwoDPZ','182jxKLcD','Path\x20segment\x20cannot\x20be\x20empty','tdx.json','dirname','segment','length','102632GybBJg','split','journey','readFile','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','135GXaMlC','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','845238sqzlqK','parse','exists','substring','2377826AzTJnc','No\x20tdx.json\x20found\x20for\x20file:\x20','resolve','push','raw','root','Relative\x20path\x20cannot\x20be\x20empty','join','startsWith','segments','relative','filter','trim','.yml','2859TdKpSR','slice','test'];a170_0x59c4=function(){return _0x21330a;};return a170_0x59c4();}function isRelativePathSegment(_0x5b2b40){return _0x5b2b40==='.'||_0x5b2b40==='..';}function validatePathSegment(_0x5eedf2){const _0x27e397=a170_0x50f0;if(_0x5eedf2==='')throw new Error(_0x27e397(0x198));if(_0x5eedf2==='.'||_0x5eedf2==='..')return;if(/[\x00-\x1F\x7F]/[_0x27e397(0x187)](_0x5eedf2))throw new Error(_0x27e397(0x1a4)+_0x5eedf2);if(_0x5eedf2!==_0x5eedf2[_0x27e397(0x183)]()){}}export function validatePath(_0x574d55){const _0x4cb9f9=a170_0x50f0;if(_0x574d55[_0x4cb9f9(0x1b2)][_0x4cb9f9(0x19c)]===0x0&&!_0x574d55[_0x4cb9f9(0x18d)])throw new Error(_0x4cb9f9(0x1af));if(_0x574d55['isAbsolute']){if(_0x574d55[_0x4cb9f9(0x1b2)][0x0]==='..')throw new Error(_0x4cb9f9(0x1a1));let _0x1e0114=0x0;for(const _0xcba25f of _0x574d55[_0x4cb9f9(0x1b2)]){if(_0xcba25f==='..'){if(_0x1e0114===0x0)throw new Error(_0x4cb9f9(0x189));_0x1e0114--;}else _0xcba25f!=='.'&&_0x1e0114++;}}}export function joinPaths(_0x4a886a,_0x13159a){const _0x5eb1a9=a170_0x50f0;if(!_0x4a886a||_0x4a886a==='/')return _0x13159a;if(!_0x13159a||_0x13159a==='.')return _0x4a886a;if(_0x13159a[_0x5eb1a9(0x1b1)]('/'))return _0x13159a;const _0x182064=parsePath(_0x4a886a),_0x40b90c=parsePath(_0x13159a),_0x53ebc4=[..._0x182064[_0x5eb1a9(0x1b2)]];for(const _0x43170b of _0x40b90c[_0x5eb1a9(0x1b2)]){if(_0x43170b==='.')continue;else{if(_0x43170b==='..'){if(_0x53ebc4['length']===0x0)throw new Error(_0x5eb1a9(0x1a3));_0x53ebc4[_0x5eb1a9(0x194)]();}else _0x53ebc4[_0x5eb1a9(0x1ac)](_0x43170b);}}const _0x48b760=_0x53ebc4[_0x5eb1a9(0x1b0)]('/');return _0x182064['raw']['startsWith']('/')?'/'+_0x48b760:_0x48b760;}export function normalizePath(_0x1ceafd){const _0x103a9b=a170_0x50f0,_0x2e29ad=parsePath(_0x1ceafd),_0x533ce1=[];for(const _0x588cba of _0x2e29ad[_0x103a9b(0x1b2)]){if(_0x588cba==='.')continue;else{if(_0x588cba==='..'){if(_0x533ce1[_0x103a9b(0x19c)]===0x0){if(_0x2e29ad[_0x103a9b(0x18d)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x533ce1[_0x103a9b(0x1ac)]('..');}else _0x533ce1[_0x533ce1[_0x103a9b(0x19c)]-0x1]==='..'?_0x533ce1['push']('..'):_0x533ce1[_0x103a9b(0x194)]();}else _0x533ce1['push'](_0x588cba);}}if(_0x533ce1[_0x103a9b(0x19c)]===0x0)return _0x2e29ad[_0x103a9b(0x18d)]?'/':'.';const _0x4de025=_0x533ce1[_0x103a9b(0x1b0)]('/');return _0x2e29ad[_0x103a9b(0x1ad)][_0x103a9b(0x1b1)]('/')?'/'+_0x4de025:_0x4de025;}export function getParentPath(_0x4df2f7){const _0x204948=a170_0x50f0,_0x1ae74c=parsePath(_0x4df2f7);if(_0x1ae74c[_0x204948(0x1b2)][_0x204948(0x19c)]<=0x1)return'/';const _0x29d376=_0x1ae74c[_0x204948(0x1b2)][_0x204948(0x186)](0x0,-0x1)['join']('/');return _0x1ae74c['raw'][_0x204948(0x1b1)]('/')?'/'+_0x29d376:_0x29d376;}export function getBaseName(_0x5122cc){const _0x425a7f=a170_0x50f0,_0x1c4f5c=parsePath(_0x5122cc);return _0x1c4f5c[_0x425a7f(0x1b2)][_0x1c4f5c['segments'][_0x425a7f(0x19c)]-0x1]||'';}export function isChildPath(_0x444f7a,_0x49954e){const _0x2ec323=a170_0x50f0,_0x49b4a1=parsePath(_0x444f7a),_0x3566d8=parsePath(_0x49954e);if(_0x49b4a1['segments'][_0x2ec323(0x19c)]<=_0x3566d8[_0x2ec323(0x1b2)]['length'])return![];for(let _0x2c612d=0x0;_0x2c612d<_0x3566d8[_0x2ec323(0x1b2)]['length'];_0x2c612d++){if(_0x49b4a1[_0x2ec323(0x1b2)][_0x2c612d]!==_0x3566d8[_0x2ec323(0x1b2)][_0x2c612d])return![];}return!![];}export function splitPath(_0x5baad8){const _0x4c73f5=a170_0x50f0,_0x1472ff=parsePath(_0x5baad8);if(_0x1472ff[_0x4c73f5(0x1b2)]['length']===0x0)throw new Error(_0x4c73f5(0x195));if(_0x1472ff[_0x4c73f5(0x1b2)][_0x4c73f5(0x19c)]===0x1)return{'parent':_0x1472ff[_0x4c73f5(0x1b2)][0x0]};return{'parent':_0x1472ff[_0x4c73f5(0x1b2)][0x0],'child':_0x1472ff[_0x4c73f5(0x1b2)][_0x4c73f5(0x186)](0x1)['join']('/')};}export function isYamlFilePath(_0xb5b438){const _0x542ea1=a170_0x50f0;return _0xb5b438['endsWith'](_0x542ea1(0x184))||_0xb5b438[_0x542ea1(0x18b)](_0x542ea1(0x18a));}export async function resolveYamlFilePath(_0x3ef182,_0x5cb670=nodeFileSystem){const _0xa82e93=a170_0x50f0,_0x2f4749=a170_0x4c10e0[_0xa82e93(0x1ab)](_0x3ef182);if(!await _0x5cb670[_0xa82e93(0x1a7)](_0x2f4749))throw new Error(_0xa82e93(0x193)+_0x3ef182);let _0x17bc59=a170_0x4c10e0[_0xa82e93(0x19a)](_0x2f4749),_0x104919=null,_0x8888ab=null;const _0x40385a=a170_0x4c10e0[_0xa82e93(0x1a6)](_0x17bc59)[_0xa82e93(0x1ae)];while(_0x17bc59!==_0x40385a){const _0x597e67=a170_0x4c10e0[_0xa82e93(0x1b0)](_0x17bc59,_0xa82e93(0x199));if(await _0x5cb670['exists'](_0x597e67)){_0x104919=_0x597e67,_0x8888ab=_0x17bc59;break;}_0x17bc59=a170_0x4c10e0[_0xa82e93(0x19a)](_0x17bc59);}if(!_0x104919||!_0x8888ab)throw new Error(_0xa82e93(0x1aa)+_0x3ef182+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x4b9c2f=await _0x5cb670[_0xa82e93(0x1a0)](_0x104919),_0x3e3d05=JSON[_0xa82e93(0x1a6)](_0x4b9c2f),_0x3d802d=_0x3e3d05['parent_segment'];if(!_0x3d802d)throw new Error(_0xa82e93(0x18c));const _0x1946ae=await _0x5cb670[_0xa82e93(0x1a0)](_0x2f4749),_0x38a6ef=a170_0x24916d(_0x1946ae),_0x2b6174=_0x38a6ef[_0xa82e93(0x188)];if(!_0x2b6174)throw new Error(_0xa82e93(0x190)+_0x3ef182);const _0x55a866=isJourneyDef(_0x38a6ef,_0x2f4749)?_0xa82e93(0x19f):_0xa82e93(0x19b),_0x369925=a170_0x4c10e0[_0xa82e93(0x1b3)](_0x8888ab,_0x2f4749),_0x297a59=a170_0x4c10e0['dirname'](_0x369925),_0x44fd8e=_0x297a59==='.'?'':_0x297a59['replace'](/\\/g,'/'),_0x4233ea=_0x44fd8e?_0x3d802d+'/'+_0x44fd8e+'/'+_0x2b6174:_0x3d802d+'/'+_0x2b6174;return{'parentSegment':_0x3d802d,'segmentName':_0x2b6174,'folderPath':_0x44fd8e,'fullPath':_0x4233ea,'resourceType':_0x55a866,'content':_0x1946ae};}
1
+ (function(_0x1f7c2c,_0x4a853b){const _0xe1a41a=a171_0x43d5,_0x1ddf84=_0x1f7c2c();while(!![]){try{const _0x108ffe=-parseInt(_0xe1a41a(0x1c2))/0x1*(-parseInt(_0xe1a41a(0x1d9))/0x2)+parseInt(_0xe1a41a(0x1b8))/0x3+-parseInt(_0xe1a41a(0x1cc))/0x4+-parseInt(_0xe1a41a(0x1dd))/0x5+-parseInt(_0xe1a41a(0x1be))/0x6*(parseInt(_0xe1a41a(0x1c0))/0x7)+-parseInt(_0xe1a41a(0x1d7))/0x8+parseInt(_0xe1a41a(0x1c9))/0x9;if(_0x108ffe===_0x4a853b)break;else _0x1ddf84['push'](_0x1ddf84['shift']());}catch(_0x1de48f){_0x1ddf84['push'](_0x1ddf84['shift']());}}}(a171_0x426e,0xe23a0));function a171_0x426e(){const _0x574c9a=['segments','name','30402495BQIgzw','File\x20not\x20found:\x20','.yaml','5710968kACajF','startsWith','parent_segment','slice','pop','segment','raw','trim','endsWith','Path\x20segment\x20cannot\x20be\x20empty','No\x20tdx.json\x20found\x20for\x20file:\x20','13384336SjVRiG','readFile','453278jmSCrv','Cannot\x20split\x20empty\x20path','Path\x20cannot\x20be\x20empty','dirname','1774380CCQtRu','replace','split','journey','Cannot\x20navigate\x20above\x20root','.yml','parse','isAbsolute','2525328Edbddr','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','substring','root','resolve','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','12LdikJV','join','3397597CJhYtq','push','5rQpZEQ','length','exists','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','relative'];a171_0x426e=function(){return _0x574c9a;};return a171_0x426e();}function a171_0x43d5(_0x17df20,_0x1ada4f){_0x17df20=_0x17df20-0x1b6;const _0x426e87=a171_0x426e();let _0x43d59d=_0x426e87[_0x17df20];return _0x43d59d;}import a171_0x15895b from'path';import{parse as a171_0x41037b}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';import{isJourneyDef}from'./journey-yaml.js';export function parsePath(_0x521ed0){const _0x24aaa3=a171_0x43d5;if(!_0x521ed0||_0x521ed0[_0x24aaa3(0x1d3)]()==='')throw new Error(_0x24aaa3(0x1db));const _0x13eda3=_0x521ed0[_0x24aaa3(0x1d3)]();if(_0x13eda3==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x521ed0};const _0xd65ad5=_0x13eda3['startsWith']('/')?_0x13eda3[_0x24aaa3(0x1ba)](0x1):_0x13eda3,_0x15ed0b=_0xd65ad5[_0x24aaa3(0x1df)]('/')['filter'](_0x351e6f=>_0x351e6f!=='');if(_0x15ed0b[_0x24aaa3(0x1c3)]===0x0)throw new Error(_0x24aaa3(0x1b9));const _0x252c34=_0x13eda3[_0x24aaa3(0x1cd)]('/')||!isRelativePathSegment(_0x15ed0b[0x0]);for(const _0x48ed95 of _0x15ed0b){validatePathSegment(_0x48ed95);}return{'segments':_0x15ed0b,'isAbsolute':_0x252c34,'raw':_0x521ed0};}function isRelativePathSegment(_0x5c72f7){return _0x5c72f7==='.'||_0x5c72f7==='..';}function validatePathSegment(_0x446384){const _0x193d99=a171_0x43d5;if(_0x446384==='')throw new Error(_0x193d99(0x1d5));if(_0x446384==='.'||_0x446384==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x446384))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x446384);if(_0x446384!==_0x446384[_0x193d99(0x1d3)]()){}}export function validatePath(_0x1527c4){const _0x188f20=a171_0x43d5;if(_0x1527c4['segments'][_0x188f20(0x1c3)]===0x0&&!_0x1527c4[_0x188f20(0x1b7)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x1527c4[_0x188f20(0x1b7)]){if(_0x1527c4['segments'][0x0]==='..')throw new Error(_0x188f20(0x1bd));let _0x1b28c8=0x0;for(const _0x5af112 of _0x1527c4[_0x188f20(0x1c7)]){if(_0x5af112==='..'){if(_0x1b28c8===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x1b28c8--;}else _0x5af112!=='.'&&_0x1b28c8++;}}}export function joinPaths(_0x3c8727,_0x396baf){const _0x5c4502=a171_0x43d5;if(!_0x3c8727||_0x3c8727==='/')return _0x396baf;if(!_0x396baf||_0x396baf==='.')return _0x3c8727;if(_0x396baf[_0x5c4502(0x1cd)]('/'))return _0x396baf;const _0x2a2c82=parsePath(_0x3c8727),_0x45d32f=parsePath(_0x396baf),_0x520abb=[..._0x2a2c82[_0x5c4502(0x1c7)]];for(const _0x3cd47a of _0x45d32f['segments']){if(_0x3cd47a==='.')continue;else{if(_0x3cd47a==='..'){if(_0x520abb[_0x5c4502(0x1c3)]===0x0)throw new Error(_0x5c4502(0x1e1));_0x520abb[_0x5c4502(0x1d0)]();}else _0x520abb['push'](_0x3cd47a);}}const _0x386d99=_0x520abb['join']('/');return _0x2a2c82[_0x5c4502(0x1d2)][_0x5c4502(0x1cd)]('/')?'/'+_0x386d99:_0x386d99;}export function normalizePath(_0x112cec){const _0x2b5b91=a171_0x43d5,_0xc48b0=parsePath(_0x112cec),_0x4b47d2=[];for(const _0x318f2e of _0xc48b0[_0x2b5b91(0x1c7)]){if(_0x318f2e==='.')continue;else{if(_0x318f2e==='..'){if(_0x4b47d2[_0x2b5b91(0x1c3)]===0x0){if(_0xc48b0['isAbsolute'])throw new Error(_0x2b5b91(0x1e1));_0x4b47d2[_0x2b5b91(0x1c1)]('..');}else _0x4b47d2[_0x4b47d2[_0x2b5b91(0x1c3)]-0x1]==='..'?_0x4b47d2[_0x2b5b91(0x1c1)]('..'):_0x4b47d2[_0x2b5b91(0x1d0)]();}else _0x4b47d2[_0x2b5b91(0x1c1)](_0x318f2e);}}if(_0x4b47d2[_0x2b5b91(0x1c3)]===0x0)return _0xc48b0[_0x2b5b91(0x1b7)]?'/':'.';const _0x1c19d7=_0x4b47d2[_0x2b5b91(0x1bf)]('/');return _0xc48b0[_0x2b5b91(0x1d2)][_0x2b5b91(0x1cd)]('/')?'/'+_0x1c19d7:_0x1c19d7;}export function getParentPath(_0x457ddc){const _0x3f275c=a171_0x43d5,_0x292a4e=parsePath(_0x457ddc);if(_0x292a4e[_0x3f275c(0x1c7)][_0x3f275c(0x1c3)]<=0x1)return'/';const _0x19e005=_0x292a4e[_0x3f275c(0x1c7)][_0x3f275c(0x1cf)](0x0,-0x1)['join']('/');return _0x292a4e[_0x3f275c(0x1d2)]['startsWith']('/')?'/'+_0x19e005:_0x19e005;}export function getBaseName(_0x59fc93){const _0x125c34=a171_0x43d5,_0x42caf1=parsePath(_0x59fc93);return _0x42caf1[_0x125c34(0x1c7)][_0x42caf1[_0x125c34(0x1c7)][_0x125c34(0x1c3)]-0x1]||'';}export function isChildPath(_0x5ea6b8,_0x2ec65b){const _0x106557=a171_0x43d5,_0x3f3d45=parsePath(_0x5ea6b8),_0x5ce4a4=parsePath(_0x2ec65b);if(_0x3f3d45['segments'][_0x106557(0x1c3)]<=_0x5ce4a4[_0x106557(0x1c7)][_0x106557(0x1c3)])return![];for(let _0x2ed696=0x0;_0x2ed696<_0x5ce4a4[_0x106557(0x1c7)]['length'];_0x2ed696++){if(_0x3f3d45[_0x106557(0x1c7)][_0x2ed696]!==_0x5ce4a4['segments'][_0x2ed696])return![];}return!![];}export function splitPath(_0x5a72b0){const _0x2de8a=a171_0x43d5,_0x31fcf4=parsePath(_0x5a72b0);if(_0x31fcf4[_0x2de8a(0x1c7)]['length']===0x0)throw new Error(_0x2de8a(0x1da));if(_0x31fcf4[_0x2de8a(0x1c7)][_0x2de8a(0x1c3)]===0x1)return{'parent':_0x31fcf4[_0x2de8a(0x1c7)][0x0]};return{'parent':_0x31fcf4[_0x2de8a(0x1c7)][0x0],'child':_0x31fcf4['segments'][_0x2de8a(0x1cf)](0x1)[_0x2de8a(0x1bf)]('/')};}export function isYamlFilePath(_0x17ee55){const _0x5eb1db=a171_0x43d5;return _0x17ee55['endsWith'](_0x5eb1db(0x1e2))||_0x17ee55[_0x5eb1db(0x1d4)](_0x5eb1db(0x1cb));}export async function resolveYamlFilePath(_0x208b28,_0x5f575a=nodeFileSystem){const _0x1625c7=a171_0x43d5,_0x2f440c=a171_0x15895b[_0x1625c7(0x1bc)](_0x208b28);if(!await _0x5f575a[_0x1625c7(0x1c4)](_0x2f440c))throw new Error(_0x1625c7(0x1ca)+_0x208b28);let _0x20a515=a171_0x15895b[_0x1625c7(0x1dc)](_0x2f440c),_0x1c5f8f=null,_0x302b5d=null;const _0x5c7328=a171_0x15895b[_0x1625c7(0x1b6)](_0x20a515)[_0x1625c7(0x1bb)];while(_0x20a515!==_0x5c7328){const _0x157745=a171_0x15895b[_0x1625c7(0x1bf)](_0x20a515,'tdx.json');if(await _0x5f575a[_0x1625c7(0x1c4)](_0x157745)){_0x1c5f8f=_0x157745,_0x302b5d=_0x20a515;break;}_0x20a515=a171_0x15895b['dirname'](_0x20a515);}if(!_0x1c5f8f||!_0x302b5d)throw new Error(_0x1625c7(0x1d6)+_0x208b28+'\x0a'+_0x1625c7(0x1c5));const _0x40f8fe=await _0x5f575a['readFile'](_0x1c5f8f),_0x22c353=JSON[_0x1625c7(0x1b6)](_0x40f8fe),_0x1d69f4=_0x22c353[_0x1625c7(0x1ce)];if(!_0x1d69f4)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x2c97d3=await _0x5f575a[_0x1625c7(0x1d8)](_0x2f440c),_0x30841=a171_0x41037b(_0x2c97d3),_0x3863cf=_0x30841[_0x1625c7(0x1c8)];if(!_0x3863cf)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x208b28);const _0xd62d5d=isJourneyDef(_0x30841,_0x2f440c)?_0x1625c7(0x1e0):_0x1625c7(0x1d1),_0x59b820=a171_0x15895b[_0x1625c7(0x1c6)](_0x302b5d,_0x2f440c),_0x440ae0=a171_0x15895b[_0x1625c7(0x1dc)](_0x59b820),_0xa43d7e=_0x440ae0==='.'?'':_0x440ae0[_0x1625c7(0x1de)](/\\/g,'/'),_0x3c437a=_0xa43d7e?_0x1d69f4+'/'+_0xa43d7e+'/'+_0x3863cf:_0x1d69f4+'/'+_0x3863cf;return{'parentSegment':_0x1d69f4,'segmentName':_0x3863cf,'folderPath':_0xa43d7e,'fullPath':_0x3c437a,'resourceType':_0xd62d5d,'content':_0x2c97d3};}
@@ -1 +1 @@
1
- (function(_0x4da345,_0x23e731){const _0x4cee94=a171_0x185f,_0x2b2ec0=_0x4da345();while(!![]){try{const _0x48402a=-parseInt(_0x4cee94(0x162))/0x1+parseInt(_0x4cee94(0x15d))/0x2+-parseInt(_0x4cee94(0x163))/0x3*(-parseInt(_0x4cee94(0x15b))/0x4)+parseInt(_0x4cee94(0x158))/0x5*(parseInt(_0x4cee94(0x165))/0x6)+parseInt(_0x4cee94(0x160))/0x7*(parseInt(_0x4cee94(0x15e))/0x8)+parseInt(_0x4cee94(0x15a))/0x9+parseInt(_0x4cee94(0x159))/0xa*(-parseInt(_0x4cee94(0x15c))/0xb);if(_0x48402a===_0x23e731)break;else _0x2b2ec0['push'](_0x2b2ec0['shift']());}catch(_0x24dffc){_0x2b2ec0['push'](_0x2b2ec0['shift']());}}}(a171_0x1a35,0x6e977));function a171_0x185f(_0x59d820,_0xc3c591){_0x59d820=_0x59d820-0x156;const _0x1a3517=a171_0x1a35();let _0x185f6d=_0x1a3517[_0x59d820];return _0x185f6d;}export function parseSegmentRef(_0x35d4d8){const _0x3b4a92=a171_0x185f,_0x2aec25=_0x35d4d8[_0x3b4a92(0x156)]('/');if(_0x2aec25===-0x1)return{'parentId':_0x35d4d8};if(_0x2aec25===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x35d4d8+_0x3b4a92(0x157));const _0x40a75b=_0x35d4d8[_0x3b4a92(0x15f)](0x0,_0x2aec25),_0x189d16=_0x35d4d8[_0x3b4a92(0x15f)](_0x2aec25+0x1);if(_0x189d16==='')throw new Error(_0x3b4a92(0x164)+_0x35d4d8+_0x3b4a92(0x161));return{'parentId':_0x40a75b,'childId':_0x189d16};}function a171_0x1a35(){const _0x4c9242=['.\x20Child\x20name\x20cannot\x20be\x20empty','795625yYOlXy','3xLrrNQ','Invalid\x20segment\x20reference\x20format:\x20','18HQAuLl','indexOf','.\x20Parent\x20name\x20cannot\x20be\x20empty','135115jtYses','7893560PGiILL','2145150sMFaSE','1314412zYMUEY','11FftXTI','1414306YAzBvS','5462312ZkxrHa','substring','7QzMUov'];a171_0x1a35=function(){return _0x4c9242;};return a171_0x1a35();}
1
+ (function(_0x224673,_0x301723){const _0x5224b1=a172_0x3a34,_0x2feb2c=_0x224673();while(!![]){try{const _0x5363e6=-parseInt(_0x5224b1(0x176))/0x1+-parseInt(_0x5224b1(0x172))/0x2*(-parseInt(_0x5224b1(0x177))/0x3)+-parseInt(_0x5224b1(0x17d))/0x4*(parseInt(_0x5224b1(0x173))/0x5)+parseInt(_0x5224b1(0x16e))/0x6*(parseInt(_0x5224b1(0x16c))/0x7)+-parseInt(_0x5224b1(0x17a))/0x8*(parseInt(_0x5224b1(0x16d))/0x9)+-parseInt(_0x5224b1(0x175))/0xa*(parseInt(_0x5224b1(0x17c))/0xb)+-parseInt(_0x5224b1(0x16f))/0xc*(-parseInt(_0x5224b1(0x171))/0xd);if(_0x5363e6===_0x301723)break;else _0x2feb2c['push'](_0x2feb2c['shift']());}catch(_0x30f182){_0x2feb2c['push'](_0x2feb2c['shift']());}}}(a172_0x5e7b,0x38d70));function a172_0x3a34(_0x4a70ab,_0xc9de9f){_0x4a70ab=_0x4a70ab-0x16c;const _0x5e7b16=a172_0x5e7b();let _0x3a34f8=_0x5e7b16[_0x4a70ab];return _0x3a34f8;}function a172_0x5e7b(){const _0x4e8301=['Invalid\x20segment\x20reference\x20format:\x20','3926igGoQJ','4006iXvrPT','35UtmfBh','substring','530sNnXld','374255oPWdHW','132qVmrcC','.\x20Parent\x20name\x20cannot\x20be\x20empty','.\x20Child\x20name\x20cannot\x20be\x20empty','5864gqWZYZ','indexOf','15136JNQOye','87268KyrTDO','3108868oZsZQs','1224lbCsTC','6XQXilk','15900yVngEU'];a172_0x5e7b=function(){return _0x4e8301;};return a172_0x5e7b();}export function parseSegmentRef(_0x4c0cac){const _0x5d007c=a172_0x3a34,_0x2e041e=_0x4c0cac[_0x5d007c(0x17b)]('/');if(_0x2e041e===-0x1)return{'parentId':_0x4c0cac};if(_0x2e041e===0x0)throw new Error(_0x5d007c(0x170)+_0x4c0cac+_0x5d007c(0x178));const _0x7447cd=_0x4c0cac[_0x5d007c(0x174)](0x0,_0x2e041e),_0x5ed3a1=_0x4c0cac[_0x5d007c(0x174)](_0x2e041e+0x1);if(_0x5ed3a1==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x4c0cac+_0x5d007c(0x179));return{'parentId':_0x7447cd,'childId':_0x5ed3a1};}
@@ -1 +1 @@
1
- function a172_0x5640(){const _0x529948=['507938XflWiK','rule.type','.attribute','EMPTY_ATTRIBUTE','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20','INVALID_RULE_TYPE','.conditions','TimeWithinNext','INVALID_OPERATOR_TYPE','source','187536SeqPOE','Composite','arrayMatching','description','.operator.type','.segment','And','541508ouMyUt','.operator.not','Attribute\x20name\x20cannot\x20be\x20empty','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','BEHAVIOR_SOURCE_MISSING_FILTER','MISSING_BETWEEN_BOUNDS','push','issues','.operator.value','skipSchema','TimeWithinPast','MISSING_OPERATOR_VALUE','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','rule','map','MISSING_TIME_UNIT','3307650BfmMaq','length','operator','filter','TEMPORAL_NEGATION_UNSUPPORTED','35PhWMmS','invalid_value','611704ASGQpU','MISSING_NAME','INVALID_ARRAY_MATCHING','.filter','3JWtCaT','custom','endsWith','9bCMLiZ','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','message','not','name','EMPTY_CONDITIONS','attribute','success','\x27\x20with\x20attribute\x20\x27','safeParse','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','symbol','conditions','type','.source','validationCode','MISSING_CONDITIONS','error','.conditions[','Operator\x20\x27','path','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','NESTED_CONDITION_GROUP','aggregation','557011CMjmHN','code','128777nLlsTs','document','level','warning','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','.type'];a172_0x5640=function(){return _0x529948;};return a172_0x5640();}(function(_0x5274d3,_0x5e338c){const _0x4a83a0=a172_0x83f2,_0x3f370c=_0x5274d3();while(!![]){try{const _0xf2e291=-parseInt(_0x4a83a0(0x14d))/0x1+-parseInt(_0x4a83a0(0x103))/0x2+parseInt(_0x4a83a0(0x130))/0x3*(parseInt(_0x4a83a0(0x115))/0x4)+-parseInt(_0x4a83a0(0x12a))/0x5*(-parseInt(_0x4a83a0(0x10e))/0x6)+-parseInt(_0x4a83a0(0x14b))/0x7+-parseInt(_0x4a83a0(0x12c))/0x8+parseInt(_0x4a83a0(0x133))/0x9*(parseInt(_0x4a83a0(0x125))/0xa);if(_0xf2e291===_0x5e338c)break;else _0x3f370c['push'](_0x3f370c['shift']());}catch(_0x3dcf2d){_0x3f370c['push'](_0x3f370c['shift']());}}}(a172_0x5640,0x23ae8));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x5ab439,_0x516b6f={},_0x2c9339={}){const _0x3392d8=a172_0x83f2;if(_0x2c9339[_0x3392d8(0x11e)])return runSemanticChecks(_0x5ab439,_0x516b6f);const _0x404023=SegmentDefSchema['safeParse'](_0x5ab439);if(_0x404023[_0x3392d8(0x13a)])return runSemanticChecks(_0x404023['data'],_0x516b6f);return zodErrorsToValidationResult(_0x404023[_0x3392d8(0x144)],_0x516b6f);}export function validateRuleDef(_0x16351b,_0x66a356,_0x28d4c8){const _0x332ae8=a172_0x83f2;if(!_0x16351b)return[];const _0x5e0bbc=RuleDefSchema[_0x332ae8(0x13c)](_0x16351b);if(_0x5e0bbc[_0x332ae8(0x13a)])return checkRule(_0x5e0bbc['data'],_0x66a356,_0x28d4c8);const _0x258153=flattenZodIssues(_0x5e0bbc[_0x332ae8(0x144)]['issues']);return _0x258153[_0x332ae8(0x123)](_0x3bfcc2=>{const _0x877aa3=_0x332ae8,_0x3735fa=formatZodPath(_0x3bfcc2[_0x877aa3(0x147)]),_0x457dd8=_0x3735fa?_0x66a356+'.'+_0x3735fa:_0x66a356,_0x95c3da=mapZodIssueToCode(_0x3bfcc2,_0x3735fa),_0x272929=getLocationFromPath(_0x28d4c8[_0x877aa3(0x14e)],_0x28d4c8[_0x877aa3(0x10d)],pathToArray(_0x457dd8));return{'level':_0x877aa3(0x144),'path':_0x457dd8,'code':_0x95c3da,'message':_0x3bfcc2['message'],..._0x272929&&{'location':_0x272929}};});}function a172_0x83f2(_0x58d7ee,_0x10a176){_0x58d7ee=_0x58d7ee-0xff;const _0x56400e=a172_0x5640();let _0x83f28f=_0x56400e[_0x58d7ee];return _0x83f28f;}function zodErrorsToValidationResult(_0x5e28aa,_0x2f43df){const _0x16a4b5=a172_0x83f2,_0x2e756a=flattenZodIssues(_0x5e28aa[_0x16a4b5(0x11c)]),_0x1ecada=_0x2e756a[_0x16a4b5(0x123)](_0x56df4c=>{const _0x3b5c5e=_0x16a4b5,_0x230eff=formatZodPath(_0x56df4c['path']),_0x4c1015=mapZodIssueToCode(_0x56df4c,_0x230eff),_0x4a5f24=getLocationFromPath(_0x2f43df[_0x3b5c5e(0x14e)],_0x2f43df['source'],_0x56df4c[_0x3b5c5e(0x147)][_0x3b5c5e(0x123)](_0x1c8d8c=>typeof _0x1c8d8c===_0x3b5c5e(0x13e)?String(_0x1c8d8c):_0x1c8d8c));return{'level':_0x3b5c5e(0x144),'path':_0x230eff,'code':_0x4c1015,'message':_0x56df4c[_0x3b5c5e(0x135)],..._0x4a5f24&&{'location':_0x4a5f24}};});return{'valid':![],'errors':_0x1ecada,'warnings':[]};}function mapZodIssueToCode(_0x131e24,_0x5a501c){const _0x400266=a172_0x83f2,_0x2db715=_0x131e24[_0x400266(0x14c)]===_0x400266(0x131)?_0x131e24['params']:undefined;if(_0x5a501c===_0x400266(0x137))return _0x400266(0x12d);if(_0x5a501c===_0x400266(0x104)||_0x5a501c[_0x400266(0x132)](_0x400266(0x102))){if(_0x131e24[_0x400266(0x14c)]===_0x400266(0x12b)){if(_0x5a501c==='rule.type'||_0x5a501c['match'](/\.conditions\[\d+\]\.type$/))return _0x400266(0x109);}}if(_0x5a501c[_0x400266(0x132)](_0x400266(0x112)))return _0x400266(0x10c);if(_0x5a501c[_0x400266(0x132)](_0x400266(0x11d)))return _0x400266(0x120);if(_0x2db715?.[_0x400266(0x142)]===_0x400266(0x11a))return _0x400266(0x11a);if(_0x2db715?.['validationCode']===_0x400266(0x124))return'MISSING_TIME_UNIT';if(_0x5a501c[_0x400266(0x132)]('.conditions')||_0x5a501c===_0x400266(0x13f))return _0x400266(0x143);if(_0x5a501c['includes'](_0x400266(0x110)))return _0x400266(0x12e);if(_0x5a501c[_0x400266(0x132)](_0x400266(0x113)))return'MISSING_SEGMENT_REFERENCE';return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x506600,_0x354757){const _0x21008d=a172_0x83f2,_0x1c603a=[];_0x506600[_0x21008d(0x122)]&&_0x1c603a['push'](...checkRule(_0x506600['rule'],'rule',_0x354757));const _0x57e083=_0x1c603a[_0x21008d(0x128)](_0xc315bb=>_0xc315bb[_0x21008d(0xff)]===_0x21008d(0x144)),_0x5cc401=_0x1c603a[_0x21008d(0x128)](_0x31516b=>_0x31516b[_0x21008d(0xff)]===_0x21008d(0x100));return{'valid':_0x57e083[_0x21008d(0x126)]===0x0,'errors':_0x57e083,'warnings':_0x5cc401};}function checkRule(_0x2807d0,_0x4a88c0,_0x1fba6b){const _0x3ab2a9=a172_0x83f2,_0x1ff9c0=[];if(_0x2807d0[_0x3ab2a9(0x13f)][_0x3ab2a9(0x126)]===0x0)return _0x1ff9c0[_0x3ab2a9(0x11b)]({'level':'error','path':_0x4a88c0+_0x3ab2a9(0x10a),'code':_0x3ab2a9(0x138),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x1fba6b[_0x3ab2a9(0x14e)],_0x1fba6b[_0x3ab2a9(0x10d)],pathToArray(_0x4a88c0+_0x3ab2a9(0x10a)))}),_0x1ff9c0;return _0x1ff9c0[_0x3ab2a9(0x11b)](...checkConditions(_0x2807d0[_0x3ab2a9(0x13f)],_0x4a88c0,_0x1fba6b)),_0x1ff9c0;}function checkConditions(_0x514d62,_0x87f22a,_0x1ec90a){const _0x3e406c=a172_0x83f2,_0x4bf1d2=[];for(let _0x36772f=0x0;_0x36772f<_0x514d62['length'];_0x36772f++){const _0x45e021=_0x514d62[_0x36772f],_0x508d97=_0x87f22a+_0x3e406c(0x145)+_0x36772f+']';_0x4bf1d2['push'](...checkCondition(_0x45e021,_0x508d97,_0x1ec90a));}return _0x4bf1d2;}function checkCondition(_0x19517f,_0x104575,_0x2149b8){const _0x4de59c=a172_0x83f2,_0x3a62a6=[];if(_0x19517f[_0x4de59c(0x140)]===_0x4de59c(0x114)||_0x19517f['type']==='Or'||_0x19517f[_0x4de59c(0x140)]===_0x4de59c(0x10f)){if(_0x19517f['conditions'][_0x4de59c(0x126)]===0x0)_0x3a62a6[_0x4de59c(0x11b)]({'level':'error','path':_0x104575+_0x4de59c(0x10a),'code':'EMPTY_CONDITIONS','message':_0x19517f[_0x4de59c(0x140)]+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x2149b8[_0x4de59c(0x14e)],_0x2149b8[_0x4de59c(0x10d)],pathToArray(_0x104575+'.conditions'))});else{const _0x1ccbbd=_0x19517f[_0x4de59c(0x111)]!==undefined,_0x1020fc=_0x19517f[_0x4de59c(0x140)]==='Composite';!_0x1ccbbd&&!_0x1020fc&&_0x3a62a6[_0x4de59c(0x11b)]({'level':'warning','path':_0x104575,'code':_0x4de59c(0x149),'message':_0x19517f[_0x4de59c(0x140)]+_0x4de59c(0x148)+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x4de59c(0x134),'location':getLocationFromPath(_0x2149b8[_0x4de59c(0x14e)],_0x2149b8[_0x4de59c(0x10d)],pathToArray(_0x104575))}),_0x3a62a6[_0x4de59c(0x11b)](...checkConditions(_0x19517f[_0x4de59c(0x13f)],_0x104575,_0x2149b8));}return _0x3a62a6;}if(_0x19517f['type']==='Value'||_0x19517f[_0x4de59c(0x140)]==='Behavior'){const _0x2276e0=_0x19517f,_0x20890e=_0x2276e0[_0x4de59c(0x10d)],_0x4ec71d=_0x2276e0[_0x4de59c(0x14a)],_0x21c8c9=_0x20890e||_0x4ec71d,_0xe2bedd=_0x2276e0[_0x4de59c(0x127)]?.[_0x4de59c(0x140)];if((_0xe2bedd===_0x4de59c(0x11f)||_0xe2bedd===_0x4de59c(0x10b))&&_0x2276e0['operator']?.[_0x4de59c(0x136)]!==undefined){const _0x1b4e14=_0x2276e0[_0x4de59c(0x127)]['not']===!![];_0x3a62a6['push']({'level':_0x1b4e14?_0x4de59c(0x144):'warning','path':_0x104575+_0x4de59c(0x116),'code':_0x4de59c(0x129),'message':_0x1b4e14?_0x4de59c(0x146)+_0xe2bedd+_0x4de59c(0x108)+_0x4de59c(0x101)+_0x4de59c(0x118):_0x4de59c(0x146)+_0xe2bedd+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+'Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','location':getLocationFromPath(_0x2149b8['document'],_0x2149b8[_0x4de59c(0x10d)],pathToArray(_0x104575+'.operator.not'))});}(!_0x2276e0[_0x4de59c(0x139)]||_0x2276e0['attribute']==='')&&(!_0x21c8c9&&_0x3a62a6[_0x4de59c(0x11b)]({'level':_0x4de59c(0x144),'path':_0x104575+'.attribute','code':_0x4de59c(0x106),'message':_0x4de59c(0x117),'location':getLocationFromPath(_0x2149b8[_0x4de59c(0x14e)],_0x2149b8[_0x4de59c(0x10d)],pathToArray(_0x104575+_0x4de59c(0x105)))}));_0x2276e0[_0x4de59c(0x128)]&&_0x3a62a6[_0x4de59c(0x11b)](...checkRule(_0x2276e0['filter'],_0x104575+_0x4de59c(0x12f),_0x2149b8));if(_0x2276e0['source']){const _0x298357=_0x2276e0[_0x4de59c(0x139)]&&_0x2276e0[_0x4de59c(0x139)]!=='';_0x298357&&!_0x2276e0['filter']&&_0x3a62a6[_0x4de59c(0x11b)]({'level':'error','path':_0x104575+'.source','code':_0x4de59c(0x119),'message':'Behavior\x20source\x20\x27'+_0x2276e0[_0x4de59c(0x10d)]+_0x4de59c(0x13b)+_0x2276e0[_0x4de59c(0x139)]+'\x27\x20'+_0x4de59c(0x121)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x2149b8[_0x4de59c(0x14e)],_0x2149b8[_0x4de59c(0x10d)],pathToArray(_0x104575+_0x4de59c(0x141)))}),_0x298357&&_0x2276e0[_0x4de59c(0x128)]&&_0x3a62a6[_0x4de59c(0x11b)]({'level':_0x4de59c(0x100),'path':_0x104575+'.attribute','code':_0x4de59c(0x107),'message':'Attribute\x20\x27'+_0x2276e0[_0x4de59c(0x139)]+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+_0x4de59c(0x13d),'location':getLocationFromPath(_0x2149b8[_0x4de59c(0x14e)],_0x2149b8[_0x4de59c(0x10d)],pathToArray(_0x104575+'.attribute'))});}}return _0x3a62a6;}
1
+ (function(_0x48bccb,_0x450037){const _0x90b965=a173_0x2f7c,_0x9b6796=_0x48bccb();while(!![]){try{const _0x9562e5=-parseInt(_0x90b965(0x152))/0x1*(-parseInt(_0x90b965(0x17e))/0x2)+parseInt(_0x90b965(0x16e))/0x3*(parseInt(_0x90b965(0x15a))/0x4)+-parseInt(_0x90b965(0x181))/0x5+-parseInt(_0x90b965(0x172))/0x6*(parseInt(_0x90b965(0x173))/0x7)+parseInt(_0x90b965(0x166))/0x8+parseInt(_0x90b965(0x17f))/0x9+-parseInt(_0x90b965(0x184))/0xa*(-parseInt(_0x90b965(0x151))/0xb);if(_0x9562e5===_0x450037)break;else _0x9b6796['push'](_0x9b6796['shift']());}catch(_0x4c36be){_0x9b6796['push'](_0x9b6796['shift']());}}}(a173_0x4ecf,0xc5970));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3bcbe5,_0xf2d6c3={},_0x434826={}){const _0x4cd71c=a173_0x2f7c;if(_0x434826[_0x4cd71c(0x14d)])return runSemanticChecks(_0x3bcbe5,_0xf2d6c3);const _0x15c53b=SegmentDefSchema[_0x4cd71c(0x164)](_0x3bcbe5);if(_0x15c53b[_0x4cd71c(0x145)])return runSemanticChecks(_0x15c53b[_0x4cd71c(0x16d)],_0xf2d6c3);return zodErrorsToValidationResult(_0x15c53b[_0x4cd71c(0x160)],_0xf2d6c3);}function a173_0x4ecf(){const _0x328e17=['custom','rule','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','warning','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','params','24RuHbrs','4728960gCkIuc','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','5821105RLVYXD','.operator.not','EMPTY_ATTRIBUTE','10sQxWaa','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','INVALID_ARRAY_MATCHING','.filter','level','.operator.type','push','operator','.attribute','aggregation','filter','path','MISSING_OPERATOR_VALUE','source','name','Operator\x20\x27','Attribute\x20name\x20cannot\x20be\x20empty','MISSING_NAME','success','document','MISSING_TIME_UNIT','arrayMatching','description','validationCode','Value','not','skipSchema','type','TimeWithinNext','EMPTY_CONDITIONS','678359yoKfBZ','61599hGWAQJ','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','endsWith','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','Attribute\x20\x27','invalid_value','.segment','1435856FMsiKo','MISSING_BETWEEN_BOUNDS','\x27\x20with\x20attribute\x20\x27','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','BEHAVIOR_SOURCE_MISSING_FILTER','conditions','error','Composite','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','safeParse','MISSING_CONDITIONS','3744144xOdSdS','includes','symbol','map','length','rule.type','NESTED_CONDITION_GROUP','data','3zxcAEf','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','.type','attribute','540yagJfY','13979JKJqgi','\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20','issues','message','.conditions'];a173_0x4ecf=function(){return _0x328e17;};return a173_0x4ecf();}export function validateRuleDef(_0xa9568d,_0xd545dd,_0xca316e){const _0x547a47=a173_0x2f7c;if(!_0xa9568d)return[];const _0x4e6244=RuleDefSchema[_0x547a47(0x164)](_0xa9568d);if(_0x4e6244[_0x547a47(0x145)])return checkRule(_0x4e6244[_0x547a47(0x16d)],_0xd545dd,_0xca316e);const _0x798940=flattenZodIssues(_0x4e6244[_0x547a47(0x160)]['issues']);return _0x798940[_0x547a47(0x169)](_0x3be02f=>{const _0x3afa6f=_0x547a47,_0x1e38c9=formatZodPath(_0x3be02f['path']),_0x4ba698=_0x1e38c9?_0xd545dd+'.'+_0x1e38c9:_0xd545dd,_0x597ebe=mapZodIssueToCode(_0x3be02f,_0x1e38c9),_0x8c328c=getLocationFromPath(_0xca316e[_0x3afa6f(0x146)],_0xca316e[_0x3afa6f(0x140)],pathToArray(_0x4ba698));return{'level':_0x3afa6f(0x160),'path':_0x4ba698,'code':_0x597ebe,'message':_0x3be02f[_0x3afa6f(0x176)],..._0x8c328c&&{'location':_0x8c328c}};});}function zodErrorsToValidationResult(_0x4bc95c,_0x2f1743){const _0x4370b0=a173_0x2f7c,_0x419622=flattenZodIssues(_0x4bc95c[_0x4370b0(0x175)]),_0x44bee2=_0x419622[_0x4370b0(0x169)](_0x59dbdb=>{const _0x4ce3b0=_0x4370b0,_0x74a687=formatZodPath(_0x59dbdb[_0x4ce3b0(0x18f)]),_0x323200=mapZodIssueToCode(_0x59dbdb,_0x74a687),_0x3e9bb2=getLocationFromPath(_0x2f1743[_0x4ce3b0(0x146)],_0x2f1743['source'],_0x59dbdb[_0x4ce3b0(0x18f)]['map'](_0x1018a7=>typeof _0x1018a7===_0x4ce3b0(0x168)?String(_0x1018a7):_0x1018a7));return{'level':'error','path':_0x74a687,'code':_0x323200,'message':_0x59dbdb[_0x4ce3b0(0x176)],..._0x3e9bb2&&{'location':_0x3e9bb2}};});return{'valid':![],'errors':_0x44bee2,'warnings':[]};}function mapZodIssueToCode(_0x12d163,_0x3cd529){const _0xd64ac1=a173_0x2f7c,_0x324ea1=_0x12d163['code']===_0xd64ac1(0x178)?_0x12d163[_0xd64ac1(0x17d)]:undefined;if(_0x3cd529===_0xd64ac1(0x141))return _0xd64ac1(0x144);if(_0x3cd529===_0xd64ac1(0x16b)||_0x3cd529[_0xd64ac1(0x155)](_0xd64ac1(0x170))){if(_0x12d163['code']===_0xd64ac1(0x158)){if(_0x3cd529===_0xd64ac1(0x16b)||_0x3cd529['match'](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x3cd529[_0xd64ac1(0x155)](_0xd64ac1(0x189)))return'INVALID_OPERATOR_TYPE';if(_0x3cd529[_0xd64ac1(0x155)]('.operator.value'))return _0xd64ac1(0x190);if(_0x324ea1?.['validationCode']===_0xd64ac1(0x15b))return _0xd64ac1(0x15b);if(_0x324ea1?.[_0xd64ac1(0x14a)]===_0xd64ac1(0x147))return'MISSING_TIME_UNIT';if(_0x3cd529[_0xd64ac1(0x155)](_0xd64ac1(0x177))||_0x3cd529===_0xd64ac1(0x15f))return _0xd64ac1(0x165);if(_0x3cd529[_0xd64ac1(0x167)](_0xd64ac1(0x148)))return _0xd64ac1(0x186);if(_0x3cd529[_0xd64ac1(0x155)](_0xd64ac1(0x159)))return'MISSING_SEGMENT_REFERENCE';return'SEGMENT_SCHEMA_ERROR';}function a173_0x2f7c(_0x3eb346,_0x58b1f5){_0x3eb346=_0x3eb346-0x140;const _0x4ecfbd=a173_0x4ecf();let _0x2f7c28=_0x4ecfbd[_0x3eb346];return _0x2f7c28;}function runSemanticChecks(_0x511c77,_0x4959d0){const _0x3272a2=a173_0x2f7c,_0x2a6d4f=[];_0x511c77[_0x3272a2(0x179)]&&_0x2a6d4f[_0x3272a2(0x18a)](...checkRule(_0x511c77[_0x3272a2(0x179)],_0x3272a2(0x179),_0x4959d0));const _0x55e153=_0x2a6d4f[_0x3272a2(0x18e)](_0x216cb4=>_0x216cb4[_0x3272a2(0x188)]===_0x3272a2(0x160)),_0x56d9f3=_0x2a6d4f[_0x3272a2(0x18e)](_0x44fbf7=>_0x44fbf7['level']===_0x3272a2(0x17b));return{'valid':_0x55e153[_0x3272a2(0x16a)]===0x0,'errors':_0x55e153,'warnings':_0x56d9f3};}function checkRule(_0x1967ed,_0x399a9b,_0x26b4bb){const _0x36d705=a173_0x2f7c,_0x2b9f0a=[];if(_0x1967ed[_0x36d705(0x15f)][_0x36d705(0x16a)]===0x0)return _0x2b9f0a[_0x36d705(0x18a)]({'level':_0x36d705(0x160),'path':_0x399a9b+_0x36d705(0x177),'code':'EMPTY_CONDITIONS','message':_0x36d705(0x154),'location':getLocationFromPath(_0x26b4bb[_0x36d705(0x146)],_0x26b4bb[_0x36d705(0x140)],pathToArray(_0x399a9b+_0x36d705(0x177)))}),_0x2b9f0a;return _0x2b9f0a[_0x36d705(0x18a)](...checkConditions(_0x1967ed[_0x36d705(0x15f)],_0x399a9b,_0x26b4bb)),_0x2b9f0a;}function checkConditions(_0x3c52e7,_0x10d210,_0x43832f){const _0x3310fb=a173_0x2f7c,_0x1a8463=[];for(let _0x13d61c=0x0;_0x13d61c<_0x3c52e7[_0x3310fb(0x16a)];_0x13d61c++){const _0x52031b=_0x3c52e7[_0x13d61c],_0x4bd50b=_0x10d210+'.conditions['+_0x13d61c+']';_0x1a8463[_0x3310fb(0x18a)](...checkCondition(_0x52031b,_0x4bd50b,_0x43832f));}return _0x1a8463;}function checkCondition(_0x41f085,_0x410d02,_0x42be41){const _0x239b41=a173_0x2f7c,_0x4a279a=[];if(_0x41f085[_0x239b41(0x14e)]==='And'||_0x41f085[_0x239b41(0x14e)]==='Or'||_0x41f085[_0x239b41(0x14e)]===_0x239b41(0x161)){if(_0x41f085['conditions'][_0x239b41(0x16a)]===0x0)_0x4a279a[_0x239b41(0x18a)]({'level':_0x239b41(0x160),'path':_0x410d02+_0x239b41(0x177),'code':_0x239b41(0x150),'message':_0x41f085[_0x239b41(0x14e)]+_0x239b41(0x162),'location':getLocationFromPath(_0x42be41['document'],_0x42be41[_0x239b41(0x140)],pathToArray(_0x410d02+_0x239b41(0x177)))});else{const _0x271b3a=_0x41f085[_0x239b41(0x149)]!==undefined,_0x13bf55=_0x41f085[_0x239b41(0x14e)]===_0x239b41(0x161);!_0x271b3a&&!_0x13bf55&&_0x4a279a[_0x239b41(0x18a)]({'level':_0x239b41(0x17b),'path':_0x410d02,'code':_0x239b41(0x16c),'message':_0x41f085[_0x239b41(0x14e)]+_0x239b41(0x17c)+_0x239b41(0x180)+_0x239b41(0x156),'location':getLocationFromPath(_0x42be41['document'],_0x42be41[_0x239b41(0x140)],pathToArray(_0x410d02))}),_0x4a279a['push'](...checkConditions(_0x41f085['conditions'],_0x410d02,_0x42be41));}return _0x4a279a;}if(_0x41f085['type']===_0x239b41(0x14b)||_0x41f085[_0x239b41(0x14e)]==='Behavior'){const _0x9610bd=_0x41f085,_0x40d7ea=_0x9610bd[_0x239b41(0x140)],_0x3ffe99=_0x9610bd[_0x239b41(0x18d)],_0x31767d=_0x40d7ea||_0x3ffe99,_0x269196=_0x9610bd[_0x239b41(0x18b)]?.['type'];if((_0x269196==='TimeWithinPast'||_0x269196===_0x239b41(0x14f))&&_0x9610bd[_0x239b41(0x18b)]?.[_0x239b41(0x14c)]!==undefined){const _0x238138=_0x9610bd[_0x239b41(0x18b)][_0x239b41(0x14c)]===!![];_0x4a279a[_0x239b41(0x18a)]({'level':_0x238138?_0x239b41(0x160):'warning','path':_0x410d02+_0x239b41(0x182),'code':'TEMPORAL_NEGATION_UNSUPPORTED','message':_0x238138?_0x239b41(0x142)+_0x269196+'\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'+_0x239b41(0x163)+_0x239b41(0x17a):_0x239b41(0x142)+_0x269196+_0x239b41(0x174)+_0x239b41(0x16f),'location':getLocationFromPath(_0x42be41[_0x239b41(0x146)],_0x42be41[_0x239b41(0x140)],pathToArray(_0x410d02+'.operator.not'))});}(!_0x9610bd['attribute']||_0x9610bd[_0x239b41(0x171)]==='')&&(!_0x31767d&&_0x4a279a[_0x239b41(0x18a)]({'level':'error','path':_0x410d02+_0x239b41(0x18c),'code':_0x239b41(0x183),'message':_0x239b41(0x143),'location':getLocationFromPath(_0x42be41['document'],_0x42be41[_0x239b41(0x140)],pathToArray(_0x410d02+'.attribute'))}));_0x9610bd[_0x239b41(0x18e)]&&_0x4a279a[_0x239b41(0x18a)](...checkRule(_0x9610bd[_0x239b41(0x18e)],_0x410d02+_0x239b41(0x187),_0x42be41));if(_0x9610bd[_0x239b41(0x140)]){const _0x4d0e54=_0x9610bd[_0x239b41(0x171)]&&_0x9610bd['attribute']!=='';_0x4d0e54&&!_0x9610bd[_0x239b41(0x18e)]&&_0x4a279a[_0x239b41(0x18a)]({'level':'error','path':_0x410d02+'.source','code':_0x239b41(0x15e),'message':'Behavior\x20source\x20\x27'+_0x9610bd[_0x239b41(0x140)]+_0x239b41(0x15c)+_0x9610bd['attribute']+'\x27\x20'+_0x239b41(0x153)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x239b41(0x15d),'location':getLocationFromPath(_0x42be41[_0x239b41(0x146)],_0x42be41[_0x239b41(0x140)],pathToArray(_0x410d02+'.source'))}),_0x4d0e54&&_0x9610bd[_0x239b41(0x18e)]&&_0x4a279a[_0x239b41(0x18a)]({'level':_0x239b41(0x17b),'path':_0x410d02+'.attribute','code':_0x239b41(0x185),'message':_0x239b41(0x157)+_0x9610bd['attribute']+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x42be41['document'],_0x42be41[_0x239b41(0x140)],pathToArray(_0x410d02+'.attribute'))});}}return _0x4a279a;}