@treasuredata/tdx 2026.4.0 → 2026.4.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 (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x560bf2=a152_0x46e6;(function(_0x5c83ee,_0x54c3a4){const _0x151efb=a152_0x46e6,_0x3d00d8=_0x5c83ee();while(!![]){try{const _0x4fb533=parseInt(_0x151efb(0x1a0))/0x1+-parseInt(_0x151efb(0x1e4))/0x2*(-parseInt(_0x151efb(0x1b7))/0x3)+parseInt(_0x151efb(0x155))/0x4+parseInt(_0x151efb(0x210))/0x5+-parseInt(_0x151efb(0x16a))/0x6*(-parseInt(_0x151efb(0x151))/0x7)+parseInt(_0x151efb(0x1a7))/0x8*(-parseInt(_0x151efb(0x17d))/0x9)+parseInt(_0x151efb(0x236))/0xa*(-parseInt(_0x151efb(0x1f4))/0xb);if(_0x4fb533===_0x54c3a4)break;else _0x3d00d8['push'](_0x3d00d8['shift']());}catch(_0x27f3f3){_0x3d00d8['push'](_0x3d00d8['shift']());}}}(a152_0x2f0e,0x46cb5));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a152_0x560bf2(0x19c);export const PENDING_ACTIVATION_PREFIX=a152_0x560bf2(0x209);export function createPendingSegmentId(_0x53ab44){return''+PENDING_SEGMENT_PREFIX+_0x53ab44+'__';}export function isPendingSegmentId(_0x1bbdd7){const _0x5c13a4=a152_0x560bf2;return _0x1bbdd7[_0x5c13a4(0x1b0)](PENDING_SEGMENT_PREFIX)&&!_0x1bbdd7[_0x5c13a4(0x1b0)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x28b86e){const _0x17dda1=a152_0x560bf2;return _0x28b86e[_0x17dda1(0x193)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4c8162){return''+PENDING_ACTIVATION_PREFIX+_0x4c8162+'__';}export function isPendingActivationId(_0x32661c){const _0xb34f73=a152_0x560bf2;return _0x32661c[_0xb34f73(0x1b0)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x2386de){return _0x2386de['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5dfb41,_0x312aa9){const _0x4e050c=a152_0x560bf2,_0x1e9221=_0x5dfb41+'::'+(_0x312aa9[_0x4e050c(0x1a3)]()||'segment'),_0x547794=createHash(_0x4e050c(0x21b))['update'](_0x1e9221)[_0x4e050c(0x22f)](_0x4e050c(0x23e))['slice'](0x0,0xc);return _0x4e050c(0x160)+_0x547794;}export function ensureJourneyDefaults(_0x4919b0){const _0x431e79=a152_0x560bf2;!_0x4919b0['description']&&(_0x4919b0[_0x431e79(0x202)]=''),!_0x4919b0[_0x431e79(0x1ab)]&&(_0x4919b0[_0x431e79(0x1ab)]=_0x431e79(0x174));}export function injectExistingStageIds(_0x321d8d,_0x45bc96){const _0xfcfefd=a152_0x560bf2,_0x473ca7=new Map(_0x45bc96[_0xfcfefd(0x22b)](_0x48bd30=>[_0x48bd30[_0xfcfefd(0x25b)],_0x48bd30['id']]));for(const _0x2608a3 of _0x321d8d){if(!_0x2608a3['id']){const _0x50e9af=_0x473ca7[_0xfcfefd(0x16b)](_0x2608a3[_0xfcfefd(0x25b)]);_0x50e9af&&(_0x2608a3['id']=_0x50e9af);}}}export function resolveTDFolderPath(_0x10067d,_0x102795,_0x2126b3){const _0x561f80=a152_0x560bf2;if(!_0x102795)return _0x10067d;if(_0x10067d===_0x2126b3||_0x10067d[_0x561f80(0x1b0)](_0x2126b3+'/'))return _0x10067d;return _0x10067d?_0x2126b3+'/'+_0x10067d:_0x2126b3;}export function addFoldersToCreate(_0x6f6929,_0x506b73,_0x1f0476){const _0x4516c6=a152_0x560bf2;if(!_0x6f6929)return;if(_0x506b73['has'](_0x6f6929))return;const _0x5f0f8a=_0x6f6929[_0x4516c6(0x17e)]('/');let _0x3d513b='';for(const _0x235371 of _0x5f0f8a){_0x3d513b=_0x3d513b?_0x3d513b+'/'+_0x235371:_0x235371,!_0x506b73[_0x4516c6(0x158)](_0x3d513b)&&_0x1f0476['add'](_0x3d513b);}}export function sortFoldersByDepth(_0x5a019c){const _0x2ae371=a152_0x560bf2;return[..._0x5a019c][_0x2ae371(0x15a)]((_0x5302cc,_0x32f246)=>{const _0x23fbeb=_0x2ae371,_0x284a57=(_0x5302cc[_0x23fbeb(0x15c)](/\//g)||[])[_0x23fbeb(0x21a)],_0x595e26=(_0x32f246[_0x23fbeb(0x15c)](/\//g)||[])['length'];return _0x284a57-_0x595e26;});}function a152_0x46e6(_0x4b1e1e,_0x1f78f5){_0x4b1e1e=_0x4b1e1e-0x151;const _0x2f0e65=a152_0x2f0e();let _0x46e6ea=_0x2f0e65[_0x4b1e1e];return _0x46e6ea;}import*as a152_0x2ed89c from'yaml';import{readFileSync}from'fs';import a152_0x1a1223 from'path';import{isJourneyDef,parseYamlString as a152_0x2c7776,toYamlString as a152_0x37a037,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(_0x26c2ae){const _0x219f04=a152_0x560bf2;if(Array['isArray'](_0x26c2ae))return'['+_0x26c2ae[_0x219f04(0x22b)](_0x202a4f=>stableStringify(_0x202a4f))[_0x219f04(0x166)](',')+']';if(_0x26c2ae&&typeof _0x26c2ae===_0x219f04(0x1c9)){const _0x4fd8d8=_0x26c2ae,_0x95a7b6=Object[_0x219f04(0x1d3)](_0x4fd8d8)[_0x219f04(0x15a)](),_0x2c8f7=_0x95a7b6[_0x219f04(0x22b)](_0x16bc91=>'\x22'+_0x16bc91+'\x22:'+stableStringify(_0x4fd8d8[_0x16bc91]));return'{'+_0x2c8f7[_0x219f04(0x166)](',')+'}';}const _0x17ba31=JSON[_0x219f04(0x1a9)](_0x26c2ae);return _0x17ba31===undefined?_0x219f04(0x1d5):_0x17ba31;}function activationSignature(_0x1f21fc){const _0x5e9eb0=a152_0x560bf2,_0x3a6d8e={'connection':_0x1f21fc[_0x5e9eb0(0x176)],..._0x1f21fc[_0x5e9eb0(0x24d)]!==undefined&&{'all_columns':_0x1f21fc[_0x5e9eb0(0x24d)]},..._0x1f21fc[_0x5e9eb0(0x1de)]!==undefined&&{'columns':_0x1f21fc['columns']},..._0x1f21fc[_0x5e9eb0(0x212)]!==undefined&&{'behavior':_0x1f21fc[_0x5e9eb0(0x212)]},..._0x1f21fc[_0x5e9eb0(0x157)]!==undefined&&{'schedule':_0x1f21fc[_0x5e9eb0(0x157)]},..._0x1f21fc[_0x5e9eb0(0x17b)]!==undefined&&{'notification':_0x1f21fc['notification']},..._0x1f21fc[_0x5e9eb0(0x21e)]!==undefined&&{'connector_config':_0x1f21fc[_0x5e9eb0(0x21e)]},..._0x1f21fc[_0x5e9eb0(0x192)]!==undefined&&{'activation_template_id':_0x1f21fc[_0x5e9eb0(0x192)]}};return stableStringify(_0x3a6d8e);}async function fetchSegment(_0x5cd4f0,_0x11e494,_0x46addb,_0x46e495){const _0x488c79=a152_0x560bf2,_0x7673ac=_0x46e495?.[_0x488c79(0x241)](_0x50be51=>_0x50be51['id']===_0x46addb);if(_0x7673ac)return _0x7673ac;try{return await _0x5cd4f0[_0x488c79(0x1f2)]['getSegment'](_0x11e494,_0x46addb);}catch(_0x14764a){logger[_0x488c79(0x251)](_0x488c79(0x23a)+_0x46addb+_0x488c79(0x25a)+_0x14764a);try{return await _0x5cd4f0[_0x488c79(0x1f2)][_0x488c79(0x16d)](_0x46addb);}catch(_0x3c2cf3){return logger[_0x488c79(0x251)](_0x488c79(0x259)+_0x46addb+':\x20'+_0x3c2cf3),null;}}}function recoverSegmentIdsFromPushRecovery(_0x34526f,_0x5aa559,_0xe0bd7c){const _0x24ba49=a152_0x560bf2,_0x4fd840=readPushRecovery(_0x34526f[_0x24ba49(0x18a)]);if(_0x4fd840?.['journeyName']===_0x34526f[_0x24ba49(0x1ac)][_0x24ba49(0x25b)])for(const [_0x3ff178,_0x255f0b]of Object['entries'](_0x4fd840[_0x24ba49(0x21f)])){const _0x519501=generateDeterministicJourneySegmentName(_0x34526f[_0x24ba49(0x1ac)][_0x24ba49(0x25b)],_0x3ff178);_0x255f0b[_0x24ba49(0x181)]===_0x519501&&(_0x5aa559[_0x24ba49(0x165)](_0x3ff178,_0x255f0b[_0x24ba49(0x19a)]),_0xe0bd7c['set'](_0x3ff178,_0x255f0b[_0x24ba49(0x19a)]));}}async function createOrRecoverEmbeddedSegment(_0x2332ef,_0x2a3484,_0x1b2e97,_0x4bf6e0){const _0x24024b=a152_0x560bf2;let _0x9e7213;try{_0x9e7213=await _0x2332ef['segment'][_0x24024b(0x227)]({'name':_0x1b2e97[_0x24024b(0x1c4)],'description':_0x1b2e97[_0x24024b(0x202)],'journeyId':_0x1b2e97[_0x24024b(0x19e)],'rule':_0x4bf6e0(_0x1b2e97[_0x24024b(0x22d)],!![]),'countPopulation':!![],'parentFolderId':_0x1b2e97[_0x24024b(0x1a2)],'audienceId':_0x1b2e97[_0x24024b(0x1be)]});}catch(_0x2a278d){const _0x4b0d04=_0x2a278d instanceof Error&&_0x2a278d[_0x24024b(0x244)][_0x24024b(0x25c)](_0x24024b(0x1db));if(_0x4b0d04){const _0x1fec5a=readPushRecovery(_0x2a3484[_0x24024b(0x18a)]),_0x5622be=_0x1fec5a?.[_0x24024b(0x1d7)]===_0x2a3484[_0x24024b(0x1ac)][_0x24024b(0x25b)]?_0x1fec5a[_0x24024b(0x21f)][_0x1b2e97[_0x24024b(0x186)]]:undefined;if(_0x5622be?.[_0x24024b(0x181)]===_0x1b2e97[_0x24024b(0x1c4)])await _0x2332ef[_0x24024b(0x1f2)][_0x24024b(0x1ed)](_0x1b2e97[_0x24024b(0x1be)],_0x5622be[_0x24024b(0x19a)],{'description':_0x1b2e97[_0x24024b(0x202)],'rule':_0x4bf6e0(_0x1b2e97[_0x24024b(0x22d)],!![]),'countPopulation':!![]}),_0x9e7213=_0x5622be[_0x24024b(0x19a)];else throw new SDKError(ErrorCode[_0x24024b(0x1e3)],'Embedded\x20segment\x20\x27'+_0x1b2e97[_0x24024b(0x186)]+_0x24024b(0x1ba)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x2a3484['absolutePath'][_0x24024b(0x193)](/([^/]+)$/,_0x24024b(0x1f8))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x2a278d);}else throw _0x2a278d;}return saveSegmentToPushRecovery(_0x2a3484[_0x24024b(0x18a)],_0x2a3484[_0x24024b(0x1ac)]['name'],_0x1b2e97[_0x24024b(0x186)],{'segmentId':_0x9e7213,'uniqueServerName':_0x1b2e97[_0x24024b(0x1c4)],'createdAt':new Date()[_0x24024b(0x1f1)]()}),_0x9e7213;}export async function prepareSegmentFiles(_0x38d3d2,_0x209864,_0x2b3ab2,_0x1cf221,_0x570b4b){const _0x399051=a152_0x560bf2,{activationDefToCreateRequest:_0x4b2bfa}=await import(_0x399051(0x204)),_0x53ba6b=[],_0x5679ba=new Set();for(const {yamlConfig:_0x362923,folderPath:_0x321ba7,sourcePath:_0x20f639}of _0x38d3d2){const _0x36579c=resolveTDFolderPath(_0x321ba7,_0x1cf221,_0x570b4b),_0x2400a5=_0x36579c+':'+_0x362923['name'],_0x1e7f9b=_0x209864[_0x399051(0x1e7)][_0x399051(0x16b)](_0x2400a5),_0x35f2ec=_0x1e7f9b?_0x209864[_0x399051(0x1e5)][_0x399051(0x16b)](_0x1e7f9b['id'])||[]:[];addFoldersToCreate(_0x36579c,_0x209864[_0x399051(0x1f6)],_0x5679ba);const _0x2b432a=calculateActivationActions(_0x362923['activations']||[],_0x35f2ec,_0x209864[_0x399051(0x1f9)],_0x209864['connectionIdToNameMap']);for(const _0x271459 of _0x2b432a){(_0x271459[_0x399051(0x23d)]===_0x399051(0x162)||_0x271459[_0x399051(0x23d)]===_0x399051(0x240))&&_0x271459['yamlActivation']&&(_0x271459[_0x399051(0x1fd)]=await _0x4b2bfa(_0x271459[_0x399051(0x18e)],_0x2b3ab2));}const _0x52a7b1=calculateSegmentDiff(_0x362923,_0x1e7f9b,_0x35f2ec,_0x209864[_0x399051(0x1f9)],_0x209864['connectionIdToNameMap']);_0x53ba6b[_0x399051(0x188)]({'relativePath':_0x362923[_0x399051(0x25b)],'absolutePath':_0x20f639,'yamlConfig':_0x362923,'folderPath':_0x36579c,'existingSegment':_0x1e7f9b,'existingActivations':_0x35f2ec,'isNew':_0x52a7b1[_0x399051(0x222)],'hasChanges':_0x52a7b1[_0x399051(0x1c5)],'diff':_0x52a7b1[_0x399051(0x1f7)],'activationActions':_0x2b432a});}return{'segmentFiles':_0x53ba6b,'foldersToCreate':_0x5679ba};}export async function prepareJourneyFiles(_0x174bee,_0x1b10d5,_0x56d87f,_0x44f48c){const _0x24066e=a152_0x560bf2,_0x3723b9=[],_0x2bf7cd=new Set();for(const {yamlConfig:_0x4e3227,folderPath:_0x332112,sourcePath:_0x1fe654}of _0x174bee){const _0x163157=resolveTDFolderPath(_0x332112,_0x56d87f,_0x44f48c),_0xb833e6=_0x163157+':'+_0x4e3227[_0x24066e(0x25b)],_0x340c03=_0x1b10d5[_0x24066e(0x239)][_0x24066e(0x16b)](_0xb833e6);let _0x5448b1,_0x4704ab;if(_0x340c03&&_0x340c03[_0x24066e(0x21a)]>0x0){const _0x5b4ea9=buildLocalExpandedRuleMappings(_0x4e3227),{createYamlContext:_0x9be9a0,prefetchJourneySegments:_0x15db90}=createPushYamlContextForBundle(_0x1b10d5[_0x24066e(0x168)],_0x1b10d5[_0x24066e(0x1be)],_0x1b10d5['existingSegments'],_0x5b4ea9,_0x1b10d5['idToEmailMap'],_0x1b10d5[_0x24066e(0x1b2)],_0x1b10d5[_0x24066e(0x22a)],_0x1b10d5[_0x24066e(0x18d)]);await _0x15db90(_0x340c03[_0x24066e(0x22b)](_0xb37b4e=>_0xb37b4e['id']));const _0x365d8c=await _0x1b10d5[_0x24066e(0x168)][_0x24066e(0x205)]['getLatestJourneyId'](_0x340c03[0x0][_0x24066e(0x1e8)]),_0x1f92c9=hasMultipleVersions(_0x4e3227),_0x40c6e9=async _0x4e1d86=>{const _0x2f362e=_0x24066e,_0x109e88=_0x1b10d5[_0x2f362e(0x18d)]?.[_0x2f362e(0x16b)](_0x4e1d86);if(_0x109e88)return _0x109e88;return _0x1b10d5[_0x2f362e(0x172)]({'journeyId':_0x4e1d86,'journeyName':_0x4e3227[_0x2f362e(0x25b)],'isMultiVersion':_0x340c03[_0x2f362e(0x21a)]>0x1});};if(_0x1f92c9&&_0x340c03[_0x24066e(0x21a)]>0x1){const _0x2bbd5d=[];for(const _0x51a4a8 of _0x340c03){const _0x3ac7c7=_0x51a4a8[_0x24066e(0x24e)]||0x1;_0x1b10d5['progress']?.[_0x24066e(0x240)](_0x24066e(0x211)+_0x4e3227[_0x24066e(0x25b)]+'\x20v'+_0x3ac7c7);const _0x1c9deb=await _0x40c6e9(_0x51a4a8['id']),_0x1659c9=_0x9be9a0(_0x51a4a8['id']),_0x48f98f=await journeyResponseToDef(_0x1c9deb,_0x1659c9);_0x2bbd5d[_0x24066e(0x188)]({'item':_0x51a4a8,'yaml':_0x48f98f});}const _0x48d51d=buildLocalRuleToNameMappingFromJourney(_0x4e3227);_0x4704ab=buildMergedJourneyDef(_0x2bbd5d,_0x48d51d,_0x365d8c);const _0x19e07d=Math[_0x24066e(0x17a)](..._0x2bbd5d['map'](_0x4a8c20=>_0x4a8c20[_0x24066e(0x177)][_0x24066e(0x24e)]||0x0)),_0x44b3f6=_0x340c03[_0x24066e(0x241)](_0x4d99e2=>(_0x4d99e2['versionNumber']||0x0)===_0x19e07d);_0x44b3f6&&(_0x1b10d5[_0x24066e(0x24c)]?.[_0x24066e(0x240)](_0x24066e(0x211)+_0x4e3227[_0x24066e(0x25b)]+'\x20v'+_0x19e07d),_0x5448b1=await _0x40c6e9(_0x44b3f6['id']));}else{const _0x5e094c=_0x340c03[_0x340c03[_0x24066e(0x21a)]-0x1];_0x1b10d5['progress']?.[_0x24066e(0x240)]('Fetching\x20'+_0x4e3227['name']),_0x5448b1=await _0x40c6e9(_0x5e094c['id']);const _0x4854c7=_0x9be9a0(_0x5e094c['id']),_0x23bab9=await journeyResponseToDef(_0x5448b1,_0x4854c7),_0x15bdec=buildLocalRuleToNameMappingFromJourney(_0x4e3227);_0x4704ab=buildMergedJourneyDef([{'item':_0x5e094c,'yaml':_0x23bab9}],_0x15bdec,_0x365d8c);}}addFoldersToCreate(_0x163157,_0x1b10d5[_0x24066e(0x1f6)],_0x2bf7cd);const _0x4608b2=calculateJourneyDiff(_0x4e3227,_0x4704ab);_0x3723b9[_0x24066e(0x188)]({'relativePath':_0x4e3227[_0x24066e(0x25b)],'absolutePath':_0x1fe654,'yamlConfig':_0x4e3227,'folderPath':_0x163157,'existingJourney':_0x5448b1,'isNew':_0x4608b2[_0x24066e(0x222)],'hasChanges':_0x4608b2[_0x24066e(0x1c5)],'diff':_0x4608b2[_0x24066e(0x1f7)]});}return{'journeyFiles':_0x3723b9,'foldersToCreate':_0x2bf7cd};}export function calculateActivationActions(_0x4d38c3,_0x4ed0cc,_0x16adc5,_0x2b236b){const _0x28e9a8=a152_0x560bf2,_0x2af826=[],_0x232a2f=new Map();for(const _0x3ed9b6 of _0x4ed0cc){_0x232a2f[_0x28e9a8(0x165)](_0x3ed9b6['name'],_0x3ed9b6);}const _0x438aa8=new Map();for(const _0x34da81 of _0x4d38c3){_0x438aa8[_0x28e9a8(0x165)](_0x34da81[_0x28e9a8(0x25b)],_0x34da81);}for(const _0x36f1e6 of _0x4d38c3){const _0x3dc1c0=_0x232a2f['get'](_0x36f1e6[_0x28e9a8(0x25b)]);if(!_0x3dc1c0)_0x2af826[_0x28e9a8(0x188)]({'type':_0x28e9a8(0x162),'name':_0x36f1e6[_0x28e9a8(0x25b)],'yamlActivation':_0x36f1e6});else{const _0x237ddf=activationResponseToDef(_0x3dc1c0,_0x16adc5,_0x2b236b),_0x208374=a152_0x2ed89c['stringify'](_0x237ddf),_0xb634f2=a152_0x2ed89c[_0x28e9a8(0x1a9)](_0x36f1e6);_0x208374!==_0xb634f2&&_0x2af826[_0x28e9a8(0x188)]({'type':'update','name':_0x36f1e6[_0x28e9a8(0x25b)],'yamlActivation':_0x36f1e6,'existingActivation':_0x3dc1c0});}}for(const _0x1029c6 of _0x4ed0cc){!_0x438aa8[_0x28e9a8(0x158)](_0x1029c6[_0x28e9a8(0x25b)])&&_0x2af826[_0x28e9a8(0x188)]({'type':_0x28e9a8(0x21d),'name':_0x1029c6[_0x28e9a8(0x25b)],'existingActivation':_0x1029c6});}return _0x2af826;}function calculateYamlDiff(_0x120757,_0x507077){if(_0x507077){const _0x177d71=generateDiff(_0x507077,_0x120757),_0xd86df1=hasChanges(_0x177d71);return{'isNew':![],'hasChanges':_0xd86df1,'diff':_0xd86df1?formatDiffWithColors(_0x177d71):undefined};}const _0x2566b0=generateDiff('',_0x120757);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x2566b0)};}export function calculateSegmentDiff(_0x480fcf,_0x3d8ff1,_0x2b8e52,_0x5affe9,_0x1dbb4c){const _0x1352cb=segmentToYamlString(_0x480fcf),_0x54c114=_0x3d8ff1?segmentToYamlString(segmentWithActivationsToYaml(_0x3d8ff1,_0x2b8e52,undefined,_0x5affe9,_0x1dbb4c)):undefined;return calculateYamlDiff(_0x1352cb,_0x54c114);}export function calculateJourneyDiff(_0x27683d,_0x23ba41){const _0x324c13=normalizeJourneyDef(_0x27683d,_0x27683d),_0x27c7c4=a152_0x37a037(_0x324c13),_0x5b2bbf=_0x23ba41?a152_0x37a037(normalizeJourneyDef(_0x23ba41,_0x27683d)):undefined;return calculateYamlDiff(_0x27c7c4,_0x5b2bbf);}export function findSegmentsToDelete(_0x180b3e,_0xf841e,_0x26a7ac,_0x41441b,_0x40e32b){const _0xd4c235=a152_0x560bf2,_0x4a073c=new Set();for(const {yamlConfig:_0x316068,folderPath:_0x36cf03}of _0xf841e){_0x4a073c[_0xd4c235(0x1d2)](_0x36cf03+':'+_0x316068[_0xd4c235(0x25b)]);}return _0x180b3e[_0xd4c235(0x1e2)](_0x555740=>{const _0x5dfd99=_0xd4c235,_0x16ba79=_0x555740[_0x5dfd99(0x15f)]?_0x26a7ac[_0x5dfd99(0x16b)](_0x555740[_0x5dfd99(0x15f)][_0x5dfd99(0x163)]())||'':'',_0x59be34=_0x16ba79+':'+_0x555740[_0x5dfd99(0x25b)];if(_0x4a073c['has'](_0x59be34))return![];if(_0x40e32b)return _0x16ba79===_0x41441b||_0x16ba79[_0x5dfd99(0x1b0)](_0x41441b+'/');return!![];});}export function findJourneysToDelete(_0x928cdf,_0xb58b60,_0x429175,_0x3fa86e,_0x2ce024){const _0x32dfa7=a152_0x560bf2,_0x2e043d=new Set();for(const {yamlConfig:_0x1461ac,folderPath:_0x3145e7}of _0xb58b60){_0x2e043d[_0x32dfa7(0x1d2)](_0x3145e7+':'+_0x1461ac['name']);}return _0x928cdf[_0x32dfa7(0x1e2)](_0x5b2bef=>{const _0x24e675=_0x32dfa7,_0x5bbc98=_0x5b2bef['folderId']?_0x429175[_0x24e675(0x16b)](_0x5b2bef[_0x24e675(0x1a2)])||'':'',_0x303fce=_0x5bbc98+':'+_0x5b2bef['journeyBundleName'];if(_0x2e043d[_0x24e675(0x158)](_0x303fce))return![];if(_0x2ce024)return _0x5bbc98===_0x3fa86e||_0x5bbc98[_0x24e675(0x1b0)](_0x3fa86e+'/');return!![];});}export function buildSegmentLookupMap(_0x3d5ec2,_0x397885){const _0x239c7c=a152_0x560bf2,_0x3ce4e5=new Map();for(const _0x3eb546 of _0x3d5ec2){const _0x4adb2b=_0x3eb546[_0x239c7c(0x15f)]?_0x397885[_0x239c7c(0x16b)](_0x3eb546[_0x239c7c(0x15f)]['toString']())||'':'',_0x5a8d24=_0x4adb2b+':'+_0x3eb546[_0x239c7c(0x25b)];_0x3ce4e5['set'](_0x5a8d24,_0x3eb546);}return _0x3ce4e5;}export function buildSegmentNameToIdMap(_0x1f7b12){const _0xc56814=a152_0x560bf2,_0x488bb3=new Map();for(const _0x28701b of _0x1f7b12){_0x488bb3[_0xc56814(0x165)](_0x28701b['name'],_0x28701b['id']);}return _0x488bb3;}export function buildJourneyBundleLookupMap(_0x36eea7,_0x1245dd){const _0x31738f=a152_0x560bf2,_0x1789de=new Map();for(const _0x318f83 of _0x36eea7){const _0x5db32c=_0x318f83[_0x31738f(0x1a2)]?_0x1245dd[_0x31738f(0x16b)](_0x318f83[_0x31738f(0x1a2)])||'':'',_0x5d8f20=_0x5db32c+':'+_0x318f83[_0x31738f(0x225)];!_0x1789de[_0x31738f(0x158)](_0x5d8f20)&&_0x1789de['set'](_0x5d8f20,[]),_0x1789de[_0x31738f(0x16b)](_0x5d8f20)[_0x31738f(0x188)](_0x318f83);}for(const _0x5cb3cd of _0x1789de[_0x31738f(0x224)]()){_0x5cb3cd[_0x31738f(0x15a)]((_0x51b7d4,_0x278584)=>(_0x51b7d4['versionNumber']||0x0)-(_0x278584[_0x31738f(0x24e)]||0x0));}return _0x1789de;}export function collectFoldersToCreate(_0x85df40,_0x1b3f5f){const _0x474910=a152_0x560bf2,_0x1a4344=new Set();for(const _0x2f0582 of _0x85df40){if(!_0x2f0582)continue;if(_0x1b3f5f[_0x474910(0x158)](_0x2f0582))continue;const _0x1f3c5b=_0x2f0582[_0x474910(0x17e)]('/');let _0x5c80a1='';for(const _0x477f5e of _0x1f3c5b){_0x5c80a1=_0x5c80a1?_0x5c80a1+'/'+_0x477f5e:_0x477f5e,!_0x1b3f5f['has'](_0x5c80a1)&&_0x1a4344['add'](_0x5c80a1);}}return _0x1a4344;}function a152_0x2f0e(){const _0x4aca65=['length','sha1','index','delete','connector_config','segments','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Created\x20segment\x20\x27','isNew','Updating\x20activation\x20\x27','values','journeyBundleName','relationships','createJourneySegment','deleteActivation','Duration','activationStepsById','map','Condition','resolvedRule','embedded_segment_creating','digest','folder_created','\x27\x20entry\x20criteria','Updating\x20segment\x20\x27','\x27\x20decision\x20point\x20branch\x20\x27','deleted','\x0a\x20\x20','10qkKZYx','JOURNEY_SYNTAX_ERROR','journey_updating','journeyBundlesByFolderAndName','getSegment\x20failed\x20for\x20','errors','entry_criteria','type','hex','segmentNameToId','update','find','conditions','milestone','message','\x27...','\x20error(s)','toLowerCase','segment_updating','NOT_FOUND','activationParams','SEGMENT_SYNTAX_ERROR','progress','all_columns','versionNumber','getActivation','kind','debug','embedded_segment_created','nameToType','journeys','goal','activation_deleted','activation_','folder','getSegmentEntity\x20also\x20failed\x20for\x20',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','name','includes','5075fNJNCo','idToName','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','flatMap','1171068sHbkXu','Creating\x20segment\x20\x27','schedule','has','resolveSegment','sort','buildUserMaps','match','logInfo','slice','segmentFolderId','journey_entry_criteria_','updateActivation','create','toString','../../utils/async.js','set','join','existingJourney','deps','\x27\x20by\x20rule\x20content','1170cmyFPE','get','Segment\x20not\x20found:\x20','getSegmentEntity','segment_deleted','entries','goal\x20criteria','results','fetchJourney','activationActions','draft','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','connection','item','stages','entryCriteria','max','notification','createdSegmentId','9846XUKXrG','split','logWarning','logSuccess','uniqueServerName','steps','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','conditionSegmentId','rootFolderId','localName','user','push',').\x20','absolutePath','Updated\x20journey\x20\x27','updated','journeyById','yamlActivation','\x20(referenced\x20in\x20journey\x20','DecisionPoint','dirname','activation_template_id','replace','data','logDeleted','JOURNEY_UPDATE_ERROR','activation_deleting','INTERNAL','\x27\x20wait\x20condition','segmentId','Activation','__pending_','run_after_journey_refresh','journeyId','onProgress','125810sECqKR','decision_point','folderId','trim','\x27\x20for\x20','all','valid','2936bRysCm','Created\x20folder\x20\x27','stringify','unchanged','state','yamlConfig','size','branches','\x27\x20to\x20local\x20\x27','startsWith','activation_creating','connectionIdToNameMap','existingSegments','action','attributes','activation_created','18903HZWOlx','Entry\x20criteria:\x20','segment_updated','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','exitCriterias','folderPath','rule','parentId','relative','embeddedSegmentNameToId','Failed\x20to\x20fetch\x20referenced\x20segment\x20','listActivations','):\x20','uniqueSegmentName','hasChanges','embedded_activation_created','ACTIVATION_UPDATE_ERROR','created','object','SEGMENT_NOT_FOUND','Failed\x20to\x20','parse','activationContext','parseDocument','activations','journey_updated','utf-8','add','keys','conditionTimeoutDuration','null','journeyActivationStepId','journeyName','from','WaitStep','segment_created','Name\x20has\x20already\x20been\x20taken','\x20activation\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','columns','./journey-yaml.js','createSegment','Creating\x20activation\x20\x27','filter','SEGMENT_UPDATE_ERROR','26cUUeAr','activationsBySegmentId','createActivation','segmentByFolderAndName','journeyBundleId','waitStepUnit','Updated\x20segment\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','resolveJourneyId','updateSegmentById','parentSegmentFolder','activation_updated','withProgress','toISOString','segment','activation_updating','900075QBDtmx','\x20segment\x20from\x20file:\x20','folderPathToId','diff','.$1.push-recovery.json','idToEmailMap','Activation\x20not\x20found:\x20','Matched\x20server\x20segment\x20\x27','reduce','validatedRequest','Journey\x20\x27','Failed\x20to\x20resolve\x20segment\x20','entry','Updated\x20activation\x20\x27','description','deleteSegment','./child-segment-yaml.js','journey','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','verbose','Created\x20journey\x20\x27','__pending_act_','stage\x20\x27','journeyStages','folder_creating','list','existingActivation','Created\x20activation\x20\x27','657155MurRbE','Fetching\x20','behavior','segment_deleting','with','waitStepType','Stage\x20\x27','existingSegment','\x27\x20from\x20file:\x20','conditionTimeoutUnit'];a152_0x2f0e=function(){return _0x4aca65;};return a152_0x2f0e();}export function parseAndClassifyYamlFiles(_0x42b1a6,_0x8381bb,_0x1fd127){const _0x1f7e0b=a152_0x560bf2,_0x4faf95=[],_0x5dcad6=[];for(const _0x110d45 of _0x42b1a6){const _0x3361a4=a152_0x1a1223[_0x1f7e0b(0x1bf)](_0x8381bb,a152_0x1a1223[_0x1f7e0b(0x191)](_0x110d45)),_0x2702b6=_0x3361a4==='.'?'':_0x3361a4[_0x1f7e0b(0x193)](/\\/g,'/'),_0x2fe7c0=readFileSync(_0x110d45,_0x1f7e0b(0x1d1)),_0xba59cb=a152_0x2ed89c[_0x1f7e0b(0x1cc)](_0x2fe7c0);if(isJourneyDef(_0xba59cb)){const _0x17ca0b=a152_0x2c7776(_0x2fe7c0);_0x5dcad6[_0x1f7e0b(0x188)]({'yamlConfig':_0x17ca0b,'folderPath':_0x2702b6,'sourcePath':_0x110d45});}else{if(!_0x1fd127?.['skipSegments']){const _0x118004=parseSegmentYamlFile(_0x2fe7c0),_0x2d553b=normalizeChildSegmentYaml(_0x118004);_0x4faf95[_0x1f7e0b(0x188)]({'yamlConfig':_0x2d553b,'folderPath':_0x2702b6,'sourcePath':_0x110d45});}}}return{'segments':_0x4faf95,'journeys':_0x5dcad6};}export function validateParsedFiles(_0x25c273,_0x8ad74b){const _0x20311b=a152_0x560bf2,_0x20975b=[];for(const {yamlConfig:_0x51accb,sourcePath:_0x36147e}of _0x25c273[_0x20311b(0x21f)]){const _0x5ae33b=readFileSync(_0x36147e,_0x20311b(0x1d1)),_0x3f0293=a152_0x2ed89c['parseDocument'](_0x5ae33b),_0x1cc3c1=validateSegmentDef(_0x51accb,{'source':_0x5ae33b,'document':_0x3f0293},{'skipSchema':!![]});if(!_0x1cc3c1[_0x20311b(0x1a6)]){const _0x220251=a152_0x1a1223[_0x20311b(0x1bf)](_0x8ad74b,_0x36147e);_0x20975b[_0x20311b(0x188)]({'filePath':_0x220251,'source':_0x5ae33b,'result':_0x1cc3c1,'isJourney':![]});}}for(const {yamlConfig:_0xbebc82,sourcePath:_0x408c0e}of _0x25c273[_0x20311b(0x254)]){const _0x48be44=readFileSync(_0x408c0e,'utf-8'),_0x5187d0=a152_0x2ed89c[_0x20311b(0x1ce)](_0x48be44),_0x5f3e61=validateJourneyDef(_0xbebc82,{'source':_0x48be44,'document':_0x5187d0},{'skipSchema':!![]});if(!_0x5f3e61[_0x20311b(0x1a6)]){const _0x215c3f=a152_0x1a1223[_0x20311b(0x1bf)](_0x8ad74b,_0x408c0e);_0x20975b[_0x20311b(0x188)]({'filePath':_0x215c3f,'source':_0x48be44,'result':_0x5f3e61,'isJourney':!![]});}}return _0x20975b;}export function formatValidationErrors(_0x31712b){const _0x1ce21f=a152_0x560bf2,_0x4fe52b=[];for(const {filePath:_0x53e219,source:_0xa96e0c,result:_0x585712,isJourney:_0xcd3385}of _0x31712b){const _0x55b620=_0xcd3385?_0x1ce21f(0x205):_0x1ce21f(0x1f2);_0x4fe52b[_0x1ce21f(0x188)]('\x0a'+_0x53e219+'\x20('+_0x55b620+_0x1ce21f(0x1c3)+_0x585712[_0x1ce21f(0x23b)][_0x1ce21f(0x21a)]+_0x1ce21f(0x246)),_0x4fe52b[_0x1ce21f(0x188)](formatValidationResult(_0x585712,_0xa96e0c,_0x53e219));}return _0x4fe52b['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x345ac2){const _0x43583a=a152_0x560bf2,_0x494b35=new Set(),_0x45e24b=new Map(),_0x5d9468=collectSegmentUsageCounts(_0x345ac2);if(_0x345ac2[_0x43583a(0x21f)])for(const [_0x46bba6,_0x2120bc]of Object[_0x43583a(0x16f)](_0x345ac2[_0x43583a(0x21f)])){_0x494b35[_0x43583a(0x1d2)](_0x46bba6);if(_0x2120bc['rule']){const _0x525782=yamlRuleToApi(_0x2120bc['rule']),_0x1dff7f=apiRuleToYaml(_0x525782);_0x45e24b[_0x43583a(0x165)](_0x46bba6,_0x1dff7f);}}const _0x1e4201=new Map();let _0x274ec4=0x0;for(const [_0x5a32f5,_0x49b534]of _0x45e24b){const _0x5d3771=serializeExpandedRule(_0x49b534,_0x45e24b),_0x4aee34=_0x1e4201['get'](_0x5d3771)||[];_0x4aee34['push']({'name':_0x5a32f5,'index':_0x274ec4}),_0x1e4201[_0x43583a(0x165)](_0x5d3771,_0x4aee34),_0x274ec4++;}const _0x452eb0=new Map();for(const [_0x1c4c60,_0x5c104b]of _0x1e4201){const _0x5106ce=_0x5c104b['slice']()[_0x43583a(0x15a)]((_0x20ffc4,_0x275f9a)=>{const _0x3c7df4=_0x43583a,_0x587911=_0x5d9468[_0x3c7df4(0x16b)](_0x20ffc4[_0x3c7df4(0x25b)])||0x0,_0x684d2e=_0x5d9468[_0x3c7df4(0x16b)](_0x275f9a[_0x3c7df4(0x25b)])||0x0;if(_0x587911!==_0x684d2e)return _0x684d2e-_0x587911;return _0x20ffc4['index']-_0x275f9a[_0x3c7df4(0x21c)];})[_0x43583a(0x22b)](_0x490706=>_0x490706[_0x43583a(0x25b)]),_0xd9de0a=[];for(const _0x40abd3 of _0x5106ce){const _0x52c220=_0x5d9468['get'](_0x40abd3)||0x0,_0x29a0df=Math[_0x43583a(0x17a)](_0x52c220,0x1);for(let _0x3bc22a=0x0;_0x3bc22a<_0x29a0df;_0x3bc22a++){_0xd9de0a[_0x43583a(0x188)](_0x40abd3);}}_0x452eb0['set'](_0x1c4c60,_0xd9de0a);}return{'existingLocalSegmentNames':_0x494b35,'localSegmentRules':_0x45e24b,'localExpandedRuleToNames':_0x452eb0};}export function createSegmentIdResolver(_0x2444a1,_0x2d87f8){return async _0x8fd3dc=>{const _0x52ddef=a152_0x46e6,_0x4e9afb=_0x2444a1[_0x52ddef(0x16b)](_0x8fd3dc);if(!_0x4e9afb)throw new SDKError(ErrorCode[_0x52ddef(0x1ca)],_0x52ddef(0x16c)+_0x8fd3dc+_0x52ddef(0x153)+_0x2d87f8+'\x27)');return _0x4e9afb;};}export function extractRootFolderId(_0x176ae9){const _0x225f2d=a152_0x560bf2;return _0x176ae9[_0x225f2d(0x226)]?.[_0x225f2d(0x1ee)]?.[_0x225f2d(0x194)]?.['id']||_0x176ae9[_0x225f2d(0x226)]?.['parentFolder']?.['data']?.['id'];}export function buildConnectionMaps(_0xc770){const _0x364b60=a152_0x560bf2,_0x1f88c7=new Map(),_0x1fd56b=new Map(),_0x581701=new Map();for(const _0x302d0a of _0xc770){_0x1f88c7[_0x364b60(0x165)](_0x302d0a[_0x364b60(0x25b)],parseInt(_0x302d0a['id'],0xa)),_0x1fd56b[_0x364b60(0x165)](_0x302d0a['id'],_0x302d0a['name']),_0x581701[_0x364b60(0x165)](_0x302d0a[_0x364b60(0x25b)],_0x302d0a[_0x364b60(0x23d)]);}return{'nameToId':_0x1f88c7,'idToName':_0x1fd56b,'nameToType':_0x581701};}export function calculatePushStats(_0x53aa02,_0xc2c8,_0x14046b,_0x80b1f5,_0x41956e,_0x582991,_0x20cbb9){const _0x24a83c=a152_0x560bf2,_0x5ca699=_0x53aa02['filter'](_0x1a86b4=>_0x1a86b4['isNew']),_0x295894=_0x53aa02[_0x24a83c(0x1e2)](_0x4be669=>!_0x4be669[_0x24a83c(0x222)]&&_0x4be669[_0x24a83c(0x1c5)]),_0x1f3762=_0x53aa02['filter'](_0x8b4432=>!_0x8b4432[_0x24a83c(0x222)]&&!_0x8b4432['hasChanges']),_0x308113=_0x582991?_0x80b1f5:[],_0x25ca4e=_0xc2c8[_0x24a83c(0x1e2)](_0x1e122e=>_0x1e122e[_0x24a83c(0x222)]),_0x49ee67=_0xc2c8[_0x24a83c(0x1e2)](_0x266959=>!_0x266959[_0x24a83c(0x222)]&&_0x266959[_0x24a83c(0x1c5)]),_0x198454=_0xc2c8[_0x24a83c(0x1e2)](_0x27d4e6=>!_0x27d4e6[_0x24a83c(0x222)]&&!_0x27d4e6[_0x24a83c(0x1c5)]),_0x1bd060=_0x582991?_0x41956e:[],_0x55c6a0=_0x53aa02[_0x24a83c(0x154)](_0x52f2bc=>_0x52f2bc[_0x24a83c(0x173)]),_0x15efee=_0x55c6a0[_0x24a83c(0x1e2)](_0x1c201b=>_0x1c201b['type']===_0x24a83c(0x162)),_0x4d7a6f=_0x55c6a0['filter'](_0x41a5a1=>_0x41a5a1['type']===_0x24a83c(0x240)),_0x29e512=_0x55c6a0[_0x24a83c(0x1e2)](_0x5313c6=>_0x5313c6['type']===_0x24a83c(0x21d)),_0x36f3b2=Array[_0x24a83c(0x1d8)](_0x14046b)[_0x24a83c(0x15a)](),_0x495f68=_0x20cbb9?![]:_0x5ca699[_0x24a83c(0x21a)]>0x0||_0x295894['length']>0x0||_0x308113[_0x24a83c(0x21a)]>0x0,_0x4eed0f=_0x25ca4e['length']>0x0||_0x49ee67[_0x24a83c(0x21a)]>0x0||_0x1bd060[_0x24a83c(0x21a)]>0x0,_0x298a83=_0x20cbb9?![]:_0x55c6a0['length']>0x0,_0x4154e4=_0x36f3b2[_0x24a83c(0x21a)]>0x0;return{'segments':{'new':_0x5ca699,'changed':_0x295894,'unchanged':_0x1f3762,'toDelete':_0x308113},'journeys':{'new':_0x25ca4e,'changed':_0x49ee67,'unchanged':_0x198454,'toDelete':_0x1bd060},'activations':{'all':_0x55c6a0,'toCreate':_0x15efee,'toUpdate':_0x4d7a6f,'toDelete':_0x29e512},'folders':{'toCreate':_0x36f3b2},'counts':{'segments':{'new':_0x5ca699[_0x24a83c(0x21a)],'changed':_0x295894[_0x24a83c(0x21a)],'unchanged':_0x1f3762[_0x24a83c(0x21a)],'toDelete':_0x308113['length']},'journeys':{'new':_0x25ca4e[_0x24a83c(0x21a)],'changed':_0x49ee67['length'],'unchanged':_0x198454[_0x24a83c(0x21a)],'toDelete':_0x1bd060[_0x24a83c(0x21a)]},'activations':{'create':_0x15efee[_0x24a83c(0x21a)],'update':_0x4d7a6f['length'],'delete':_0x29e512[_0x24a83c(0x21a)]},'folders':_0x36f3b2['length']},'hasChanges':_0x495f68||_0x4eed0f||_0x298a83||_0x4154e4};}export async function buildPushExecutionContext(_0x295c63,_0x4b21c5,_0x3e39a4,_0x4ed711,_0xc3441b,_0x426145){const _0x41b040=a152_0x560bf2,_0x40e772=extractRootFolderId(_0x3e39a4),{pathToId:_0x7e9a8c,idToPath:_0x1f6c6b}=buildFolderMaps(_0xc3441b),_0x56f7dc=buildSegmentNameToIdMap(_0x4ed711),_0x4a5414=new Map(),{batchAsync:_0x2f8279}=await import(_0x41b040(0x164)),[_0x4be9ac,_0x517cbb]=await Promise[_0x41b040(0x1a5)]([_0x295c63[_0x41b040(0x187)][_0x41b040(0x15b)](),_0x295c63[_0x41b040(0x176)][_0x41b040(0x20d)](),((async()=>{!_0x426145&&_0x4ed711['length']>0x0&&await _0x2f8279(_0x4ed711,async _0x1ac5f1=>{const _0x33df1e=a152_0x46e6,_0x32bd7a=await _0x295c63[_0x33df1e(0x1f2)]['listActivations'](_0x4b21c5,_0x1ac5f1['id']);_0x4a5414[_0x33df1e(0x165)](_0x1ac5f1['id'],_0x32bd7a);});})())]),{emailToId:_0x33b841,idToEmail:_0x1598b3}=_0x4be9ac,_0x1cbfe2=buildConnectionMaps(_0x517cbb);return{'rootFolderId':_0x40e772,'folderPathToId':_0x7e9a8c,'folderIdToPath':_0x1f6c6b,'segmentNameToId':_0x56f7dc,'activationsBySegmentId':_0x4a5414,'emailToIdMap':_0x33b841,'idToEmailMap':_0x1598b3,'connectionNameToIdMap':_0x1cbfe2['nameToId'],'connectionIdToNameMap':_0x1cbfe2[_0x41b040(0x152)],'connectionNameToTypeMap':_0x1cbfe2[_0x41b040(0x253)]};}export function createPushYamlContextForBundle(_0xa69f09,_0x5c8084,_0x2b8326,_0x4da5bf,_0x4f0e5a,_0x530dc8,_0x4209c5,_0x48beb0){const {existingLocalSegmentNames:_0x1298c0,localExpandedRuleToNames:_0x48a7f2}=_0x4da5bf,_0x1f8fcd=new Set(),_0x3ca3f8=new Map(),_0x18e940=new Map(),_0x3bc28c=new Map(),_0x5700ca=createJumpTargetCache(),_0x191b44=new Map(),_0x6b7982=new Map(),_0x5645a2=new Set();let _0xa0c16f;const _0x32b465=_0x28d76f=>{const _0x47200f={'resolveSegment':async _0x1e29d9=>{const _0xf81e9f=a152_0x46e6,_0x59089b=_0x3bc28c[_0xf81e9f(0x16b)](_0x1e29d9);if(_0x59089b!==undefined)return{'name':_0x59089b,'isJourneyLocal':!![]};try{const _0x14b837=await fetchSegment(_0xa69f09,_0x5c8084,_0x1e29d9,_0x2b8326);if(!_0x14b837)throw new Error('Segment\x20not\x20found');const _0x546f52=generateJourneyLocalName(_0x14b837[_0xf81e9f(0x25b)]),_0x577b98=_0x14b837[_0xf81e9f(0x250)]===SEGMENT_KIND_JOURNEY&&_0x546f52!==undefined;let _0x3327db=_0x14b837[_0xf81e9f(0x25b)],_0x5f584f;if(_0x577b98&&_0x14b837['rule']){const _0x2eec54=apiRuleToYaml(_0x14b837[_0xf81e9f(0x1bd)]);_0x6b7982['set'](_0x1e29d9,_0x2eec54);const _0x7326=async _0x44294f=>{const _0x3da56d=_0xf81e9f,_0x22f066=collectSegmentRefsFromRule(_0x44294f);for(const _0x25f7ae of _0x22f066){if(!_0x6b7982['has'](_0x25f7ae))try{const _0x18319b=await fetchSegment(_0xa69f09,_0x5c8084,_0x25f7ae,_0x2b8326);if(_0x18319b?.[_0x3da56d(0x1bd)]){const _0x5ed641=apiRuleToYaml(_0x18319b[_0x3da56d(0x1bd)]);_0x6b7982['set'](_0x25f7ae,_0x5ed641),await _0x7326(_0x5ed641);}}catch(_0x59793b){logger['debug'](_0x3da56d(0x1c1)+_0x25f7ae+':\x20'+_0x59793b);}}};await _0x7326(_0x2eec54);const _0x54f282=serializeExpandedRule(_0x2eec54,_0x6b7982),_0x5a420e=_0x48a7f2[_0xf81e9f(0x16b)](_0x54f282);if(_0x5a420e&&_0x5a420e['length']>0x0){const _0x4c363f=_0x3ca3f8['get'](_0x54f282)||0x0,_0x48c4a0=_0x5a420e[_0x4c363f]||_0x5a420e[_0x5a420e[_0xf81e9f(0x21a)]-0x1];_0x3ca3f8['set'](_0x54f282,_0x4c363f+0x1),_0x3327db=_0x48c4a0,_0x1f8fcd[_0xf81e9f(0x1d2)](_0x3327db),_0x3bc28c[_0xf81e9f(0x165)](_0x1e29d9,_0x3327db);const _0x124369=await resolveRuleSegmentRefs(_0x2eec54,async _0xad8b78=>{const _0x1cf6fc=_0xf81e9f,_0x35fc2a=_0x3bc28c[_0x1cf6fc(0x16b)](_0xad8b78);if(_0x35fc2a)return _0x35fc2a;const _0x1ff4c3=await _0xa0c16f[_0x1cf6fc(0x159)](_0xad8b78);return _0x1ff4c3['name'];});_0x5f584f={'description':_0x14b837[_0xf81e9f(0x202)],'rule':_0x124369};}else{const _0x52d6c5=_0x191b44['get'](_0x54f282);if(_0x52d6c5)_0x3327db=_0x52d6c5,_0x3bc28c[_0xf81e9f(0x165)](_0x1e29d9,_0x3327db);else{if(_0x546f52){let _0x493eb9=_0x546f52,_0x473c85=0x2;while(_0x1f8fcd[_0xf81e9f(0x158)](_0x493eb9)||_0x1298c0[_0xf81e9f(0x158)](_0x493eb9)){_0x493eb9=_0x546f52+'_'+_0x473c85,_0x473c85++;}_0x1f8fcd[_0xf81e9f(0x1d2)](_0x493eb9),_0x3327db=_0x493eb9;}_0x3bc28c[_0xf81e9f(0x165)](_0x1e29d9,_0x3327db),_0x191b44[_0xf81e9f(0x165)](_0x54f282,_0x3327db);const _0x582b76=await resolveRuleSegmentRefs(_0x2eec54,async _0x1d4a77=>{const _0x268647=_0xf81e9f,_0x349262=_0x3bc28c['get'](_0x1d4a77);if(_0x349262)return _0x349262;const _0x294d1c=await _0xa0c16f['resolveSegment'](_0x1d4a77);return _0x294d1c[_0x268647(0x25b)];});_0x5f584f={'description':_0x14b837['description'],'rule':_0x582b76};}}}return{'name':_0x3327db,'isJourneyLocal':_0x577b98,'definition':_0x5f584f};}catch(_0x541be7){return logger[_0xf81e9f(0x251)](_0xf81e9f(0x1ff)+_0x1e29d9+':\x20'+_0x541be7),{'name':_0x1e29d9,'isJourneyLocal':![]};}},'resolveActivation':async _0x155203=>{const _0x3cc703=a152_0x46e6,_0x200430=_0x18e940[_0x3cc703(0x16b)](_0x155203);if(_0x200430!==undefined)return{'name':_0x200430,'isJourneyLocal':!![]};try{let _0x36f27a=_0x4209c5?.[_0x3cc703(0x16b)](_0x155203);!_0x36f27a&&(_0x36f27a=await _0xa69f09[_0x3cc703(0x205)][_0x3cc703(0x24f)](_0x28d76f,_0x155203));const _0x3f5ddc=_0x36f27a[_0x3cc703(0x1b5)][_0x3cc703(0x24a)][_0x3cc703(0x25b)]||_0x155203,_0x2ce059=sanitizeYamlKey(_0x3f5ddc)||_0x3cc703(0x257)+_0x155203,_0x4c6428=_0x2ce059;_0x18e940[_0x3cc703(0x165)](_0x155203,_0x4c6428);const _0x3d2220=journeyActivationStepToYaml(_0x36f27a,_0x4f0e5a,_0x530dc8);return{'name':_0x4c6428,'isJourneyLocal':!![],'definition':_0x3d2220};}catch(_0x56a3b0){return logger['debug']('Failed\x20to\x20resolve\x20activation\x20'+_0x155203+':\x20'+_0x56a3b0),{'name':_0x155203,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x30ebb1,_0x185a3d)=>resolveJumpTarget(_0x30ebb1,_0x185a3d,_0x5700ca,async _0x23387a=>{const _0xefa8fe=a152_0x46e6,_0x292de2=_0x48beb0?.[_0xefa8fe(0x16b)](_0x23387a);if(_0x292de2)return _0x292de2;return _0xa69f09['journey']['getJourney'](_0x23387a);})};return _0xa0c16f=_0x47200f,_0x47200f;},_0x210aea=async _0x54d816=>{const _0x583804=a152_0x46e6,{collectSegmentIdsFromJourneyApi:_0x589a8f}=await import(_0x583804(0x1df)),{batchAsync:_0x2e4514}=await import(_0x583804(0x164)),_0x4ea9c6=new Set();for(const _0x2874a4 of _0x54d816){let _0x4e344d=_0x48beb0?.[_0x583804(0x16b)](_0x2874a4);!_0x4e344d&&(_0x4e344d=await _0xa69f09[_0x583804(0x205)]['getJourney'](_0x2874a4));const _0x376582=_0x589a8f(_0x4e344d);for(const _0xd5b99f of _0x376582){_0x4ea9c6[_0x583804(0x1d2)](_0xd5b99f);}}let _0x3c9e12=Array[_0x583804(0x1d8)](_0x4ea9c6);while(_0x3c9e12[_0x583804(0x21a)]>0x0){const _0x4235a0=_0x3c9e12[_0x583804(0x1e2)](_0x564833=>!_0x5645a2[_0x583804(0x158)](_0x564833));if(_0x4235a0[_0x583804(0x21a)]===0x0)break;const _0x4e53c5=await _0x2e4514(_0x4235a0,async _0x218cdd=>{const _0x4ad2d4=_0x583804;_0x5645a2[_0x4ad2d4(0x1d2)](_0x218cdd);const _0x26b99e=await fetchSegment(_0xa69f09,_0x5c8084,_0x218cdd,_0x2b8326);if(!_0x26b99e)return null;return{'segmentId':_0x218cdd,'segment':_0x26b99e};},0xa),_0x21406c=new Set();for(const _0x302e36 of _0x4e53c5){if(!_0x302e36?.[_0x583804(0x1f2)]?.[_0x583804(0x1bd)])continue;const _0x29dab6=apiRuleToYaml(_0x302e36[_0x583804(0x1f2)][_0x583804(0x1bd)]);_0x6b7982[_0x583804(0x165)](_0x302e36['segmentId'],_0x29dab6);const _0x196b4d=collectSegmentRefsFromRule(_0x29dab6);for(const _0x221d09 of _0x196b4d){!_0x5645a2[_0x583804(0x158)](_0x221d09)&&_0x21406c[_0x583804(0x1d2)](_0x221d09);}}_0x3c9e12=Array[_0x583804(0x1d8)](_0x21406c);}};return{'createYamlContext':_0x32b465,'prefetchJourneySegments':_0x210aea};}export async function executePushSegments(_0x581f89,_0x4b17c6,_0x2e80e9,_0x18f1a0,_0x2ad398){const _0x5b5207=a152_0x560bf2,{segmentDefToCreateRequest:_0x22242b,segmentDefToUpdateRequest:_0x4e34f3}=await import(_0x5b5207(0x204)),_0x223480=_0x2e80e9['folderPathToId'],_0x1fef2d=0x5,_0x534497=async _0x537690=>{const _0x3f2839=_0x5b5207,_0x1f3947=_0x537690[_0x3f2839(0x1bc)]?_0x223480[_0x3f2839(0x16b)](_0x537690[_0x3f2839(0x1bc)]):undefined;let _0x2596e9;const _0x4ceb9a={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2aa45e=_0x537690['yamlConfig'];if(_0x537690['yamlConfig'][_0x3f2839(0x1bd)]){const _0xee2917=createSegmentIdResolver(_0x2e80e9[_0x3f2839(0x23f)],_0x537690[_0x3f2839(0x1ac)]['name']),_0x573a9e=await resolveRuleSegmentIds(_0x537690['yamlConfig'][_0x3f2839(0x1bd)],_0xee2917);_0x2aa45e={..._0x537690[_0x3f2839(0x1ac)],'rule':_0x573a9e};}try{if(_0x537690[_0x3f2839(0x222)]){_0x2ad398[_0x3f2839(0x19f)]?.({'type':'segment_creating','name':_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)]});const _0x598109=_0x22242b(_0x2aa45e,_0x1f3947),_0x25c539=await _0x2ad398['withProgress'](_0x3f2839(0x156)+_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)]+'\x27...',()=>_0x581f89['segment'][_0x3f2839(0x1e0)](_0x18f1a0[_0x3f2839(0x1be)],_0x598109));_0x2596e9=_0x25c539[_0x3f2839(0x194)]['id'],_0x2e80e9['segmentNameToId'][_0x3f2839(0x165)](_0x537690['yamlConfig'][_0x3f2839(0x25b)],_0x2596e9),_0x4ceb9a[_0x3f2839(0x17c)]={'name':_0x537690['yamlConfig']['name'],'id':_0x2596e9},_0x2ad398[_0x3f2839(0x19f)]?.({'type':_0x3f2839(0x1da),'name':_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)],'segmentId':_0x2596e9}),_0x2ad398[_0x3f2839(0x180)]?.(_0x3f2839(0x221)+_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)]+'\x27'),_0x4ceb9a[_0x3f2839(0x1c8)]=0x1;}else{if(_0x537690[_0x3f2839(0x1c5)]){_0x2ad398[_0x3f2839(0x19f)]?.({'type':_0x3f2839(0x248),'name':_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)]});const _0x5a5583=_0x4e34f3(_0x2aa45e);_0x1f3947!==_0x537690[_0x3f2839(0x217)]?.[_0x3f2839(0x15f)]&&(_0x5a5583[_0x3f2839(0x15f)]=_0x1f3947?parseInt(_0x1f3947,0xa):undefined),await _0x2ad398['withProgress'](_0x3f2839(0x232)+_0x537690['yamlConfig'][_0x3f2839(0x25b)]+_0x3f2839(0x245),()=>_0x581f89[_0x3f2839(0x1f2)][_0x3f2839(0x1ed)](_0x18f1a0['parentId'],_0x537690[_0x3f2839(0x217)]['id'],_0x5a5583)),_0x2596e9=_0x537690['existingSegment']['id'],_0x2ad398['onProgress']?.({'type':_0x3f2839(0x1b9),'name':_0x537690[_0x3f2839(0x1ac)]['name']}),_0x2ad398[_0x3f2839(0x180)]?.(_0x3f2839(0x1ea)+_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)]+'\x27'),_0x4ceb9a['updated']=0x1;}else _0x2596e9=_0x537690[_0x3f2839(0x217)]['id'];}}catch(_0x2fdb0c){const _0x2868dd=isHttp400Error(_0x2fdb0c),_0x1a8ccf=_0x2868dd?ErrorCode[_0x3f2839(0x24b)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x4ab2fd=getErrorMessage(_0x2fdb0c);throw new SDKError(_0x1a8ccf,_0x3f2839(0x1cb)+(_0x537690[_0x3f2839(0x222)]?'create':_0x3f2839(0x240))+_0x3f2839(0x1f5)+_0x537690[_0x3f2839(0x18a)]+'\x0a\x20\x20'+_0x4ab2fd,_0x2fdb0c);}try{const _0x4d124e=await syncActivationsForSegment(_0x581f89,_0x18f1a0[_0x3f2839(0x1be)],_0x2596e9,_0x537690[_0x3f2839(0x1ac)][_0x3f2839(0x25b)],_0x537690[_0x3f2839(0x173)],_0x2ad398,_0x537690['absolutePath']);_0x4ceb9a[_0x3f2839(0x1cf)]=_0x4d124e;}catch(_0x124fbb){if(_0x124fbb instanceof SDKError)throw _0x124fbb;throw new SDKError(ErrorCode[_0x3f2839(0x1c7)],_0x3f2839(0x206)+_0x537690[_0x3f2839(0x1ac)]['name']+_0x3f2839(0x218)+_0x537690[_0x3f2839(0x18a)]+_0x3f2839(0x235)+getErrorMessage(_0x124fbb),_0x124fbb);}return _0x4ceb9a;},_0x215659=await batchAsync(_0x4b17c6,_0x534497,_0x1fef2d),_0x4055e0={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x862be1 of _0x215659){_0x4055e0[_0x5b5207(0x1c8)]+=_0x862be1[_0x5b5207(0x1c8)],_0x4055e0[_0x5b5207(0x18c)]+=_0x862be1['updated'],_0x862be1[_0x5b5207(0x17c)]&&_0x4055e0['createdSegmentIds']['set'](_0x862be1[_0x5b5207(0x17c)][_0x5b5207(0x25b)],_0x862be1[_0x5b5207(0x17c)]['id']),_0x4055e0[_0x5b5207(0x1cf)][_0x5b5207(0x1c8)]+=_0x862be1[_0x5b5207(0x1cf)]['created'],_0x4055e0[_0x5b5207(0x1cf)][_0x5b5207(0x18c)]+=_0x862be1['activations']['updated'],_0x4055e0['activations']['deleted']+=_0x862be1[_0x5b5207(0x1cf)]['deleted'];}return _0x4055e0;}async function syncActivationsForSegment(_0x54b046,_0x31fe29,_0x3af644,_0x473920,_0x14db98,_0x1e6359,_0xaec57f){const _0x3ef5f4=a152_0x560bf2,_0x1bf123={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1a9903 of _0x14db98){try{if(_0x1a9903[_0x3ef5f4(0x23d)]===_0x3ef5f4(0x162)&&_0x1a9903[_0x3ef5f4(0x1fd)])_0x1e6359[_0x3ef5f4(0x19f)]?.({'type':_0x3ef5f4(0x1b1),'segmentName':_0x473920,'activationName':_0x1a9903[_0x3ef5f4(0x25b)]}),await _0x1e6359[_0x3ef5f4(0x1f0)](_0x3ef5f4(0x1e1)+_0x1a9903['name']+_0x3ef5f4(0x245),()=>_0x54b046[_0x3ef5f4(0x1f2)][_0x3ef5f4(0x1e6)](_0x31fe29,_0x3af644,_0x1a9903['validatedRequest'])),_0x1e6359[_0x3ef5f4(0x19f)]?.({'type':_0x3ef5f4(0x1b6),'segmentName':_0x473920,'activationName':_0x1a9903[_0x3ef5f4(0x25b)]}),_0x1e6359[_0x3ef5f4(0x180)]?.(_0x3ef5f4(0x20f)+_0x1a9903[_0x3ef5f4(0x25b)]+'\x27'),_0x1bf123[_0x3ef5f4(0x1c8)]++;else{if(_0x1a9903['type']==='update'&&_0x1a9903['validatedRequest']&&_0x1a9903[_0x3ef5f4(0x20e)])_0x1e6359[_0x3ef5f4(0x19f)]?.({'type':_0x3ef5f4(0x1f3),'segmentName':_0x473920,'activationName':_0x1a9903[_0x3ef5f4(0x25b)]}),await _0x1e6359[_0x3ef5f4(0x1f0)](_0x3ef5f4(0x223)+_0x1a9903[_0x3ef5f4(0x25b)]+_0x3ef5f4(0x245),()=>_0x54b046[_0x3ef5f4(0x1f2)][_0x3ef5f4(0x161)](_0x31fe29,_0x3af644,_0x1a9903['existingActivation']['id'],_0x1a9903['validatedRequest'])),_0x1e6359[_0x3ef5f4(0x19f)]?.({'type':_0x3ef5f4(0x1ef),'segmentName':_0x473920,'activationName':_0x1a9903[_0x3ef5f4(0x25b)]}),_0x1e6359[_0x3ef5f4(0x180)]?.(_0x3ef5f4(0x201)+_0x1a9903[_0x3ef5f4(0x25b)]+'\x27'),_0x1bf123[_0x3ef5f4(0x18c)]++;else _0x1a9903[_0x3ef5f4(0x23d)]===_0x3ef5f4(0x21d)&&_0x1a9903[_0x3ef5f4(0x20e)]&&(_0x1e6359[_0x3ef5f4(0x19f)]?.({'type':_0x3ef5f4(0x197),'segmentName':_0x473920,'activationName':_0x1a9903[_0x3ef5f4(0x25b)]}),await _0x1e6359['withProgress']('Deleting\x20activation\x20\x27'+_0x1a9903[_0x3ef5f4(0x25b)]+_0x3ef5f4(0x245),()=>_0x54b046[_0x3ef5f4(0x1f2)][_0x3ef5f4(0x228)](_0x31fe29,_0x3af644,_0x1a9903['existingActivation']['id'])),_0x1e6359['onProgress']?.({'type':_0x3ef5f4(0x256),'segmentName':_0x473920,'activationName':_0x1a9903['name']}),_0x1e6359[_0x3ef5f4(0x195)]?.('Deleted\x20activation\x20\x27'+_0x1a9903[_0x3ef5f4(0x25b)]+'\x27'),_0x1bf123[_0x3ef5f4(0x234)]++);}}catch(_0x177709){const _0x2aac99=isHttp400Error(_0x177709),_0x221965=_0x2aac99?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x57bc84=getErrorMessage(_0x177709);throw new SDKError(_0x221965,'Failed\x20to\x20'+_0x1a9903['type']+_0x3ef5f4(0x1dc)+_0x1a9903[_0x3ef5f4(0x25b)]+_0x3ef5f4(0x218)+_0xaec57f+_0x3ef5f4(0x235)+_0x57bc84,_0x177709);}}return _0x1bf123;}export async function executePushFolders(_0x3ea21c,_0x3c7763,_0x559103,_0x1376f0,_0x2680d6){const _0x972c5d=a152_0x560bf2,_0x3713b3=new Map(_0x559103),_0x4714be=sortFoldersByDepth(_0x3c7763);for(const _0x3f0e5a of _0x4714be){const _0x5df3c8=_0x3f0e5a['split']('/'),_0x303ca7=_0x5df3c8[_0x5df3c8[_0x972c5d(0x21a)]-0x1],_0x31a4ae=_0x5df3c8[_0x972c5d(0x15e)](0x0,-0x1)['join']('/'),_0x39d2f7=_0x3713b3[_0x972c5d(0x16b)](_0x31a4ae);_0x2680d6[_0x972c5d(0x19f)]?.({'type':_0x972c5d(0x20c),'folder':_0x3f0e5a});const _0x366e14={'name':_0x303ca7,'parentFolderId':_0x39d2f7},_0x2841d5=await _0x2680d6[_0x972c5d(0x1f0)]('Creating\x20folder\x20\x27'+_0x3f0e5a+_0x972c5d(0x245),()=>_0x3ea21c['segment']['createFolder'](_0x1376f0['parentId'],_0x366e14));_0x3713b3[_0x972c5d(0x165)](_0x3f0e5a,_0x2841d5[_0x972c5d(0x194)]['id']),_0x2680d6[_0x972c5d(0x19f)]?.({'type':_0x972c5d(0x230),'folder':_0x3f0e5a,'folderId':_0x2841d5[_0x972c5d(0x194)]['id']}),_0x2680d6[_0x972c5d(0x15d)]?.(_0x972c5d(0x1a8)+_0x3f0e5a+'\x27');}return _0x3713b3;}export async function executePushSegmentDeletions(_0xe837f6,_0x41781d,_0x4a9093){const _0x2da763=a152_0x560bf2;if(_0x41781d[_0x2da763(0x21a)]===0x0)return 0x0;const {batchAsync:_0x3f5af6}=await import('../../utils/async.js'),_0x5dbf9f=0x5,_0x5a55c8=await _0x3f5af6(_0x41781d,async _0x5ad919=>{const _0x3360dc=_0x2da763;return _0x4a9093[_0x3360dc(0x19f)]?.({'type':_0x3360dc(0x213),'name':_0x5ad919[_0x3360dc(0x25b)]}),await _0xe837f6[_0x3360dc(0x1f2)][_0x3360dc(0x203)](_0x5ad919['id']),_0x4a9093[_0x3360dc(0x19f)]?.({'type':_0x3360dc(0x16e),'name':_0x5ad919[_0x3360dc(0x25b)]}),_0x4a9093[_0x3360dc(0x195)]?.('Deleted\x20segment\x20\x27'+_0x5ad919[_0x3360dc(0x25b)]+'\x27'),0x1;},_0x5dbf9f);return _0x5a55c8[_0x2da763(0x1fc)]((_0x32ce28,_0x4d403)=>_0x32ce28+_0x4d403,0x0);}export async function executePushJourneys(_0x5ddfc3,_0x29dfad,_0x503b06,_0x2da4a5,_0x4634aa){const _0x40150d=a152_0x560bf2,{journeyDefToRequest:_0x4bd49c}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x20a950,yamlRuleToApi:_0x4f0196,validateSegmentRule:_0x581d98}=await import(_0x40150d(0x204)),_0x1dabe6={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x550820=new Map(_0x503b06[_0x40150d(0x23f)]),_0x13dc2e=0x5;for(let _0x46f972=0x0;_0x46f972<_0x29dfad['length'];_0x46f972+=_0x13dc2e){const _0x13f5db=_0x29dfad[_0x40150d(0x15e)](_0x46f972,_0x46f972+_0x13dc2e),_0x3dda07=await Promise[_0x40150d(0x1a5)](_0x13f5db[_0x40150d(0x22b)](async _0x5b68da=>{const _0x55a0b3=_0x40150d;if(!_0x5b68da[_0x55a0b3(0x222)]&&!_0x5b68da[_0x55a0b3(0x1c5)])return{'action':_0x55a0b3(0x1aa),'name':_0x5b68da[_0x55a0b3(0x1ac)][_0x55a0b3(0x25b)],'journeyId':_0x5b68da[_0x55a0b3(0x167)]?.['id']};const _0x1b8658=_0x5b68da[_0x55a0b3(0x1bc)]?_0x503b06[_0x55a0b3(0x1f6)][_0x55a0b3(0x16b)](_0x5b68da[_0x55a0b3(0x1bc)]):undefined;_0x4634aa['onProgress']?.({'type':_0x5b68da[_0x55a0b3(0x222)]?'journey_creating':_0x55a0b3(0x238),'name':_0x5b68da[_0x55a0b3(0x1ac)]['name']});try{const _0x2f5732=await executeSingleJourneyPush(_0x5ddfc3,_0x5b68da,{..._0x503b06,'segmentNameToId':_0x550820},{'parentId':_0x2da4a5[_0x55a0b3(0x1be)],'rootFolderId':_0x2da4a5['rootFolderId'],'folderId':_0x1b8658,'verbose':_0x2da4a5[_0x55a0b3(0x207)]},_0x4634aa,{'journeyDefToRequest':_0x4bd49c,'activationDefToCreateRequest':_0x20a950,'yamlRuleToApi':_0x4f0196,'validateSegmentRule':_0x581d98});for(const [_0x5d8087,_0x270182]of _0x2f5732[_0x55a0b3(0x1c0)]){_0x550820[_0x55a0b3(0x165)](_0x5d8087,_0x270182),_0x1dabe6[_0x55a0b3(0x1c0)]['set'](_0x5d8087,_0x270182);}if(_0x2f5732[_0x55a0b3(0x1b4)]===_0x55a0b3(0x1c8))_0x4634aa[_0x55a0b3(0x19f)]?.({'type':'journey_created','name':_0x5b68da['yamlConfig'][_0x55a0b3(0x25b)],'journeyId':_0x2f5732[_0x55a0b3(0x19e)]}),_0x4634aa['logSuccess']?.(_0x55a0b3(0x208)+_0x5b68da[_0x55a0b3(0x1ac)]['name']+'\x27'),_0x1dabe6[_0x55a0b3(0x1c8)]++;else _0x2f5732[_0x55a0b3(0x1b4)]===_0x55a0b3(0x18c)&&(_0x4634aa['onProgress']?.({'type':_0x55a0b3(0x1d0),'name':_0x5b68da[_0x55a0b3(0x1ac)][_0x55a0b3(0x25b)]}),_0x4634aa[_0x55a0b3(0x180)]?.(_0x55a0b3(0x18b)+_0x5b68da[_0x55a0b3(0x1ac)][_0x55a0b3(0x25b)]+'\x27'),_0x1dabe6['updated']++);return{'action':_0x2f5732['action'],'name':_0x5b68da[_0x55a0b3(0x1ac)][_0x55a0b3(0x25b)],'journeyId':_0x2f5732[_0x55a0b3(0x19e)]};}catch(_0x518443){const _0xbf267e=isHttp400Error(_0x518443),_0xa75519=_0xbf267e?ErrorCode[_0x55a0b3(0x237)]:ErrorCode[_0x55a0b3(0x196)],_0x9a8f73=getErrorMessage(_0x518443);throw new SDKError(_0xa75519,_0x55a0b3(0x1cb)+(_0x5b68da['isNew']?_0x55a0b3(0x162):_0x55a0b3(0x240))+'\x20journey\x20from\x20file:\x20'+_0x5b68da[_0x55a0b3(0x18a)]+_0x55a0b3(0x235)+_0x9a8f73,_0x518443);}}));_0x1dabe6[_0x40150d(0x171)][_0x40150d(0x188)](..._0x3dda07);}return _0x1dabe6;}async function matchExistingJourneySegments(_0x224fee,_0x4a5d5c,_0x35e3b5,_0x2ea7f3,_0x258f21){const _0x58e3ea=a152_0x560bf2;if(!_0x4a5d5c[_0x58e3ea(0x167)]||!_0x4a5d5c['yamlConfig'][_0x58e3ea(0x21f)])return;const _0x28c94d=new Map(),_0x2e5a14=new Set();for(const _0x9b48f6 of Object[_0x58e3ea(0x1d3)](_0x4a5d5c[_0x58e3ea(0x1ac)][_0x58e3ea(0x21f)])){const _0x57c9b6=generateDeterministicJourneySegmentName(_0x4a5d5c['yamlConfig'][_0x58e3ea(0x25b)],_0x9b48f6);_0x28c94d['set'](_0x57c9b6,_0x9b48f6),_0x2e5a14[_0x58e3ea(0x1d2)](_0x9b48f6);}const _0x38725f=[],_0x34daee=collectSegmentIdsFromJourneyApi(_0x4a5d5c[_0x58e3ea(0x167)]);for(const _0x5c5b96 of _0x34daee){const _0xd557d4=await fetchSegment(_0x224fee,_0x35e3b5,_0x5c5b96,_0x2ea7f3);if(!_0xd557d4?.['name'])continue;const _0x3e9c0d=_0x28c94d[_0x58e3ea(0x16b)](_0xd557d4[_0x58e3ea(0x25b)]);_0x3e9c0d?(_0x258f21['set'](_0x3e9c0d,_0x5c5b96),_0x2e5a14[_0x58e3ea(0x21d)](_0x3e9c0d)):_0x38725f[_0x58e3ea(0x188)]({'id':_0x5c5b96,'seg':_0xd557d4});}if(_0x2e5a14[_0x58e3ea(0x1ad)]>0x0&&_0x38725f[_0x58e3ea(0x21a)]>0x0){const {localExpandedRuleToNames:_0x2d64e0}=buildLocalExpandedRuleMappings(_0x4a5d5c[_0x58e3ea(0x1ac)]),_0x2222f9=new Map();for(const {id:_0x18560a,seg:_0x50297d}of _0x38725f){if(_0x50297d[_0x58e3ea(0x1bd)]){const _0x5d7876=apiRuleToYaml(_0x50297d[_0x58e3ea(0x1bd)]);_0x2222f9['set'](_0x18560a,_0x5d7876);}}for(const {id:_0x3765cc,seg:_0x31313c}of _0x38725f){if(!_0x31313c[_0x58e3ea(0x1bd)])continue;const _0x56c2ea=_0x2222f9[_0x58e3ea(0x16b)](_0x3765cc);if(!_0x56c2ea)continue;const _0x318fd5=serializeExpandedRule(_0x56c2ea,_0x2222f9),_0x367d53=_0x2d64e0[_0x58e3ea(0x16b)](_0x318fd5);if(_0x367d53){const _0x4539dc=_0x367d53[_0x58e3ea(0x241)](_0x408948=>_0x2e5a14[_0x58e3ea(0x158)](_0x408948));_0x4539dc&&(_0x258f21[_0x58e3ea(0x165)](_0x4539dc,_0x3765cc),_0x2e5a14['delete'](_0x4539dc),logger[_0x58e3ea(0x251)](_0x58e3ea(0x1fb)+_0x31313c[_0x58e3ea(0x25b)]+_0x58e3ea(0x1af)+_0x4539dc+_0x58e3ea(0x169)));}}}}async function executeSingleJourneyPush(_0x5082b5,_0x89d8c7,_0x6a0c23,_0x536bfe,_0x59050a,_0x47a35c){const _0x3d7de6=a152_0x560bf2,{journeyDefToRequest:_0x1f08a5,activationDefToCreateRequest:_0x202cae,yamlRuleToApi:_0x5dabfa,validateSegmentRule:_0x37607e}=_0x47a35c,_0x37e0f5=new Map(),_0x35d788=new Map();recoverSegmentIdsFromPushRecovery(_0x89d8c7,_0x37e0f5,_0x6a0c23[_0x3d7de6(0x23f)]);const _0x42bfbb=new Map(),_0xd5cb68=new Map(),_0x459644=new Map();let _0x54fc25;const _0x502482=async()=>{const _0x3187de=_0x3d7de6;if(_0x54fc25)return;_0x54fc25=new Map();if(!_0x89d8c7[_0x3187de(0x167)])return;const _0x5c2ca8=await _0x5082b5[_0x3187de(0x205)][_0x3187de(0x1c2)](_0x89d8c7[_0x3187de(0x167)]['id']);for(const _0xc27c1f of _0x5c2ca8){const _0x520d80=journeyActivationStepToYaml(_0xc27c1f,_0x6a0c23['idToEmailMap'],_0x6a0c23['connectionIdToNameMap']),_0x1bad99=activationSignature(_0x520d80);!_0x54fc25[_0x3187de(0x158)](_0x1bad99)&&_0x54fc25[_0x3187de(0x165)](_0x1bad99,_0xc27c1f['id']),_0x520d80[_0x3187de(0x25b)]&&_0x35d788[_0x3187de(0x165)](_0x520d80['name'],_0xc27c1f['id']);}};await matchExistingJourneySegments(_0x5082b5,_0x89d8c7,_0x536bfe[_0x3d7de6(0x1be)],_0x6a0c23['existingSegments'],_0x6a0c23[_0x3d7de6(0x23f)]);const _0x27d89a={'resolveSegmentId':async _0x351b23=>{const _0x406cd1=_0x3d7de6,_0x36e9db=_0x6a0c23[_0x406cd1(0x23f)][_0x406cd1(0x16b)](_0x351b23);if(!_0x36e9db)throw new SDKError(ErrorCode[_0x406cd1(0x1ca)],_0x406cd1(0x16c)+_0x351b23+_0x406cd1(0x18f)+_0x89d8c7[_0x406cd1(0x1ac)]['name']+')');return _0x36e9db;},'resolveEmbeddedSegmentId':async(_0x900aba,_0x1fcbe9)=>{const _0x46342b=_0x3d7de6,_0x118a24=_0x6a0c23[_0x46342b(0x23f)][_0x46342b(0x16b)](_0x900aba);if(_0x118a24)return _0x118a24;const _0x368b13=_0x6a0c23['existingSegments']['find'](_0x40f414=>_0x40f414[_0x46342b(0x25b)]===_0x900aba);if(_0x368b13)return _0x6a0c23[_0x46342b(0x23f)][_0x46342b(0x165)](_0x900aba,_0x368b13['id']),_0x368b13['id'];if(_0x89d8c7[_0x46342b(0x222)]){const {stageName:_0x758f0,criteriaName:_0x15db5d}=findSegmentCriteriaLocation(_0x89d8c7[_0x46342b(0x1ac)],_0x900aba);return _0x37607e(_0x900aba,_0x1fcbe9['rule']),_0xd5cb68[_0x46342b(0x165)](_0x900aba,{'definition':_0x1fcbe9,'stageName':_0x758f0,'criteriaName':_0x15db5d}),createPendingSegmentId(_0x900aba);}const _0x4cdae5=_0x89d8c7['existingJourney']?.['id'];if(!_0x4cdae5)throw new SDKError(ErrorCode[_0x46342b(0x198)],_0x46342b(0x1eb));const _0x56c42a=_0x42bfbb[_0x46342b(0x16b)](_0x900aba);if(_0x56c42a)return _0x56c42a;const _0x1ba2cb=((async()=>{const _0x195906=_0x46342b;_0x37607e(_0x900aba,_0x1fcbe9[_0x195906(0x1bd)]);const _0x3120e9=generateDeterministicJourneySegmentName(_0x89d8c7[_0x195906(0x1ac)][_0x195906(0x25b)],_0x900aba),_0x4efae5=_0x6a0c23[_0x195906(0x1b3)][_0x195906(0x241)](_0x5bd8fe=>_0x5bd8fe[_0x195906(0x25b)]===_0x3120e9),_0x20a748=createSegmentIdResolver(_0x6a0c23[_0x195906(0x23f)],_0x900aba),_0x5f1f16=await resolveRuleSegmentIds(_0x1fcbe9[_0x195906(0x1bd)],_0x20a748);let _0x410daa;return _0x4efae5?(await _0x5082b5[_0x195906(0x1f2)][_0x195906(0x1ed)](_0x536bfe[_0x195906(0x1be)],_0x4efae5['id'],{'description':_0x1fcbe9['description']||_0x195906(0x1b8)+_0x900aba,'rule':_0x5dabfa(_0x5f1f16),'countPopulation':!![]}),_0x410daa=_0x4efae5['id'],saveSegmentToPushRecovery(_0x89d8c7['absolutePath'],_0x89d8c7[_0x195906(0x1ac)]['name'],_0x900aba,{'segmentId':_0x410daa,'uniqueServerName':_0x3120e9,'createdAt':new Date()[_0x195906(0x1f1)]()})):_0x410daa=await createOrRecoverEmbeddedSegment(_0x5082b5,_0x89d8c7,{'localName':_0x900aba,'uniqueSegmentName':_0x3120e9,'description':_0x1fcbe9[_0x195906(0x202)]||_0x195906(0x1b8)+_0x900aba,'journeyId':_0x4cdae5,'resolvedRule':_0x5f1f16,'parentId':_0x536bfe['parentId'],'folderId':_0x536bfe[_0x195906(0x185)]||''},_0x5dabfa),_0x6a0c23[_0x195906(0x23f)]['set'](_0x900aba,_0x410daa),_0x37e0f5[_0x195906(0x165)](_0x900aba,_0x410daa),_0x410daa;})());_0x42bfbb['set'](_0x900aba,_0x1ba2cb);try{return await _0x1ba2cb;}finally{_0x42bfbb[_0x46342b(0x21d)](_0x900aba);}},'resolveActivationId':async _0x50fa9f=>{const _0x517f8c=_0x3d7de6,_0x4f96c6=_0x35d788[_0x517f8c(0x16b)](_0x50fa9f);if(_0x4f96c6)return _0x4f96c6;if(_0x89d8c7[_0x517f8c(0x167)]){await _0x502482();const _0x4453c1=_0x35d788[_0x517f8c(0x16b)](_0x50fa9f);if(_0x4453c1)return _0x4453c1;}throw new SDKError(ErrorCode[_0x517f8c(0x249)],_0x517f8c(0x1fa)+_0x50fa9f+_0x517f8c(0x18f)+_0x89d8c7[_0x517f8c(0x1ac)][_0x517f8c(0x25b)]+_0x517f8c(0x189)+_0x517f8c(0x220));},'resolveEmbeddedActivationId':async(_0x2beb4c,_0x373f97)=>{const _0x7ecc94=_0x3d7de6,_0x4b7e98=_0x35d788[_0x7ecc94(0x16b)](_0x2beb4c);if(_0x4b7e98)return _0x4b7e98;if(_0x89d8c7[_0x7ecc94(0x222)])return _0x459644['set'](_0x2beb4c,_0x373f97),createPendingActivationId(_0x2beb4c);if(_0x89d8c7['existingJourney']){await _0x502482();const _0x4a5295=_0x35d788[_0x7ecc94(0x16b)](_0x373f97['name']);if(_0x4a5295)return _0x35d788[_0x7ecc94(0x165)](_0x2beb4c,_0x4a5295),_0x4a5295;const _0x2646f0=activationSignature(_0x373f97),_0x22a016=_0x54fc25?.['get'](_0x2646f0);if(_0x22a016)return _0x35d788['set'](_0x2beb4c,_0x22a016),_0x22a016;const _0x26ca96=await _0x202cae(_0x373f97,_0x6a0c23[_0x7ecc94(0x1cd)]),_0x3997a7={..._0x26ca96,..._0x373f97[_0x7ecc94(0x19d)]!==undefined&&{'runAfterJourneyRefresh':_0x373f97['run_after_journey_refresh']}},_0x1e208c=await _0x5082b5[_0x7ecc94(0x205)][_0x7ecc94(0x1e6)](_0x89d8c7['existingJourney']['id'],_0x3997a7);return _0x35d788['set'](_0x2beb4c,_0x1e208c['id']),_0x1e208c['id'];}throw new SDKError(ErrorCode[_0x7ecc94(0x198)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x487f1a=>{const _0x9b483c=_0x3d7de6;try{return await _0x5082b5[_0x9b483c(0x205)][_0x9b483c(0x1ec)](_0x536bfe[_0x9b483c(0x1be)],_0x487f1a);}catch(_0x12d490){throw new SDKError(ErrorCode['NOT_FOUND'],_0x9b483c(0x1fe)+_0x487f1a+_0x9b483c(0x175)+_0x89d8c7[_0x9b483c(0x1ac)][_0x9b483c(0x25b)]+'\x27)',_0x12d490);}},'resolveStageId':async(_0xd10203,_0x53c3cc)=>{const _0x486cf8=_0x3d7de6,_0x4f3d9d=await _0x5082b5[_0x486cf8(0x205)]['getJourney'](_0xd10203),_0x563138=_0x4f3d9d['attributes'][_0x486cf8(0x20b)]['find'](_0x1a4671=>_0x1a4671[_0x486cf8(0x25b)][_0x486cf8(0x247)]()===_0x53c3cc[_0x486cf8(0x247)]());if(!_0x563138?.['id'])throw new SDKError(ErrorCode[_0x486cf8(0x249)],_0x486cf8(0x216)+_0x53c3cc+_0x486cf8(0x1dd)+(_0x4f3d9d[_0x486cf8(0x1b5)][_0x486cf8(0x225)]||_0x4f3d9d[_0x486cf8(0x1b5)][_0x486cf8(0x25b)])+'\x27');return _0x563138['id'];}},_0x157147=await _0x1f08a5(_0x89d8c7['yamlConfig'],_0x536bfe[_0x3d7de6(0x1be)],_0x27d89a),_0x330f4b=_0x536bfe[_0x3d7de6(0x1a2)]||_0x536bfe[_0x3d7de6(0x185)];_0x330f4b&&(_0x157147['relationships']={'parentFolder':{'data':{'id':_0x330f4b,'type':_0x3d7de6(0x258)}}});if(_0x89d8c7[_0x3d7de6(0x222)]){if(_0xd5cb68['size']>0x0||_0x459644[_0x3d7de6(0x1ad)]>0x0)return await executeThreeStepJourneyCreate(_0x5082b5,_0x89d8c7,_0x157147,{'pendingEmbeddedSegments':_0xd5cb68,'pendingEmbeddedActivations':_0x459644,'embeddedSegmentNameToId':_0x37e0f5,'journeyActivationNameToId':_0x35d788},{..._0x536bfe,'effectiveFolderId':_0x330f4b},_0x6a0c23,_0x59050a,_0x47a35c);else{ensureJourneyDefaults(_0x157147[_0x3d7de6(0x1b5)]);const _0x5a9b28=await _0x5082b5['journey']['create'](_0x157147);return deletePushRecovery(_0x89d8c7[_0x3d7de6(0x18a)]),{'action':'created','journeyId':_0x5a9b28['id'],'embeddedSegmentNameToId':_0x37e0f5};}}else{if(_0x89d8c7['hasChanges']&&_0x89d8c7[_0x3d7de6(0x167)]){_0x157147['id']=_0x89d8c7['existingJourney']['id'];const _0x38e03a=_0x157147[_0x3d7de6(0x1b5)];_0x89d8c7[_0x3d7de6(0x167)][_0x3d7de6(0x1b5)]?.[_0x3d7de6(0x225)]&&(_0x38e03a[_0x3d7de6(0x225)]=_0x89d8c7['existingJourney'][_0x3d7de6(0x1b5)][_0x3d7de6(0x225)]);const _0xf239ac=_0x89d8c7[_0x3d7de6(0x167)][_0x3d7de6(0x1b5)]?.[_0x3d7de6(0x20b)];return _0xf239ac&&_0x157147[_0x3d7de6(0x1b5)][_0x3d7de6(0x20b)]&&injectExistingStageIds(_0x157147[_0x3d7de6(0x1b5)]['journeyStages'],_0xf239ac),ensureJourneyDefaults(_0x38e03a),await _0x5082b5['journey']['update'](_0x89d8c7['existingJourney']['id'],_0x157147),deletePushRecovery(_0x89d8c7[_0x3d7de6(0x18a)]),{'action':_0x3d7de6(0x18c),'journeyId':_0x89d8c7[_0x3d7de6(0x167)]['id'],'embeddedSegmentNameToId':_0x37e0f5};}}return deletePushRecovery(_0x89d8c7[_0x3d7de6(0x18a)]),{'action':_0x3d7de6(0x1aa),'journeyId':_0x89d8c7['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x37e0f5};}function findSegmentCriteriaLocation(_0x3a637c,_0x3daa42){const _0x513167=a152_0x560bf2,_0x5a3118=_0x3a637c[_0x513167(0x178)]||_0x3a637c[_0x513167(0x254)]?.[0x0]?.['stages']||[];let _0x44801f=_0x513167(0x200),_0x147b55=_0x3daa42;const _0x2539fb=_0x3a637c[_0x513167(0x255)]||_0x3a637c['journeys']?.[0x0]?.[_0x513167(0x255)];if(_0x2539fb?.[_0x513167(0x1f2)]===_0x3daa42)return{'stageName':_0x513167(0x255),'criteriaName':_0x2539fb['name']||_0x3daa42};_0x506aec:for(const _0x27c4e8 of _0x5a3118){if(_0x27c4e8[_0x513167(0x23c)]?.[_0x513167(0x1f2)]===_0x3daa42){_0x44801f=_0x27c4e8[_0x513167(0x25b)],_0x147b55=_0x27c4e8[_0x513167(0x23c)]['name']||_0x3daa42;break;}if(_0x27c4e8[_0x513167(0x182)])for(const _0x3bf846 of _0x27c4e8[_0x513167(0x182)]){if(_0x3bf846[_0x513167(0x23d)]===_0x513167(0x1a1)&&_0x3bf846[_0x513167(0x214)]?.[_0x513167(0x1ae)])for(const _0x2a65c9 of _0x3bf846[_0x513167(0x214)][_0x513167(0x1ae)]){if(_0x2a65c9[_0x513167(0x1f2)]===_0x3daa42){_0x44801f=_0x27c4e8[_0x513167(0x25b)],_0x147b55=_0x2a65c9[_0x513167(0x25b)]||_0x3daa42;break _0x506aec;}}}}return{'stageName':_0x44801f,'criteriaName':_0x147b55};}async function executeThreeStepJourneyCreate(_0x3ab7ea,_0x2810db,_0x18f1a4,_0x3f5467,_0x498321,_0x28c810,_0xd1ad6a,_0x334b6f){const _0x2b498e=a152_0x560bf2,{activationDefToCreateRequest:_0x173b99,yamlRuleToApi:_0x39e9b3}=_0x334b6f,{pendingEmbeddedSegments:_0x185404,pendingEmbeddedActivations:_0x157960,embeddedSegmentNameToId:_0x4c7cf2}=_0x3f5467,_0x85000=JSON[_0x2b498e(0x1cc)](JSON[_0x2b498e(0x1a9)](_0x18f1a4));ensureJourneyDefaults(_0x85000[_0x2b498e(0x1b5)]),stripPendingIds(_0x85000);const _0x24994f=await _0x3ab7ea['journey'][_0x2b498e(0x162)](_0x85000),_0x3e49ee=_0x24994f['id'],_0x2caa34=new Map();for(const _0x36615f of _0x24994f[_0x2b498e(0x1b5)][_0x2b498e(0x20b)]){_0x2caa34['set'](_0x36615f[_0x2b498e(0x25b)]['toLowerCase'](),_0x36615f['id']);}recoverSegmentIdsFromPushRecovery(_0x2810db,_0x4c7cf2,_0x28c810[_0x2b498e(0x23f)]);for(const [_0x157542,{definition:_0x15fc5f}]of _0x185404){if(_0x4c7cf2[_0x2b498e(0x158)](_0x157542)){_0xd1ad6a[_0x2b498e(0x19f)]?.({'type':_0x2b498e(0x252),'journeyName':_0x2810db[_0x2b498e(0x1ac)]['name'],'segmentName':_0x157542});continue;}const _0x23ec4d=generateDeterministicJourneySegmentName(_0x2810db[_0x2b498e(0x1ac)][_0x2b498e(0x25b)],_0x157542);_0xd1ad6a[_0x2b498e(0x19f)]?.({'type':_0x2b498e(0x22e),'journeyName':_0x2810db[_0x2b498e(0x1ac)][_0x2b498e(0x25b)],'segmentName':_0x157542});const _0x59d4c2=createSegmentIdResolver(_0x28c810['segmentNameToId'],_0x157542),_0x202b43=await resolveRuleSegmentIds(_0x15fc5f['rule'],_0x59d4c2),_0x1f864f=await createOrRecoverEmbeddedSegment(_0x3ab7ea,_0x2810db,{'localName':_0x157542,'uniqueSegmentName':_0x23ec4d,'description':_0x15fc5f[_0x2b498e(0x202)]||_0x2b498e(0x1b8)+_0x157542,'journeyId':_0x3e49ee,'resolvedRule':_0x202b43,'parentId':_0x498321[_0x2b498e(0x1be)],'folderId':_0x498321['effectiveFolderId']||''},_0x39e9b3);_0x4c7cf2[_0x2b498e(0x165)](_0x157542,_0x1f864f),_0x28c810[_0x2b498e(0x23f)]['set'](_0x157542,_0x1f864f),_0xd1ad6a[_0x2b498e(0x19f)]?.({'type':_0x2b498e(0x252),'journeyName':_0x2810db[_0x2b498e(0x1ac)]['name'],'segmentName':_0x157542});}const _0xb95ef4=new Map();for(const [_0xaaa3,_0xf682ad]of _0x157960){_0xd1ad6a[_0x2b498e(0x19f)]?.({'type':'embedded_activation_creating','journeyName':_0x2810db[_0x2b498e(0x1ac)][_0x2b498e(0x25b)],'activationName':_0xaaa3});const _0x1bc145=await _0x173b99(_0xf682ad,_0x28c810[_0x2b498e(0x1cd)]),_0x4aafdf={..._0x1bc145,..._0xf682ad[_0x2b498e(0x19d)]!==undefined&&{'runAfterJourneyRefresh':_0xf682ad[_0x2b498e(0x19d)]}},_0xb78f71=await _0x3ab7ea[_0x2b498e(0x205)]['createActivation'](_0x3e49ee,_0x4aafdf);_0xb95ef4[_0x2b498e(0x165)](_0xaaa3,_0xb78f71['id']),_0x3f5467['journeyActivationNameToId'][_0x2b498e(0x165)](_0xaaa3,_0xb78f71['id']),_0xd1ad6a[_0x2b498e(0x19f)]?.({'type':_0x2b498e(0x1c6),'journeyName':_0x2810db[_0x2b498e(0x1ac)][_0x2b498e(0x25b)],'activationName':_0xaaa3});}const _0x3b1fca=JSON[_0x2b498e(0x1cc)](JSON[_0x2b498e(0x1a9)](_0x18f1a4));return _0x3b1fca['id']=_0x3e49ee,ensureJourneyDefaults(_0x3b1fca[_0x2b498e(0x1b5)]),resolvePendingIdsInRequest(_0x3b1fca,_0x18f1a4,_0x2caa34,_0x4c7cf2,_0xb95ef4,_0xd1ad6a),await _0x3ab7ea[_0x2b498e(0x205)][_0x2b498e(0x240)](_0x3e49ee,_0x3b1fca),deletePushRecovery(_0x2810db[_0x2b498e(0x18a)]),{'action':_0x2b498e(0x1c8),'journeyId':_0x3e49ee,'embeddedSegmentNameToId':_0x4c7cf2};}export function stripWaitStepPendingIds(_0x3b0290){const _0x1a2a1c=a152_0x560bf2,_0x953f52=_0x3b0290[_0x1a2a1c(0x184)]&&isPendingSegmentId(_0x3b0290[_0x1a2a1c(0x184)]),_0x9b7f3=_0x3b0290[_0x1a2a1c(0x242)]?.['some'](_0x8b18f3=>_0x8b18f3[_0x1a2a1c(0x19a)]&&isPendingSegmentId(_0x8b18f3['segmentId']));(_0x953f52||_0x9b7f3)&&(_0x3b0290[_0x1a2a1c(0x215)]=_0x1a2a1c(0x229),_0x3b0290['waitStep']=0x1,_0x3b0290[_0x1a2a1c(0x1e9)]='day',delete _0x3b0290[_0x1a2a1c(0x184)],delete _0x3b0290[_0x1a2a1c(0x1d4)],delete _0x3b0290[_0x1a2a1c(0x219)],delete _0x3b0290['conditions']);}export function resolveWaitStepPendingIds(_0x2e2b3c,_0x4918a4,_0x24e221,_0x5a9635){const _0x1740ca=a152_0x560bf2;if(_0x4918a4[_0x1740ca(0x184)]&&isPendingSegmentId(_0x4918a4[_0x1740ca(0x184)])){const _0x25b60f=_0x24e221(_0x4918a4[_0x1740ca(0x184)],'stage\x20\x27'+_0x5a9635+_0x1740ca(0x199));_0x25b60f&&(_0x2e2b3c[_0x1740ca(0x215)]='Condition',_0x2e2b3c[_0x1740ca(0x184)]=_0x25b60f,delete _0x2e2b3c['waitStep'],delete _0x2e2b3c[_0x1740ca(0x1e9)],_0x4918a4['conditionTimeoutDuration']!==undefined&&(_0x2e2b3c[_0x1740ca(0x1d4)]=_0x4918a4['conditionTimeoutDuration']),_0x4918a4[_0x1740ca(0x219)]&&(_0x2e2b3c[_0x1740ca(0x219)]=_0x4918a4[_0x1740ca(0x219)]));}if(_0x4918a4[_0x1740ca(0x242)]){const _0x34a712=_0x4918a4['conditions']['some'](_0x2bbd05=>_0x2bbd05[_0x1740ca(0x19a)]&&isPendingSegmentId(_0x2bbd05[_0x1740ca(0x19a)]));if(_0x34a712){const _0x1bbca5=_0x4918a4[_0x1740ca(0x242)]['map'](_0x430616=>{const _0x4a302e=_0x1740ca;if(_0x430616[_0x4a302e(0x19a)]&&isPendingSegmentId(_0x430616[_0x4a302e(0x19a)])){const _0x2fc5ce=_0x24e221(_0x430616[_0x4a302e(0x19a)],_0x4a302e(0x20a)+_0x5a9635+_0x4a302e(0x199));return{..._0x430616,'segmentId':_0x2fc5ce||_0x430616['segmentId']};}return{..._0x430616};});_0x2e2b3c[_0x1740ca(0x215)]=_0x1740ca(0x22c),_0x2e2b3c[_0x1740ca(0x242)]=_0x1bbca5,delete _0x2e2b3c['waitStep'],delete _0x2e2b3c[_0x1740ca(0x1e9)],delete _0x2e2b3c[_0x1740ca(0x184)],delete _0x2e2b3c[_0x1740ca(0x1d4)],delete _0x2e2b3c[_0x1740ca(0x219)];}}}function stripPendingIds(_0x5ae406){const _0x2abba3=a152_0x560bf2;_0x5ae406['attributes'][_0x2abba3(0x255)]?.[_0x2abba3(0x19a)]&&isPendingSegmentId(_0x5ae406['attributes'][_0x2abba3(0x255)][_0x2abba3(0x19a)])&&delete _0x5ae406[_0x2abba3(0x1b5)][_0x2abba3(0x255)];for(const _0x4b4dbb of _0x5ae406[_0x2abba3(0x1b5)]['journeyStages']||[]){_0x4b4dbb[_0x2abba3(0x179)]?.[_0x2abba3(0x19a)]&&isPendingSegmentId(_0x4b4dbb['entryCriteria'][_0x2abba3(0x19a)])&&delete _0x4b4dbb[_0x2abba3(0x179)];_0x4b4dbb[_0x2abba3(0x243)]?.[_0x2abba3(0x19a)]&&isPendingSegmentId(_0x4b4dbb['milestone'][_0x2abba3(0x19a)])&&delete _0x4b4dbb[_0x2abba3(0x243)];_0x4b4dbb[_0x2abba3(0x1bb)]&&(_0x4b4dbb[_0x2abba3(0x1bb)]=_0x4b4dbb[_0x2abba3(0x1bb)]['filter'](_0x1ef512=>!_0x1ef512[_0x2abba3(0x19a)]||!isPendingSegmentId(_0x1ef512[_0x2abba3(0x19a)])));if(_0x4b4dbb['steps'])for(const _0x22fc4a of Object[_0x2abba3(0x1d3)](_0x4b4dbb['steps'])){const _0x397408=_0x4b4dbb[_0x2abba3(0x182)][_0x22fc4a];_0x397408[_0x2abba3(0x23d)]===_0x2abba3(0x19b)&&_0x397408[_0x2abba3(0x1d6)]&&isPendingActivationId(_0x397408[_0x2abba3(0x1d6)])&&(_0x397408['journeyActivationStepId']='');if(_0x397408[_0x2abba3(0x23d)]===_0x2abba3(0x190)&&_0x397408[_0x2abba3(0x1ae)])for(const _0x2d339f of _0x397408[_0x2abba3(0x1ae)]){_0x2d339f[_0x2abba3(0x19a)]&&isPendingSegmentId(_0x2d339f[_0x2abba3(0x19a)])&&(_0x2d339f[_0x2abba3(0x19a)]='');}_0x397408[_0x2abba3(0x23d)]===_0x2abba3(0x1d9)&&stripWaitStepPendingIds(_0x397408);}}}function resolvePendingIdsInRequest(_0x573a3a,_0x2804af,_0x1867dc,_0x24cfc7,_0x124a47,_0x3e2548){const _0x86c9a7=a152_0x560bf2,_0x325cba=(_0x246a9d,_0x40cc90)=>{const _0x40eaee=a152_0x46e6;if(!isPendingSegmentId(_0x246a9d))return _0x246a9d;const _0x1a7053=extractPendingSegmentName(_0x246a9d),_0x397d4a=_0x24cfc7[_0x40eaee(0x16b)](_0x1a7053);return!_0x397d4a&&_0x3e2548[_0x40eaee(0x17f)]?.(_0x40eaee(0x183)+_0x1a7053+_0x40eaee(0x1a4)+_0x40cc90),_0x397d4a;};if(_0x573a3a[_0x86c9a7(0x1b5)][_0x86c9a7(0x255)]?.['segmentId']&&isPendingSegmentId(_0x573a3a[_0x86c9a7(0x1b5)][_0x86c9a7(0x255)]['segmentId'])){const _0x320e3e=_0x325cba(_0x573a3a['attributes'][_0x86c9a7(0x255)][_0x86c9a7(0x19a)],_0x86c9a7(0x170));_0x320e3e&&(_0x573a3a[_0x86c9a7(0x1b5)][_0x86c9a7(0x255)]['segmentId']=_0x320e3e);}for(const _0x163afa of _0x573a3a[_0x86c9a7(0x1b5)][_0x86c9a7(0x20b)]||[]){const _0x24055c=_0x1867dc['get'](_0x163afa[_0x86c9a7(0x25b)][_0x86c9a7(0x247)]());_0x24055c&&(_0x163afa['id']=_0x24055c);if(_0x163afa[_0x86c9a7(0x179)]?.[_0x86c9a7(0x19a)]&&isPendingSegmentId(_0x163afa['entryCriteria'][_0x86c9a7(0x19a)])){const _0x2dd0fc=_0x325cba(_0x163afa[_0x86c9a7(0x179)][_0x86c9a7(0x19a)],'stage\x20\x27'+_0x163afa[_0x86c9a7(0x25b)]+_0x86c9a7(0x231));_0x2dd0fc&&(_0x163afa[_0x86c9a7(0x179)][_0x86c9a7(0x19a)]=_0x2dd0fc);}if(_0x163afa[_0x86c9a7(0x1bb)])for(const _0x47c4eb of _0x163afa[_0x86c9a7(0x1bb)]){if(_0x47c4eb[_0x86c9a7(0x19a)]&&isPendingSegmentId(_0x47c4eb['segmentId'])){const _0x5dc16b=_0x325cba(_0x47c4eb['segmentId'],_0x86c9a7(0x20a)+_0x163afa[_0x86c9a7(0x25b)]+'\x27\x20exit\x20criteria');_0x5dc16b&&(_0x47c4eb[_0x86c9a7(0x19a)]=_0x5dc16b);}}if(_0x163afa[_0x86c9a7(0x243)]?.[_0x86c9a7(0x19a)]&&isPendingSegmentId(_0x163afa[_0x86c9a7(0x243)][_0x86c9a7(0x19a)])){const _0x5b300d=_0x325cba(_0x163afa['milestone'][_0x86c9a7(0x19a)],_0x86c9a7(0x20a)+_0x163afa[_0x86c9a7(0x25b)]+'\x27\x20milestone');_0x5b300d&&(_0x163afa['milestone'][_0x86c9a7(0x19a)]=_0x5b300d);}if(_0x163afa[_0x86c9a7(0x182)]){const _0x408d12=_0x4d873b=>_0x2804af[_0x86c9a7(0x1b5)]['journeyStages']?.[_0x86c9a7(0x241)](_0x4a691f=>_0x4a691f['name'][_0x86c9a7(0x247)]()===_0x163afa['name']['toLowerCase']())?.[_0x86c9a7(0x182)]?.[_0x4d873b];for(const _0x19d0e1 of Object[_0x86c9a7(0x1d3)](_0x163afa[_0x86c9a7(0x182)])){const _0x21a5e4=_0x163afa[_0x86c9a7(0x182)][_0x19d0e1],_0x554400=_0x408d12(_0x19d0e1);if(_0x21a5e4[_0x86c9a7(0x23d)]==='Activation'&&_0x21a5e4['journeyActivationStepId']&&(isPendingActivationId(_0x21a5e4['journeyActivationStepId'])||_0x21a5e4[_0x86c9a7(0x1d6)]==='')){if(_0x554400?.[_0x86c9a7(0x1d6)]&&isPendingActivationId(_0x554400['journeyActivationStepId'])){const _0x343c66=extractPendingActivationName(_0x554400[_0x86c9a7(0x1d6)]),_0x1ee70a=_0x124a47['get'](_0x343c66);_0x1ee70a&&(_0x21a5e4[_0x86c9a7(0x1d6)]=_0x1ee70a);}}if(_0x21a5e4[_0x86c9a7(0x23d)]===_0x86c9a7(0x190)&&_0x21a5e4[_0x86c9a7(0x1ae)]&&_0x554400?.['branches'])for(let _0x5d4031=0x0;_0x5d4031<_0x21a5e4['branches'][_0x86c9a7(0x21a)];_0x5d4031++){const _0x1cce45=_0x21a5e4['branches'][_0x5d4031],_0x22e7df=_0x554400[_0x86c9a7(0x1ae)][_0x5d4031];if(_0x22e7df?.['segmentId']&&isPendingSegmentId(_0x22e7df[_0x86c9a7(0x19a)])){const _0x5adc73=_0x325cba(_0x22e7df[_0x86c9a7(0x19a)],_0x86c9a7(0x20a)+_0x163afa[_0x86c9a7(0x25b)]+_0x86c9a7(0x233)+(_0x1cce45['name']||_0x5d4031)+'\x27');_0x5adc73&&(_0x1cce45[_0x86c9a7(0x19a)]=_0x5adc73);}}_0x21a5e4[_0x86c9a7(0x23d)]==='WaitStep'&&_0x554400?.['type']===_0x86c9a7(0x1d9)&&resolveWaitStepPendingIds(_0x21a5e4,_0x554400,_0x325cba,_0x163afa['name']);}}}}
1
+ const a152_0x2f9afb=a152_0x1d0d;(function(_0x50c9f5,_0x3ec34c){const _0x641369=a152_0x1d0d,_0x298281=_0x50c9f5();while(!![]){try{const _0x1288ff=parseInt(_0x641369(0x1a3))/0x1*(-parseInt(_0x641369(0x1f2))/0x2)+-parseInt(_0x641369(0x20a))/0x3+-parseInt(_0x641369(0x134))/0x4+parseInt(_0x641369(0x1ec))/0x5+parseInt(_0x641369(0x161))/0x6+-parseInt(_0x641369(0x1d0))/0x7*(parseInt(_0x641369(0x13b))/0x8)+parseInt(_0x641369(0x131))/0x9;if(_0x1288ff===_0x3ec34c)break;else _0x298281['push'](_0x298281['shift']());}catch(_0x3f56d0){_0x298281['push'](_0x298281['shift']());}}}(a152_0x50cb,0xcade0));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x2f9afb(0x1c1));export const PENDING_SEGMENT_PREFIX=a152_0x2f9afb(0x1df);export const PENDING_ACTIVATION_PREFIX=a152_0x2f9afb(0x1eb);export function createPendingSegmentId(_0x3c99bf){return''+PENDING_SEGMENT_PREFIX+_0x3c99bf+'__';}export function isPendingSegmentId(_0x15ee82){const _0x238e32=a152_0x2f9afb;return _0x15ee82[_0x238e32(0x1e0)](PENDING_SEGMENT_PREFIX)&&!_0x15ee82['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3a3796){const _0x2bcf3d=a152_0x2f9afb;return _0x3a3796[_0x2bcf3d(0x1ed)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x9df540){return''+PENDING_ACTIVATION_PREFIX+_0x9df540+'__';}export function isPendingActivationId(_0xb49e1a){return _0xb49e1a['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x16781b){const _0x4cb3ae=a152_0x2f9afb;return _0x16781b[_0x4cb3ae(0x1ed)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x260814,_0x5d86d8){const _0x33bba4=a152_0x2f9afb,_0x365383=_0x260814+'::'+(_0x5d86d8[_0x33bba4(0x16b)]()||'segment'),_0x827cfc=createHash(_0x33bba4(0x173))['update'](_0x365383)[_0x33bba4(0x1c8)](_0x33bba4(0x1d4))['slice'](0x0,0xc);return _0x33bba4(0x13e)+_0x827cfc;}export function ensureJourneyDefaults(_0x21d78a){const _0x5c1c86=a152_0x2f9afb;!_0x21d78a[_0x5c1c86(0x1a0)]&&(_0x21d78a[_0x5c1c86(0x1a0)]=''),!_0x21d78a[_0x5c1c86(0x14a)]&&(_0x21d78a[_0x5c1c86(0x14a)]='draft');}export function injectExistingStageIds(_0x45756b,_0x41c52a){const _0x4135e3=a152_0x2f9afb,_0x2b8497=new Map(_0x41c52a[_0x4135e3(0x210)](_0x37a8f5=>[_0x37a8f5[_0x4135e3(0x1f9)],_0x37a8f5['id']]));for(const _0x3c15d9 of _0x45756b){if(!_0x3c15d9['id']){const _0x516824=_0x2b8497[_0x4135e3(0x181)](_0x3c15d9['name']);_0x516824&&(_0x3c15d9['id']=_0x516824);}}}export function resolveTDFolderPath(_0x588163,_0xa9e89,_0x122941){if(!_0xa9e89)return _0x588163;if(_0x588163===_0x122941||_0x588163['startsWith'](_0x122941+'/'))return _0x588163;return _0x588163?_0x122941+'/'+_0x588163:_0x122941;}export function addFoldersToCreate(_0x4afe62,_0x3dbd23,_0x4574d1){const _0x2d0dec=a152_0x2f9afb;if(!_0x4afe62)return;if(_0x3dbd23[_0x2d0dec(0x188)](_0x4afe62))return;const _0x15e5a0=_0x4afe62[_0x2d0dec(0x128)]('/');let _0x18e263='';for(const _0x3048f6 of _0x15e5a0){_0x18e263=_0x18e263?_0x18e263+'/'+_0x3048f6:_0x3048f6,!_0x3dbd23[_0x2d0dec(0x188)](_0x18e263)&&_0x4574d1[_0x2d0dec(0x1de)](_0x18e263);}}export function sortFoldersByDepth(_0x52cc54){const _0x42dc8d=a152_0x2f9afb;return[..._0x52cc54][_0x42dc8d(0x11b)]((_0x83eae6,_0x1d60a6)=>{const _0x3afa7e=_0x42dc8d,_0x352517=(_0x83eae6['match'](/\//g)||[])['length'],_0x194c72=(_0x1d60a6[_0x3afa7e(0x127)](/\//g)||[])[_0x3afa7e(0x119)];return _0x352517-_0x194c72;});}import*as a152_0x1e3619 from'yaml';import{readFileSync}from'fs';import a152_0x2ed1f8 from'path';import{isJourneyDef,parseYamlString as a152_0x56dc4d,toYamlString as a152_0x32e295,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(_0xd6d0e1){const _0x2a9e66=a152_0x2f9afb;if(Array[_0x2a9e66(0x113)](_0xd6d0e1))return'['+_0xd6d0e1[_0x2a9e66(0x210)](_0x46f9d1=>stableStringify(_0x46f9d1))['join'](',')+']';if(_0xd6d0e1&&typeof _0xd6d0e1===_0x2a9e66(0x1f5)){const _0x3b61c6=_0xd6d0e1,_0x305259=Object[_0x2a9e66(0x1e8)](_0x3b61c6)[_0x2a9e66(0x11b)](),_0x189b7d=_0x305259[_0x2a9e66(0x210)](_0x310ac1=>'\x22'+_0x310ac1+'\x22:'+stableStringify(_0x3b61c6[_0x310ac1]));return'{'+_0x189b7d[_0x2a9e66(0x19d)](',')+'}';}const _0x27b7c0=JSON['stringify'](_0xd6d0e1);return _0x27b7c0===undefined?_0x2a9e66(0x14f):_0x27b7c0;}function activationSignature(_0x3e264e){const _0x11e8c4=a152_0x2f9afb,_0x2a8ef1={'connection':_0x3e264e['connection'],..._0x3e264e[_0x11e8c4(0x14b)]!==undefined&&{'all_columns':_0x3e264e[_0x11e8c4(0x14b)]},..._0x3e264e[_0x11e8c4(0x15d)]!==undefined&&{'columns':_0x3e264e[_0x11e8c4(0x15d)]},..._0x3e264e[_0x11e8c4(0x1c9)]!==undefined&&{'behavior':_0x3e264e[_0x11e8c4(0x1c9)]},..._0x3e264e['schedule']!==undefined&&{'schedule':_0x3e264e[_0x11e8c4(0x192)]},..._0x3e264e[_0x11e8c4(0x1b8)]!==undefined&&{'notification':_0x3e264e[_0x11e8c4(0x1b8)]},..._0x3e264e[_0x11e8c4(0x1bd)]!==undefined&&{'connector_config':_0x3e264e[_0x11e8c4(0x1bd)]},..._0x3e264e[_0x11e8c4(0x16f)]!==undefined&&{'activation_template_id':_0x3e264e[_0x11e8c4(0x16f)]}};return stableStringify(_0x2a8ef1);}async function fetchSegment(_0x619232,_0x4187c5,_0x414f97,_0x4f768e){const _0x20ce59=a152_0x2f9afb,_0x48aaa5=_0x4f768e?.['find'](_0x54a43e=>_0x54a43e['id']===_0x414f97);if(_0x48aaa5)return _0x48aaa5;try{return await _0x619232[_0x20ce59(0x1a4)][_0x20ce59(0x1e2)](_0x4187c5,_0x414f97);}catch(_0xd56ac1){logger[_0x20ce59(0x190)]('getSegment\x20failed\x20for\x20'+_0x414f97+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0xd56ac1);try{return await _0x619232[_0x20ce59(0x1a4)][_0x20ce59(0x138)](_0x414f97);}catch(_0x1f4145){return logger[_0x20ce59(0x190)](_0x20ce59(0x1d9)+_0x414f97+':\x20'+_0x1f4145),null;}}}function recoverSegmentIdsFromPushRecovery(_0x1f6aea,_0x31dc7a,_0x56148b){const _0x4edb5=a152_0x2f9afb,_0x5347e2=readPushRecovery(_0x1f6aea[_0x4edb5(0x17e)]);if(_0x5347e2?.[_0x4edb5(0x18b)]===_0x1f6aea['yamlConfig']['name'])for(const [_0x1dacff,_0x1350ee]of Object[_0x4edb5(0x1e4)](_0x5347e2['segments'])){const _0x203e8b=generateDeterministicJourneySegmentName(_0x1f6aea[_0x4edb5(0x152)]['name'],_0x1dacff);_0x1350ee[_0x4edb5(0x200)]===_0x203e8b&&(_0x31dc7a['set'](_0x1dacff,_0x1350ee[_0x4edb5(0x216)]),_0x56148b[_0x4edb5(0x1ea)](_0x1dacff,_0x1350ee['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x41c218,_0x2bfbc5,_0x1304aa,_0x490d04){const _0x4a4e6e=a152_0x2f9afb;let _0x43585d;try{_0x43585d=await _0x41c218[_0x4a4e6e(0x1a4)][_0x4a4e6e(0x125)]({'name':_0x1304aa[_0x4a4e6e(0x175)],'description':_0x1304aa[_0x4a4e6e(0x1a0)],'journeyId':_0x1304aa['journeyId'],'rule':_0x490d04(_0x1304aa[_0x4a4e6e(0x14e)],!![]),'countPopulation':!![],'parentFolderId':_0x1304aa['folderId'],'audienceId':_0x1304aa[_0x4a4e6e(0x168)]});}catch(_0x2fc646){const _0x3d71ec=_0x2fc646 instanceof Error&&_0x2fc646[_0x4a4e6e(0x182)]['includes'](_0x4a4e6e(0x156));if(_0x3d71ec){const _0x46db7a=readPushRecovery(_0x2bfbc5[_0x4a4e6e(0x17e)]),_0x5cbfce=_0x46db7a?.[_0x4a4e6e(0x18b)]===_0x2bfbc5[_0x4a4e6e(0x152)][_0x4a4e6e(0x1f9)]?_0x46db7a[_0x4a4e6e(0x199)][_0x1304aa[_0x4a4e6e(0x198)]]:undefined;if(_0x5cbfce?.[_0x4a4e6e(0x200)]===_0x1304aa['uniqueSegmentName'])await _0x41c218[_0x4a4e6e(0x1a4)][_0x4a4e6e(0x13c)](_0x1304aa[_0x4a4e6e(0x168)],_0x5cbfce[_0x4a4e6e(0x216)],{'description':_0x1304aa[_0x4a4e6e(0x1a0)],'rule':_0x490d04(_0x1304aa[_0x4a4e6e(0x14e)],!![]),'countPopulation':!![]}),_0x43585d=_0x5cbfce[_0x4a4e6e(0x216)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x1304aa[_0x4a4e6e(0x198)]+_0x4a4e6e(0x1b2)+(_0x4a4e6e(0x135)+_0x2bfbc5['absolutePath'][_0x4a4e6e(0x1ed)](/([^/]+)$/,_0x4a4e6e(0x1a1))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x2fc646);}else throw _0x2fc646;}return saveSegmentToPushRecovery(_0x2bfbc5[_0x4a4e6e(0x17e)],_0x2bfbc5['yamlConfig'][_0x4a4e6e(0x1f9)],_0x1304aa['localName'],{'segmentId':_0x43585d,'uniqueServerName':_0x1304aa[_0x4a4e6e(0x175)],'createdAt':new Date()['toISOString']()}),_0x43585d;}export async function prepareSegmentFiles(_0x188b1c,_0x10f3e6,_0x2b3e7c,_0x79eb2d,_0x2e37d){const _0x16bed9=a152_0x2f9afb,{activationDefToCreateRequest:_0x4e39a3}=await import(_0x16bed9(0x16a)),_0x41503f=[],_0x4afd89=new Set();for(const {yamlConfig:_0x1bad48,folderPath:_0x365070,sourcePath:_0xd3b9d4}of _0x188b1c){const _0xafd90c=resolveTDFolderPath(_0x365070,_0x79eb2d,_0x2e37d),_0x2030de=_0xafd90c+':'+_0x1bad48[_0x16bed9(0x1f9)],_0x13fdfe=_0x10f3e6['segmentByFolderAndName']['get'](_0x2030de),_0x2c3a75=_0x13fdfe?_0x10f3e6[_0x16bed9(0x118)][_0x16bed9(0x181)](_0x13fdfe['id'])||[]:[];addFoldersToCreate(_0xafd90c,_0x10f3e6['folderPathToId'],_0x4afd89);const _0x174edc=calculateActivationActions(_0x1bad48['activations']||[],_0x2c3a75,_0x10f3e6['idToEmailMap'],_0x10f3e6['connectionIdToNameMap']);for(const _0x2f241c of _0x174edc){(_0x2f241c[_0x16bed9(0x1b0)]===_0x16bed9(0x18e)||_0x2f241c[_0x16bed9(0x1b0)]===_0x16bed9(0x12c))&&_0x2f241c['yamlActivation']&&(_0x2f241c[_0x16bed9(0x164)]=await _0x4e39a3(_0x2f241c[_0x16bed9(0x1ee)],_0x2b3e7c));}const _0x4cc9a0=calculateSegmentDiff(_0x1bad48,_0x13fdfe,_0x2c3a75,_0x10f3e6[_0x16bed9(0x15b)],_0x10f3e6['connectionIdToNameMap']);_0x41503f[_0x16bed9(0x1b4)]({'relativePath':_0x1bad48['name'],'absolutePath':_0xd3b9d4,'yamlConfig':_0x1bad48,'folderPath':_0xafd90c,'existingSegment':_0x13fdfe,'existingActivations':_0x2c3a75,'isNew':_0x4cc9a0[_0x16bed9(0x139)],'hasChanges':_0x4cc9a0[_0x16bed9(0x12e)],'diff':_0x4cc9a0[_0x16bed9(0x1fa)],'activationActions':_0x174edc});}return{'segmentFiles':_0x41503f,'foldersToCreate':_0x4afd89};}export async function prepareJourneyFiles(_0x416bc6,_0x32ece1,_0x5d6909,_0x1d70ea){const _0x4fe112=a152_0x2f9afb,_0x13c689=[],_0x718ea4=new Set();for(const {yamlConfig:_0x16ec45,folderPath:_0x156af2,sourcePath:_0x24a5be}of _0x416bc6){const _0x39bfc8=resolveTDFolderPath(_0x156af2,_0x5d6909,_0x1d70ea),_0x83f79b=_0x39bfc8+':'+_0x16ec45[_0x4fe112(0x1f9)],_0x2cb679=_0x32ece1['journeyBundlesByFolderAndName'][_0x4fe112(0x181)](_0x83f79b);let _0xb05964,_0x5c7311;if(_0x2cb679&&_0x2cb679[_0x4fe112(0x119)]>0x0){const _0x24c0fc=buildLocalExpandedRuleMappings(_0x16ec45),{createYamlContext:_0xc451ae,prefetchJourneySegments:_0x384792}=createPushYamlContextForBundle(_0x32ece1[_0x4fe112(0x183)],_0x32ece1[_0x4fe112(0x168)],_0x32ece1['existingSegments'],_0x24c0fc,_0x32ece1['idToEmailMap'],_0x32ece1[_0x4fe112(0x12a)],_0x32ece1[_0x4fe112(0x197)],_0x32ece1[_0x4fe112(0x1bb)]);await _0x384792(_0x2cb679[_0x4fe112(0x210)](_0x2c7f3e=>_0x2c7f3e['id']));const _0x176686=await _0x32ece1[_0x4fe112(0x183)][_0x4fe112(0x1aa)][_0x4fe112(0x1ca)](_0x2cb679[0x0][_0x4fe112(0x20d)]),_0x381896=hasMultipleVersions(_0x16ec45),_0x54db7d=async _0x4fa57c=>{const _0x172d64=_0x4fe112,_0x4eb42c=_0x32ece1[_0x172d64(0x1bb)]?.[_0x172d64(0x181)](_0x4fa57c);if(_0x4eb42c)return _0x4eb42c;return _0x32ece1[_0x172d64(0x209)]({'journeyId':_0x4fa57c,'journeyName':_0x16ec45[_0x172d64(0x1f9)],'isMultiVersion':_0x2cb679[_0x172d64(0x119)]>0x1});};if(_0x381896&&_0x2cb679[_0x4fe112(0x119)]>0x1){const _0x794731=[];for(const _0x47cba3 of _0x2cb679){const _0x1592de=_0x47cba3[_0x4fe112(0x1ef)]||0x1;_0x32ece1[_0x4fe112(0x146)]?.[_0x4fe112(0x12c)]('Fetching\x20'+_0x16ec45['name']+'\x20v'+_0x1592de);const _0x46c570=await _0x54db7d(_0x47cba3['id']),_0x1ecb6c=_0xc451ae(_0x47cba3['id']),_0x1f3aa9=await journeyResponseToDef(_0x46c570,_0x1ecb6c);_0x794731[_0x4fe112(0x1b4)]({'item':_0x47cba3,'yaml':_0x1f3aa9});}const _0x4c81a4=buildLocalRuleToNameMappingFromJourney(_0x16ec45);_0x5c7311=buildMergedJourneyDef(_0x794731,_0x4c81a4,_0x176686);const _0x55c1ec=Math[_0x4fe112(0x1e5)](..._0x794731[_0x4fe112(0x210)](_0x54c0d6=>_0x54c0d6[_0x4fe112(0x126)][_0x4fe112(0x1ef)]||0x0)),_0x5f58aa=_0x2cb679[_0x4fe112(0x20e)](_0x1c22b8=>(_0x1c22b8[_0x4fe112(0x1ef)]||0x0)===_0x55c1ec);_0x5f58aa&&(_0x32ece1[_0x4fe112(0x146)]?.['update']('Fetching\x20'+_0x16ec45[_0x4fe112(0x1f9)]+'\x20v'+_0x55c1ec),_0xb05964=await _0x54db7d(_0x5f58aa['id']));}else{const _0x285672=_0x2cb679[_0x2cb679[_0x4fe112(0x119)]-0x1];_0x32ece1[_0x4fe112(0x146)]?.[_0x4fe112(0x12c)](_0x4fe112(0x195)+_0x16ec45[_0x4fe112(0x1f9)]),_0xb05964=await _0x54db7d(_0x285672['id']);const _0x183f63=_0xc451ae(_0x285672['id']),_0x3a1093=await journeyResponseToDef(_0xb05964,_0x183f63),_0xdba473=buildLocalRuleToNameMappingFromJourney(_0x16ec45);_0x5c7311=buildMergedJourneyDef([{'item':_0x285672,'yaml':_0x3a1093}],_0xdba473,_0x176686);}}addFoldersToCreate(_0x39bfc8,_0x32ece1[_0x4fe112(0x1f6)],_0x718ea4);const _0x31f484=calculateJourneyDiff(_0x16ec45,_0x5c7311);_0x13c689[_0x4fe112(0x1b4)]({'relativePath':_0x16ec45['name'],'absolutePath':_0x24a5be,'yamlConfig':_0x16ec45,'folderPath':_0x39bfc8,'existingJourney':_0xb05964,'isNew':_0x31f484[_0x4fe112(0x139)],'hasChanges':_0x31f484[_0x4fe112(0x12e)],'diff':_0x31f484[_0x4fe112(0x1fa)]});}return{'journeyFiles':_0x13c689,'foldersToCreate':_0x718ea4};}export function calculateActivationActions(_0x34898e,_0x446865,_0x2a70be,_0xbf9648){const _0x180002=a152_0x2f9afb,_0x4e4469=[],_0x11cc2a=new Map();for(const _0x2ce9ca of _0x446865){_0x11cc2a['set'](_0x2ce9ca['name'],_0x2ce9ca);}const _0x5a32e5=new Map();for(const _0x123b55 of _0x34898e){_0x5a32e5['set'](_0x123b55[_0x180002(0x1f9)],_0x123b55);}for(const _0xc16c1b of _0x34898e){const _0x2edd09=_0x11cc2a[_0x180002(0x181)](_0xc16c1b[_0x180002(0x1f9)]);if(!_0x2edd09)_0x4e4469['push']({'type':_0x180002(0x18e),'name':_0xc16c1b[_0x180002(0x1f9)],'yamlActivation':_0xc16c1b});else{const _0x2c2ecc=activationResponseToDef(_0x2edd09,_0x2a70be,_0xbf9648),_0x211919=a152_0x1e3619['stringify'](_0x2c2ecc),_0x30ee8d=a152_0x1e3619[_0x180002(0x178)](_0xc16c1b);_0x211919!==_0x30ee8d&&_0x4e4469['push']({'type':_0x180002(0x12c),'name':_0xc16c1b[_0x180002(0x1f9)],'yamlActivation':_0xc16c1b,'existingActivation':_0x2edd09});}}for(const _0x99ccb8 of _0x446865){!_0x5a32e5[_0x180002(0x188)](_0x99ccb8[_0x180002(0x1f9)])&&_0x4e4469[_0x180002(0x1b4)]({'type':_0x180002(0x193),'name':_0x99ccb8[_0x180002(0x1f9)],'existingActivation':_0x99ccb8});}return _0x4e4469;}function calculateYamlDiff(_0x3540d7,_0x304787){if(_0x304787){const _0x2c36ca=generateDiff(_0x304787,_0x3540d7),_0x10428c=hasChanges(_0x2c36ca);return{'isNew':![],'hasChanges':_0x10428c,'diff':_0x10428c?formatDiffWithColors(_0x2c36ca):undefined};}const _0x406c95=generateDiff('',_0x3540d7);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x406c95)};}export function calculateSegmentDiff(_0x503f01,_0x42fb60,_0x407a32,_0xb69df3,_0x3ad224){const _0x2fc15c=segmentToYamlString(_0x503f01),_0x3cf071=_0x42fb60?segmentToYamlString(segmentWithActivationsToYaml(_0x42fb60,_0x407a32,undefined,_0xb69df3,_0x3ad224)):undefined;return calculateYamlDiff(_0x2fc15c,_0x3cf071);}export function calculateJourneyDiff(_0x1d9bfb,_0xcbbcb1){const _0x546f00=normalizeJourneyDef(_0x1d9bfb,_0x1d9bfb),_0x3b3287=a152_0x32e295(_0x546f00),_0x282780=_0xcbbcb1?a152_0x32e295(normalizeJourneyDef(_0xcbbcb1,_0x1d9bfb)):undefined;return calculateYamlDiff(_0x3b3287,_0x282780);}export function findSegmentsToDelete(_0x586d06,_0x58f080,_0x5a36fe,_0x3f1f87,_0x7fac31){const _0xaaf120=a152_0x2f9afb,_0x4faecf=new Set();for(const {yamlConfig:_0x491c4e,folderPath:_0x5d5c25}of _0x58f080){_0x4faecf[_0xaaf120(0x1de)](_0x5d5c25+':'+_0x491c4e[_0xaaf120(0x1f9)]);}return _0x586d06[_0xaaf120(0x15e)](_0x1b0216=>{const _0x259b61=_0xaaf120,_0x5b0ea6=_0x1b0216[_0x259b61(0x21a)]?_0x5a36fe[_0x259b61(0x181)](_0x1b0216[_0x259b61(0x21a)][_0x259b61(0x11e)]())||'':'',_0xfb0751=_0x5b0ea6+':'+_0x1b0216[_0x259b61(0x1f9)];if(_0x4faecf['has'](_0xfb0751))return![];if(_0x7fac31)return _0x5b0ea6===_0x3f1f87||_0x5b0ea6[_0x259b61(0x1e0)](_0x3f1f87+'/');return!![];});}export function findJourneysToDelete(_0x2ddcf5,_0x414a10,_0x18f7e9,_0x141744,_0x2420fd){const _0x3d0120=a152_0x2f9afb,_0x21fdc8=new Set();for(const {yamlConfig:_0x21be20,folderPath:_0x4e358f}of _0x414a10){_0x21fdc8['add'](_0x4e358f+':'+_0x21be20[_0x3d0120(0x1f9)]);}return _0x2ddcf5[_0x3d0120(0x15e)](_0x3b6494=>{const _0x839199=_0x3d0120,_0xb47e43=_0x3b6494['folderId']?_0x18f7e9[_0x839199(0x181)](_0x3b6494[_0x839199(0x1f1)])||'':'',_0x5ab170=_0xb47e43+':'+_0x3b6494[_0x839199(0x1a9)];if(_0x21fdc8[_0x839199(0x188)](_0x5ab170))return![];if(_0x2420fd)return _0xb47e43===_0x141744||_0xb47e43[_0x839199(0x1e0)](_0x141744+'/');return!![];});}export function buildSegmentLookupMap(_0x445b79,_0x42fb81){const _0x3a1d33=a152_0x2f9afb,_0x360b8c=new Map();for(const _0x319927 of _0x445b79){const _0x4bf092=_0x319927['segmentFolderId']?_0x42fb81[_0x3a1d33(0x181)](_0x319927[_0x3a1d33(0x21a)][_0x3a1d33(0x11e)]())||'':'',_0x4b05e2=_0x4bf092+':'+_0x319927['name'];_0x360b8c[_0x3a1d33(0x1ea)](_0x4b05e2,_0x319927);}return _0x360b8c;}export function buildSegmentNameToIdMap(_0x47719a){const _0x191a62=a152_0x2f9afb,_0x44afcb=new Map();for(const _0x3f780a of _0x47719a){_0x44afcb[_0x191a62(0x1ea)](_0x3f780a['name'],_0x3f780a['id']);}return _0x44afcb;}export function buildJourneyBundleLookupMap(_0x33647b,_0x2345fe){const _0x5afad6=a152_0x2f9afb,_0x314643=new Map();for(const _0x2fbdb of _0x33647b){const _0x7ba7b5=_0x2fbdb[_0x5afad6(0x1f1)]?_0x2345fe['get'](_0x2fbdb[_0x5afad6(0x1f1)])||'':'',_0x53e884=_0x7ba7b5+':'+_0x2fbdb[_0x5afad6(0x1a9)];!_0x314643[_0x5afad6(0x188)](_0x53e884)&&_0x314643[_0x5afad6(0x1ea)](_0x53e884,[]),_0x314643[_0x5afad6(0x181)](_0x53e884)[_0x5afad6(0x1b4)](_0x2fbdb);}for(const _0x48e59c of _0x314643['values']()){_0x48e59c[_0x5afad6(0x11b)]((_0x14cbfb,_0x5cfe1e)=>(_0x14cbfb[_0x5afad6(0x1ef)]||0x0)-(_0x5cfe1e[_0x5afad6(0x1ef)]||0x0));}return _0x314643;}export function collectFoldersToCreate(_0x4d6f84,_0xe4f33b){const _0x5776bf=a152_0x2f9afb,_0x2eeaac=new Set();for(const _0x1b7769 of _0x4d6f84){if(!_0x1b7769)continue;if(_0xe4f33b['has'](_0x1b7769))continue;const _0x10fcaa=_0x1b7769['split']('/');let _0xc24126='';for(const _0x4d5f9a of _0x10fcaa){_0xc24126=_0xc24126?_0xc24126+'/'+_0x4d5f9a:_0x4d5f9a,!_0xe4f33b[_0x5776bf(0x188)](_0xc24126)&&_0x2eeaac['add'](_0xc24126);}}return _0x2eeaac;}export function parseAndClassifyYamlFiles(_0x2027e1,_0x3ffbc3,_0x3edd5c){const _0x29dc00=a152_0x2f9afb,_0x3a788c=[],_0x7fc4a3=[];for(const _0x44f5d2 of _0x2027e1){const _0xae485a=a152_0x2ed1f8[_0x29dc00(0x18a)](_0x3ffbc3,a152_0x2ed1f8[_0x29dc00(0x1dc)](_0x44f5d2)),_0x160bdd=_0xae485a==='.'?'':_0xae485a[_0x29dc00(0x1ed)](/\\/g,'/'),_0x546cf1=readFileSync(_0x44f5d2,'utf-8'),_0x26a729=a152_0x1e3619['parse'](_0x546cf1);if(isJourneyDef(_0x26a729)){const _0x8af0ef=a152_0x56dc4d(_0x546cf1);_0x7fc4a3[_0x29dc00(0x1b4)]({'yamlConfig':_0x8af0ef,'folderPath':_0x160bdd,'sourcePath':_0x44f5d2});}else{if(!_0x3edd5c?.[_0x29dc00(0x205)]){const _0x116132=parseSegmentYamlFile(_0x546cf1),_0x20699a=normalizeChildSegmentYaml(_0x116132);_0x3a788c[_0x29dc00(0x1b4)]({'yamlConfig':_0x20699a,'folderPath':_0x160bdd,'sourcePath':_0x44f5d2});}}}return{'segments':_0x3a788c,'journeys':_0x7fc4a3};}export function validateParsedFiles(_0x35d90a,_0x1705ea){const _0x3a67c5=a152_0x2f9afb,_0x2fdf13=[];for(const {yamlConfig:_0x318429,sourcePath:_0x3636c4}of _0x35d90a[_0x3a67c5(0x199)]){const _0x43af9f=readFileSync(_0x3636c4,_0x3a67c5(0x16d)),_0xb5d750=a152_0x1e3619[_0x3a67c5(0x14d)](_0x43af9f),_0x3e59b5=validateSegmentDef(_0x318429,{'source':_0x43af9f,'document':_0xb5d750},{'skipSchema':!![]});if(!_0x3e59b5[_0x3a67c5(0x16c)]){const _0x484ffd=a152_0x2ed1f8['relative'](_0x1705ea,_0x3636c4);_0x2fdf13[_0x3a67c5(0x1b4)]({'filePath':_0x484ffd,'source':_0x43af9f,'result':_0x3e59b5,'isJourney':![]});}}for(const {yamlConfig:_0x4dc406,sourcePath:_0x2ac212}of _0x35d90a[_0x3a67c5(0x143)]){const _0x5a4394=readFileSync(_0x2ac212,_0x3a67c5(0x16d)),_0x424c24=a152_0x1e3619[_0x3a67c5(0x14d)](_0x5a4394),_0x22ef13=validateJourneyDef(_0x4dc406,{'source':_0x5a4394,'document':_0x424c24},{'skipSchema':!![]});if(!_0x22ef13['valid']){const _0x57f1cc=a152_0x2ed1f8[_0x3a67c5(0x18a)](_0x1705ea,_0x2ac212);_0x2fdf13['push']({'filePath':_0x57f1cc,'source':_0x5a4394,'result':_0x22ef13,'isJourney':!![]});}}return _0x2fdf13;}export function formatValidationErrors(_0x2a7256){const _0x5ce583=a152_0x2f9afb,_0x5966cb=[];for(const {filePath:_0xcb6ce8,source:_0x335cab,result:_0x404cdc,isJourney:_0x1bd05b}of _0x2a7256){const _0x42adb9=_0x1bd05b?_0x5ce583(0x1aa):_0x5ce583(0x1a4);_0x5966cb[_0x5ce583(0x1b4)]('\x0a'+_0xcb6ce8+'\x20('+_0x42adb9+_0x5ce583(0x172)+_0x404cdc[_0x5ce583(0x129)][_0x5ce583(0x119)]+_0x5ce583(0x160)),_0x5966cb['push'](formatValidationResult(_0x404cdc,_0x335cab,_0xcb6ce8));}return _0x5966cb[_0x5ce583(0x19d)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x2942b0){const _0x23ef91=a152_0x2f9afb,_0x4300bb=new Set(),_0x36a86c=new Map(),_0x42f29f=collectSegmentUsageCounts(_0x2942b0);if(_0x2942b0[_0x23ef91(0x199)])for(const [_0x414ea6,_0x6541af]of Object[_0x23ef91(0x1e4)](_0x2942b0[_0x23ef91(0x199)])){_0x4300bb[_0x23ef91(0x1de)](_0x414ea6);if(_0x6541af[_0x23ef91(0x1c6)]){const _0x181210=yamlRuleToApi(_0x6541af[_0x23ef91(0x1c6)]),_0x388a0d=apiRuleToYaml(_0x181210);_0x36a86c['set'](_0x414ea6,_0x388a0d);}}const _0x20e618=new Map();let _0x105088=0x0;for(const [_0x1ea52e,_0x19de30]of _0x36a86c){const _0x24b23c=serializeExpandedRule(_0x19de30,_0x36a86c),_0x3c24a5=_0x20e618[_0x23ef91(0x181)](_0x24b23c)||[];_0x3c24a5[_0x23ef91(0x1b4)]({'name':_0x1ea52e,'index':_0x105088}),_0x20e618[_0x23ef91(0x1ea)](_0x24b23c,_0x3c24a5),_0x105088++;}const _0x1fa7a3=new Map();for(const [_0x272289,_0x401f2a]of _0x20e618){const _0x2d23d8=_0x401f2a[_0x23ef91(0x191)]()[_0x23ef91(0x11b)]((_0x4e333b,_0xc2a812)=>{const _0x326801=_0x23ef91,_0x18ab0f=_0x42f29f[_0x326801(0x181)](_0x4e333b['name'])||0x0,_0x49657=_0x42f29f[_0x326801(0x181)](_0xc2a812[_0x326801(0x1f9)])||0x0;if(_0x18ab0f!==_0x49657)return _0x49657-_0x18ab0f;return _0x4e333b['index']-_0xc2a812['index'];})[_0x23ef91(0x210)](_0xc1878=>_0xc1878[_0x23ef91(0x1f9)]),_0x323e6f=[];for(const _0x1f8052 of _0x2d23d8){const _0x133f54=_0x42f29f[_0x23ef91(0x181)](_0x1f8052)||0x0,_0x20d983=Math['max'](_0x133f54,0x1);for(let _0x4208bf=0x0;_0x4208bf<_0x20d983;_0x4208bf++){_0x323e6f['push'](_0x1f8052);}}_0x1fa7a3[_0x23ef91(0x1ea)](_0x272289,_0x323e6f);}return{'existingLocalSegmentNames':_0x4300bb,'localSegmentRules':_0x36a86c,'localExpandedRuleToNames':_0x1fa7a3};}export function createSegmentIdResolver(_0x52dcfa,_0x720009){return async _0x3b2682=>{const _0x3598b3=a152_0x1d0d,_0x16e3d7=_0x52dcfa['get'](_0x3b2682);if(!_0x16e3d7)throw new SDKError(ErrorCode[_0x3598b3(0x186)],_0x3598b3(0x1e6)+_0x3b2682+_0x3598b3(0x1f7)+_0x720009+'\x27)');return _0x16e3d7;};}export function extractRootFolderId(_0x32d787){const _0x42d853=a152_0x2f9afb;return _0x32d787['relationships']?.[_0x42d853(0x158)]?.['data']?.['id']||_0x32d787['relationships']?.[_0x42d853(0x1c2)]?.[_0x42d853(0x1da)]?.['id'];}export function buildConnectionMaps(_0x2ee43d){const _0x15e8d5=a152_0x2f9afb,_0x14099e=new Map(),_0x2258fa=new Map(),_0x5915d4=new Map();for(const _0xeb4ad3 of _0x2ee43d){_0x14099e['set'](_0xeb4ad3['name'],parseInt(_0xeb4ad3['id'],0xa)),_0x2258fa[_0x15e8d5(0x1ea)](_0xeb4ad3['id'],_0xeb4ad3[_0x15e8d5(0x1f9)]),_0x5915d4[_0x15e8d5(0x1ea)](_0xeb4ad3[_0x15e8d5(0x1f9)],_0xeb4ad3[_0x15e8d5(0x1b0)]);}return{'nameToId':_0x14099e,'idToName':_0x2258fa,'nameToType':_0x5915d4};}function a152_0x1d0d(_0x554146,_0x396267){_0x554146=_0x554146-0x112;const _0x50cb8a=a152_0x50cb();let _0x1d0d9b=_0x50cb8a[_0x554146];return _0x1d0d9b;}export function calculatePushStats(_0x5409a0,_0x2d76ee,_0x3f5296,_0x3a4294,_0x306245,_0x347f81,_0x26100c){const _0x1dc102=a152_0x2f9afb,_0x4d1e6a=_0x5409a0[_0x1dc102(0x15e)](_0xf64c6e=>_0xf64c6e['isNew']),_0x5f219c=_0x5409a0['filter'](_0x2e1f87=>!_0x2e1f87[_0x1dc102(0x139)]&&_0x2e1f87[_0x1dc102(0x12e)]),_0x1645f6=_0x5409a0[_0x1dc102(0x15e)](_0x3b7186=>!_0x3b7186['isNew']&&!_0x3b7186[_0x1dc102(0x12e)]),_0x1d2e22=_0x347f81?_0x3a4294:[],_0x2d3884=_0x2d76ee[_0x1dc102(0x15e)](_0x479b01=>_0x479b01[_0x1dc102(0x139)]),_0x5c0e13=_0x2d76ee[_0x1dc102(0x15e)](_0x3f30a7=>!_0x3f30a7[_0x1dc102(0x139)]&&_0x3f30a7[_0x1dc102(0x12e)]),_0xaa790c=_0x2d76ee[_0x1dc102(0x15e)](_0x1b03ef=>!_0x1b03ef[_0x1dc102(0x139)]&&!_0x1b03ef[_0x1dc102(0x12e)]),_0x1bd734=_0x347f81?_0x306245:[],_0x46d661=_0x5409a0['flatMap'](_0x24d841=>_0x24d841[_0x1dc102(0x1b5)]),_0x6bd1c1=_0x46d661[_0x1dc102(0x15e)](_0x5ce4c7=>_0x5ce4c7['type']===_0x1dc102(0x18e)),_0x19e24f=_0x46d661[_0x1dc102(0x15e)](_0x289d7b=>_0x289d7b[_0x1dc102(0x1b0)]===_0x1dc102(0x12c)),_0x30e484=_0x46d661[_0x1dc102(0x15e)](_0x3bf1dd=>_0x3bf1dd['type']===_0x1dc102(0x193)),_0x399151=Array[_0x1dc102(0x112)](_0x3f5296)[_0x1dc102(0x11b)](),_0x1ea571=_0x26100c?![]:_0x4d1e6a[_0x1dc102(0x119)]>0x0||_0x5f219c['length']>0x0||_0x1d2e22[_0x1dc102(0x119)]>0x0,_0x40c645=_0x2d3884['length']>0x0||_0x5c0e13['length']>0x0||_0x1bd734[_0x1dc102(0x119)]>0x0,_0x40ef96=_0x26100c?![]:_0x46d661[_0x1dc102(0x119)]>0x0,_0x31bda8=_0x399151[_0x1dc102(0x119)]>0x0;return{'segments':{'new':_0x4d1e6a,'changed':_0x5f219c,'unchanged':_0x1645f6,'toDelete':_0x1d2e22},'journeys':{'new':_0x2d3884,'changed':_0x5c0e13,'unchanged':_0xaa790c,'toDelete':_0x1bd734},'activations':{'all':_0x46d661,'toCreate':_0x6bd1c1,'toUpdate':_0x19e24f,'toDelete':_0x30e484},'folders':{'toCreate':_0x399151},'counts':{'segments':{'new':_0x4d1e6a[_0x1dc102(0x119)],'changed':_0x5f219c[_0x1dc102(0x119)],'unchanged':_0x1645f6[_0x1dc102(0x119)],'toDelete':_0x1d2e22[_0x1dc102(0x119)]},'journeys':{'new':_0x2d3884['length'],'changed':_0x5c0e13['length'],'unchanged':_0xaa790c[_0x1dc102(0x119)],'toDelete':_0x1bd734['length']},'activations':{'create':_0x6bd1c1['length'],'update':_0x19e24f['length'],'delete':_0x30e484[_0x1dc102(0x119)]},'folders':_0x399151[_0x1dc102(0x119)]},'hasChanges':_0x1ea571||_0x40c645||_0x40ef96||_0x31bda8};}export async function buildPushExecutionContext(_0x3ab3fe,_0x3a1f33,_0x28aaca,_0x192aea,_0x2fc54d,_0x2be2ee){const _0x1db585=a152_0x2f9afb,_0x1ccd73=extractRootFolderId(_0x28aaca),{pathToId:_0x52f8a1,idToPath:_0x31dca4}=buildFolderMaps(_0x2fc54d),_0x553a28=buildSegmentNameToIdMap(_0x192aea),_0x1189fd=new Map(),{batchAsync:_0x462181}=await import(_0x1db585(0x1ff)),[_0x1392f5,_0x36dbcd]=await Promise[_0x1db585(0x1cf)]([_0x3ab3fe[_0x1db585(0x1ce)][_0x1db585(0x19a)](),_0x3ab3fe[_0x1db585(0x1d3)][_0x1db585(0x179)](),((async()=>{const _0x2cdee9=_0x1db585;!_0x2be2ee&&_0x192aea[_0x2cdee9(0x119)]>0x0&&await _0x462181(_0x192aea,async _0x41cce9=>{const _0x4466ed=_0x2cdee9,_0x2062d1=await _0x3ab3fe['segment'][_0x4466ed(0x18c)](_0x3a1f33,_0x41cce9['id']);_0x1189fd[_0x4466ed(0x1ea)](_0x41cce9['id'],_0x2062d1);});})())]),{emailToId:_0x7ee083,idToEmail:_0x2fd701}=_0x1392f5,_0x9e2b9d=buildConnectionMaps(_0x36dbcd);return{'rootFolderId':_0x1ccd73,'folderPathToId':_0x52f8a1,'folderIdToPath':_0x31dca4,'segmentNameToId':_0x553a28,'activationsBySegmentId':_0x1189fd,'emailToIdMap':_0x7ee083,'idToEmailMap':_0x2fd701,'connectionNameToIdMap':_0x9e2b9d[_0x1db585(0x185)],'connectionIdToNameMap':_0x9e2b9d[_0x1db585(0x1fe)],'connectionNameToTypeMap':_0x9e2b9d[_0x1db585(0x17c)]};}export function createPushYamlContextForBundle(_0x1bd53e,_0x2fe391,_0x11b2c4,_0x1e60d1,_0x4920a9,_0x263077,_0x21c5c4,_0x362b3f){const {existingLocalSegmentNames:_0x18d869,localExpandedRuleToNames:_0x5db9c6}=_0x1e60d1,_0x1ef1b8=new Set(),_0x3b1949=new Map(),_0x492273=new Map(),_0x55962c=new Map(),_0x2e3112=createJumpTargetCache(),_0x17c66a=new Map(),_0xad7c03=new Map(),_0x3fca02=new Set();let _0x214058;const _0x382dab=_0xb67f47=>{const _0x19393e={'resolveSegment':async _0x23d234=>{const _0x58b44a=a152_0x1d0d,_0x5ca157=_0x55962c[_0x58b44a(0x181)](_0x23d234);if(_0x5ca157!==undefined)return{'name':_0x5ca157,'isJourneyLocal':!![]};try{const _0x2eb1fa=await fetchSegment(_0x1bd53e,_0x2fe391,_0x23d234,_0x11b2c4);if(!_0x2eb1fa)throw new Error(_0x58b44a(0x1d8));const _0xce22f8=generateJourneyLocalName(_0x2eb1fa[_0x58b44a(0x1f9)]),_0x22ebad=_0x2eb1fa[_0x58b44a(0x12d)]===SEGMENT_KIND_JOURNEY&&_0xce22f8!==undefined;let _0x29e95e=_0x2eb1fa[_0x58b44a(0x1f9)],_0x1dfa0c;if(_0x22ebad&&_0x2eb1fa[_0x58b44a(0x1c6)]){const _0x15e8e5=apiRuleToYaml(_0x2eb1fa[_0x58b44a(0x1c6)]);_0xad7c03[_0x58b44a(0x1ea)](_0x23d234,_0x15e8e5);const _0x31054a=async _0x5976ad=>{const _0x2f8a08=_0x58b44a,_0x3ae43c=collectSegmentRefsFromRule(_0x5976ad);for(const _0xeefbca of _0x3ae43c){if(!_0xad7c03[_0x2f8a08(0x188)](_0xeefbca))try{const _0x30edc5=await fetchSegment(_0x1bd53e,_0x2fe391,_0xeefbca,_0x11b2c4);if(_0x30edc5?.['rule']){const _0x3a66b6=apiRuleToYaml(_0x30edc5[_0x2f8a08(0x1c6)]);_0xad7c03[_0x2f8a08(0x1ea)](_0xeefbca,_0x3a66b6),await _0x31054a(_0x3a66b6);}}catch(_0x3cbb55){logger['debug'](_0x2f8a08(0x1af)+_0xeefbca+':\x20'+_0x3cbb55);}}};await _0x31054a(_0x15e8e5);const _0x24d8d7=serializeExpandedRule(_0x15e8e5,_0xad7c03),_0x3a5ed7=_0x5db9c6[_0x58b44a(0x181)](_0x24d8d7);if(_0x3a5ed7&&_0x3a5ed7[_0x58b44a(0x119)]>0x0){const _0x4b2a01=_0x3b1949['get'](_0x24d8d7)||0x0,_0x1b225c=_0x3a5ed7[_0x4b2a01]||_0x3a5ed7[_0x3a5ed7['length']-0x1];_0x3b1949['set'](_0x24d8d7,_0x4b2a01+0x1),_0x29e95e=_0x1b225c,_0x1ef1b8[_0x58b44a(0x1de)](_0x29e95e),_0x55962c[_0x58b44a(0x1ea)](_0x23d234,_0x29e95e);const _0x40e528=await resolveRuleSegmentRefs(_0x15e8e5,async _0x18ff0a=>{const _0x1d3f47=_0x58b44a,_0x299d6b=_0x55962c[_0x1d3f47(0x181)](_0x18ff0a);if(_0x299d6b)return _0x299d6b;const _0x1731da=await _0x214058[_0x1d3f47(0x154)](_0x18ff0a);return _0x1731da[_0x1d3f47(0x1f9)];});_0x1dfa0c={'description':_0x2eb1fa[_0x58b44a(0x1a0)],'rule':_0x40e528};}else{const _0x27f8f5=_0x17c66a[_0x58b44a(0x181)](_0x24d8d7);if(_0x27f8f5)_0x29e95e=_0x27f8f5,_0x55962c[_0x58b44a(0x1ea)](_0x23d234,_0x29e95e);else{if(_0xce22f8){let _0x318c24=_0xce22f8,_0x3d272e=0x2;while(_0x1ef1b8[_0x58b44a(0x188)](_0x318c24)||_0x18d869[_0x58b44a(0x188)](_0x318c24)){_0x318c24=_0xce22f8+'_'+_0x3d272e,_0x3d272e++;}_0x1ef1b8[_0x58b44a(0x1de)](_0x318c24),_0x29e95e=_0x318c24;}_0x55962c[_0x58b44a(0x1ea)](_0x23d234,_0x29e95e),_0x17c66a['set'](_0x24d8d7,_0x29e95e);const _0x1cb405=await resolveRuleSegmentRefs(_0x15e8e5,async _0x49c44a=>{const _0x5c8911=_0x58b44a,_0x35c7d4=_0x55962c[_0x5c8911(0x181)](_0x49c44a);if(_0x35c7d4)return _0x35c7d4;const _0x59246a=await _0x214058[_0x5c8911(0x154)](_0x49c44a);return _0x59246a[_0x5c8911(0x1f9)];});_0x1dfa0c={'description':_0x2eb1fa[_0x58b44a(0x1a0)],'rule':_0x1cb405};}}}return{'name':_0x29e95e,'isJourneyLocal':_0x22ebad,'definition':_0x1dfa0c};}catch(_0x431c80){return logger['debug'](_0x58b44a(0x1d5)+_0x23d234+':\x20'+_0x431c80),{'name':_0x23d234,'isJourneyLocal':![]};}},'resolveActivation':async _0x3361d5=>{const _0x246bcc=a152_0x1d0d,_0x40862a=_0x492273[_0x246bcc(0x181)](_0x3361d5);if(_0x40862a!==undefined)return{'name':_0x40862a,'isJourneyLocal':!![]};try{let _0x2a1a72=_0x21c5c4?.['get'](_0x3361d5);!_0x2a1a72&&(_0x2a1a72=await _0x1bd53e[_0x246bcc(0x1aa)][_0x246bcc(0x1cc)](_0xb67f47,_0x3361d5));const _0x36d62f=_0x2a1a72[_0x246bcc(0x20f)][_0x246bcc(0x20c)][_0x246bcc(0x1f9)]||_0x3361d5,_0x1e3cf6=sanitizeYamlKey(_0x36d62f)||_0x246bcc(0x1cb)+_0x3361d5,_0x1a46c7=_0x1e3cf6;_0x492273[_0x246bcc(0x1ea)](_0x3361d5,_0x1a46c7);const _0x3f5452=journeyActivationStepToYaml(_0x2a1a72,_0x4920a9,_0x263077);return{'name':_0x1a46c7,'isJourneyLocal':!![],'definition':_0x3f5452};}catch(_0x2defcb){return logger[_0x246bcc(0x190)](_0x246bcc(0x219)+_0x3361d5+':\x20'+_0x2defcb),{'name':_0x3361d5,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5b722c,_0x535c35)=>resolveJumpTarget(_0x5b722c,_0x535c35,_0x2e3112,async _0x227875=>{const _0x118b3d=a152_0x1d0d,_0x5e24e4=_0x362b3f?.[_0x118b3d(0x181)](_0x227875);if(_0x5e24e4)return _0x5e24e4;return _0x1bd53e[_0x118b3d(0x1aa)]['getJourney'](_0x227875);})};return _0x214058=_0x19393e,_0x19393e;},_0x2b4e19=async _0x2fa17b=>{const _0x32c787=a152_0x1d0d,{collectSegmentIdsFromJourneyApi:_0x50ba5e}=await import(_0x32c787(0x203)),{batchAsync:_0x1c6003}=await import(_0x32c787(0x1ff)),_0x1b9f60=new Set();for(const _0x539832 of _0x2fa17b){let _0x3d900d=_0x362b3f?.[_0x32c787(0x181)](_0x539832);!_0x3d900d&&(_0x3d900d=await _0x1bd53e[_0x32c787(0x1aa)][_0x32c787(0x17d)](_0x539832));const _0x20cb3c=_0x50ba5e(_0x3d900d);for(const _0x39e554 of _0x20cb3c){_0x1b9f60[_0x32c787(0x1de)](_0x39e554);}}let _0x42065c=Array['from'](_0x1b9f60);while(_0x42065c[_0x32c787(0x119)]>0x0){const _0x3aff10=_0x42065c[_0x32c787(0x15e)](_0xb5705f=>!_0x3fca02[_0x32c787(0x188)](_0xb5705f));if(_0x3aff10[_0x32c787(0x119)]===0x0)break;const _0x163e7a=await _0x1c6003(_0x3aff10,async _0x4e842c=>{const _0x36b9d5=_0x32c787;_0x3fca02[_0x36b9d5(0x1de)](_0x4e842c);const _0x5e2b59=await fetchSegment(_0x1bd53e,_0x2fe391,_0x4e842c,_0x11b2c4);if(!_0x5e2b59)return null;return{'segmentId':_0x4e842c,'segment':_0x5e2b59};},0xa),_0x108b59=new Set();for(const _0xa6a73c of _0x163e7a){if(!_0xa6a73c?.[_0x32c787(0x1a4)]?.['rule'])continue;const _0x475023=apiRuleToYaml(_0xa6a73c[_0x32c787(0x1a4)][_0x32c787(0x1c6)]);_0xad7c03[_0x32c787(0x1ea)](_0xa6a73c[_0x32c787(0x216)],_0x475023);const _0xbdbef6=collectSegmentRefsFromRule(_0x475023);for(const _0x5a096a of _0xbdbef6){!_0x3fca02[_0x32c787(0x188)](_0x5a096a)&&_0x108b59[_0x32c787(0x1de)](_0x5a096a);}}_0x42065c=Array[_0x32c787(0x112)](_0x108b59);}};return{'createYamlContext':_0x382dab,'prefetchJourneySegments':_0x2b4e19};}export async function executePushSegments(_0x5623c0,_0x1212c7,_0x4ef3e0,_0x5ed152,_0x5886eb){const _0x188d16=a152_0x2f9afb,{segmentDefToCreateRequest:_0x58cb7a,segmentDefToUpdateRequest:_0x4e51f8}=await import(_0x188d16(0x16a)),_0x1964c5=_0x4ef3e0[_0x188d16(0x1f6)],_0x14ea1a=0x5,_0x57d127=async _0x3f5277=>{const _0x3016f5=_0x188d16,_0x4dc8f0=_0x3f5277[_0x3016f5(0x169)]?_0x1964c5[_0x3016f5(0x181)](_0x3f5277[_0x3016f5(0x169)]):undefined;let _0x14009c;const _0x3e51ca={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x304158=_0x3f5277[_0x3016f5(0x152)];if(_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1c6)]){const _0x54c64b=createSegmentIdResolver(_0x4ef3e0['segmentNameToId'],_0x3f5277['yamlConfig']['name']),_0x2421a9=await resolveRuleSegmentIds(_0x3f5277['yamlConfig'][_0x3016f5(0x1c6)],_0x54c64b);_0x304158={..._0x3f5277[_0x3016f5(0x152)],'rule':_0x2421a9};}try{if(_0x3f5277['isNew']){_0x5886eb[_0x3016f5(0x1b7)]?.({'type':_0x3016f5(0x1ad),'name':_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1f9)]});const _0x3fa65f=_0x58cb7a(_0x304158,_0x4dc8f0),_0x6bd8f1=await _0x5886eb[_0x3016f5(0x140)]('Creating\x20segment\x20\x27'+_0x3f5277[_0x3016f5(0x152)]['name']+_0x3016f5(0x1ab),()=>_0x5623c0[_0x3016f5(0x1a4)][_0x3016f5(0x14c)](_0x5ed152[_0x3016f5(0x168)],_0x3fa65f));_0x14009c=_0x6bd8f1[_0x3016f5(0x1da)]['id'],_0x4ef3e0[_0x3016f5(0x122)][_0x3016f5(0x1ea)](_0x3f5277['yamlConfig'][_0x3016f5(0x1f9)],_0x14009c),_0x3e51ca['createdSegmentId']={'name':_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1f9)],'id':_0x14009c},_0x5886eb[_0x3016f5(0x1b7)]?.({'type':_0x3016f5(0x1b3),'name':_0x3f5277[_0x3016f5(0x152)]['name'],'segmentId':_0x14009c}),_0x5886eb[_0x3016f5(0x121)]?.(_0x3016f5(0x19e)+_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1f9)]+'\x27'),_0x3e51ca['created']=0x1;}else{if(_0x3f5277['hasChanges']){_0x5886eb[_0x3016f5(0x1b7)]?.({'type':_0x3016f5(0x1bc),'name':_0x3f5277['yamlConfig'][_0x3016f5(0x1f9)]});const _0x1ba9f5=_0x4e51f8(_0x304158);_0x4dc8f0!==_0x3f5277[_0x3016f5(0x1e7)]?.[_0x3016f5(0x21a)]&&(_0x1ba9f5[_0x3016f5(0x21a)]=_0x4dc8f0?parseInt(_0x4dc8f0,0xa):undefined),await _0x5886eb[_0x3016f5(0x140)](_0x3016f5(0x132)+_0x3f5277[_0x3016f5(0x152)]['name']+_0x3016f5(0x1ab),()=>_0x5623c0[_0x3016f5(0x1a4)][_0x3016f5(0x13c)](_0x5ed152['parentId'],_0x3f5277[_0x3016f5(0x1e7)]['id'],_0x1ba9f5)),_0x14009c=_0x3f5277[_0x3016f5(0x1e7)]['id'],_0x5886eb[_0x3016f5(0x1b7)]?.({'type':'segment_updated','name':_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1f9)]}),_0x5886eb['logSuccess']?.(_0x3016f5(0x1a6)+_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1f9)]+'\x27'),_0x3e51ca[_0x3016f5(0x1f4)]=0x1;}else _0x14009c=_0x3f5277[_0x3016f5(0x1e7)]['id'];}}catch(_0x47c786){const _0x2e8668=isHttp400Error(_0x47c786),_0x22da11=_0x2e8668?ErrorCode[_0x3016f5(0x171)]:ErrorCode[_0x3016f5(0x13f)],_0x5787b5=getErrorMessage(_0x47c786);throw new SDKError(_0x22da11,_0x3016f5(0x117)+(_0x3f5277[_0x3016f5(0x139)]?_0x3016f5(0x18e):'update')+_0x3016f5(0x1e9)+_0x3f5277[_0x3016f5(0x17e)]+_0x3016f5(0x13d)+_0x5787b5,_0x47c786);}try{const _0x1a7993=await syncActivationsForSegment(_0x5623c0,_0x5ed152[_0x3016f5(0x168)],_0x14009c,_0x3f5277[_0x3016f5(0x152)][_0x3016f5(0x1f9)],_0x3f5277[_0x3016f5(0x1b5)],_0x5886eb,_0x3f5277[_0x3016f5(0x17e)]);_0x3e51ca[_0x3016f5(0x12b)]=_0x1a7993;}catch(_0x95aa28){if(_0x95aa28 instanceof SDKError)throw _0x95aa28;throw new SDKError(ErrorCode[_0x3016f5(0x116)],_0x3016f5(0x212)+_0x3f5277['yamlConfig'][_0x3016f5(0x1f9)]+_0x3016f5(0x163)+_0x3f5277[_0x3016f5(0x17e)]+_0x3016f5(0x13d)+getErrorMessage(_0x95aa28),_0x95aa28);}return _0x3e51ca;},_0xa9b9f2=await batchAsync(_0x1212c7,_0x57d127,_0x14ea1a),_0x31640a={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1cc751 of _0xa9b9f2){_0x31640a[_0x188d16(0x1a2)]+=_0x1cc751[_0x188d16(0x1a2)],_0x31640a[_0x188d16(0x1f4)]+=_0x1cc751[_0x188d16(0x1f4)],_0x1cc751[_0x188d16(0x217)]&&_0x31640a['createdSegmentIds']['set'](_0x1cc751[_0x188d16(0x217)]['name'],_0x1cc751['createdSegmentId']['id']),_0x31640a['activations'][_0x188d16(0x1a2)]+=_0x1cc751['activations'][_0x188d16(0x1a2)],_0x31640a['activations']['updated']+=_0x1cc751[_0x188d16(0x12b)][_0x188d16(0x1f4)],_0x31640a['activations'][_0x188d16(0x144)]+=_0x1cc751[_0x188d16(0x12b)][_0x188d16(0x144)];}return _0x31640a;}async function syncActivationsForSegment(_0x181f23,_0x3f6524,_0x525424,_0x5e36d7,_0x1e49d7,_0x10b83a,_0x598691){const _0x230d78=a152_0x2f9afb,_0x11c923={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x40d0b8 of _0x1e49d7){try{if(_0x40d0b8[_0x230d78(0x1b0)]===_0x230d78(0x18e)&&_0x40d0b8['validatedRequest'])_0x10b83a[_0x230d78(0x1b7)]?.({'type':_0x230d78(0x1d6),'segmentName':_0x5e36d7,'activationName':_0x40d0b8[_0x230d78(0x1f9)]}),await _0x10b83a['withProgress']('Creating\x20activation\x20\x27'+_0x40d0b8[_0x230d78(0x1f9)]+_0x230d78(0x1ab),()=>_0x181f23[_0x230d78(0x1a4)][_0x230d78(0x1b9)](_0x3f6524,_0x525424,_0x40d0b8[_0x230d78(0x164)])),_0x10b83a[_0x230d78(0x1b7)]?.({'type':_0x230d78(0x141),'segmentName':_0x5e36d7,'activationName':_0x40d0b8[_0x230d78(0x1f9)]}),_0x10b83a[_0x230d78(0x121)]?.(_0x230d78(0x214)+_0x40d0b8[_0x230d78(0x1f9)]+'\x27'),_0x11c923[_0x230d78(0x1a2)]++;else{if(_0x40d0b8['type']===_0x230d78(0x12c)&&_0x40d0b8[_0x230d78(0x164)]&&_0x40d0b8[_0x230d78(0x1b1)])_0x10b83a[_0x230d78(0x1b7)]?.({'type':_0x230d78(0x213),'segmentName':_0x5e36d7,'activationName':_0x40d0b8[_0x230d78(0x1f9)]}),await _0x10b83a[_0x230d78(0x140)]('Updating\x20activation\x20\x27'+_0x40d0b8['name']+'\x27...',()=>_0x181f23[_0x230d78(0x1a4)][_0x230d78(0x1c4)](_0x3f6524,_0x525424,_0x40d0b8['existingActivation']['id'],_0x40d0b8[_0x230d78(0x164)])),_0x10b83a[_0x230d78(0x1b7)]?.({'type':_0x230d78(0x1db),'segmentName':_0x5e36d7,'activationName':_0x40d0b8['name']}),_0x10b83a[_0x230d78(0x121)]?.(_0x230d78(0x1fc)+_0x40d0b8[_0x230d78(0x1f9)]+'\x27'),_0x11c923['updated']++;else _0x40d0b8['type']===_0x230d78(0x193)&&_0x40d0b8[_0x230d78(0x1b1)]&&(_0x10b83a[_0x230d78(0x1b7)]?.({'type':_0x230d78(0x11c),'segmentName':_0x5e36d7,'activationName':_0x40d0b8[_0x230d78(0x1f9)]}),await _0x10b83a[_0x230d78(0x140)](_0x230d78(0x187)+_0x40d0b8['name']+_0x230d78(0x1ab),()=>_0x181f23[_0x230d78(0x1a4)][_0x230d78(0x202)](_0x3f6524,_0x525424,_0x40d0b8[_0x230d78(0x1b1)]['id'])),_0x10b83a['onProgress']?.({'type':_0x230d78(0x114),'segmentName':_0x5e36d7,'activationName':_0x40d0b8[_0x230d78(0x1f9)]}),_0x10b83a[_0x230d78(0x1c5)]?.(_0x230d78(0x165)+_0x40d0b8['name']+'\x27'),_0x11c923[_0x230d78(0x144)]++);}}catch(_0x330700){const _0x1e3f65=isHttp400Error(_0x330700),_0x2b6bd5=_0x1e3f65?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x5a0bdd=getErrorMessage(_0x330700);throw new SDKError(_0x2b6bd5,_0x230d78(0x117)+_0x40d0b8[_0x230d78(0x1b0)]+_0x230d78(0x20b)+_0x40d0b8[_0x230d78(0x1f9)]+_0x230d78(0x163)+_0x598691+'\x0a\x20\x20'+_0x5a0bdd,_0x330700);}}return _0x11c923;}export async function executePushFolders(_0x109c7b,_0x55c6ba,_0x3c3fcd,_0x598747,_0x2d7826){const _0x174ddb=a152_0x2f9afb,_0x314811=new Map(_0x3c3fcd),_0x34beb6=sortFoldersByDepth(_0x55c6ba);for(const _0x40af11 of _0x34beb6){const _0x58ce50=_0x40af11[_0x174ddb(0x128)]('/'),_0x4010c9=_0x58ce50[_0x58ce50[_0x174ddb(0x119)]-0x1],_0x3d2a2d=_0x58ce50['slice'](0x0,-0x1)[_0x174ddb(0x19d)]('/'),_0x380ab2=_0x314811[_0x174ddb(0x181)](_0x3d2a2d);_0x2d7826[_0x174ddb(0x1b7)]?.({'type':'folder_creating','folder':_0x40af11});const _0x4642ef={'name':_0x4010c9,'parentFolderId':_0x380ab2},_0x231ec0=await _0x2d7826[_0x174ddb(0x140)](_0x174ddb(0x15f)+_0x40af11+_0x174ddb(0x1ab),()=>_0x109c7b[_0x174ddb(0x1a4)][_0x174ddb(0x218)](_0x598747[_0x174ddb(0x168)],_0x4642ef));_0x314811[_0x174ddb(0x1ea)](_0x40af11,_0x231ec0['data']['id']),_0x2d7826['onProgress']?.({'type':'folder_created','folder':_0x40af11,'folderId':_0x231ec0[_0x174ddb(0x1da)]['id']}),_0x2d7826['logInfo']?.(_0x174ddb(0x1be)+_0x40af11+'\x27');}return _0x314811;}export async function executePushSegmentDeletions(_0x1373ef,_0x58435e,_0x3522bf){const _0x341e2a=a152_0x2f9afb;if(_0x58435e['length']===0x0)return 0x0;const {batchAsync:_0x2a2afd}=await import(_0x341e2a(0x1ff)),_0x53f82e=0x5,_0x48b04d=await _0x2a2afd(_0x58435e,async _0x12ce25=>{const _0x37ae69=_0x341e2a;return _0x3522bf[_0x37ae69(0x1b7)]?.({'type':_0x37ae69(0x17b),'name':_0x12ce25['name']}),await _0x1373ef[_0x37ae69(0x1a4)][_0x37ae69(0x1f0)](_0x12ce25['id']),_0x3522bf[_0x37ae69(0x1b7)]?.({'type':_0x37ae69(0x21b),'name':_0x12ce25['name']}),_0x3522bf['logDeleted']?.(_0x37ae69(0x1b6)+_0x12ce25[_0x37ae69(0x1f9)]+'\x27'),0x1;},_0x53f82e);return _0x48b04d[_0x341e2a(0x1d2)]((_0x29ab20,_0x34d34)=>_0x29ab20+_0x34d34,0x0);}export async function executePushJourneys(_0xc439d0,_0x51c93d,_0x54176d,_0x42a553,_0x507249){const _0x2166ce=a152_0x2f9afb,{journeyDefToRequest:_0x4e6661}=await import(_0x2166ce(0x203)),{activationDefToCreateRequest:_0x3a37b7,yamlRuleToApi:_0x27556d,validateSegmentRule:_0x4c33ed}=await import('./child-segment-yaml.js'),_0x140736={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x32af8b=new Map(_0x54176d[_0x2166ce(0x122)]),_0x1e1bd7=0x5;for(let _0x3e4db7=0x0;_0x3e4db7<_0x51c93d['length'];_0x3e4db7+=_0x1e1bd7){const _0x31c20e=_0x51c93d[_0x2166ce(0x191)](_0x3e4db7,_0x3e4db7+_0x1e1bd7),_0x216ea2=await Promise[_0x2166ce(0x1cf)](_0x31c20e[_0x2166ce(0x210)](async _0x42262f=>{const _0x1f34bd=_0x2166ce;if(!_0x42262f[_0x1f34bd(0x139)]&&!_0x42262f[_0x1f34bd(0x12e)])return{'action':_0x1f34bd(0x1c0),'name':_0x42262f[_0x1f34bd(0x152)]['name'],'journeyId':_0x42262f[_0x1f34bd(0x1a7)]?.['id']};const _0x3e6c05=_0x42262f[_0x1f34bd(0x169)]?_0x54176d[_0x1f34bd(0x1f6)]['get'](_0x42262f[_0x1f34bd(0x169)]):undefined;_0x507249[_0x1f34bd(0x1b7)]?.({'type':_0x42262f['isNew']?_0x1f34bd(0x19b):_0x1f34bd(0x211),'name':_0x42262f[_0x1f34bd(0x152)]['name']});try{const _0x2481b9=await executeSingleJourneyPush(_0xc439d0,_0x42262f,{..._0x54176d,'segmentNameToId':_0x32af8b},{'parentId':_0x42a553[_0x1f34bd(0x168)],'rootFolderId':_0x42a553[_0x1f34bd(0x207)],'folderId':_0x3e6c05,'verbose':_0x42a553['verbose']},_0x507249,{'journeyDefToRequest':_0x4e6661,'activationDefToCreateRequest':_0x3a37b7,'yamlRuleToApi':_0x27556d,'validateSegmentRule':_0x4c33ed});for(const [_0x3f0d5d,_0x4afd41]of _0x2481b9[_0x1f34bd(0x12f)]){_0x32af8b[_0x1f34bd(0x1ea)](_0x3f0d5d,_0x4afd41),_0x140736['embeddedSegmentNameToId'][_0x1f34bd(0x1ea)](_0x3f0d5d,_0x4afd41);}if(_0x2481b9[_0x1f34bd(0x19f)]==='created')_0x507249['onProgress']?.({'type':_0x1f34bd(0x177),'name':_0x42262f['yamlConfig'][_0x1f34bd(0x1f9)],'journeyId':_0x2481b9[_0x1f34bd(0x123)]}),_0x507249['logSuccess']?.(_0x1f34bd(0x1a8)+_0x42262f[_0x1f34bd(0x152)][_0x1f34bd(0x1f9)]+'\x27'),_0x140736['created']++;else _0x2481b9['action']===_0x1f34bd(0x1f4)&&(_0x507249[_0x1f34bd(0x1b7)]?.({'type':'journey_updated','name':_0x42262f[_0x1f34bd(0x152)]['name']}),_0x507249['logSuccess']?.('Updated\x20journey\x20\x27'+_0x42262f[_0x1f34bd(0x152)][_0x1f34bd(0x1f9)]+'\x27'),_0x140736['updated']++);return{'action':_0x2481b9[_0x1f34bd(0x19f)],'name':_0x42262f[_0x1f34bd(0x152)][_0x1f34bd(0x1f9)],'journeyId':_0x2481b9[_0x1f34bd(0x123)]};}catch(_0x41994d){const _0x4d67ef=isHttp400Error(_0x41994d),_0x1d6d45=_0x4d67ef?ErrorCode[_0x1f34bd(0x1cd)]:ErrorCode[_0x1f34bd(0x184)],_0x2344ef=getErrorMessage(_0x41994d);throw new SDKError(_0x1d6d45,_0x1f34bd(0x117)+(_0x42262f[_0x1f34bd(0x139)]?_0x1f34bd(0x18e):'update')+_0x1f34bd(0x15a)+_0x42262f[_0x1f34bd(0x17e)]+'\x0a\x20\x20'+_0x2344ef,_0x41994d);}}));_0x140736['results'][_0x2166ce(0x1b4)](..._0x216ea2);}return _0x140736;}async function matchExistingJourneySegments(_0x1b7a2f,_0x49e7aa,_0x348658,_0x5949dd,_0xd8bb79){const _0x3ee04e=a152_0x2f9afb;if(!_0x49e7aa[_0x3ee04e(0x1a7)]||!_0x49e7aa[_0x3ee04e(0x152)][_0x3ee04e(0x199)])return;const _0x5492d1=new Map(),_0x1ef8c9=new Set();for(const _0x263b68 of Object[_0x3ee04e(0x1e8)](_0x49e7aa[_0x3ee04e(0x152)][_0x3ee04e(0x199)])){const _0xf43d4d=generateDeterministicJourneySegmentName(_0x49e7aa[_0x3ee04e(0x152)]['name'],_0x263b68);_0x5492d1[_0x3ee04e(0x1ea)](_0xf43d4d,_0x263b68),_0x1ef8c9[_0x3ee04e(0x1de)](_0x263b68);}const _0x46643c=[],_0x33db3c=collectSegmentIdsFromJourneyApi(_0x49e7aa[_0x3ee04e(0x1a7)]);for(const _0x5e0bf3 of _0x33db3c){const _0x368297=await fetchSegment(_0x1b7a2f,_0x348658,_0x5e0bf3,_0x5949dd);if(!_0x368297?.[_0x3ee04e(0x1f9)])continue;const _0x58e26e=_0x5492d1['get'](_0x368297['name']);_0x58e26e?(_0xd8bb79[_0x3ee04e(0x1ea)](_0x58e26e,_0x5e0bf3),_0x1ef8c9[_0x3ee04e(0x193)](_0x58e26e)):_0x46643c[_0x3ee04e(0x1b4)]({'id':_0x5e0bf3,'seg':_0x368297});}if(_0x1ef8c9[_0x3ee04e(0x174)]>0x0&&_0x46643c[_0x3ee04e(0x119)]>0x0){const {localExpandedRuleToNames:_0x6ee414}=buildLocalExpandedRuleMappings(_0x49e7aa[_0x3ee04e(0x152)]),_0xfd0542=new Map();for(const {id:_0x435d5b,seg:_0x30a99f}of _0x46643c){if(_0x30a99f[_0x3ee04e(0x1c6)]){const _0x198d46=apiRuleToYaml(_0x30a99f[_0x3ee04e(0x1c6)]);_0xfd0542['set'](_0x435d5b,_0x198d46);}}for(const {id:_0x1c19af,seg:_0x207af8}of _0x46643c){if(!_0x207af8[_0x3ee04e(0x1c6)])continue;const _0x5bba54=_0xfd0542[_0x3ee04e(0x181)](_0x1c19af);if(!_0x5bba54)continue;const _0x4929a1=serializeExpandedRule(_0x5bba54,_0xfd0542),_0x4dcf89=_0x6ee414[_0x3ee04e(0x181)](_0x4929a1);if(_0x4dcf89){const _0x18966c=_0x4dcf89['find'](_0x4cc3f0=>_0x1ef8c9['has'](_0x4cc3f0));_0x18966c&&(_0xd8bb79[_0x3ee04e(0x1ea)](_0x18966c,_0x1c19af),_0x1ef8c9['delete'](_0x18966c),logger[_0x3ee04e(0x190)](_0x3ee04e(0x189)+_0x207af8[_0x3ee04e(0x1f9)]+_0x3ee04e(0x133)+_0x18966c+_0x3ee04e(0x180)));}}}}async function executeSingleJourneyPush(_0x2a19db,_0x5d3d12,_0x2142ef,_0x55fe8a,_0x5f22b8,_0x25eb59){const _0x574e46=a152_0x2f9afb,{journeyDefToRequest:_0x4ad484,activationDefToCreateRequest:_0xd2a3a7,yamlRuleToApi:_0x342925,validateSegmentRule:_0x20e749}=_0x25eb59,_0x25ea5d=new Map(),_0x4af7e7=new Map();recoverSegmentIdsFromPushRecovery(_0x5d3d12,_0x25ea5d,_0x2142ef[_0x574e46(0x122)]);const _0x32691d=new Map(),_0x1de167=new Map(),_0x1e215f=new Map();let _0x5606be;const _0x2ce033=async()=>{const _0x200a90=_0x574e46;if(_0x5606be)return;_0x5606be=new Map();if(!_0x5d3d12[_0x200a90(0x1a7)])return;const _0x1ea26e=await _0x2a19db[_0x200a90(0x1aa)][_0x200a90(0x18c)](_0x5d3d12[_0x200a90(0x1a7)]['id']);for(const _0x50cc9a of _0x1ea26e){const _0x35d8c2=journeyActivationStepToYaml(_0x50cc9a,_0x2142ef['idToEmailMap'],_0x2142ef['connectionIdToNameMap']),_0x1e46bd=activationSignature(_0x35d8c2);!_0x5606be[_0x200a90(0x188)](_0x1e46bd)&&_0x5606be['set'](_0x1e46bd,_0x50cc9a['id']),_0x35d8c2[_0x200a90(0x1f9)]&&_0x4af7e7[_0x200a90(0x1ea)](_0x35d8c2['name'],_0x50cc9a['id']);}};await matchExistingJourneySegments(_0x2a19db,_0x5d3d12,_0x55fe8a['parentId'],_0x2142ef['existingSegments'],_0x2142ef[_0x574e46(0x122)]);const _0x384c0e={'resolveSegmentId':async _0xd21acd=>{const _0x5b4840=_0x574e46,_0x3a08a7=_0x2142ef[_0x5b4840(0x122)]['get'](_0xd21acd);if(!_0x3a08a7)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0xd21acd+'\x20(referenced\x20in\x20journey\x20'+_0x5d3d12[_0x5b4840(0x152)][_0x5b4840(0x1f9)]+')');return _0x3a08a7;},'resolveEmbeddedSegmentId':async(_0x1da5e1,_0x5d4878)=>{const _0x310537=_0x574e46,_0x26c40e=_0x2142ef['segmentNameToId'][_0x310537(0x181)](_0x1da5e1);if(_0x26c40e)return _0x26c40e;const _0x2d4e14=_0x2142ef[_0x310537(0x194)][_0x310537(0x20e)](_0x4d66c0=>_0x4d66c0[_0x310537(0x1f9)]===_0x1da5e1);if(_0x2d4e14)return _0x2142ef[_0x310537(0x122)][_0x310537(0x1ea)](_0x1da5e1,_0x2d4e14['id']),_0x2d4e14['id'];if(_0x5d3d12[_0x310537(0x139)]){const {stageName:_0x4d638d,criteriaName:_0x592d5e}=findSegmentCriteriaLocation(_0x5d3d12['yamlConfig'],_0x1da5e1);return _0x20e749(_0x1da5e1,_0x5d4878[_0x310537(0x1c6)]),_0x1de167[_0x310537(0x1ea)](_0x1da5e1,{'definition':_0x5d4878,'stageName':_0x4d638d,'criteriaName':_0x592d5e}),createPendingSegmentId(_0x1da5e1);}const _0x4bb6e8=_0x5d3d12[_0x310537(0x1a7)]?.['id'];if(!_0x4bb6e8)throw new SDKError(ErrorCode[_0x310537(0x155)],_0x310537(0x150));const _0x1e1047=_0x32691d[_0x310537(0x181)](_0x1da5e1);if(_0x1e1047)return _0x1e1047;const _0x458dbd=((async()=>{const _0x5e9742=_0x310537;_0x20e749(_0x1da5e1,_0x5d4878[_0x5e9742(0x1c6)]);const _0x38866a=generateDeterministicJourneySegmentName(_0x5d3d12[_0x5e9742(0x152)][_0x5e9742(0x1f9)],_0x1da5e1),_0x46d658=_0x2142ef['existingSegments'][_0x5e9742(0x20e)](_0x10e5fd=>_0x10e5fd[_0x5e9742(0x1f9)]===_0x38866a),_0x52e4eb=createSegmentIdResolver(_0x2142ef[_0x5e9742(0x122)],_0x1da5e1),_0x3a313b=await resolveRuleSegmentIds(_0x5d4878[_0x5e9742(0x1c6)],_0x52e4eb);let _0x193185;return _0x46d658?(await _0x2a19db['segment'][_0x5e9742(0x13c)](_0x55fe8a[_0x5e9742(0x168)],_0x46d658['id'],{'description':_0x5d4878[_0x5e9742(0x1a0)]||_0x5e9742(0x162)+_0x1da5e1,'rule':_0x342925(_0x3a313b),'countPopulation':!![]}),_0x193185=_0x46d658['id'],saveSegmentToPushRecovery(_0x5d3d12[_0x5e9742(0x17e)],_0x5d3d12[_0x5e9742(0x152)][_0x5e9742(0x1f9)],_0x1da5e1,{'segmentId':_0x193185,'uniqueServerName':_0x38866a,'createdAt':new Date()['toISOString']()})):_0x193185=await createOrRecoverEmbeddedSegment(_0x2a19db,_0x5d3d12,{'localName':_0x1da5e1,'uniqueSegmentName':_0x38866a,'description':_0x5d4878['description']||_0x5e9742(0x162)+_0x1da5e1,'journeyId':_0x4bb6e8,'resolvedRule':_0x3a313b,'parentId':_0x55fe8a['parentId'],'folderId':_0x55fe8a['rootFolderId']||''},_0x342925),_0x2142ef[_0x5e9742(0x122)]['set'](_0x1da5e1,_0x193185),_0x25ea5d[_0x5e9742(0x1ea)](_0x1da5e1,_0x193185),_0x193185;})());_0x32691d[_0x310537(0x1ea)](_0x1da5e1,_0x458dbd);try{return await _0x458dbd;}finally{_0x32691d[_0x310537(0x193)](_0x1da5e1);}},'resolveActivationId':async _0x53ecb8=>{const _0x36f86f=_0x574e46,_0xc53798=_0x4af7e7[_0x36f86f(0x181)](_0x53ecb8);if(_0xc53798)return _0xc53798;if(_0x5d3d12['existingJourney']){await _0x2ce033();const _0x739f97=_0x4af7e7[_0x36f86f(0x181)](_0x53ecb8);if(_0x739f97)return _0x739f97;}throw new SDKError(ErrorCode[_0x36f86f(0x11d)],_0x36f86f(0x1ac)+_0x53ecb8+_0x36f86f(0x1ae)+_0x5d3d12['yamlConfig']['name']+_0x36f86f(0x18f)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0xa9688a,_0xc7328c)=>{const _0x355547=_0x574e46,_0x2f474a=_0x4af7e7[_0x355547(0x181)](_0xa9688a);if(_0x2f474a)return _0x2f474a;if(_0x5d3d12[_0x355547(0x139)])return _0x1e215f[_0x355547(0x1ea)](_0xa9688a,_0xc7328c),createPendingActivationId(_0xa9688a);if(_0x5d3d12['existingJourney']){await _0x2ce033();const _0x503ca4=_0x4af7e7[_0x355547(0x181)](_0xc7328c[_0x355547(0x1f9)]);if(_0x503ca4)return _0x4af7e7[_0x355547(0x1ea)](_0xa9688a,_0x503ca4),_0x503ca4;const _0x414a3e=activationSignature(_0xc7328c),_0x1c9aa8=_0x5606be?.['get'](_0x414a3e);if(_0x1c9aa8)return _0x4af7e7[_0x355547(0x1ea)](_0xa9688a,_0x1c9aa8),_0x1c9aa8;const _0x50b12e=await _0xd2a3a7(_0xc7328c,_0x2142ef[_0x355547(0x142)]),_0x1f85c7={..._0x50b12e,..._0xc7328c[_0x355547(0x19c)]!==undefined&&{'runAfterJourneyRefresh':_0xc7328c[_0x355547(0x19c)]}},_0x4a9d6e=await _0x2a19db[_0x355547(0x1aa)][_0x355547(0x1b9)](_0x5d3d12['existingJourney']['id'],_0x1f85c7);return _0x4af7e7[_0x355547(0x1ea)](_0xa9688a,_0x4a9d6e['id']),_0x4a9d6e['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x355547(0x170));},'resolveJourneyId':async _0x5a481d=>{const _0x1ca269=_0x574e46;try{return await _0x2a19db[_0x1ca269(0x1aa)][_0x1ca269(0x1a5)](_0x55fe8a['parentId'],_0x5a481d);}catch(_0x10c2d2){throw new SDKError(ErrorCode[_0x1ca269(0x11d)],'Journey\x20\x27'+_0x5a481d+_0x1ca269(0x115)+_0x5d3d12[_0x1ca269(0x152)][_0x1ca269(0x1f9)]+'\x27)',_0x10c2d2);}},'resolveStageId':async(_0x1fc5c0,_0x35e45c)=>{const _0x3bff0b=_0x574e46,_0x2aaf8d=await _0x2a19db[_0x3bff0b(0x1aa)][_0x3bff0b(0x17d)](_0x1fc5c0),_0x308719=_0x2aaf8d[_0x3bff0b(0x20f)][_0x3bff0b(0x206)]['find'](_0x35651c=>_0x35651c[_0x3bff0b(0x1f9)]['toLowerCase']()===_0x35e45c[_0x3bff0b(0x1fb)]());if(!_0x308719?.['id'])throw new SDKError(ErrorCode[_0x3bff0b(0x11d)],_0x3bff0b(0x13a)+_0x35e45c+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x2aaf8d[_0x3bff0b(0x20f)]['journeyBundleName']||_0x2aaf8d[_0x3bff0b(0x20f)][_0x3bff0b(0x1f9)])+'\x27');return _0x308719['id'];}},_0x1875ce=await _0x4ad484(_0x5d3d12[_0x574e46(0x152)],_0x55fe8a[_0x574e46(0x168)],_0x384c0e),_0x46a6e6=_0x55fe8a[_0x574e46(0x1f1)]||_0x55fe8a[_0x574e46(0x207)];_0x46a6e6&&(_0x1875ce[_0x574e46(0x11a)]={'parentFolder':{'data':{'id':_0x46a6e6,'type':_0x574e46(0x15c)}}});if(_0x5d3d12[_0x574e46(0x139)]){if(_0x1de167[_0x574e46(0x174)]>0x0||_0x1e215f['size']>0x0)return await executeThreeStepJourneyCreate(_0x2a19db,_0x5d3d12,_0x1875ce,{'pendingEmbeddedSegments':_0x1de167,'pendingEmbeddedActivations':_0x1e215f,'embeddedSegmentNameToId':_0x25ea5d,'journeyActivationNameToId':_0x4af7e7},{..._0x55fe8a,'effectiveFolderId':_0x46a6e6},_0x2142ef,_0x5f22b8,_0x25eb59);else{ensureJourneyDefaults(_0x1875ce['attributes']);const _0x4d7ab3=await _0x2a19db['journey']['create'](_0x1875ce);return deletePushRecovery(_0x5d3d12[_0x574e46(0x17e)]),{'action':_0x574e46(0x1a2),'journeyId':_0x4d7ab3['id'],'embeddedSegmentNameToId':_0x25ea5d};}}else{if(_0x5d3d12['hasChanges']&&_0x5d3d12[_0x574e46(0x1a7)]){_0x1875ce['id']=_0x5d3d12['existingJourney']['id'];const _0x4178ef=_0x1875ce['attributes'];_0x5d3d12[_0x574e46(0x1a7)][_0x574e46(0x20f)]?.['journeyBundleName']&&(_0x4178ef[_0x574e46(0x1a9)]=_0x5d3d12['existingJourney'][_0x574e46(0x20f)][_0x574e46(0x1a9)]);const _0x5da37c=_0x5d3d12[_0x574e46(0x1a7)][_0x574e46(0x20f)]?.['journeyStages'];return _0x5da37c&&_0x1875ce[_0x574e46(0x20f)][_0x574e46(0x206)]&&injectExistingStageIds(_0x1875ce[_0x574e46(0x20f)][_0x574e46(0x206)],_0x5da37c),ensureJourneyDefaults(_0x4178ef),await _0x2a19db['journey'][_0x574e46(0x12c)](_0x5d3d12['existingJourney']['id'],_0x1875ce),deletePushRecovery(_0x5d3d12[_0x574e46(0x17e)]),{'action':_0x574e46(0x1f4),'journeyId':_0x5d3d12[_0x574e46(0x1a7)]['id'],'embeddedSegmentNameToId':_0x25ea5d};}}return deletePushRecovery(_0x5d3d12[_0x574e46(0x17e)]),{'action':_0x574e46(0x1c0),'journeyId':_0x5d3d12[_0x574e46(0x1a7)]?.['id'],'embeddedSegmentNameToId':_0x25ea5d};}function findSegmentCriteriaLocation(_0xf056ea,_0x36882b){const _0x3471f4=a152_0x2f9afb,_0x275e2c=_0xf056ea[_0x3471f4(0x149)]||_0xf056ea['journeys']?.[0x0]?.[_0x3471f4(0x149)]||[];let _0x4462d3=_0x3471f4(0x147),_0x51d9d8=_0x36882b;const _0x1aa51c=_0xf056ea[_0x3471f4(0x208)]||_0xf056ea[_0x3471f4(0x143)]?.[0x0]?.[_0x3471f4(0x208)];if(_0x1aa51c?.[_0x3471f4(0x1a4)]===_0x36882b)return{'stageName':'goal','criteriaName':_0x1aa51c['name']||_0x36882b};_0x3c1322:for(const _0x51bbd6 of _0x275e2c){if(_0x51bbd6[_0x3471f4(0x166)]?.[_0x3471f4(0x1a4)]===_0x36882b){_0x4462d3=_0x51bbd6[_0x3471f4(0x1f9)],_0x51d9d8=_0x51bbd6['entry_criteria']['name']||_0x36882b;break;}if(_0x51bbd6[_0x3471f4(0x120)])for(const _0x31572d of _0x51bbd6['steps']){if(_0x31572d[_0x3471f4(0x1b0)]===_0x3471f4(0x1ba)&&_0x31572d['with']?.[_0x3471f4(0x176)])for(const _0x382b2e of _0x31572d[_0x3471f4(0x1e1)][_0x3471f4(0x176)]){if(_0x382b2e['segment']===_0x36882b){_0x4462d3=_0x51bbd6[_0x3471f4(0x1f9)],_0x51d9d8=_0x382b2e['name']||_0x36882b;break _0x3c1322;}}}}return{'stageName':_0x4462d3,'criteriaName':_0x51d9d8};}async function executeThreeStepJourneyCreate(_0x37350c,_0x580087,_0x2d5719,_0x5851e0,_0x146872,_0x1df236,_0x3dcf38,_0x50cb89){const _0x831e83=a152_0x2f9afb,{activationDefToCreateRequest:_0x2c6709,yamlRuleToApi:_0x53cf40}=_0x50cb89,{pendingEmbeddedSegments:_0x30ff06,pendingEmbeddedActivations:_0x30cca4,embeddedSegmentNameToId:_0x31cecd}=_0x5851e0,_0x2b4086=JSON[_0x831e83(0x124)](JSON[_0x831e83(0x178)](_0x2d5719));ensureJourneyDefaults(_0x2b4086['attributes']),stripPendingIds(_0x2b4086);const _0x1e9c77=await _0x37350c[_0x831e83(0x1aa)][_0x831e83(0x18e)](_0x2b4086),_0x56b663=_0x1e9c77['id'],_0x304b03=new Map();for(const _0x1fb985 of _0x1e9c77[_0x831e83(0x20f)][_0x831e83(0x206)]){_0x304b03[_0x831e83(0x1ea)](_0x1fb985['name'][_0x831e83(0x1fb)](),_0x1fb985['id']);}recoverSegmentIdsFromPushRecovery(_0x580087,_0x31cecd,_0x1df236[_0x831e83(0x122)]);for(const [_0x1d766d,{definition:_0x3a5c0c}]of _0x30ff06){if(_0x31cecd['has'](_0x1d766d)){_0x3dcf38[_0x831e83(0x1b7)]?.({'type':_0x831e83(0x145),'journeyName':_0x580087[_0x831e83(0x152)]['name'],'segmentName':_0x1d766d});continue;}const _0x476031=generateDeterministicJourneySegmentName(_0x580087[_0x831e83(0x152)][_0x831e83(0x1f9)],_0x1d766d);_0x3dcf38[_0x831e83(0x1b7)]?.({'type':'embedded_segment_creating','journeyName':_0x580087['yamlConfig'][_0x831e83(0x1f9)],'segmentName':_0x1d766d});const _0x5939bb=createSegmentIdResolver(_0x1df236[_0x831e83(0x122)],_0x1d766d),_0x591095=await resolveRuleSegmentIds(_0x3a5c0c['rule'],_0x5939bb),_0x355f3a=await createOrRecoverEmbeddedSegment(_0x37350c,_0x580087,{'localName':_0x1d766d,'uniqueSegmentName':_0x476031,'description':_0x3a5c0c[_0x831e83(0x1a0)]||_0x831e83(0x162)+_0x1d766d,'journeyId':_0x56b663,'resolvedRule':_0x591095,'parentId':_0x146872[_0x831e83(0x168)],'folderId':_0x146872['effectiveFolderId']||''},_0x53cf40);_0x31cecd[_0x831e83(0x1ea)](_0x1d766d,_0x355f3a),_0x1df236[_0x831e83(0x122)][_0x831e83(0x1ea)](_0x1d766d,_0x355f3a),_0x3dcf38[_0x831e83(0x1b7)]?.({'type':_0x831e83(0x145),'journeyName':_0x580087[_0x831e83(0x152)][_0x831e83(0x1f9)],'segmentName':_0x1d766d});}const _0x3695d8=new Map();for(const [_0x25cf15,_0x1d597a]of _0x30cca4){_0x3dcf38['onProgress']?.({'type':_0x831e83(0x1c7),'journeyName':_0x580087[_0x831e83(0x152)][_0x831e83(0x1f9)],'activationName':_0x25cf15});const _0x46b8a6=await _0x2c6709(_0x1d597a,_0x1df236[_0x831e83(0x142)]),_0x1e9613={..._0x46b8a6,..._0x1d597a[_0x831e83(0x19c)]!==undefined&&{'runAfterJourneyRefresh':_0x1d597a['run_after_journey_refresh']}},_0x30809f=await _0x37350c['journey']['createActivation'](_0x56b663,_0x1e9613);_0x3695d8[_0x831e83(0x1ea)](_0x25cf15,_0x30809f['id']),_0x5851e0[_0x831e83(0x1d1)][_0x831e83(0x1ea)](_0x25cf15,_0x30809f['id']),_0x3dcf38['onProgress']?.({'type':_0x831e83(0x1bf),'journeyName':_0x580087[_0x831e83(0x152)][_0x831e83(0x1f9)],'activationName':_0x25cf15});}const _0x3729f3=JSON[_0x831e83(0x124)](JSON['stringify'](_0x2d5719));return _0x3729f3['id']=_0x56b663,ensureJourneyDefaults(_0x3729f3['attributes']),resolvePendingIdsInRequest(_0x3729f3,_0x2d5719,_0x304b03,_0x31cecd,_0x3695d8,_0x3dcf38),await _0x37350c[_0x831e83(0x1aa)][_0x831e83(0x12c)](_0x56b663,_0x3729f3),deletePushRecovery(_0x580087[_0x831e83(0x17e)]),{'action':'created','journeyId':_0x56b663,'embeddedSegmentNameToId':_0x31cecd};}export function stripWaitStepPendingIds(_0x53a6a3){const _0x517248=a152_0x2f9afb,_0x20a759=_0x53a6a3[_0x517248(0x157)]&&isPendingSegmentId(_0x53a6a3['conditionSegmentId']),_0x24bd71=_0x53a6a3[_0x517248(0x18d)]?.[_0x517248(0x215)](_0x569c7f=>_0x569c7f[_0x517248(0x216)]&&isPendingSegmentId(_0x569c7f[_0x517248(0x216)]));(_0x20a759||_0x24bd71)&&(_0x53a6a3[_0x517248(0x11f)]=_0x517248(0x153),_0x53a6a3['waitStep']=0x1,_0x53a6a3[_0x517248(0x17a)]='day',delete _0x53a6a3[_0x517248(0x157)],delete _0x53a6a3[_0x517248(0x130)],delete _0x53a6a3[_0x517248(0x137)],delete _0x53a6a3[_0x517248(0x18d)]);}function a152_0x50cb(){const _0x5ca7be=['SEGMENT_SYNTAX_ERROR','):\x20','sha1','size','uniqueSegmentName','branches','journey_created','stringify','list','waitStepUnit','segment_deleting','nameToType','getJourney','absolutePath','logWarning','\x27\x20by\x20rule\x20content','get','message','deps','JOURNEY_UPDATE_ERROR','nameToId','SEGMENT_NOT_FOUND','Deleting\x20activation\x20\x27','has','Matched\x20server\x20segment\x20\x27','relative','journeyName','listActivations','conditions','create',').\x20','debug','slice','schedule','delete','existingSegments','Fetching\x20','\x27\x20for\x20','activationStepsById','localName','segments','buildUserMaps','journey_creating','run_after_journey_refresh','join','Created\x20segment\x20\x27','action','description','.$1.push-recovery.json','created','1KsalPA','segment','resolveJourneyId','Updated\x20segment\x20\x27','existingJourney','Created\x20journey\x20\x27','journeyBundleName','journey','\x27...','Activation\x20not\x20found:\x20','segment_creating','\x20(referenced\x20in\x20journey\x20','Failed\x20to\x20fetch\x20referenced\x20segment\x20','type','existingActivation','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','segment_created','push','activationActions','Deleted\x20segment\x20\x27','onProgress','notification','createActivation','decision_point','journeyById','segment_updating','connector_config','Created\x20folder\x20\x27','embedded_activation_created','unchanged','tdx.sdk.push-workflow','parentFolder','stage\x20\x27','updateActivation','logDeleted','rule','embedded_activation_creating','digest','behavior','getLatestJourneyId','activation_','getActivation','JOURNEY_SYNTAX_ERROR','user','all','7GRxPMo','journeyActivationNameToId','reduce','connection','hex','Failed\x20to\x20resolve\x20segment\x20','activation_creating','\x27\x20wait\x20condition','Segment\x20not\x20found','getSegmentEntity\x20also\x20failed\x20for\x20','data','activation_updated','dirname','goal\x20criteria','add','__pending_','startsWith','with','getSegment','\x27\x20exit\x20criteria','entries','max','Segment\x20not\x20found:\x20','existingSegment','keys','\x20segment\x20from\x20file:\x20','set','__pending_act_','5174705yKxVpm','replace','yamlActivation','versionNumber','deleteSegment','folderId','1368242XPwEZn','milestone','updated','object','folderPathToId','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Condition','name','diff','toLowerCase','Updated\x20activation\x20\x27','journeyActivationStepId','idToName','../../utils/async.js','uniqueServerName','waitStep','deleteActivation','./journey-yaml.js','WaitStep','skipSegments','journeyStages','rootFolderId','goal','fetchJourney','2326020PmveLR','\x20activation\x20\x27','activationParams','journeyBundleId','find','attributes','map','journey_updating','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','activation_updating','Created\x20activation\x20\x27','some','segmentId','createdSegmentId','createFolder','Failed\x20to\x20resolve\x20activation\x20','segmentFolderId','segment_deleted','from','isArray','activation_deleted','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','ACTIVATION_UPDATE_ERROR','Failed\x20to\x20','activationsBySegmentId','length','relationships','sort','activation_deleting','NOT_FOUND','toString','waitStepType','steps','logSuccess','segmentNameToId','journeyId','parse','createJourneySegment','item','match','split','errors','connectionIdToNameMap','activations','update','kind','hasChanges','embeddedSegmentNameToId','conditionTimeoutDuration','14228946FdyWZB','Updating\x20segment\x20\x27','\x27\x20to\x20local\x20\x27','684724Ifjhpx','Delete\x20the\x20push\x20recovery\x20file\x20(','\x27\x20decision\x20point\x20branch\x20\x27','conditionTimeoutUnit','getSegmentEntity','isNew','Stage\x20\x27','3282536bnGZrL','updateSegmentById','\x0a\x20\x20','journey_entry_criteria_','SEGMENT_UPDATE_ERROR','withProgress','activation_created','activationContext','journeys','deleted','embedded_segment_created','progress','entry','DecisionPoint','stages','state','all_columns','createSegment','parseDocument','resolvedRule','null','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Activation','yamlConfig','Duration','resolveSegment','INTERNAL','Name\x20has\x20already\x20been\x20taken','conditionSegmentId','parentSegmentFolder','exitCriterias','\x20journey\x20from\x20file:\x20','idToEmailMap','folder','columns','filter','Creating\x20folder\x20\x27','\x20error(s)','1535808bbJBkO','Entry\x20criteria:\x20','\x27\x20from\x20file:\x20','validatedRequest','Deleted\x20activation\x20\x27','entry_criteria','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','parentId','folderPath','./child-segment-yaml.js','trim','valid','utf-8','entryCriteria','activation_template_id','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context'];a152_0x50cb=function(){return _0x5ca7be;};return a152_0x50cb();}export function resolveWaitStepPendingIds(_0xe4835f,_0x7e6031,_0x1f048d,_0x2399b4){const _0x4c3f90=a152_0x2f9afb;if(_0x7e6031[_0x4c3f90(0x157)]&&isPendingSegmentId(_0x7e6031['conditionSegmentId'])){const _0x4bfbc6=_0x1f048d(_0x7e6031[_0x4c3f90(0x157)],_0x4c3f90(0x1c3)+_0x2399b4+_0x4c3f90(0x1d7));_0x4bfbc6&&(_0xe4835f[_0x4c3f90(0x11f)]=_0x4c3f90(0x1f8),_0xe4835f[_0x4c3f90(0x157)]=_0x4bfbc6,delete _0xe4835f[_0x4c3f90(0x201)],delete _0xe4835f[_0x4c3f90(0x17a)],_0x7e6031['conditionTimeoutDuration']!==undefined&&(_0xe4835f[_0x4c3f90(0x130)]=_0x7e6031[_0x4c3f90(0x130)]),_0x7e6031[_0x4c3f90(0x137)]&&(_0xe4835f[_0x4c3f90(0x137)]=_0x7e6031[_0x4c3f90(0x137)]));}if(_0x7e6031[_0x4c3f90(0x18d)]){const _0x143ecb=_0x7e6031['conditions'][_0x4c3f90(0x215)](_0xa35606=>_0xa35606[_0x4c3f90(0x216)]&&isPendingSegmentId(_0xa35606[_0x4c3f90(0x216)]));if(_0x143ecb){const _0x3acb8f=_0x7e6031['conditions'][_0x4c3f90(0x210)](_0x49a6ce=>{const _0x5ae69e=_0x4c3f90;if(_0x49a6ce[_0x5ae69e(0x216)]&&isPendingSegmentId(_0x49a6ce[_0x5ae69e(0x216)])){const _0x31f8f2=_0x1f048d(_0x49a6ce[_0x5ae69e(0x216)],_0x5ae69e(0x1c3)+_0x2399b4+_0x5ae69e(0x1d7));return{..._0x49a6ce,'segmentId':_0x31f8f2||_0x49a6ce[_0x5ae69e(0x216)]};}return{..._0x49a6ce};});_0xe4835f['waitStepType']=_0x4c3f90(0x1f8),_0xe4835f[_0x4c3f90(0x18d)]=_0x3acb8f,delete _0xe4835f[_0x4c3f90(0x201)],delete _0xe4835f[_0x4c3f90(0x17a)],delete _0xe4835f['conditionSegmentId'],delete _0xe4835f[_0x4c3f90(0x130)],delete _0xe4835f['conditionTimeoutUnit'];}}}function stripPendingIds(_0x305d29){const _0x189a40=a152_0x2f9afb;_0x305d29[_0x189a40(0x20f)][_0x189a40(0x208)]?.[_0x189a40(0x216)]&&isPendingSegmentId(_0x305d29['attributes'][_0x189a40(0x208)][_0x189a40(0x216)])&&delete _0x305d29[_0x189a40(0x20f)][_0x189a40(0x208)];for(const _0x2483dc of _0x305d29[_0x189a40(0x20f)][_0x189a40(0x206)]||[]){_0x2483dc['entryCriteria']?.[_0x189a40(0x216)]&&isPendingSegmentId(_0x2483dc[_0x189a40(0x16e)][_0x189a40(0x216)])&&delete _0x2483dc[_0x189a40(0x16e)];_0x2483dc[_0x189a40(0x1f3)]?.[_0x189a40(0x216)]&&isPendingSegmentId(_0x2483dc['milestone'][_0x189a40(0x216)])&&delete _0x2483dc[_0x189a40(0x1f3)];_0x2483dc[_0x189a40(0x159)]&&(_0x2483dc[_0x189a40(0x159)]=_0x2483dc[_0x189a40(0x159)][_0x189a40(0x15e)](_0x3209c2=>!_0x3209c2['segmentId']||!isPendingSegmentId(_0x3209c2[_0x189a40(0x216)])));if(_0x2483dc[_0x189a40(0x120)])for(const _0x2760ec of Object[_0x189a40(0x1e8)](_0x2483dc[_0x189a40(0x120)])){const _0x24f7b7=_0x2483dc[_0x189a40(0x120)][_0x2760ec];_0x24f7b7[_0x189a40(0x1b0)]===_0x189a40(0x151)&&_0x24f7b7[_0x189a40(0x1fd)]&&isPendingActivationId(_0x24f7b7['journeyActivationStepId'])&&(_0x24f7b7['journeyActivationStepId']='');if(_0x24f7b7[_0x189a40(0x1b0)]===_0x189a40(0x148)&&_0x24f7b7[_0x189a40(0x176)])for(const _0x570f97 of _0x24f7b7[_0x189a40(0x176)]){_0x570f97[_0x189a40(0x216)]&&isPendingSegmentId(_0x570f97['segmentId'])&&(_0x570f97[_0x189a40(0x216)]='');}_0x24f7b7[_0x189a40(0x1b0)]===_0x189a40(0x204)&&stripWaitStepPendingIds(_0x24f7b7);}}}function resolvePendingIdsInRequest(_0x440ff6,_0x39ac4e,_0x28d42a,_0x2fba49,_0x1e9686,_0x173d25){const _0x5c058e=a152_0x2f9afb,_0x1bcf0a=(_0x593fd2,_0x8cbbd)=>{const _0x1b5ebb=a152_0x1d0d;if(!isPendingSegmentId(_0x593fd2))return _0x593fd2;const _0x2e8d53=extractPendingSegmentName(_0x593fd2),_0x53b28f=_0x2fba49[_0x1b5ebb(0x181)](_0x2e8d53);return!_0x53b28f&&_0x173d25[_0x1b5ebb(0x17f)]?.(_0x1b5ebb(0x167)+_0x2e8d53+_0x1b5ebb(0x196)+_0x8cbbd),_0x53b28f;};if(_0x440ff6['attributes'][_0x5c058e(0x208)]?.[_0x5c058e(0x216)]&&isPendingSegmentId(_0x440ff6['attributes'][_0x5c058e(0x208)][_0x5c058e(0x216)])){const _0x4807d5=_0x1bcf0a(_0x440ff6[_0x5c058e(0x20f)][_0x5c058e(0x208)][_0x5c058e(0x216)],_0x5c058e(0x1dd));_0x4807d5&&(_0x440ff6[_0x5c058e(0x20f)]['goal'][_0x5c058e(0x216)]=_0x4807d5);}for(const _0xada191 of _0x440ff6['attributes'][_0x5c058e(0x206)]||[]){const _0x29a4e1=_0x28d42a[_0x5c058e(0x181)](_0xada191[_0x5c058e(0x1f9)][_0x5c058e(0x1fb)]());_0x29a4e1&&(_0xada191['id']=_0x29a4e1);if(_0xada191[_0x5c058e(0x16e)]?.['segmentId']&&isPendingSegmentId(_0xada191[_0x5c058e(0x16e)][_0x5c058e(0x216)])){const _0x36b23a=_0x1bcf0a(_0xada191[_0x5c058e(0x16e)][_0x5c058e(0x216)],_0x5c058e(0x1c3)+_0xada191[_0x5c058e(0x1f9)]+'\x27\x20entry\x20criteria');_0x36b23a&&(_0xada191[_0x5c058e(0x16e)]['segmentId']=_0x36b23a);}if(_0xada191[_0x5c058e(0x159)])for(const _0x2e7fb9 of _0xada191[_0x5c058e(0x159)]){if(_0x2e7fb9[_0x5c058e(0x216)]&&isPendingSegmentId(_0x2e7fb9[_0x5c058e(0x216)])){const _0x196a72=_0x1bcf0a(_0x2e7fb9[_0x5c058e(0x216)],_0x5c058e(0x1c3)+_0xada191[_0x5c058e(0x1f9)]+_0x5c058e(0x1e3));_0x196a72&&(_0x2e7fb9[_0x5c058e(0x216)]=_0x196a72);}}if(_0xada191[_0x5c058e(0x1f3)]?.[_0x5c058e(0x216)]&&isPendingSegmentId(_0xada191['milestone']['segmentId'])){const _0x2b745f=_0x1bcf0a(_0xada191[_0x5c058e(0x1f3)][_0x5c058e(0x216)],_0x5c058e(0x1c3)+_0xada191['name']+'\x27\x20milestone');_0x2b745f&&(_0xada191[_0x5c058e(0x1f3)][_0x5c058e(0x216)]=_0x2b745f);}if(_0xada191[_0x5c058e(0x120)]){const _0x471452=_0x29cade=>_0x39ac4e['attributes'][_0x5c058e(0x206)]?.['find'](_0x58a36e=>_0x58a36e[_0x5c058e(0x1f9)]['toLowerCase']()===_0xada191['name'][_0x5c058e(0x1fb)]())?.[_0x5c058e(0x120)]?.[_0x29cade];for(const _0x3f9ae7 of Object[_0x5c058e(0x1e8)](_0xada191[_0x5c058e(0x120)])){const _0xd97858=_0xada191['steps'][_0x3f9ae7],_0x563c69=_0x471452(_0x3f9ae7);if(_0xd97858[_0x5c058e(0x1b0)]===_0x5c058e(0x151)&&_0xd97858[_0x5c058e(0x1fd)]&&(isPendingActivationId(_0xd97858['journeyActivationStepId'])||_0xd97858[_0x5c058e(0x1fd)]==='')){if(_0x563c69?.[_0x5c058e(0x1fd)]&&isPendingActivationId(_0x563c69[_0x5c058e(0x1fd)])){const _0xac0dd5=extractPendingActivationName(_0x563c69[_0x5c058e(0x1fd)]),_0xf02a69=_0x1e9686[_0x5c058e(0x181)](_0xac0dd5);_0xf02a69&&(_0xd97858['journeyActivationStepId']=_0xf02a69);}}if(_0xd97858[_0x5c058e(0x1b0)]==='DecisionPoint'&&_0xd97858['branches']&&_0x563c69?.[_0x5c058e(0x176)])for(let _0x583b3e=0x0;_0x583b3e<_0xd97858[_0x5c058e(0x176)][_0x5c058e(0x119)];_0x583b3e++){const _0x2f7a57=_0xd97858[_0x5c058e(0x176)][_0x583b3e],_0x5e8702=_0x563c69[_0x5c058e(0x176)][_0x583b3e];if(_0x5e8702?.[_0x5c058e(0x216)]&&isPendingSegmentId(_0x5e8702[_0x5c058e(0x216)])){const _0x1b0a90=_0x1bcf0a(_0x5e8702['segmentId'],_0x5c058e(0x1c3)+_0xada191['name']+_0x5c058e(0x136)+(_0x2f7a57[_0x5c058e(0x1f9)]||_0x583b3e)+'\x27');_0x1b0a90&&(_0x2f7a57['segmentId']=_0x1b0a90);}}_0xd97858[_0x5c058e(0x1b0)]==='WaitStep'&&_0x563c69?.[_0x5c058e(0x1b0)]===_0x5c058e(0x204)&&resolveWaitStepPendingIds(_0xd97858,_0x563c69,_0x1bcf0a,_0xada191[_0x5c058e(0x1f9)]);}}}}
@@ -1 +1 @@
1
- (function(_0x22e92e,_0x2ad296){const _0x5c6cca=a153_0x40e0,_0x3dfbdb=_0x22e92e();while(!![]){try{const _0x24a4d1=-parseInt(_0x5c6cca(0x147))/0x1*(-parseInt(_0x5c6cca(0x142))/0x2)+parseInt(_0x5c6cca(0x14e))/0x3*(parseInt(_0x5c6cca(0x13e))/0x4)+parseInt(_0x5c6cca(0x13f))/0x5+-parseInt(_0x5c6cca(0x144))/0x6+-parseInt(_0x5c6cca(0x14c))/0x7+parseInt(_0x5c6cca(0x14d))/0x8*(parseInt(_0x5c6cca(0x148))/0x9)+-parseInt(_0x5c6cca(0x145))/0xa*(parseInt(_0x5c6cca(0x140))/0xb);if(_0x24a4d1===_0x2ad296)break;else _0x3dfbdb['push'](_0x3dfbdb['shift']());}catch(_0x24c8d4){_0x3dfbdb['push'](_0x3dfbdb['shift']());}}}(a153_0x3687,0x79e90));export function buildFolderIdToPathMap(_0x5f1192){const _0x5b6bcd=a153_0x40e0,_0x3ca2da=new Map(),_0x3f2c3a=new Map();for(const _0x455e2f of _0x5f1192){_0x3f2c3a[_0x5b6bcd(0x146)](_0x455e2f['id'],_0x455e2f);}const _0x515508=new Set();for(const _0x21639b of _0x5f1192){!_0x21639b[_0x5b6bcd(0x14a)]&&_0x515508['add'](_0x21639b['id']);}function _0x5de81f(_0x362615){const _0x356446=_0x5b6bcd;if(_0x3ca2da[_0x356446(0x143)](_0x362615['id']))return _0x3ca2da[_0x356446(0x149)](_0x362615['id']);if(_0x515508[_0x356446(0x143)](_0x362615['id']))return _0x3ca2da[_0x356446(0x146)](_0x362615['id'],''),'';if(_0x362615[_0x356446(0x14a)]){const _0x14a91=_0x3f2c3a[_0x356446(0x149)](_0x362615[_0x356446(0x14a)]);if(_0x14a91){const _0x409838=_0x5de81f(_0x14a91),_0x5d2818=_0x409838?_0x409838+'/'+_0x362615['name']:_0x362615[_0x356446(0x141)];return _0x3ca2da[_0x356446(0x146)](_0x362615['id'],_0x5d2818),_0x5d2818;}}const _0x4e2d5d=_0x362615[_0x356446(0x141)];return _0x3ca2da[_0x356446(0x146)](_0x362615['id'],_0x4e2d5d),_0x4e2d5d;}for(const _0x302b17 of _0x5f1192){_0x5de81f(_0x302b17);}return _0x3ca2da;}function a153_0x3687(){const _0x2d1371=['3096610EvviMS','470558RdGEzl','name','2CIIPiE','has','1355508HsoMzZ','350JUrgkC','set','126305MHJqzr','405abWpQx','get','parentFolderId','add','906703HCihLD','168400wtXKSR','6mWVkBl','1318288yeCHtA'];a153_0x3687=function(){return _0x2d1371;};return a153_0x3687();}export function buildFolderPathToIdMap(_0x4b855f){const _0x4027d0=a153_0x40e0,_0x289ca3=new Map(),_0x5542f6=new Map();for(const _0x13c48d of _0x4b855f){_0x5542f6[_0x4027d0(0x146)](_0x13c48d['id'],_0x13c48d);}const _0x58562d=new Set();for(const _0x55ea88 of _0x4b855f){!_0x55ea88[_0x4027d0(0x14a)]&&_0x58562d[_0x4027d0(0x14b)](_0x55ea88['id']);}function _0x4a4f16(_0x30ec89){const _0x48dc5c=_0x4027d0;if(_0x58562d['has'](_0x30ec89['id']))return'';if(_0x30ec89[_0x48dc5c(0x14a)]){const _0x4743e3=_0x5542f6[_0x48dc5c(0x149)](_0x30ec89[_0x48dc5c(0x14a)]);if(_0x4743e3){const _0x3800ad=_0x4a4f16(_0x4743e3);return _0x3800ad?_0x3800ad+'/'+_0x30ec89['name']:_0x30ec89['name'];}}return _0x30ec89['name'];}for(const _0x445aac of _0x4b855f){const _0x1994d8=_0x4a4f16(_0x445aac);_0x289ca3[_0x4027d0(0x146)](_0x1994d8,_0x445aac['id']);}return _0x289ca3;}export function buildFolderMaps(_0xa81614){const _0x3608f1=a153_0x40e0,_0x3a7d67=buildFolderIdToPathMap(_0xa81614),_0xfe08f4=new Map();for(const [_0x9b2bb7,_0x51f66c]of _0x3a7d67){_0xfe08f4[_0x3608f1(0x146)](_0x51f66c,_0x9b2bb7);}return{'idToPath':_0x3a7d67,'pathToId':_0xfe08f4};}function a153_0x40e0(_0xb7db1d,_0x5bcda2){_0xb7db1d=_0xb7db1d-0x13e;const _0x3687a6=a153_0x3687();let _0x40e077=_0x3687a6[_0xb7db1d];return _0x40e077;}export function getFolderPath(_0x2ad5b7,_0x584a96){const _0x1e1dbd=a153_0x40e0;if(!_0x2ad5b7)return'';return _0x584a96[_0x1e1dbd(0x149)](_0x2ad5b7)??'';}
1
+ function a153_0x17b8(_0x39dd9e,_0x48e8f6){_0x39dd9e=_0x39dd9e-0x86;const _0x3aa431=a153_0x3aa4();let _0x17b850=_0x3aa431[_0x39dd9e];return _0x17b850;}(function(_0x2f1bfc,_0x5a2a29){const _0xd06e4a=a153_0x17b8,_0x3eeefc=_0x2f1bfc();while(!![]){try{const _0x3bc113=-parseInt(_0xd06e4a(0x89))/0x1+parseInt(_0xd06e4a(0x92))/0x2*(-parseInt(_0xd06e4a(0x94))/0x3)+parseInt(_0xd06e4a(0x8e))/0x4+-parseInt(_0xd06e4a(0x91))/0x5*(parseInt(_0xd06e4a(0x86))/0x6)+-parseInt(_0xd06e4a(0x87))/0x7*(parseInt(_0xd06e4a(0x8f))/0x8)+parseInt(_0xd06e4a(0x96))/0x9+parseInt(_0xd06e4a(0x90))/0xa*(parseInt(_0xd06e4a(0x8a))/0xb);if(_0x3bc113===_0x5a2a29)break;else _0x3eeefc['push'](_0x3eeefc['shift']());}catch(_0x27c479){_0x3eeefc['push'](_0x3eeefc['shift']());}}}(a153_0x3aa4,0xa026e));export function buildFolderIdToPathMap(_0x3750be){const _0x2a2b87=a153_0x17b8,_0x46a135=new Map(),_0x48d4da=new Map();for(const _0x14df2f of _0x3750be){_0x48d4da['set'](_0x14df2f['id'],_0x14df2f);}const _0x4c9bc6=new Set();for(const _0x155af4 of _0x3750be){!_0x155af4[_0x2a2b87(0x93)]&&_0x4c9bc6['add'](_0x155af4['id']);}function _0x262e45(_0x45c81e){const _0x4d4fdb=_0x2a2b87;if(_0x46a135[_0x4d4fdb(0x8c)](_0x45c81e['id']))return _0x46a135[_0x4d4fdb(0x8b)](_0x45c81e['id']);if(_0x4c9bc6[_0x4d4fdb(0x8c)](_0x45c81e['id']))return _0x46a135[_0x4d4fdb(0x8d)](_0x45c81e['id'],''),'';if(_0x45c81e[_0x4d4fdb(0x93)]){const _0x5966d2=_0x48d4da[_0x4d4fdb(0x8b)](_0x45c81e[_0x4d4fdb(0x93)]);if(_0x5966d2){const _0x1345c7=_0x262e45(_0x5966d2),_0x3dc66b=_0x1345c7?_0x1345c7+'/'+_0x45c81e['name']:_0x45c81e[_0x4d4fdb(0x95)];return _0x46a135[_0x4d4fdb(0x8d)](_0x45c81e['id'],_0x3dc66b),_0x3dc66b;}}const _0x5ac846=_0x45c81e[_0x4d4fdb(0x95)];return _0x46a135[_0x4d4fdb(0x8d)](_0x45c81e['id'],_0x5ac846),_0x5ac846;}for(const _0x6a4ff1 of _0x3750be){_0x262e45(_0x6a4ff1);}return _0x46a135;}export function buildFolderPathToIdMap(_0xc1005d){const _0xf4a4ca=a153_0x17b8,_0x2da12a=new Map(),_0x289fd7=new Map();for(const _0x5c90dd of _0xc1005d){_0x289fd7[_0xf4a4ca(0x8d)](_0x5c90dd['id'],_0x5c90dd);}const _0x2146c7=new Set();for(const _0x5e848a of _0xc1005d){!_0x5e848a[_0xf4a4ca(0x93)]&&_0x2146c7[_0xf4a4ca(0x88)](_0x5e848a['id']);}function _0x211cef(_0x4d2df5){const _0x2883f1=_0xf4a4ca;if(_0x2146c7[_0x2883f1(0x8c)](_0x4d2df5['id']))return'';if(_0x4d2df5[_0x2883f1(0x93)]){const _0xeb0687=_0x289fd7[_0x2883f1(0x8b)](_0x4d2df5[_0x2883f1(0x93)]);if(_0xeb0687){const _0x344332=_0x211cef(_0xeb0687);return _0x344332?_0x344332+'/'+_0x4d2df5[_0x2883f1(0x95)]:_0x4d2df5[_0x2883f1(0x95)];}}return _0x4d2df5[_0x2883f1(0x95)];}for(const _0xa86574 of _0xc1005d){const _0x5e4aaf=_0x211cef(_0xa86574);_0x2da12a[_0xf4a4ca(0x8d)](_0x5e4aaf,_0xa86574['id']);}return _0x2da12a;}export function buildFolderMaps(_0xd7e5a5){const _0x130cbe=a153_0x17b8,_0x3fa280=buildFolderIdToPathMap(_0xd7e5a5),_0x1295bc=new Map();for(const [_0x113e19,_0xd0e14a]of _0x3fa280){_0x1295bc[_0x130cbe(0x8d)](_0xd0e14a,_0x113e19);}return{'idToPath':_0x3fa280,'pathToId':_0x1295bc};}function a153_0x3aa4(){const _0x5928c3=['2400400ifqAeB','1840424aXZnNI','19169510aMcGpi','1054985uMMrMl','94yWPuaH','parentFolderId','47451bOaoIL','name','8642097PQGwUC','30lPNFDW','7pgEIIx','add','792865XoYgsk','11JgeYSo','get','has','set'];a153_0x3aa4=function(){return _0x5928c3;};return a153_0x3aa4();}export function getFolderPath(_0x1a2639,_0xfaf883){const _0x177a2b=a153_0x17b8;if(!_0x1a2639)return'';return _0xfaf883[_0x177a2b(0x8b)](_0x1a2639)??'';}
@@ -1 +1 @@
1
- (function(_0x50c3ca,_0x53d774){const _0x12818a=a154_0x4018,_0x32f865=_0x50c3ca();while(!![]){try{const _0x471e13=parseInt(_0x12818a(0x1ad))/0x1+-parseInt(_0x12818a(0x1ba))/0x2+parseInt(_0x12818a(0x1a5))/0x3+parseInt(_0x12818a(0x1a8))/0x4+parseInt(_0x12818a(0x1a2))/0x5+parseInt(_0x12818a(0x1b9))/0x6*(-parseInt(_0x12818a(0x1c4))/0x7)+parseInt(_0x12818a(0x1bb))/0x8*(-parseInt(_0x12818a(0x1b3))/0x9);if(_0x471e13===_0x53d774)break;else _0x32f865['push'](_0x32f865['shift']());}catch(_0x3fdaa7){_0x32f865['push'](_0x32f865['shift']());}}}(a154_0x4001,0x83904));function a154_0x4001(){const _0x31c29d=['journey','Path\x20attempts\x20to\x20navigate\x20above\x20root','.yaml','677750hdRlTc','dirname','segments','785175NssOEq','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','split','3412476sMnbGC','endsWith','Cannot\x20navigate\x20above\x20root','No\x20tdx.json\x20found\x20for\x20file:\x20','.yml','895660wVTjKU','resolve','type','tdx.json','Path\x20segment\x20cannot\x20be\x20empty','isAbsolute','432288QfRGTB','push','startsWith','parent_segment','pop','filter','24UbeRKG','890332HPFEAR','16FQTbUb','name','Cannot\x20split\x20empty\x20path','test','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','File\x20not\x20found:\x20','Path\x20cannot\x20be\x20empty','length','slice','1865395tCPUAb','trim','readFile','exists','substring','join','raw','relative','Relative\x20path\x20cannot\x20be\x20empty','parse','Path\x20must\x20contain\x20at\x20least\x20one\x20segment'];a154_0x4001=function(){return _0x31c29d;};return a154_0x4001();}import a154_0x3dc4d9 from'path';import{parse as a154_0x59e7c3}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x111668){const _0x104ee3=a154_0x4018;if(!_0x111668||_0x111668[_0x104ee3(0x1c5)]()==='')throw new Error(_0x104ee3(0x1c1));const _0x48f804=_0x111668['trim']();if(_0x48f804==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x111668};const _0x785370=_0x48f804[_0x104ee3(0x1b5)]('/')?_0x48f804[_0x104ee3(0x1c8)](0x1):_0x48f804,_0x359d2=_0x785370[_0x104ee3(0x1a7)]('/')[_0x104ee3(0x1b8)](_0x53717b=>_0x53717b!=='');if(_0x359d2[_0x104ee3(0x1c2)]===0x0)throw new Error(_0x104ee3(0x19e));const _0x32c9a4=_0x48f804[_0x104ee3(0x1b5)]('/')||!isRelativePathSegment(_0x359d2[0x0]);for(const _0x274c9f of _0x359d2){validatePathSegment(_0x274c9f);}return{'segments':_0x359d2,'isAbsolute':_0x32c9a4,'raw':_0x111668};}function isRelativePathSegment(_0x117ec6){return _0x117ec6==='.'||_0x117ec6==='..';}function validatePathSegment(_0xe855ef){const _0xb762d9=a154_0x4018;if(_0xe855ef==='')throw new Error(_0xb762d9(0x1b1));if(_0xe855ef==='.'||_0xe855ef==='..')return;if(/[\x00-\x1F\x7F]/[_0xb762d9(0x1be)](_0xe855ef))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0xe855ef);if(_0xe855ef!==_0xe855ef['trim']()){}}export function validatePath(_0x466598){const _0x1d7f98=a154_0x4018;if(_0x466598[_0x1d7f98(0x1a4)][_0x1d7f98(0x1c2)]===0x0&&!_0x466598[_0x1d7f98(0x1b2)])throw new Error(_0x1d7f98(0x19c));if(_0x466598['isAbsolute']){if(_0x466598[_0x1d7f98(0x1a4)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x1751b5=0x0;for(const _0x1606da of _0x466598[_0x1d7f98(0x1a4)]){if(_0x1606da==='..'){if(_0x1751b5===0x0)throw new Error(_0x1d7f98(0x1a0));_0x1751b5--;}else _0x1606da!=='.'&&_0x1751b5++;}}}export function joinPaths(_0x5d1fbb,_0xd360b3){const _0x1eb269=a154_0x4018;if(!_0x5d1fbb||_0x5d1fbb==='/')return _0xd360b3;if(!_0xd360b3||_0xd360b3==='.')return _0x5d1fbb;if(_0xd360b3['startsWith']('/'))return _0xd360b3;const _0xe446eb=parsePath(_0x5d1fbb),_0x33bc9d=parsePath(_0xd360b3),_0x56412e=[..._0xe446eb[_0x1eb269(0x1a4)]];for(const _0x22db8f of _0x33bc9d['segments']){if(_0x22db8f==='.')continue;else{if(_0x22db8f==='..'){if(_0x56412e[_0x1eb269(0x1c2)]===0x0)throw new Error(_0x1eb269(0x1aa));_0x56412e[_0x1eb269(0x1b7)]();}else _0x56412e['push'](_0x22db8f);}}const _0x43a722=_0x56412e[_0x1eb269(0x199)]('/');return _0xe446eb[_0x1eb269(0x19a)][_0x1eb269(0x1b5)]('/')?'/'+_0x43a722:_0x43a722;}export function normalizePath(_0xb1d2d){const _0x56f9ec=a154_0x4018,_0x1c3cc0=parsePath(_0xb1d2d),_0x452641=[];for(const _0x2f5306 of _0x1c3cc0[_0x56f9ec(0x1a4)]){if(_0x2f5306==='.')continue;else{if(_0x2f5306==='..'){if(_0x452641['length']===0x0){if(_0x1c3cc0['isAbsolute'])throw new Error(_0x56f9ec(0x1aa));_0x452641[_0x56f9ec(0x1b4)]('..');}else _0x452641[_0x452641['length']-0x1]==='..'?_0x452641[_0x56f9ec(0x1b4)]('..'):_0x452641['pop']();}else _0x452641[_0x56f9ec(0x1b4)](_0x2f5306);}}if(_0x452641[_0x56f9ec(0x1c2)]===0x0)return _0x1c3cc0['isAbsolute']?'/':'.';const _0x4b1f84=_0x452641[_0x56f9ec(0x199)]('/');return _0x1c3cc0[_0x56f9ec(0x19a)]['startsWith']('/')?'/'+_0x4b1f84:_0x4b1f84;}export function getParentPath(_0x336ae5){const _0x2f9cbd=a154_0x4018,_0x4ee911=parsePath(_0x336ae5);if(_0x4ee911['segments'][_0x2f9cbd(0x1c2)]<=0x1)return'/';const _0x20d04b=_0x4ee911[_0x2f9cbd(0x1a4)][_0x2f9cbd(0x1c3)](0x0,-0x1)[_0x2f9cbd(0x199)]('/');return _0x4ee911[_0x2f9cbd(0x19a)][_0x2f9cbd(0x1b5)]('/')?'/'+_0x20d04b:_0x20d04b;}export function getBaseName(_0x127846){const _0x4dbad8=a154_0x4018,_0x9d20ec=parsePath(_0x127846);return _0x9d20ec[_0x4dbad8(0x1a4)][_0x9d20ec[_0x4dbad8(0x1a4)][_0x4dbad8(0x1c2)]-0x1]||'';}export function isChildPath(_0x214bd8,_0x424968){const _0x3defef=a154_0x4018,_0x4ebc5e=parsePath(_0x214bd8),_0x381c40=parsePath(_0x424968);if(_0x4ebc5e[_0x3defef(0x1a4)][_0x3defef(0x1c2)]<=_0x381c40[_0x3defef(0x1a4)][_0x3defef(0x1c2)])return![];for(let _0x55e742=0x0;_0x55e742<_0x381c40['segments']['length'];_0x55e742++){if(_0x4ebc5e[_0x3defef(0x1a4)][_0x55e742]!==_0x381c40[_0x3defef(0x1a4)][_0x55e742])return![];}return!![];}export function splitPath(_0x386ded){const _0x9ceb72=a154_0x4018,_0x3b35c0=parsePath(_0x386ded);if(_0x3b35c0[_0x9ceb72(0x1a4)][_0x9ceb72(0x1c2)]===0x0)throw new Error(_0x9ceb72(0x1bd));if(_0x3b35c0[_0x9ceb72(0x1a4)][_0x9ceb72(0x1c2)]===0x1)return{'parent':_0x3b35c0[_0x9ceb72(0x1a4)][0x0]};return{'parent':_0x3b35c0[_0x9ceb72(0x1a4)][0x0],'child':_0x3b35c0[_0x9ceb72(0x1a4)][_0x9ceb72(0x1c3)](0x1)['join']('/')};}export function isYamlFilePath(_0x2cd989){const _0x285442=a154_0x4018;return _0x2cd989['endsWith'](_0x285442(0x1ac))||_0x2cd989[_0x285442(0x1a9)](_0x285442(0x1a1));}function a154_0x4018(_0x3b400e,_0x247a91){_0x3b400e=_0x3b400e-0x199;const _0x4001e0=a154_0x4001();let _0x4018f2=_0x4001e0[_0x3b400e];return _0x4018f2;}export async function resolveYamlFilePath(_0x1fcde5,_0x1aad7f=nodeFileSystem){const _0x31c93f=a154_0x4018,_0x25bfe4=a154_0x3dc4d9[_0x31c93f(0x1ae)](_0x1fcde5);if(!await _0x1aad7f['exists'](_0x25bfe4))throw new Error(_0x31c93f(0x1c0)+_0x1fcde5);let _0xa91f9a=a154_0x3dc4d9[_0x31c93f(0x1a3)](_0x25bfe4),_0x1560f0=null,_0x411f45=null;const _0x156a1c=a154_0x3dc4d9[_0x31c93f(0x19d)](_0xa91f9a)['root'];while(_0xa91f9a!==_0x156a1c){const _0x568734=a154_0x3dc4d9[_0x31c93f(0x199)](_0xa91f9a,_0x31c93f(0x1b0));if(await _0x1aad7f[_0x31c93f(0x1c7)](_0x568734)){_0x1560f0=_0x568734,_0x411f45=_0xa91f9a;break;}_0xa91f9a=a154_0x3dc4d9['dirname'](_0xa91f9a);}if(!_0x1560f0||!_0x411f45)throw new Error(_0x31c93f(0x1ab)+_0x1fcde5+'\x0a'+_0x31c93f(0x1a6));const _0x37a258=await _0x1aad7f['readFile'](_0x1560f0),_0x49ecec=JSON[_0x31c93f(0x19d)](_0x37a258),_0x5e6343=_0x49ecec[_0x31c93f(0x1b6)];if(!_0x5e6343)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1273d8=await _0x1aad7f[_0x31c93f(0x1c6)](_0x25bfe4),_0x56405d=a154_0x59e7c3(_0x1273d8),_0x2087ec=_0x56405d[_0x31c93f(0x1bc)];if(!_0x2087ec)throw new Error(_0x31c93f(0x1bf)+_0x1fcde5);const _0x23315d=_0x56405d[_0x31c93f(0x1af)]===_0x31c93f(0x19f)?_0x31c93f(0x19f):'segment',_0x51eddf=a154_0x3dc4d9[_0x31c93f(0x19b)](_0x411f45,_0x25bfe4),_0x1cdcda=a154_0x3dc4d9[_0x31c93f(0x1a3)](_0x51eddf),_0x35d558=_0x1cdcda==='.'?'':_0x1cdcda['replace'](/\\/g,'/'),_0x2a2e66=_0x35d558?_0x5e6343+'/'+_0x35d558+'/'+_0x2087ec:_0x5e6343+'/'+_0x2087ec;return{'parentSegment':_0x5e6343,'segmentName':_0x2087ec,'folderPath':_0x35d558,'fullPath':_0x2a2e66,'resourceType':_0x23315d,'content':_0x1273d8};}
1
+ (function(_0xb3f4a5,_0x3324a9){const _0x5f5034=a154_0x24ab,_0x240c62=_0xb3f4a5();while(!![]){try{const _0x2ca9b5=parseInt(_0x5f5034(0x77))/0x1+parseInt(_0x5f5034(0x88))/0x2+parseInt(_0x5f5034(0x8d))/0x3+parseInt(_0x5f5034(0x78))/0x4+parseInt(_0x5f5034(0x81))/0x5*(-parseInt(_0x5f5034(0x8f))/0x6)+parseInt(_0x5f5034(0x93))/0x7*(-parseInt(_0x5f5034(0x84))/0x8)+parseInt(_0x5f5034(0x76))/0x9*(-parseInt(_0x5f5034(0x82))/0xa);if(_0x2ca9b5===_0x3324a9)break;else _0x240c62['push'](_0x240c62['shift']());}catch(_0xb5274e){_0x240c62['push'](_0x240c62['shift']());}}}(a154_0x515b,0xbb474));import a154_0x51d8a4 from'path';import{parse as a154_0x58c943}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x3bab0f){const _0x37c31a=a154_0x24ab;if(!_0x3bab0f||_0x3bab0f[_0x37c31a(0x7f)]()==='')throw new Error(_0x37c31a(0x97));const _0x590e16=_0x3bab0f[_0x37c31a(0x7f)]();if(_0x590e16==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x3bab0f};const _0x5a2082=_0x590e16[_0x37c31a(0x7d)]('/')?_0x590e16[_0x37c31a(0x8b)](0x1):_0x590e16,_0x3a26f1=_0x5a2082[_0x37c31a(0x94)]('/')[_0x37c31a(0x87)](_0x282f54=>_0x282f54!=='');if(_0x3a26f1[_0x37c31a(0x95)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x36c2c6=_0x590e16[_0x37c31a(0x7d)]('/')||!isRelativePathSegment(_0x3a26f1[0x0]);for(const _0x12858a of _0x3a26f1){validatePathSegment(_0x12858a);}return{'segments':_0x3a26f1,'isAbsolute':_0x36c2c6,'raw':_0x3bab0f};}function isRelativePathSegment(_0x8cf2c2){return _0x8cf2c2==='.'||_0x8cf2c2==='..';}function validatePathSegment(_0x3e95c8){const _0x1b6ff2=a154_0x24ab;if(_0x3e95c8==='')throw new Error(_0x1b6ff2(0x90));if(_0x3e95c8==='.'||_0x3e95c8==='..')return;if(/[\x00-\x1F\x7F]/[_0x1b6ff2(0x92)](_0x3e95c8))throw new Error(_0x1b6ff2(0x83)+_0x3e95c8);if(_0x3e95c8!==_0x3e95c8['trim']()){}}export function validatePath(_0x12370b){const _0x429c27=a154_0x24ab;if(_0x12370b[_0x429c27(0x89)][_0x429c27(0x95)]===0x0&&!_0x12370b[_0x429c27(0x9a)])throw new Error(_0x429c27(0x8a));if(_0x12370b[_0x429c27(0x9a)]){if(_0x12370b['segments'][0x0]==='..')throw new Error(_0x429c27(0x80));let _0x156fb5=0x0;for(const _0x4dc249 of _0x12370b[_0x429c27(0x89)]){if(_0x4dc249==='..'){if(_0x156fb5===0x0)throw new Error(_0x429c27(0x98));_0x156fb5--;}else _0x4dc249!=='.'&&_0x156fb5++;}}}export function joinPaths(_0x4b4c86,_0x1cd24f){const _0x1afa8b=a154_0x24ab;if(!_0x4b4c86||_0x4b4c86==='/')return _0x1cd24f;if(!_0x1cd24f||_0x1cd24f==='.')return _0x4b4c86;if(_0x1cd24f[_0x1afa8b(0x7d)]('/'))return _0x1cd24f;const _0x4ba3c=parsePath(_0x4b4c86),_0x20fe16=parsePath(_0x1cd24f),_0x26370c=[..._0x4ba3c[_0x1afa8b(0x89)]];for(const _0x2fc63c of _0x20fe16[_0x1afa8b(0x89)]){if(_0x2fc63c==='.')continue;else{if(_0x2fc63c==='..'){if(_0x26370c[_0x1afa8b(0x95)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x26370c['pop']();}else _0x26370c[_0x1afa8b(0x7e)](_0x2fc63c);}}const _0x46e902=_0x26370c[_0x1afa8b(0x86)]('/');return _0x4ba3c['raw']['startsWith']('/')?'/'+_0x46e902:_0x46e902;}function a154_0x24ab(_0x5c8dc1,_0x1e2e7a){_0x5c8dc1=_0x5c8dc1-0x6f;const _0x515b7e=a154_0x515b();let _0x24abb3=_0x515b7e[_0x5c8dc1];return _0x24abb3;}export function normalizePath(_0x4a0b0f){const _0x3c6a30=a154_0x24ab,_0x527fcf=parsePath(_0x4a0b0f),_0x45aed5=[];for(const _0x3c362b of _0x527fcf[_0x3c6a30(0x89)]){if(_0x3c362b==='.')continue;else{if(_0x3c362b==='..'){if(_0x45aed5[_0x3c6a30(0x95)]===0x0){if(_0x527fcf[_0x3c6a30(0x9a)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x45aed5[_0x3c6a30(0x7e)]('..');}else _0x45aed5[_0x45aed5[_0x3c6a30(0x95)]-0x1]==='..'?_0x45aed5[_0x3c6a30(0x7e)]('..'):_0x45aed5[_0x3c6a30(0x8e)]();}else _0x45aed5[_0x3c6a30(0x7e)](_0x3c362b);}}if(_0x45aed5[_0x3c6a30(0x95)]===0x0)return _0x527fcf[_0x3c6a30(0x9a)]?'/':'.';const _0x1f9b17=_0x45aed5[_0x3c6a30(0x86)]('/');return _0x527fcf['raw']['startsWith']('/')?'/'+_0x1f9b17:_0x1f9b17;}export function getParentPath(_0x4b1fa4){const _0x9ee542=a154_0x24ab,_0x332818=parsePath(_0x4b1fa4);if(_0x332818[_0x9ee542(0x89)][_0x9ee542(0x95)]<=0x1)return'/';const _0x1913ef=_0x332818[_0x9ee542(0x89)][_0x9ee542(0x7c)](0x0,-0x1)[_0x9ee542(0x86)]('/');return _0x332818['raw'][_0x9ee542(0x7d)]('/')?'/'+_0x1913ef:_0x1913ef;}export function getBaseName(_0x2bca25){const _0x4fd2fe=a154_0x24ab,_0x3c5ad2=parsePath(_0x2bca25);return _0x3c5ad2[_0x4fd2fe(0x89)][_0x3c5ad2[_0x4fd2fe(0x89)][_0x4fd2fe(0x95)]-0x1]||'';}export function isChildPath(_0x275d6b,_0x34af39){const _0x370fe2=a154_0x24ab,_0x132620=parsePath(_0x275d6b),_0x3fbc18=parsePath(_0x34af39);if(_0x132620[_0x370fe2(0x89)][_0x370fe2(0x95)]<=_0x3fbc18['segments'][_0x370fe2(0x95)])return![];for(let _0x507548=0x0;_0x507548<_0x3fbc18[_0x370fe2(0x89)]['length'];_0x507548++){if(_0x132620[_0x370fe2(0x89)][_0x507548]!==_0x3fbc18[_0x370fe2(0x89)][_0x507548])return![];}return!![];}export function splitPath(_0x5c7450){const _0x35ebdf=a154_0x24ab,_0x2d0b8f=parsePath(_0x5c7450);if(_0x2d0b8f[_0x35ebdf(0x89)]['length']===0x0)throw new Error(_0x35ebdf(0x7b));if(_0x2d0b8f[_0x35ebdf(0x89)][_0x35ebdf(0x95)]===0x1)return{'parent':_0x2d0b8f['segments'][0x0]};return{'parent':_0x2d0b8f['segments'][0x0],'child':_0x2d0b8f[_0x35ebdf(0x89)]['slice'](0x1)[_0x35ebdf(0x86)]('/')};}function a154_0x515b(){const _0x42570e=['relative','readFile','resolve','endsWith','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','File\x20not\x20found:\x20','parse','replace','9idbAvL','1028434gcHvbW','533044xfWFrn','type','parent_segment','Cannot\x20split\x20empty\x20path','slice','startsWith','push','trim','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','6415JEkHiH','11311430fgayJE','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','5432kfFieJ','tdx.json','join','filter','1122840vNiWpW','segments','Relative\x20path\x20cannot\x20be\x20empty','substring','No\x20tdx.json\x20found\x20for\x20file:\x20','4170453fGebNe','pop','4050mGArWx','Path\x20segment\x20cannot\x20be\x20empty','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','test','3598hboMXC','split','length','dirname','Path\x20cannot\x20be\x20empty','Path\x20attempts\x20to\x20navigate\x20above\x20root','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','isAbsolute'];a154_0x515b=function(){return _0x42570e;};return a154_0x515b();}export function isYamlFilePath(_0x3946ff){const _0x4e258b=a154_0x24ab;return _0x3946ff[_0x4e258b(0x71)]('.yml')||_0x3946ff['endsWith']('.yaml');}export async function resolveYamlFilePath(_0x344934,_0x9bf83e=nodeFileSystem){const _0x4cca1e=a154_0x24ab,_0x18002a=a154_0x51d8a4[_0x4cca1e(0x70)](_0x344934);if(!await _0x9bf83e['exists'](_0x18002a))throw new Error(_0x4cca1e(0x73)+_0x344934);let _0x51fd37=a154_0x51d8a4['dirname'](_0x18002a),_0x5291df=null,_0x15a947=null;const _0x20c4fc=a154_0x51d8a4[_0x4cca1e(0x74)](_0x51fd37)['root'];while(_0x51fd37!==_0x20c4fc){const _0x13de2e=a154_0x51d8a4['join'](_0x51fd37,_0x4cca1e(0x85));if(await _0x9bf83e['exists'](_0x13de2e)){_0x5291df=_0x13de2e,_0x15a947=_0x51fd37;break;}_0x51fd37=a154_0x51d8a4[_0x4cca1e(0x96)](_0x51fd37);}if(!_0x5291df||!_0x15a947)throw new Error(_0x4cca1e(0x8c)+_0x344934+'\x0a'+_0x4cca1e(0x91));const _0x38fb8f=await _0x9bf83e[_0x4cca1e(0x6f)](_0x5291df),_0x4c912a=JSON[_0x4cca1e(0x74)](_0x38fb8f),_0x5a759c=_0x4c912a[_0x4cca1e(0x7a)];if(!_0x5a759c)throw new Error(_0x4cca1e(0x99));const _0x5ed1d7=await _0x9bf83e['readFile'](_0x18002a),_0x109be4=a154_0x58c943(_0x5ed1d7),_0x17fd17=_0x109be4['name'];if(!_0x17fd17)throw new Error(_0x4cca1e(0x72)+_0x344934);const _0x186b0e=_0x109be4[_0x4cca1e(0x79)]==='journey'?'journey':'segment',_0x242fec=a154_0x51d8a4[_0x4cca1e(0x9b)](_0x15a947,_0x18002a),_0x2f53a9=a154_0x51d8a4[_0x4cca1e(0x96)](_0x242fec),_0x4d1ff9=_0x2f53a9==='.'?'':_0x2f53a9[_0x4cca1e(0x75)](/\\/g,'/'),_0x5368cc=_0x4d1ff9?_0x5a759c+'/'+_0x4d1ff9+'/'+_0x17fd17:_0x5a759c+'/'+_0x17fd17;return{'parentSegment':_0x5a759c,'segmentName':_0x17fd17,'folderPath':_0x4d1ff9,'fullPath':_0x5368cc,'resourceType':_0x186b0e,'content':_0x5ed1d7};}
@@ -1 +1 @@
1
- function a155_0x3f06(_0x872482,_0x12cb89){_0x872482=_0x872482-0x187;const _0x427950=a155_0x4279();let _0x3f062c=_0x427950[_0x872482];return _0x3f062c;}(function(_0x5decb3,_0x33c9cb){const _0x4222b2=a155_0x3f06,_0x37df07=_0x5decb3();while(!![]){try{const _0xdc7475=parseInt(_0x4222b2(0x193))/0x1+-parseInt(_0x4222b2(0x18c))/0x2+parseInt(_0x4222b2(0x189))/0x3*(-parseInt(_0x4222b2(0x187))/0x4)+-parseInt(_0x4222b2(0x18d))/0x5+-parseInt(_0x4222b2(0x188))/0x6*(parseInt(_0x4222b2(0x18f))/0x7)+-parseInt(_0x4222b2(0x18a))/0x8+parseInt(_0x4222b2(0x18e))/0x9;if(_0xdc7475===_0x33c9cb)break;else _0x37df07['push'](_0x37df07['shift']());}catch(_0x18dcd7){_0x37df07['push'](_0x37df07['shift']());}}}(a155_0x4279,0xd8b1b));function a155_0x4279(){const _0x57e35f=['2006872GDOiPU','Invalid\x20segment\x20reference\x20format:\x20','294878SZMGQn','6346550PFUBqq','41343867jbgEfE','7946666cIujpz','substring','.\x20Child\x20name\x20cannot\x20be\x20empty','.\x20Parent\x20name\x20cannot\x20be\x20empty','610652JRJEWC','4NtdbTc','6lPlUiq','4541970lNMUSJ'];a155_0x4279=function(){return _0x57e35f;};return a155_0x4279();}export function parseSegmentRef(_0x25cfc7){const _0x1267f9=a155_0x3f06,_0x402f75=_0x25cfc7['indexOf']('/');if(_0x402f75===-0x1)return{'parentId':_0x25cfc7};if(_0x402f75===0x0)throw new Error(_0x1267f9(0x18b)+_0x25cfc7+_0x1267f9(0x192));const _0x2aa08c=_0x25cfc7[_0x1267f9(0x190)](0x0,_0x402f75),_0x50d5e5=_0x25cfc7['substring'](_0x402f75+0x1);if(_0x50d5e5==='')throw new Error(_0x1267f9(0x18b)+_0x25cfc7+_0x1267f9(0x191));return{'parentId':_0x2aa08c,'childId':_0x50d5e5};}
1
+ function a155_0x19fe(){const _0x19bca3=['40OTSqBP','Invalid\x20segment\x20reference\x20format:\x20','245579IIKZvl','substring','355792Zlqscw','1522509RmJKFG','1728yMwqRF','indexOf','.\x20Child\x20name\x20cannot\x20be\x20empty','48663HbYxIP','4626408CVKsIw','2366846VkpQSD','6988863FQJdGL','.\x20Parent\x20name\x20cannot\x20be\x20empty'];a155_0x19fe=function(){return _0x19bca3;};return a155_0x19fe();}(function(_0x5468f2,_0x1cf0ea){const _0x1fa558=a155_0x184c,_0x578187=_0x5468f2();while(!![]){try{const _0x31ae5e=parseInt(_0x1fa558(0x1f2))/0x1+parseInt(_0x1fa558(0x1fb))/0x2+parseInt(_0x1fa558(0x1f5))/0x3+-parseInt(_0x1fa558(0x1f4))/0x4*(parseInt(_0x1fa558(0x1f0))/0x5)+-parseInt(_0x1fa558(0x1fa))/0x6+-parseInt(_0x1fa558(0x1ee))/0x7+-parseInt(_0x1fa558(0x1f6))/0x8*(-parseInt(_0x1fa558(0x1f9))/0x9);if(_0x31ae5e===_0x1cf0ea)break;else _0x578187['push'](_0x578187['shift']());}catch(_0x433f78){_0x578187['push'](_0x578187['shift']());}}}(a155_0x19fe,0x982fc));function a155_0x184c(_0x471bb0,_0x48d2b1){_0x471bb0=_0x471bb0-0x1ee;const _0x19fe9d=a155_0x19fe();let _0x184c5e=_0x19fe9d[_0x471bb0];return _0x184c5e;}export function parseSegmentRef(_0x2b847a){const _0x51924e=a155_0x184c,_0x26cd39=_0x2b847a[_0x51924e(0x1f7)]('/');if(_0x26cd39===-0x1)return{'parentId':_0x2b847a};if(_0x26cd39===0x0)throw new Error(_0x51924e(0x1f1)+_0x2b847a+_0x51924e(0x1ef));const _0x981fc7=_0x2b847a[_0x51924e(0x1f3)](0x0,_0x26cd39),_0x29cead=_0x2b847a[_0x51924e(0x1f3)](_0x26cd39+0x1);if(_0x29cead==='')throw new Error(_0x51924e(0x1f1)+_0x2b847a+_0x51924e(0x1f8));return{'parentId':_0x981fc7,'childId':_0x29cead};}
@@ -1 +1 @@
1
- (function(_0x6e9ab9,_0xa95d5b){const _0x2876f7=a156_0x549b,_0xcac8d=_0x6e9ab9();while(!![]){try{const _0x16db4f=-parseInt(_0x2876f7(0x133))/0x1*(-parseInt(_0x2876f7(0xf5))/0x2)+-parseInt(_0x2876f7(0x119))/0x3+parseInt(_0x2876f7(0x12c))/0x4*(parseInt(_0x2876f7(0x122))/0x5)+parseInt(_0x2876f7(0xf7))/0x6+-parseInt(_0x2876f7(0x11e))/0x7+-parseInt(_0x2876f7(0x130))/0x8*(-parseInt(_0x2876f7(0xf3))/0x9)+parseInt(_0x2876f7(0x129))/0xa*(-parseInt(_0x2876f7(0x11c))/0xb);if(_0x16db4f===_0xa95d5b)break;else _0xcac8d['push'](_0xcac8d['shift']());}catch(_0x35d555){_0xcac8d['push'](_0xcac8d['shift']());}}}(a156_0x8462,0x52357));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x1ed157,_0x76a54e={},_0x4c86fa={}){const _0x50318e=a156_0x549b;if(_0x4c86fa['skipSchema'])return runSemanticChecks(_0x1ed157,_0x76a54e);const _0x5900e4=SegmentDefSchema[_0x50318e(0x104)](_0x1ed157);if(_0x5900e4[_0x50318e(0xfe)])return runSemanticChecks(_0x5900e4[_0x50318e(0x111)],_0x76a54e);return zodErrorsToValidationResult(_0x5900e4['error'],_0x76a54e);}export function validateRuleDef(_0x45ef37,_0x1fa11c,_0x135200){const _0x21b8c6=a156_0x549b;if(!_0x45ef37)return[];const _0x4a804a=RuleDefSchema['safeParse'](_0x45ef37);if(_0x4a804a['success'])return checkRule(_0x4a804a['data'],_0x1fa11c,_0x135200);const _0x50455f=flattenZodIssues(_0x4a804a[_0x21b8c6(0x123)][_0x21b8c6(0x103)]);return _0x50455f[_0x21b8c6(0x115)](_0x47293c=>{const _0x55dcfd=_0x21b8c6,_0x39aa2b=formatZodPath(_0x47293c['path']),_0x5adc5e=_0x39aa2b?_0x1fa11c+'.'+_0x39aa2b:_0x1fa11c,_0x23f73e=mapZodIssueToCode(_0x47293c,_0x39aa2b),_0xc3f597=getLocationFromPath(_0x135200[_0x55dcfd(0x106)],_0x135200[_0x55dcfd(0x135)],pathToArray(_0x5adc5e));return{'level':_0x55dcfd(0x123),'path':_0x5adc5e,'code':_0x23f73e,'message':_0x47293c[_0x55dcfd(0x109)],..._0xc3f597&&{'location':_0xc3f597}};});}function zodErrorsToValidationResult(_0x358004,_0x3ae98b){const _0x5dabc4=a156_0x549b,_0x47a39e=flattenZodIssues(_0x358004[_0x5dabc4(0x103)]),_0x2b2dee=_0x47a39e[_0x5dabc4(0x115)](_0x582ff5=>{const _0x464637=_0x5dabc4,_0x35a7d3=formatZodPath(_0x582ff5[_0x464637(0xfa)]),_0x370a48=mapZodIssueToCode(_0x582ff5,_0x35a7d3),_0x48ddae=getLocationFromPath(_0x3ae98b[_0x464637(0x106)],_0x3ae98b[_0x464637(0x135)],_0x582ff5[_0x464637(0xfa)][_0x464637(0x115)](_0x3fb965=>typeof _0x3fb965===_0x464637(0x118)?String(_0x3fb965):_0x3fb965));return{'level':_0x464637(0x123),'path':_0x35a7d3,'code':_0x370a48,'message':_0x582ff5['message'],..._0x48ddae&&{'location':_0x48ddae}};});return{'valid':![],'errors':_0x2b2dee,'warnings':[]};}function mapZodIssueToCode(_0xa15bf1,_0x39d36f){const _0x3ffa3c=a156_0x549b,_0x3b1461=_0xa15bf1[_0x3ffa3c(0x114)]===_0x3ffa3c(0x110)?_0xa15bf1['params']:undefined;if(_0x39d36f===_0x3ffa3c(0xf4))return _0x3ffa3c(0x108);if(_0x39d36f===_0x3ffa3c(0x128)||_0x39d36f[_0x3ffa3c(0x127)](_0x3ffa3c(0x10e))){if(_0xa15bf1['code']===_0x3ffa3c(0x12b)){if(_0x39d36f==='rule.type'||_0x39d36f['match'](/\.conditions\[\d+\]\.type$/))return _0x3ffa3c(0x12f);}}if(_0x39d36f[_0x3ffa3c(0x127)](_0x3ffa3c(0x12e)))return _0x3ffa3c(0x10c);if(_0x39d36f[_0x3ffa3c(0x127)](_0x3ffa3c(0x101)))return _0x3ffa3c(0xef);if(_0x3b1461?.[_0x3ffa3c(0xf6)]==='MISSING_BETWEEN_BOUNDS')return _0x3ffa3c(0xfc);if(_0x3b1461?.[_0x3ffa3c(0xf6)]===_0x3ffa3c(0x10f))return _0x3ffa3c(0x10f);if(_0x39d36f[_0x3ffa3c(0x127)]('.conditions')||_0x39d36f==='conditions')return _0x3ffa3c(0x10b);if(_0x39d36f[_0x3ffa3c(0xf8)]('arrayMatching'))return _0x3ffa3c(0xf2);if(_0x39d36f['endsWith'](_0x3ffa3c(0x117)))return _0x3ffa3c(0xf1);return _0x3ffa3c(0xed);}function runSemanticChecks(_0xfa88eb,_0x2e9e00){const _0x59f8b5=a156_0x549b,_0x42405a=[];_0xfa88eb['rule']&&_0x42405a[_0x59f8b5(0xf9)](...checkRule(_0xfa88eb[_0x59f8b5(0x132)],_0x59f8b5(0x132),_0x2e9e00));const _0x253af7=_0x42405a[_0x59f8b5(0x11b)](_0x1f96e7=>_0x1f96e7['level']===_0x59f8b5(0x123)),_0x484689=_0x42405a['filter'](_0x2b823e=>_0x2b823e['level']===_0x59f8b5(0x12a));return{'valid':_0x253af7[_0x59f8b5(0x11f)]===0x0,'errors':_0x253af7,'warnings':_0x484689};}function checkRule(_0x37ba27,_0x856e62,_0x1838cf){const _0x2dff8e=a156_0x549b,_0x1acce7=[];if(_0x37ba27['conditions'][_0x2dff8e(0x11f)]===0x0)return _0x1acce7[_0x2dff8e(0xf9)]({'level':_0x2dff8e(0x123),'path':_0x856e62+_0x2dff8e(0x116),'code':_0x2dff8e(0x121),'message':_0x2dff8e(0xec),'location':getLocationFromPath(_0x1838cf['document'],_0x1838cf['source'],pathToArray(_0x856e62+'.conditions'))}),_0x1acce7;return _0x1acce7[_0x2dff8e(0xf9)](...checkConditions(_0x37ba27[_0x2dff8e(0x102)],_0x856e62,_0x1838cf)),_0x1acce7;}function checkConditions(_0xe10916,_0x4bf955,_0x548fd5){const _0x27607f=a156_0x549b,_0x53f2cf=[];for(let _0x2b9bc3=0x0;_0x2b9bc3<_0xe10916[_0x27607f(0x11f)];_0x2b9bc3++){const _0x511699=_0xe10916[_0x2b9bc3],_0x59f1ea=_0x4bf955+_0x27607f(0xee)+_0x2b9bc3+']';_0x53f2cf[_0x27607f(0xf9)](...checkCondition(_0x511699,_0x59f1ea,_0x548fd5));}return _0x53f2cf;}function checkCondition(_0x590ab8,_0x273d16,_0x552961){const _0x42782c=a156_0x549b,_0x5b04b0=[];if(_0x590ab8['type']===_0x42782c(0x124)||_0x590ab8['type']==='Or'){if(_0x590ab8['conditions'][_0x42782c(0x11f)]===0x0)_0x5b04b0[_0x42782c(0xf9)]({'level':_0x42782c(0x123),'path':_0x273d16+_0x42782c(0x116),'code':'EMPTY_CONDITIONS','message':_0x590ab8[_0x42782c(0x10d)]+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x552961['document'],_0x552961[_0x42782c(0x135)],pathToArray(_0x273d16+'.conditions'))});else{const _0x38b7b2=_0x590ab8[_0x42782c(0x113)]!==undefined;!_0x38b7b2&&_0x5b04b0[_0x42782c(0xf9)]({'level':_0x42782c(0x12a),'path':_0x273d16,'code':_0x42782c(0xff),'message':_0x590ab8[_0x42782c(0x10d)]+_0x42782c(0x12d)+_0x42782c(0x126)+_0x42782c(0xeb),'location':getLocationFromPath(_0x552961[_0x42782c(0x106)],_0x552961[_0x42782c(0x135)],pathToArray(_0x273d16))}),_0x5b04b0[_0x42782c(0xf9)](...checkConditions(_0x590ab8[_0x42782c(0x102)],_0x273d16,_0x552961));}return _0x5b04b0;}if(_0x590ab8[_0x42782c(0x10d)]===_0x42782c(0x107)||_0x590ab8[_0x42782c(0x10d)]===_0x42782c(0x134)){const _0x118b84=_0x590ab8,_0x1c3b8b=_0x118b84[_0x42782c(0x135)],_0xe511e7=_0x118b84[_0x42782c(0x11a)],_0xbbca96=_0x1c3b8b||_0xe511e7;(!_0x118b84[_0x42782c(0x120)]||_0x118b84['attribute']==='')&&(!_0xbbca96&&_0x5b04b0['push']({'level':'error','path':_0x273d16+'.attribute','code':'EMPTY_ATTRIBUTE','message':_0x42782c(0x11d),'location':getLocationFromPath(_0x552961['document'],_0x552961[_0x42782c(0x135)],pathToArray(_0x273d16+'.attribute'))}));_0x118b84[_0x42782c(0x11b)]&&_0x5b04b0[_0x42782c(0xf9)](...checkRule(_0x118b84['filter'],_0x273d16+'.filter',_0x552961));if(_0x118b84['source']){const _0x4baec1=_0x118b84[_0x42782c(0x120)]&&_0x118b84[_0x42782c(0x120)]!=='';_0x4baec1&&!_0x118b84[_0x42782c(0x11b)]&&_0x5b04b0['push']({'level':'error','path':_0x273d16+_0x42782c(0xfb),'code':'BEHAVIOR_SOURCE_MISSING_FILTER','message':_0x42782c(0x105)+_0x118b84['source']+_0x42782c(0xf0)+_0x118b84['attribute']+'\x27\x20'+_0x42782c(0xfd)+_0x42782c(0x125)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x552961[_0x42782c(0x106)],_0x552961[_0x42782c(0x135)],pathToArray(_0x273d16+_0x42782c(0xfb)))}),_0x4baec1&&_0x118b84[_0x42782c(0x11b)]&&_0x5b04b0[_0x42782c(0xf9)]({'level':_0x42782c(0x12a),'path':_0x273d16+'.attribute','code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x42782c(0x112)+_0x118b84['attribute']+_0x42782c(0x10a)+_0x42782c(0x131),'location':getLocationFromPath(_0x552961[_0x42782c(0x106)],_0x552961[_0x42782c(0x135)],pathToArray(_0x273d16+_0x42782c(0x100)))});}}return _0x5b04b0;}function a156_0x549b(_0x57cd4a,_0x5690a2){_0x57cd4a=_0x57cd4a-0xeb;const _0x84629e=a156_0x8462();let _0x549bff=_0x84629e[_0x57cd4a];return _0x549bff;}function a156_0x8462(){const _0x22b58b=['attribute','EMPTY_CONDITIONS','1345845oUVPJb','error','And','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','endsWith','rule.type','2932130RdWecx','warning','invalid_value','4PQCBsB','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','.operator.type','INVALID_RULE_TYPE','8cgPphb','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','rule','145687zfZLSL','Behavior','source','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','SEGMENT_SCHEMA_ERROR','.conditions[','MISSING_OPERATOR_VALUE','\x27\x20with\x20attribute\x20\x27','MISSING_SEGMENT_REFERENCE','INVALID_ARRAY_MATCHING','4487157zjFmmU','name','8AyotFE','validationCode','3402972OlwKHX','includes','push','path','.source','MISSING_BETWEEN_BOUNDS','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','success','NESTED_CONDITION_GROUP','.attribute','.operator.value','conditions','issues','safeParse','Behavior\x20source\x20\x27','document','Value','MISSING_NAME','message','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','MISSING_CONDITIONS','INVALID_OPERATOR_TYPE','type','.type','MISSING_TIME_UNIT','custom','data','Attribute\x20\x27','description','code','map','.conditions','.segment','symbol','1863654Rdhlbv','aggregation','filter','22cWzqKQ','Attribute\x20name\x20cannot\x20be\x20empty','2612967DDGMfG','length'];a156_0x8462=function(){return _0x22b58b;};return a156_0x8462();}
1
+ (function(_0xa9dbe5,_0xecd0de){const _0x2e33b8=a156_0x4cbf,_0x3d1a8a=_0xa9dbe5();while(!![]){try{const _0x3496d1=parseInt(_0x2e33b8(0x1b2))/0x1*(parseInt(_0x2e33b8(0x1dd))/0x2)+parseInt(_0x2e33b8(0x1ad))/0x3*(parseInt(_0x2e33b8(0x19d))/0x4)+-parseInt(_0x2e33b8(0x1d6))/0x5*(parseInt(_0x2e33b8(0x1a6))/0x6)+-parseInt(_0x2e33b8(0x1c2))/0x7*(-parseInt(_0x2e33b8(0x1bb))/0x8)+parseInt(_0x2e33b8(0x1e0))/0x9*(-parseInt(_0x2e33b8(0x1d3))/0xa)+-parseInt(_0x2e33b8(0x1cb))/0xb+parseInt(_0x2e33b8(0x1b1))/0xc*(parseInt(_0x2e33b8(0x1c5))/0xd);if(_0x3496d1===_0xecd0de)break;else _0x3d1a8a['push'](_0x3d1a8a['shift']());}catch(_0x2515c3){_0x3d1a8a['push'](_0x3d1a8a['shift']());}}}(a156_0x1b61,0x68b48));function a156_0x4cbf(_0x197238,_0xb46f04){_0x197238=_0x197238-0x198;const _0x1b615b=a156_0x1b61();let _0x4cbf08=_0x1b615b[_0x197238];return _0x4cbf08;}import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';function a156_0x1b61(){const _0x5eb004=['MISSING_NAME','11470IIgjoA','INVALID_OPERATOR_TYPE','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','42561YMJrtk','conditions','path','MISSING_CONDITIONS','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','map','INVALID_RULE_TYPE','.conditions[','1684RVSzJo','issues','message','aggregation','rule','level','.type','EMPTY_ATTRIBUTE','Attribute\x20\x27','6tlNLzY','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','document','rule.type','Behavior','attribute','15zeqzfn','MISSING_TIME_UNIT','INVALID_ARRAY_MATCHING','safeParse','30684cUOaSV','37tIRFIF','MISSING_OPERATOR_VALUE','BEHAVIOR_SOURCE_MISSING_FILTER','success','skipSchema','type','data','MISSING_BETWEEN_BOUNDS','endsWith','2520eXpuAF','.attribute','length','MISSING_SEGMENT_REFERENCE','\x27\x20with\x20attribute\x20\x27','error','source','18529DcviqA','match','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','6383oWQwqC','code','.source','custom','includes','And','3600916xZwYzF','params','filter','Value','SEGMENT_SCHEMA_ERROR','.operator.value','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','arrayMatching','1670vWIPVR','warning','name','3788105RWpwSW','push','validationCode','.conditions','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','EMPTY_CONDITIONS'];a156_0x1b61=function(){return _0x5eb004;};return a156_0x1b61();}export function validateSegmentDef(_0x360958,_0x3e52c0={},_0x3ffc59={}){const _0x1d5809=a156_0x4cbf;if(_0x3ffc59[_0x1d5809(0x1b6)])return runSemanticChecks(_0x360958,_0x3e52c0);const _0x27524e=SegmentDefSchema[_0x1d5809(0x1b0)](_0x360958);if(_0x27524e[_0x1d5809(0x1b5)])return runSemanticChecks(_0x27524e[_0x1d5809(0x1b8)],_0x3e52c0);return zodErrorsToValidationResult(_0x27524e[_0x1d5809(0x1c0)],_0x3e52c0);}export function validateRuleDef(_0x240cc6,_0x548dec,_0xfed57e){const _0x4c28ce=a156_0x4cbf;if(!_0x240cc6)return[];const _0x689f9d=RuleDefSchema[_0x4c28ce(0x1b0)](_0x240cc6);if(_0x689f9d[_0x4c28ce(0x1b5)])return checkRule(_0x689f9d[_0x4c28ce(0x1b8)],_0x548dec,_0xfed57e);const _0x44df03=flattenZodIssues(_0x689f9d[_0x4c28ce(0x1c0)]['issues']);return _0x44df03[_0x4c28ce(0x19a)](_0x2df2bb=>{const _0x487614=_0x4c28ce,_0x5bffdc=formatZodPath(_0x2df2bb['path']),_0x3acd46=_0x5bffdc?_0x548dec+'.'+_0x5bffdc:_0x548dec,_0x2d8729=mapZodIssueToCode(_0x2df2bb,_0x5bffdc),_0x53ffea=getLocationFromPath(_0xfed57e[_0x487614(0x1a9)],_0xfed57e[_0x487614(0x1c1)],pathToArray(_0x3acd46));return{'level':'error','path':_0x3acd46,'code':_0x2d8729,'message':_0x2df2bb[_0x487614(0x19f)],..._0x53ffea&&{'location':_0x53ffea}};});}function zodErrorsToValidationResult(_0x47f4fd,_0x126f6c){const _0x70514=a156_0x4cbf,_0x3b3650=flattenZodIssues(_0x47f4fd[_0x70514(0x19e)]),_0x23646f=_0x3b3650['map'](_0x3b8405=>{const _0x550e63=_0x70514,_0x49a254=formatZodPath(_0x3b8405[_0x550e63(0x1e2)]),_0x51713a=mapZodIssueToCode(_0x3b8405,_0x49a254),_0x292fb8=getLocationFromPath(_0x126f6c['document'],_0x126f6c[_0x550e63(0x1c1)],_0x3b8405[_0x550e63(0x1e2)]['map'](_0x4a1e16=>typeof _0x4a1e16==='symbol'?String(_0x4a1e16):_0x4a1e16));return{'level':_0x550e63(0x1c0),'path':_0x49a254,'code':_0x51713a,'message':_0x3b8405[_0x550e63(0x19f)],..._0x292fb8&&{'location':_0x292fb8}};});return{'valid':![],'errors':_0x23646f,'warnings':[]};}function mapZodIssueToCode(_0x16de76,_0x25e301){const _0x56793c=a156_0x4cbf,_0x2d2fb1=_0x16de76[_0x56793c(0x1c6)]===_0x56793c(0x1c8)?_0x16de76[_0x56793c(0x1cc)]:undefined;if(_0x25e301===_0x56793c(0x1d5))return _0x56793c(0x1dc);if(_0x25e301===_0x56793c(0x1aa)||_0x25e301[_0x56793c(0x1ba)](_0x56793c(0x1a3))){if(_0x16de76[_0x56793c(0x1c6)]==='invalid_value'){if(_0x25e301===_0x56793c(0x1aa)||_0x25e301[_0x56793c(0x1c3)](/\.conditions\[\d+\]\.type$/))return _0x56793c(0x19b);}}if(_0x25e301[_0x56793c(0x1ba)]('.operator.type'))return _0x56793c(0x1de);if(_0x25e301['endsWith'](_0x56793c(0x1d0)))return _0x56793c(0x1b3);if(_0x2d2fb1?.[_0x56793c(0x1d8)]==='MISSING_BETWEEN_BOUNDS')return _0x56793c(0x1b9);if(_0x2d2fb1?.[_0x56793c(0x1d8)]===_0x56793c(0x1ae))return'MISSING_TIME_UNIT';if(_0x25e301[_0x56793c(0x1ba)]('.conditions')||_0x25e301===_0x56793c(0x1e1))return _0x56793c(0x198);if(_0x25e301[_0x56793c(0x1c9)](_0x56793c(0x1d2)))return _0x56793c(0x1af);if(_0x25e301[_0x56793c(0x1ba)]('.segment'))return _0x56793c(0x1be);return _0x56793c(0x1cf);}function runSemanticChecks(_0x22c0dc,_0x258f65){const _0x424228=a156_0x4cbf,_0x2ba9af=[];_0x22c0dc[_0x424228(0x1a1)]&&_0x2ba9af[_0x424228(0x1d7)](...checkRule(_0x22c0dc[_0x424228(0x1a1)],_0x424228(0x1a1),_0x258f65));const _0x5922fb=_0x2ba9af[_0x424228(0x1cd)](_0x2a31c4=>_0x2a31c4[_0x424228(0x1a2)]==='error'),_0x5c2de0=_0x2ba9af[_0x424228(0x1cd)](_0xbdddf2=>_0xbdddf2[_0x424228(0x1a2)]==='warning');return{'valid':_0x5922fb[_0x424228(0x1bd)]===0x0,'errors':_0x5922fb,'warnings':_0x5c2de0};}function checkRule(_0x238a32,_0x1c95e8,_0x5f5373){const _0x2b30f1=a156_0x4cbf,_0x160d07=[];if(_0x238a32[_0x2b30f1(0x1e1)][_0x2b30f1(0x1bd)]===0x0)return _0x160d07[_0x2b30f1(0x1d7)]({'level':'error','path':_0x1c95e8+'.conditions','code':_0x2b30f1(0x1db),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x5f5373[_0x2b30f1(0x1a9)],_0x5f5373['source'],pathToArray(_0x1c95e8+_0x2b30f1(0x1d9)))}),_0x160d07;return _0x160d07[_0x2b30f1(0x1d7)](...checkConditions(_0x238a32[_0x2b30f1(0x1e1)],_0x1c95e8,_0x5f5373)),_0x160d07;}function checkConditions(_0x12ded9,_0xaff2cb,_0x34ddc1){const _0x28761=a156_0x4cbf,_0x39004a=[];for(let _0x337fda=0x0;_0x337fda<_0x12ded9[_0x28761(0x1bd)];_0x337fda++){const _0x4b31e5=_0x12ded9[_0x337fda],_0x32d449=_0xaff2cb+_0x28761(0x19c)+_0x337fda+']';_0x39004a[_0x28761(0x1d7)](...checkCondition(_0x4b31e5,_0x32d449,_0x34ddc1));}return _0x39004a;}function checkCondition(_0x427d49,_0x555043,_0x339ca6){const _0x5ef67e=a156_0x4cbf,_0x32793f=[];if(_0x427d49[_0x5ef67e(0x1b7)]===_0x5ef67e(0x1ca)||_0x427d49[_0x5ef67e(0x1b7)]==='Or'){if(_0x427d49[_0x5ef67e(0x1e1)][_0x5ef67e(0x1bd)]===0x0)_0x32793f[_0x5ef67e(0x1d7)]({'level':'error','path':_0x555043+_0x5ef67e(0x1d9),'code':_0x5ef67e(0x1db),'message':_0x427d49[_0x5ef67e(0x1b7)]+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x339ca6[_0x5ef67e(0x1a9)],_0x339ca6[_0x5ef67e(0x1c1)],pathToArray(_0x555043+_0x5ef67e(0x1d9)))});else{const _0x214a98=_0x427d49['description']!==undefined;!_0x214a98&&_0x32793f[_0x5ef67e(0x1d7)]({'level':_0x5ef67e(0x1d4),'path':_0x555043,'code':'NESTED_CONDITION_GROUP','message':_0x427d49[_0x5ef67e(0x1b7)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x5ef67e(0x1a7)+_0x5ef67e(0x1da),'location':getLocationFromPath(_0x339ca6['document'],_0x339ca6[_0x5ef67e(0x1c1)],pathToArray(_0x555043))}),_0x32793f['push'](...checkConditions(_0x427d49['conditions'],_0x555043,_0x339ca6));}return _0x32793f;}if(_0x427d49[_0x5ef67e(0x1b7)]===_0x5ef67e(0x1ce)||_0x427d49[_0x5ef67e(0x1b7)]===_0x5ef67e(0x1ab)){const _0x1dd1ab=_0x427d49,_0x18180a=_0x1dd1ab[_0x5ef67e(0x1c1)],_0x1f95aa=_0x1dd1ab[_0x5ef67e(0x1a0)],_0x37e0b2=_0x18180a||_0x1f95aa;(!_0x1dd1ab[_0x5ef67e(0x1ac)]||_0x1dd1ab['attribute']==='')&&(!_0x37e0b2&&_0x32793f[_0x5ef67e(0x1d7)]({'level':_0x5ef67e(0x1c0),'path':_0x555043+'.attribute','code':_0x5ef67e(0x1a4),'message':'Attribute\x20name\x20cannot\x20be\x20empty','location':getLocationFromPath(_0x339ca6['document'],_0x339ca6[_0x5ef67e(0x1c1)],pathToArray(_0x555043+_0x5ef67e(0x1bc)))}));_0x1dd1ab[_0x5ef67e(0x1cd)]&&_0x32793f['push'](...checkRule(_0x1dd1ab[_0x5ef67e(0x1cd)],_0x555043+'.filter',_0x339ca6));if(_0x1dd1ab['source']){const _0x225a7c=_0x1dd1ab[_0x5ef67e(0x1ac)]&&_0x1dd1ab[_0x5ef67e(0x1ac)]!=='';_0x225a7c&&!_0x1dd1ab[_0x5ef67e(0x1cd)]&&_0x32793f['push']({'level':_0x5ef67e(0x1c0),'path':_0x555043+_0x5ef67e(0x1c7),'code':_0x5ef67e(0x1b4),'message':'Behavior\x20source\x20\x27'+_0x1dd1ab['source']+_0x5ef67e(0x1bf)+_0x1dd1ab['attribute']+'\x27\x20'+_0x5ef67e(0x1c4)+_0x5ef67e(0x1d1)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x339ca6[_0x5ef67e(0x1a9)],_0x339ca6[_0x5ef67e(0x1c1)],pathToArray(_0x555043+_0x5ef67e(0x1c7)))}),_0x225a7c&&_0x1dd1ab['filter']&&_0x32793f[_0x5ef67e(0x1d7)]({'level':_0x5ef67e(0x1d4),'path':_0x555043+_0x5ef67e(0x1bc),'code':_0x5ef67e(0x1a8),'message':_0x5ef67e(0x1a5)+_0x1dd1ab[_0x5ef67e(0x1ac)]+_0x5ef67e(0x1df)+_0x5ef67e(0x199),'location':getLocationFromPath(_0x339ca6[_0x5ef67e(0x1a9)],_0x339ca6[_0x5ef67e(0x1c1)],pathToArray(_0x555043+'.attribute'))});}}return _0x32793f;}