@treasuredata/tdx 2026.4.16 → 2026.4.17

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 (220) 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/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x5819a5=a152_0x3568;(function(_0x39876d,_0x377aaf){const _0x1a7e89=a152_0x3568,_0x52983b=_0x39876d();while(!![]){try{const _0x7b4e80=-parseInt(_0x1a7e89(0x1e1))/0x1*(-parseInt(_0x1a7e89(0x10c))/0x2)+-parseInt(_0x1a7e89(0x14b))/0x3*(parseInt(_0x1a7e89(0x1eb))/0x4)+parseInt(_0x1a7e89(0x132))/0x5+parseInt(_0x1a7e89(0x192))/0x6+parseInt(_0x1a7e89(0x120))/0x7*(-parseInt(_0x1a7e89(0x13a))/0x8)+-parseInt(_0x1a7e89(0x13f))/0x9*(parseInt(_0x1a7e89(0x13c))/0xa)+-parseInt(_0x1a7e89(0x1ef))/0xb*(-parseInt(_0x1a7e89(0x11b))/0xc);if(_0x7b4e80===_0x377aaf)break;else _0x52983b['push'](_0x52983b['shift']());}catch(_0x4819fc){_0x52983b['push'](_0x52983b['shift']());}}}(a152_0x1dcf,0x79394));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x5819a5(0x180));export const PENDING_SEGMENT_PREFIX=a152_0x5819a5(0x161);export const PENDING_ACTIVATION_PREFIX=a152_0x5819a5(0x1d1);export function createPendingSegmentId(_0x40e3e2){return''+PENDING_SEGMENT_PREFIX+_0x40e3e2+'__';}export function isPendingSegmentId(_0x1d070f){const _0x365bea=a152_0x5819a5;return _0x1d070f[_0x365bea(0x177)](PENDING_SEGMENT_PREFIX)&&!_0x1d070f[_0x365bea(0x177)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x56bb7e){return _0x56bb7e['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x48fea9){return''+PENDING_ACTIVATION_PREFIX+_0x48fea9+'__';}export function isPendingActivationId(_0xb96df9){const _0x25015a=a152_0x5819a5;return _0xb96df9[_0x25015a(0x177)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x4e82b2){const _0x4fc544=a152_0x5819a5;return _0x4e82b2[_0x4fc544(0x122)](/^__pending_act_(.+)__$/,'$1');}function a152_0x3568(_0x2970a2,_0x2ecdb5){_0x2970a2=_0x2970a2-0xfc;const _0x1dcf34=a152_0x1dcf();let _0x35684c=_0x1dcf34[_0x2970a2];return _0x35684c;}export function generateDeterministicJourneySegmentName(_0xf558f6,_0x1db505){const _0x17aae9=a152_0x5819a5,_0x4ad0da=_0xf558f6+'::'+(_0x1db505['trim']()||'segment'),_0xc4b295=createHash('sha1')[_0x17aae9(0x1bf)](_0x4ad0da)[_0x17aae9(0x19d)](_0x17aae9(0x136))['slice'](0x0,0xc);return'journey_entry_criteria_'+_0xc4b295;}export function ensureJourneyDefaults(_0x2daada){const _0x17c3e8=a152_0x5819a5;!_0x2daada[_0x17c3e8(0x197)]&&(_0x2daada[_0x17c3e8(0x197)]=''),!_0x2daada[_0x17c3e8(0x1cd)]&&(_0x2daada[_0x17c3e8(0x1cd)]=_0x17c3e8(0x191));}export function injectExistingStageIds(_0x2dbaa1,_0x41ce25){const _0xb06a08=a152_0x5819a5,_0x314a9c=new Map(_0x41ce25[_0xb06a08(0x1fc)](_0x322618=>[_0x322618[_0xb06a08(0x1a3)],_0x322618['id']]));for(const _0x4904a7 of _0x2dbaa1){if(!_0x4904a7['id']){const _0x3aa25b=_0x314a9c[_0xb06a08(0x1d9)](_0x4904a7[_0xb06a08(0x1a3)]);_0x3aa25b&&(_0x4904a7['id']=_0x3aa25b);}}}export function resolveTDFolderPath(_0x55fcc3,_0x424290,_0x210df1){if(!_0x424290)return _0x55fcc3;if(_0x55fcc3===_0x210df1||_0x55fcc3['startsWith'](_0x210df1+'/'))return _0x55fcc3;return _0x55fcc3?_0x210df1+'/'+_0x55fcc3:_0x210df1;}export function addFoldersToCreate(_0x506ba4,_0x2c5b3e,_0x1bd5db){const _0x426cfe=a152_0x5819a5;if(!_0x506ba4)return;if(_0x2c5b3e[_0x426cfe(0x1e3)](_0x506ba4))return;const _0x277135=_0x506ba4['split']('/');let _0x2626e1='';for(const _0x15e7b7 of _0x277135){_0x2626e1=_0x2626e1?_0x2626e1+'/'+_0x15e7b7:_0x15e7b7,!_0x2c5b3e[_0x426cfe(0x1e3)](_0x2626e1)&&_0x1bd5db[_0x426cfe(0x1ff)](_0x2626e1);}}export function sortFoldersByDepth(_0x2932c0){const _0x21ef0c=a152_0x5819a5;return[..._0x2932c0][_0x21ef0c(0x1c1)]((_0x13a78e,_0x52a5b8)=>{const _0x89ebf4=_0x21ef0c,_0x1e8201=(_0x13a78e[_0x89ebf4(0x1fb)](/\//g)||[])['length'],_0x4e93d3=(_0x52a5b8[_0x89ebf4(0x1fb)](/\//g)||[])[_0x89ebf4(0x19b)];return _0x1e8201-_0x4e93d3;});}import*as a152_0x27a142 from'yaml';import{readFileSync}from'fs';import a152_0x322d4e from'path';import{isJourneyDef,parseYamlString as a152_0x4dcb37,toYamlString as a152_0x42e94e,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(_0x11a70d){const _0x2128d5=a152_0x5819a5;if(Array[_0x2128d5(0x102)](_0x11a70d))return'['+_0x11a70d['map'](_0x86d337=>stableStringify(_0x86d337))[_0x2128d5(0x110)](',')+']';if(_0x11a70d&&typeof _0x11a70d==='object'){const _0x590caf=_0x11a70d,_0x3d3137=Object[_0x2128d5(0x101)](_0x590caf)['sort'](),_0x2de351=_0x3d3137[_0x2128d5(0x1fc)](_0x48e7b7=>'\x22'+_0x48e7b7+'\x22:'+stableStringify(_0x590caf[_0x48e7b7]));return'{'+_0x2de351['join'](',')+'}';}const _0x5dcc40=JSON['stringify'](_0x11a70d);return _0x5dcc40===undefined?'null':_0x5dcc40;}function activationSignature(_0x58c309){const _0x2b3bc9=a152_0x5819a5,_0x5873c4={'connection':_0x58c309[_0x2b3bc9(0x205)],..._0x58c309[_0x2b3bc9(0x13b)]!==undefined&&{'all_columns':_0x58c309[_0x2b3bc9(0x13b)]},..._0x58c309[_0x2b3bc9(0x117)]!==undefined&&{'columns':_0x58c309[_0x2b3bc9(0x117)]},..._0x58c309[_0x2b3bc9(0x109)]!==undefined&&{'behavior':_0x58c309[_0x2b3bc9(0x109)]},..._0x58c309[_0x2b3bc9(0xfe)]!==undefined&&{'schedule':_0x58c309[_0x2b3bc9(0xfe)]},..._0x58c309[_0x2b3bc9(0x11e)]!==undefined&&{'notification':_0x58c309[_0x2b3bc9(0x11e)]},..._0x58c309[_0x2b3bc9(0x186)]!==undefined&&{'connector_config':_0x58c309[_0x2b3bc9(0x186)]},..._0x58c309[_0x2b3bc9(0x16f)]!==undefined&&{'activation_template_id':_0x58c309[_0x2b3bc9(0x16f)]}};return stableStringify(_0x5873c4);}async function fetchSegment(_0x442e91,_0x3d9fc9,_0x588605,_0x4dbf4f){const _0x176e9d=a152_0x5819a5,_0x5aacb5=_0x4dbf4f?.[_0x176e9d(0x133)](_0x13c7aa=>_0x13c7aa['id']===_0x588605);if(_0x5aacb5)return _0x5aacb5;try{return await _0x442e91[_0x176e9d(0x1c3)][_0x176e9d(0x18f)](_0x3d9fc9,_0x588605);}catch(_0x2f6759){logger[_0x176e9d(0x172)](_0x176e9d(0x130)+_0x588605+_0x176e9d(0x194)+_0x2f6759);try{return await _0x442e91[_0x176e9d(0x1c3)][_0x176e9d(0x15c)](_0x588605);}catch(_0x247b74){return logger[_0x176e9d(0x172)](_0x176e9d(0x175)+_0x588605+':\x20'+_0x247b74),null;}}}function recoverSegmentIdsFromPushRecovery(_0x368f29,_0x14551b,_0x361428){const _0xb4b01b=a152_0x5819a5,_0x7e0e4a=readPushRecovery(_0x368f29[_0xb4b01b(0x1af)]);if(_0x7e0e4a?.[_0xb4b01b(0x11f)]===_0x368f29[_0xb4b01b(0x108)]['name'])for(const [_0x4d605c,_0x35cdf3]of Object[_0xb4b01b(0x19f)](_0x7e0e4a['segments'])){const _0x5eeec8=generateDeterministicJourneySegmentName(_0x368f29[_0xb4b01b(0x108)][_0xb4b01b(0x1a3)],_0x4d605c);_0x35cdf3['uniqueServerName']===_0x5eeec8&&(_0x14551b['set'](_0x4d605c,_0x35cdf3[_0xb4b01b(0x15e)]),_0x361428[_0xb4b01b(0x1bb)](_0x4d605c,_0x35cdf3[_0xb4b01b(0x15e)]));}}async function createOrRecoverEmbeddedSegment(_0x549759,_0x2344ad,_0x23dbd1,_0x1e48e6){const _0x22df76=a152_0x5819a5;let _0x1712fc;try{_0x1712fc=await _0x549759[_0x22df76(0x1c3)][_0x22df76(0x1db)]({'name':_0x23dbd1[_0x22df76(0x165)],'description':_0x23dbd1[_0x22df76(0x197)],'journeyId':_0x23dbd1[_0x22df76(0x1e5)],'rule':_0x1e48e6(_0x23dbd1[_0x22df76(0x135)],!![]),'countPopulation':!![],'parentFolderId':_0x23dbd1[_0x22df76(0x164)],'audienceId':_0x23dbd1['parentId']});}catch(_0x35b172){const _0x32da9d=_0x35b172 instanceof Error&&_0x35b172[_0x22df76(0x1f0)][_0x22df76(0x1bd)]('Name\x20has\x20already\x20been\x20taken');if(_0x32da9d){const _0x37dcc3=readPushRecovery(_0x2344ad[_0x22df76(0x1af)]),_0x4a2f45=_0x37dcc3?.[_0x22df76(0x11f)]===_0x2344ad['yamlConfig'][_0x22df76(0x1a3)]?_0x37dcc3[_0x22df76(0x15f)][_0x23dbd1[_0x22df76(0x12c)]]:undefined;if(_0x4a2f45?.['uniqueServerName']===_0x23dbd1['uniqueSegmentName'])await _0x549759['segment']['updateSegmentById'](_0x23dbd1[_0x22df76(0x113)],_0x4a2f45[_0x22df76(0x15e)],{'description':_0x23dbd1[_0x22df76(0x197)],'rule':_0x1e48e6(_0x23dbd1[_0x22df76(0x135)],!![]),'countPopulation':!![]}),_0x1712fc=_0x4a2f45[_0x22df76(0x15e)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x22df76(0x181)+_0x23dbd1[_0x22df76(0x12c)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x22df76(0x190)+_0x2344ad['absolutePath']['replace'](/([^/]+)$/,_0x22df76(0x1e0))+')\x20')+_0x22df76(0x118),_0x35b172);}else throw _0x35b172;}return saveSegmentToPushRecovery(_0x2344ad[_0x22df76(0x1af)],_0x2344ad[_0x22df76(0x108)][_0x22df76(0x1a3)],_0x23dbd1['localName'],{'segmentId':_0x1712fc,'uniqueServerName':_0x23dbd1[_0x22df76(0x165)],'createdAt':new Date()['toISOString']()}),_0x1712fc;}export async function prepareSegmentFiles(_0x162f89,_0x3d3cbd,_0x169d72,_0x290a04,_0x73d90b){const _0x4b90e1=a152_0x5819a5,{activationDefToCreateRequest:_0x2b26c2}=await import(_0x4b90e1(0x1cf)),_0xecfd6f=[],_0x12aa76=new Set();for(const {yamlConfig:_0x1d6342,folderPath:_0x9a41e3,sourcePath:_0x2ad179}of _0x162f89){const _0x205efa=resolveTDFolderPath(_0x9a41e3,_0x290a04,_0x73d90b),_0x56eb8d=_0x205efa+':'+_0x1d6342[_0x4b90e1(0x1a3)],_0x183af2=_0x3d3cbd[_0x4b90e1(0x176)]['get'](_0x56eb8d),_0x1599d5=_0x183af2?_0x3d3cbd[_0x4b90e1(0x12b)]['get'](_0x183af2['id'])||[]:[];addFoldersToCreate(_0x205efa,_0x3d3cbd[_0x4b90e1(0x10d)],_0x12aa76);const _0x1c762d=calculateActivationActions(_0x1d6342[_0x4b90e1(0x15d)]||[],_0x1599d5,_0x3d3cbd[_0x4b90e1(0x10b)],_0x3d3cbd['connectionIdToNameMap']);for(const _0x354fe1 of _0x1c762d){(_0x354fe1[_0x4b90e1(0x150)]==='create'||_0x354fe1[_0x4b90e1(0x150)]===_0x4b90e1(0x1bf))&&_0x354fe1[_0x4b90e1(0x15b)]&&(_0x354fe1[_0x4b90e1(0x156)]=await _0x2b26c2(_0x354fe1[_0x4b90e1(0x15b)],_0x169d72));}const _0x2cfec1=calculateSegmentDiff(_0x1d6342,_0x183af2,_0x1599d5,_0x3d3cbd['idToEmailMap'],_0x3d3cbd[_0x4b90e1(0x1e6)]);_0xecfd6f['push']({'relativePath':_0x1d6342[_0x4b90e1(0x1a3)],'absolutePath':_0x2ad179,'yamlConfig':_0x1d6342,'folderPath':_0x205efa,'existingSegment':_0x183af2,'existingActivations':_0x1599d5,'isNew':_0x2cfec1[_0x4b90e1(0x198)],'hasChanges':_0x2cfec1[_0x4b90e1(0x1ee)],'diff':_0x2cfec1[_0x4b90e1(0x159)],'activationActions':_0x1c762d});}return{'segmentFiles':_0xecfd6f,'foldersToCreate':_0x12aa76};}export async function prepareJourneyFiles(_0x1de163,_0x41e037,_0x33ac2c,_0x16bf47){const _0x34ada3=a152_0x5819a5,_0x195b1c=[],_0x483056=new Set();for(const {yamlConfig:_0x6fe434,folderPath:_0x3684a2,sourcePath:_0x136441}of _0x1de163){const _0x51b6dd=resolveTDFolderPath(_0x3684a2,_0x33ac2c,_0x16bf47),_0x3422da=_0x51b6dd+':'+_0x6fe434[_0x34ada3(0x1a3)],_0x53b977=_0x41e037[_0x34ada3(0x1a0)][_0x34ada3(0x1d9)](_0x3422da);let _0x31104b,_0x32c98e;if(_0x53b977&&_0x53b977[_0x34ada3(0x19b)]>0x0){const _0x446cda=buildLocalExpandedRuleMappings(_0x6fe434),{createYamlContext:_0x4107b1,prefetchJourneySegments:_0xe83909}=createPushYamlContextForBundle(_0x41e037['deps'],_0x41e037[_0x34ada3(0x113)],_0x41e037[_0x34ada3(0x1e8)],_0x446cda,_0x41e037['idToEmailMap'],_0x41e037[_0x34ada3(0x1e6)],_0x41e037['activationStepsById'],_0x41e037[_0x34ada3(0x166)]);await _0xe83909(_0x53b977['map'](_0x347c7b=>_0x347c7b['id']));const _0x5f3020=await _0x41e037[_0x34ada3(0x182)][_0x34ada3(0x11c)][_0x34ada3(0x18c)](_0x53b977[0x0][_0x34ada3(0x171)]),_0x2ddf44=hasMultipleVersions(_0x6fe434),_0x5206dc=async _0x36ffa8=>{const _0x10ad40=_0x34ada3,_0x2a9945=_0x41e037[_0x10ad40(0x166)]?.[_0x10ad40(0x1d9)](_0x36ffa8);if(_0x2a9945)return _0x2a9945;return _0x41e037[_0x10ad40(0x12d)]({'journeyId':_0x36ffa8,'journeyName':_0x6fe434['name'],'isMultiVersion':_0x53b977[_0x10ad40(0x19b)]>0x1});};if(_0x2ddf44&&_0x53b977[_0x34ada3(0x19b)]>0x1){const _0x10f7a5=[];for(const _0x32ec5e of _0x53b977){const _0x4dc3e0=_0x32ec5e['versionNumber']||0x1;_0x41e037['progress']?.[_0x34ada3(0x1bf)](_0x34ada3(0x131)+_0x6fe434[_0x34ada3(0x1a3)]+'\x20v'+_0x4dc3e0);const _0x5e2716=await _0x5206dc(_0x32ec5e['id']),_0x15e54c=_0x4107b1(_0x32ec5e['id']),_0x3c5a63=await journeyResponseToDef(_0x5e2716,_0x15e54c);_0x10f7a5['push']({'item':_0x32ec5e,'yaml':_0x3c5a63});}const _0x20bd12=buildLocalRuleToNameMappingFromJourney(_0x6fe434);_0x32c98e=buildMergedJourneyDef(_0x10f7a5,_0x20bd12,_0x5f3020);const _0x300a16=Math[_0x34ada3(0x1b2)](..._0x10f7a5[_0x34ada3(0x1fc)](_0x43e390=>_0x43e390['item'][_0x34ada3(0x1c5)]||0x0)),_0x3f16d2=_0x53b977[_0x34ada3(0x133)](_0x40f216=>(_0x40f216[_0x34ada3(0x1c5)]||0x0)===_0x300a16);_0x3f16d2&&(_0x41e037[_0x34ada3(0x1e4)]?.[_0x34ada3(0x1bf)]('Fetching\x20'+_0x6fe434[_0x34ada3(0x1a3)]+'\x20v'+_0x300a16),_0x31104b=await _0x5206dc(_0x3f16d2['id']));}else{const _0x327e4a=_0x53b977[_0x53b977['length']-0x1];_0x41e037[_0x34ada3(0x1e4)]?.['update'](_0x34ada3(0x131)+_0x6fe434[_0x34ada3(0x1a3)]),_0x31104b=await _0x5206dc(_0x327e4a['id']);const _0x400060=_0x4107b1(_0x327e4a['id']),_0x15bc7d=await journeyResponseToDef(_0x31104b,_0x400060),_0x4838ff=buildLocalRuleToNameMappingFromJourney(_0x6fe434);_0x32c98e=buildMergedJourneyDef([{'item':_0x327e4a,'yaml':_0x15bc7d}],_0x4838ff,_0x5f3020);}}addFoldersToCreate(_0x51b6dd,_0x41e037[_0x34ada3(0x10d)],_0x483056);const _0x1b3004=calculateJourneyDiff(_0x6fe434,_0x32c98e);_0x195b1c[_0x34ada3(0x1b3)]({'relativePath':_0x6fe434[_0x34ada3(0x1a3)],'absolutePath':_0x136441,'yamlConfig':_0x6fe434,'folderPath':_0x51b6dd,'existingJourney':_0x31104b,'isNew':_0x1b3004[_0x34ada3(0x198)],'hasChanges':_0x1b3004[_0x34ada3(0x1ee)],'diff':_0x1b3004[_0x34ada3(0x159)]});}return{'journeyFiles':_0x195b1c,'foldersToCreate':_0x483056};}export function calculateActivationActions(_0x3d41ec,_0x3074d6,_0x496208,_0xc5f24b){const _0x1b7ad9=a152_0x5819a5,_0x41d19c=[],_0x286381=new Map();for(const _0x4b58d4 of _0x3074d6){_0x286381[_0x1b7ad9(0x1bb)](_0x4b58d4[_0x1b7ad9(0x1a3)],_0x4b58d4);}const _0x2b5d8b=new Map();for(const _0x40d14b of _0x3d41ec){_0x2b5d8b[_0x1b7ad9(0x1bb)](_0x40d14b[_0x1b7ad9(0x1a3)],_0x40d14b);}for(const _0x22672e of _0x3d41ec){const _0x2993c9=_0x286381[_0x1b7ad9(0x1d9)](_0x22672e[_0x1b7ad9(0x1a3)]);if(!_0x2993c9)_0x41d19c['push']({'type':_0x1b7ad9(0x105),'name':_0x22672e['name'],'yamlActivation':_0x22672e});else{const _0x1ccf01=activationResponseToDef(_0x2993c9,_0x496208,_0xc5f24b),_0x357fb9=a152_0x27a142[_0x1b7ad9(0x203)](_0x1ccf01),_0x2aff0a=a152_0x27a142[_0x1b7ad9(0x203)](_0x22672e);_0x357fb9!==_0x2aff0a&&_0x41d19c[_0x1b7ad9(0x1b3)]({'type':_0x1b7ad9(0x1bf),'name':_0x22672e[_0x1b7ad9(0x1a3)],'yamlActivation':_0x22672e,'existingActivation':_0x2993c9});}}for(const _0x1e23bc of _0x3074d6){!_0x2b5d8b['has'](_0x1e23bc[_0x1b7ad9(0x1a3)])&&_0x41d19c[_0x1b7ad9(0x1b3)]({'type':_0x1b7ad9(0x1d4),'name':_0x1e23bc['name'],'existingActivation':_0x1e23bc});}return _0x41d19c;}function a152_0x1dcf(){const _0x27f6f6=['activationsBySegmentId','localName','fetchJourney','exitCriterias','getActivation','getSegment\x20failed\x20for\x20','Fetching\x20','356325YeAmyF','find','onProgress','resolvedRule','hex','folder_creating','NOT_FOUND','activationContext','36552qbqMUv','all_columns','620710eRNpDO','createFolder','data','9BRoNnQ','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','logDeleted','\x20journey\x20from\x20file:\x20','activation_deleting','SEGMENT_UPDATE_ERROR','conditionSegmentId','\x20error(s)','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','existingSegment','\x27\x20by\x20rule\x20content','updated','95229eusnFB','embeddedSegmentNameToId','entryCriteria','filter','kind','type','valid','updateSegmentById','conditionTimeoutUnit','parentSegmentFolder','./journey-yaml.js','validatedRequest','toLowerCase','journeys','diff','segment_created','yamlActivation','getSegmentEntity','activations','segmentId','segments','created','__pending_','embedded_segment_created','logInfo','folderId','uniqueSegmentName','journeyById','INTERNAL','WaitStep','goal\x20criteria','utf-8','JOURNEY_SYNTAX_ERROR','Deleted\x20activation\x20\x27','createSegment','createdSegmentId','activation_template_id','ACTIVATION_SYNTAX_ERROR','journeyBundleId','debug','segment_deleting','Activation\x20not\x20found:\x20','getSegmentEntity\x20also\x20failed\x20for\x20','segmentByFolderAndName','startsWith','segmentFolderId','skipSegments','DecisionPoint','stages','split','parse','listActivations','\x27...','tdx.sdk.push-workflow','Embedded\x20segment\x20\x27','deps','relationships','deleteSegment','verbose','connector_config','entry','journey_created','waitStep','\x20segment\x20from\x20file:\x20','\x27\x20milestone','getLatestJourneyId','attributes','getJourney','getSegment','Delete\x20the\x20push\x20recovery\x20file\x20(','draft','4490490rkpOYw','errors',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','Condition','Matched\x20server\x20segment\x20\x27','description','isNew','\x0a\x20\x20','Updated\x20segment\x20\x27','length','journeyActivationStepId','digest','Stage\x20\x27','entries','journeyBundlesByFolderAndName','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','\x20activation\x20\x27','name','Segment\x20not\x20found','Creating\x20activation\x20\x27','segment_updated','results','milestone','Updating\x20activation\x20\x27','activationActions','segment_deleted','buildUserMaps','Failed\x20to\x20resolve\x20segment\x20','index','absolutePath','day','unchanged','max','push','JOURNEY_UPDATE_ERROR','logWarning','SEGMENT_SYNTAX_ERROR','nameToId','slice','updateActivation','folderPath','set','\x27\x20for\x20','includes','logSuccess','update','folder','sort','rootFolderId','segment','from','versionNumber','size','ACTIVATION_UPDATE_ERROR','\x20(referenced\x20in\x20journey\x20','rule','toString','Segment\x20not\x20found:\x20','Failed\x20to\x20fetch\x20referenced\x20segment\x20','state','deleted','./child-segment-yaml.js','Created\x20activation\x20\x27','__pending_act_',').\x20','activation_','delete','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','journeyBundleName','\x27\x20not\x20found\x20in\x20journey\x20\x27','goal','get','existingActivation','createJourneySegment','run_after_journey_refresh','resolveJourneyId','\x27\x20to\x20local\x20\x27','withProgress','.$1.push-recovery.json','147229QKjVJE','Deleting\x20activation\x20\x27','has','progress','journeyId','connectionIdToNameMap','Activation','existingSegments','journey_creating','embedded_activation_created','24uExCTy','activation_creating','branches','hasChanges','26708sojJpg','message','resolveSegment','Creating\x20folder\x20\x27','Failed\x20to\x20','action','parentFolder','idToName','journeyStages','activation_updating','steps','journey_updated','match','map','folder_created','Updated\x20activation\x20\x27','add','waitStepUnit','conditions','existingJourney','stringify','toISOString','connection','Failed\x20to\x20resolve\x20activation\x20','values','schedule','flatMap','Updated\x20journey\x20\x27','keys','isArray','../../utils/async.js','segment_updating','create','with','Duration','yamlConfig','behavior','SEGMENT_NOT_FOUND','idToEmailMap','2EnHcAz','folderPathToId','user','\x27\x20wait\x20condition','join','Deleted\x20segment\x20\x27','waitStepType','parentId','effectiveFolderId','\x27\x20from\x20file:\x20','segmentNameToId','columns','and\x20the\x20server\x20segment,\x20then\x20retry.','some','relative','2988AOQCkT','journey','activation_deleted','notification','journeyName','1260SHTJfF','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','replace','stage\x20\x27','createdSegmentIds','parseDocument','conditionTimeoutDuration','entry_criteria','Entry\x20criteria:\x20','Created\x20segment\x20\x27','nameToType'];a152_0x1dcf=function(){return _0x27f6f6;};return a152_0x1dcf();}function calculateYamlDiff(_0x3d4deb,_0x2c0314){if(_0x2c0314){const _0x4504fc=generateDiff(_0x2c0314,_0x3d4deb),_0x2df121=hasChanges(_0x4504fc);return{'isNew':![],'hasChanges':_0x2df121,'diff':_0x2df121?formatDiffWithColors(_0x4504fc):undefined};}const _0x1d3a8a=generateDiff('',_0x3d4deb);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1d3a8a)};}export function calculateSegmentDiff(_0x1f7779,_0x27d69e,_0x3fa1f2,_0x3c2b58,_0x5b2c35){const _0x8eb1a=segmentToYamlString(_0x1f7779),_0x52e348=_0x27d69e?segmentToYamlString(segmentWithActivationsToYaml(_0x27d69e,_0x3fa1f2,undefined,_0x3c2b58,_0x5b2c35)):undefined;return calculateYamlDiff(_0x8eb1a,_0x52e348);}export function calculateJourneyDiff(_0x4aa3d5,_0x3078df){const _0x116859=normalizeJourneyDef(_0x4aa3d5,_0x4aa3d5),_0x1cf5ac=a152_0x42e94e(_0x116859),_0x22edc0=_0x3078df?a152_0x42e94e(normalizeJourneyDef(_0x3078df,_0x4aa3d5)):undefined;return calculateYamlDiff(_0x1cf5ac,_0x22edc0);}export function findSegmentsToDelete(_0x20d0ed,_0x475730,_0x4eb715,_0x282d0c,_0x2074c9){const _0x3f6236=a152_0x5819a5,_0x35fbf5=new Set();for(const {yamlConfig:_0x3234d6,folderPath:_0x34f094}of _0x475730){_0x35fbf5[_0x3f6236(0x1ff)](_0x34f094+':'+_0x3234d6[_0x3f6236(0x1a3)]);}return _0x20d0ed[_0x3f6236(0x14e)](_0x4e1cb8=>{const _0xc9486f=_0x3f6236,_0x5e07d3=_0x4e1cb8[_0xc9486f(0x178)]?_0x4eb715[_0xc9486f(0x1d9)](_0x4e1cb8[_0xc9486f(0x178)][_0xc9486f(0x1ca)]())||'':'',_0x14dbc7=_0x5e07d3+':'+_0x4e1cb8[_0xc9486f(0x1a3)];if(_0x35fbf5[_0xc9486f(0x1e3)](_0x14dbc7))return![];if(_0x2074c9)return _0x5e07d3===_0x282d0c||_0x5e07d3[_0xc9486f(0x177)](_0x282d0c+'/');return!![];});}export function findJourneysToDelete(_0x16b009,_0x5664ee,_0x44b459,_0x441867,_0x216b08){const _0x46acc0=a152_0x5819a5,_0x484657=new Set();for(const {yamlConfig:_0x187a7a,folderPath:_0x59572f}of _0x5664ee){_0x484657[_0x46acc0(0x1ff)](_0x59572f+':'+_0x187a7a[_0x46acc0(0x1a3)]);}return _0x16b009['filter'](_0x52432d=>{const _0x455c2c=_0x46acc0,_0x307f32=_0x52432d['folderId']?_0x44b459[_0x455c2c(0x1d9)](_0x52432d[_0x455c2c(0x164)])||'':'',_0x4dacec=_0x307f32+':'+_0x52432d[_0x455c2c(0x1d6)];if(_0x484657[_0x455c2c(0x1e3)](_0x4dacec))return![];if(_0x216b08)return _0x307f32===_0x441867||_0x307f32[_0x455c2c(0x177)](_0x441867+'/');return!![];});}export function buildSegmentLookupMap(_0x4e2b3b,_0x6a64db){const _0x29ef83=a152_0x5819a5,_0x3ef1db=new Map();for(const _0x404181 of _0x4e2b3b){const _0x4941ab=_0x404181[_0x29ef83(0x178)]?_0x6a64db[_0x29ef83(0x1d9)](_0x404181[_0x29ef83(0x178)]['toString']())||'':'',_0xbf3690=_0x4941ab+':'+_0x404181[_0x29ef83(0x1a3)];_0x3ef1db[_0x29ef83(0x1bb)](_0xbf3690,_0x404181);}return _0x3ef1db;}export function buildSegmentNameToIdMap(_0x2db411){const _0xa41c41=a152_0x5819a5,_0x173da6=new Map();for(const _0x3f1c84 of _0x2db411){_0x173da6[_0xa41c41(0x1bb)](_0x3f1c84[_0xa41c41(0x1a3)],_0x3f1c84['id']);}return _0x173da6;}export function buildJourneyBundleLookupMap(_0x5009f2,_0xe95018){const _0x57a810=a152_0x5819a5,_0x5238f3=new Map();for(const _0x5bb903 of _0x5009f2){const _0x449fd9=_0x5bb903[_0x57a810(0x164)]?_0xe95018['get'](_0x5bb903[_0x57a810(0x164)])||'':'',_0xf9a326=_0x449fd9+':'+_0x5bb903[_0x57a810(0x1d6)];!_0x5238f3[_0x57a810(0x1e3)](_0xf9a326)&&_0x5238f3[_0x57a810(0x1bb)](_0xf9a326,[]),_0x5238f3['get'](_0xf9a326)[_0x57a810(0x1b3)](_0x5bb903);}for(const _0x4499c4 of _0x5238f3[_0x57a810(0xfd)]()){_0x4499c4[_0x57a810(0x1c1)]((_0x491f5a,_0x3af78f)=>(_0x491f5a[_0x57a810(0x1c5)]||0x0)-(_0x3af78f[_0x57a810(0x1c5)]||0x0));}return _0x5238f3;}export function collectFoldersToCreate(_0x99f8b6,_0x4babca){const _0x143b7f=a152_0x5819a5,_0x451c73=new Set();for(const _0x858a48 of _0x99f8b6){if(!_0x858a48)continue;if(_0x4babca[_0x143b7f(0x1e3)](_0x858a48))continue;const _0x5cf808=_0x858a48[_0x143b7f(0x17c)]('/');let _0x394cbb='';for(const _0x3bcf03 of _0x5cf808){_0x394cbb=_0x394cbb?_0x394cbb+'/'+_0x3bcf03:_0x3bcf03,!_0x4babca[_0x143b7f(0x1e3)](_0x394cbb)&&_0x451c73[_0x143b7f(0x1ff)](_0x394cbb);}}return _0x451c73;}export function parseAndClassifyYamlFiles(_0x398adc,_0x3257b3,_0x3c5f87){const _0x5eade3=a152_0x5819a5,_0x290941=[],_0x47f909=[];for(const _0x3a79e2 of _0x398adc){const _0x51325b=a152_0x322d4e[_0x5eade3(0x11a)](_0x3257b3,a152_0x322d4e['dirname'](_0x3a79e2)),_0x50c6d5=_0x51325b==='.'?'':_0x51325b[_0x5eade3(0x122)](/\\/g,'/'),_0x1ad21d=readFileSync(_0x3a79e2,_0x5eade3(0x16a)),_0x31a8c4=a152_0x27a142[_0x5eade3(0x17d)](_0x1ad21d);if(isJourneyDef(_0x31a8c4)){const _0x4f7117=a152_0x4dcb37(_0x1ad21d);_0x47f909[_0x5eade3(0x1b3)]({'yamlConfig':_0x4f7117,'folderPath':_0x50c6d5,'sourcePath':_0x3a79e2});}else{if(!_0x3c5f87?.[_0x5eade3(0x179)]){const _0x26c893=parseSegmentYamlFile(_0x1ad21d),_0x5d8edb=normalizeChildSegmentYaml(_0x26c893);_0x290941[_0x5eade3(0x1b3)]({'yamlConfig':_0x5d8edb,'folderPath':_0x50c6d5,'sourcePath':_0x3a79e2});}}}return{'segments':_0x290941,'journeys':_0x47f909};}export function validateParsedFiles(_0x1d23ef,_0x96aa00){const _0x46861f=a152_0x5819a5,_0x26b09f=[];for(const {yamlConfig:_0x5a5b3d,sourcePath:_0x557f11}of _0x1d23ef['segments']){const _0x1673db=readFileSync(_0x557f11,_0x46861f(0x16a)),_0x371b3b=a152_0x27a142[_0x46861f(0x125)](_0x1673db),_0x299f3a=validateSegmentDef(_0x5a5b3d,{'source':_0x1673db,'document':_0x371b3b},{'skipSchema':!![]});if(!_0x299f3a[_0x46861f(0x151)]){const _0x4e8c09=a152_0x322d4e[_0x46861f(0x11a)](_0x96aa00,_0x557f11);_0x26b09f[_0x46861f(0x1b3)]({'filePath':_0x4e8c09,'source':_0x1673db,'result':_0x299f3a,'isJourney':![]});}}for(const {yamlConfig:_0x2e89d8,sourcePath:_0x5325dc}of _0x1d23ef[_0x46861f(0x158)]){const _0x4bebff=readFileSync(_0x5325dc,_0x46861f(0x16a)),_0x14b864=a152_0x27a142[_0x46861f(0x125)](_0x4bebff),_0x1979c8=validateJourneyDef(_0x2e89d8,{'source':_0x4bebff,'document':_0x14b864},{'skipSchema':!![]});if(!_0x1979c8[_0x46861f(0x151)]){const _0x565698=a152_0x322d4e['relative'](_0x96aa00,_0x5325dc);_0x26b09f[_0x46861f(0x1b3)]({'filePath':_0x565698,'source':_0x4bebff,'result':_0x1979c8,'isJourney':!![]});}}return _0x26b09f;}export function formatValidationErrors(_0x9d57c6){const _0x1783f5=a152_0x5819a5,_0x1d9b3c=[];for(const {filePath:_0x3e8c0e,source:_0x26f374,result:_0x38f41b,isJourney:_0x9b5614}of _0x9d57c6){const _0x6ee21e=_0x9b5614?_0x1783f5(0x11c):_0x1783f5(0x1c3);_0x1d9b3c[_0x1783f5(0x1b3)]('\x0a'+_0x3e8c0e+'\x20('+_0x6ee21e+'):\x20'+_0x38f41b[_0x1783f5(0x193)][_0x1783f5(0x19b)]+_0x1783f5(0x146)),_0x1d9b3c[_0x1783f5(0x1b3)](formatValidationResult(_0x38f41b,_0x26f374,_0x3e8c0e));}return _0x1d9b3c[_0x1783f5(0x110)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x3d6b71){const _0x347cb1=a152_0x5819a5,_0x909f13=new Set(),_0x2e74c4=new Map(),_0x5e96f3=collectSegmentUsageCounts(_0x3d6b71);if(_0x3d6b71[_0x347cb1(0x15f)])for(const [_0xb6b668,_0x32fb14]of Object[_0x347cb1(0x19f)](_0x3d6b71['segments'])){_0x909f13['add'](_0xb6b668);if(_0x32fb14[_0x347cb1(0x1c9)]){const _0x1b74f9=yamlRuleToApi(_0x32fb14[_0x347cb1(0x1c9)]),_0x4723b4=apiRuleToYaml(_0x1b74f9);_0x2e74c4['set'](_0xb6b668,_0x4723b4);}}const _0x3c4122=new Map();let _0x25ea8d=0x0;for(const [_0x314ac0,_0x486058]of _0x2e74c4){const _0x6c8ae4=serializeExpandedRule(_0x486058,_0x2e74c4),_0x5d5edd=_0x3c4122[_0x347cb1(0x1d9)](_0x6c8ae4)||[];_0x5d5edd[_0x347cb1(0x1b3)]({'name':_0x314ac0,'index':_0x25ea8d}),_0x3c4122[_0x347cb1(0x1bb)](_0x6c8ae4,_0x5d5edd),_0x25ea8d++;}const _0x2b720d=new Map();for(const [_0x175c6f,_0x3cefd4]of _0x3c4122){const _0x162a15=_0x3cefd4[_0x347cb1(0x1b8)]()['sort']((_0x46f4ed,_0x91f6ff)=>{const _0x106cf8=_0x347cb1,_0x4cd305=_0x5e96f3[_0x106cf8(0x1d9)](_0x46f4ed[_0x106cf8(0x1a3)])||0x0,_0x478daa=_0x5e96f3[_0x106cf8(0x1d9)](_0x91f6ff['name'])||0x0;if(_0x4cd305!==_0x478daa)return _0x478daa-_0x4cd305;return _0x46f4ed['index']-_0x91f6ff[_0x106cf8(0x1ae)];})[_0x347cb1(0x1fc)](_0x325412=>_0x325412[_0x347cb1(0x1a3)]),_0x169a10=[];for(const _0x5baaa2 of _0x162a15){const _0xb796b1=_0x5e96f3[_0x347cb1(0x1d9)](_0x5baaa2)||0x0,_0x5dcfe0=Math['max'](_0xb796b1,0x1);for(let _0x532710=0x0;_0x532710<_0x5dcfe0;_0x532710++){_0x169a10[_0x347cb1(0x1b3)](_0x5baaa2);}}_0x2b720d[_0x347cb1(0x1bb)](_0x175c6f,_0x169a10);}return{'existingLocalSegmentNames':_0x909f13,'localSegmentRules':_0x2e74c4,'localExpandedRuleToNames':_0x2b720d};}export function createSegmentIdResolver(_0x2402c1,_0x38db44){return async _0x11f0a1=>{const _0x4032b2=a152_0x3568,_0xa4cfb0=_0x2402c1[_0x4032b2(0x1d9)](_0x11f0a1);if(!_0xa4cfb0)throw new SDKError(ErrorCode[_0x4032b2(0x10a)],_0x4032b2(0x1cb)+_0x11f0a1+_0x4032b2(0x140)+_0x38db44+'\x27)');return _0xa4cfb0;};}export function extractRootFolderId(_0x2067dc){const _0x4ad235=a152_0x5819a5;return _0x2067dc[_0x4ad235(0x183)]?.[_0x4ad235(0x154)]?.[_0x4ad235(0x13e)]?.['id']||_0x2067dc[_0x4ad235(0x183)]?.[_0x4ad235(0x1f5)]?.[_0x4ad235(0x13e)]?.['id'];}export function buildConnectionMaps(_0x5475e4){const _0x5dfa45=a152_0x5819a5,_0x581b0d=new Map(),_0x3124b9=new Map(),_0x1a0e80=new Map();for(const _0x516f0a of _0x5475e4){_0x581b0d[_0x5dfa45(0x1bb)](_0x516f0a['name'],parseInt(_0x516f0a['id'],0xa)),_0x3124b9[_0x5dfa45(0x1bb)](_0x516f0a['id'],_0x516f0a[_0x5dfa45(0x1a3)]),_0x1a0e80[_0x5dfa45(0x1bb)](_0x516f0a[_0x5dfa45(0x1a3)],_0x516f0a['type']);}return{'nameToId':_0x581b0d,'idToName':_0x3124b9,'nameToType':_0x1a0e80};}export function calculatePushStats(_0x3800a6,_0x46e9fd,_0x2794d7,_0xeb0632,_0x3ceb4c,_0x55804b,_0x922619){const _0x99ab84=a152_0x5819a5,_0xfa77fa=_0x3800a6['filter'](_0x2abed2=>_0x2abed2[_0x99ab84(0x198)]),_0x36816c=_0x3800a6[_0x99ab84(0x14e)](_0x3d554a=>!_0x3d554a[_0x99ab84(0x198)]&&_0x3d554a[_0x99ab84(0x1ee)]),_0x2d60c0=_0x3800a6['filter'](_0x1169b0=>!_0x1169b0['isNew']&&!_0x1169b0['hasChanges']),_0x5b8ffa=_0x55804b?_0xeb0632:[],_0x40914d=_0x46e9fd['filter'](_0x29f765=>_0x29f765[_0x99ab84(0x198)]),_0x540de7=_0x46e9fd[_0x99ab84(0x14e)](_0xa8f983=>!_0xa8f983[_0x99ab84(0x198)]&&_0xa8f983[_0x99ab84(0x1ee)]),_0xb693b3=_0x46e9fd['filter'](_0x28a75a=>!_0x28a75a[_0x99ab84(0x198)]&&!_0x28a75a[_0x99ab84(0x1ee)]),_0x518014=_0x55804b?_0x3ceb4c:[],_0x572818=_0x3800a6[_0x99ab84(0xff)](_0x457eb9=>_0x457eb9[_0x99ab84(0x1aa)]),_0x510232=_0x572818['filter'](_0x1cbf2f=>_0x1cbf2f[_0x99ab84(0x150)]===_0x99ab84(0x105)),_0x4c3375=_0x572818[_0x99ab84(0x14e)](_0x3f3740=>_0x3f3740[_0x99ab84(0x150)]===_0x99ab84(0x1bf)),_0x4f55d4=_0x572818[_0x99ab84(0x14e)](_0x2a6cd6=>_0x2a6cd6['type']===_0x99ab84(0x1d4)),_0x3e80f4=Array[_0x99ab84(0x1c4)](_0x2794d7)[_0x99ab84(0x1c1)](),_0x2987b8=_0x922619?![]:_0xfa77fa[_0x99ab84(0x19b)]>0x0||_0x36816c['length']>0x0||_0x5b8ffa[_0x99ab84(0x19b)]>0x0,_0xf1ea70=_0x40914d['length']>0x0||_0x540de7['length']>0x0||_0x518014[_0x99ab84(0x19b)]>0x0,_0x92a590=_0x922619?![]:_0x572818[_0x99ab84(0x19b)]>0x0,_0x3f8132=_0x3e80f4[_0x99ab84(0x19b)]>0x0;return{'segments':{'new':_0xfa77fa,'changed':_0x36816c,'unchanged':_0x2d60c0,'toDelete':_0x5b8ffa},'journeys':{'new':_0x40914d,'changed':_0x540de7,'unchanged':_0xb693b3,'toDelete':_0x518014},'activations':{'all':_0x572818,'toCreate':_0x510232,'toUpdate':_0x4c3375,'toDelete':_0x4f55d4},'folders':{'toCreate':_0x3e80f4},'counts':{'segments':{'new':_0xfa77fa['length'],'changed':_0x36816c['length'],'unchanged':_0x2d60c0[_0x99ab84(0x19b)],'toDelete':_0x5b8ffa['length']},'journeys':{'new':_0x40914d[_0x99ab84(0x19b)],'changed':_0x540de7['length'],'unchanged':_0xb693b3[_0x99ab84(0x19b)],'toDelete':_0x518014[_0x99ab84(0x19b)]},'activations':{'create':_0x510232[_0x99ab84(0x19b)],'update':_0x4c3375[_0x99ab84(0x19b)],'delete':_0x4f55d4[_0x99ab84(0x19b)]},'folders':_0x3e80f4[_0x99ab84(0x19b)]},'hasChanges':_0x2987b8||_0xf1ea70||_0x92a590||_0x3f8132};}export async function buildPushExecutionContext(_0x4a26dc,_0x33ecf5,_0x5ac49e,_0xce1f8e,_0x176864,_0x1cf480){const _0x3a8098=a152_0x5819a5,_0x3a9a53=extractRootFolderId(_0x5ac49e),{pathToId:_0x5b2e0c,idToPath:_0x5e041b}=buildFolderMaps(_0x176864),_0x3d0455=buildSegmentNameToIdMap(_0xce1f8e),_0x5021c5=new Map(),{batchAsync:_0x268b9d}=await import(_0x3a8098(0x103)),[_0x2dbf09,_0x5eee18]=await Promise['all']([_0x4a26dc[_0x3a8098(0x10e)][_0x3a8098(0x1ac)](),_0x4a26dc[_0x3a8098(0x205)]['list'](),((async()=>{!_0x1cf480&&_0xce1f8e['length']>0x0&&await _0x268b9d(_0xce1f8e,async _0x1827f7=>{const _0x356037=a152_0x3568,_0x5be3fd=await _0x4a26dc[_0x356037(0x1c3)]['listActivations'](_0x33ecf5,_0x1827f7['id']);_0x5021c5[_0x356037(0x1bb)](_0x1827f7['id'],_0x5be3fd);});})())]),{emailToId:_0x108694,idToEmail:_0x1a9d3a}=_0x2dbf09,_0x3ccf35=buildConnectionMaps(_0x5eee18);return{'rootFolderId':_0x3a9a53,'folderPathToId':_0x5b2e0c,'folderIdToPath':_0x5e041b,'segmentNameToId':_0x3d0455,'activationsBySegmentId':_0x5021c5,'emailToIdMap':_0x108694,'idToEmailMap':_0x1a9d3a,'connectionNameToIdMap':_0x3ccf35[_0x3a8098(0x1b7)],'connectionIdToNameMap':_0x3ccf35[_0x3a8098(0x1f6)],'connectionNameToTypeMap':_0x3ccf35[_0x3a8098(0x12a)]};}export function createPushYamlContextForBundle(_0x5b34be,_0x463748,_0x648b88,_0x4d07d4,_0x8060e8,_0x2cfb74,_0x45940d,_0x3486fe){const {existingLocalSegmentNames:_0x322364,localExpandedRuleToNames:_0x578720}=_0x4d07d4,_0x45a01f=new Set(),_0x29c382=new Map(),_0x10ff86=new Map(),_0x5b2a6a=new Map(),_0x10b0eb=createJumpTargetCache(),_0x15495b=new Map(),_0x1aca51=new Map(),_0xfc3c57=new Set();let _0x10a26d;const _0x3fb93f=_0x177cc8=>{const _0x4ba1fc={'resolveSegment':async _0x327c03=>{const _0x2680d8=a152_0x3568,_0x1ec6a6=_0x5b2a6a['get'](_0x327c03);if(_0x1ec6a6!==undefined)return{'name':_0x1ec6a6,'isJourneyLocal':!![]};try{const _0x2c236d=await fetchSegment(_0x5b34be,_0x463748,_0x327c03,_0x648b88);if(!_0x2c236d)throw new Error(_0x2680d8(0x1a4));const _0x447679=generateJourneyLocalName(_0x2c236d['name']),_0x2d9aed=_0x2c236d[_0x2680d8(0x14f)]===SEGMENT_KIND_JOURNEY&&_0x447679!==undefined;let _0x4ff6cd=_0x2c236d[_0x2680d8(0x1a3)],_0x5df95f;if(_0x2d9aed&&_0x2c236d[_0x2680d8(0x1c9)]){const _0x59eca2=apiRuleToYaml(_0x2c236d[_0x2680d8(0x1c9)]);_0x1aca51[_0x2680d8(0x1bb)](_0x327c03,_0x59eca2);const _0x22b931=async _0x5db334=>{const _0x10eff1=_0x2680d8,_0x4bbd6e=collectSegmentRefsFromRule(_0x5db334);for(const _0x8ff850 of _0x4bbd6e){if(!_0x1aca51[_0x10eff1(0x1e3)](_0x8ff850))try{const _0x173628=await fetchSegment(_0x5b34be,_0x463748,_0x8ff850,_0x648b88);if(_0x173628?.[_0x10eff1(0x1c9)]){const _0x3d3965=apiRuleToYaml(_0x173628[_0x10eff1(0x1c9)]);_0x1aca51[_0x10eff1(0x1bb)](_0x8ff850,_0x3d3965),await _0x22b931(_0x3d3965);}}catch(_0x33bbe5){logger['debug'](_0x10eff1(0x1cc)+_0x8ff850+':\x20'+_0x33bbe5);}}};await _0x22b931(_0x59eca2);const _0x4ea0ed=serializeExpandedRule(_0x59eca2,_0x1aca51),_0x88f9d6=_0x578720['get'](_0x4ea0ed);if(_0x88f9d6&&_0x88f9d6[_0x2680d8(0x19b)]>0x0){const _0x410229=_0x29c382['get'](_0x4ea0ed)||0x0,_0x510792=_0x88f9d6[_0x410229]||_0x88f9d6[_0x88f9d6[_0x2680d8(0x19b)]-0x1];_0x29c382[_0x2680d8(0x1bb)](_0x4ea0ed,_0x410229+0x1),_0x4ff6cd=_0x510792,_0x45a01f[_0x2680d8(0x1ff)](_0x4ff6cd),_0x5b2a6a[_0x2680d8(0x1bb)](_0x327c03,_0x4ff6cd);const _0x542ba0=await resolveRuleSegmentRefs(_0x59eca2,async _0x448e9d=>{const _0x450f53=_0x2680d8,_0x26de47=_0x5b2a6a['get'](_0x448e9d);if(_0x26de47)return _0x26de47;const _0x26e43d=await _0x10a26d[_0x450f53(0x1f1)](_0x448e9d);return _0x26e43d['name'];});_0x5df95f={'description':_0x2c236d['description'],'rule':_0x542ba0};}else{const _0x8674e9=_0x15495b['get'](_0x4ea0ed);if(_0x8674e9)_0x4ff6cd=_0x8674e9,_0x5b2a6a[_0x2680d8(0x1bb)](_0x327c03,_0x4ff6cd);else{if(_0x447679){let _0xbc7146=_0x447679,_0x36d870=0x2;while(_0x45a01f[_0x2680d8(0x1e3)](_0xbc7146)||_0x322364[_0x2680d8(0x1e3)](_0xbc7146)){_0xbc7146=_0x447679+'_'+_0x36d870,_0x36d870++;}_0x45a01f[_0x2680d8(0x1ff)](_0xbc7146),_0x4ff6cd=_0xbc7146;}_0x5b2a6a[_0x2680d8(0x1bb)](_0x327c03,_0x4ff6cd),_0x15495b['set'](_0x4ea0ed,_0x4ff6cd);const _0x5a09b3=await resolveRuleSegmentRefs(_0x59eca2,async _0x2ed47b=>{const _0x3318c7=_0x2680d8,_0x151326=_0x5b2a6a[_0x3318c7(0x1d9)](_0x2ed47b);if(_0x151326)return _0x151326;const _0x196bed=await _0x10a26d[_0x3318c7(0x1f1)](_0x2ed47b);return _0x196bed[_0x3318c7(0x1a3)];});_0x5df95f={'description':_0x2c236d[_0x2680d8(0x197)],'rule':_0x5a09b3};}}}return{'name':_0x4ff6cd,'isJourneyLocal':_0x2d9aed,'definition':_0x5df95f};}catch(_0x3b1d36){return logger['debug'](_0x2680d8(0x1ad)+_0x327c03+':\x20'+_0x3b1d36),{'name':_0x327c03,'isJourneyLocal':![]};}},'resolveActivation':async _0x520c81=>{const _0x411d1b=a152_0x3568,_0x4f0994=_0x10ff86[_0x411d1b(0x1d9)](_0x520c81);if(_0x4f0994!==undefined)return{'name':_0x4f0994,'isJourneyLocal':!![]};try{let _0x8a36ce=_0x45940d?.[_0x411d1b(0x1d9)](_0x520c81);!_0x8a36ce&&(_0x8a36ce=await _0x5b34be[_0x411d1b(0x11c)][_0x411d1b(0x12f)](_0x177cc8,_0x520c81));const _0x279712=_0x8a36ce[_0x411d1b(0x18d)]['activationParams']['name']||_0x520c81,_0x41fb8d=sanitizeYamlKey(_0x279712)||_0x411d1b(0x1d3)+_0x520c81,_0x460921=_0x41fb8d;_0x10ff86['set'](_0x520c81,_0x460921);const _0x2d4e40=journeyActivationStepToYaml(_0x8a36ce,_0x8060e8,_0x2cfb74);return{'name':_0x460921,'isJourneyLocal':!![],'definition':_0x2d4e40};}catch(_0x50a7eb){return logger['debug'](_0x411d1b(0xfc)+_0x520c81+':\x20'+_0x50a7eb),{'name':_0x520c81,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3800e2,_0x588f24)=>resolveJumpTarget(_0x3800e2,_0x588f24,_0x10b0eb,async _0x404dcf=>{const _0x78c98e=a152_0x3568,_0x43e0d9=_0x3486fe?.[_0x78c98e(0x1d9)](_0x404dcf);if(_0x43e0d9)return _0x43e0d9;return _0x5b34be[_0x78c98e(0x11c)][_0x78c98e(0x18e)](_0x404dcf);})};return _0x10a26d=_0x4ba1fc,_0x4ba1fc;},_0xbcd118=async _0x5d4dd0=>{const _0x4714e4=a152_0x3568,{collectSegmentIdsFromJourneyApi:_0x1add47}=await import('./journey-yaml.js'),{batchAsync:_0x1e90fc}=await import(_0x4714e4(0x103)),_0x38ef68=new Set();for(const _0x599a43 of _0x5d4dd0){let _0xf59d26=_0x3486fe?.[_0x4714e4(0x1d9)](_0x599a43);!_0xf59d26&&(_0xf59d26=await _0x5b34be['journey'][_0x4714e4(0x18e)](_0x599a43));const _0x3f9d09=_0x1add47(_0xf59d26);for(const _0x3a8724 of _0x3f9d09){_0x38ef68[_0x4714e4(0x1ff)](_0x3a8724);}}let _0x7a70d6=Array['from'](_0x38ef68);while(_0x7a70d6[_0x4714e4(0x19b)]>0x0){const _0x25d8eb=_0x7a70d6[_0x4714e4(0x14e)](_0x148ed2=>!_0xfc3c57[_0x4714e4(0x1e3)](_0x148ed2));if(_0x25d8eb['length']===0x0)break;const _0x5ee098=await _0x1e90fc(_0x25d8eb,async _0x491e65=>{const _0x301666=_0x4714e4;_0xfc3c57[_0x301666(0x1ff)](_0x491e65);const _0x3ed92e=await fetchSegment(_0x5b34be,_0x463748,_0x491e65,_0x648b88);if(!_0x3ed92e)return null;return{'segmentId':_0x491e65,'segment':_0x3ed92e};},0xa),_0x199c6a=new Set();for(const _0x383a0c of _0x5ee098){if(!_0x383a0c?.['segment']?.['rule'])continue;const _0x5246a6=apiRuleToYaml(_0x383a0c[_0x4714e4(0x1c3)]['rule']);_0x1aca51[_0x4714e4(0x1bb)](_0x383a0c['segmentId'],_0x5246a6);const _0x54f334=collectSegmentRefsFromRule(_0x5246a6);for(const _0x96a850 of _0x54f334){!_0xfc3c57[_0x4714e4(0x1e3)](_0x96a850)&&_0x199c6a[_0x4714e4(0x1ff)](_0x96a850);}}_0x7a70d6=Array[_0x4714e4(0x1c4)](_0x199c6a);}};return{'createYamlContext':_0x3fb93f,'prefetchJourneySegments':_0xbcd118};}export async function executePushSegments(_0x42d4bf,_0x27b3e9,_0x249c32,_0x51b61f,_0x2474e0){const _0x42c1dd=a152_0x5819a5,{segmentDefToCreateRequest:_0x47139a,segmentDefToUpdateRequest:_0xc9807b}=await import('./child-segment-yaml.js'),_0x4be8be=_0x249c32[_0x42c1dd(0x10d)],_0x4c44fc=0x5,_0x2efc47=async _0x4dd8df=>{const _0x5b17e5=_0x42c1dd,_0x57981e=_0x4dd8df['folderPath']?_0x4be8be[_0x5b17e5(0x1d9)](_0x4dd8df['folderPath']):undefined;let _0x742e02;const _0x3635b7={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x54d537=_0x4dd8df[_0x5b17e5(0x108)];if(_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1c9)]){const _0x59085d=createSegmentIdResolver(_0x249c32[_0x5b17e5(0x116)],_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]),_0x567ffb=await resolveRuleSegmentIds(_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1c9)],_0x59085d);_0x54d537={..._0x4dd8df[_0x5b17e5(0x108)],'rule':_0x567ffb};}try{if(_0x4dd8df['isNew']){_0x2474e0['onProgress']?.({'type':'segment_creating','name':_0x4dd8df['yamlConfig']['name']});const _0x113224=_0x47139a(_0x54d537,_0x57981e),_0x21f1e3=await _0x2474e0['withProgress']('Creating\x20segment\x20\x27'+_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]+_0x5b17e5(0x17f),()=>_0x42d4bf[_0x5b17e5(0x1c3)][_0x5b17e5(0x16d)](_0x51b61f[_0x5b17e5(0x113)],_0x113224));_0x742e02=_0x21f1e3['data']['id'],_0x249c32['segmentNameToId'][_0x5b17e5(0x1bb)](_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)],_0x742e02),_0x3635b7[_0x5b17e5(0x16e)]={'name':_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)],'id':_0x742e02},_0x2474e0[_0x5b17e5(0x134)]?.({'type':_0x5b17e5(0x15a),'name':_0x4dd8df[_0x5b17e5(0x108)]['name'],'segmentId':_0x742e02}),_0x2474e0[_0x5b17e5(0x1be)]?.(_0x5b17e5(0x129)+_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]+'\x27'),_0x3635b7[_0x5b17e5(0x160)]=0x1;}else{if(_0x4dd8df[_0x5b17e5(0x1ee)]){_0x2474e0[_0x5b17e5(0x134)]?.({'type':_0x5b17e5(0x104),'name':_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]});const _0x583985=_0xc9807b(_0x54d537);_0x57981e!==_0x4dd8df[_0x5b17e5(0x148)]?.[_0x5b17e5(0x178)]&&(_0x583985[_0x5b17e5(0x178)]=_0x57981e?parseInt(_0x57981e,0xa):undefined),await _0x2474e0[_0x5b17e5(0x1df)]('Updating\x20segment\x20\x27'+_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]+'\x27...',()=>_0x42d4bf[_0x5b17e5(0x1c3)][_0x5b17e5(0x152)](_0x51b61f[_0x5b17e5(0x113)],_0x4dd8df['existingSegment']['id'],_0x583985)),_0x742e02=_0x4dd8df['existingSegment']['id'],_0x2474e0[_0x5b17e5(0x134)]?.({'type':_0x5b17e5(0x1a6),'name':_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]}),_0x2474e0[_0x5b17e5(0x1be)]?.(_0x5b17e5(0x19a)+_0x4dd8df['yamlConfig'][_0x5b17e5(0x1a3)]+'\x27'),_0x3635b7[_0x5b17e5(0x14a)]=0x1;}else _0x742e02=_0x4dd8df[_0x5b17e5(0x148)]['id'];}}catch(_0x3aba3a){const _0x469928=isHttp400Error(_0x3aba3a),_0xa40190=_0x469928?ErrorCode[_0x5b17e5(0x1b6)]:ErrorCode[_0x5b17e5(0x144)],_0x1bc058=getErrorMessage(_0x3aba3a);throw new SDKError(_0xa40190,'Failed\x20to\x20'+(_0x4dd8df[_0x5b17e5(0x198)]?_0x5b17e5(0x105):_0x5b17e5(0x1bf))+_0x5b17e5(0x18a)+_0x4dd8df[_0x5b17e5(0x1af)]+_0x5b17e5(0x199)+_0x1bc058,_0x3aba3a);}try{const _0xcd4034=await syncActivationsForSegment(_0x42d4bf,_0x51b61f[_0x5b17e5(0x113)],_0x742e02,_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)],_0x4dd8df[_0x5b17e5(0x1aa)],_0x2474e0,_0x4dd8df[_0x5b17e5(0x1af)]);_0x3635b7[_0x5b17e5(0x15d)]=_0xcd4034;}catch(_0x3de731){if(_0x3de731 instanceof SDKError)throw _0x3de731;throw new SDKError(ErrorCode[_0x5b17e5(0x1c7)],_0x5b17e5(0x1a1)+_0x4dd8df[_0x5b17e5(0x108)][_0x5b17e5(0x1a3)]+'\x27\x20from\x20file:\x20'+_0x4dd8df[_0x5b17e5(0x1af)]+_0x5b17e5(0x199)+getErrorMessage(_0x3de731),_0x3de731);}return _0x3635b7;},_0x1e41be=await batchAsync(_0x27b3e9,_0x2efc47,_0x4c44fc),_0x4efdde={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x33796f of _0x1e41be){_0x4efdde[_0x42c1dd(0x160)]+=_0x33796f[_0x42c1dd(0x160)],_0x4efdde[_0x42c1dd(0x14a)]+=_0x33796f[_0x42c1dd(0x14a)],_0x33796f[_0x42c1dd(0x16e)]&&_0x4efdde[_0x42c1dd(0x124)][_0x42c1dd(0x1bb)](_0x33796f[_0x42c1dd(0x16e)]['name'],_0x33796f[_0x42c1dd(0x16e)]['id']),_0x4efdde[_0x42c1dd(0x15d)][_0x42c1dd(0x160)]+=_0x33796f['activations'][_0x42c1dd(0x160)],_0x4efdde[_0x42c1dd(0x15d)][_0x42c1dd(0x14a)]+=_0x33796f[_0x42c1dd(0x15d)]['updated'],_0x4efdde['activations']['deleted']+=_0x33796f[_0x42c1dd(0x15d)][_0x42c1dd(0x1ce)];}return _0x4efdde;}async function syncActivationsForSegment(_0x55925f,_0x1a9b97,_0x359527,_0x28ff6b,_0x5ed18b,_0x4acdde,_0x15cc77){const _0x58df93=a152_0x5819a5,_0x508501={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x88ce52 of _0x5ed18b){try{if(_0x88ce52['type']===_0x58df93(0x105)&&_0x88ce52[_0x58df93(0x156)])_0x4acdde[_0x58df93(0x134)]?.({'type':_0x58df93(0x1ec),'segmentName':_0x28ff6b,'activationName':_0x88ce52[_0x58df93(0x1a3)]}),await _0x4acdde[_0x58df93(0x1df)](_0x58df93(0x1a5)+_0x88ce52['name']+_0x58df93(0x17f),()=>_0x55925f['segment']['createActivation'](_0x1a9b97,_0x359527,_0x88ce52[_0x58df93(0x156)])),_0x4acdde['onProgress']?.({'type':'activation_created','segmentName':_0x28ff6b,'activationName':_0x88ce52[_0x58df93(0x1a3)]}),_0x4acdde[_0x58df93(0x1be)]?.(_0x58df93(0x1d0)+_0x88ce52['name']+'\x27'),_0x508501[_0x58df93(0x160)]++;else{if(_0x88ce52['type']===_0x58df93(0x1bf)&&_0x88ce52[_0x58df93(0x156)]&&_0x88ce52[_0x58df93(0x1da)])_0x4acdde[_0x58df93(0x134)]?.({'type':_0x58df93(0x1f8),'segmentName':_0x28ff6b,'activationName':_0x88ce52[_0x58df93(0x1a3)]}),await _0x4acdde[_0x58df93(0x1df)](_0x58df93(0x1a9)+_0x88ce52['name']+_0x58df93(0x17f),()=>_0x55925f[_0x58df93(0x1c3)][_0x58df93(0x1b9)](_0x1a9b97,_0x359527,_0x88ce52[_0x58df93(0x1da)]['id'],_0x88ce52['validatedRequest'])),_0x4acdde[_0x58df93(0x134)]?.({'type':'activation_updated','segmentName':_0x28ff6b,'activationName':_0x88ce52['name']}),_0x4acdde['logSuccess']?.(_0x58df93(0x1fe)+_0x88ce52[_0x58df93(0x1a3)]+'\x27'),_0x508501[_0x58df93(0x14a)]++;else _0x88ce52[_0x58df93(0x150)]===_0x58df93(0x1d4)&&_0x88ce52[_0x58df93(0x1da)]&&(_0x4acdde[_0x58df93(0x134)]?.({'type':_0x58df93(0x143),'segmentName':_0x28ff6b,'activationName':_0x88ce52[_0x58df93(0x1a3)]}),await _0x4acdde[_0x58df93(0x1df)](_0x58df93(0x1e2)+_0x88ce52[_0x58df93(0x1a3)]+_0x58df93(0x17f),()=>_0x55925f[_0x58df93(0x1c3)]['deleteActivation'](_0x1a9b97,_0x359527,_0x88ce52[_0x58df93(0x1da)]['id'])),_0x4acdde['onProgress']?.({'type':_0x58df93(0x11d),'segmentName':_0x28ff6b,'activationName':_0x88ce52[_0x58df93(0x1a3)]}),_0x4acdde[_0x58df93(0x141)]?.(_0x58df93(0x16c)+_0x88ce52['name']+'\x27'),_0x508501[_0x58df93(0x1ce)]++);}}catch(_0x4baa3a){const _0x3177d9=isHttp400Error(_0x4baa3a),_0x49e6fa=_0x3177d9?ErrorCode[_0x58df93(0x170)]:ErrorCode[_0x58df93(0x1c7)],_0x1b13c6=getErrorMessage(_0x4baa3a);throw new SDKError(_0x49e6fa,_0x58df93(0x1f3)+_0x88ce52[_0x58df93(0x150)]+_0x58df93(0x1a2)+_0x88ce52[_0x58df93(0x1a3)]+_0x58df93(0x115)+_0x15cc77+'\x0a\x20\x20'+_0x1b13c6,_0x4baa3a);}}return _0x508501;}export async function executePushFolders(_0x3f806b,_0x463da9,_0x4b733b,_0x512a4a,_0x5c2116){const _0xf3e3a2=a152_0x5819a5,_0x5773ee=new Map(_0x4b733b),_0xaf87ad=sortFoldersByDepth(_0x463da9);for(const _0x50f479 of _0xaf87ad){const _0x583496=_0x50f479[_0xf3e3a2(0x17c)]('/'),_0x455f1a=_0x583496[_0x583496['length']-0x1],_0x59214d=_0x583496[_0xf3e3a2(0x1b8)](0x0,-0x1)[_0xf3e3a2(0x110)]('/'),_0x38e7ee=_0x5773ee['get'](_0x59214d);_0x5c2116[_0xf3e3a2(0x134)]?.({'type':_0xf3e3a2(0x137),'folder':_0x50f479});const _0x538b23={'name':_0x455f1a,'parentFolderId':_0x38e7ee},_0x1eba68=await _0x5c2116[_0xf3e3a2(0x1df)](_0xf3e3a2(0x1f2)+_0x50f479+'\x27...',()=>_0x3f806b[_0xf3e3a2(0x1c3)][_0xf3e3a2(0x13d)](_0x512a4a[_0xf3e3a2(0x113)],_0x538b23));_0x5773ee[_0xf3e3a2(0x1bb)](_0x50f479,_0x1eba68[_0xf3e3a2(0x13e)]['id']),_0x5c2116[_0xf3e3a2(0x134)]?.({'type':_0xf3e3a2(0x1fd),'folder':_0x50f479,'folderId':_0x1eba68['data']['id']}),_0x5c2116[_0xf3e3a2(0x163)]?.('Created\x20folder\x20\x27'+_0x50f479+'\x27');}return _0x5773ee;}export async function executePushSegmentDeletions(_0x599717,_0x5740b8,_0x5f206e){const _0x2cc51d=a152_0x5819a5;if(_0x5740b8[_0x2cc51d(0x19b)]===0x0)return 0x0;const {batchAsync:_0x4ec129}=await import(_0x2cc51d(0x103)),_0x25d59e=0x5,_0x428033=await _0x4ec129(_0x5740b8,async _0x8437b0=>{const _0x41c0ce=_0x2cc51d;return _0x5f206e[_0x41c0ce(0x134)]?.({'type':_0x41c0ce(0x173),'name':_0x8437b0[_0x41c0ce(0x1a3)]}),await _0x599717[_0x41c0ce(0x1c3)][_0x41c0ce(0x184)](_0x8437b0['id']),_0x5f206e[_0x41c0ce(0x134)]?.({'type':_0x41c0ce(0x1ab),'name':_0x8437b0[_0x41c0ce(0x1a3)]}),_0x5f206e['logDeleted']?.(_0x41c0ce(0x111)+_0x8437b0['name']+'\x27'),0x1;},_0x25d59e);return _0x428033['reduce']((_0x418faa,_0x40c0aa)=>_0x418faa+_0x40c0aa,0x0);}export async function executePushJourneys(_0x28b61d,_0x3f59b3,_0x2e3106,_0x20318f,_0x307747){const _0x6223a=a152_0x5819a5,{journeyDefToRequest:_0x2e7ba6}=await import(_0x6223a(0x155)),{activationDefToCreateRequest:_0x45dc5c,yamlRuleToApi:_0x29107c,validateSegmentRule:_0x223329}=await import(_0x6223a(0x1cf)),_0x5cc2de={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x227da7=new Map(_0x2e3106[_0x6223a(0x116)]),_0x14c32b=0x5;for(let _0x4d6124=0x0;_0x4d6124<_0x3f59b3[_0x6223a(0x19b)];_0x4d6124+=_0x14c32b){const _0x18c145=_0x3f59b3[_0x6223a(0x1b8)](_0x4d6124,_0x4d6124+_0x14c32b),_0x2852cd=await Promise['all'](_0x18c145[_0x6223a(0x1fc)](async _0x5bfb7c=>{const _0x1dfb36=_0x6223a;if(!_0x5bfb7c['isNew']&&!_0x5bfb7c[_0x1dfb36(0x1ee)])return{'action':_0x1dfb36(0x1b1),'name':_0x5bfb7c[_0x1dfb36(0x108)][_0x1dfb36(0x1a3)],'journeyId':_0x5bfb7c['existingJourney']?.['id']};const _0x10fc93=_0x5bfb7c['folderPath']?_0x2e3106[_0x1dfb36(0x10d)][_0x1dfb36(0x1d9)](_0x5bfb7c[_0x1dfb36(0x1ba)]):undefined;_0x307747[_0x1dfb36(0x134)]?.({'type':_0x5bfb7c[_0x1dfb36(0x198)]?_0x1dfb36(0x1e9):'journey_updating','name':_0x5bfb7c[_0x1dfb36(0x108)]['name']});try{const _0x3b7900=await executeSingleJourneyPush(_0x28b61d,_0x5bfb7c,{..._0x2e3106,'segmentNameToId':_0x227da7},{'parentId':_0x20318f[_0x1dfb36(0x113)],'rootFolderId':_0x20318f['rootFolderId'],'folderId':_0x10fc93,'verbose':_0x20318f[_0x1dfb36(0x185)]},_0x307747,{'journeyDefToRequest':_0x2e7ba6,'activationDefToCreateRequest':_0x45dc5c,'yamlRuleToApi':_0x29107c,'validateSegmentRule':_0x223329});for(const [_0x447e5d,_0x18a638]of _0x3b7900['embeddedSegmentNameToId']){_0x227da7['set'](_0x447e5d,_0x18a638),_0x5cc2de[_0x1dfb36(0x14c)][_0x1dfb36(0x1bb)](_0x447e5d,_0x18a638);}if(_0x3b7900[_0x1dfb36(0x1f4)]===_0x1dfb36(0x160))_0x307747['onProgress']?.({'type':_0x1dfb36(0x188),'name':_0x5bfb7c[_0x1dfb36(0x108)][_0x1dfb36(0x1a3)],'journeyId':_0x3b7900[_0x1dfb36(0x1e5)]}),_0x307747['logSuccess']?.('Created\x20journey\x20\x27'+_0x5bfb7c[_0x1dfb36(0x108)][_0x1dfb36(0x1a3)]+'\x27'),_0x5cc2de['created']++;else _0x3b7900[_0x1dfb36(0x1f4)]===_0x1dfb36(0x14a)&&(_0x307747[_0x1dfb36(0x134)]?.({'type':_0x1dfb36(0x1fa),'name':_0x5bfb7c[_0x1dfb36(0x108)][_0x1dfb36(0x1a3)]}),_0x307747['logSuccess']?.(_0x1dfb36(0x100)+_0x5bfb7c['yamlConfig']['name']+'\x27'),_0x5cc2de[_0x1dfb36(0x14a)]++);return{'action':_0x3b7900['action'],'name':_0x5bfb7c[_0x1dfb36(0x108)][_0x1dfb36(0x1a3)],'journeyId':_0x3b7900['journeyId']};}catch(_0x599578){const _0x3bf86c=isHttp400Error(_0x599578),_0x4f2790=_0x3bf86c?ErrorCode[_0x1dfb36(0x16b)]:ErrorCode[_0x1dfb36(0x1b4)],_0x403343=getErrorMessage(_0x599578);throw new SDKError(_0x4f2790,_0x1dfb36(0x1f3)+(_0x5bfb7c[_0x1dfb36(0x198)]?_0x1dfb36(0x105):_0x1dfb36(0x1bf))+_0x1dfb36(0x142)+_0x5bfb7c[_0x1dfb36(0x1af)]+_0x1dfb36(0x199)+_0x403343,_0x599578);}}));_0x5cc2de[_0x6223a(0x1a7)]['push'](..._0x2852cd);}return _0x5cc2de;}async function matchExistingJourneySegments(_0x2ba6bc,_0x1e2309,_0x22fa8d,_0x5bd83b,_0x360f99){const _0x103b54=a152_0x5819a5;if(!_0x1e2309[_0x103b54(0x202)]||!_0x1e2309[_0x103b54(0x108)][_0x103b54(0x15f)])return;const _0x33ebaa=new Map(),_0x2e5c65=new Set();for(const _0x1afcd9 of Object[_0x103b54(0x101)](_0x1e2309[_0x103b54(0x108)][_0x103b54(0x15f)])){const _0x3e4289=generateDeterministicJourneySegmentName(_0x1e2309['yamlConfig'][_0x103b54(0x1a3)],_0x1afcd9);_0x33ebaa[_0x103b54(0x1bb)](_0x3e4289,_0x1afcd9),_0x2e5c65[_0x103b54(0x1ff)](_0x1afcd9);}const _0x5dad32=[],_0x3c1251=collectSegmentIdsFromJourneyApi(_0x1e2309[_0x103b54(0x202)]);for(const _0x24c0dc of _0x3c1251){const _0xe1c83f=await fetchSegment(_0x2ba6bc,_0x22fa8d,_0x24c0dc,_0x5bd83b);if(!_0xe1c83f?.['name'])continue;const _0x1c0300=_0x33ebaa[_0x103b54(0x1d9)](_0xe1c83f[_0x103b54(0x1a3)]);_0x1c0300?(_0x360f99[_0x103b54(0x1bb)](_0x1c0300,_0x24c0dc),_0x2e5c65[_0x103b54(0x1d4)](_0x1c0300)):_0x5dad32[_0x103b54(0x1b3)]({'id':_0x24c0dc,'seg':_0xe1c83f});}if(_0x2e5c65[_0x103b54(0x1c6)]>0x0&&_0x5dad32[_0x103b54(0x19b)]>0x0){const {localExpandedRuleToNames:_0x32c40c}=buildLocalExpandedRuleMappings(_0x1e2309['yamlConfig']),_0x4a8f1e=new Map();for(const {id:_0x2d8ac8,seg:_0x203cae}of _0x5dad32){if(_0x203cae[_0x103b54(0x1c9)]){const _0x54439a=apiRuleToYaml(_0x203cae[_0x103b54(0x1c9)]);_0x4a8f1e['set'](_0x2d8ac8,_0x54439a);}}for(const {id:_0x3794e0,seg:_0x4bc82d}of _0x5dad32){if(!_0x4bc82d[_0x103b54(0x1c9)])continue;const _0x723b56=_0x4a8f1e[_0x103b54(0x1d9)](_0x3794e0);if(!_0x723b56)continue;const _0x27951d=serializeExpandedRule(_0x723b56,_0x4a8f1e),_0x29a49b=_0x32c40c[_0x103b54(0x1d9)](_0x27951d);if(_0x29a49b){const _0x3442b6=_0x29a49b['find'](_0x50d673=>_0x2e5c65[_0x103b54(0x1e3)](_0x50d673));_0x3442b6&&(_0x360f99[_0x103b54(0x1bb)](_0x3442b6,_0x3794e0),_0x2e5c65['delete'](_0x3442b6),logger[_0x103b54(0x172)](_0x103b54(0x196)+_0x4bc82d[_0x103b54(0x1a3)]+_0x103b54(0x1de)+_0x3442b6+_0x103b54(0x149)));}}}}async function executeSingleJourneyPush(_0x34d3fb,_0x1306b5,_0x3cc288,_0x446a2a,_0xa5a9d1,_0x24f0f5){const _0x58a0bf=a152_0x5819a5,{journeyDefToRequest:_0x11055b,activationDefToCreateRequest:_0x451ee7,yamlRuleToApi:_0x5165cb,validateSegmentRule:_0x1428ce}=_0x24f0f5,_0x1819cc=new Map(),_0x5ccb45=new Map();recoverSegmentIdsFromPushRecovery(_0x1306b5,_0x1819cc,_0x3cc288[_0x58a0bf(0x116)]);const _0x572517=new Map(),_0x1919c2=new Map(),_0x4d77e9=new Map();let _0x1b4684;const _0x499694=async()=>{const _0x1e868e=_0x58a0bf;if(_0x1b4684)return;_0x1b4684=new Map();if(!_0x1306b5[_0x1e868e(0x202)])return;const _0x1c8fc5=await _0x34d3fb[_0x1e868e(0x11c)][_0x1e868e(0x17e)](_0x1306b5[_0x1e868e(0x202)]['id']);for(const _0x64c274 of _0x1c8fc5){const _0x199310=journeyActivationStepToYaml(_0x64c274,_0x3cc288[_0x1e868e(0x10b)],_0x3cc288['connectionIdToNameMap']),_0x1c676e=activationSignature(_0x199310);!_0x1b4684[_0x1e868e(0x1e3)](_0x1c676e)&&_0x1b4684[_0x1e868e(0x1bb)](_0x1c676e,_0x64c274['id']),_0x199310['name']&&_0x5ccb45[_0x1e868e(0x1bb)](_0x199310[_0x1e868e(0x1a3)],_0x64c274['id']);}};await matchExistingJourneySegments(_0x34d3fb,_0x1306b5,_0x446a2a[_0x58a0bf(0x113)],_0x3cc288[_0x58a0bf(0x1e8)],_0x3cc288[_0x58a0bf(0x116)]);const _0x54f213={'resolveSegmentId':async _0x31fe0c=>{const _0x2f8b26=_0x58a0bf,_0x4386cc=_0x3cc288[_0x2f8b26(0x116)][_0x2f8b26(0x1d9)](_0x31fe0c);if(!_0x4386cc)throw new SDKError(ErrorCode[_0x2f8b26(0x10a)],'Segment\x20not\x20found:\x20'+_0x31fe0c+_0x2f8b26(0x1c8)+_0x1306b5[_0x2f8b26(0x108)]['name']+')');return _0x4386cc;},'resolveEmbeddedSegmentId':async(_0x48b71d,_0x27cbec)=>{const _0x1e0dfb=_0x58a0bf,_0x43504b=_0x3cc288['segmentNameToId'][_0x1e0dfb(0x1d9)](_0x48b71d);if(_0x43504b)return _0x43504b;const _0x14c441=_0x3cc288[_0x1e0dfb(0x1e8)][_0x1e0dfb(0x133)](_0x17fe7f=>_0x17fe7f[_0x1e0dfb(0x1a3)]===_0x48b71d);if(_0x14c441)return _0x3cc288[_0x1e0dfb(0x116)]['set'](_0x48b71d,_0x14c441['id']),_0x14c441['id'];if(_0x1306b5[_0x1e0dfb(0x198)]){const {stageName:_0x47589a,criteriaName:_0x5095ec}=findSegmentCriteriaLocation(_0x1306b5['yamlConfig'],_0x48b71d);return _0x1428ce(_0x48b71d,_0x27cbec['rule']),_0x1919c2[_0x1e0dfb(0x1bb)](_0x48b71d,{'definition':_0x27cbec,'stageName':_0x47589a,'criteriaName':_0x5095ec}),createPendingSegmentId(_0x48b71d);}const _0x4b9813=_0x1306b5['existingJourney']?.['id'];if(!_0x4b9813)throw new SDKError(ErrorCode[_0x1e0dfb(0x167)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x588940=_0x572517[_0x1e0dfb(0x1d9)](_0x48b71d);if(_0x588940)return _0x588940;const _0x26cbd1=((async()=>{const _0x489b56=_0x1e0dfb;_0x1428ce(_0x48b71d,_0x27cbec['rule']);const _0x7d1e36=generateDeterministicJourneySegmentName(_0x1306b5['yamlConfig']['name'],_0x48b71d),_0x3705bc=_0x3cc288[_0x489b56(0x1e8)][_0x489b56(0x133)](_0x256df5=>_0x256df5['name']===_0x7d1e36),_0x31b06a=createSegmentIdResolver(_0x3cc288['segmentNameToId'],_0x48b71d),_0x1d8bca=await resolveRuleSegmentIds(_0x27cbec[_0x489b56(0x1c9)],_0x31b06a);let _0x2bb1c0;return _0x3705bc?(await _0x34d3fb[_0x489b56(0x1c3)][_0x489b56(0x152)](_0x446a2a[_0x489b56(0x113)],_0x3705bc['id'],{'description':_0x27cbec[_0x489b56(0x197)]||_0x489b56(0x128)+_0x48b71d,'rule':_0x5165cb(_0x1d8bca),'countPopulation':!![]}),_0x2bb1c0=_0x3705bc['id'],saveSegmentToPushRecovery(_0x1306b5['absolutePath'],_0x1306b5[_0x489b56(0x108)]['name'],_0x48b71d,{'segmentId':_0x2bb1c0,'uniqueServerName':_0x7d1e36,'createdAt':new Date()[_0x489b56(0x204)]()})):_0x2bb1c0=await createOrRecoverEmbeddedSegment(_0x34d3fb,_0x1306b5,{'localName':_0x48b71d,'uniqueSegmentName':_0x7d1e36,'description':_0x27cbec['description']||_0x489b56(0x128)+_0x48b71d,'journeyId':_0x4b9813,'resolvedRule':_0x1d8bca,'parentId':_0x446a2a[_0x489b56(0x113)],'folderId':_0x446a2a[_0x489b56(0x1c2)]||''},_0x5165cb),_0x3cc288[_0x489b56(0x116)]['set'](_0x48b71d,_0x2bb1c0),_0x1819cc[_0x489b56(0x1bb)](_0x48b71d,_0x2bb1c0),_0x2bb1c0;})());_0x572517[_0x1e0dfb(0x1bb)](_0x48b71d,_0x26cbd1);try{return await _0x26cbd1;}finally{_0x572517[_0x1e0dfb(0x1d4)](_0x48b71d);}},'resolveActivationId':async _0xb71d99=>{const _0x291b87=_0x58a0bf,_0x1bde22=_0x5ccb45['get'](_0xb71d99);if(_0x1bde22)return _0x1bde22;if(_0x1306b5[_0x291b87(0x202)]){await _0x499694();const _0x25e8ba=_0x5ccb45[_0x291b87(0x1d9)](_0xb71d99);if(_0x25e8ba)return _0x25e8ba;}throw new SDKError(ErrorCode[_0x291b87(0x138)],_0x291b87(0x174)+_0xb71d99+_0x291b87(0x1c8)+_0x1306b5[_0x291b87(0x108)][_0x291b87(0x1a3)]+_0x291b87(0x1d2)+_0x291b87(0x1d5));},'resolveEmbeddedActivationId':async(_0x10be0f,_0x213b57)=>{const _0x3a8681=_0x58a0bf,_0x200d7b=_0x5ccb45[_0x3a8681(0x1d9)](_0x10be0f);if(_0x200d7b)return _0x200d7b;if(_0x1306b5[_0x3a8681(0x198)])return _0x4d77e9[_0x3a8681(0x1bb)](_0x10be0f,_0x213b57),createPendingActivationId(_0x10be0f);if(_0x1306b5['existingJourney']){await _0x499694();const _0x2810b5=_0x5ccb45[_0x3a8681(0x1d9)](_0x213b57['name']);if(_0x2810b5)return _0x5ccb45[_0x3a8681(0x1bb)](_0x10be0f,_0x2810b5),_0x2810b5;const _0x398075=activationSignature(_0x213b57),_0x2e3589=_0x1b4684?.[_0x3a8681(0x1d9)](_0x398075);if(_0x2e3589)return _0x5ccb45[_0x3a8681(0x1bb)](_0x10be0f,_0x2e3589),_0x2e3589;const _0x336006=await _0x451ee7(_0x213b57,_0x3cc288[_0x3a8681(0x139)]),_0x4c9dca={..._0x336006,..._0x213b57['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x213b57['run_after_journey_refresh']}},_0x1e0365=await _0x34d3fb['journey']['createActivation'](_0x1306b5['existingJourney']['id'],_0x4c9dca);return _0x5ccb45[_0x3a8681(0x1bb)](_0x10be0f,_0x1e0365['id']),_0x1e0365['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x3a8681(0x147));},'resolveJourneyId':async _0xde296c=>{const _0x2b5d60=_0x58a0bf;try{return await _0x34d3fb[_0x2b5d60(0x11c)][_0x2b5d60(0x1dd)](_0x446a2a[_0x2b5d60(0x113)],_0xde296c);}catch(_0x25f1db){throw new SDKError(ErrorCode[_0x2b5d60(0x138)],'Journey\x20\x27'+_0xde296c+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x1306b5[_0x2b5d60(0x108)]['name']+'\x27)',_0x25f1db);}},'resolveStageId':async(_0x5147f4,_0x481b1c)=>{const _0x43a584=_0x58a0bf,_0x265717=await _0x34d3fb[_0x43a584(0x11c)][_0x43a584(0x18e)](_0x5147f4),_0x288325=_0x265717[_0x43a584(0x18d)]['journeyStages']['find'](_0x4f7775=>_0x4f7775[_0x43a584(0x1a3)][_0x43a584(0x157)]()===_0x481b1c['toLowerCase']());if(!_0x288325?.['id'])throw new SDKError(ErrorCode[_0x43a584(0x138)],_0x43a584(0x19e)+_0x481b1c+_0x43a584(0x1d7)+(_0x265717[_0x43a584(0x18d)]['journeyBundleName']||_0x265717[_0x43a584(0x18d)][_0x43a584(0x1a3)])+'\x27');return _0x288325['id'];}},_0x55d936=await _0x11055b(_0x1306b5[_0x58a0bf(0x108)],_0x446a2a[_0x58a0bf(0x113)],_0x54f213),_0x5345a8=_0x446a2a['folderId']||_0x446a2a['rootFolderId'];_0x5345a8&&(_0x55d936[_0x58a0bf(0x183)]={'parentFolder':{'data':{'id':_0x5345a8,'type':_0x58a0bf(0x1c0)}}});if(_0x1306b5[_0x58a0bf(0x198)]){if(_0x1919c2[_0x58a0bf(0x1c6)]>0x0||_0x4d77e9[_0x58a0bf(0x1c6)]>0x0)return await executeThreeStepJourneyCreate(_0x34d3fb,_0x1306b5,_0x55d936,{'pendingEmbeddedSegments':_0x1919c2,'pendingEmbeddedActivations':_0x4d77e9,'embeddedSegmentNameToId':_0x1819cc,'journeyActivationNameToId':_0x5ccb45},{..._0x446a2a,'effectiveFolderId':_0x5345a8},_0x3cc288,_0xa5a9d1,_0x24f0f5);else{ensureJourneyDefaults(_0x55d936[_0x58a0bf(0x18d)]);const _0x1eca4f=await _0x34d3fb[_0x58a0bf(0x11c)][_0x58a0bf(0x105)](_0x55d936);return deletePushRecovery(_0x1306b5[_0x58a0bf(0x1af)]),{'action':_0x58a0bf(0x160),'journeyId':_0x1eca4f['id'],'embeddedSegmentNameToId':_0x1819cc};}}else{if(_0x1306b5[_0x58a0bf(0x1ee)]&&_0x1306b5[_0x58a0bf(0x202)]){_0x55d936['id']=_0x1306b5[_0x58a0bf(0x202)]['id'];const _0x23019b=_0x55d936[_0x58a0bf(0x18d)];_0x1306b5[_0x58a0bf(0x202)][_0x58a0bf(0x18d)]?.[_0x58a0bf(0x1d6)]&&(_0x23019b[_0x58a0bf(0x1d6)]=_0x1306b5[_0x58a0bf(0x202)]['attributes'][_0x58a0bf(0x1d6)]);const _0x4f76e4=_0x1306b5[_0x58a0bf(0x202)][_0x58a0bf(0x18d)]?.['journeyStages'];return _0x4f76e4&&_0x55d936[_0x58a0bf(0x18d)][_0x58a0bf(0x1f7)]&&injectExistingStageIds(_0x55d936[_0x58a0bf(0x18d)]['journeyStages'],_0x4f76e4),ensureJourneyDefaults(_0x23019b),await _0x34d3fb[_0x58a0bf(0x11c)][_0x58a0bf(0x1bf)](_0x1306b5[_0x58a0bf(0x202)]['id'],_0x55d936),deletePushRecovery(_0x1306b5[_0x58a0bf(0x1af)]),{'action':'updated','journeyId':_0x1306b5['existingJourney']['id'],'embeddedSegmentNameToId':_0x1819cc};}}return deletePushRecovery(_0x1306b5[_0x58a0bf(0x1af)]),{'action':_0x58a0bf(0x1b1),'journeyId':_0x1306b5[_0x58a0bf(0x202)]?.['id'],'embeddedSegmentNameToId':_0x1819cc};}function findSegmentCriteriaLocation(_0x2eb7b4,_0x3ed476){const _0x162218=a152_0x5819a5,_0x281273=_0x2eb7b4['stages']||_0x2eb7b4[_0x162218(0x158)]?.[0x0]?.[_0x162218(0x17b)]||[];let _0xbe7a63=_0x162218(0x187),_0x38893e=_0x3ed476;const _0x28c7e9=_0x2eb7b4[_0x162218(0x1d8)]||_0x2eb7b4[_0x162218(0x158)]?.[0x0]?.[_0x162218(0x1d8)];if(_0x28c7e9?.[_0x162218(0x1c3)]===_0x3ed476)return{'stageName':_0x162218(0x1d8),'criteriaName':_0x28c7e9[_0x162218(0x1a3)]||_0x3ed476};_0x4cc72e:for(const _0x1a055f of _0x281273){if(_0x1a055f[_0x162218(0x127)]?.[_0x162218(0x1c3)]===_0x3ed476){_0xbe7a63=_0x1a055f['name'],_0x38893e=_0x1a055f[_0x162218(0x127)][_0x162218(0x1a3)]||_0x3ed476;break;}if(_0x1a055f['steps'])for(const _0x301e8d of _0x1a055f[_0x162218(0x1f9)]){if(_0x301e8d['type']==='decision_point'&&_0x301e8d[_0x162218(0x106)]?.[_0x162218(0x1ed)])for(const _0x14e038 of _0x301e8d[_0x162218(0x106)][_0x162218(0x1ed)]){if(_0x14e038['segment']===_0x3ed476){_0xbe7a63=_0x1a055f[_0x162218(0x1a3)],_0x38893e=_0x14e038[_0x162218(0x1a3)]||_0x3ed476;break _0x4cc72e;}}}}return{'stageName':_0xbe7a63,'criteriaName':_0x38893e};}async function executeThreeStepJourneyCreate(_0x2b9d3b,_0x116b54,_0xa5332,_0x4e7778,_0xdfad5d,_0x156e18,_0x13c04c,_0x7aec40){const _0x313065=a152_0x5819a5,{activationDefToCreateRequest:_0x4dc450,yamlRuleToApi:_0x1ca142}=_0x7aec40,{pendingEmbeddedSegments:_0x19ffdf,pendingEmbeddedActivations:_0x3d016a,embeddedSegmentNameToId:_0x1bbba4}=_0x4e7778,_0x1bf342=JSON[_0x313065(0x17d)](JSON['stringify'](_0xa5332));ensureJourneyDefaults(_0x1bf342['attributes']),stripPendingIds(_0x1bf342);const _0x3bb61c=await _0x2b9d3b[_0x313065(0x11c)][_0x313065(0x105)](_0x1bf342),_0x2cf44f=_0x3bb61c['id'],_0x7d463=new Map();for(const _0x3143ad of _0x3bb61c[_0x313065(0x18d)]['journeyStages']){_0x7d463[_0x313065(0x1bb)](_0x3143ad['name'][_0x313065(0x157)](),_0x3143ad['id']);}recoverSegmentIdsFromPushRecovery(_0x116b54,_0x1bbba4,_0x156e18[_0x313065(0x116)]);for(const [_0x18b768,{definition:_0x2b41d4}]of _0x19ffdf){if(_0x1bbba4[_0x313065(0x1e3)](_0x18b768)){_0x13c04c[_0x313065(0x134)]?.({'type':_0x313065(0x162),'journeyName':_0x116b54['yamlConfig'][_0x313065(0x1a3)],'segmentName':_0x18b768});continue;}const _0x220770=generateDeterministicJourneySegmentName(_0x116b54[_0x313065(0x108)][_0x313065(0x1a3)],_0x18b768);_0x13c04c[_0x313065(0x134)]?.({'type':'embedded_segment_creating','journeyName':_0x116b54[_0x313065(0x108)][_0x313065(0x1a3)],'segmentName':_0x18b768});const _0x535793=createSegmentIdResolver(_0x156e18[_0x313065(0x116)],_0x18b768),_0x51c31e=await resolveRuleSegmentIds(_0x2b41d4[_0x313065(0x1c9)],_0x535793),_0x28a2ec=await createOrRecoverEmbeddedSegment(_0x2b9d3b,_0x116b54,{'localName':_0x18b768,'uniqueSegmentName':_0x220770,'description':_0x2b41d4[_0x313065(0x197)]||'Entry\x20criteria:\x20'+_0x18b768,'journeyId':_0x2cf44f,'resolvedRule':_0x51c31e,'parentId':_0xdfad5d[_0x313065(0x113)],'folderId':_0xdfad5d[_0x313065(0x114)]||''},_0x1ca142);_0x1bbba4['set'](_0x18b768,_0x28a2ec),_0x156e18[_0x313065(0x116)][_0x313065(0x1bb)](_0x18b768,_0x28a2ec),_0x13c04c[_0x313065(0x134)]?.({'type':_0x313065(0x162),'journeyName':_0x116b54[_0x313065(0x108)][_0x313065(0x1a3)],'segmentName':_0x18b768});}const _0x1ca4ac=new Map();for(const [_0x597e77,_0x465520]of _0x3d016a){_0x13c04c['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x116b54[_0x313065(0x108)][_0x313065(0x1a3)],'activationName':_0x597e77});const _0x2c2980=await _0x4dc450(_0x465520,_0x156e18['activationContext']),_0x4c107a={..._0x2c2980,..._0x465520[_0x313065(0x1dc)]!==undefined&&{'runAfterJourneyRefresh':_0x465520['run_after_journey_refresh']}},_0x1e8a6d=await _0x2b9d3b[_0x313065(0x11c)]['createActivation'](_0x2cf44f,_0x4c107a);_0x1ca4ac['set'](_0x597e77,_0x1e8a6d['id']),_0x4e7778['journeyActivationNameToId'][_0x313065(0x1bb)](_0x597e77,_0x1e8a6d['id']),_0x13c04c[_0x313065(0x134)]?.({'type':_0x313065(0x1ea),'journeyName':_0x116b54['yamlConfig']['name'],'activationName':_0x597e77});}const _0x4abdba=JSON[_0x313065(0x17d)](JSON[_0x313065(0x203)](_0xa5332));return _0x4abdba['id']=_0x2cf44f,ensureJourneyDefaults(_0x4abdba['attributes']),resolvePendingIdsInRequest(_0x4abdba,_0xa5332,_0x7d463,_0x1bbba4,_0x1ca4ac,_0x13c04c),await _0x2b9d3b[_0x313065(0x11c)][_0x313065(0x1bf)](_0x2cf44f,_0x4abdba),deletePushRecovery(_0x116b54[_0x313065(0x1af)]),{'action':_0x313065(0x160),'journeyId':_0x2cf44f,'embeddedSegmentNameToId':_0x1bbba4};}export function stripWaitStepPendingIds(_0x5d7197){const _0x5a1c31=a152_0x5819a5,_0x1c365b=_0x5d7197['conditionSegmentId']&&isPendingSegmentId(_0x5d7197[_0x5a1c31(0x145)]),_0x34ac53=_0x5d7197['conditions']?.['some'](_0x54883a=>_0x54883a['segmentId']&&isPendingSegmentId(_0x54883a[_0x5a1c31(0x15e)]));(_0x1c365b||_0x34ac53)&&(_0x5d7197[_0x5a1c31(0x112)]=_0x5a1c31(0x107),_0x5d7197[_0x5a1c31(0x189)]=0x1,_0x5d7197[_0x5a1c31(0x200)]=_0x5a1c31(0x1b0),delete _0x5d7197[_0x5a1c31(0x145)],delete _0x5d7197[_0x5a1c31(0x126)],delete _0x5d7197['conditionTimeoutUnit'],delete _0x5d7197[_0x5a1c31(0x201)]);}export function resolveWaitStepPendingIds(_0x5879a8,_0x5d3936,_0xb92311,_0x5911bb){const _0x14772d=a152_0x5819a5;if(_0x5d3936[_0x14772d(0x145)]&&isPendingSegmentId(_0x5d3936[_0x14772d(0x145)])){const _0x2ea4b5=_0xb92311(_0x5d3936[_0x14772d(0x145)],_0x14772d(0x123)+_0x5911bb+_0x14772d(0x10f));_0x2ea4b5&&(_0x5879a8[_0x14772d(0x112)]=_0x14772d(0x195),_0x5879a8[_0x14772d(0x145)]=_0x2ea4b5,delete _0x5879a8[_0x14772d(0x189)],delete _0x5879a8[_0x14772d(0x200)],_0x5d3936[_0x14772d(0x126)]!==undefined&&(_0x5879a8[_0x14772d(0x126)]=_0x5d3936[_0x14772d(0x126)]),_0x5d3936['conditionTimeoutUnit']&&(_0x5879a8[_0x14772d(0x153)]=_0x5d3936['conditionTimeoutUnit']));}if(_0x5d3936['conditions']){const _0xa03f7c=_0x5d3936[_0x14772d(0x201)][_0x14772d(0x119)](_0x5ab514=>_0x5ab514[_0x14772d(0x15e)]&&isPendingSegmentId(_0x5ab514['segmentId']));if(_0xa03f7c){const _0x18a664=_0x5d3936[_0x14772d(0x201)][_0x14772d(0x1fc)](_0x5826ea=>{const _0x34685f=_0x14772d;if(_0x5826ea[_0x34685f(0x15e)]&&isPendingSegmentId(_0x5826ea[_0x34685f(0x15e)])){const _0x5d6935=_0xb92311(_0x5826ea[_0x34685f(0x15e)],_0x34685f(0x123)+_0x5911bb+_0x34685f(0x10f));return{..._0x5826ea,'segmentId':_0x5d6935||_0x5826ea[_0x34685f(0x15e)]};}return{..._0x5826ea};});_0x5879a8[_0x14772d(0x112)]=_0x14772d(0x195),_0x5879a8['conditions']=_0x18a664,delete _0x5879a8['waitStep'],delete _0x5879a8['waitStepUnit'],delete _0x5879a8['conditionSegmentId'],delete _0x5879a8[_0x14772d(0x126)],delete _0x5879a8['conditionTimeoutUnit'];}}}function stripPendingIds(_0x43b1a0){const _0x293f74=a152_0x5819a5;_0x43b1a0[_0x293f74(0x18d)][_0x293f74(0x1d8)]?.['segmentId']&&isPendingSegmentId(_0x43b1a0['attributes'][_0x293f74(0x1d8)][_0x293f74(0x15e)])&&delete _0x43b1a0['attributes'][_0x293f74(0x1d8)];for(const _0x4a125a of _0x43b1a0[_0x293f74(0x18d)][_0x293f74(0x1f7)]||[]){_0x4a125a[_0x293f74(0x14d)]?.['segmentId']&&isPendingSegmentId(_0x4a125a['entryCriteria'][_0x293f74(0x15e)])&&delete _0x4a125a[_0x293f74(0x14d)];_0x4a125a[_0x293f74(0x1a8)]?.[_0x293f74(0x15e)]&&isPendingSegmentId(_0x4a125a[_0x293f74(0x1a8)][_0x293f74(0x15e)])&&delete _0x4a125a['milestone'];_0x4a125a[_0x293f74(0x12e)]&&(_0x4a125a[_0x293f74(0x12e)]=_0x4a125a['exitCriterias'][_0x293f74(0x14e)](_0x389e3c=>!_0x389e3c['segmentId']||!isPendingSegmentId(_0x389e3c[_0x293f74(0x15e)])));if(_0x4a125a['steps'])for(const _0x511299 of Object[_0x293f74(0x101)](_0x4a125a[_0x293f74(0x1f9)])){const _0x411aaa=_0x4a125a[_0x293f74(0x1f9)][_0x511299];_0x411aaa[_0x293f74(0x150)]===_0x293f74(0x1e7)&&_0x411aaa['journeyActivationStepId']&&isPendingActivationId(_0x411aaa[_0x293f74(0x19c)])&&(_0x411aaa[_0x293f74(0x19c)]='');if(_0x411aaa[_0x293f74(0x150)]===_0x293f74(0x17a)&&_0x411aaa[_0x293f74(0x1ed)])for(const _0x57f6aa of _0x411aaa[_0x293f74(0x1ed)]){_0x57f6aa[_0x293f74(0x15e)]&&isPendingSegmentId(_0x57f6aa[_0x293f74(0x15e)])&&(_0x57f6aa[_0x293f74(0x15e)]='');}_0x411aaa[_0x293f74(0x150)]===_0x293f74(0x168)&&stripWaitStepPendingIds(_0x411aaa);}}}function resolvePendingIdsInRequest(_0x2f6dda,_0x532210,_0x3df986,_0x394b5a,_0xb8f5be,_0x43aad8){const _0x4c9297=a152_0x5819a5,_0x68fd6f=(_0x2e28cd,_0x45c894)=>{const _0x58d9a2=a152_0x3568;if(!isPendingSegmentId(_0x2e28cd))return _0x2e28cd;const _0x12e56d=extractPendingSegmentName(_0x2e28cd),_0x5a7643=_0x394b5a[_0x58d9a2(0x1d9)](_0x12e56d);return!_0x5a7643&&_0x43aad8[_0x58d9a2(0x1b5)]?.(_0x58d9a2(0x121)+_0x12e56d+_0x58d9a2(0x1bc)+_0x45c894),_0x5a7643;};if(_0x2f6dda['attributes'][_0x4c9297(0x1d8)]?.[_0x4c9297(0x15e)]&&isPendingSegmentId(_0x2f6dda[_0x4c9297(0x18d)]['goal'][_0x4c9297(0x15e)])){const _0x42f252=_0x68fd6f(_0x2f6dda['attributes']['goal'][_0x4c9297(0x15e)],_0x4c9297(0x169));_0x42f252&&(_0x2f6dda[_0x4c9297(0x18d)][_0x4c9297(0x1d8)][_0x4c9297(0x15e)]=_0x42f252);}for(const _0x2312bd of _0x2f6dda[_0x4c9297(0x18d)][_0x4c9297(0x1f7)]||[]){const _0x5c1689=_0x3df986[_0x4c9297(0x1d9)](_0x2312bd[_0x4c9297(0x1a3)][_0x4c9297(0x157)]());_0x5c1689&&(_0x2312bd['id']=_0x5c1689);if(_0x2312bd['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x2312bd[_0x4c9297(0x14d)]['segmentId'])){const _0x4b235c=_0x68fd6f(_0x2312bd['entryCriteria'][_0x4c9297(0x15e)],'stage\x20\x27'+_0x2312bd[_0x4c9297(0x1a3)]+'\x27\x20entry\x20criteria');_0x4b235c&&(_0x2312bd[_0x4c9297(0x14d)]['segmentId']=_0x4b235c);}if(_0x2312bd[_0x4c9297(0x12e)])for(const _0x4ad9f5 of _0x2312bd[_0x4c9297(0x12e)]){if(_0x4ad9f5['segmentId']&&isPendingSegmentId(_0x4ad9f5[_0x4c9297(0x15e)])){const _0x1b0483=_0x68fd6f(_0x4ad9f5['segmentId'],_0x4c9297(0x123)+_0x2312bd[_0x4c9297(0x1a3)]+'\x27\x20exit\x20criteria');_0x1b0483&&(_0x4ad9f5[_0x4c9297(0x15e)]=_0x1b0483);}}if(_0x2312bd['milestone']?.[_0x4c9297(0x15e)]&&isPendingSegmentId(_0x2312bd[_0x4c9297(0x1a8)][_0x4c9297(0x15e)])){const _0x1ed1cc=_0x68fd6f(_0x2312bd[_0x4c9297(0x1a8)]['segmentId'],_0x4c9297(0x123)+_0x2312bd['name']+_0x4c9297(0x18b));_0x1ed1cc&&(_0x2312bd[_0x4c9297(0x1a8)][_0x4c9297(0x15e)]=_0x1ed1cc);}if(_0x2312bd[_0x4c9297(0x1f9)]){const _0x11bea0=_0x4c599f=>_0x532210[_0x4c9297(0x18d)][_0x4c9297(0x1f7)]?.[_0x4c9297(0x133)](_0x3c23c9=>_0x3c23c9[_0x4c9297(0x1a3)]['toLowerCase']()===_0x2312bd[_0x4c9297(0x1a3)][_0x4c9297(0x157)]())?.[_0x4c9297(0x1f9)]?.[_0x4c599f];for(const _0x394045 of Object[_0x4c9297(0x101)](_0x2312bd[_0x4c9297(0x1f9)])){const _0xad694b=_0x2312bd[_0x4c9297(0x1f9)][_0x394045],_0x12eee3=_0x11bea0(_0x394045);if(_0xad694b[_0x4c9297(0x150)]===_0x4c9297(0x1e7)&&_0xad694b['journeyActivationStepId']&&(isPendingActivationId(_0xad694b[_0x4c9297(0x19c)])||_0xad694b[_0x4c9297(0x19c)]==='')){if(_0x12eee3?.['journeyActivationStepId']&&isPendingActivationId(_0x12eee3['journeyActivationStepId'])){const _0x3b79b2=extractPendingActivationName(_0x12eee3[_0x4c9297(0x19c)]),_0x52c8f5=_0xb8f5be[_0x4c9297(0x1d9)](_0x3b79b2);_0x52c8f5&&(_0xad694b[_0x4c9297(0x19c)]=_0x52c8f5);}}if(_0xad694b[_0x4c9297(0x150)]===_0x4c9297(0x17a)&&_0xad694b[_0x4c9297(0x1ed)]&&_0x12eee3?.[_0x4c9297(0x1ed)])for(let _0x369856=0x0;_0x369856<_0xad694b[_0x4c9297(0x1ed)][_0x4c9297(0x19b)];_0x369856++){const _0x40aa5f=_0xad694b['branches'][_0x369856],_0x3d3cc7=_0x12eee3[_0x4c9297(0x1ed)][_0x369856];if(_0x3d3cc7?.[_0x4c9297(0x15e)]&&isPendingSegmentId(_0x3d3cc7[_0x4c9297(0x15e)])){const _0x227a58=_0x68fd6f(_0x3d3cc7[_0x4c9297(0x15e)],'stage\x20\x27'+_0x2312bd[_0x4c9297(0x1a3)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x40aa5f[_0x4c9297(0x1a3)]||_0x369856)+'\x27');_0x227a58&&(_0x40aa5f[_0x4c9297(0x15e)]=_0x227a58);}}_0xad694b['type']===_0x4c9297(0x168)&&_0x12eee3?.[_0x4c9297(0x150)]===_0x4c9297(0x168)&&resolveWaitStepPendingIds(_0xad694b,_0x12eee3,_0x68fd6f,_0x2312bd[_0x4c9297(0x1a3)]);}}}}
1
+ const a152_0x38a090=a152_0xc3a3;(function(_0x13ca7f,_0x14003e){const _0x17bb02=a152_0xc3a3,_0x4112e8=_0x13ca7f();while(!![]){try{const _0xd6c60f=-parseInt(_0x17bb02(0x15b))/0x1+-parseInt(_0x17bb02(0x116))/0x2+parseInt(_0x17bb02(0xed))/0x3*(-parseInt(_0x17bb02(0x80))/0x4)+parseInt(_0x17bb02(0xe1))/0x5+parseInt(_0x17bb02(0x107))/0x6+-parseInt(_0x17bb02(0x108))/0x7*(-parseInt(_0x17bb02(0x157))/0x8)+parseInt(_0x17bb02(0xf0))/0x9;if(_0xd6c60f===_0x14003e)break;else _0x4112e8['push'](_0x4112e8['shift']());}catch(_0x16638d){_0x4112e8['push'](_0x4112e8['shift']());}}}(a152_0x3031,0xd50b5));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_0x38a090(0x169);export const PENDING_ACTIVATION_PREFIX=a152_0x38a090(0xe7);export function createPendingSegmentId(_0x4dfb70){return''+PENDING_SEGMENT_PREFIX+_0x4dfb70+'__';}export function isPendingSegmentId(_0x187ad0){const _0x4bd077=a152_0x38a090;return _0x187ad0[_0x4bd077(0x99)](PENDING_SEGMENT_PREFIX)&&!_0x187ad0[_0x4bd077(0x99)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x4a9e36){return _0x4a9e36['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3bc23a){return''+PENDING_ACTIVATION_PREFIX+_0x3bc23a+'__';}export function isPendingActivationId(_0x554245){const _0x4e3944=a152_0x38a090;return _0x554245[_0x4e3944(0x99)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3509d9){return _0x3509d9['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1aa57b,_0x1544c3){const _0x1318f0=a152_0x38a090,_0x37ad0a=_0x1aa57b+'::'+(_0x1544c3[_0x1318f0(0x79)]()||_0x1318f0(0x134)),_0x1936fb=createHash(_0x1318f0(0x127))[_0x1318f0(0x15d)](_0x37ad0a)[_0x1318f0(0xb1)](_0x1318f0(0x155))[_0x1318f0(0x139)](0x0,0xc);return'journey_entry_criteria_'+_0x1936fb;}export function ensureJourneyDefaults(_0x2bb3c9){const _0x4d757e=a152_0x38a090;!_0x2bb3c9[_0x4d757e(0xf9)]&&(_0x2bb3c9[_0x4d757e(0xf9)]=''),!_0x2bb3c9[_0x4d757e(0xda)]&&(_0x2bb3c9['state']=_0x4d757e(0xab));}export function injectExistingStageIds(_0x9e881c,_0x14af8a){const _0x13fc2c=a152_0x38a090,_0x5a4286=new Map(_0x14af8a[_0x13fc2c(0x131)](_0x15ed94=>[_0x15ed94[_0x13fc2c(0x7e)],_0x15ed94['id']]));for(const _0x165ebc of _0x9e881c){if(!_0x165ebc['id']){const _0x3b58f7=_0x5a4286[_0x13fc2c(0xcb)](_0x165ebc[_0x13fc2c(0x7e)]);_0x3b58f7&&(_0x165ebc['id']=_0x3b58f7);}}}export function resolveTDFolderPath(_0x1fefb7,_0x20e93b,_0x11f598){const _0x15b871=a152_0x38a090;if(!_0x20e93b)return _0x1fefb7;if(_0x1fefb7===_0x11f598||_0x1fefb7[_0x15b871(0x99)](_0x11f598+'/'))return _0x1fefb7;return _0x1fefb7?_0x11f598+'/'+_0x1fefb7:_0x11f598;}export function addFoldersToCreate(_0xbda95f,_0x1f910a,_0x43fc48){const _0x2985f2=a152_0x38a090;if(!_0xbda95f)return;if(_0x1f910a[_0x2985f2(0x168)](_0xbda95f))return;const _0x410d3d=_0xbda95f[_0x2985f2(0x153)]('/');let _0x309d35='';for(const _0xfa588c of _0x410d3d){_0x309d35=_0x309d35?_0x309d35+'/'+_0xfa588c:_0xfa588c,!_0x1f910a['has'](_0x309d35)&&_0x43fc48[_0x2985f2(0x106)](_0x309d35);}}export function sortFoldersByDepth(_0x5d778a){return[..._0x5d778a]['sort']((_0x374edf,_0x3045ae)=>{const _0x20322b=a152_0xc3a3,_0x4fbe20=(_0x374edf[_0x20322b(0x145)](/\//g)||[])[_0x20322b(0xfe)],_0x25fd70=(_0x3045ae[_0x20322b(0x145)](/\//g)||[])[_0x20322b(0xfe)];return _0x4fbe20-_0x25fd70;});}import*as a152_0x2d2e6c from'yaml';import{readFileSync}from'fs';import a152_0x450276 from'path';import{isJourneyDef,parseYamlString as a152_0x2bc1aa,toYamlString as a152_0x164b8e,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(_0x4bf40d){const _0x168ee8=a152_0x38a090;if(Array[_0x168ee8(0x167)](_0x4bf40d))return'['+_0x4bf40d['map'](_0x3675fd=>stableStringify(_0x3675fd))[_0x168ee8(0xff)](',')+']';if(_0x4bf40d&&typeof _0x4bf40d===_0x168ee8(0x9c)){const _0x597fd1=_0x4bf40d,_0x4f8341=Object[_0x168ee8(0x135)](_0x597fd1)[_0x168ee8(0x8f)](),_0x5012f9=_0x4f8341[_0x168ee8(0x131)](_0x5dc559=>'\x22'+_0x5dc559+'\x22:'+stableStringify(_0x597fd1[_0x5dc559]));return'{'+_0x5012f9[_0x168ee8(0xff)](',')+'}';}const _0x4ebd8a=JSON[_0x168ee8(0xb4)](_0x4bf40d);return _0x4ebd8a===undefined?_0x168ee8(0x12e):_0x4ebd8a;}function activationSignature(_0x1d8d0e){const _0x36754a=a152_0x38a090,_0xae8336={'connection':_0x1d8d0e[_0x36754a(0xa8)],..._0x1d8d0e[_0x36754a(0x161)]!==undefined&&{'all_columns':_0x1d8d0e[_0x36754a(0x161)]},..._0x1d8d0e[_0x36754a(0xd7)]!==undefined&&{'columns':_0x1d8d0e['columns']},..._0x1d8d0e['behavior']!==undefined&&{'behavior':_0x1d8d0e[_0x36754a(0xa9)]},..._0x1d8d0e[_0x36754a(0x10c)]!==undefined&&{'schedule':_0x1d8d0e['schedule']},..._0x1d8d0e['notification']!==undefined&&{'notification':_0x1d8d0e[_0x36754a(0x154)]},..._0x1d8d0e['connector_config']!==undefined&&{'connector_config':_0x1d8d0e[_0x36754a(0x105)]},..._0x1d8d0e[_0x36754a(0x87)]!==undefined&&{'activation_template_id':_0x1d8d0e[_0x36754a(0x87)]}};return stableStringify(_0xae8336);}async function fetchSegment(_0x48475e,_0x4d1ea5,_0x4d49d1,_0x5d5025){const _0x353038=a152_0x38a090,_0x53cb16=_0x5d5025?.[_0x353038(0x98)](_0x30ce37=>_0x30ce37['id']===_0x4d49d1);if(_0x53cb16)return _0x53cb16;try{return await _0x48475e[_0x353038(0x134)][_0x353038(0x137)](_0x4d1ea5,_0x4d49d1);}catch(_0x180541){logger['debug']('getSegment\x20failed\x20for\x20'+_0x4d49d1+_0x353038(0xc0)+_0x180541);try{return await _0x48475e['segment'][_0x353038(0x8c)](_0x4d49d1);}catch(_0x37c22e){return logger[_0x353038(0xb9)](_0x353038(0x14f)+_0x4d49d1+':\x20'+_0x37c22e),null;}}}function recoverSegmentIdsFromPushRecovery(_0x34792f,_0x5cd544,_0x27b0e6){const _0x36d7e2=a152_0x38a090,_0x5f40a2=readPushRecovery(_0x34792f[_0x36d7e2(0xcf)]);if(_0x5f40a2?.[_0x36d7e2(0xce)]===_0x34792f[_0x36d7e2(0xa2)]['name'])for(const [_0x55f24f,_0xc247ea]of Object[_0x36d7e2(0xa4)](_0x5f40a2['segments'])){const _0x3b5504=generateDeterministicJourneySegmentName(_0x34792f['yamlConfig'][_0x36d7e2(0x7e)],_0x55f24f);_0xc247ea[_0x36d7e2(0xc1)]===_0x3b5504&&(_0x5cd544['set'](_0x55f24f,_0xc247ea[_0x36d7e2(0x165)]),_0x27b0e6[_0x36d7e2(0x89)](_0x55f24f,_0xc247ea[_0x36d7e2(0x165)]));}}async function createOrRecoverEmbeddedSegment(_0x18a76e,_0x133a0e,_0x5db364,_0x409c89){const _0x3304de=a152_0x38a090;let _0x5044fb;try{_0x5044fb=await _0x18a76e[_0x3304de(0x134)][_0x3304de(0xfb)]({'name':_0x5db364[_0x3304de(0xe8)],'description':_0x5db364['description'],'journeyId':_0x5db364[_0x3304de(0xca)],'rule':_0x409c89(_0x5db364['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x5db364[_0x3304de(0xad)],'audienceId':_0x5db364[_0x3304de(0xea)]});}catch(_0x261635){const _0x3dc786=_0x261635 instanceof Error&&_0x261635[_0x3304de(0xd2)][_0x3304de(0x13d)](_0x3304de(0xcc));if(_0x3dc786){const _0x54cd10=readPushRecovery(_0x133a0e[_0x3304de(0xcf)]),_0x10ca38=_0x54cd10?.[_0x3304de(0xce)]===_0x133a0e['yamlConfig'][_0x3304de(0x7e)]?_0x54cd10[_0x3304de(0x93)][_0x5db364[_0x3304de(0xba)]]:undefined;if(_0x10ca38?.[_0x3304de(0xc1)]===_0x5db364['uniqueSegmentName'])await _0x18a76e[_0x3304de(0x134)][_0x3304de(0x138)](_0x5db364['parentId'],_0x10ca38[_0x3304de(0x165)],{'description':_0x5db364['description'],'rule':_0x409c89(_0x5db364['resolvedRule'],!![]),'countPopulation':!![]}),_0x5044fb=_0x10ca38[_0x3304de(0x165)];else throw new SDKError(ErrorCode[_0x3304de(0x92)],'Embedded\x20segment\x20\x27'+_0x5db364[_0x3304de(0xba)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x3304de(0xb8)+_0x133a0e[_0x3304de(0xcf)][_0x3304de(0x159)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x3304de(0x146),_0x261635);}else throw _0x261635;}return saveSegmentToPushRecovery(_0x133a0e['absolutePath'],_0x133a0e[_0x3304de(0xa2)][_0x3304de(0x7e)],_0x5db364[_0x3304de(0xba)],{'segmentId':_0x5044fb,'uniqueServerName':_0x5db364[_0x3304de(0xe8)],'createdAt':new Date()['toISOString']()}),_0x5044fb;}export async function prepareSegmentFiles(_0x329ba8,_0x1427e2,_0x6e0b54,_0x3f76b3,_0x19b596){const _0xd7a8d3=a152_0x38a090,{activationDefToCreateRequest:_0x45d955}=await import(_0xd7a8d3(0x73)),_0x2c95a1=[],_0x3de192=new Set();for(const {yamlConfig:_0x52a81a,folderPath:_0x3e5095,sourcePath:_0x5507be}of _0x329ba8){const _0xef548d=resolveTDFolderPath(_0x3e5095,_0x3f76b3,_0x19b596),_0x17d0fe=_0xef548d+':'+_0x52a81a[_0xd7a8d3(0x7e)],_0x293c19=_0x1427e2[_0xd7a8d3(0x6c)][_0xd7a8d3(0xcb)](_0x17d0fe),_0x105b77=_0x293c19?_0x1427e2['activationsBySegmentId'][_0xd7a8d3(0xcb)](_0x293c19['id'])||[]:[];addFoldersToCreate(_0xef548d,_0x1427e2[_0xd7a8d3(0x78)],_0x3de192);const _0x40bde3=calculateActivationActions(_0x52a81a['activations']||[],_0x105b77,_0x1427e2[_0xd7a8d3(0x119)],_0x1427e2[_0xd7a8d3(0x72)]);for(const _0x116d65 of _0x40bde3){(_0x116d65[_0xd7a8d3(0xaf)]===_0xd7a8d3(0x132)||_0x116d65['type']===_0xd7a8d3(0x15d))&&_0x116d65[_0xd7a8d3(0x16a)]&&(_0x116d65[_0xd7a8d3(0x120)]=await _0x45d955(_0x116d65[_0xd7a8d3(0x16a)],_0x6e0b54));}const _0x873e37=calculateSegmentDiff(_0x52a81a,_0x293c19,_0x105b77,_0x1427e2['idToEmailMap'],_0x1427e2[_0xd7a8d3(0x72)]);_0x2c95a1[_0xd7a8d3(0x7a)]({'relativePath':_0x52a81a[_0xd7a8d3(0x7e)],'absolutePath':_0x5507be,'yamlConfig':_0x52a81a,'folderPath':_0xef548d,'existingSegment':_0x293c19,'existingActivations':_0x105b77,'isNew':_0x873e37['isNew'],'hasChanges':_0x873e37[_0xd7a8d3(0x121)],'diff':_0x873e37[_0xd7a8d3(0xbc)],'activationActions':_0x40bde3});}return{'segmentFiles':_0x2c95a1,'foldersToCreate':_0x3de192};}export async function prepareJourneyFiles(_0x4deae5,_0xa7a840,_0x43ab7d,_0x26f87e){const _0x3c57e4=a152_0x38a090,_0x4f7315=[],_0x1101c6=new Set();for(const {yamlConfig:_0x5947b1,folderPath:_0xd5b245,sourcePath:_0x41a162}of _0x4deae5){const _0x3b09ef=resolveTDFolderPath(_0xd5b245,_0x43ab7d,_0x26f87e),_0x49426d=_0x3b09ef+':'+_0x5947b1['name'],_0x311f10=_0xa7a840[_0x3c57e4(0xfc)][_0x3c57e4(0xcb)](_0x49426d);let _0x2c30de,_0x267be4;if(_0x311f10&&_0x311f10['length']>0x0){const _0xbc89cf=buildLocalExpandedRuleMappings(_0x5947b1),{createYamlContext:_0x3045a4,prefetchJourneySegments:_0xeca42d}=createPushYamlContextForBundle(_0xa7a840[_0x3c57e4(0xdc)],_0xa7a840['parentId'],_0xa7a840[_0x3c57e4(0x11e)],_0xbc89cf,_0xa7a840[_0x3c57e4(0x119)],_0xa7a840[_0x3c57e4(0x72)],_0xa7a840[_0x3c57e4(0x11f)],_0xa7a840[_0x3c57e4(0xe9)]);await _0xeca42d(_0x311f10[_0x3c57e4(0x131)](_0x37aabf=>_0x37aabf['id']));const _0x1d092a=await _0xa7a840[_0x3c57e4(0xdc)][_0x3c57e4(0x7d)][_0x3c57e4(0x156)](_0x311f10[0x0][_0x3c57e4(0x140)]),_0x23b294=hasMultipleVersions(_0x5947b1),_0x3d8f4d=async _0x4f7ded=>{const _0x154f46=_0x3c57e4,_0x3869f0=_0xa7a840[_0x154f46(0xe9)]?.['get'](_0x4f7ded);if(_0x3869f0)return _0x3869f0;return _0xa7a840[_0x154f46(0x129)]({'journeyId':_0x4f7ded,'journeyName':_0x5947b1[_0x154f46(0x7e)],'isMultiVersion':_0x311f10[_0x154f46(0xfe)]>0x1});};if(_0x23b294&&_0x311f10[_0x3c57e4(0xfe)]>0x1){const _0x398809=[];for(const _0x3bddbc of _0x311f10){const _0x420454=_0x3bddbc['versionNumber']||0x1;_0xa7a840[_0x3c57e4(0x91)]?.['update'](_0x3c57e4(0xc4)+_0x5947b1[_0x3c57e4(0x7e)]+'\x20v'+_0x420454);const _0x3c448a=await _0x3d8f4d(_0x3bddbc['id']),_0x13211d=_0x3045a4(_0x3bddbc['id']),_0x40fad8=await journeyResponseToDef(_0x3c448a,_0x13211d);_0x398809['push']({'item':_0x3bddbc,'yaml':_0x40fad8});}const _0x474aeb=buildLocalRuleToNameMappingFromJourney(_0x5947b1);_0x267be4=buildMergedJourneyDef(_0x398809,_0x474aeb,_0x1d092a);const _0x260b88=Math[_0x3c57e4(0x8a)](..._0x398809[_0x3c57e4(0x131)](_0x39e2ac=>_0x39e2ac[_0x3c57e4(0xdf)][_0x3c57e4(0x9f)]||0x0)),_0x650db6=_0x311f10[_0x3c57e4(0x98)](_0xd42f50=>(_0xd42f50[_0x3c57e4(0x9f)]||0x0)===_0x260b88);_0x650db6&&(_0xa7a840[_0x3c57e4(0x91)]?.[_0x3c57e4(0x15d)](_0x3c57e4(0xc4)+_0x5947b1[_0x3c57e4(0x7e)]+'\x20v'+_0x260b88),_0x2c30de=await _0x3d8f4d(_0x650db6['id']));}else{const _0x229fbb=_0x311f10[_0x311f10['length']-0x1];_0xa7a840['progress']?.[_0x3c57e4(0x15d)](_0x3c57e4(0xc4)+_0x5947b1[_0x3c57e4(0x7e)]),_0x2c30de=await _0x3d8f4d(_0x229fbb['id']);const _0x3e288b=_0x3045a4(_0x229fbb['id']),_0xa82b0f=await journeyResponseToDef(_0x2c30de,_0x3e288b),_0x122596=buildLocalRuleToNameMappingFromJourney(_0x5947b1);_0x267be4=buildMergedJourneyDef([{'item':_0x229fbb,'yaml':_0xa82b0f}],_0x122596,_0x1d092a);}}addFoldersToCreate(_0x3b09ef,_0xa7a840[_0x3c57e4(0x78)],_0x1101c6);const _0xfece49=calculateJourneyDiff(_0x5947b1,_0x267be4);_0x4f7315[_0x3c57e4(0x7a)]({'relativePath':_0x5947b1[_0x3c57e4(0x7e)],'absolutePath':_0x41a162,'yamlConfig':_0x5947b1,'folderPath':_0x3b09ef,'existingJourney':_0x2c30de,'isNew':_0xfece49[_0x3c57e4(0x9b)],'hasChanges':_0xfece49[_0x3c57e4(0x121)],'diff':_0xfece49['diff']});}return{'journeyFiles':_0x4f7315,'foldersToCreate':_0x1101c6};}export function calculateActivationActions(_0x4bfb39,_0x30788f,_0x3c101c,_0x313f7a){const _0x5dcfc4=a152_0x38a090,_0x535e7a=[],_0x251022=new Map();for(const _0x1950ba of _0x30788f){_0x251022[_0x5dcfc4(0x89)](_0x1950ba[_0x5dcfc4(0x7e)],_0x1950ba);}const _0x1999d9=new Map();for(const _0x412089 of _0x4bfb39){_0x1999d9[_0x5dcfc4(0x89)](_0x412089[_0x5dcfc4(0x7e)],_0x412089);}for(const _0x1083e0 of _0x4bfb39){const _0x22ebed=_0x251022[_0x5dcfc4(0xcb)](_0x1083e0['name']);if(!_0x22ebed)_0x535e7a[_0x5dcfc4(0x7a)]({'type':'create','name':_0x1083e0[_0x5dcfc4(0x7e)],'yamlActivation':_0x1083e0});else{const _0x163d27=activationResponseToDef(_0x22ebed,_0x3c101c,_0x313f7a),_0x342014=a152_0x2d2e6c['stringify'](_0x163d27),_0x26ee28=a152_0x2d2e6c[_0x5dcfc4(0xb4)](_0x1083e0);_0x342014!==_0x26ee28&&_0x535e7a[_0x5dcfc4(0x7a)]({'type':_0x5dcfc4(0x15d),'name':_0x1083e0[_0x5dcfc4(0x7e)],'yamlActivation':_0x1083e0,'existingActivation':_0x22ebed});}}for(const _0x2aee01 of _0x30788f){!_0x1999d9[_0x5dcfc4(0x168)](_0x2aee01[_0x5dcfc4(0x7e)])&&_0x535e7a[_0x5dcfc4(0x7a)]({'type':_0x5dcfc4(0x6b),'name':_0x2aee01[_0x5dcfc4(0x7e)],'existingActivation':_0x2aee01});}return _0x535e7a;}function calculateYamlDiff(_0x351c71,_0x277a5b){if(_0x277a5b){const _0x491b01=generateDiff(_0x277a5b,_0x351c71),_0x1b77c2=hasChanges(_0x491b01);return{'isNew':![],'hasChanges':_0x1b77c2,'diff':_0x1b77c2?formatDiffWithColors(_0x491b01):undefined};}const _0x289b45=generateDiff('',_0x351c71);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x289b45)};}export function calculateSegmentDiff(_0x31f957,_0x1f1603,_0x1ac7da,_0x378f2d,_0x472131){const _0x3a330d=segmentToYamlString(_0x31f957),_0x1e72b1=_0x1f1603?segmentToYamlString(segmentWithActivationsToYaml(_0x1f1603,_0x1ac7da,undefined,_0x378f2d,_0x472131)):undefined;return calculateYamlDiff(_0x3a330d,_0x1e72b1);}function a152_0xc3a3(_0x2aa09e,_0x43497d){_0x2aa09e=_0x2aa09e-0x6a;const _0x30319c=a152_0x3031();let _0xc3a3e1=_0x30319c[_0x2aa09e];return _0xc3a3e1;}export function calculateJourneyDiff(_0x3a18b9,_0xfaa026){const _0xc5d840=normalizeJourneyDef(_0x3a18b9,_0x3a18b9),_0x30c17f=a152_0x164b8e(_0xc5d840),_0x169a21=_0xfaa026?a152_0x164b8e(normalizeJourneyDef(_0xfaa026,_0x3a18b9)):undefined;return calculateYamlDiff(_0x30c17f,_0x169a21);}export function findSegmentsToDelete(_0x106c47,_0x71caec,_0x5b4f59,_0x293f27,_0xc9dc30){const _0x2a216d=a152_0x38a090,_0x13ce81=new Set();for(const {yamlConfig:_0x12938c,folderPath:_0x4bdace}of _0x71caec){_0x13ce81[_0x2a216d(0x106)](_0x4bdace+':'+_0x12938c[_0x2a216d(0x7e)]);}return _0x106c47[_0x2a216d(0x144)](_0x1d584a=>{const _0x400a0f=_0x2a216d,_0x1fba53=_0x1d584a[_0x400a0f(0xbd)]?_0x5b4f59[_0x400a0f(0xcb)](_0x1d584a[_0x400a0f(0xbd)][_0x400a0f(0xd6)]())||'':'',_0x2668fe=_0x1fba53+':'+_0x1d584a[_0x400a0f(0x7e)];if(_0x13ce81[_0x400a0f(0x168)](_0x2668fe))return![];if(_0xc9dc30)return _0x1fba53===_0x293f27||_0x1fba53[_0x400a0f(0x99)](_0x293f27+'/');return!![];});}export function findJourneysToDelete(_0x1388f7,_0x2c6e8f,_0x304625,_0x11f084,_0x487f6a){const _0x2dbdea=a152_0x38a090,_0x33e1db=new Set();for(const {yamlConfig:_0x402d64,folderPath:_0x4955ce}of _0x2c6e8f){_0x33e1db['add'](_0x4955ce+':'+_0x402d64[_0x2dbdea(0x7e)]);}return _0x1388f7[_0x2dbdea(0x144)](_0x1025b0=>{const _0x3cc981=_0x2dbdea,_0x50356a=_0x1025b0[_0x3cc981(0xad)]?_0x304625[_0x3cc981(0xcb)](_0x1025b0['folderId'])||'':'',_0x38373d=_0x50356a+':'+_0x1025b0[_0x3cc981(0x158)];if(_0x33e1db[_0x3cc981(0x168)](_0x38373d))return![];if(_0x487f6a)return _0x50356a===_0x11f084||_0x50356a['startsWith'](_0x11f084+'/');return!![];});}export function buildSegmentLookupMap(_0x1b93d0,_0x3727c5){const _0x1db1cd=a152_0x38a090,_0x29d3a7=new Map();for(const _0x16bf64 of _0x1b93d0){const _0x3f8d12=_0x16bf64[_0x1db1cd(0xbd)]?_0x3727c5[_0x1db1cd(0xcb)](_0x16bf64[_0x1db1cd(0xbd)][_0x1db1cd(0xd6)]())||'':'',_0x905e5c=_0x3f8d12+':'+_0x16bf64['name'];_0x29d3a7[_0x1db1cd(0x89)](_0x905e5c,_0x16bf64);}return _0x29d3a7;}export function buildSegmentNameToIdMap(_0xfb997a){const _0x32ab66=a152_0x38a090,_0x2ab84=new Map();for(const _0x551aca of _0xfb997a){_0x2ab84[_0x32ab66(0x89)](_0x551aca['name'],_0x551aca['id']);}return _0x2ab84;}export function buildJourneyBundleLookupMap(_0xbd49f7,_0x5dca4f){const _0x2ab03=a152_0x38a090,_0x2bdad4=new Map();for(const _0x1693db of _0xbd49f7){const _0x4bdd6b=_0x1693db['folderId']?_0x5dca4f['get'](_0x1693db[_0x2ab03(0xad)])||'':'',_0x5434b8=_0x4bdd6b+':'+_0x1693db['journeyBundleName'];!_0x2bdad4[_0x2ab03(0x168)](_0x5434b8)&&_0x2bdad4[_0x2ab03(0x89)](_0x5434b8,[]),_0x2bdad4[_0x2ab03(0xcb)](_0x5434b8)[_0x2ab03(0x7a)](_0x1693db);}for(const _0x5684a5 of _0x2bdad4[_0x2ab03(0x133)]()){_0x5684a5[_0x2ab03(0x8f)]((_0x2833da,_0x3489c6)=>(_0x2833da[_0x2ab03(0x9f)]||0x0)-(_0x3489c6[_0x2ab03(0x9f)]||0x0));}return _0x2bdad4;}function a152_0x3031(){const _0x28f8a7=['idToName','from','attributes','Segment\x20not\x20found','Created\x20journey\x20\x27','\x27...','resolveJourneyId','data','getSegmentEntity\x20also\x20failed\x20for\x20','embedded_activation_creating','Activation',').\x20','split','notification','hex','getLatestJourneyId','339496BFTIiO','journeyBundleName','replace','segment_updating','1609776uqAqik','Entry\x20criteria:\x20','update','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','embeddedSegmentNameToId','conditionSegmentId','all_columns','goal\x20criteria','stage\x20\x27','folder_created','segmentId','results','isArray','has','__pending_','yamlActivation','createSegment','Updated\x20segment\x20\x27','delete','segmentByFolderAndName','valid','updateActivation','exitCriterias','JOURNEY_UPDATE_ERROR','\x20error(s)','connectionIdToNameMap','./child-segment-yaml.js','embedded_segment_created','goal','Deleted\x20segment\x20\x27','toISOString','folderPathToId','trim','push','milestone','listActivations','journey','name','day','100uNkLgk','Created\x20activation\x20\x27','segmentNameToId','Stage\x20\x27','\x27\x20milestone','journeys','activations','activation_template_id','skipSegments','set','max','parentSegmentFolder','getSegmentEntity','decision_point','\x0a\x20\x20','sort','ACTIVATION_SYNTAX_ERROR','progress','SEGMENT_UPDATE_ERROR','segments','entryCriteria','index','activation_updating','Updating\x20activation\x20\x27','find','startsWith','existingActivation','isNew','object','updated','Condition','versionNumber','errors','embedded_segment_creating','yamlConfig','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','entries','../../utils/async.js','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','segment_deleted','connection','behavior','embedded_activation_created','draft','NOT_FOUND','folderId','journey_updating','type','withProgress','digest','createActivation','\x27\x20by\x20rule\x20content','stringify','existingJourney','logWarning','activationContext','Delete\x20the\x20push\x20recovery\x20file\x20(','debug','localName','Creating\x20folder\x20\x27','diff','segmentFolderId','Failed\x20to\x20resolve\x20activation\x20','dirname',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','uniqueServerName','resolveSegment','deleteActivation','Fetching\x20','):\x20','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','nameToType','journeyActivationStepId','\x20segment\x20from\x20file:\x20','journeyId','get','Name\x20has\x20already\x20been\x20taken','activationActions','journeyName','absolutePath','\x27\x20to\x20local\x20\x27','\x20activation\x20\x27','message','segment_updated','DecisionPoint','branches','toString','columns','waitStep','Updated\x20journey\x20\x27','state','logInfo','deps','all','getJourney','item','\x27\x20for\x20','774510qkhgMe','stages','WaitStep','waitStepType','relative','toLowerCase','__pending_act_','uniqueSegmentName','journeyById','parentId','createFolder','conditionTimeoutDuration','26526CTriCZ','\x27\x20wait\x20condition','size','30377691QoGHVX','conditions','\x27\x20decision\x20point\x20branch\x20\x27','ACTIVATION_UPDATE_ERROR','deleted','unchanged','utf-8','steps','journey_created','description','entry_criteria','createJourneySegment','journeyBundlesByFolderAndName','run_after_journey_refresh','length','join','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','parseDocument','activation_deleted','conditionTimeoutUnit','Failed\x20to\x20resolve\x20segment\x20','connector_config','add','4984962CTEXZc','7yYKnzD','parse','entry','action','schedule','segment_creating','INTERNAL','JOURNEY_SYNTAX_ERROR','segment_created','createdSegmentId','\x20(referenced\x20in\x20journey\x20','journeyActivationNameToId','\x27\x20entry\x20criteria','logSuccess','3400020YFZfMI','waitStepUnit','Updated\x20activation\x20\x27','idToEmailMap','onProgress','deleteSegment','relationships','parentFolder','existingSegments','activationStepsById','validatedRequest','hasChanges','folder_creating','activationParams','existingSegment','folder','\x27\x20from\x20file:\x20','sha1','logDeleted','fetchJourney','rootFolderId','Failed\x20to\x20','folderPath','Deleting\x20activation\x20\x27','null','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','buildUserMaps','map','create','values','segment','keys','Segment\x20not\x20found:\x20','getSegment','updateSegmentById','slice','SEGMENT_NOT_FOUND','some','Matched\x20server\x20segment\x20\x27','includes','journeyStages','with','journeyBundleId','created','Creating\x20activation\x20\x27','rule','filter','match','and\x20the\x20server\x20segment,\x20then\x20retry.'];a152_0x3031=function(){return _0x28f8a7;};return a152_0x3031();}export function collectFoldersToCreate(_0x562162,_0x781d1f){const _0xa723d9=a152_0x38a090,_0x16d1d5=new Set();for(const _0x4413a2 of _0x562162){if(!_0x4413a2)continue;if(_0x781d1f[_0xa723d9(0x168)](_0x4413a2))continue;const _0x471758=_0x4413a2[_0xa723d9(0x153)]('/');let _0x11671a='';for(const _0x46562d of _0x471758){_0x11671a=_0x11671a?_0x11671a+'/'+_0x46562d:_0x46562d,!_0x781d1f[_0xa723d9(0x168)](_0x11671a)&&_0x16d1d5[_0xa723d9(0x106)](_0x11671a);}}return _0x16d1d5;}export function parseAndClassifyYamlFiles(_0x27fd9f,_0x1c1239,_0x4eb91d){const _0x380440=a152_0x38a090,_0x7e024=[],_0xe0455b=[];for(const _0x1e814f of _0x27fd9f){const _0x5c637e=a152_0x450276[_0x380440(0xe5)](_0x1c1239,a152_0x450276[_0x380440(0xbf)](_0x1e814f)),_0x1ae2db=_0x5c637e==='.'?'':_0x5c637e[_0x380440(0x159)](/\\/g,'/'),_0x52e14f=readFileSync(_0x1e814f,_0x380440(0xf6)),_0x1bf7ac=a152_0x2d2e6c[_0x380440(0x109)](_0x52e14f);if(isJourneyDef(_0x1bf7ac)){const _0x569045=a152_0x2bc1aa(_0x52e14f);_0xe0455b[_0x380440(0x7a)]({'yamlConfig':_0x569045,'folderPath':_0x1ae2db,'sourcePath':_0x1e814f});}else{if(!_0x4eb91d?.[_0x380440(0x88)]){const _0x3eff71=parseSegmentYamlFile(_0x52e14f),_0x45c11c=normalizeChildSegmentYaml(_0x3eff71);_0x7e024[_0x380440(0x7a)]({'yamlConfig':_0x45c11c,'folderPath':_0x1ae2db,'sourcePath':_0x1e814f});}}}return{'segments':_0x7e024,'journeys':_0xe0455b};}export function validateParsedFiles(_0x53fc70,_0x192cfc){const _0x1b3bea=a152_0x38a090,_0x39544a=[];for(const {yamlConfig:_0x5a2b19,sourcePath:_0x4e15bd}of _0x53fc70[_0x1b3bea(0x93)]){const _0x4cc7fd=readFileSync(_0x4e15bd,_0x1b3bea(0xf6)),_0x1d7782=a152_0x2d2e6c[_0x1b3bea(0x101)](_0x4cc7fd),_0x275f10=validateSegmentDef(_0x5a2b19,{'source':_0x4cc7fd,'document':_0x1d7782},{'skipSchema':!![]});if(!_0x275f10[_0x1b3bea(0x6d)]){const _0x54e09e=a152_0x450276[_0x1b3bea(0xe5)](_0x192cfc,_0x4e15bd);_0x39544a[_0x1b3bea(0x7a)]({'filePath':_0x54e09e,'source':_0x4cc7fd,'result':_0x275f10,'isJourney':![]});}}for(const {yamlConfig:_0x154f37,sourcePath:_0x13f9cd}of _0x53fc70['journeys']){const _0xd38d4a=readFileSync(_0x13f9cd,_0x1b3bea(0xf6)),_0x4f81fc=a152_0x2d2e6c[_0x1b3bea(0x101)](_0xd38d4a),_0x37c35c=validateJourneyDef(_0x154f37,{'source':_0xd38d4a,'document':_0x4f81fc},{'skipSchema':!![]});if(!_0x37c35c[_0x1b3bea(0x6d)]){const _0x4eeb13=a152_0x450276[_0x1b3bea(0xe5)](_0x192cfc,_0x13f9cd);_0x39544a[_0x1b3bea(0x7a)]({'filePath':_0x4eeb13,'source':_0xd38d4a,'result':_0x37c35c,'isJourney':!![]});}}return _0x39544a;}export function formatValidationErrors(_0x5e0be7){const _0x4cf253=a152_0x38a090,_0xbe90ec=[];for(const {filePath:_0xd8ae29,source:_0x2a4518,result:_0x379dbc,isJourney:_0x112527}of _0x5e0be7){const _0x3109db=_0x112527?_0x4cf253(0x7d):_0x4cf253(0x134);_0xbe90ec[_0x4cf253(0x7a)]('\x0a'+_0xd8ae29+'\x20('+_0x3109db+_0x4cf253(0xc5)+_0x379dbc[_0x4cf253(0xa0)][_0x4cf253(0xfe)]+_0x4cf253(0x71)),_0xbe90ec['push'](formatValidationResult(_0x379dbc,_0x2a4518,_0xd8ae29));}return _0xbe90ec[_0x4cf253(0xff)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x300ef8){const _0x44233e=a152_0x38a090,_0x30fa79=new Set(),_0x5e70f2=new Map(),_0x52746e=collectSegmentUsageCounts(_0x300ef8);if(_0x300ef8['segments'])for(const [_0x5c9bec,_0x5b7996]of Object[_0x44233e(0xa4)](_0x300ef8['segments'])){_0x30fa79[_0x44233e(0x106)](_0x5c9bec);if(_0x5b7996[_0x44233e(0x143)]){const _0x2ea680=yamlRuleToApi(_0x5b7996[_0x44233e(0x143)]),_0x5e228c=apiRuleToYaml(_0x2ea680);_0x5e70f2[_0x44233e(0x89)](_0x5c9bec,_0x5e228c);}}const _0x1fca0a=new Map();let _0x5eef20=0x0;for(const [_0x539dc9,_0x106377]of _0x5e70f2){const _0xccaf=serializeExpandedRule(_0x106377,_0x5e70f2),_0x1a2013=_0x1fca0a['get'](_0xccaf)||[];_0x1a2013[_0x44233e(0x7a)]({'name':_0x539dc9,'index':_0x5eef20}),_0x1fca0a['set'](_0xccaf,_0x1a2013),_0x5eef20++;}const _0xd54f5a=new Map();for(const [_0x20356d,_0x4a4196]of _0x1fca0a){const _0x48eb3f=_0x4a4196[_0x44233e(0x139)]()[_0x44233e(0x8f)]((_0x53706b,_0x2f60be)=>{const _0x4e46c2=_0x44233e,_0x23b7aa=_0x52746e[_0x4e46c2(0xcb)](_0x53706b[_0x4e46c2(0x7e)])||0x0,_0x728dd1=_0x52746e[_0x4e46c2(0xcb)](_0x2f60be[_0x4e46c2(0x7e)])||0x0;if(_0x23b7aa!==_0x728dd1)return _0x728dd1-_0x23b7aa;return _0x53706b[_0x4e46c2(0x95)]-_0x2f60be[_0x4e46c2(0x95)];})[_0x44233e(0x131)](_0x421967=>_0x421967[_0x44233e(0x7e)]),_0xcfc460=[];for(const _0x40abca of _0x48eb3f){const _0x4f3f59=_0x52746e['get'](_0x40abca)||0x0,_0x37f944=Math[_0x44233e(0x8a)](_0x4f3f59,0x1);for(let _0x26b6c7=0x0;_0x26b6c7<_0x37f944;_0x26b6c7++){_0xcfc460[_0x44233e(0x7a)](_0x40abca);}}_0xd54f5a[_0x44233e(0x89)](_0x20356d,_0xcfc460);}return{'existingLocalSegmentNames':_0x30fa79,'localSegmentRules':_0x5e70f2,'localExpandedRuleToNames':_0xd54f5a};}export function createSegmentIdResolver(_0x580e15,_0x23b70e){return async _0x1307ff=>{const _0x2ac64f=a152_0xc3a3,_0xe203da=_0x580e15[_0x2ac64f(0xcb)](_0x1307ff);if(!_0xe203da)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2ac64f(0x136)+_0x1307ff+_0x2ac64f(0xa6)+_0x23b70e+'\x27)');return _0xe203da;};}export function extractRootFolderId(_0x61e50e){const _0x3331be=a152_0x38a090;return _0x61e50e['relationships']?.[_0x3331be(0x8b)]?.[_0x3331be(0x14e)]?.['id']||_0x61e50e[_0x3331be(0x11c)]?.[_0x3331be(0x11d)]?.[_0x3331be(0x14e)]?.['id'];}export function buildConnectionMaps(_0x5575b7){const _0x3d7b8e=a152_0x38a090,_0x29e87c=new Map(),_0x2eba45=new Map(),_0x363591=new Map();for(const _0x27341e of _0x5575b7){_0x29e87c[_0x3d7b8e(0x89)](_0x27341e['name'],parseInt(_0x27341e['id'],0xa)),_0x2eba45[_0x3d7b8e(0x89)](_0x27341e['id'],_0x27341e[_0x3d7b8e(0x7e)]),_0x363591['set'](_0x27341e['name'],_0x27341e['type']);}return{'nameToId':_0x29e87c,'idToName':_0x2eba45,'nameToType':_0x363591};}export function calculatePushStats(_0x110c18,_0x6c5618,_0x50b834,_0x55cb6f,_0xa08da6,_0x30a608,_0x50b27){const _0x5430ab=a152_0x38a090,_0x1676d3=_0x110c18['filter'](_0x4c413c=>_0x4c413c['isNew']),_0x28c885=_0x110c18['filter'](_0x142b37=>!_0x142b37['isNew']&&_0x142b37[_0x5430ab(0x121)]),_0x1e5e80=_0x110c18[_0x5430ab(0x144)](_0x41f5b8=>!_0x41f5b8[_0x5430ab(0x9b)]&&!_0x41f5b8[_0x5430ab(0x121)]),_0x223534=_0x30a608?_0x55cb6f:[],_0x5bb46f=_0x6c5618['filter'](_0x45d606=>_0x45d606[_0x5430ab(0x9b)]),_0xd582f8=_0x6c5618[_0x5430ab(0x144)](_0x406926=>!_0x406926['isNew']&&_0x406926[_0x5430ab(0x121)]),_0x205194=_0x6c5618[_0x5430ab(0x144)](_0x4369d8=>!_0x4369d8[_0x5430ab(0x9b)]&&!_0x4369d8[_0x5430ab(0x121)]),_0x2f6dfd=_0x30a608?_0xa08da6:[],_0x5e69e2=_0x110c18['flatMap'](_0x5f2f37=>_0x5f2f37['activationActions']),_0x205424=_0x5e69e2['filter'](_0x58ff47=>_0x58ff47['type']==='create'),_0x302d16=_0x5e69e2[_0x5430ab(0x144)](_0x3d8277=>_0x3d8277[_0x5430ab(0xaf)]===_0x5430ab(0x15d)),_0x5cbd52=_0x5e69e2['filter'](_0x48d805=>_0x48d805['type']===_0x5430ab(0x6b)),_0x4df592=Array[_0x5430ab(0x148)](_0x50b834)[_0x5430ab(0x8f)](),_0xccb76e=_0x50b27?![]:_0x1676d3[_0x5430ab(0xfe)]>0x0||_0x28c885[_0x5430ab(0xfe)]>0x0||_0x223534[_0x5430ab(0xfe)]>0x0,_0x5c771f=_0x5bb46f[_0x5430ab(0xfe)]>0x0||_0xd582f8['length']>0x0||_0x2f6dfd[_0x5430ab(0xfe)]>0x0,_0x34615d=_0x50b27?![]:_0x5e69e2[_0x5430ab(0xfe)]>0x0,_0x422efc=_0x4df592[_0x5430ab(0xfe)]>0x0;return{'segments':{'new':_0x1676d3,'changed':_0x28c885,'unchanged':_0x1e5e80,'toDelete':_0x223534},'journeys':{'new':_0x5bb46f,'changed':_0xd582f8,'unchanged':_0x205194,'toDelete':_0x2f6dfd},'activations':{'all':_0x5e69e2,'toCreate':_0x205424,'toUpdate':_0x302d16,'toDelete':_0x5cbd52},'folders':{'toCreate':_0x4df592},'counts':{'segments':{'new':_0x1676d3['length'],'changed':_0x28c885[_0x5430ab(0xfe)],'unchanged':_0x1e5e80[_0x5430ab(0xfe)],'toDelete':_0x223534[_0x5430ab(0xfe)]},'journeys':{'new':_0x5bb46f[_0x5430ab(0xfe)],'changed':_0xd582f8[_0x5430ab(0xfe)],'unchanged':_0x205194[_0x5430ab(0xfe)],'toDelete':_0x2f6dfd[_0x5430ab(0xfe)]},'activations':{'create':_0x205424[_0x5430ab(0xfe)],'update':_0x302d16['length'],'delete':_0x5cbd52['length']},'folders':_0x4df592['length']},'hasChanges':_0xccb76e||_0x5c771f||_0x34615d||_0x422efc};}export async function buildPushExecutionContext(_0x34b186,_0xde9faa,_0xa31b74,_0x6f97af,_0x19528f,_0x4f3f31){const _0x1df926=a152_0x38a090,_0x5b0e92=extractRootFolderId(_0xa31b74),{pathToId:_0x1581ae,idToPath:_0x496697}=buildFolderMaps(_0x19528f),_0x48daed=buildSegmentNameToIdMap(_0x6f97af),_0x44efc6=new Map(),{batchAsync:_0x5f49ff}=await import('../../utils/async.js'),[_0x23adba,_0x417913]=await Promise[_0x1df926(0xdd)]([_0x34b186['user'][_0x1df926(0x130)](),_0x34b186[_0x1df926(0xa8)]['list'](),((async()=>{const _0x1ad551=_0x1df926;!_0x4f3f31&&_0x6f97af[_0x1ad551(0xfe)]>0x0&&await _0x5f49ff(_0x6f97af,async _0x5cb894=>{const _0x536096=_0x1ad551,_0x3394e1=await _0x34b186['segment'][_0x536096(0x7c)](_0xde9faa,_0x5cb894['id']);_0x44efc6[_0x536096(0x89)](_0x5cb894['id'],_0x3394e1);});})())]),{emailToId:_0x20a7b2,idToEmail:_0x299e2f}=_0x23adba,_0x28f3d0=buildConnectionMaps(_0x417913);return{'rootFolderId':_0x5b0e92,'folderPathToId':_0x1581ae,'folderIdToPath':_0x496697,'segmentNameToId':_0x48daed,'activationsBySegmentId':_0x44efc6,'emailToIdMap':_0x20a7b2,'idToEmailMap':_0x299e2f,'connectionNameToIdMap':_0x28f3d0['nameToId'],'connectionIdToNameMap':_0x28f3d0[_0x1df926(0x147)],'connectionNameToTypeMap':_0x28f3d0[_0x1df926(0xc7)]};}export function createPushYamlContextForBundle(_0x11a07a,_0x2457f9,_0x5af788,_0x19d5ad,_0x174f3d,_0x21b8fb,_0x552f20,_0x23c948){const {existingLocalSegmentNames:_0xa9bf0f,localExpandedRuleToNames:_0x49ccfe}=_0x19d5ad,_0x477f28=new Set(),_0x5eae2c=new Map(),_0x268681=new Map(),_0x233b5d=new Map(),_0x1807d6=createJumpTargetCache(),_0x5da4f7=new Map(),_0x5312fc=new Map(),_0x339b70=new Set();let _0x452013;const _0x14b357=_0x5888eb=>{const _0x5e8dba={'resolveSegment':async _0x2d8608=>{const _0x514192=a152_0xc3a3,_0x215e3e=_0x233b5d[_0x514192(0xcb)](_0x2d8608);if(_0x215e3e!==undefined)return{'name':_0x215e3e,'isJourneyLocal':!![]};try{const _0x4b3ea8=await fetchSegment(_0x11a07a,_0x2457f9,_0x2d8608,_0x5af788);if(!_0x4b3ea8)throw new Error(_0x514192(0x14a));const _0x515f51=generateJourneyLocalName(_0x4b3ea8[_0x514192(0x7e)]),_0x56d6ab=_0x4b3ea8['kind']===SEGMENT_KIND_JOURNEY&&_0x515f51!==undefined;let _0x343284=_0x4b3ea8[_0x514192(0x7e)],_0x102549;if(_0x56d6ab&&_0x4b3ea8['rule']){const _0x3d2bae=apiRuleToYaml(_0x4b3ea8[_0x514192(0x143)]);_0x5312fc['set'](_0x2d8608,_0x3d2bae);const _0x444e25=async _0x4ef25a=>{const _0x183c43=_0x514192,_0x363c2e=collectSegmentRefsFromRule(_0x4ef25a);for(const _0x324120 of _0x363c2e){if(!_0x5312fc[_0x183c43(0x168)](_0x324120))try{const _0x1de469=await fetchSegment(_0x11a07a,_0x2457f9,_0x324120,_0x5af788);if(_0x1de469?.[_0x183c43(0x143)]){const _0xc2c694=apiRuleToYaml(_0x1de469[_0x183c43(0x143)]);_0x5312fc[_0x183c43(0x89)](_0x324120,_0xc2c694),await _0x444e25(_0xc2c694);}}catch(_0x25c55c){logger[_0x183c43(0xb9)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x324120+':\x20'+_0x25c55c);}}};await _0x444e25(_0x3d2bae);const _0x13c716=serializeExpandedRule(_0x3d2bae,_0x5312fc),_0x5a0884=_0x49ccfe[_0x514192(0xcb)](_0x13c716);if(_0x5a0884&&_0x5a0884[_0x514192(0xfe)]>0x0){const _0x30a937=_0x5eae2c['get'](_0x13c716)||0x0,_0x1c340b=_0x5a0884[_0x30a937]||_0x5a0884[_0x5a0884['length']-0x1];_0x5eae2c[_0x514192(0x89)](_0x13c716,_0x30a937+0x1),_0x343284=_0x1c340b,_0x477f28[_0x514192(0x106)](_0x343284),_0x233b5d[_0x514192(0x89)](_0x2d8608,_0x343284);const _0x1f81ba=await resolveRuleSegmentRefs(_0x3d2bae,async _0x47bf1d=>{const _0x2b8d5a=_0x514192,_0x5af9b5=_0x233b5d[_0x2b8d5a(0xcb)](_0x47bf1d);if(_0x5af9b5)return _0x5af9b5;const _0x4344db=await _0x452013[_0x2b8d5a(0xc2)](_0x47bf1d);return _0x4344db[_0x2b8d5a(0x7e)];});_0x102549={'description':_0x4b3ea8[_0x514192(0xf9)],'rule':_0x1f81ba};}else{const _0x2bf89d=_0x5da4f7['get'](_0x13c716);if(_0x2bf89d)_0x343284=_0x2bf89d,_0x233b5d[_0x514192(0x89)](_0x2d8608,_0x343284);else{if(_0x515f51){let _0x16eb75=_0x515f51,_0x5403f7=0x2;while(_0x477f28[_0x514192(0x168)](_0x16eb75)||_0xa9bf0f[_0x514192(0x168)](_0x16eb75)){_0x16eb75=_0x515f51+'_'+_0x5403f7,_0x5403f7++;}_0x477f28['add'](_0x16eb75),_0x343284=_0x16eb75;}_0x233b5d[_0x514192(0x89)](_0x2d8608,_0x343284),_0x5da4f7[_0x514192(0x89)](_0x13c716,_0x343284);const _0x4888ea=await resolveRuleSegmentRefs(_0x3d2bae,async _0x372c9f=>{const _0x3578c4=_0x514192,_0x339697=_0x233b5d[_0x3578c4(0xcb)](_0x372c9f);if(_0x339697)return _0x339697;const _0x2af63f=await _0x452013[_0x3578c4(0xc2)](_0x372c9f);return _0x2af63f[_0x3578c4(0x7e)];});_0x102549={'description':_0x4b3ea8[_0x514192(0xf9)],'rule':_0x4888ea};}}}return{'name':_0x343284,'isJourneyLocal':_0x56d6ab,'definition':_0x102549};}catch(_0x40f192){return logger[_0x514192(0xb9)](_0x514192(0x104)+_0x2d8608+':\x20'+_0x40f192),{'name':_0x2d8608,'isJourneyLocal':![]};}},'resolveActivation':async _0x16af94=>{const _0x164cd5=a152_0xc3a3,_0x194575=_0x268681['get'](_0x16af94);if(_0x194575!==undefined)return{'name':_0x194575,'isJourneyLocal':!![]};try{let _0x446738=_0x552f20?.['get'](_0x16af94);!_0x446738&&(_0x446738=await _0x11a07a[_0x164cd5(0x7d)]['getActivation'](_0x5888eb,_0x16af94));const _0x284e92=_0x446738[_0x164cd5(0x149)][_0x164cd5(0x123)]['name']||_0x16af94,_0x3c327d=sanitizeYamlKey(_0x284e92)||'activation_'+_0x16af94,_0x2d47c6=_0x3c327d;_0x268681[_0x164cd5(0x89)](_0x16af94,_0x2d47c6);const _0x8f283a=journeyActivationStepToYaml(_0x446738,_0x174f3d,_0x21b8fb);return{'name':_0x2d47c6,'isJourneyLocal':!![],'definition':_0x8f283a};}catch(_0x380a38){return logger[_0x164cd5(0xb9)](_0x164cd5(0xbe)+_0x16af94+':\x20'+_0x380a38),{'name':_0x16af94,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x4502cc,_0x554a36)=>resolveJumpTarget(_0x4502cc,_0x554a36,_0x1807d6,async _0x25e1d0=>{const _0x4a39ff=a152_0xc3a3,_0x37a509=_0x23c948?.[_0x4a39ff(0xcb)](_0x25e1d0);if(_0x37a509)return _0x37a509;return _0x11a07a[_0x4a39ff(0x7d)][_0x4a39ff(0xde)](_0x25e1d0);})};return _0x452013=_0x5e8dba,_0x5e8dba;},_0x2dee68=async _0x1de9c6=>{const _0x1c92b1=a152_0xc3a3,{collectSegmentIdsFromJourneyApi:_0x180b46}=await import('./journey-yaml.js'),{batchAsync:_0x1e7a22}=await import(_0x1c92b1(0xa5)),_0x32d340=new Set();for(const _0x4b8235 of _0x1de9c6){let _0x11894a=_0x23c948?.[_0x1c92b1(0xcb)](_0x4b8235);!_0x11894a&&(_0x11894a=await _0x11a07a[_0x1c92b1(0x7d)]['getJourney'](_0x4b8235));const _0x30246b=_0x180b46(_0x11894a);for(const _0x2be5d5 of _0x30246b){_0x32d340[_0x1c92b1(0x106)](_0x2be5d5);}}let _0x1aa9dd=Array[_0x1c92b1(0x148)](_0x32d340);while(_0x1aa9dd['length']>0x0){const _0x247e0d=_0x1aa9dd[_0x1c92b1(0x144)](_0x1a65e8=>!_0x339b70[_0x1c92b1(0x168)](_0x1a65e8));if(_0x247e0d[_0x1c92b1(0xfe)]===0x0)break;const _0x5c9409=await _0x1e7a22(_0x247e0d,async _0x4e76d1=>{const _0x57e693=_0x1c92b1;_0x339b70[_0x57e693(0x106)](_0x4e76d1);const _0x1fb145=await fetchSegment(_0x11a07a,_0x2457f9,_0x4e76d1,_0x5af788);if(!_0x1fb145)return null;return{'segmentId':_0x4e76d1,'segment':_0x1fb145};},0xa),_0x4c3606=new Set();for(const _0x16305c of _0x5c9409){if(!_0x16305c?.[_0x1c92b1(0x134)]?.[_0x1c92b1(0x143)])continue;const _0x423f59=apiRuleToYaml(_0x16305c[_0x1c92b1(0x134)][_0x1c92b1(0x143)]);_0x5312fc['set'](_0x16305c[_0x1c92b1(0x165)],_0x423f59);const _0x101da1=collectSegmentRefsFromRule(_0x423f59);for(const _0x14db25 of _0x101da1){!_0x339b70['has'](_0x14db25)&&_0x4c3606['add'](_0x14db25);}}_0x1aa9dd=Array[_0x1c92b1(0x148)](_0x4c3606);}};return{'createYamlContext':_0x14b357,'prefetchJourneySegments':_0x2dee68};}export async function executePushSegments(_0x467289,_0x2ebff4,_0x2705fe,_0x5f3089,_0x2ccf8e){const _0xc10d9=a152_0x38a090,{segmentDefToCreateRequest:_0x3ec315,segmentDefToUpdateRequest:_0x481306}=await import(_0xc10d9(0x73)),_0x537f4f=_0x2705fe[_0xc10d9(0x78)],_0x44e4b3=0x5,_0x437ef6=async _0x4a5ae5=>{const _0x49c114=_0xc10d9,_0x2eac0e=_0x4a5ae5[_0x49c114(0x12c)]?_0x537f4f[_0x49c114(0xcb)](_0x4a5ae5['folderPath']):undefined;let _0x2d62d1;const _0x281e5c={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0xe702c7=_0x4a5ae5[_0x49c114(0xa2)];if(_0x4a5ae5['yamlConfig'][_0x49c114(0x143)]){const _0x1295ed=createSegmentIdResolver(_0x2705fe['segmentNameToId'],_0x4a5ae5['yamlConfig'][_0x49c114(0x7e)]),_0x2c50c6=await resolveRuleSegmentIds(_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x143)],_0x1295ed);_0xe702c7={..._0x4a5ae5[_0x49c114(0xa2)],'rule':_0x2c50c6};}try{if(_0x4a5ae5[_0x49c114(0x9b)]){_0x2ccf8e[_0x49c114(0x11a)]?.({'type':_0x49c114(0x10d),'name':_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)]});const _0x1c4cb9=_0x3ec315(_0xe702c7,_0x2eac0e),_0x2df04a=await _0x2ccf8e[_0x49c114(0xb0)]('Creating\x20segment\x20\x27'+_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)]+'\x27...',()=>_0x467289[_0x49c114(0x134)][_0x49c114(0x16b)](_0x5f3089[_0x49c114(0xea)],_0x1c4cb9));_0x2d62d1=_0x2df04a[_0x49c114(0x14e)]['id'],_0x2705fe[_0x49c114(0x82)][_0x49c114(0x89)](_0x4a5ae5['yamlConfig']['name'],_0x2d62d1),_0x281e5c[_0x49c114(0x111)]={'name':_0x4a5ae5[_0x49c114(0xa2)]['name'],'id':_0x2d62d1},_0x2ccf8e[_0x49c114(0x11a)]?.({'type':_0x49c114(0x110),'name':_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)],'segmentId':_0x2d62d1}),_0x2ccf8e['logSuccess']?.('Created\x20segment\x20\x27'+_0x4a5ae5['yamlConfig']['name']+'\x27'),_0x281e5c['created']=0x1;}else{if(_0x4a5ae5['hasChanges']){_0x2ccf8e[_0x49c114(0x11a)]?.({'type':_0x49c114(0x15a),'name':_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)]});const _0x318df0=_0x481306(_0xe702c7);_0x2eac0e!==_0x4a5ae5[_0x49c114(0x124)]?.['segmentFolderId']&&(_0x318df0[_0x49c114(0xbd)]=_0x2eac0e?parseInt(_0x2eac0e,0xa):undefined),await _0x2ccf8e[_0x49c114(0xb0)]('Updating\x20segment\x20\x27'+_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)]+_0x49c114(0x14c),()=>_0x467289[_0x49c114(0x134)][_0x49c114(0x138)](_0x5f3089[_0x49c114(0xea)],_0x4a5ae5[_0x49c114(0x124)]['id'],_0x318df0)),_0x2d62d1=_0x4a5ae5[_0x49c114(0x124)]['id'],_0x2ccf8e[_0x49c114(0x11a)]?.({'type':_0x49c114(0xd3),'name':_0x4a5ae5['yamlConfig'][_0x49c114(0x7e)]}),_0x2ccf8e[_0x49c114(0x115)]?.(_0x49c114(0x6a)+_0x4a5ae5[_0x49c114(0xa2)]['name']+'\x27'),_0x281e5c[_0x49c114(0x9d)]=0x1;}else _0x2d62d1=_0x4a5ae5[_0x49c114(0x124)]['id'];}}catch(_0x55303d){const _0x51c04c=isHttp400Error(_0x55303d),_0x118ea1=_0x51c04c?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x49c114(0x92)],_0x542e79=getErrorMessage(_0x55303d);throw new SDKError(_0x118ea1,_0x49c114(0x12b)+(_0x4a5ae5[_0x49c114(0x9b)]?_0x49c114(0x132):_0x49c114(0x15d))+_0x49c114(0xc9)+_0x4a5ae5['absolutePath']+_0x49c114(0x8e)+_0x542e79,_0x55303d);}try{const _0x2b8db1=await syncActivationsForSegment(_0x467289,_0x5f3089['parentId'],_0x2d62d1,_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)],_0x4a5ae5[_0x49c114(0xcd)],_0x2ccf8e,_0x4a5ae5[_0x49c114(0xcf)]);_0x281e5c['activations']=_0x2b8db1;}catch(_0x18e7da){if(_0x18e7da instanceof SDKError)throw _0x18e7da;throw new SDKError(ErrorCode[_0x49c114(0xf3)],_0x49c114(0x100)+_0x4a5ae5[_0x49c114(0xa2)][_0x49c114(0x7e)]+_0x49c114(0x126)+_0x4a5ae5['absolutePath']+_0x49c114(0x8e)+getErrorMessage(_0x18e7da),_0x18e7da);}return _0x281e5c;},_0x4fd194=await batchAsync(_0x2ebff4,_0x437ef6,_0x44e4b3),_0x223ab2={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4c8bce of _0x4fd194){_0x223ab2[_0xc10d9(0x141)]+=_0x4c8bce[_0xc10d9(0x141)],_0x223ab2['updated']+=_0x4c8bce[_0xc10d9(0x9d)],_0x4c8bce[_0xc10d9(0x111)]&&_0x223ab2['createdSegmentIds'][_0xc10d9(0x89)](_0x4c8bce[_0xc10d9(0x111)][_0xc10d9(0x7e)],_0x4c8bce['createdSegmentId']['id']),_0x223ab2[_0xc10d9(0x86)][_0xc10d9(0x141)]+=_0x4c8bce['activations'][_0xc10d9(0x141)],_0x223ab2[_0xc10d9(0x86)][_0xc10d9(0x9d)]+=_0x4c8bce[_0xc10d9(0x86)][_0xc10d9(0x9d)],_0x223ab2['activations']['deleted']+=_0x4c8bce[_0xc10d9(0x86)]['deleted'];}return _0x223ab2;}async function syncActivationsForSegment(_0x340908,_0x344554,_0x468651,_0x571245,_0x187acc,_0x5e028e,_0x1e65e5){const _0x53b51d=a152_0x38a090,_0x432607={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x5ea0e5 of _0x187acc){try{if(_0x5ea0e5[_0x53b51d(0xaf)]===_0x53b51d(0x132)&&_0x5ea0e5['validatedRequest'])_0x5e028e[_0x53b51d(0x11a)]?.({'type':'activation_creating','segmentName':_0x571245,'activationName':_0x5ea0e5[_0x53b51d(0x7e)]}),await _0x5e028e[_0x53b51d(0xb0)](_0x53b51d(0x142)+_0x5ea0e5[_0x53b51d(0x7e)]+_0x53b51d(0x14c),()=>_0x340908[_0x53b51d(0x134)][_0x53b51d(0xb2)](_0x344554,_0x468651,_0x5ea0e5['validatedRequest'])),_0x5e028e[_0x53b51d(0x11a)]?.({'type':'activation_created','segmentName':_0x571245,'activationName':_0x5ea0e5[_0x53b51d(0x7e)]}),_0x5e028e[_0x53b51d(0x115)]?.(_0x53b51d(0x81)+_0x5ea0e5[_0x53b51d(0x7e)]+'\x27'),_0x432607[_0x53b51d(0x141)]++;else{if(_0x5ea0e5[_0x53b51d(0xaf)]===_0x53b51d(0x15d)&&_0x5ea0e5[_0x53b51d(0x120)]&&_0x5ea0e5['existingActivation'])_0x5e028e[_0x53b51d(0x11a)]?.({'type':_0x53b51d(0x96),'segmentName':_0x571245,'activationName':_0x5ea0e5['name']}),await _0x5e028e[_0x53b51d(0xb0)](_0x53b51d(0x97)+_0x5ea0e5[_0x53b51d(0x7e)]+_0x53b51d(0x14c),()=>_0x340908['segment'][_0x53b51d(0x6e)](_0x344554,_0x468651,_0x5ea0e5[_0x53b51d(0x9a)]['id'],_0x5ea0e5['validatedRequest'])),_0x5e028e[_0x53b51d(0x11a)]?.({'type':'activation_updated','segmentName':_0x571245,'activationName':_0x5ea0e5[_0x53b51d(0x7e)]}),_0x5e028e[_0x53b51d(0x115)]?.(_0x53b51d(0x118)+_0x5ea0e5[_0x53b51d(0x7e)]+'\x27'),_0x432607[_0x53b51d(0x9d)]++;else _0x5ea0e5['type']===_0x53b51d(0x6b)&&_0x5ea0e5[_0x53b51d(0x9a)]&&(_0x5e028e['onProgress']?.({'type':'activation_deleting','segmentName':_0x571245,'activationName':_0x5ea0e5[_0x53b51d(0x7e)]}),await _0x5e028e[_0x53b51d(0xb0)](_0x53b51d(0x12d)+_0x5ea0e5['name']+_0x53b51d(0x14c),()=>_0x340908[_0x53b51d(0x134)][_0x53b51d(0xc3)](_0x344554,_0x468651,_0x5ea0e5[_0x53b51d(0x9a)]['id'])),_0x5e028e[_0x53b51d(0x11a)]?.({'type':_0x53b51d(0x102),'segmentName':_0x571245,'activationName':_0x5ea0e5[_0x53b51d(0x7e)]}),_0x5e028e[_0x53b51d(0x128)]?.('Deleted\x20activation\x20\x27'+_0x5ea0e5[_0x53b51d(0x7e)]+'\x27'),_0x432607[_0x53b51d(0xf4)]++);}}catch(_0x44f01f){const _0xca415e=isHttp400Error(_0x44f01f),_0x2f9dc5=_0xca415e?ErrorCode[_0x53b51d(0x90)]:ErrorCode[_0x53b51d(0xf3)],_0x3aa836=getErrorMessage(_0x44f01f);throw new SDKError(_0x2f9dc5,_0x53b51d(0x12b)+_0x5ea0e5[_0x53b51d(0xaf)]+_0x53b51d(0xd1)+_0x5ea0e5['name']+_0x53b51d(0x126)+_0x1e65e5+_0x53b51d(0x8e)+_0x3aa836,_0x44f01f);}}return _0x432607;}export async function executePushFolders(_0x4a0d8d,_0x307243,_0x165cfe,_0x377ea9,_0x49b303){const _0x2d7645=a152_0x38a090,_0x345e11=new Map(_0x165cfe),_0x312dc4=sortFoldersByDepth(_0x307243);for(const _0x50f4c4 of _0x312dc4){const _0x1335be=_0x50f4c4[_0x2d7645(0x153)]('/'),_0x2c2a40=_0x1335be[_0x1335be['length']-0x1],_0xf12397=_0x1335be[_0x2d7645(0x139)](0x0,-0x1)[_0x2d7645(0xff)]('/'),_0x44e61c=_0x345e11[_0x2d7645(0xcb)](_0xf12397);_0x49b303[_0x2d7645(0x11a)]?.({'type':_0x2d7645(0x122),'folder':_0x50f4c4});const _0x560ec6={'name':_0x2c2a40,'parentFolderId':_0x44e61c},_0x58894c=await _0x49b303[_0x2d7645(0xb0)](_0x2d7645(0xbb)+_0x50f4c4+_0x2d7645(0x14c),()=>_0x4a0d8d[_0x2d7645(0x134)][_0x2d7645(0xeb)](_0x377ea9['parentId'],_0x560ec6));_0x345e11['set'](_0x50f4c4,_0x58894c[_0x2d7645(0x14e)]['id']),_0x49b303[_0x2d7645(0x11a)]?.({'type':_0x2d7645(0x164),'folder':_0x50f4c4,'folderId':_0x58894c[_0x2d7645(0x14e)]['id']}),_0x49b303[_0x2d7645(0xdb)]?.('Created\x20folder\x20\x27'+_0x50f4c4+'\x27');}return _0x345e11;}export async function executePushSegmentDeletions(_0x1082b2,_0x368d8d,_0x2f81e1){const _0x165185=a152_0x38a090;if(_0x368d8d[_0x165185(0xfe)]===0x0)return 0x0;const {batchAsync:_0x181aa8}=await import(_0x165185(0xa5)),_0x3d5aac=0x5,_0x2126d1=await _0x181aa8(_0x368d8d,async _0x24c838=>{const _0x128204=_0x165185;return _0x2f81e1[_0x128204(0x11a)]?.({'type':'segment_deleting','name':_0x24c838[_0x128204(0x7e)]}),await _0x1082b2['segment'][_0x128204(0x11b)](_0x24c838['id']),_0x2f81e1[_0x128204(0x11a)]?.({'type':_0x128204(0xa7),'name':_0x24c838[_0x128204(0x7e)]}),_0x2f81e1[_0x128204(0x128)]?.(_0x128204(0x76)+_0x24c838[_0x128204(0x7e)]+'\x27'),0x1;},_0x3d5aac);return _0x2126d1['reduce']((_0x11b4f4,_0x4b7ae9)=>_0x11b4f4+_0x4b7ae9,0x0);}export async function executePushJourneys(_0x2bd287,_0x33c296,_0x3fcb53,_0x2bd492,_0x1dce22){const _0x5b7788=a152_0x38a090,{journeyDefToRequest:_0x49c0ca}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x560945,yamlRuleToApi:_0x4e0298,validateSegmentRule:_0x490f80}=await import(_0x5b7788(0x73)),_0x1982a2={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x31e27c=new Map(_0x3fcb53[_0x5b7788(0x82)]),_0x4661e2=0x5;for(let _0x2ec8f2=0x0;_0x2ec8f2<_0x33c296[_0x5b7788(0xfe)];_0x2ec8f2+=_0x4661e2){const _0x1b86d1=_0x33c296[_0x5b7788(0x139)](_0x2ec8f2,_0x2ec8f2+_0x4661e2),_0x4047c6=await Promise['all'](_0x1b86d1[_0x5b7788(0x131)](async _0x4ae639=>{const _0x3adc83=_0x5b7788;if(!_0x4ae639[_0x3adc83(0x9b)]&&!_0x4ae639['hasChanges'])return{'action':_0x3adc83(0xf5),'name':_0x4ae639[_0x3adc83(0xa2)][_0x3adc83(0x7e)],'journeyId':_0x4ae639['existingJourney']?.['id']};const _0x12b558=_0x4ae639[_0x3adc83(0x12c)]?_0x3fcb53[_0x3adc83(0x78)][_0x3adc83(0xcb)](_0x4ae639[_0x3adc83(0x12c)]):undefined;_0x1dce22[_0x3adc83(0x11a)]?.({'type':_0x4ae639[_0x3adc83(0x9b)]?'journey_creating':_0x3adc83(0xae),'name':_0x4ae639[_0x3adc83(0xa2)][_0x3adc83(0x7e)]});try{const _0x3c1c63=await executeSingleJourneyPush(_0x2bd287,_0x4ae639,{..._0x3fcb53,'segmentNameToId':_0x31e27c},{'parentId':_0x2bd492[_0x3adc83(0xea)],'rootFolderId':_0x2bd492[_0x3adc83(0x12a)],'folderId':_0x12b558,'verbose':_0x2bd492['verbose']},_0x1dce22,{'journeyDefToRequest':_0x49c0ca,'activationDefToCreateRequest':_0x560945,'yamlRuleToApi':_0x4e0298,'validateSegmentRule':_0x490f80});for(const [_0x1584e6,_0x5bb21a]of _0x3c1c63[_0x3adc83(0x15f)]){_0x31e27c[_0x3adc83(0x89)](_0x1584e6,_0x5bb21a),_0x1982a2[_0x3adc83(0x15f)][_0x3adc83(0x89)](_0x1584e6,_0x5bb21a);}if(_0x3c1c63['action']==='created')_0x1dce22['onProgress']?.({'type':_0x3adc83(0xf8),'name':_0x4ae639[_0x3adc83(0xa2)][_0x3adc83(0x7e)],'journeyId':_0x3c1c63[_0x3adc83(0xca)]}),_0x1dce22[_0x3adc83(0x115)]?.(_0x3adc83(0x14b)+_0x4ae639[_0x3adc83(0xa2)][_0x3adc83(0x7e)]+'\x27'),_0x1982a2[_0x3adc83(0x141)]++;else _0x3c1c63[_0x3adc83(0x10b)]===_0x3adc83(0x9d)&&(_0x1dce22[_0x3adc83(0x11a)]?.({'type':'journey_updated','name':_0x4ae639['yamlConfig'][_0x3adc83(0x7e)]}),_0x1dce22[_0x3adc83(0x115)]?.(_0x3adc83(0xd9)+_0x4ae639['yamlConfig'][_0x3adc83(0x7e)]+'\x27'),_0x1982a2[_0x3adc83(0x9d)]++);return{'action':_0x3c1c63[_0x3adc83(0x10b)],'name':_0x4ae639[_0x3adc83(0xa2)][_0x3adc83(0x7e)],'journeyId':_0x3c1c63[_0x3adc83(0xca)]};}catch(_0xf39e87){const _0x43e43c=isHttp400Error(_0xf39e87),_0xa738c3=_0x43e43c?ErrorCode[_0x3adc83(0x10f)]:ErrorCode[_0x3adc83(0x70)],_0x5c1aa5=getErrorMessage(_0xf39e87);throw new SDKError(_0xa738c3,_0x3adc83(0x12b)+(_0x4ae639[_0x3adc83(0x9b)]?_0x3adc83(0x132):_0x3adc83(0x15d))+'\x20journey\x20from\x20file:\x20'+_0x4ae639[_0x3adc83(0xcf)]+'\x0a\x20\x20'+_0x5c1aa5,_0xf39e87);}}));_0x1982a2[_0x5b7788(0x166)][_0x5b7788(0x7a)](..._0x4047c6);}return _0x1982a2;}async function matchExistingJourneySegments(_0x615227,_0x4c72a1,_0x609cdc,_0x2d4237,_0x205d73){const _0x5c5f53=a152_0x38a090;if(!_0x4c72a1[_0x5c5f53(0xb5)]||!_0x4c72a1[_0x5c5f53(0xa2)][_0x5c5f53(0x93)])return;const _0x54b64f=new Map(),_0xb34d10=new Set();for(const _0x246d9f of Object['keys'](_0x4c72a1[_0x5c5f53(0xa2)][_0x5c5f53(0x93)])){const _0x3939ae=generateDeterministicJourneySegmentName(_0x4c72a1[_0x5c5f53(0xa2)]['name'],_0x246d9f);_0x54b64f[_0x5c5f53(0x89)](_0x3939ae,_0x246d9f),_0xb34d10[_0x5c5f53(0x106)](_0x246d9f);}const _0x59fd71=[],_0x3de6dc=collectSegmentIdsFromJourneyApi(_0x4c72a1[_0x5c5f53(0xb5)]);for(const _0x2a4bb9 of _0x3de6dc){const _0x524f0c=await fetchSegment(_0x615227,_0x609cdc,_0x2a4bb9,_0x2d4237);if(!_0x524f0c?.['name'])continue;const _0x509c8b=_0x54b64f['get'](_0x524f0c[_0x5c5f53(0x7e)]);_0x509c8b?(_0x205d73['set'](_0x509c8b,_0x2a4bb9),_0xb34d10[_0x5c5f53(0x6b)](_0x509c8b)):_0x59fd71['push']({'id':_0x2a4bb9,'seg':_0x524f0c});}if(_0xb34d10[_0x5c5f53(0xef)]>0x0&&_0x59fd71[_0x5c5f53(0xfe)]>0x0){const {localExpandedRuleToNames:_0x5d5722}=buildLocalExpandedRuleMappings(_0x4c72a1[_0x5c5f53(0xa2)]),_0x237caa=new Map();for(const {id:_0x3371cc,seg:_0x1b80aa}of _0x59fd71){if(_0x1b80aa['rule']){const _0x4ca506=apiRuleToYaml(_0x1b80aa[_0x5c5f53(0x143)]);_0x237caa[_0x5c5f53(0x89)](_0x3371cc,_0x4ca506);}}for(const {id:_0x215ee3,seg:_0x2a1974}of _0x59fd71){if(!_0x2a1974['rule'])continue;const _0x54bbb7=_0x237caa[_0x5c5f53(0xcb)](_0x215ee3);if(!_0x54bbb7)continue;const _0x32eb6f=serializeExpandedRule(_0x54bbb7,_0x237caa),_0x21b370=_0x5d5722[_0x5c5f53(0xcb)](_0x32eb6f);if(_0x21b370){const _0x8754f9=_0x21b370[_0x5c5f53(0x98)](_0x2dc4a0=>_0xb34d10[_0x5c5f53(0x168)](_0x2dc4a0));_0x8754f9&&(_0x205d73[_0x5c5f53(0x89)](_0x8754f9,_0x215ee3),_0xb34d10[_0x5c5f53(0x6b)](_0x8754f9),logger['debug'](_0x5c5f53(0x13c)+_0x2a1974['name']+_0x5c5f53(0xd0)+_0x8754f9+_0x5c5f53(0xb3)));}}}}async function executeSingleJourneyPush(_0x4b4fed,_0x4af431,_0x594ba9,_0x354c7a,_0x13b632,_0x13ef22){const _0x3e9ba7=a152_0x38a090,{journeyDefToRequest:_0xbced33,activationDefToCreateRequest:_0x541e9e,yamlRuleToApi:_0x4ada7d,validateSegmentRule:_0xc9feb}=_0x13ef22,_0x352256=new Map(),_0x154cf2=new Map();recoverSegmentIdsFromPushRecovery(_0x4af431,_0x352256,_0x594ba9[_0x3e9ba7(0x82)]);const _0x55cc2b=new Map(),_0x4c5692=new Map(),_0xad7c41=new Map();let _0x489f8c;const _0x8c8a93=async()=>{const _0x4aba13=_0x3e9ba7;if(_0x489f8c)return;_0x489f8c=new Map();if(!_0x4af431['existingJourney'])return;const _0x4830da=await _0x4b4fed[_0x4aba13(0x7d)][_0x4aba13(0x7c)](_0x4af431[_0x4aba13(0xb5)]['id']);for(const _0x10ccf8 of _0x4830da){const _0x46936c=journeyActivationStepToYaml(_0x10ccf8,_0x594ba9[_0x4aba13(0x119)],_0x594ba9['connectionIdToNameMap']),_0x532103=activationSignature(_0x46936c);!_0x489f8c[_0x4aba13(0x168)](_0x532103)&&_0x489f8c[_0x4aba13(0x89)](_0x532103,_0x10ccf8['id']),_0x46936c['name']&&_0x154cf2[_0x4aba13(0x89)](_0x46936c[_0x4aba13(0x7e)],_0x10ccf8['id']);}};await matchExistingJourneySegments(_0x4b4fed,_0x4af431,_0x354c7a[_0x3e9ba7(0xea)],_0x594ba9['existingSegments'],_0x594ba9['segmentNameToId']);const _0x57851f={'resolveSegmentId':async _0x3239ae=>{const _0xf84b11=_0x3e9ba7,_0xbb072d=_0x594ba9[_0xf84b11(0x82)][_0xf84b11(0xcb)](_0x3239ae);if(!_0xbb072d)throw new SDKError(ErrorCode[_0xf84b11(0x13a)],_0xf84b11(0x136)+_0x3239ae+_0xf84b11(0x112)+_0x4af431[_0xf84b11(0xa2)][_0xf84b11(0x7e)]+')');return _0xbb072d;},'resolveEmbeddedSegmentId':async(_0x1589a9,_0x43c654)=>{const _0x85e5ff=_0x3e9ba7,_0x40f159=_0x594ba9[_0x85e5ff(0x82)][_0x85e5ff(0xcb)](_0x1589a9);if(_0x40f159)return _0x40f159;const _0xe7760c=_0x594ba9[_0x85e5ff(0x11e)]['find'](_0x5f16a1=>_0x5f16a1[_0x85e5ff(0x7e)]===_0x1589a9);if(_0xe7760c)return _0x594ba9[_0x85e5ff(0x82)]['set'](_0x1589a9,_0xe7760c['id']),_0xe7760c['id'];if(_0x4af431[_0x85e5ff(0x9b)]){const {stageName:_0x4226d8,criteriaName:_0x14e768}=findSegmentCriteriaLocation(_0x4af431[_0x85e5ff(0xa2)],_0x1589a9);return _0xc9feb(_0x1589a9,_0x43c654['rule']),_0x4c5692['set'](_0x1589a9,{'definition':_0x43c654,'stageName':_0x4226d8,'criteriaName':_0x14e768}),createPendingSegmentId(_0x1589a9);}const _0x273dc0=_0x4af431[_0x85e5ff(0xb5)]?.['id'];if(!_0x273dc0)throw new SDKError(ErrorCode[_0x85e5ff(0x10e)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x297fdb=_0x55cc2b[_0x85e5ff(0xcb)](_0x1589a9);if(_0x297fdb)return _0x297fdb;const _0x529aa7=((async()=>{const _0x4311dd=_0x85e5ff;_0xc9feb(_0x1589a9,_0x43c654['rule']);const _0x12808d=generateDeterministicJourneySegmentName(_0x4af431[_0x4311dd(0xa2)][_0x4311dd(0x7e)],_0x1589a9),_0x4046f4=_0x594ba9[_0x4311dd(0x11e)][_0x4311dd(0x98)](_0x14e9d5=>_0x14e9d5[_0x4311dd(0x7e)]===_0x12808d),_0x14e898=createSegmentIdResolver(_0x594ba9[_0x4311dd(0x82)],_0x1589a9),_0x46a582=await resolveRuleSegmentIds(_0x43c654[_0x4311dd(0x143)],_0x14e898);let _0x545053;return _0x4046f4?(await _0x4b4fed[_0x4311dd(0x134)]['updateSegmentById'](_0x354c7a['parentId'],_0x4046f4['id'],{'description':_0x43c654[_0x4311dd(0xf9)]||_0x4311dd(0x15c)+_0x1589a9,'rule':_0x4ada7d(_0x46a582),'countPopulation':!![]}),_0x545053=_0x4046f4['id'],saveSegmentToPushRecovery(_0x4af431[_0x4311dd(0xcf)],_0x4af431[_0x4311dd(0xa2)][_0x4311dd(0x7e)],_0x1589a9,{'segmentId':_0x545053,'uniqueServerName':_0x12808d,'createdAt':new Date()[_0x4311dd(0x77)]()})):_0x545053=await createOrRecoverEmbeddedSegment(_0x4b4fed,_0x4af431,{'localName':_0x1589a9,'uniqueSegmentName':_0x12808d,'description':_0x43c654['description']||_0x4311dd(0x15c)+_0x1589a9,'journeyId':_0x273dc0,'resolvedRule':_0x46a582,'parentId':_0x354c7a['parentId'],'folderId':_0x354c7a[_0x4311dd(0x12a)]||''},_0x4ada7d),_0x594ba9[_0x4311dd(0x82)][_0x4311dd(0x89)](_0x1589a9,_0x545053),_0x352256[_0x4311dd(0x89)](_0x1589a9,_0x545053),_0x545053;})());_0x55cc2b[_0x85e5ff(0x89)](_0x1589a9,_0x529aa7);try{return await _0x529aa7;}finally{_0x55cc2b[_0x85e5ff(0x6b)](_0x1589a9);}},'resolveActivationId':async _0x430476=>{const _0x202baa=_0x3e9ba7,_0x2e89eb=_0x154cf2[_0x202baa(0xcb)](_0x430476);if(_0x2e89eb)return _0x2e89eb;if(_0x4af431['existingJourney']){await _0x8c8a93();const _0x2affe6=_0x154cf2['get'](_0x430476);if(_0x2affe6)return _0x2affe6;}throw new SDKError(ErrorCode[_0x202baa(0xac)],'Activation\x20not\x20found:\x20'+_0x430476+_0x202baa(0x112)+_0x4af431['yamlConfig']['name']+_0x202baa(0x152)+_0x202baa(0xc6));},'resolveEmbeddedActivationId':async(_0x17fb23,_0x5bb342)=>{const _0x6f8ec9=_0x3e9ba7,_0x999ccb=_0x154cf2['get'](_0x17fb23);if(_0x999ccb)return _0x999ccb;if(_0x4af431[_0x6f8ec9(0x9b)])return _0xad7c41['set'](_0x17fb23,_0x5bb342),createPendingActivationId(_0x17fb23);if(_0x4af431[_0x6f8ec9(0xb5)]){await _0x8c8a93();const _0x1144a6=_0x154cf2[_0x6f8ec9(0xcb)](_0x5bb342[_0x6f8ec9(0x7e)]);if(_0x1144a6)return _0x154cf2[_0x6f8ec9(0x89)](_0x17fb23,_0x1144a6),_0x1144a6;const _0xfa5e96=activationSignature(_0x5bb342),_0x19462f=_0x489f8c?.[_0x6f8ec9(0xcb)](_0xfa5e96);if(_0x19462f)return _0x154cf2[_0x6f8ec9(0x89)](_0x17fb23,_0x19462f),_0x19462f;const _0x471ae5=await _0x541e9e(_0x5bb342,_0x594ba9['activationContext']),_0x1860fd={..._0x471ae5,..._0x5bb342['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x5bb342[_0x6f8ec9(0xfd)]}},_0x77345f=await _0x4b4fed[_0x6f8ec9(0x7d)][_0x6f8ec9(0xb2)](_0x4af431[_0x6f8ec9(0xb5)]['id'],_0x1860fd);return _0x154cf2[_0x6f8ec9(0x89)](_0x17fb23,_0x77345f['id']),_0x77345f['id'];}throw new SDKError(ErrorCode[_0x6f8ec9(0x10e)],_0x6f8ec9(0xa3));},'resolveJourneyId':async _0x651cb9=>{const _0x4056b5=_0x3e9ba7;try{return await _0x4b4fed[_0x4056b5(0x7d)][_0x4056b5(0x14d)](_0x354c7a[_0x4056b5(0xea)],_0x651cb9);}catch(_0x397e11){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x651cb9+_0x4056b5(0x15e)+_0x4af431[_0x4056b5(0xa2)][_0x4056b5(0x7e)]+'\x27)',_0x397e11);}},'resolveStageId':async(_0x3f2aa9,_0x4798d8)=>{const _0x270f72=_0x3e9ba7,_0x49e5c0=await _0x4b4fed[_0x270f72(0x7d)][_0x270f72(0xde)](_0x3f2aa9),_0x63d87d=_0x49e5c0[_0x270f72(0x149)][_0x270f72(0x13e)][_0x270f72(0x98)](_0x60f423=>_0x60f423[_0x270f72(0x7e)]['toLowerCase']()===_0x4798d8['toLowerCase']());if(!_0x63d87d?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x270f72(0x83)+_0x4798d8+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x49e5c0[_0x270f72(0x149)][_0x270f72(0x158)]||_0x49e5c0[_0x270f72(0x149)][_0x270f72(0x7e)])+'\x27');return _0x63d87d['id'];}},_0x2b1928=await _0xbced33(_0x4af431[_0x3e9ba7(0xa2)],_0x354c7a['parentId'],_0x57851f),_0x3ef4d9=_0x354c7a[_0x3e9ba7(0xad)]||_0x354c7a[_0x3e9ba7(0x12a)];_0x3ef4d9&&(_0x2b1928['relationships']={'parentFolder':{'data':{'id':_0x3ef4d9,'type':_0x3e9ba7(0x125)}}});if(_0x4af431['isNew']){if(_0x4c5692['size']>0x0||_0xad7c41[_0x3e9ba7(0xef)]>0x0)return await executeThreeStepJourneyCreate(_0x4b4fed,_0x4af431,_0x2b1928,{'pendingEmbeddedSegments':_0x4c5692,'pendingEmbeddedActivations':_0xad7c41,'embeddedSegmentNameToId':_0x352256,'journeyActivationNameToId':_0x154cf2},{..._0x354c7a,'effectiveFolderId':_0x3ef4d9},_0x594ba9,_0x13b632,_0x13ef22);else{ensureJourneyDefaults(_0x2b1928['attributes']);const _0x733e95=await _0x4b4fed[_0x3e9ba7(0x7d)][_0x3e9ba7(0x132)](_0x2b1928);return deletePushRecovery(_0x4af431[_0x3e9ba7(0xcf)]),{'action':_0x3e9ba7(0x141),'journeyId':_0x733e95['id'],'embeddedSegmentNameToId':_0x352256};}}else{if(_0x4af431['hasChanges']&&_0x4af431['existingJourney']){_0x2b1928['id']=_0x4af431[_0x3e9ba7(0xb5)]['id'];const _0x786f61=_0x2b1928[_0x3e9ba7(0x149)];_0x4af431[_0x3e9ba7(0xb5)]['attributes']?.[_0x3e9ba7(0x158)]&&(_0x786f61[_0x3e9ba7(0x158)]=_0x4af431['existingJourney'][_0x3e9ba7(0x149)][_0x3e9ba7(0x158)]);const _0x5a9c36=_0x4af431['existingJourney'][_0x3e9ba7(0x149)]?.['journeyStages'];return _0x5a9c36&&_0x2b1928['attributes']['journeyStages']&&injectExistingStageIds(_0x2b1928['attributes'][_0x3e9ba7(0x13e)],_0x5a9c36),ensureJourneyDefaults(_0x786f61),await _0x4b4fed[_0x3e9ba7(0x7d)]['update'](_0x4af431[_0x3e9ba7(0xb5)]['id'],_0x2b1928),deletePushRecovery(_0x4af431[_0x3e9ba7(0xcf)]),{'action':_0x3e9ba7(0x9d),'journeyId':_0x4af431['existingJourney']['id'],'embeddedSegmentNameToId':_0x352256};}}return deletePushRecovery(_0x4af431[_0x3e9ba7(0xcf)]),{'action':_0x3e9ba7(0xf5),'journeyId':_0x4af431['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x352256};}function findSegmentCriteriaLocation(_0x2468ac,_0x4566a2){const _0x5e7314=a152_0x38a090,_0x3f71f0=_0x2468ac[_0x5e7314(0xe2)]||_0x2468ac['journeys']?.[0x0]?.[_0x5e7314(0xe2)]||[];let _0x1adad5=_0x5e7314(0x10a),_0x27bced=_0x4566a2;const _0x44ac23=_0x2468ac[_0x5e7314(0x75)]||_0x2468ac[_0x5e7314(0x85)]?.[0x0]?.[_0x5e7314(0x75)];if(_0x44ac23?.['segment']===_0x4566a2)return{'stageName':_0x5e7314(0x75),'criteriaName':_0x44ac23['name']||_0x4566a2};_0xff0e99:for(const _0x1ea197 of _0x3f71f0){if(_0x1ea197['entry_criteria']?.['segment']===_0x4566a2){_0x1adad5=_0x1ea197[_0x5e7314(0x7e)],_0x27bced=_0x1ea197[_0x5e7314(0xfa)]['name']||_0x4566a2;break;}if(_0x1ea197[_0x5e7314(0xf7)])for(const _0x50399c of _0x1ea197[_0x5e7314(0xf7)]){if(_0x50399c[_0x5e7314(0xaf)]===_0x5e7314(0x8d)&&_0x50399c[_0x5e7314(0x13f)]?.[_0x5e7314(0xd5)])for(const _0x5c5824 of _0x50399c[_0x5e7314(0x13f)][_0x5e7314(0xd5)]){if(_0x5c5824[_0x5e7314(0x134)]===_0x4566a2){_0x1adad5=_0x1ea197[_0x5e7314(0x7e)],_0x27bced=_0x5c5824[_0x5e7314(0x7e)]||_0x4566a2;break _0xff0e99;}}}}return{'stageName':_0x1adad5,'criteriaName':_0x27bced};}async function executeThreeStepJourneyCreate(_0x4ebdb2,_0x4c6ed4,_0x49b190,_0x1c1279,_0x87bc2c,_0x18afa2,_0x3a1d64,_0x3a1150){const _0x3f5000=a152_0x38a090,{activationDefToCreateRequest:_0x325191,yamlRuleToApi:_0x3b4f61}=_0x3a1150,{pendingEmbeddedSegments:_0x182e6d,pendingEmbeddedActivations:_0x4ddede,embeddedSegmentNameToId:_0xa181e}=_0x1c1279,_0x1b0c09=JSON['parse'](JSON[_0x3f5000(0xb4)](_0x49b190));ensureJourneyDefaults(_0x1b0c09['attributes']),stripPendingIds(_0x1b0c09);const _0x16dd1b=await _0x4ebdb2[_0x3f5000(0x7d)][_0x3f5000(0x132)](_0x1b0c09),_0x2778fe=_0x16dd1b['id'],_0x388107=new Map();for(const _0x4abbd4 of _0x16dd1b[_0x3f5000(0x149)][_0x3f5000(0x13e)]){_0x388107[_0x3f5000(0x89)](_0x4abbd4[_0x3f5000(0x7e)][_0x3f5000(0xe6)](),_0x4abbd4['id']);}recoverSegmentIdsFromPushRecovery(_0x4c6ed4,_0xa181e,_0x18afa2['segmentNameToId']);for(const [_0x276f06,{definition:_0x22077c}]of _0x182e6d){if(_0xa181e[_0x3f5000(0x168)](_0x276f06)){_0x3a1d64['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x4c6ed4['yamlConfig']['name'],'segmentName':_0x276f06});continue;}const _0xd9389c=generateDeterministicJourneySegmentName(_0x4c6ed4[_0x3f5000(0xa2)][_0x3f5000(0x7e)],_0x276f06);_0x3a1d64[_0x3f5000(0x11a)]?.({'type':_0x3f5000(0xa1),'journeyName':_0x4c6ed4[_0x3f5000(0xa2)][_0x3f5000(0x7e)],'segmentName':_0x276f06});const _0x4faf94=createSegmentIdResolver(_0x18afa2[_0x3f5000(0x82)],_0x276f06),_0x31b26b=await resolveRuleSegmentIds(_0x22077c['rule'],_0x4faf94),_0x4c5d30=await createOrRecoverEmbeddedSegment(_0x4ebdb2,_0x4c6ed4,{'localName':_0x276f06,'uniqueSegmentName':_0xd9389c,'description':_0x22077c[_0x3f5000(0xf9)]||_0x3f5000(0x15c)+_0x276f06,'journeyId':_0x2778fe,'resolvedRule':_0x31b26b,'parentId':_0x87bc2c[_0x3f5000(0xea)],'folderId':_0x87bc2c['effectiveFolderId']||''},_0x3b4f61);_0xa181e['set'](_0x276f06,_0x4c5d30),_0x18afa2['segmentNameToId'][_0x3f5000(0x89)](_0x276f06,_0x4c5d30),_0x3a1d64[_0x3f5000(0x11a)]?.({'type':_0x3f5000(0x74),'journeyName':_0x4c6ed4[_0x3f5000(0xa2)][_0x3f5000(0x7e)],'segmentName':_0x276f06});}const _0x4c62c0=new Map();for(const [_0x4a6779,_0x1c45e5]of _0x4ddede){_0x3a1d64[_0x3f5000(0x11a)]?.({'type':_0x3f5000(0x150),'journeyName':_0x4c6ed4['yamlConfig']['name'],'activationName':_0x4a6779});const _0x4142fa=await _0x325191(_0x1c45e5,_0x18afa2[_0x3f5000(0xb7)]),_0x25a408={..._0x4142fa,..._0x1c45e5[_0x3f5000(0xfd)]!==undefined&&{'runAfterJourneyRefresh':_0x1c45e5[_0x3f5000(0xfd)]}},_0x13da86=await _0x4ebdb2[_0x3f5000(0x7d)]['createActivation'](_0x2778fe,_0x25a408);_0x4c62c0[_0x3f5000(0x89)](_0x4a6779,_0x13da86['id']),_0x1c1279[_0x3f5000(0x113)]['set'](_0x4a6779,_0x13da86['id']),_0x3a1d64[_0x3f5000(0x11a)]?.({'type':_0x3f5000(0xaa),'journeyName':_0x4c6ed4['yamlConfig']['name'],'activationName':_0x4a6779});}const _0xaaf978=JSON[_0x3f5000(0x109)](JSON[_0x3f5000(0xb4)](_0x49b190));return _0xaaf978['id']=_0x2778fe,ensureJourneyDefaults(_0xaaf978['attributes']),resolvePendingIdsInRequest(_0xaaf978,_0x49b190,_0x388107,_0xa181e,_0x4c62c0,_0x3a1d64),await _0x4ebdb2[_0x3f5000(0x7d)][_0x3f5000(0x15d)](_0x2778fe,_0xaaf978),deletePushRecovery(_0x4c6ed4['absolutePath']),{'action':_0x3f5000(0x141),'journeyId':_0x2778fe,'embeddedSegmentNameToId':_0xa181e};}export function stripWaitStepPendingIds(_0x1aa534){const _0x2c8022=a152_0x38a090,_0x250ffb=_0x1aa534[_0x2c8022(0x160)]&&isPendingSegmentId(_0x1aa534[_0x2c8022(0x160)]),_0x4d45dc=_0x1aa534[_0x2c8022(0xf1)]?.[_0x2c8022(0x13b)](_0x4a6375=>_0x4a6375['segmentId']&&isPendingSegmentId(_0x4a6375[_0x2c8022(0x165)]));(_0x250ffb||_0x4d45dc)&&(_0x1aa534[_0x2c8022(0xe4)]='Duration',_0x1aa534[_0x2c8022(0xd8)]=0x1,_0x1aa534['waitStepUnit']=_0x2c8022(0x7f),delete _0x1aa534[_0x2c8022(0x160)],delete _0x1aa534[_0x2c8022(0xec)],delete _0x1aa534[_0x2c8022(0x103)],delete _0x1aa534['conditions']);}export function resolveWaitStepPendingIds(_0x1d5b69,_0x508606,_0x55a459,_0x5d6753){const _0x363d41=a152_0x38a090;if(_0x508606['conditionSegmentId']&&isPendingSegmentId(_0x508606[_0x363d41(0x160)])){const _0x19b8e1=_0x55a459(_0x508606['conditionSegmentId'],_0x363d41(0x163)+_0x5d6753+_0x363d41(0xee));_0x19b8e1&&(_0x1d5b69['waitStepType']=_0x363d41(0x9e),_0x1d5b69[_0x363d41(0x160)]=_0x19b8e1,delete _0x1d5b69['waitStep'],delete _0x1d5b69['waitStepUnit'],_0x508606[_0x363d41(0xec)]!==undefined&&(_0x1d5b69['conditionTimeoutDuration']=_0x508606[_0x363d41(0xec)]),_0x508606['conditionTimeoutUnit']&&(_0x1d5b69[_0x363d41(0x103)]=_0x508606['conditionTimeoutUnit']));}if(_0x508606['conditions']){const _0x173c87=_0x508606[_0x363d41(0xf1)][_0x363d41(0x13b)](_0x1c3a0e=>_0x1c3a0e[_0x363d41(0x165)]&&isPendingSegmentId(_0x1c3a0e[_0x363d41(0x165)]));if(_0x173c87){const _0x2ca94b=_0x508606[_0x363d41(0xf1)]['map'](_0xb2a930=>{const _0xf27e1c=_0x363d41;if(_0xb2a930[_0xf27e1c(0x165)]&&isPendingSegmentId(_0xb2a930[_0xf27e1c(0x165)])){const _0x156a90=_0x55a459(_0xb2a930[_0xf27e1c(0x165)],_0xf27e1c(0x163)+_0x5d6753+_0xf27e1c(0xee));return{..._0xb2a930,'segmentId':_0x156a90||_0xb2a930[_0xf27e1c(0x165)]};}return{..._0xb2a930};});_0x1d5b69[_0x363d41(0xe4)]=_0x363d41(0x9e),_0x1d5b69[_0x363d41(0xf1)]=_0x2ca94b,delete _0x1d5b69[_0x363d41(0xd8)],delete _0x1d5b69[_0x363d41(0x117)],delete _0x1d5b69[_0x363d41(0x160)],delete _0x1d5b69[_0x363d41(0xec)],delete _0x1d5b69['conditionTimeoutUnit'];}}}function stripPendingIds(_0x2bc96f){const _0x481ae3=a152_0x38a090;_0x2bc96f[_0x481ae3(0x149)][_0x481ae3(0x75)]?.['segmentId']&&isPendingSegmentId(_0x2bc96f['attributes'][_0x481ae3(0x75)][_0x481ae3(0x165)])&&delete _0x2bc96f[_0x481ae3(0x149)][_0x481ae3(0x75)];for(const _0x2366e0 of _0x2bc96f[_0x481ae3(0x149)][_0x481ae3(0x13e)]||[]){_0x2366e0[_0x481ae3(0x94)]?.[_0x481ae3(0x165)]&&isPendingSegmentId(_0x2366e0[_0x481ae3(0x94)][_0x481ae3(0x165)])&&delete _0x2366e0[_0x481ae3(0x94)];_0x2366e0['milestone']?.[_0x481ae3(0x165)]&&isPendingSegmentId(_0x2366e0[_0x481ae3(0x7b)][_0x481ae3(0x165)])&&delete _0x2366e0['milestone'];_0x2366e0[_0x481ae3(0x6f)]&&(_0x2366e0[_0x481ae3(0x6f)]=_0x2366e0[_0x481ae3(0x6f)][_0x481ae3(0x144)](_0x1682c7=>!_0x1682c7[_0x481ae3(0x165)]||!isPendingSegmentId(_0x1682c7[_0x481ae3(0x165)])));if(_0x2366e0[_0x481ae3(0xf7)])for(const _0x277592 of Object['keys'](_0x2366e0[_0x481ae3(0xf7)])){const _0x473eda=_0x2366e0[_0x481ae3(0xf7)][_0x277592];_0x473eda['type']==='Activation'&&_0x473eda[_0x481ae3(0xc8)]&&isPendingActivationId(_0x473eda['journeyActivationStepId'])&&(_0x473eda[_0x481ae3(0xc8)]='');if(_0x473eda['type']===_0x481ae3(0xd4)&&_0x473eda['branches'])for(const _0x303414 of _0x473eda['branches']){_0x303414[_0x481ae3(0x165)]&&isPendingSegmentId(_0x303414[_0x481ae3(0x165)])&&(_0x303414[_0x481ae3(0x165)]='');}_0x473eda[_0x481ae3(0xaf)]==='WaitStep'&&stripWaitStepPendingIds(_0x473eda);}}}function resolvePendingIdsInRequest(_0x9e7346,_0x265d3c,_0x1d204b,_0x4eb12a,_0x8058a2,_0x555fa8){const _0x512cb0=a152_0x38a090,_0x59a6b6=(_0x502460,_0x55f58)=>{const _0x5078b9=a152_0xc3a3;if(!isPendingSegmentId(_0x502460))return _0x502460;const _0x3ca37=extractPendingSegmentName(_0x502460),_0x589c58=_0x4eb12a[_0x5078b9(0xcb)](_0x3ca37);return!_0x589c58&&_0x555fa8[_0x5078b9(0xb6)]?.(_0x5078b9(0x12f)+_0x3ca37+_0x5078b9(0xe0)+_0x55f58),_0x589c58;};if(_0x9e7346[_0x512cb0(0x149)][_0x512cb0(0x75)]?.['segmentId']&&isPendingSegmentId(_0x9e7346['attributes'][_0x512cb0(0x75)][_0x512cb0(0x165)])){const _0x200277=_0x59a6b6(_0x9e7346[_0x512cb0(0x149)][_0x512cb0(0x75)][_0x512cb0(0x165)],_0x512cb0(0x162));_0x200277&&(_0x9e7346[_0x512cb0(0x149)][_0x512cb0(0x75)]['segmentId']=_0x200277);}for(const _0x4983cb of _0x9e7346['attributes'][_0x512cb0(0x13e)]||[]){const _0x4ba95f=_0x1d204b[_0x512cb0(0xcb)](_0x4983cb[_0x512cb0(0x7e)]['toLowerCase']());_0x4ba95f&&(_0x4983cb['id']=_0x4ba95f);if(_0x4983cb[_0x512cb0(0x94)]?.[_0x512cb0(0x165)]&&isPendingSegmentId(_0x4983cb[_0x512cb0(0x94)][_0x512cb0(0x165)])){const _0x109a4e=_0x59a6b6(_0x4983cb[_0x512cb0(0x94)][_0x512cb0(0x165)],_0x512cb0(0x163)+_0x4983cb[_0x512cb0(0x7e)]+_0x512cb0(0x114));_0x109a4e&&(_0x4983cb[_0x512cb0(0x94)][_0x512cb0(0x165)]=_0x109a4e);}if(_0x4983cb[_0x512cb0(0x6f)])for(const _0x5250dd of _0x4983cb['exitCriterias']){if(_0x5250dd[_0x512cb0(0x165)]&&isPendingSegmentId(_0x5250dd[_0x512cb0(0x165)])){const _0x217b52=_0x59a6b6(_0x5250dd[_0x512cb0(0x165)],_0x512cb0(0x163)+_0x4983cb[_0x512cb0(0x7e)]+'\x27\x20exit\x20criteria');_0x217b52&&(_0x5250dd[_0x512cb0(0x165)]=_0x217b52);}}if(_0x4983cb['milestone']?.['segmentId']&&isPendingSegmentId(_0x4983cb[_0x512cb0(0x7b)]['segmentId'])){const _0x597bb9=_0x59a6b6(_0x4983cb[_0x512cb0(0x7b)][_0x512cb0(0x165)],_0x512cb0(0x163)+_0x4983cb[_0x512cb0(0x7e)]+_0x512cb0(0x84));_0x597bb9&&(_0x4983cb[_0x512cb0(0x7b)][_0x512cb0(0x165)]=_0x597bb9);}if(_0x4983cb['steps']){const _0x2dc008=_0x2a1830=>_0x265d3c[_0x512cb0(0x149)][_0x512cb0(0x13e)]?.[_0x512cb0(0x98)](_0x3ffac5=>_0x3ffac5[_0x512cb0(0x7e)][_0x512cb0(0xe6)]()===_0x4983cb[_0x512cb0(0x7e)][_0x512cb0(0xe6)]())?.[_0x512cb0(0xf7)]?.[_0x2a1830];for(const _0x5c1f38 of Object[_0x512cb0(0x135)](_0x4983cb[_0x512cb0(0xf7)])){const _0x3bfbe8=_0x4983cb['steps'][_0x5c1f38],_0x1ae518=_0x2dc008(_0x5c1f38);if(_0x3bfbe8['type']===_0x512cb0(0x151)&&_0x3bfbe8[_0x512cb0(0xc8)]&&(isPendingActivationId(_0x3bfbe8['journeyActivationStepId'])||_0x3bfbe8[_0x512cb0(0xc8)]==='')){if(_0x1ae518?.[_0x512cb0(0xc8)]&&isPendingActivationId(_0x1ae518['journeyActivationStepId'])){const _0x2fb9e7=extractPendingActivationName(_0x1ae518[_0x512cb0(0xc8)]),_0x8519e3=_0x8058a2[_0x512cb0(0xcb)](_0x2fb9e7);_0x8519e3&&(_0x3bfbe8[_0x512cb0(0xc8)]=_0x8519e3);}}if(_0x3bfbe8[_0x512cb0(0xaf)]===_0x512cb0(0xd4)&&_0x3bfbe8[_0x512cb0(0xd5)]&&_0x1ae518?.[_0x512cb0(0xd5)])for(let _0x43fc94=0x0;_0x43fc94<_0x3bfbe8[_0x512cb0(0xd5)]['length'];_0x43fc94++){const _0x2eb62e=_0x3bfbe8[_0x512cb0(0xd5)][_0x43fc94],_0x3332d2=_0x1ae518['branches'][_0x43fc94];if(_0x3332d2?.['segmentId']&&isPendingSegmentId(_0x3332d2[_0x512cb0(0x165)])){const _0x2ffc0e=_0x59a6b6(_0x3332d2[_0x512cb0(0x165)],_0x512cb0(0x163)+_0x4983cb[_0x512cb0(0x7e)]+_0x512cb0(0xf2)+(_0x2eb62e[_0x512cb0(0x7e)]||_0x43fc94)+'\x27');_0x2ffc0e&&(_0x2eb62e[_0x512cb0(0x165)]=_0x2ffc0e);}}_0x3bfbe8[_0x512cb0(0xaf)]===_0x512cb0(0xe3)&&_0x1ae518?.[_0x512cb0(0xaf)]===_0x512cb0(0xe3)&&resolveWaitStepPendingIds(_0x3bfbe8,_0x1ae518,_0x59a6b6,_0x4983cb['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x3348c3,_0x4afb3e){const _0x12cbe0=a153_0x2377,_0x457b85=_0x3348c3();while(!![]){try{const _0x3a38bd=parseInt(_0x12cbe0(0x174))/0x1*(parseInt(_0x12cbe0(0x175))/0x2)+-parseInt(_0x12cbe0(0x16e))/0x3+-parseInt(_0x12cbe0(0x173))/0x4+parseInt(_0x12cbe0(0x166))/0x5+-parseInt(_0x12cbe0(0x172))/0x6*(parseInt(_0x12cbe0(0x16c))/0x7)+-parseInt(_0x12cbe0(0x169))/0x8*(parseInt(_0x12cbe0(0x171))/0x9)+-parseInt(_0x12cbe0(0x168))/0xa*(-parseInt(_0x12cbe0(0x16f))/0xb);if(_0x3a38bd===_0x4afb3e)break;else _0x457b85['push'](_0x457b85['shift']());}catch(_0x10b46f){_0x457b85['push'](_0x457b85['shift']());}}}(a153_0x497e,0x53edf));export function buildFolderIdToPathMap(_0x408088){const _0x2db9e2=a153_0x2377,_0xe0dddf=new Map(),_0x4163f5=new Map();for(const _0x4bb6a4 of _0x408088){_0x4163f5[_0x2db9e2(0x170)](_0x4bb6a4['id'],_0x4bb6a4);}const _0x32e537=new Set();for(const _0x329bc6 of _0x408088){!_0x329bc6[_0x2db9e2(0x16d)]&&_0x32e537[_0x2db9e2(0x167)](_0x329bc6['id']);}function _0x160786(_0x21b934){const _0x5b1f58=_0x2db9e2;if(_0xe0dddf[_0x5b1f58(0x176)](_0x21b934['id']))return _0xe0dddf[_0x5b1f58(0x16b)](_0x21b934['id']);if(_0x32e537[_0x5b1f58(0x176)](_0x21b934['id']))return _0xe0dddf[_0x5b1f58(0x170)](_0x21b934['id'],''),'';if(_0x21b934['parentFolderId']){const _0x77b61b=_0x4163f5[_0x5b1f58(0x16b)](_0x21b934[_0x5b1f58(0x16d)]);if(_0x77b61b){const _0x181b29=_0x160786(_0x77b61b),_0x5d6898=_0x181b29?_0x181b29+'/'+_0x21b934[_0x5b1f58(0x16a)]:_0x21b934[_0x5b1f58(0x16a)];return _0xe0dddf[_0x5b1f58(0x170)](_0x21b934['id'],_0x5d6898),_0x5d6898;}}const _0x63972a=_0x21b934['name'];return _0xe0dddf[_0x5b1f58(0x170)](_0x21b934['id'],_0x63972a),_0x63972a;}for(const _0x1abac6 of _0x408088){_0x160786(_0x1abac6);}return _0xe0dddf;}export function buildFolderPathToIdMap(_0x4aeee6){const _0x206a02=a153_0x2377,_0x56d8cf=new Map(),_0x1520fe=new Map();for(const _0xba4bcc of _0x4aeee6){_0x1520fe[_0x206a02(0x170)](_0xba4bcc['id'],_0xba4bcc);}const _0x571671=new Set();for(const _0x53df12 of _0x4aeee6){!_0x53df12[_0x206a02(0x16d)]&&_0x571671[_0x206a02(0x167)](_0x53df12['id']);}function _0x156a68(_0x35cef0){const _0x4c5947=_0x206a02;if(_0x571671[_0x4c5947(0x176)](_0x35cef0['id']))return'';if(_0x35cef0[_0x4c5947(0x16d)]){const _0x43c853=_0x1520fe[_0x4c5947(0x16b)](_0x35cef0[_0x4c5947(0x16d)]);if(_0x43c853){const _0x1c4b04=_0x156a68(_0x43c853);return _0x1c4b04?_0x1c4b04+'/'+_0x35cef0[_0x4c5947(0x16a)]:_0x35cef0[_0x4c5947(0x16a)];}}return _0x35cef0['name'];}for(const _0x42a224 of _0x4aeee6){const _0x1f2e3e=_0x156a68(_0x42a224);_0x56d8cf[_0x206a02(0x170)](_0x1f2e3e,_0x42a224['id']);}return _0x56d8cf;}function a153_0x497e(){const _0x43ee61=['11276397nAczME','set','140031YrQddY','542370uMDNMJ','385024HDrVYP','25TvqizG','3064yjhfpL','has','1715660ZEypOo','add','10LpYkVL','232eWxFrE','name','get','35mNdWqB','parentFolderId','190026SZdtfL'];a153_0x497e=function(){return _0x43ee61;};return a153_0x497e();}function a153_0x2377(_0x504eb6,_0x4557cb){_0x504eb6=_0x504eb6-0x166;const _0x497eb6=a153_0x497e();let _0x237776=_0x497eb6[_0x504eb6];return _0x237776;}export function buildFolderMaps(_0x23e49c){const _0x339a55=a153_0x2377,_0x22ea8d=buildFolderIdToPathMap(_0x23e49c),_0x3eec12=new Map();for(const [_0xf44e7,_0x481c8f]of _0x22ea8d){_0x3eec12[_0x339a55(0x170)](_0x481c8f,_0xf44e7);}return{'idToPath':_0x22ea8d,'pathToId':_0x3eec12};}export function getFolderPath(_0x2ffe45,_0x515060){const _0x51d708=a153_0x2377;if(!_0x2ffe45)return'';return _0x515060[_0x51d708(0x16b)](_0x2ffe45)??'';}
1
+ (function(_0x37cec8,_0x4f7b76){const _0x50551a=a153_0x5119,_0x1f5fbe=_0x37cec8();while(!![]){try{const _0x1807b7=-parseInt(_0x50551a(0xa7))/0x1+parseInt(_0x50551a(0xad))/0x2*(parseInt(_0x50551a(0xa4))/0x3)+parseInt(_0x50551a(0xa0))/0x4+-parseInt(_0x50551a(0xa6))/0x5+parseInt(_0x50551a(0xaa))/0x6+-parseInt(_0x50551a(0xae))/0x7*(parseInt(_0x50551a(0xac))/0x8)+-parseInt(_0x50551a(0xa2))/0x9;if(_0x1807b7===_0x4f7b76)break;else _0x1f5fbe['push'](_0x1f5fbe['shift']());}catch(_0x21461d){_0x1f5fbe['push'](_0x1f5fbe['shift']());}}}(a153_0x67bd,0xbb720));export function buildFolderIdToPathMap(_0x361281){const _0x1d8f51=a153_0x5119,_0x46123d=new Map(),_0x2e5217=new Map();for(const _0x4868de of _0x361281){_0x2e5217[_0x1d8f51(0xab)](_0x4868de['id'],_0x4868de);}const _0x2d6fb0=new Set();for(const _0x10b870 of _0x361281){!_0x10b870['parentFolderId']&&_0x2d6fb0[_0x1d8f51(0xa5)](_0x10b870['id']);}function _0x5e9cd9(_0x4eda99){const _0x43e881=_0x1d8f51;if(_0x46123d[_0x43e881(0xa9)](_0x4eda99['id']))return _0x46123d['get'](_0x4eda99['id']);if(_0x2d6fb0[_0x43e881(0xa9)](_0x4eda99['id']))return _0x46123d[_0x43e881(0xab)](_0x4eda99['id'],''),'';if(_0x4eda99[_0x43e881(0xa3)]){const _0x1d23f9=_0x2e5217[_0x43e881(0xa1)](_0x4eda99[_0x43e881(0xa3)]);if(_0x1d23f9){const _0x59237e=_0x5e9cd9(_0x1d23f9),_0x1117d5=_0x59237e?_0x59237e+'/'+_0x4eda99[_0x43e881(0xa8)]:_0x4eda99[_0x43e881(0xa8)];return _0x46123d[_0x43e881(0xab)](_0x4eda99['id'],_0x1117d5),_0x1117d5;}}const _0x2f10a4=_0x4eda99[_0x43e881(0xa8)];return _0x46123d[_0x43e881(0xab)](_0x4eda99['id'],_0x2f10a4),_0x2f10a4;}for(const _0x3864dc of _0x361281){_0x5e9cd9(_0x3864dc);}return _0x46123d;}export function buildFolderPathToIdMap(_0x3242b2){const _0x50df0c=a153_0x5119,_0x45409f=new Map(),_0x2f4398=new Map();for(const _0x1c5a84 of _0x3242b2){_0x2f4398['set'](_0x1c5a84['id'],_0x1c5a84);}const _0x15f7d6=new Set();for(const _0x2132f5 of _0x3242b2){!_0x2132f5[_0x50df0c(0xa3)]&&_0x15f7d6[_0x50df0c(0xa5)](_0x2132f5['id']);}function _0x1f0252(_0x6c9965){const _0x416a2a=_0x50df0c;if(_0x15f7d6[_0x416a2a(0xa9)](_0x6c9965['id']))return'';if(_0x6c9965[_0x416a2a(0xa3)]){const _0x291021=_0x2f4398['get'](_0x6c9965['parentFolderId']);if(_0x291021){const _0x221416=_0x1f0252(_0x291021);return _0x221416?_0x221416+'/'+_0x6c9965[_0x416a2a(0xa8)]:_0x6c9965[_0x416a2a(0xa8)];}}return _0x6c9965['name'];}for(const _0x43541f of _0x3242b2){const _0x23c5be=_0x1f0252(_0x43541f);_0x45409f['set'](_0x23c5be,_0x43541f['id']);}return _0x45409f;}export function buildFolderMaps(_0x1b3048){const _0x167592=buildFolderIdToPathMap(_0x1b3048),_0x385c67=new Map();for(const [_0x287857,_0x4a3c72]of _0x167592){_0x385c67['set'](_0x4a3c72,_0x287857);}return{'idToPath':_0x167592,'pathToId':_0x385c67};}function a153_0x67bd(){const _0x3e3b9d=['2289uuKyPp','5121772hzYXri','get','2642085idBBKK','parentFolderId','573OmuXpU','add','5031440SazHLC','1224342IlcXrX','name','has','6726360iqDYkU','set','3032uWLTEx','10622GaCNUV'];a153_0x67bd=function(){return _0x3e3b9d;};return a153_0x67bd();}function a153_0x5119(_0x194399,_0x5ed358){_0x194399=_0x194399-0xa0;const _0x67bd8b=a153_0x67bd();let _0x511904=_0x67bd8b[_0x194399];return _0x511904;}export function getFolderPath(_0x4cf02e,_0x5ae92d){if(!_0x4cf02e)return'';return _0x5ae92d['get'](_0x4cf02e)??'';}
@@ -1 +1 @@
1
- (function(_0x21d07b,_0x2ee0aa){const _0x4f5232=a154_0x1e54,_0x5ae7e2=_0x21d07b();while(!![]){try{const _0x2a64cd=-parseInt(_0x4f5232(0x113))/0x1+parseInt(_0x4f5232(0x110))/0x2+parseInt(_0x4f5232(0xf9))/0x3*(parseInt(_0x4f5232(0xfd))/0x4)+-parseInt(_0x4f5232(0x112))/0x5+parseInt(_0x4f5232(0xfa))/0x6+-parseInt(_0x4f5232(0x11b))/0x7*(-parseInt(_0x4f5232(0x103))/0x8)+-parseInt(_0x4f5232(0x10d))/0x9;if(_0x2a64cd===_0x2ee0aa)break;else _0x5ae7e2['push'](_0x5ae7e2['shift']());}catch(_0x450548){_0x5ae7e2['push'](_0x5ae7e2['shift']());}}}(a154_0x5030,0x3a767));import a154_0x205fab from'path';import{parse as a154_0x4baf5b}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';function a154_0x5030(){const _0xdd4128=['replace','Relative\x20path\x20cannot\x20be\x20empty','segment','split','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','1379VuXeom','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','name','resolve','trim','push','File\x20not\x20found:\x20','Cannot\x20navigate\x20above\x20root','relative','raw','Path\x20cannot\x20be\x20empty','No\x20tdx.json\x20found\x20for\x20file:\x20','journey','join','endsWith','3PfOTbt','2461158qqBJSn','parse','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','101804aiwygR','Cannot\x20split\x20empty\x20path','Path\x20segment\x20cannot\x20be\x20empty','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','tdx.json','Path\x20attempts\x20to\x20navigate\x20above\x20root','17944BblENv','readFile','slice','dirname','root','substring','startsWith','isAbsolute','parent_segment','pop','5434866YGNsGB','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','segments','769806DkOzuD','.yml','1759125hvUjUT','67256tXIdFR','length'];a154_0x5030=function(){return _0xdd4128;};return a154_0x5030();}export function parsePath(_0x36e470){const _0x1ab7bb=a154_0x1e54;if(!_0x36e470||_0x36e470['trim']()==='')throw new Error(_0x1ab7bb(0x125));const _0x5c3b4c=_0x36e470[_0x1ab7bb(0x11f)]();if(_0x5c3b4c==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x36e470};const _0x409491=_0x5c3b4c[_0x1ab7bb(0x109)]('/')?_0x5c3b4c[_0x1ab7bb(0x108)](0x1):_0x5c3b4c,_0x1fd295=_0x409491[_0x1ab7bb(0x118)]('/')['filter'](_0x20f078=>_0x20f078!=='');if(_0x1fd295['length']===0x0)throw new Error(_0x1ab7bb(0x10e));const _0x3df73e=_0x5c3b4c['startsWith']('/')||!isRelativePathSegment(_0x1fd295[0x0]);for(const _0x25b8ab of _0x1fd295){validatePathSegment(_0x25b8ab);}return{'segments':_0x1fd295,'isAbsolute':_0x3df73e,'raw':_0x36e470};}function isRelativePathSegment(_0x151dc4){return _0x151dc4==='.'||_0x151dc4==='..';}function validatePathSegment(_0x1c8f4a){const _0x238c10=a154_0x1e54;if(_0x1c8f4a==='')throw new Error(_0x238c10(0xff));if(_0x1c8f4a==='.'||_0x1c8f4a==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x1c8f4a))throw new Error(_0x238c10(0x11a)+_0x1c8f4a);if(_0x1c8f4a!==_0x1c8f4a['trim']()){}}export function validatePath(_0x24f5d0){const _0xb0d0f2=a154_0x1e54;if(_0x24f5d0[_0xb0d0f2(0x10f)][_0xb0d0f2(0x114)]===0x0&&!_0x24f5d0[_0xb0d0f2(0x10a)])throw new Error(_0xb0d0f2(0x116));if(_0x24f5d0[_0xb0d0f2(0x10a)]){if(_0x24f5d0['segments'][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0xe15a35=0x0;for(const _0x526157 of _0x24f5d0[_0xb0d0f2(0x10f)]){if(_0x526157==='..'){if(_0xe15a35===0x0)throw new Error(_0xb0d0f2(0x102));_0xe15a35--;}else _0x526157!=='.'&&_0xe15a35++;}}}export function joinPaths(_0x2d4863,_0x2bf870){const _0x3e2acc=a154_0x1e54;if(!_0x2d4863||_0x2d4863==='/')return _0x2bf870;if(!_0x2bf870||_0x2bf870==='.')return _0x2d4863;if(_0x2bf870['startsWith']('/'))return _0x2bf870;const _0x2a9fc1=parsePath(_0x2d4863),_0x32be50=parsePath(_0x2bf870),_0x420e14=[..._0x2a9fc1['segments']];for(const _0x30756c of _0x32be50['segments']){if(_0x30756c==='.')continue;else{if(_0x30756c==='..'){if(_0x420e14[_0x3e2acc(0x114)]===0x0)throw new Error(_0x3e2acc(0x122));_0x420e14['pop']();}else _0x420e14[_0x3e2acc(0x120)](_0x30756c);}}const _0xd1e7ce=_0x420e14[_0x3e2acc(0xf7)]('/');return _0x2a9fc1[_0x3e2acc(0x124)][_0x3e2acc(0x109)]('/')?'/'+_0xd1e7ce:_0xd1e7ce;}export function normalizePath(_0x317d2f){const _0x37c687=a154_0x1e54,_0x1f4498=parsePath(_0x317d2f),_0x5f598=[];for(const _0xdaff28 of _0x1f4498[_0x37c687(0x10f)]){if(_0xdaff28==='.')continue;else{if(_0xdaff28==='..'){if(_0x5f598[_0x37c687(0x114)]===0x0){if(_0x1f4498[_0x37c687(0x10a)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x5f598[_0x37c687(0x120)]('..');}else _0x5f598[_0x5f598[_0x37c687(0x114)]-0x1]==='..'?_0x5f598[_0x37c687(0x120)]('..'):_0x5f598[_0x37c687(0x10c)]();}else _0x5f598['push'](_0xdaff28);}}if(_0x5f598['length']===0x0)return _0x1f4498[_0x37c687(0x10a)]?'/':'.';const _0x2f6636=_0x5f598[_0x37c687(0xf7)]('/');return _0x1f4498[_0x37c687(0x124)]['startsWith']('/')?'/'+_0x2f6636:_0x2f6636;}export function getParentPath(_0xbd2ade){const _0x4771d9=a154_0x1e54,_0x292eaf=parsePath(_0xbd2ade);if(_0x292eaf['segments']['length']<=0x1)return'/';const _0x1f55a1=_0x292eaf[_0x4771d9(0x10f)][_0x4771d9(0x105)](0x0,-0x1)[_0x4771d9(0xf7)]('/');return _0x292eaf[_0x4771d9(0x124)][_0x4771d9(0x109)]('/')?'/'+_0x1f55a1:_0x1f55a1;}export function getBaseName(_0x2a5e87){const _0x514e66=a154_0x1e54,_0x32f344=parsePath(_0x2a5e87);return _0x32f344['segments'][_0x32f344[_0x514e66(0x10f)][_0x514e66(0x114)]-0x1]||'';}function a154_0x1e54(_0x2590b2,_0x12bf3f){_0x2590b2=_0x2590b2-0xf5;const _0x5030f1=a154_0x5030();let _0x1e5410=_0x5030f1[_0x2590b2];return _0x1e5410;}export function isChildPath(_0x527c75,_0xd89a08){const _0x57fee6=a154_0x1e54,_0x2df9bc=parsePath(_0x527c75),_0x18ec0e=parsePath(_0xd89a08);if(_0x2df9bc['segments'][_0x57fee6(0x114)]<=_0x18ec0e[_0x57fee6(0x10f)][_0x57fee6(0x114)])return![];for(let _0x539801=0x0;_0x539801<_0x18ec0e[_0x57fee6(0x10f)][_0x57fee6(0x114)];_0x539801++){if(_0x2df9bc[_0x57fee6(0x10f)][_0x539801]!==_0x18ec0e[_0x57fee6(0x10f)][_0x539801])return![];}return!![];}export function splitPath(_0x25d92a){const _0x143c96=a154_0x1e54,_0x5afc9c=parsePath(_0x25d92a);if(_0x5afc9c['segments'][_0x143c96(0x114)]===0x0)throw new Error(_0x143c96(0xfe));if(_0x5afc9c[_0x143c96(0x10f)][_0x143c96(0x114)]===0x1)return{'parent':_0x5afc9c[_0x143c96(0x10f)][0x0]};return{'parent':_0x5afc9c[_0x143c96(0x10f)][0x0],'child':_0x5afc9c[_0x143c96(0x10f)][_0x143c96(0x105)](0x1)[_0x143c96(0xf7)]('/')};}export function isYamlFilePath(_0x124fad){const _0x37cffc=a154_0x1e54;return _0x124fad[_0x37cffc(0xf8)](_0x37cffc(0x111))||_0x124fad['endsWith']('.yaml');}export async function resolveYamlFilePath(_0x994372,_0x364708=nodeFileSystem){const _0x4ae386=a154_0x1e54,_0x428bc7=a154_0x205fab[_0x4ae386(0x11e)](_0x994372);if(!await _0x364708[_0x4ae386(0x119)](_0x428bc7))throw new Error(_0x4ae386(0x121)+_0x994372);let _0x13eb2c=a154_0x205fab[_0x4ae386(0x106)](_0x428bc7),_0x407862=null,_0x550bc8=null;const _0x1c9878=a154_0x205fab[_0x4ae386(0xfb)](_0x13eb2c)[_0x4ae386(0x107)];while(_0x13eb2c!==_0x1c9878){const _0xfcf5bc=a154_0x205fab[_0x4ae386(0xf7)](_0x13eb2c,_0x4ae386(0x101));if(await _0x364708[_0x4ae386(0x119)](_0xfcf5bc)){_0x407862=_0xfcf5bc,_0x550bc8=_0x13eb2c;break;}_0x13eb2c=a154_0x205fab[_0x4ae386(0x106)](_0x13eb2c);}if(!_0x407862||!_0x550bc8)throw new Error(_0x4ae386(0xf5)+_0x994372+'\x0a'+_0x4ae386(0xfc));const _0x256c22=await _0x364708[_0x4ae386(0x104)](_0x407862),_0x1a757a=JSON[_0x4ae386(0xfb)](_0x256c22),_0x2d1d35=_0x1a757a[_0x4ae386(0x10b)];if(!_0x2d1d35)throw new Error(_0x4ae386(0x100));const _0xdcbc45=await _0x364708[_0x4ae386(0x104)](_0x428bc7),_0x568a81=a154_0x4baf5b(_0xdcbc45),_0x1162fa=_0x568a81[_0x4ae386(0x11d)];if(!_0x1162fa)throw new Error(_0x4ae386(0x11c)+_0x994372);const _0x1d9110=_0x568a81['type']===_0x4ae386(0xf6)?'journey':_0x4ae386(0x117),_0x249e4b=a154_0x205fab[_0x4ae386(0x123)](_0x550bc8,_0x428bc7),_0x3b0122=a154_0x205fab[_0x4ae386(0x106)](_0x249e4b),_0x38d5ac=_0x3b0122==='.'?'':_0x3b0122[_0x4ae386(0x115)](/\\/g,'/'),_0x10bf72=_0x38d5ac?_0x2d1d35+'/'+_0x38d5ac+'/'+_0x1162fa:_0x2d1d35+'/'+_0x1162fa;return{'parentSegment':_0x2d1d35,'segmentName':_0x1162fa,'folderPath':_0x38d5ac,'fullPath':_0x10bf72,'resourceType':_0x1d9110,'content':_0xdcbc45};}
1
+ (function(_0x1d83d7,_0x30b736){const _0x23fedc=a154_0x9b52,_0x41e407=_0x1d83d7();while(!![]){try{const _0x3ac8ca=-parseInt(_0x23fedc(0x15b))/0x1*(-parseInt(_0x23fedc(0x166))/0x2)+-parseInt(_0x23fedc(0x157))/0x3*(parseInt(_0x23fedc(0x14f))/0x4)+parseInt(_0x23fedc(0x159))/0x5*(parseInt(_0x23fedc(0x151))/0x6)+parseInt(_0x23fedc(0x16a))/0x7+parseInt(_0x23fedc(0x156))/0x8*(-parseInt(_0x23fedc(0x169))/0x9)+-parseInt(_0x23fedc(0x15e))/0xa+-parseInt(_0x23fedc(0x178))/0xb;if(_0x3ac8ca===_0x30b736)break;else _0x41e407['push'](_0x41e407['shift']());}catch(_0x567a53){_0x41e407['push'](_0x41e407['shift']());}}}(a154_0x3201,0x6b463));import a154_0x2ba3c3 from'path';import{parse as a154_0x205c1b}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x4f7e88){const _0x437485=a154_0x9b52;if(!_0x4f7e88||_0x4f7e88['trim']()==='')throw new Error(_0x437485(0x172));const _0x3a3df3=_0x4f7e88[_0x437485(0x16f)]();if(_0x3a3df3==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x4f7e88};const _0x674a4c=_0x3a3df3[_0x437485(0x14c)]('/')?_0x3a3df3['substring'](0x1):_0x3a3df3,_0x5ceeeb=_0x674a4c[_0x437485(0x167)]('/')[_0x437485(0x154)](_0x4e4670=>_0x4e4670!=='');if(_0x5ceeeb[_0x437485(0x164)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x577876=_0x3a3df3[_0x437485(0x14c)]('/')||!isRelativePathSegment(_0x5ceeeb[0x0]);for(const _0x1c05a2 of _0x5ceeeb){validatePathSegment(_0x1c05a2);}return{'segments':_0x5ceeeb,'isAbsolute':_0x577876,'raw':_0x4f7e88};}function isRelativePathSegment(_0x49c5d3){return _0x49c5d3==='.'||_0x49c5d3==='..';}function validatePathSegment(_0xd0b4fc){const _0x3100a9=a154_0x9b52;if(_0xd0b4fc==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0xd0b4fc==='.'||_0xd0b4fc==='..')return;if(/[\x00-\x1F\x7F]/[_0x3100a9(0x168)](_0xd0b4fc))throw new Error(_0x3100a9(0x174)+_0xd0b4fc);if(_0xd0b4fc!==_0xd0b4fc[_0x3100a9(0x16f)]()){}}export function validatePath(_0x4cfc57){const _0x5ec7bb=a154_0x9b52;if(_0x4cfc57[_0x5ec7bb(0x175)]['length']===0x0&&!_0x4cfc57[_0x5ec7bb(0x153)])throw new Error(_0x5ec7bb(0x177));if(_0x4cfc57[_0x5ec7bb(0x153)]){if(_0x4cfc57[_0x5ec7bb(0x175)][0x0]==='..')throw new Error(_0x5ec7bb(0x179));let _0x9fd2a9=0x0;for(const _0x1bd11b of _0x4cfc57[_0x5ec7bb(0x175)]){if(_0x1bd11b==='..'){if(_0x9fd2a9===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x9fd2a9--;}else _0x1bd11b!=='.'&&_0x9fd2a9++;}}}export function joinPaths(_0x124706,_0x20b1bf){const _0x4b61a4=a154_0x9b52;if(!_0x124706||_0x124706==='/')return _0x20b1bf;if(!_0x20b1bf||_0x20b1bf==='.')return _0x124706;if(_0x20b1bf['startsWith']('/'))return _0x20b1bf;const _0xd2b73f=parsePath(_0x124706),_0xbc8dfa=parsePath(_0x20b1bf),_0x823be9=[..._0xd2b73f[_0x4b61a4(0x175)]];for(const _0x3ef57 of _0xbc8dfa[_0x4b61a4(0x175)]){if(_0x3ef57==='.')continue;else{if(_0x3ef57==='..'){if(_0x823be9[_0x4b61a4(0x164)]===0x0)throw new Error(_0x4b61a4(0x155));_0x823be9[_0x4b61a4(0x15c)]();}else _0x823be9[_0x4b61a4(0x176)](_0x3ef57);}}const _0x115c68=_0x823be9[_0x4b61a4(0x16b)]('/');return _0xd2b73f[_0x4b61a4(0x171)]['startsWith']('/')?'/'+_0x115c68:_0x115c68;}export function normalizePath(_0x4e18d3){const _0x3c11d7=a154_0x9b52,_0x3c8bd9=parsePath(_0x4e18d3),_0x1dd760=[];for(const _0x459dfa of _0x3c8bd9[_0x3c11d7(0x175)]){if(_0x459dfa==='.')continue;else{if(_0x459dfa==='..'){if(_0x1dd760['length']===0x0){if(_0x3c8bd9[_0x3c11d7(0x153)])throw new Error(_0x3c11d7(0x155));_0x1dd760[_0x3c11d7(0x176)]('..');}else _0x1dd760[_0x1dd760[_0x3c11d7(0x164)]-0x1]==='..'?_0x1dd760[_0x3c11d7(0x176)]('..'):_0x1dd760[_0x3c11d7(0x15c)]();}else _0x1dd760[_0x3c11d7(0x176)](_0x459dfa);}}if(_0x1dd760[_0x3c11d7(0x164)]===0x0)return _0x3c8bd9[_0x3c11d7(0x153)]?'/':'.';const _0x37c4b4=_0x1dd760[_0x3c11d7(0x16b)]('/');return _0x3c8bd9[_0x3c11d7(0x171)][_0x3c11d7(0x14c)]('/')?'/'+_0x37c4b4:_0x37c4b4;}export function getParentPath(_0x3793c7){const _0x1856c6=a154_0x9b52,_0x7e8453=parsePath(_0x3793c7);if(_0x7e8453[_0x1856c6(0x175)]['length']<=0x1)return'/';const _0x520351=_0x7e8453[_0x1856c6(0x175)][_0x1856c6(0x163)](0x0,-0x1)['join']('/');return _0x7e8453[_0x1856c6(0x171)]['startsWith']('/')?'/'+_0x520351:_0x520351;}export function getBaseName(_0x217d55){const _0x54a9a0=a154_0x9b52,_0x38d53e=parsePath(_0x217d55);return _0x38d53e[_0x54a9a0(0x175)][_0x38d53e[_0x54a9a0(0x175)][_0x54a9a0(0x164)]-0x1]||'';}export function isChildPath(_0x1c0f32,_0x2c8bb1){const _0x547be7=a154_0x9b52,_0x1227cd=parsePath(_0x1c0f32),_0xa2aff6=parsePath(_0x2c8bb1);if(_0x1227cd[_0x547be7(0x175)][_0x547be7(0x164)]<=_0xa2aff6[_0x547be7(0x175)][_0x547be7(0x164)])return![];for(let _0x4fc108=0x0;_0x4fc108<_0xa2aff6[_0x547be7(0x175)][_0x547be7(0x164)];_0x4fc108++){if(_0x1227cd[_0x547be7(0x175)][_0x4fc108]!==_0xa2aff6[_0x547be7(0x175)][_0x4fc108])return![];}return!![];}function a154_0x9b52(_0x187d94,_0x53d0b1){_0x187d94=_0x187d94-0x14c;const _0x320174=a154_0x3201();let _0x9b526=_0x320174[_0x187d94];return _0x9b526;}export function splitPath(_0x4d6301){const _0x5240ea=a154_0x9b52,_0x2f4b6b=parsePath(_0x4d6301);if(_0x2f4b6b[_0x5240ea(0x175)]['length']===0x0)throw new Error(_0x5240ea(0x16e));if(_0x2f4b6b[_0x5240ea(0x175)][_0x5240ea(0x164)]===0x1)return{'parent':_0x2f4b6b[_0x5240ea(0x175)][0x0]};return{'parent':_0x2f4b6b[_0x5240ea(0x175)][0x0],'child':_0x2f4b6b['segments'][_0x5240ea(0x163)](0x1)[_0x5240ea(0x16b)]('/')};}export function isYamlFilePath(_0x4fdf73){const _0x43ec75=a154_0x9b52;return _0x4fdf73[_0x43ec75(0x158)](_0x43ec75(0x170))||_0x4fdf73[_0x43ec75(0x158)](_0x43ec75(0x17a));}function a154_0x3201(){const _0x5003db=['6wnPoIC','split','test','199962XTyFMV','4479559gQGRIn','join','journey','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Cannot\x20split\x20empty\x20path','trim','.yml','raw','Path\x20cannot\x20be\x20empty','segment','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','segments','push','Relative\x20path\x20cannot\x20be\x20empty','7459452jyWAyd','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','.yaml','type','startsWith','exists','relative','16opMZNL','readFile','4837062OqyhGE','File\x20not\x20found:\x20','isAbsolute','filter','Cannot\x20navigate\x20above\x20root','24EfznUl','292761VcoGzy','endsWith','5xxEEMo','resolve','282875dZUvxS','pop','No\x20tdx.json\x20found\x20for\x20file:\x20','7202100LmYybX','parent_segment','name','parse','root','slice','length','dirname'];a154_0x3201=function(){return _0x5003db;};return a154_0x3201();}export async function resolveYamlFilePath(_0x3f07b3,_0x11b167=nodeFileSystem){const _0x16e312=a154_0x9b52,_0x2840f6=a154_0x2ba3c3[_0x16e312(0x15a)](_0x3f07b3);if(!await _0x11b167[_0x16e312(0x14d)](_0x2840f6))throw new Error(_0x16e312(0x152)+_0x3f07b3);let _0x12c2b7=a154_0x2ba3c3['dirname'](_0x2840f6),_0x4645f8=null,_0x4f1e4a=null;const _0x2d8e5c=a154_0x2ba3c3[_0x16e312(0x161)](_0x12c2b7)[_0x16e312(0x162)];while(_0x12c2b7!==_0x2d8e5c){const _0x2fdad6=a154_0x2ba3c3[_0x16e312(0x16b)](_0x12c2b7,'tdx.json');if(await _0x11b167[_0x16e312(0x14d)](_0x2fdad6)){_0x4645f8=_0x2fdad6,_0x4f1e4a=_0x12c2b7;break;}_0x12c2b7=a154_0x2ba3c3['dirname'](_0x12c2b7);}if(!_0x4645f8||!_0x4f1e4a)throw new Error(_0x16e312(0x15d)+_0x3f07b3+'\x0a'+_0x16e312(0x16d));const _0x2cb178=await _0x11b167[_0x16e312(0x150)](_0x4645f8),_0x3f49d8=JSON['parse'](_0x2cb178),_0x99ef95=_0x3f49d8[_0x16e312(0x15f)];if(!_0x99ef95)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x4bf02a=await _0x11b167[_0x16e312(0x150)](_0x2840f6),_0x4d7bed=a154_0x205c1b(_0x4bf02a),_0x4de7de=_0x4d7bed[_0x16e312(0x160)];if(!_0x4de7de)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x3f07b3);const _0x1bd320=_0x4d7bed[_0x16e312(0x17b)]===_0x16e312(0x16c)?_0x16e312(0x16c):_0x16e312(0x173),_0x1aeeed=a154_0x2ba3c3[_0x16e312(0x14e)](_0x4f1e4a,_0x2840f6),_0x21016b=a154_0x2ba3c3[_0x16e312(0x165)](_0x1aeeed),_0x238d57=_0x21016b==='.'?'':_0x21016b['replace'](/\\/g,'/'),_0x45e796=_0x238d57?_0x99ef95+'/'+_0x238d57+'/'+_0x4de7de:_0x99ef95+'/'+_0x4de7de;return{'parentSegment':_0x99ef95,'segmentName':_0x4de7de,'folderPath':_0x238d57,'fullPath':_0x45e796,'resourceType':_0x1bd320,'content':_0x4bf02a};}
@@ -1 +1 @@
1
- function a155_0x3866(_0x49787f,_0xe368fc){_0x49787f=_0x49787f-0x16b;const _0x17a8e4=a155_0x17a8();let _0x3866e1=_0x17a8e4[_0x49787f];return _0x3866e1;}(function(_0x5c9d45,_0x460e26){const _0x202b75=a155_0x3866,_0x42680f=_0x5c9d45();while(!![]){try{const _0x1736c9=parseInt(_0x202b75(0x16d))/0x1+-parseInt(_0x202b75(0x171))/0x2*(parseInt(_0x202b75(0x175))/0x3)+parseInt(_0x202b75(0x173))/0x4+-parseInt(_0x202b75(0x16b))/0x5*(-parseInt(_0x202b75(0x172))/0x6)+parseInt(_0x202b75(0x16e))/0x7+parseInt(_0x202b75(0x16c))/0x8+-parseInt(_0x202b75(0x176))/0x9;if(_0x1736c9===_0x460e26)break;else _0x42680f['push'](_0x42680f['shift']());}catch(_0x3f1485){_0x42680f['push'](_0x42680f['shift']());}}}(a155_0x17a8,0x40d1f));export function parseSegmentRef(_0x4cec25){const _0x3aa231=a155_0x3866,_0x46a711=_0x4cec25['indexOf']('/');if(_0x46a711===-0x1)return{'parentId':_0x4cec25};if(_0x46a711===0x0)throw new Error(_0x3aa231(0x16f)+_0x4cec25+_0x3aa231(0x170));const _0x5d87e2=_0x4cec25[_0x3aa231(0x174)](0x0,_0x46a711),_0x1a3465=_0x4cec25[_0x3aa231(0x174)](_0x46a711+0x1);if(_0x1a3465==='')throw new Error(_0x3aa231(0x16f)+_0x4cec25+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x5d87e2,'childId':_0x1a3465};}function a155_0x17a8(){const _0x152a28=['54005YcSjUY','1050752QAXiEy','226890swGYHv','2317833xbgTDr','Invalid\x20segment\x20reference\x20format:\x20','.\x20Parent\x20name\x20cannot\x20be\x20empty','4NFjAjb','6pOiFBr','2110116dWQCzb','substring','653241ezrkek','4740174LtZtti'];a155_0x17a8=function(){return _0x152a28;};return a155_0x17a8();}
1
+ (function(_0x55286e,_0x456df5){const _0x47094f=a155_0x46f2,_0x580afb=_0x55286e();while(!![]){try{const _0x227103=parseInt(_0x47094f(0x1e3))/0x1+parseInt(_0x47094f(0x1e6))/0x2+-parseInt(_0x47094f(0x1ea))/0x3+parseInt(_0x47094f(0x1e7))/0x4+parseInt(_0x47094f(0x1ed))/0x5+parseInt(_0x47094f(0x1e9))/0x6+parseInt(_0x47094f(0x1eb))/0x7*(-parseInt(_0x47094f(0x1ec))/0x8);if(_0x227103===_0x456df5)break;else _0x580afb['push'](_0x580afb['shift']());}catch(_0x4ae422){_0x580afb['push'](_0x580afb['shift']());}}}(a155_0x26eb,0x892e4));export function parseSegmentRef(_0x4b37cd){const _0x304a54=a155_0x46f2,_0x5644f4=_0x4b37cd[_0x304a54(0x1e8)]('/');if(_0x5644f4===-0x1)return{'parentId':_0x4b37cd};if(_0x5644f4===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x4b37cd+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0xec35df=_0x4b37cd['substring'](0x0,_0x5644f4),_0x5c6b50=_0x4b37cd[_0x304a54(0x1ee)](_0x5644f4+0x1);if(_0x5c6b50==='')throw new Error(_0x304a54(0x1e4)+_0x4b37cd+_0x304a54(0x1e5));return{'parentId':_0xec35df,'childId':_0x5c6b50};}function a155_0x46f2(_0xac936e,_0x2f1b8c){_0xac936e=_0xac936e-0x1e3;const _0x26eb01=a155_0x26eb();let _0x46f233=_0x26eb01[_0xac936e];return _0x46f233;}function a155_0x26eb(){const _0x1c0e59=['2855934sEEPpb','1488435yeYrmg','3314052HuJAUR','40nlSKBV','3726685kHXFtI','substring','1119631HSjwKh','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','1442530uTQLdS','1451980bXKjbW','indexOf'];a155_0x26eb=function(){return _0x1c0e59;};return a155_0x26eb();}
@@ -1 +1 @@
1
- (function(_0x213de1,_0x2f7a52){const _0x307c01=a156_0x210f,_0x4240de=_0x213de1();while(!![]){try{const _0x5c038f=parseInt(_0x307c01(0x139))/0x1*(parseInt(_0x307c01(0x112))/0x2)+-parseInt(_0x307c01(0x11e))/0x3*(parseInt(_0x307c01(0x10d))/0x4)+parseInt(_0x307c01(0x12b))/0x5*(parseInt(_0x307c01(0x11f))/0x6)+parseInt(_0x307c01(0x10f))/0x7*(parseInt(_0x307c01(0x12f))/0x8)+-parseInt(_0x307c01(0x130))/0x9*(parseInt(_0x307c01(0x11b))/0xa)+parseInt(_0x307c01(0x148))/0xb*(parseInt(_0x307c01(0x10c))/0xc)+parseInt(_0x307c01(0x106))/0xd;if(_0x5c038f===_0x2f7a52)break;else _0x4240de['push'](_0x4240de['shift']());}catch(_0x33f75f){_0x4240de['push'](_0x4240de['shift']());}}}(a156_0x2eba,0x36c84));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x50bae8,_0x53f1e7={},_0x48eac7={}){const _0x800f9f=a156_0x210f;if(_0x48eac7['skipSchema'])return runSemanticChecks(_0x50bae8,_0x53f1e7);const _0x5b70cb=SegmentDefSchema['safeParse'](_0x50bae8);if(_0x5b70cb[_0x800f9f(0x135)])return runSemanticChecks(_0x5b70cb[_0x800f9f(0x138)],_0x53f1e7);return zodErrorsToValidationResult(_0x5b70cb[_0x800f9f(0x11c)],_0x53f1e7);}export function validateRuleDef(_0x2542e1,_0x16d72f,_0x20c125){const _0x351841=a156_0x210f;if(!_0x2542e1)return[];const _0x193009=RuleDefSchema['safeParse'](_0x2542e1);if(_0x193009[_0x351841(0x135)])return checkRule(_0x193009['data'],_0x16d72f,_0x20c125);const _0x40709d=flattenZodIssues(_0x193009[_0x351841(0x11c)]['issues']);return _0x40709d[_0x351841(0x136)](_0x2dfdd4=>{const _0x503974=_0x351841,_0x165267=formatZodPath(_0x2dfdd4[_0x503974(0x108)]),_0x284359=_0x165267?_0x16d72f+'.'+_0x165267:_0x16d72f,_0x1e09e9=mapZodIssueToCode(_0x2dfdd4,_0x165267),_0x444d40=getLocationFromPath(_0x20c125['document'],_0x20c125[_0x503974(0x140)],pathToArray(_0x284359));return{'level':'error','path':_0x284359,'code':_0x1e09e9,'message':_0x2dfdd4[_0x503974(0x11d)],..._0x444d40&&{'location':_0x444d40}};});}function a156_0x2eba(){const _0x4aff13=['BEHAVIOR_SOURCE_WITH_ATTRIBUTE','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','attribute','1220990wFPHBQ','error','message','4104noTTBO','2334pBHEIg','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','level','Behavior\x20source\x20\x27','MISSING_BETWEEN_BOUNDS','.conditions','.conditions[','And','EMPTY_CONDITIONS','filter','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','835OoYGEM','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','push','INVALID_OPERATOR_TYPE','104QsMYSK','27KnYPno','INVALID_ARRAY_MATCHING','.segment','document','\x27\x20with\x20attribute\x20\x27','success','map','rule.type','data','113395zKPjVR','.attribute','type','validationCode','params','.source','conditions','source','code','MISSING_TIME_UNIT','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','MISSING_SEGMENT_REFERENCE','arrayMatching','.operator.type','68497aXSqEE','name','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','.type','length','Attribute\x20name\x20cannot\x20be\x20empty','415454uJtOcg','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','path','Behavior','BEHAVIOR_SOURCE_MISSING_FILTER','MISSING_OPERATOR_VALUE','216epaxNV','32CSkOfD','description','150353jTTkwH','warning','match','2XDuDxY','custom','MISSING_NAME','rule','aggregation','endsWith'];a156_0x2eba=function(){return _0x4aff13;};return a156_0x2eba();}function zodErrorsToValidationResult(_0x3775fe,_0x835612){const _0x1b3fe2=a156_0x210f,_0x5be653=flattenZodIssues(_0x3775fe['issues']),_0x1d51e9=_0x5be653[_0x1b3fe2(0x136)](_0x35563a=>{const _0x31c28f=_0x1b3fe2,_0x36fb75=formatZodPath(_0x35563a[_0x31c28f(0x108)]),_0x4fa5a2=mapZodIssueToCode(_0x35563a,_0x36fb75),_0x15f77c=getLocationFromPath(_0x835612[_0x31c28f(0x133)],_0x835612[_0x31c28f(0x140)],_0x35563a[_0x31c28f(0x108)][_0x31c28f(0x136)](_0x4a7069=>typeof _0x4a7069==='symbol'?String(_0x4a7069):_0x4a7069));return{'level':_0x31c28f(0x11c),'path':_0x36fb75,'code':_0x4fa5a2,'message':_0x35563a[_0x31c28f(0x11d)],..._0x15f77c&&{'location':_0x15f77c}};});return{'valid':![],'errors':_0x1d51e9,'warnings':[]};}function mapZodIssueToCode(_0x2f97ce,_0x2af28f){const _0x32e9eb=a156_0x210f,_0x45f522=_0x2f97ce[_0x32e9eb(0x141)]===_0x32e9eb(0x113)?_0x2f97ce[_0x32e9eb(0x13d)]:undefined;if(_0x2af28f===_0x32e9eb(0x149))return _0x32e9eb(0x114);if(_0x2af28f===_0x32e9eb(0x137)||_0x2af28f[_0x32e9eb(0x117)](_0x32e9eb(0x103))){if(_0x2f97ce['code']==='invalid_value'){if(_0x2af28f===_0x32e9eb(0x137)||_0x2af28f[_0x32e9eb(0x111)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x2af28f[_0x32e9eb(0x117)](_0x32e9eb(0x147)))return _0x32e9eb(0x12e);if(_0x2af28f['endsWith']('.operator.value'))return _0x32e9eb(0x10b);if(_0x45f522?.[_0x32e9eb(0x13c)]==='MISSING_BETWEEN_BOUNDS')return _0x32e9eb(0x123);if(_0x45f522?.[_0x32e9eb(0x13c)]===_0x32e9eb(0x142))return _0x32e9eb(0x142);if(_0x2af28f[_0x32e9eb(0x117)](_0x32e9eb(0x124))||_0x2af28f===_0x32e9eb(0x13f))return'MISSING_CONDITIONS';if(_0x2af28f['includes'](_0x32e9eb(0x146)))return _0x32e9eb(0x131);if(_0x2af28f[_0x32e9eb(0x117)](_0x32e9eb(0x132)))return _0x32e9eb(0x145);return'SEGMENT_SCHEMA_ERROR';}function a156_0x210f(_0x3451cf,_0x3d594a){_0x3451cf=_0x3451cf-0x102;const _0x2eba14=a156_0x2eba();let _0x210fa5=_0x2eba14[_0x3451cf];return _0x210fa5;}function runSemanticChecks(_0x2c7d9f,_0x4c734b){const _0x2e2cde=a156_0x210f,_0x1ab90e=[];_0x2c7d9f[_0x2e2cde(0x115)]&&_0x1ab90e[_0x2e2cde(0x12d)](...checkRule(_0x2c7d9f[_0x2e2cde(0x115)],_0x2e2cde(0x115),_0x4c734b));const _0x4fe0ed=_0x1ab90e[_0x2e2cde(0x128)](_0x506cc7=>_0x506cc7[_0x2e2cde(0x121)]===_0x2e2cde(0x11c)),_0xbb35b=_0x1ab90e['filter'](_0x158921=>_0x158921[_0x2e2cde(0x121)]==='warning');return{'valid':_0x4fe0ed['length']===0x0,'errors':_0x4fe0ed,'warnings':_0xbb35b};}function checkRule(_0x4bb9e9,_0x35eafc,_0x769c16){const _0x57b95e=a156_0x210f,_0x6f4342=[];if(_0x4bb9e9['conditions'][_0x57b95e(0x104)]===0x0)return _0x6f4342['push']({'level':_0x57b95e(0x11c),'path':_0x35eafc+_0x57b95e(0x124),'code':_0x57b95e(0x127),'message':_0x57b95e(0x120),'location':getLocationFromPath(_0x769c16['document'],_0x769c16[_0x57b95e(0x140)],pathToArray(_0x35eafc+_0x57b95e(0x124)))}),_0x6f4342;return _0x6f4342['push'](...checkConditions(_0x4bb9e9[_0x57b95e(0x13f)],_0x35eafc,_0x769c16)),_0x6f4342;}function checkConditions(_0x2bf6b8,_0x3bcca4,_0x2cbf35){const _0x522d71=a156_0x210f,_0xdaa1f6=[];for(let _0x58c43b=0x0;_0x58c43b<_0x2bf6b8['length'];_0x58c43b++){const _0x3c2ebd=_0x2bf6b8[_0x58c43b],_0x2a7b8d=_0x3bcca4+_0x522d71(0x125)+_0x58c43b+']';_0xdaa1f6[_0x522d71(0x12d)](...checkCondition(_0x3c2ebd,_0x2a7b8d,_0x2cbf35));}return _0xdaa1f6;}function checkCondition(_0x12ef33,_0x4e17dd,_0x16be01){const _0x4375d1=a156_0x210f,_0x3ae25d=[];if(_0x12ef33['type']===_0x4375d1(0x126)||_0x12ef33[_0x4375d1(0x13b)]==='Or'){if(_0x12ef33[_0x4375d1(0x13f)]['length']===0x0)_0x3ae25d[_0x4375d1(0x12d)]({'level':_0x4375d1(0x11c),'path':_0x4e17dd+_0x4375d1(0x124),'code':'EMPTY_CONDITIONS','message':_0x12ef33[_0x4375d1(0x13b)]+_0x4375d1(0x129),'location':getLocationFromPath(_0x16be01['document'],_0x16be01[_0x4375d1(0x140)],pathToArray(_0x4e17dd+_0x4375d1(0x124)))});else{const _0xe46cf8=_0x12ef33[_0x4375d1(0x10e)]!==undefined;!_0xe46cf8&&_0x3ae25d[_0x4375d1(0x12d)]({'level':'warning','path':_0x4e17dd,'code':'NESTED_CONDITION_GROUP','message':_0x12ef33[_0x4375d1(0x13b)]+_0x4375d1(0x102)+_0x4375d1(0x143)+_0x4375d1(0x119),'location':getLocationFromPath(_0x16be01[_0x4375d1(0x133)],_0x16be01[_0x4375d1(0x140)],pathToArray(_0x4e17dd))}),_0x3ae25d[_0x4375d1(0x12d)](...checkConditions(_0x12ef33[_0x4375d1(0x13f)],_0x4e17dd,_0x16be01));}return _0x3ae25d;}if(_0x12ef33[_0x4375d1(0x13b)]==='Value'||_0x12ef33['type']===_0x4375d1(0x109)){const _0x27d1f3=_0x12ef33,_0x55b1f8=_0x27d1f3[_0x4375d1(0x140)],_0x52e081=_0x27d1f3[_0x4375d1(0x116)],_0x407de8=_0x55b1f8||_0x52e081;(!_0x27d1f3[_0x4375d1(0x11a)]||_0x27d1f3[_0x4375d1(0x11a)]==='')&&(!_0x407de8&&_0x3ae25d[_0x4375d1(0x12d)]({'level':_0x4375d1(0x11c),'path':_0x4e17dd+'.attribute','code':'EMPTY_ATTRIBUTE','message':_0x4375d1(0x105),'location':getLocationFromPath(_0x16be01[_0x4375d1(0x133)],_0x16be01[_0x4375d1(0x140)],pathToArray(_0x4e17dd+_0x4375d1(0x13a)))}));_0x27d1f3[_0x4375d1(0x128)]&&_0x3ae25d['push'](...checkRule(_0x27d1f3['filter'],_0x4e17dd+'.filter',_0x16be01));if(_0x27d1f3[_0x4375d1(0x140)]){const _0x429c2f=_0x27d1f3[_0x4375d1(0x11a)]&&_0x27d1f3[_0x4375d1(0x11a)]!=='';_0x429c2f&&!_0x27d1f3[_0x4375d1(0x128)]&&_0x3ae25d[_0x4375d1(0x12d)]({'level':_0x4375d1(0x11c),'path':_0x4e17dd+_0x4375d1(0x13e),'code':_0x4375d1(0x10a),'message':_0x4375d1(0x122)+_0x27d1f3[_0x4375d1(0x140)]+_0x4375d1(0x134)+_0x27d1f3[_0x4375d1(0x11a)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x4375d1(0x12a)+_0x4375d1(0x144),'location':getLocationFromPath(_0x16be01[_0x4375d1(0x133)],_0x16be01[_0x4375d1(0x140)],pathToArray(_0x4e17dd+_0x4375d1(0x13e)))}),_0x429c2f&&_0x27d1f3['filter']&&_0x3ae25d[_0x4375d1(0x12d)]({'level':_0x4375d1(0x110),'path':_0x4e17dd+'.attribute','code':_0x4375d1(0x118),'message':'Attribute\x20\x27'+_0x27d1f3[_0x4375d1(0x11a)]+_0x4375d1(0x12c)+_0x4375d1(0x107),'location':getLocationFromPath(_0x16be01[_0x4375d1(0x133)],_0x16be01[_0x4375d1(0x140)],pathToArray(_0x4e17dd+_0x4375d1(0x13a)))});}}return _0x3ae25d;}
1
+ (function(_0x14e050,_0x177419){const _0x5f2a46=a156_0x287a,_0x21fa1f=_0x14e050();while(!![]){try{const _0xf469a9=parseInt(_0x5f2a46(0x152))/0x1*(-parseInt(_0x5f2a46(0x116))/0x2)+parseInt(_0x5f2a46(0x11c))/0x3*(parseInt(_0x5f2a46(0x141))/0x4)+-parseInt(_0x5f2a46(0x136))/0x5*(parseInt(_0x5f2a46(0x11d))/0x6)+parseInt(_0x5f2a46(0x151))/0x7*(-parseInt(_0x5f2a46(0x112))/0x8)+parseInt(_0x5f2a46(0x111))/0x9*(-parseInt(_0x5f2a46(0x139))/0xa)+parseInt(_0x5f2a46(0x15b))/0xb+parseInt(_0x5f2a46(0x114))/0xc*(parseInt(_0x5f2a46(0x145))/0xd);if(_0xf469a9===_0x177419)break;else _0x21fa1f['push'](_0x21fa1f['shift']());}catch(_0x1ee353){_0x21fa1f['push'](_0x21fa1f['shift']());}}}(a156_0x3aeb,0x466a3));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';function a156_0x287a(_0x1ff60c,_0x3168ac){_0x1ff60c=_0x1ff60c-0x110;const _0x3aebce=a156_0x3aeb();let _0x287aeb=_0x3aebce[_0x1ff60c];return _0x287aeb;}export function validateSegmentDef(_0x5bca80,_0x12a083={},_0x2615bf={}){const _0x31836f=a156_0x287a;if(_0x2615bf[_0x31836f(0x14e)])return runSemanticChecks(_0x5bca80,_0x12a083);const _0x1a3879=SegmentDefSchema[_0x31836f(0x13c)](_0x5bca80);if(_0x1a3879[_0x31836f(0x150)])return runSemanticChecks(_0x1a3879['data'],_0x12a083);return zodErrorsToValidationResult(_0x1a3879['error'],_0x12a083);}export function validateRuleDef(_0x202999,_0x523813,_0x49be3e){const _0x73d37f=a156_0x287a;if(!_0x202999)return[];const _0x23e24e=RuleDefSchema[_0x73d37f(0x13c)](_0x202999);if(_0x23e24e[_0x73d37f(0x150)])return checkRule(_0x23e24e['data'],_0x523813,_0x49be3e);const _0x52533=flattenZodIssues(_0x23e24e[_0x73d37f(0x143)][_0x73d37f(0x158)]);return _0x52533[_0x73d37f(0x120)](_0x4016cf=>{const _0x1bbac8=_0x73d37f,_0x19f394=formatZodPath(_0x4016cf['path']),_0x5251cf=_0x19f394?_0x523813+'.'+_0x19f394:_0x523813,_0x21ec7e=mapZodIssueToCode(_0x4016cf,_0x19f394),_0x35bf8d=getLocationFromPath(_0x49be3e[_0x1bbac8(0x119)],_0x49be3e[_0x1bbac8(0x11a)],pathToArray(_0x5251cf));return{'level':_0x1bbac8(0x143),'path':_0x5251cf,'code':_0x21ec7e,'message':_0x4016cf['message'],..._0x35bf8d&&{'location':_0x35bf8d}};});}function zodErrorsToValidationResult(_0x1a1981,_0x7f4e41){const _0x4572d0=a156_0x287a,_0x27ab5f=flattenZodIssues(_0x1a1981[_0x4572d0(0x158)]),_0xbfde2e=_0x27ab5f[_0x4572d0(0x120)](_0x27102b=>{const _0x15fc9f=_0x4572d0,_0xd63b2e=formatZodPath(_0x27102b[_0x15fc9f(0x125)]),_0x40618d=mapZodIssueToCode(_0x27102b,_0xd63b2e),_0x517a6f=getLocationFromPath(_0x7f4e41['document'],_0x7f4e41['source'],_0x27102b[_0x15fc9f(0x125)][_0x15fc9f(0x120)](_0x32d315=>typeof _0x32d315===_0x15fc9f(0x12e)?String(_0x32d315):_0x32d315));return{'level':_0x15fc9f(0x143),'path':_0xd63b2e,'code':_0x40618d,'message':_0x27102b[_0x15fc9f(0x126)],..._0x517a6f&&{'location':_0x517a6f}};});return{'valid':![],'errors':_0xbfde2e,'warnings':[]};}function mapZodIssueToCode(_0x58d004,_0x4d0fd2){const _0x23c382=a156_0x287a,_0x5d425b=_0x58d004['code']===_0x23c382(0x127)?_0x58d004[_0x23c382(0x110)]:undefined;if(_0x4d0fd2===_0x23c382(0x157))return _0x23c382(0x147);if(_0x4d0fd2==='rule.type'||_0x4d0fd2['endsWith']('.type')){if(_0x58d004['code']===_0x23c382(0x142)){if(_0x4d0fd2===_0x23c382(0x149)||_0x4d0fd2[_0x23c382(0x129)](/\.conditions\[\d+\]\.type$/))return _0x23c382(0x133);}}if(_0x4d0fd2[_0x23c382(0x14a)]('.operator.type'))return _0x23c382(0x137);if(_0x4d0fd2[_0x23c382(0x14a)](_0x23c382(0x124)))return _0x23c382(0x140);if(_0x5d425b?.[_0x23c382(0x128)]===_0x23c382(0x148))return _0x23c382(0x148);if(_0x5d425b?.['validationCode']===_0x23c382(0x12f))return _0x23c382(0x12f);if(_0x4d0fd2[_0x23c382(0x14a)](_0x23c382(0x146))||_0x4d0fd2==='conditions')return _0x23c382(0x135);if(_0x4d0fd2['includes'](_0x23c382(0x154)))return _0x23c382(0x117);if(_0x4d0fd2[_0x23c382(0x14a)](_0x23c382(0x11f)))return _0x23c382(0x134);return _0x23c382(0x12b);}function runSemanticChecks(_0x230df1,_0x3b1134){const _0x499dab=a156_0x287a,_0x1a3fe6=[];_0x230df1[_0x499dab(0x115)]&&_0x1a3fe6[_0x499dab(0x122)](...checkRule(_0x230df1[_0x499dab(0x115)],_0x499dab(0x115),_0x3b1134));const _0x8c49b5=_0x1a3fe6[_0x499dab(0x13e)](_0x2fb44b=>_0x2fb44b[_0x499dab(0x12d)]===_0x499dab(0x143)),_0x52731e=_0x1a3fe6['filter'](_0x7b4655=>_0x7b4655[_0x499dab(0x12d)]===_0x499dab(0x153));return{'valid':_0x8c49b5[_0x499dab(0x131)]===0x0,'errors':_0x8c49b5,'warnings':_0x52731e};}function checkRule(_0x1c7571,_0x55f08c,_0x46020d){const _0x4a08a4=a156_0x287a,_0x58a8f0=[];if(_0x1c7571[_0x4a08a4(0x11b)][_0x4a08a4(0x131)]===0x0)return _0x58a8f0[_0x4a08a4(0x122)]({'level':_0x4a08a4(0x143),'path':_0x55f08c+'.conditions','code':_0x4a08a4(0x13f),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x46020d[_0x4a08a4(0x119)],_0x46020d[_0x4a08a4(0x11a)],pathToArray(_0x55f08c+_0x4a08a4(0x146)))}),_0x58a8f0;return _0x58a8f0[_0x4a08a4(0x122)](...checkConditions(_0x1c7571[_0x4a08a4(0x11b)],_0x55f08c,_0x46020d)),_0x58a8f0;}function checkConditions(_0x7bee02,_0x33aad1,_0x1c60df){const _0x52fcfb=a156_0x287a,_0x123847=[];for(let _0x55c381=0x0;_0x55c381<_0x7bee02[_0x52fcfb(0x131)];_0x55c381++){const _0x8a140b=_0x7bee02[_0x55c381],_0x3355e0=_0x33aad1+_0x52fcfb(0x15c)+_0x55c381+']';_0x123847[_0x52fcfb(0x122)](...checkCondition(_0x8a140b,_0x3355e0,_0x1c60df));}return _0x123847;}function checkCondition(_0xea20ca,_0x1c9ef4,_0x1d99bc){const _0x46d5cd=a156_0x287a,_0xc9efb3=[];if(_0xea20ca[_0x46d5cd(0x13b)]===_0x46d5cd(0x14b)||_0xea20ca[_0x46d5cd(0x13b)]==='Or'){if(_0xea20ca['conditions'][_0x46d5cd(0x131)]===0x0)_0xc9efb3[_0x46d5cd(0x122)]({'level':'error','path':_0x1c9ef4+'.conditions','code':_0x46d5cd(0x13f),'message':_0xea20ca[_0x46d5cd(0x13b)]+_0x46d5cd(0x156),'location':getLocationFromPath(_0x1d99bc['document'],_0x1d99bc[_0x46d5cd(0x11a)],pathToArray(_0x1c9ef4+_0x46d5cd(0x146)))});else{const _0x4cf3b2=_0xea20ca[_0x46d5cd(0x113)]!==undefined;!_0x4cf3b2&&_0xc9efb3['push']({'level':_0x46d5cd(0x153),'path':_0x1c9ef4,'code':'NESTED_CONDITION_GROUP','message':_0xea20ca[_0x46d5cd(0x13b)]+_0x46d5cd(0x130)+_0x46d5cd(0x138)+_0x46d5cd(0x12c),'location':getLocationFromPath(_0x1d99bc[_0x46d5cd(0x119)],_0x1d99bc[_0x46d5cd(0x11a)],pathToArray(_0x1c9ef4))}),_0xc9efb3[_0x46d5cd(0x122)](...checkConditions(_0xea20ca[_0x46d5cd(0x11b)],_0x1c9ef4,_0x1d99bc));}return _0xc9efb3;}if(_0xea20ca[_0x46d5cd(0x13b)]===_0x46d5cd(0x159)||_0xea20ca[_0x46d5cd(0x13b)]===_0x46d5cd(0x118)){const _0x48d862=_0xea20ca,_0x8c7176=_0x48d862[_0x46d5cd(0x11a)],_0x3462a0=_0x48d862['aggregation'],_0x4638a8=_0x8c7176||_0x3462a0;(!_0x48d862[_0x46d5cd(0x144)]||_0x48d862[_0x46d5cd(0x144)]==='')&&(!_0x4638a8&&_0xc9efb3['push']({'level':'error','path':_0x1c9ef4+'.attribute','code':_0x46d5cd(0x14d),'message':_0x46d5cd(0x14c),'location':getLocationFromPath(_0x1d99bc[_0x46d5cd(0x119)],_0x1d99bc[_0x46d5cd(0x11a)],pathToArray(_0x1c9ef4+_0x46d5cd(0x11e)))}));_0x48d862[_0x46d5cd(0x13e)]&&_0xc9efb3[_0x46d5cd(0x122)](...checkRule(_0x48d862[_0x46d5cd(0x13e)],_0x1c9ef4+_0x46d5cd(0x13a),_0x1d99bc));if(_0x48d862['source']){const _0x398506=_0x48d862['attribute']&&_0x48d862[_0x46d5cd(0x144)]!=='';_0x398506&&!_0x48d862[_0x46d5cd(0x13e)]&&_0xc9efb3[_0x46d5cd(0x122)]({'level':'error','path':_0x1c9ef4+_0x46d5cd(0x155),'code':_0x46d5cd(0x123),'message':'Behavior\x20source\x20\x27'+_0x48d862[_0x46d5cd(0x11a)]+_0x46d5cd(0x132)+_0x48d862[_0x46d5cd(0x144)]+'\x27\x20'+_0x46d5cd(0x121)+_0x46d5cd(0x15a)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x1d99bc['document'],_0x1d99bc['source'],pathToArray(_0x1c9ef4+'.source'))}),_0x398506&&_0x48d862[_0x46d5cd(0x13e)]&&_0xc9efb3[_0x46d5cd(0x122)]({'level':'warning','path':_0x1c9ef4+_0x46d5cd(0x11e),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x46d5cd(0x12a)+_0x48d862['attribute']+_0x46d5cd(0x14f)+_0x46d5cd(0x13d),'location':getLocationFromPath(_0x1d99bc[_0x46d5cd(0x119)],_0x1d99bc['source'],pathToArray(_0x1c9ef4+_0x46d5cd(0x11e)))});}}return _0xc9efb3;}function a156_0x3aeb(){const _0x356b50=['12ZNyFHX','415956tbsJeB','.attribute','.segment','map','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','push','BEHAVIOR_SOURCE_MISSING_FILTER','.operator.value','path','message','custom','validationCode','match','Attribute\x20\x27','SEGMENT_SCHEMA_ERROR','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','level','symbol','MISSING_TIME_UNIT','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','length','\x27\x20with\x20attribute\x20\x27','INVALID_RULE_TYPE','MISSING_SEGMENT_REFERENCE','MISSING_CONDITIONS','35urAwzo','INVALID_OPERATOR_TYPE','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','1030BvGMKH','.filter','type','safeParse','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','filter','EMPTY_CONDITIONS','MISSING_OPERATOR_VALUE','218232NbJvEL','invalid_value','error','attribute','39wTYUWl','.conditions','MISSING_NAME','MISSING_BETWEEN_BOUNDS','rule.type','endsWith','And','Attribute\x20name\x20cannot\x20be\x20empty','EMPTY_ATTRIBUTE','skipSchema','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','success','77742avlxic','98cpyGUE','warning','arrayMatching','.source','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','name','issues','Value','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','6254237DlAEai','.conditions[','params','5787qlPCrk','24BZrpYk','description','710748lJrjXY','rule','1862tgVrDy','INVALID_ARRAY_MATCHING','Behavior','document','source','conditions'];a156_0x3aeb=function(){return _0x356b50;};return a156_0x3aeb();}