@treasuredata/tdx 2026.4.21 → 2026.4.23

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 (231) 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.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  82. package/dist/proxy/claude-usage-tracker.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  84. package/dist/proxy/passthrough-server.d.ts +17 -0
  85. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  86. package/dist/proxy/passthrough-server.js +1 -1
  87. package/dist/proxy/passthrough-server.js.map +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.js +1 -1
  116. package/dist/sdk/connection-validator.js +1 -1
  117. package/dist/sdk/connection.js +1 -1
  118. package/dist/sdk/delivery.js +1 -1
  119. package/dist/sdk/engage/campaign-pull.js +1 -1
  120. package/dist/sdk/engage/campaign-push.js +1 -1
  121. package/dist/sdk/engage/campaign-validator.js +1 -1
  122. package/dist/sdk/engage/campaign-yaml.js +1 -1
  123. package/dist/sdk/engage/template-pull.js +1 -1
  124. package/dist/sdk/engage/template-push.js +1 -1
  125. package/dist/sdk/engage/template-validator.js +1 -1
  126. package/dist/sdk/engage/template-yaml.js +1 -1
  127. package/dist/sdk/engage/types/campaign-def.js +1 -1
  128. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  129. package/dist/sdk/engage/types/template-schema.js +1 -1
  130. package/dist/sdk/engage.js +1 -1
  131. package/dist/sdk/errors.js +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/io/index.js +1 -1
  134. package/dist/sdk/io/node-filesystem.js +1 -1
  135. package/dist/sdk/job.js +1 -1
  136. package/dist/sdk/journey.js +1 -1
  137. package/dist/sdk/llm/chat-cache.js +1 -1
  138. package/dist/sdk/llm/index.js +1 -1
  139. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  140. package/dist/sdk/llm/model-factors.d.ts +33 -9
  141. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  142. package/dist/sdk/llm/model-factors.js +1 -1
  143. package/dist/sdk/llm/model-factors.js.map +1 -1
  144. package/dist/sdk/personalization.js +1 -1
  145. package/dist/sdk/policy.js +1 -1
  146. package/dist/sdk/query/index.js +1 -1
  147. package/dist/sdk/query/sql-parser.js +1 -1
  148. package/dist/sdk/realtime.js +1 -1
  149. package/dist/sdk/schedule.js +1 -1
  150. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/fields-display.js +1 -1
  152. package/dist/sdk/segment/file-discovery.js +1 -1
  153. package/dist/sdk/segment/journey-utils.js +1 -1
  154. package/dist/sdk/segment/journey-validator.js +1 -1
  155. package/dist/sdk/segment/journey-yaml.js +1 -1
  156. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  157. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  158. package/dist/sdk/segment/pull-workflow.js +1 -1
  159. package/dist/sdk/segment/push-recovery.js +1 -1
  160. package/dist/sdk/segment/push-workflow.js +1 -1
  161. package/dist/sdk/segment/resolution-context.js +1 -1
  162. package/dist/sdk/segment/segment-path-parser.js +1 -1
  163. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  164. package/dist/sdk/segment/segment-validator.js +1 -1
  165. package/dist/sdk/segment/target-resolution.js +1 -1
  166. package/dist/sdk/segment/tdx-config.js +1 -1
  167. package/dist/sdk/segment/types/activation-schema.js +1 -1
  168. package/dist/sdk/segment/types/journey-def.js +1 -1
  169. package/dist/sdk/segment/types/journey-schema.js +1 -1
  170. package/dist/sdk/segment/types/segment-def.js +1 -1
  171. package/dist/sdk/segment/types/segment-schema.js +1 -1
  172. package/dist/sdk/segment/validate-files.js +1 -1
  173. package/dist/sdk/segment/yaml-validator.js +1 -1
  174. package/dist/sdk/segment.js +1 -1
  175. package/dist/sdk/types/index.js +1 -1
  176. package/dist/sdk/types/progress.js +1 -1
  177. package/dist/sdk/types/workspace.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/task-graph.js +1 -1
  190. package/dist/sdk/workflow/tdx-config.js +1 -1
  191. package/dist/sdk/workflow/workflow-utils.js +1 -1
  192. package/dist/sdk/workspace/access-tracker.js +1 -1
  193. package/dist/sdk/workspace/frontmatter.js +1 -1
  194. package/dist/sdk/workspace/git.js +1 -1
  195. package/dist/sdk/workspace/index.js +1 -1
  196. package/dist/sdk/workspace/templates.js +1 -1
  197. package/dist/sdk/workspace/weekly.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x156079=a152_0x4f7b;(function(_0x106858,_0x40ecd3){const _0x14692e=a152_0x4f7b,_0x3c0e26=_0x106858();while(!![]){try{const _0x2a0b50=parseInt(_0x14692e(0x205))/0x1*(-parseInt(_0x14692e(0x183))/0x2)+-parseInt(_0x14692e(0x1b3))/0x3+-parseInt(_0x14692e(0x1fa))/0x4+-parseInt(_0x14692e(0x200))/0x5+-parseInt(_0x14692e(0x194))/0x6*(-parseInt(_0x14692e(0x1bc))/0x7)+-parseInt(_0x14692e(0x1bd))/0x8*(parseInt(_0x14692e(0x178))/0x9)+-parseInt(_0x14692e(0x16a))/0xa*(-parseInt(_0x14692e(0x182))/0xb);if(_0x2a0b50===_0x40ecd3)break;else _0x3c0e26['push'](_0x3c0e26['shift']());}catch(_0x3100d3){_0x3c0e26['push'](_0x3c0e26['shift']());}}}(a152_0x2b94,0x9dd27));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x156079(0x18c));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a152_0x156079(0x17d);export function createPendingSegmentId(_0x304617){return''+PENDING_SEGMENT_PREFIX+_0x304617+'__';}export function isPendingSegmentId(_0x153a2f){const _0x30739f=a152_0x156079;return _0x153a2f[_0x30739f(0x1a0)](PENDING_SEGMENT_PREFIX)&&!_0x153a2f['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x51173e){const _0x3a3e79=a152_0x156079;return _0x51173e[_0x3a3e79(0x20b)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x39981d){return''+PENDING_ACTIVATION_PREFIX+_0x39981d+'__';}export function isPendingActivationId(_0x30f3da){const _0x2c3a7d=a152_0x156079;return _0x30f3da[_0x2c3a7d(0x1a0)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x535f81){const _0x5431a9=a152_0x156079;return _0x535f81[_0x5431a9(0x20b)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3714aa,_0x3f4622){const _0x7108ee=a152_0x156079,_0x166c91=_0x3714aa+'::'+(_0x3f4622[_0x7108ee(0x181)]()||'segment'),_0x5a95d1=createHash(_0x7108ee(0x1f7))[_0x7108ee(0x179)](_0x166c91)[_0x7108ee(0x216)](_0x7108ee(0x18d))['slice'](0x0,0xc);return _0x7108ee(0x159)+_0x5a95d1;}export function ensureJourneyDefaults(_0xa01886){const _0x10d6cb=a152_0x156079;!_0xa01886[_0x10d6cb(0x1ce)]&&(_0xa01886[_0x10d6cb(0x1ce)]=''),!_0xa01886[_0x10d6cb(0x169)]&&(_0xa01886[_0x10d6cb(0x169)]=_0x10d6cb(0x167));}export function injectExistingStageIds(_0x187664,_0xbab6cb){const _0x11e31d=a152_0x156079,_0x3b2e05=new Map(_0xbab6cb['map'](_0x2b01b2=>[_0x2b01b2[_0x11e31d(0x1e6)],_0x2b01b2['id']]));for(const _0x12b505 of _0x187664){if(!_0x12b505['id']){const _0x2be666=_0x3b2e05[_0x11e31d(0x186)](_0x12b505['name']);_0x2be666&&(_0x12b505['id']=_0x2be666);}}}export function resolveTDFolderPath(_0xc3c348,_0x247ed0,_0x19b8b6){const _0x1736aa=a152_0x156079;if(!_0x247ed0)return _0xc3c348;if(_0xc3c348===_0x19b8b6||_0xc3c348[_0x1736aa(0x1a0)](_0x19b8b6+'/'))return _0xc3c348;return _0xc3c348?_0x19b8b6+'/'+_0xc3c348:_0x19b8b6;}export function addFoldersToCreate(_0x1f6bae,_0x28b479,_0x4dd5f0){const _0x22015e=a152_0x156079;if(!_0x1f6bae)return;if(_0x28b479[_0x22015e(0x15d)](_0x1f6bae))return;const _0x1e4a43=_0x1f6bae[_0x22015e(0x1da)]('/');let _0x296613='';for(const _0x3c9738 of _0x1e4a43){_0x296613=_0x296613?_0x296613+'/'+_0x3c9738:_0x3c9738,!_0x28b479[_0x22015e(0x15d)](_0x296613)&&_0x4dd5f0[_0x22015e(0x193)](_0x296613);}}export function sortFoldersByDepth(_0x44ca3f){const _0x356e7b=a152_0x156079;return[..._0x44ca3f][_0x356e7b(0x1d6)]((_0x2fe23f,_0x38d611)=>{const _0x5e82ee=_0x356e7b,_0x447254=(_0x2fe23f[_0x5e82ee(0x222)](/\//g)||[])[_0x5e82ee(0x15f)],_0x20016a=(_0x38d611[_0x5e82ee(0x222)](/\//g)||[])['length'];return _0x447254-_0x20016a;});}import*as a152_0x6b472 from'yaml';import{readFileSync}from'fs';import a152_0x2b7610 from'path';import{isJourneyDef,parseYamlString as a152_0x1b2bee,toYamlString as a152_0x204244,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(_0x457989){const _0xea7fe0=a152_0x156079;if(Array[_0xea7fe0(0x22a)](_0x457989))return'['+_0x457989[_0xea7fe0(0x1b4)](_0xee90d6=>stableStringify(_0xee90d6))['join'](',')+']';if(_0x457989&&typeof _0x457989===_0xea7fe0(0x1bf)){const _0x4b7669=_0x457989,_0x27df57=Object[_0xea7fe0(0x230)](_0x4b7669)[_0xea7fe0(0x1d6)](),_0xaed90a=_0x27df57[_0xea7fe0(0x1b4)](_0x424725=>'\x22'+_0x424725+'\x22:'+stableStringify(_0x4b7669[_0x424725]));return'{'+_0xaed90a[_0xea7fe0(0x15e)](',')+'}';}const _0x607448=JSON[_0xea7fe0(0x1ff)](_0x457989);return _0x607448===undefined?_0xea7fe0(0x1f9):_0x607448;}function activationSignature(_0x4081bb){const _0x4f4fab=a152_0x156079,_0x4338a1={'connection':_0x4081bb[_0x4f4fab(0x249)],..._0x4081bb['all_columns']!==undefined&&{'all_columns':_0x4081bb['all_columns']},..._0x4081bb[_0x4f4fab(0x1ec)]!==undefined&&{'columns':_0x4081bb['columns']},..._0x4081bb[_0x4f4fab(0x1de)]!==undefined&&{'behavior':_0x4081bb[_0x4f4fab(0x1de)]},..._0x4081bb[_0x4f4fab(0x23f)]!==undefined&&{'schedule':_0x4081bb[_0x4f4fab(0x23f)]},..._0x4081bb['notification']!==undefined&&{'notification':_0x4081bb[_0x4f4fab(0x220)]},..._0x4081bb[_0x4f4fab(0x20f)]!==undefined&&{'connector_config':_0x4081bb[_0x4f4fab(0x20f)]},..._0x4081bb[_0x4f4fab(0x1fb)]!==undefined&&{'activation_template_id':_0x4081bb[_0x4f4fab(0x1fb)]}};return stableStringify(_0x4338a1);}async function fetchSegment(_0x5ecf82,_0x4efe24,_0x18bbbd,_0x297ebc){const _0x525720=a152_0x156079,_0x5b82e5=_0x297ebc?.[_0x525720(0x168)](_0x3342bd=>_0x3342bd['id']===_0x18bbbd);if(_0x5b82e5)return _0x5b82e5;try{return await _0x5ecf82[_0x525720(0x1a7)]['getSegment'](_0x4efe24,_0x18bbbd);}catch(_0x4617d6){logger[_0x525720(0x19a)](_0x525720(0x245)+_0x18bbbd+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x4617d6);try{return await _0x5ecf82[_0x525720(0x1a7)][_0x525720(0x185)](_0x18bbbd);}catch(_0x51bf51){return logger[_0x525720(0x19a)](_0x525720(0x243)+_0x18bbbd+':\x20'+_0x51bf51),null;}}}function recoverSegmentIdsFromPushRecovery(_0x5c9309,_0x5138a9,_0xe0dd5){const _0x4060ac=a152_0x156079,_0x657e96=readPushRecovery(_0x5c9309[_0x4060ac(0x210)]);if(_0x657e96?.[_0x4060ac(0x1f2)]===_0x5c9309[_0x4060ac(0x247)][_0x4060ac(0x1e6)])for(const [_0x19f5c2,_0x41db87]of Object[_0x4060ac(0x227)](_0x657e96[_0x4060ac(0x202)])){const _0x116f04=generateDeterministicJourneySegmentName(_0x5c9309[_0x4060ac(0x247)][_0x4060ac(0x1e6)],_0x19f5c2);_0x41db87['uniqueServerName']===_0x116f04&&(_0x5138a9['set'](_0x19f5c2,_0x41db87[_0x4060ac(0x158)]),_0xe0dd5[_0x4060ac(0x174)](_0x19f5c2,_0x41db87[_0x4060ac(0x158)]));}}async function createOrRecoverEmbeddedSegment(_0x5cde48,_0xc68e60,_0x2cc835,_0x17c160){const _0x20dc1e=a152_0x156079;let _0x5b0660;try{_0x5b0660=await _0x5cde48['segment'][_0x20dc1e(0x208)]({'name':_0x2cc835[_0x20dc1e(0x24b)],'description':_0x2cc835['description'],'journeyId':_0x2cc835[_0x20dc1e(0x20e)],'rule':_0x17c160(_0x2cc835['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x2cc835[_0x20dc1e(0x1a6)],'audienceId':_0x2cc835[_0x20dc1e(0x211)]});}catch(_0x42fd68){const _0x411018=_0x42fd68 instanceof Error&&_0x42fd68[_0x20dc1e(0x152)][_0x20dc1e(0x1db)]('Name\x20has\x20already\x20been\x20taken');if(_0x411018){const _0x19fb0e=readPushRecovery(_0xc68e60[_0x20dc1e(0x210)]),_0x1995a5=_0x19fb0e?.[_0x20dc1e(0x1f2)]===_0xc68e60['yamlConfig'][_0x20dc1e(0x1e6)]?_0x19fb0e['segments'][_0x2cc835['localName']]:undefined;if(_0x1995a5?.[_0x20dc1e(0x203)]===_0x2cc835[_0x20dc1e(0x24b)])await _0x5cde48[_0x20dc1e(0x1a7)][_0x20dc1e(0x1cc)](_0x2cc835[_0x20dc1e(0x211)],_0x1995a5[_0x20dc1e(0x158)],{'description':_0x2cc835[_0x20dc1e(0x1ce)],'rule':_0x17c160(_0x2cc835[_0x20dc1e(0x19e)],!![]),'countPopulation':!![]}),_0x5b0660=_0x1995a5['segmentId'];else throw new SDKError(ErrorCode[_0x20dc1e(0x164)],_0x20dc1e(0x238)+_0x2cc835[_0x20dc1e(0x24c)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0xc68e60['absolutePath'][_0x20dc1e(0x20b)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x42fd68);}else throw _0x42fd68;}return saveSegmentToPushRecovery(_0xc68e60[_0x20dc1e(0x210)],_0xc68e60[_0x20dc1e(0x247)][_0x20dc1e(0x1e6)],_0x2cc835[_0x20dc1e(0x24c)],{'segmentId':_0x5b0660,'uniqueServerName':_0x2cc835[_0x20dc1e(0x24b)],'createdAt':new Date()['toISOString']()}),_0x5b0660;}export async function prepareSegmentFiles(_0x407fb0,_0x3219be,_0x508d25,_0x35995a,_0x5c12b0){const _0x36a0b5=a152_0x156079,{activationDefToCreateRequest:_0x2efe03}=await import(_0x36a0b5(0x23c)),_0x52645e=[],_0x5cd40f=new Set();for(const {yamlConfig:_0x4498f7,folderPath:_0x3f070f,sourcePath:_0x3f60b2}of _0x407fb0){const _0x2c1845=resolveTDFolderPath(_0x3f070f,_0x35995a,_0x5c12b0),_0x5348c3=_0x2c1845+':'+_0x4498f7[_0x36a0b5(0x1e6)],_0x2c17ca=_0x3219be[_0x36a0b5(0x215)][_0x36a0b5(0x186)](_0x5348c3),_0x410f81=_0x2c17ca?_0x3219be[_0x36a0b5(0x1a2)][_0x36a0b5(0x186)](_0x2c17ca['id'])||[]:[];addFoldersToCreate(_0x2c1845,_0x3219be[_0x36a0b5(0x170)],_0x5cd40f);const _0x317a73=calculateActivationActions(_0x4498f7['activations']||[],_0x410f81,_0x3219be[_0x36a0b5(0x234)],_0x3219be[_0x36a0b5(0x1a8)]);for(const _0x3bcf10 of _0x317a73){(_0x3bcf10[_0x36a0b5(0x217)]===_0x36a0b5(0x248)||_0x3bcf10[_0x36a0b5(0x217)]===_0x36a0b5(0x179))&&_0x3bcf10[_0x36a0b5(0x184)]&&(_0x3bcf10['validatedRequest']=await _0x2efe03(_0x3bcf10['yamlActivation'],_0x508d25));}const _0x4446b3=calculateSegmentDiff(_0x4498f7,_0x2c17ca,_0x410f81,_0x3219be['idToEmailMap'],_0x3219be[_0x36a0b5(0x1a8)]);_0x52645e[_0x36a0b5(0x241)]({'relativePath':_0x4498f7[_0x36a0b5(0x1e6)],'absolutePath':_0x3f60b2,'yamlConfig':_0x4498f7,'folderPath':_0x2c1845,'existingSegment':_0x2c17ca,'existingActivations':_0x410f81,'isNew':_0x4446b3['isNew'],'hasChanges':_0x4446b3[_0x36a0b5(0x204)],'diff':_0x4446b3[_0x36a0b5(0x155)],'activationActions':_0x317a73});}return{'segmentFiles':_0x52645e,'foldersToCreate':_0x5cd40f};}export async function prepareJourneyFiles(_0x188ba1,_0x10455a,_0x4a4713,_0x28bc8b){const _0x8fadac=a152_0x156079,_0x190f38=[],_0x552833=new Set();for(const {yamlConfig:_0x429b31,folderPath:_0x2a3177,sourcePath:_0x4e43cb}of _0x188ba1){const _0x5e2581=resolveTDFolderPath(_0x2a3177,_0x4a4713,_0x28bc8b),_0x4d9fd2=_0x5e2581+':'+_0x429b31['name'],_0x257c46=_0x10455a[_0x8fadac(0x1c9)]['get'](_0x4d9fd2);let _0x2f7598,_0x1324ce;if(_0x257c46&&_0x257c46[_0x8fadac(0x15f)]>0x0){const _0x29fc84=buildLocalExpandedRuleMappings(_0x429b31),{createYamlContext:_0x507c9b,prefetchJourneySegments:_0x2b1272}=createPushYamlContextForBundle(_0x10455a[_0x8fadac(0x165)],_0x10455a[_0x8fadac(0x211)],_0x10455a[_0x8fadac(0x1df)],_0x29fc84,_0x10455a[_0x8fadac(0x234)],_0x10455a[_0x8fadac(0x1a8)],_0x10455a[_0x8fadac(0x1d0)],_0x10455a['journeyById']);await _0x2b1272(_0x257c46[_0x8fadac(0x1b4)](_0x26f98a=>_0x26f98a['id']));const _0x1336f7=await _0x10455a[_0x8fadac(0x165)][_0x8fadac(0x20c)][_0x8fadac(0x1f3)](_0x257c46[0x0][_0x8fadac(0x1e1)]),_0x319ec0=hasMultipleVersions(_0x429b31),_0x445eff=async _0x5827fd=>{const _0x38838a=_0x8fadac,_0x439b84=_0x10455a[_0x38838a(0x19f)]?.[_0x38838a(0x186)](_0x5827fd);if(_0x439b84)return _0x439b84;return _0x10455a['fetchJourney']({'journeyId':_0x5827fd,'journeyName':_0x429b31[_0x38838a(0x1e6)],'isMultiVersion':_0x257c46[_0x38838a(0x15f)]>0x1});};if(_0x319ec0&&_0x257c46[_0x8fadac(0x15f)]>0x1){const _0x33f82c=[];for(const _0x8266d1 of _0x257c46){const _0x148c06=_0x8266d1[_0x8fadac(0x246)]||0x1;_0x10455a[_0x8fadac(0x228)]?.[_0x8fadac(0x179)](_0x8fadac(0x1b6)+_0x429b31[_0x8fadac(0x1e6)]+'\x20v'+_0x148c06);const _0x2e4473=await _0x445eff(_0x8266d1['id']),_0x820b13=_0x507c9b(_0x8266d1['id']),_0x33ef5c=await journeyResponseToDef(_0x2e4473,_0x820b13);_0x33f82c['push']({'item':_0x8266d1,'yaml':_0x33ef5c});}const _0x15d30b=buildLocalRuleToNameMappingFromJourney(_0x429b31);_0x1324ce=buildMergedJourneyDef(_0x33f82c,_0x15d30b,_0x1336f7);const _0x44ec26=Math[_0x8fadac(0x1d7)](..._0x33f82c['map'](_0x43d139=>_0x43d139[_0x8fadac(0x22c)]['versionNumber']||0x0)),_0x4efbb9=_0x257c46[_0x8fadac(0x168)](_0x577211=>(_0x577211[_0x8fadac(0x246)]||0x0)===_0x44ec26);_0x4efbb9&&(_0x10455a['progress']?.[_0x8fadac(0x179)](_0x8fadac(0x1b6)+_0x429b31['name']+'\x20v'+_0x44ec26),_0x2f7598=await _0x445eff(_0x4efbb9['id']));}else{const _0x56aa61=_0x257c46[_0x257c46[_0x8fadac(0x15f)]-0x1];_0x10455a['progress']?.[_0x8fadac(0x179)](_0x8fadac(0x1b6)+_0x429b31[_0x8fadac(0x1e6)]),_0x2f7598=await _0x445eff(_0x56aa61['id']);const _0x33c946=_0x507c9b(_0x56aa61['id']),_0x4845e1=await journeyResponseToDef(_0x2f7598,_0x33c946),_0x5b153c=buildLocalRuleToNameMappingFromJourney(_0x429b31);_0x1324ce=buildMergedJourneyDef([{'item':_0x56aa61,'yaml':_0x4845e1}],_0x5b153c,_0x1336f7);}}addFoldersToCreate(_0x5e2581,_0x10455a[_0x8fadac(0x170)],_0x552833);const _0x36b761=calculateJourneyDiff(_0x429b31,_0x1324ce);_0x190f38['push']({'relativePath':_0x429b31[_0x8fadac(0x1e6)],'absolutePath':_0x4e43cb,'yamlConfig':_0x429b31,'folderPath':_0x5e2581,'existingJourney':_0x2f7598,'isNew':_0x36b761['isNew'],'hasChanges':_0x36b761[_0x8fadac(0x204)],'diff':_0x36b761[_0x8fadac(0x155)]});}return{'journeyFiles':_0x190f38,'foldersToCreate':_0x552833};}export function calculateActivationActions(_0x24f068,_0x2ea427,_0x3e4426,_0x4323c4){const _0x50793e=a152_0x156079,_0x4a3308=[],_0x3c484f=new Map();for(const _0x23ee01 of _0x2ea427){_0x3c484f['set'](_0x23ee01[_0x50793e(0x1e6)],_0x23ee01);}const _0x4fb0c8=new Map();for(const _0x2b6abb of _0x24f068){_0x4fb0c8[_0x50793e(0x174)](_0x2b6abb['name'],_0x2b6abb);}for(const _0x211f55 of _0x24f068){const _0x339436=_0x3c484f['get'](_0x211f55[_0x50793e(0x1e6)]);if(!_0x339436)_0x4a3308['push']({'type':_0x50793e(0x248),'name':_0x211f55[_0x50793e(0x1e6)],'yamlActivation':_0x211f55});else{const _0x3c8f77=activationResponseToDef(_0x339436,_0x3e4426,_0x4323c4),_0x120237=a152_0x6b472[_0x50793e(0x1ff)](_0x3c8f77),_0x166079=a152_0x6b472['stringify'](_0x211f55);_0x120237!==_0x166079&&_0x4a3308[_0x50793e(0x241)]({'type':_0x50793e(0x179),'name':_0x211f55['name'],'yamlActivation':_0x211f55,'existingActivation':_0x339436});}}for(const _0x589568 of _0x2ea427){!_0x4fb0c8['has'](_0x589568['name'])&&_0x4a3308[_0x50793e(0x241)]({'type':_0x50793e(0x224),'name':_0x589568['name'],'existingActivation':_0x589568});}return _0x4a3308;}function calculateYamlDiff(_0x26e17f,_0x15c195){if(_0x15c195){const _0x2783e2=generateDiff(_0x15c195,_0x26e17f),_0x113373=hasChanges(_0x2783e2);return{'isNew':![],'hasChanges':_0x113373,'diff':_0x113373?formatDiffWithColors(_0x2783e2):undefined};}const _0x1b48cb=generateDiff('',_0x26e17f);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1b48cb)};}export function calculateSegmentDiff(_0x1b7bf4,_0xfb7472,_0x1cfb3a,_0x58912d,_0x4dea70){const _0x39fc7e=segmentToYamlString(_0x1b7bf4),_0x1cffb0=_0xfb7472?segmentToYamlString(segmentWithActivationsToYaml(_0xfb7472,_0x1cfb3a,undefined,_0x58912d,_0x4dea70)):undefined;return calculateYamlDiff(_0x39fc7e,_0x1cffb0);}export function calculateJourneyDiff(_0x237c04,_0x4d154e){const _0x549103=normalizeJourneyDef(_0x237c04,_0x237c04),_0x28e71a=a152_0x204244(_0x549103),_0x2f7131=_0x4d154e?a152_0x204244(normalizeJourneyDef(_0x4d154e,_0x237c04)):undefined;return calculateYamlDiff(_0x28e71a,_0x2f7131);}export function findSegmentsToDelete(_0x5bb773,_0x2d5e73,_0x3bf541,_0x582c51,_0x587386){const _0x2e727c=a152_0x156079,_0x28af07=new Set();for(const {yamlConfig:_0x137f53,folderPath:_0x41ca14}of _0x2d5e73){_0x28af07[_0x2e727c(0x193)](_0x41ca14+':'+_0x137f53[_0x2e727c(0x1e6)]);}return _0x5bb773[_0x2e727c(0x207)](_0x103123=>{const _0x3eb142=_0x2e727c,_0x3899f3=_0x103123[_0x3eb142(0x163)]?_0x3bf541[_0x3eb142(0x186)](_0x103123['segmentFolderId'][_0x3eb142(0x1cd)]())||'':'',_0x365d88=_0x3899f3+':'+_0x103123['name'];if(_0x28af07['has'](_0x365d88))return![];if(_0x587386)return _0x3899f3===_0x582c51||_0x3899f3[_0x3eb142(0x1a0)](_0x582c51+'/');return!![];});}export function findJourneysToDelete(_0x1d4c24,_0x45de5a,_0x1717cd,_0x23770a,_0x515090){const _0x36a2d4=a152_0x156079,_0x1d2760=new Set();for(const {yamlConfig:_0x4b69c1,folderPath:_0x513610}of _0x45de5a){_0x1d2760[_0x36a2d4(0x193)](_0x513610+':'+_0x4b69c1['name']);}return _0x1d4c24[_0x36a2d4(0x207)](_0x2db273=>{const _0x1edd9e=_0x36a2d4,_0x24da9b=_0x2db273['folderId']?_0x1717cd[_0x1edd9e(0x186)](_0x2db273[_0x1edd9e(0x1a6)])||'':'',_0x5a5eb8=_0x24da9b+':'+_0x2db273[_0x1edd9e(0x17f)];if(_0x1d2760[_0x1edd9e(0x15d)](_0x5a5eb8))return![];if(_0x515090)return _0x24da9b===_0x23770a||_0x24da9b['startsWith'](_0x23770a+'/');return!![];});}export function buildSegmentLookupMap(_0x11ba85,_0x525cf6){const _0x183b23=a152_0x156079,_0x1bdcae=new Map();for(const _0x38697a of _0x11ba85){const _0x63a196=_0x38697a[_0x183b23(0x163)]?_0x525cf6[_0x183b23(0x186)](_0x38697a[_0x183b23(0x163)][_0x183b23(0x1cd)]())||'':'',_0x3fcbd8=_0x63a196+':'+_0x38697a[_0x183b23(0x1e6)];_0x1bdcae[_0x183b23(0x174)](_0x3fcbd8,_0x38697a);}return _0x1bdcae;}export function buildSegmentNameToIdMap(_0x2addca){const _0x1a237c=a152_0x156079,_0xb2c281=new Map();for(const _0x4e98e6 of _0x2addca){_0xb2c281[_0x1a237c(0x174)](_0x4e98e6[_0x1a237c(0x1e6)],_0x4e98e6['id']);}return _0xb2c281;}export function buildJourneyBundleLookupMap(_0x37b679,_0xc60bba){const _0x33c51a=a152_0x156079,_0x3565b8=new Map();for(const _0x31ddaa of _0x37b679){const _0x3e2f9f=_0x31ddaa[_0x33c51a(0x1a6)]?_0xc60bba[_0x33c51a(0x186)](_0x31ddaa[_0x33c51a(0x1a6)])||'':'',_0x22bb71=_0x3e2f9f+':'+_0x31ddaa[_0x33c51a(0x17f)];!_0x3565b8[_0x33c51a(0x15d)](_0x22bb71)&&_0x3565b8['set'](_0x22bb71,[]),_0x3565b8['get'](_0x22bb71)[_0x33c51a(0x241)](_0x31ddaa);}for(const _0x368c97 of _0x3565b8['values']()){_0x368c97[_0x33c51a(0x1d6)]((_0x47d608,_0x8ff5c9)=>(_0x47d608[_0x33c51a(0x246)]||0x0)-(_0x8ff5c9[_0x33c51a(0x246)]||0x0));}return _0x3565b8;}export function collectFoldersToCreate(_0x3c385b,_0x33309a){const _0x30c26b=a152_0x156079,_0x2a96a4=new Set();for(const _0x4043a2 of _0x3c385b){if(!_0x4043a2)continue;if(_0x33309a[_0x30c26b(0x15d)](_0x4043a2))continue;const _0x34908f=_0x4043a2[_0x30c26b(0x1da)]('/');let _0x1b44c3='';for(const _0x5d1ac9 of _0x34908f){_0x1b44c3=_0x1b44c3?_0x1b44c3+'/'+_0x5d1ac9:_0x5d1ac9,!_0x33309a[_0x30c26b(0x15d)](_0x1b44c3)&&_0x2a96a4[_0x30c26b(0x193)](_0x1b44c3);}}return _0x2a96a4;}function a152_0x2b94(){const _0x2f44e6=['Deleted\x20segment\x20\x27','match','segment_created','delete','\x20journey\x20from\x20file:\x20','existingSegment','entries','progress','activationContext','isArray','created','item','segmentNameToId','size','createActivation','keys','buildUserMaps','segment_deleted','Updated\x20journey\x20\x27','idToEmailMap','Activation','withProgress','conditionTimeoutDuration','Embedded\x20segment\x20\x27','activations','entryCriteria','parse','./child-segment-yaml.js','validatedRequest','createdSegmentIds','schedule','relative','push','\x27\x20decision\x20point\x20branch\x20\x27','getSegmentEntity\x20also\x20failed\x20for\x20','existingActivation','getSegment\x20failed\x20for\x20','versionNumber','yamlConfig','create','connection','run_after_journey_refresh','uniqueSegmentName','localName','message','journey_updated','Condition','diff','Segment\x20not\x20found','createSegment','segmentId','journey_entry_criteria_','Failed\x20to\x20resolve\x20segment\x20','activation_updating','relationships','has','join','length','resolveJourneyId','Creating\x20folder\x20\x27','journeyStages','segmentFolderId','SEGMENT_UPDATE_ERROR','deps','journey_updating','draft','find','state','10QDlXqq','stages','folder','with','getJourney','isNew','folderPathToId','\x20segment\x20from\x20file:\x20','activation_deleting','day','set','stage\x20\x27','nameToType','conditionSegmentId','3566583pBfcYG','update','resolveSegment','createdSegmentId','Stage\x20\x27','__pending_act_','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','journeyBundleName','Updating\x20segment\x20\x27','trim','30799901xxfwyC','4HrHxwI','yamlActivation','getSegmentEntity','get','data',').\x20','journeys','parseDocument','Created\x20journey\x20\x27','tdx.sdk.push-workflow','hex','results','index','goal','ACTIVATION_UPDATE_ERROR','Matched\x20server\x20segment\x20\x27','add','1212SdxcVu','Journey\x20\x27','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Entry\x20criteria:\x20','listActivations','waitStepUnit','debug','existingJourney','logWarning','user','resolvedRule','journeyById','startsWith','Updating\x20activation\x20\x27','activationsBySegmentId','rule','rootFolderId','\x27...','folderId','segment','connectionIdToNameMap','embeddedSegmentNameToId','deleted','exitCriterias','WaitStep','INTERNAL','Created\x20activation\x20\x27','skipSegments','logInfo','Creating\x20segment\x20\x27','ACTIVATION_SYNTAX_ERROR','1291263Ujvxww','map','journeyActivationStepId','Fetching\x20','NOT_FOUND','flatMap','\x27\x20exit\x20criteria','kind','Deleting\x20activation\x20\x27','8351OkDFCj','24lNlERe','journey_created','object','\x27\x20entry\x20criteria','decision_point','from','SEGMENT_SYNTAX_ERROR','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','attributes','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','unchanged','createFolder','journeyBundlesByFolderAndName','folder_created','some','updateSegmentById','toString','description','\x20activation\x20\x27','activationStepsById','steps','\x27\x20from\x20file:\x20','all','deleteSegment','deleteActivation','sort','max','slice','waitStepType','split','includes','updateActivation','entry','behavior','existingSegments','\x20(referenced\x20in\x20journey\x20','journeyBundleId','\x27\x20milestone','DecisionPoint','waitStep','Duration','name','reduce','action','idToName','../../utils/async.js','\x27\x20for\x20','columns','journey_creating','SEGMENT_NOT_FOUND','Created\x20folder\x20\x27','branches','onProgress','journeyName','getLatestJourneyId','valid','\x0a\x20\x20','folderPath','sha1','conditions','null','571616DqFSCB','activation_template_id','activationActions','Created\x20segment\x20\x27','Segment\x20not\x20found:\x20','stringify','1526780qZbaGG','conditionTimeoutUnit','segments','uniqueServerName','hasChanges','163498xaomXO','logSuccess','filter','createJourneySegment','goal\x20criteria','Failed\x20to\x20','replace','journey','milestone','journeyId','connector_config','absolutePath','parentId','embedded_segment_created','utf-8','parentFolder','segmentByFolderAndName','digest','type','entry_criteria','\x27\x20wait\x20condition','Activation\x20not\x20found:\x20','updated','):\x20','verbose','toLowerCase','\x27\x20not\x20found\x20in\x20journey\x20\x27','notification'];a152_0x2b94=function(){return _0x2f44e6;};return a152_0x2b94();}export function parseAndClassifyYamlFiles(_0x869de5,_0x414f38,_0x45cea3){const _0x4a12ae=a152_0x156079,_0x8ce848=[],_0x34dd71=[];for(const _0x3d93fe of _0x869de5){const _0x43c5b5=a152_0x2b7610[_0x4a12ae(0x240)](_0x414f38,a152_0x2b7610['dirname'](_0x3d93fe)),_0x4b2b96=_0x43c5b5==='.'?'':_0x43c5b5[_0x4a12ae(0x20b)](/\\/g,'/'),_0xff6261=readFileSync(_0x3d93fe,'utf-8'),_0x9ffe98=a152_0x6b472[_0x4a12ae(0x23b)](_0xff6261);if(isJourneyDef(_0x9ffe98)){const _0x3f6f4f=a152_0x1b2bee(_0xff6261);_0x34dd71[_0x4a12ae(0x241)]({'yamlConfig':_0x3f6f4f,'folderPath':_0x4b2b96,'sourcePath':_0x3d93fe});}else{if(!_0x45cea3?.[_0x4a12ae(0x1af)]){const _0x80454c=parseSegmentYamlFile(_0xff6261),_0x569e40=normalizeChildSegmentYaml(_0x80454c);_0x8ce848[_0x4a12ae(0x241)]({'yamlConfig':_0x569e40,'folderPath':_0x4b2b96,'sourcePath':_0x3d93fe});}}}return{'segments':_0x8ce848,'journeys':_0x34dd71};}export function validateParsedFiles(_0x44e486,_0x51fbe4){const _0x35b0bd=a152_0x156079,_0x402722=[];for(const {yamlConfig:_0x2d4e57,sourcePath:_0x58f0d4}of _0x44e486[_0x35b0bd(0x202)]){const _0xea1057=readFileSync(_0x58f0d4,_0x35b0bd(0x213)),_0x3093fe=a152_0x6b472[_0x35b0bd(0x18a)](_0xea1057),_0x567ddf=validateSegmentDef(_0x2d4e57,{'source':_0xea1057,'document':_0x3093fe},{'skipSchema':!![]});if(!_0x567ddf[_0x35b0bd(0x1f4)]){const _0x38f28d=a152_0x2b7610['relative'](_0x51fbe4,_0x58f0d4);_0x402722[_0x35b0bd(0x241)]({'filePath':_0x38f28d,'source':_0xea1057,'result':_0x567ddf,'isJourney':![]});}}for(const {yamlConfig:_0x523397,sourcePath:_0x50a3f9}of _0x44e486[_0x35b0bd(0x189)]){const _0x550753=readFileSync(_0x50a3f9,'utf-8'),_0x3f339e=a152_0x6b472[_0x35b0bd(0x18a)](_0x550753),_0x29f241=validateJourneyDef(_0x523397,{'source':_0x550753,'document':_0x3f339e},{'skipSchema':!![]});if(!_0x29f241[_0x35b0bd(0x1f4)]){const _0x452236=a152_0x2b7610[_0x35b0bd(0x240)](_0x51fbe4,_0x50a3f9);_0x402722[_0x35b0bd(0x241)]({'filePath':_0x452236,'source':_0x550753,'result':_0x29f241,'isJourney':!![]});}}return _0x402722;}export function formatValidationErrors(_0x1d1f55){const _0x26d094=a152_0x156079,_0x231131=[];for(const {filePath:_0x51908,source:_0x13ba5c,result:_0x1b4adb,isJourney:_0xe9fa19}of _0x1d1f55){const _0x3b4f65=_0xe9fa19?_0x26d094(0x20c):'segment';_0x231131[_0x26d094(0x241)]('\x0a'+_0x51908+'\x20('+_0x3b4f65+_0x26d094(0x21c)+_0x1b4adb['errors'][_0x26d094(0x15f)]+'\x20error(s)'),_0x231131[_0x26d094(0x241)](formatValidationResult(_0x1b4adb,_0x13ba5c,_0x51908));}return _0x231131[_0x26d094(0x15e)]('\x0a');}export function buildLocalExpandedRuleMappings(_0xda031a){const _0x168dbd=a152_0x156079,_0x1b4e56=new Set(),_0x1b7d3f=new Map(),_0x59417c=collectSegmentUsageCounts(_0xda031a);if(_0xda031a[_0x168dbd(0x202)])for(const [_0x156b1b,_0x50ed27]of Object[_0x168dbd(0x227)](_0xda031a[_0x168dbd(0x202)])){_0x1b4e56[_0x168dbd(0x193)](_0x156b1b);if(_0x50ed27[_0x168dbd(0x1a3)]){const _0x50e1bf=yamlRuleToApi(_0x50ed27[_0x168dbd(0x1a3)]),_0x35c75a=apiRuleToYaml(_0x50e1bf);_0x1b7d3f[_0x168dbd(0x174)](_0x156b1b,_0x35c75a);}}const _0x1086da=new Map();let _0x5dd05f=0x0;for(const [_0x5a9bd6,_0xe7a77c]of _0x1b7d3f){const _0x82ff17=serializeExpandedRule(_0xe7a77c,_0x1b7d3f),_0x1cfd9e=_0x1086da[_0x168dbd(0x186)](_0x82ff17)||[];_0x1cfd9e['push']({'name':_0x5a9bd6,'index':_0x5dd05f}),_0x1086da[_0x168dbd(0x174)](_0x82ff17,_0x1cfd9e),_0x5dd05f++;}const _0x4b623f=new Map();for(const [_0x5d6248,_0x184333]of _0x1086da){const _0x4ecfeb=_0x184333[_0x168dbd(0x1d8)]()['sort']((_0x4b18a2,_0x4d2bfb)=>{const _0x4951d7=_0x168dbd,_0x5bcaa5=_0x59417c[_0x4951d7(0x186)](_0x4b18a2[_0x4951d7(0x1e6)])||0x0,_0x5cee19=_0x59417c[_0x4951d7(0x186)](_0x4d2bfb[_0x4951d7(0x1e6)])||0x0;if(_0x5bcaa5!==_0x5cee19)return _0x5cee19-_0x5bcaa5;return _0x4b18a2[_0x4951d7(0x18f)]-_0x4d2bfb['index'];})[_0x168dbd(0x1b4)](_0x18d676=>_0x18d676[_0x168dbd(0x1e6)]),_0x47fe5b=[];for(const _0x2b3159 of _0x4ecfeb){const _0x223f2d=_0x59417c['get'](_0x2b3159)||0x0,_0x408f5a=Math[_0x168dbd(0x1d7)](_0x223f2d,0x1);for(let _0x267ecb=0x0;_0x267ecb<_0x408f5a;_0x267ecb++){_0x47fe5b[_0x168dbd(0x241)](_0x2b3159);}}_0x4b623f[_0x168dbd(0x174)](_0x5d6248,_0x47fe5b);}return{'existingLocalSegmentNames':_0x1b4e56,'localSegmentRules':_0x1b7d3f,'localExpandedRuleToNames':_0x4b623f};}export function createSegmentIdResolver(_0x35be94,_0x13605c){return async _0x4c8da6=>{const _0x5d07da=a152_0x4f7b,_0x488d29=_0x35be94['get'](_0x4c8da6);if(!_0x488d29)throw new SDKError(ErrorCode[_0x5d07da(0x1ee)],_0x5d07da(0x1fe)+_0x4c8da6+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x13605c+'\x27)');return _0x488d29;};}export function extractRootFolderId(_0x1bc3c0){const _0x58b12e=a152_0x156079;return _0x1bc3c0[_0x58b12e(0x15c)]?.['parentSegmentFolder']?.[_0x58b12e(0x187)]?.['id']||_0x1bc3c0[_0x58b12e(0x15c)]?.[_0x58b12e(0x214)]?.[_0x58b12e(0x187)]?.['id'];}export function buildConnectionMaps(_0x29a8b9){const _0x5563aa=a152_0x156079,_0x296a12=new Map(),_0x5061e3=new Map(),_0x41e2f4=new Map();for(const _0x4d9a52 of _0x29a8b9){_0x296a12[_0x5563aa(0x174)](_0x4d9a52[_0x5563aa(0x1e6)],parseInt(_0x4d9a52['id'],0xa)),_0x5061e3['set'](_0x4d9a52['id'],_0x4d9a52[_0x5563aa(0x1e6)]),_0x41e2f4[_0x5563aa(0x174)](_0x4d9a52[_0x5563aa(0x1e6)],_0x4d9a52[_0x5563aa(0x217)]);}return{'nameToId':_0x296a12,'idToName':_0x5061e3,'nameToType':_0x41e2f4};}export function calculatePushStats(_0x3483da,_0xa5cfde,_0x2f8ad4,_0x1ebce2,_0x10cee7,_0xb3f5fb,_0x1baf21){const _0x40a436=a152_0x156079,_0x5c8667=_0x3483da['filter'](_0x2d704f=>_0x2d704f[_0x40a436(0x16f)]),_0x14c05d=_0x3483da[_0x40a436(0x207)](_0x425a6b=>!_0x425a6b[_0x40a436(0x16f)]&&_0x425a6b['hasChanges']),_0x5a7497=_0x3483da[_0x40a436(0x207)](_0x590b33=>!_0x590b33[_0x40a436(0x16f)]&&!_0x590b33['hasChanges']),_0x1b2507=_0xb3f5fb?_0x1ebce2:[],_0x44dcdb=_0xa5cfde[_0x40a436(0x207)](_0x24b954=>_0x24b954[_0x40a436(0x16f)]),_0x3fc6bb=_0xa5cfde['filter'](_0x1bc1d5=>!_0x1bc1d5[_0x40a436(0x16f)]&&_0x1bc1d5[_0x40a436(0x204)]),_0x189910=_0xa5cfde[_0x40a436(0x207)](_0x4aa9a8=>!_0x4aa9a8[_0x40a436(0x16f)]&&!_0x4aa9a8[_0x40a436(0x204)]),_0x4a86b6=_0xb3f5fb?_0x10cee7:[],_0x181644=_0x3483da[_0x40a436(0x1b8)](_0x5699b4=>_0x5699b4[_0x40a436(0x1fc)]),_0x1cbb63=_0x181644[_0x40a436(0x207)](_0x359bf9=>_0x359bf9['type']===_0x40a436(0x248)),_0x14381e=_0x181644[_0x40a436(0x207)](_0x5563d4=>_0x5563d4[_0x40a436(0x217)]===_0x40a436(0x179)),_0x5bca60=_0x181644[_0x40a436(0x207)](_0x970909=>_0x970909['type']===_0x40a436(0x224)),_0x938b4f=Array[_0x40a436(0x1c2)](_0x2f8ad4)['sort'](),_0x544589=_0x1baf21?![]:_0x5c8667['length']>0x0||_0x14c05d['length']>0x0||_0x1b2507['length']>0x0,_0x34d4aa=_0x44dcdb[_0x40a436(0x15f)]>0x0||_0x3fc6bb['length']>0x0||_0x4a86b6[_0x40a436(0x15f)]>0x0,_0x6c25b9=_0x1baf21?![]:_0x181644[_0x40a436(0x15f)]>0x0,_0x454d79=_0x938b4f[_0x40a436(0x15f)]>0x0;return{'segments':{'new':_0x5c8667,'changed':_0x14c05d,'unchanged':_0x5a7497,'toDelete':_0x1b2507},'journeys':{'new':_0x44dcdb,'changed':_0x3fc6bb,'unchanged':_0x189910,'toDelete':_0x4a86b6},'activations':{'all':_0x181644,'toCreate':_0x1cbb63,'toUpdate':_0x14381e,'toDelete':_0x5bca60},'folders':{'toCreate':_0x938b4f},'counts':{'segments':{'new':_0x5c8667[_0x40a436(0x15f)],'changed':_0x14c05d[_0x40a436(0x15f)],'unchanged':_0x5a7497[_0x40a436(0x15f)],'toDelete':_0x1b2507[_0x40a436(0x15f)]},'journeys':{'new':_0x44dcdb['length'],'changed':_0x3fc6bb[_0x40a436(0x15f)],'unchanged':_0x189910[_0x40a436(0x15f)],'toDelete':_0x4a86b6[_0x40a436(0x15f)]},'activations':{'create':_0x1cbb63[_0x40a436(0x15f)],'update':_0x14381e[_0x40a436(0x15f)],'delete':_0x5bca60[_0x40a436(0x15f)]},'folders':_0x938b4f[_0x40a436(0x15f)]},'hasChanges':_0x544589||_0x34d4aa||_0x6c25b9||_0x454d79};}export async function buildPushExecutionContext(_0x433e38,_0x3a135a,_0x2cef63,_0x489313,_0x2c5f3a,_0x205b25){const _0x3b6b7=a152_0x156079,_0x6dc1ab=extractRootFolderId(_0x2cef63),{pathToId:_0x26b382,idToPath:_0x2425fd}=buildFolderMaps(_0x2c5f3a),_0x3ed32e=buildSegmentNameToIdMap(_0x489313),_0x10a661=new Map(),{batchAsync:_0x12972b}=await import('../../utils/async.js'),[_0x48b197,_0x431646]=await Promise[_0x3b6b7(0x1d3)]([_0x433e38[_0x3b6b7(0x19d)][_0x3b6b7(0x231)](),_0x433e38[_0x3b6b7(0x249)]['list'](),((async()=>{!_0x205b25&&_0x489313['length']>0x0&&await _0x12972b(_0x489313,async _0x19231a=>{const _0x5ce8af=a152_0x4f7b,_0xfe543a=await _0x433e38[_0x5ce8af(0x1a7)][_0x5ce8af(0x198)](_0x3a135a,_0x19231a['id']);_0x10a661[_0x5ce8af(0x174)](_0x19231a['id'],_0xfe543a);});})())]),{emailToId:_0x591c41,idToEmail:_0x54855b}=_0x48b197,_0x575686=buildConnectionMaps(_0x431646);return{'rootFolderId':_0x6dc1ab,'folderPathToId':_0x26b382,'folderIdToPath':_0x2425fd,'segmentNameToId':_0x3ed32e,'activationsBySegmentId':_0x10a661,'emailToIdMap':_0x591c41,'idToEmailMap':_0x54855b,'connectionNameToIdMap':_0x575686['nameToId'],'connectionIdToNameMap':_0x575686[_0x3b6b7(0x1e9)],'connectionNameToTypeMap':_0x575686[_0x3b6b7(0x176)]};}export function createPushYamlContextForBundle(_0x4ee3e8,_0x4bab6e,_0x5df7a6,_0x1295a2,_0x506858,_0xe688a9,_0x4aa539,_0x15da74){const {existingLocalSegmentNames:_0x459e86,localExpandedRuleToNames:_0x389997}=_0x1295a2,_0x2cc5a5=new Set(),_0x1c9a5f=new Map(),_0x2a04a1=new Map(),_0x57bdb2=new Map(),_0xb29b6f=createJumpTargetCache(),_0x51a2b9=new Map(),_0x324e72=new Map(),_0x40fc00=new Set();let _0x2f4da9;const _0x46c03e=_0x382fc6=>{const _0x58de6f={'resolveSegment':async _0x3a6d1e=>{const _0x461831=a152_0x4f7b,_0x50dc32=_0x57bdb2[_0x461831(0x186)](_0x3a6d1e);if(_0x50dc32!==undefined)return{'name':_0x50dc32,'isJourneyLocal':!![]};try{const _0x45278f=await fetchSegment(_0x4ee3e8,_0x4bab6e,_0x3a6d1e,_0x5df7a6);if(!_0x45278f)throw new Error(_0x461831(0x156));const _0x5d0433=generateJourneyLocalName(_0x45278f[_0x461831(0x1e6)]),_0x40df5f=_0x45278f[_0x461831(0x1ba)]===SEGMENT_KIND_JOURNEY&&_0x5d0433!==undefined;let _0x11d486=_0x45278f[_0x461831(0x1e6)],_0x2cefb6;if(_0x40df5f&&_0x45278f[_0x461831(0x1a3)]){const _0x4b075c=apiRuleToYaml(_0x45278f[_0x461831(0x1a3)]);_0x324e72[_0x461831(0x174)](_0x3a6d1e,_0x4b075c);const _0x2142f2=async _0x148d6a=>{const _0x4b35cf=_0x461831,_0x3b697c=collectSegmentRefsFromRule(_0x148d6a);for(const _0x4eb074 of _0x3b697c){if(!_0x324e72['has'](_0x4eb074))try{const _0xb54dbb=await fetchSegment(_0x4ee3e8,_0x4bab6e,_0x4eb074,_0x5df7a6);if(_0xb54dbb?.[_0x4b35cf(0x1a3)]){const _0x380959=apiRuleToYaml(_0xb54dbb[_0x4b35cf(0x1a3)]);_0x324e72[_0x4b35cf(0x174)](_0x4eb074,_0x380959),await _0x2142f2(_0x380959);}}catch(_0x165403){logger[_0x4b35cf(0x19a)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x4eb074+':\x20'+_0x165403);}}};await _0x2142f2(_0x4b075c);const _0x294dac=serializeExpandedRule(_0x4b075c,_0x324e72),_0x7dab4c=_0x389997[_0x461831(0x186)](_0x294dac);if(_0x7dab4c&&_0x7dab4c['length']>0x0){const _0x476056=_0x1c9a5f[_0x461831(0x186)](_0x294dac)||0x0,_0x21dc52=_0x7dab4c[_0x476056]||_0x7dab4c[_0x7dab4c[_0x461831(0x15f)]-0x1];_0x1c9a5f['set'](_0x294dac,_0x476056+0x1),_0x11d486=_0x21dc52,_0x2cc5a5['add'](_0x11d486),_0x57bdb2[_0x461831(0x174)](_0x3a6d1e,_0x11d486);const _0x20b707=await resolveRuleSegmentRefs(_0x4b075c,async _0x5202b8=>{const _0x561b83=_0x461831,_0x2864cd=_0x57bdb2['get'](_0x5202b8);if(_0x2864cd)return _0x2864cd;const _0x4adb80=await _0x2f4da9[_0x561b83(0x17a)](_0x5202b8);return _0x4adb80[_0x561b83(0x1e6)];});_0x2cefb6={'description':_0x45278f['description'],'rule':_0x20b707};}else{const _0x23be66=_0x51a2b9[_0x461831(0x186)](_0x294dac);if(_0x23be66)_0x11d486=_0x23be66,_0x57bdb2['set'](_0x3a6d1e,_0x11d486);else{if(_0x5d0433){let _0x436a72=_0x5d0433,_0x5bcb77=0x2;while(_0x2cc5a5['has'](_0x436a72)||_0x459e86['has'](_0x436a72)){_0x436a72=_0x5d0433+'_'+_0x5bcb77,_0x5bcb77++;}_0x2cc5a5['add'](_0x436a72),_0x11d486=_0x436a72;}_0x57bdb2[_0x461831(0x174)](_0x3a6d1e,_0x11d486),_0x51a2b9[_0x461831(0x174)](_0x294dac,_0x11d486);const _0x351e02=await resolveRuleSegmentRefs(_0x4b075c,async _0x3c315e=>{const _0x1fa177=_0x461831,_0x5256d1=_0x57bdb2['get'](_0x3c315e);if(_0x5256d1)return _0x5256d1;const _0x145686=await _0x2f4da9[_0x1fa177(0x17a)](_0x3c315e);return _0x145686[_0x1fa177(0x1e6)];});_0x2cefb6={'description':_0x45278f[_0x461831(0x1ce)],'rule':_0x351e02};}}}return{'name':_0x11d486,'isJourneyLocal':_0x40df5f,'definition':_0x2cefb6};}catch(_0x4fd191){return logger['debug'](_0x461831(0x15a)+_0x3a6d1e+':\x20'+_0x4fd191),{'name':_0x3a6d1e,'isJourneyLocal':![]};}},'resolveActivation':async _0x3117f8=>{const _0x419033=a152_0x4f7b,_0xb5d7ac=_0x2a04a1['get'](_0x3117f8);if(_0xb5d7ac!==undefined)return{'name':_0xb5d7ac,'isJourneyLocal':!![]};try{let _0x22cd3e=_0x4aa539?.[_0x419033(0x186)](_0x3117f8);!_0x22cd3e&&(_0x22cd3e=await _0x4ee3e8['journey']['getActivation'](_0x382fc6,_0x3117f8));const _0x3b1ff=_0x22cd3e[_0x419033(0x1c5)]['activationParams'][_0x419033(0x1e6)]||_0x3117f8,_0x26c4fd=sanitizeYamlKey(_0x3b1ff)||'activation_'+_0x3117f8,_0x10b956=_0x26c4fd;_0x2a04a1[_0x419033(0x174)](_0x3117f8,_0x10b956);const _0x1e2fe5=journeyActivationStepToYaml(_0x22cd3e,_0x506858,_0xe688a9);return{'name':_0x10b956,'isJourneyLocal':!![],'definition':_0x1e2fe5};}catch(_0xa26081){return logger[_0x419033(0x19a)]('Failed\x20to\x20resolve\x20activation\x20'+_0x3117f8+':\x20'+_0xa26081),{'name':_0x3117f8,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5b10db,_0x1acab2)=>resolveJumpTarget(_0x5b10db,_0x1acab2,_0xb29b6f,async _0x43c85d=>{const _0x4c0e83=a152_0x4f7b,_0x18815c=_0x15da74?.[_0x4c0e83(0x186)](_0x43c85d);if(_0x18815c)return _0x18815c;return _0x4ee3e8[_0x4c0e83(0x20c)][_0x4c0e83(0x16e)](_0x43c85d);})};return _0x2f4da9=_0x58de6f,_0x58de6f;},_0x4dc8ad=async _0x5d5711=>{const _0xf26524=a152_0x4f7b,{collectSegmentIdsFromJourneyApi:_0x56bd50}=await import('./journey-yaml.js'),{batchAsync:_0x3b0638}=await import(_0xf26524(0x1ea)),_0x247a9a=new Set();for(const _0x46f4b9 of _0x5d5711){let _0x22e88e=_0x15da74?.[_0xf26524(0x186)](_0x46f4b9);!_0x22e88e&&(_0x22e88e=await _0x4ee3e8[_0xf26524(0x20c)][_0xf26524(0x16e)](_0x46f4b9));const _0x37af14=_0x56bd50(_0x22e88e);for(const _0x110b51 of _0x37af14){_0x247a9a[_0xf26524(0x193)](_0x110b51);}}let _0x2c2fe0=Array[_0xf26524(0x1c2)](_0x247a9a);while(_0x2c2fe0[_0xf26524(0x15f)]>0x0){const _0x4ec1e5=_0x2c2fe0['filter'](_0xad9683=>!_0x40fc00[_0xf26524(0x15d)](_0xad9683));if(_0x4ec1e5[_0xf26524(0x15f)]===0x0)break;const _0x23db8a=await _0x3b0638(_0x4ec1e5,async _0x59097f=>{const _0x1c7386=_0xf26524;_0x40fc00[_0x1c7386(0x193)](_0x59097f);const _0x5025f9=await fetchSegment(_0x4ee3e8,_0x4bab6e,_0x59097f,_0x5df7a6);if(!_0x5025f9)return null;return{'segmentId':_0x59097f,'segment':_0x5025f9};},0xa),_0x5635b5=new Set();for(const _0x4ecb4f of _0x23db8a){if(!_0x4ecb4f?.['segment']?.['rule'])continue;const _0x2f72a6=apiRuleToYaml(_0x4ecb4f[_0xf26524(0x1a7)][_0xf26524(0x1a3)]);_0x324e72[_0xf26524(0x174)](_0x4ecb4f[_0xf26524(0x158)],_0x2f72a6);const _0x10adc6=collectSegmentRefsFromRule(_0x2f72a6);for(const _0x2a0d71 of _0x10adc6){!_0x40fc00[_0xf26524(0x15d)](_0x2a0d71)&&_0x5635b5[_0xf26524(0x193)](_0x2a0d71);}}_0x2c2fe0=Array[_0xf26524(0x1c2)](_0x5635b5);}};return{'createYamlContext':_0x46c03e,'prefetchJourneySegments':_0x4dc8ad};}export async function executePushSegments(_0x408cb9,_0x57d62d,_0x12e11c,_0x43109a,_0x55dde1){const _0x1d11a8=a152_0x156079,{segmentDefToCreateRequest:_0xb7c9b2,segmentDefToUpdateRequest:_0x5683a0}=await import(_0x1d11a8(0x23c)),_0x59240a=_0x12e11c[_0x1d11a8(0x170)],_0x2b69af=0x5,_0x81a3c2=async _0x47d2b3=>{const _0x5d94a2=_0x1d11a8,_0x7e5cde=_0x47d2b3[_0x5d94a2(0x1f6)]?_0x59240a[_0x5d94a2(0x186)](_0x47d2b3[_0x5d94a2(0x1f6)]):undefined;let _0x7e6652;const _0x492fdd={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x4458e5=_0x47d2b3[_0x5d94a2(0x247)];if(_0x47d2b3[_0x5d94a2(0x247)][_0x5d94a2(0x1a3)]){const _0x1f5066=createSegmentIdResolver(_0x12e11c[_0x5d94a2(0x22d)],_0x47d2b3[_0x5d94a2(0x247)][_0x5d94a2(0x1e6)]),_0x13f94b=await resolveRuleSegmentIds(_0x47d2b3['yamlConfig'][_0x5d94a2(0x1a3)],_0x1f5066);_0x4458e5={..._0x47d2b3[_0x5d94a2(0x247)],'rule':_0x13f94b};}try{if(_0x47d2b3[_0x5d94a2(0x16f)]){_0x55dde1['onProgress']?.({'type':'segment_creating','name':_0x47d2b3[_0x5d94a2(0x247)]['name']});const _0x14b960=_0xb7c9b2(_0x4458e5,_0x7e5cde),_0x27d9e2=await _0x55dde1['withProgress'](_0x5d94a2(0x1b1)+_0x47d2b3[_0x5d94a2(0x247)][_0x5d94a2(0x1e6)]+_0x5d94a2(0x1a5),()=>_0x408cb9['segment'][_0x5d94a2(0x157)](_0x43109a['parentId'],_0x14b960));_0x7e6652=_0x27d9e2[_0x5d94a2(0x187)]['id'],_0x12e11c[_0x5d94a2(0x22d)][_0x5d94a2(0x174)](_0x47d2b3[_0x5d94a2(0x247)]['name'],_0x7e6652),_0x492fdd['createdSegmentId']={'name':_0x47d2b3[_0x5d94a2(0x247)][_0x5d94a2(0x1e6)],'id':_0x7e6652},_0x55dde1[_0x5d94a2(0x1f1)]?.({'type':_0x5d94a2(0x223),'name':_0x47d2b3[_0x5d94a2(0x247)][_0x5d94a2(0x1e6)],'segmentId':_0x7e6652}),_0x55dde1[_0x5d94a2(0x206)]?.(_0x5d94a2(0x1fd)+_0x47d2b3['yamlConfig']['name']+'\x27'),_0x492fdd[_0x5d94a2(0x22b)]=0x1;}else{if(_0x47d2b3[_0x5d94a2(0x204)]){_0x55dde1[_0x5d94a2(0x1f1)]?.({'type':'segment_updating','name':_0x47d2b3[_0x5d94a2(0x247)]['name']});const _0x48c48b=_0x5683a0(_0x4458e5);_0x7e5cde!==_0x47d2b3['existingSegment']?.[_0x5d94a2(0x163)]&&(_0x48c48b[_0x5d94a2(0x163)]=_0x7e5cde?parseInt(_0x7e5cde,0xa):undefined),await _0x55dde1[_0x5d94a2(0x236)](_0x5d94a2(0x180)+_0x47d2b3[_0x5d94a2(0x247)]['name']+_0x5d94a2(0x1a5),()=>_0x408cb9[_0x5d94a2(0x1a7)][_0x5d94a2(0x1cc)](_0x43109a[_0x5d94a2(0x211)],_0x47d2b3[_0x5d94a2(0x226)]['id'],_0x48c48b)),_0x7e6652=_0x47d2b3['existingSegment']['id'],_0x55dde1[_0x5d94a2(0x1f1)]?.({'type':'segment_updated','name':_0x47d2b3['yamlConfig']['name']}),_0x55dde1['logSuccess']?.('Updated\x20segment\x20\x27'+_0x47d2b3[_0x5d94a2(0x247)]['name']+'\x27'),_0x492fdd[_0x5d94a2(0x21b)]=0x1;}else _0x7e6652=_0x47d2b3[_0x5d94a2(0x226)]['id'];}}catch(_0xb4c8ed){const _0x3f3ec8=isHttp400Error(_0xb4c8ed),_0x4b3315=_0x3f3ec8?ErrorCode[_0x5d94a2(0x1c3)]:ErrorCode[_0x5d94a2(0x164)],_0x4c9f2a=getErrorMessage(_0xb4c8ed);throw new SDKError(_0x4b3315,_0x5d94a2(0x20a)+(_0x47d2b3[_0x5d94a2(0x16f)]?_0x5d94a2(0x248):_0x5d94a2(0x179))+_0x5d94a2(0x171)+_0x47d2b3[_0x5d94a2(0x210)]+_0x5d94a2(0x1f5)+_0x4c9f2a,_0xb4c8ed);}try{const _0x71fee9=await syncActivationsForSegment(_0x408cb9,_0x43109a['parentId'],_0x7e6652,_0x47d2b3[_0x5d94a2(0x247)]['name'],_0x47d2b3[_0x5d94a2(0x1fc)],_0x55dde1,_0x47d2b3['absolutePath']);_0x492fdd[_0x5d94a2(0x239)]=_0x71fee9;}catch(_0x4cdeb6){if(_0x4cdeb6 instanceof SDKError)throw _0x4cdeb6;throw new SDKError(ErrorCode[_0x5d94a2(0x191)],_0x5d94a2(0x1c6)+_0x47d2b3['yamlConfig'][_0x5d94a2(0x1e6)]+_0x5d94a2(0x1d2)+_0x47d2b3[_0x5d94a2(0x210)]+_0x5d94a2(0x1f5)+getErrorMessage(_0x4cdeb6),_0x4cdeb6);}return _0x492fdd;},_0xcbd2b3=await batchAsync(_0x57d62d,_0x81a3c2,_0x2b69af),_0x57a4c6={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1b4a0e of _0xcbd2b3){_0x57a4c6[_0x1d11a8(0x22b)]+=_0x1b4a0e[_0x1d11a8(0x22b)],_0x57a4c6[_0x1d11a8(0x21b)]+=_0x1b4a0e[_0x1d11a8(0x21b)],_0x1b4a0e[_0x1d11a8(0x17b)]&&_0x57a4c6[_0x1d11a8(0x23e)]['set'](_0x1b4a0e[_0x1d11a8(0x17b)][_0x1d11a8(0x1e6)],_0x1b4a0e[_0x1d11a8(0x17b)]['id']),_0x57a4c6['activations'][_0x1d11a8(0x22b)]+=_0x1b4a0e[_0x1d11a8(0x239)][_0x1d11a8(0x22b)],_0x57a4c6[_0x1d11a8(0x239)]['updated']+=_0x1b4a0e[_0x1d11a8(0x239)][_0x1d11a8(0x21b)],_0x57a4c6['activations'][_0x1d11a8(0x1aa)]+=_0x1b4a0e['activations'][_0x1d11a8(0x1aa)];}return _0x57a4c6;}async function syncActivationsForSegment(_0x3cbba5,_0x135101,_0x5a7334,_0xa24500,_0x456280,_0x1aac46,_0x2db178){const _0x3a8f42=a152_0x156079,_0xcdf02b={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xc046e1 of _0x456280){try{if(_0xc046e1[_0x3a8f42(0x217)]==='create'&&_0xc046e1[_0x3a8f42(0x23d)])_0x1aac46[_0x3a8f42(0x1f1)]?.({'type':'activation_creating','segmentName':_0xa24500,'activationName':_0xc046e1[_0x3a8f42(0x1e6)]}),await _0x1aac46[_0x3a8f42(0x236)]('Creating\x20activation\x20\x27'+_0xc046e1[_0x3a8f42(0x1e6)]+_0x3a8f42(0x1a5),()=>_0x3cbba5['segment'][_0x3a8f42(0x22f)](_0x135101,_0x5a7334,_0xc046e1[_0x3a8f42(0x23d)])),_0x1aac46['onProgress']?.({'type':'activation_created','segmentName':_0xa24500,'activationName':_0xc046e1[_0x3a8f42(0x1e6)]}),_0x1aac46[_0x3a8f42(0x206)]?.(_0x3a8f42(0x1ae)+_0xc046e1[_0x3a8f42(0x1e6)]+'\x27'),_0xcdf02b[_0x3a8f42(0x22b)]++;else{if(_0xc046e1[_0x3a8f42(0x217)]===_0x3a8f42(0x179)&&_0xc046e1[_0x3a8f42(0x23d)]&&_0xc046e1[_0x3a8f42(0x244)])_0x1aac46[_0x3a8f42(0x1f1)]?.({'type':_0x3a8f42(0x15b),'segmentName':_0xa24500,'activationName':_0xc046e1['name']}),await _0x1aac46[_0x3a8f42(0x236)](_0x3a8f42(0x1a1)+_0xc046e1[_0x3a8f42(0x1e6)]+_0x3a8f42(0x1a5),()=>_0x3cbba5[_0x3a8f42(0x1a7)][_0x3a8f42(0x1dc)](_0x135101,_0x5a7334,_0xc046e1[_0x3a8f42(0x244)]['id'],_0xc046e1['validatedRequest'])),_0x1aac46[_0x3a8f42(0x1f1)]?.({'type':'activation_updated','segmentName':_0xa24500,'activationName':_0xc046e1['name']}),_0x1aac46[_0x3a8f42(0x206)]?.('Updated\x20activation\x20\x27'+_0xc046e1[_0x3a8f42(0x1e6)]+'\x27'),_0xcdf02b[_0x3a8f42(0x21b)]++;else _0xc046e1['type']===_0x3a8f42(0x224)&&_0xc046e1['existingActivation']&&(_0x1aac46[_0x3a8f42(0x1f1)]?.({'type':_0x3a8f42(0x172),'segmentName':_0xa24500,'activationName':_0xc046e1[_0x3a8f42(0x1e6)]}),await _0x1aac46['withProgress'](_0x3a8f42(0x1bb)+_0xc046e1['name']+_0x3a8f42(0x1a5),()=>_0x3cbba5[_0x3a8f42(0x1a7)][_0x3a8f42(0x1d5)](_0x135101,_0x5a7334,_0xc046e1[_0x3a8f42(0x244)]['id'])),_0x1aac46[_0x3a8f42(0x1f1)]?.({'type':'activation_deleted','segmentName':_0xa24500,'activationName':_0xc046e1[_0x3a8f42(0x1e6)]}),_0x1aac46['logDeleted']?.('Deleted\x20activation\x20\x27'+_0xc046e1['name']+'\x27'),_0xcdf02b[_0x3a8f42(0x1aa)]++);}}catch(_0x1e0a8e){const _0x13578a=isHttp400Error(_0x1e0a8e),_0x2dc580=_0x13578a?ErrorCode[_0x3a8f42(0x1b2)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x29b8d0=getErrorMessage(_0x1e0a8e);throw new SDKError(_0x2dc580,_0x3a8f42(0x20a)+_0xc046e1['type']+_0x3a8f42(0x1cf)+_0xc046e1[_0x3a8f42(0x1e6)]+_0x3a8f42(0x1d2)+_0x2db178+_0x3a8f42(0x1f5)+_0x29b8d0,_0x1e0a8e);}}return _0xcdf02b;}export async function executePushFolders(_0x29b794,_0x185584,_0x5dc563,_0x5841ba,_0x1108f3){const _0xfdc187=a152_0x156079,_0x9ed311=new Map(_0x5dc563),_0x566a02=sortFoldersByDepth(_0x185584);for(const _0x427dfc of _0x566a02){const _0x3a5edd=_0x427dfc[_0xfdc187(0x1da)]('/'),_0x50dfea=_0x3a5edd[_0x3a5edd[_0xfdc187(0x15f)]-0x1],_0x2ce26f=_0x3a5edd[_0xfdc187(0x1d8)](0x0,-0x1)[_0xfdc187(0x15e)]('/'),_0x390892=_0x9ed311['get'](_0x2ce26f);_0x1108f3['onProgress']?.({'type':'folder_creating','folder':_0x427dfc});const _0x12af80={'name':_0x50dfea,'parentFolderId':_0x390892},_0x2f34b4=await _0x1108f3[_0xfdc187(0x236)](_0xfdc187(0x161)+_0x427dfc+_0xfdc187(0x1a5),()=>_0x29b794[_0xfdc187(0x1a7)][_0xfdc187(0x1c8)](_0x5841ba[_0xfdc187(0x211)],_0x12af80));_0x9ed311[_0xfdc187(0x174)](_0x427dfc,_0x2f34b4[_0xfdc187(0x187)]['id']),_0x1108f3[_0xfdc187(0x1f1)]?.({'type':_0xfdc187(0x1ca),'folder':_0x427dfc,'folderId':_0x2f34b4[_0xfdc187(0x187)]['id']}),_0x1108f3[_0xfdc187(0x1b0)]?.(_0xfdc187(0x1ef)+_0x427dfc+'\x27');}return _0x9ed311;}export async function executePushSegmentDeletions(_0xc8bb02,_0x3940b8,_0x22e110){const _0x1c1d4d=a152_0x156079;if(_0x3940b8[_0x1c1d4d(0x15f)]===0x0)return 0x0;const {batchAsync:_0x177cc5}=await import('../../utils/async.js'),_0x5cc324=0x5,_0x4fe83b=await _0x177cc5(_0x3940b8,async _0x59f891=>{const _0x1ecf34=_0x1c1d4d;return _0x22e110[_0x1ecf34(0x1f1)]?.({'type':'segment_deleting','name':_0x59f891['name']}),await _0xc8bb02[_0x1ecf34(0x1a7)][_0x1ecf34(0x1d4)](_0x59f891['id']),_0x22e110['onProgress']?.({'type':_0x1ecf34(0x232),'name':_0x59f891['name']}),_0x22e110['logDeleted']?.(_0x1ecf34(0x221)+_0x59f891['name']+'\x27'),0x1;},_0x5cc324);return _0x4fe83b[_0x1c1d4d(0x1e7)]((_0x252b43,_0x59cf42)=>_0x252b43+_0x59cf42,0x0);}export async function executePushJourneys(_0x492988,_0x4f524f,_0x1cbd29,_0x1b3352,_0x4ec68b){const _0x4cd9ce=a152_0x156079,{journeyDefToRequest:_0x4d8132}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x5dfd31,yamlRuleToApi:_0x3238e7,validateSegmentRule:_0x79cd52}=await import('./child-segment-yaml.js'),_0x231654={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2543d9=new Map(_0x1cbd29[_0x4cd9ce(0x22d)]),_0x74db7c=0x5;for(let _0x51214c=0x0;_0x51214c<_0x4f524f[_0x4cd9ce(0x15f)];_0x51214c+=_0x74db7c){const _0x24def4=_0x4f524f['slice'](_0x51214c,_0x51214c+_0x74db7c),_0x38c14a=await Promise[_0x4cd9ce(0x1d3)](_0x24def4[_0x4cd9ce(0x1b4)](async _0x37186d=>{const _0x3b5bcb=_0x4cd9ce;if(!_0x37186d['isNew']&&!_0x37186d[_0x3b5bcb(0x204)])return{'action':_0x3b5bcb(0x1c7),'name':_0x37186d[_0x3b5bcb(0x247)]['name'],'journeyId':_0x37186d[_0x3b5bcb(0x19b)]?.['id']};const _0x5d648d=_0x37186d[_0x3b5bcb(0x1f6)]?_0x1cbd29[_0x3b5bcb(0x170)]['get'](_0x37186d['folderPath']):undefined;_0x4ec68b['onProgress']?.({'type':_0x37186d['isNew']?_0x3b5bcb(0x1ed):_0x3b5bcb(0x166),'name':_0x37186d['yamlConfig'][_0x3b5bcb(0x1e6)]});try{const _0x4b3767=await executeSingleJourneyPush(_0x492988,_0x37186d,{..._0x1cbd29,'segmentNameToId':_0x2543d9},{'parentId':_0x1b3352['parentId'],'rootFolderId':_0x1b3352[_0x3b5bcb(0x1a4)],'folderId':_0x5d648d,'verbose':_0x1b3352[_0x3b5bcb(0x21d)]},_0x4ec68b,{'journeyDefToRequest':_0x4d8132,'activationDefToCreateRequest':_0x5dfd31,'yamlRuleToApi':_0x3238e7,'validateSegmentRule':_0x79cd52});for(const [_0x25c328,_0x429b06]of _0x4b3767['embeddedSegmentNameToId']){_0x2543d9['set'](_0x25c328,_0x429b06),_0x231654[_0x3b5bcb(0x1a9)][_0x3b5bcb(0x174)](_0x25c328,_0x429b06);}if(_0x4b3767[_0x3b5bcb(0x1e8)]===_0x3b5bcb(0x22b))_0x4ec68b[_0x3b5bcb(0x1f1)]?.({'type':_0x3b5bcb(0x1be),'name':_0x37186d[_0x3b5bcb(0x247)][_0x3b5bcb(0x1e6)],'journeyId':_0x4b3767[_0x3b5bcb(0x20e)]}),_0x4ec68b[_0x3b5bcb(0x206)]?.(_0x3b5bcb(0x18b)+_0x37186d['yamlConfig'][_0x3b5bcb(0x1e6)]+'\x27'),_0x231654[_0x3b5bcb(0x22b)]++;else _0x4b3767[_0x3b5bcb(0x1e8)]==='updated'&&(_0x4ec68b[_0x3b5bcb(0x1f1)]?.({'type':_0x3b5bcb(0x153),'name':_0x37186d[_0x3b5bcb(0x247)][_0x3b5bcb(0x1e6)]}),_0x4ec68b['logSuccess']?.(_0x3b5bcb(0x233)+_0x37186d['yamlConfig'][_0x3b5bcb(0x1e6)]+'\x27'),_0x231654['updated']++);return{'action':_0x4b3767[_0x3b5bcb(0x1e8)],'name':_0x37186d[_0x3b5bcb(0x247)][_0x3b5bcb(0x1e6)],'journeyId':_0x4b3767[_0x3b5bcb(0x20e)]};}catch(_0x2e14bd){const _0x1c27ab=isHttp400Error(_0x2e14bd),_0x412130=_0x1c27ab?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x56d120=getErrorMessage(_0x2e14bd);throw new SDKError(_0x412130,_0x3b5bcb(0x20a)+(_0x37186d[_0x3b5bcb(0x16f)]?_0x3b5bcb(0x248):_0x3b5bcb(0x179))+_0x3b5bcb(0x225)+_0x37186d['absolutePath']+_0x3b5bcb(0x1f5)+_0x56d120,_0x2e14bd);}}));_0x231654[_0x4cd9ce(0x18e)]['push'](..._0x38c14a);}return _0x231654;}async function matchExistingJourneySegments(_0x29c4b2,_0x2988a7,_0x28dc61,_0x515f71,_0x4f7908){const _0x36ac4a=a152_0x156079;if(!_0x2988a7[_0x36ac4a(0x19b)]||!_0x2988a7[_0x36ac4a(0x247)]['segments'])return;const _0x26e6a0=new Map(),_0x462cc2=new Set();for(const _0x370fd4 of Object[_0x36ac4a(0x230)](_0x2988a7[_0x36ac4a(0x247)][_0x36ac4a(0x202)])){const _0xd69611=generateDeterministicJourneySegmentName(_0x2988a7[_0x36ac4a(0x247)][_0x36ac4a(0x1e6)],_0x370fd4);_0x26e6a0[_0x36ac4a(0x174)](_0xd69611,_0x370fd4),_0x462cc2[_0x36ac4a(0x193)](_0x370fd4);}const _0x456115=[],_0x1ebe91=collectSegmentIdsFromJourneyApi(_0x2988a7[_0x36ac4a(0x19b)]);for(const _0x42e646 of _0x1ebe91){const _0x104890=await fetchSegment(_0x29c4b2,_0x28dc61,_0x42e646,_0x515f71);if(!_0x104890?.[_0x36ac4a(0x1e6)])continue;const _0x41b697=_0x26e6a0[_0x36ac4a(0x186)](_0x104890[_0x36ac4a(0x1e6)]);_0x41b697?(_0x4f7908[_0x36ac4a(0x174)](_0x41b697,_0x42e646),_0x462cc2[_0x36ac4a(0x224)](_0x41b697)):_0x456115[_0x36ac4a(0x241)]({'id':_0x42e646,'seg':_0x104890});}if(_0x462cc2['size']>0x0&&_0x456115[_0x36ac4a(0x15f)]>0x0){const {localExpandedRuleToNames:_0x175b0d}=buildLocalExpandedRuleMappings(_0x2988a7[_0x36ac4a(0x247)]),_0x5c6567=new Map();for(const {id:_0x789976,seg:_0x5a3a71}of _0x456115){if(_0x5a3a71[_0x36ac4a(0x1a3)]){const _0xd251c5=apiRuleToYaml(_0x5a3a71[_0x36ac4a(0x1a3)]);_0x5c6567[_0x36ac4a(0x174)](_0x789976,_0xd251c5);}}for(const {id:_0x22d0a,seg:_0x166213}of _0x456115){if(!_0x166213[_0x36ac4a(0x1a3)])continue;const _0x2c5531=_0x5c6567['get'](_0x22d0a);if(!_0x2c5531)continue;const _0x4bbf14=serializeExpandedRule(_0x2c5531,_0x5c6567),_0x5eebe2=_0x175b0d[_0x36ac4a(0x186)](_0x4bbf14);if(_0x5eebe2){const _0x49ccdc=_0x5eebe2['find'](_0x1f4318=>_0x462cc2[_0x36ac4a(0x15d)](_0x1f4318));_0x49ccdc&&(_0x4f7908[_0x36ac4a(0x174)](_0x49ccdc,_0x22d0a),_0x462cc2[_0x36ac4a(0x224)](_0x49ccdc),logger[_0x36ac4a(0x19a)](_0x36ac4a(0x192)+_0x166213[_0x36ac4a(0x1e6)]+'\x27\x20to\x20local\x20\x27'+_0x49ccdc+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x1c17c4,_0x207455,_0x1c36d4,_0x1d60bb,_0x3c1f36,_0x56dd71){const _0x371072=a152_0x156079,{journeyDefToRequest:_0x159df6,activationDefToCreateRequest:_0x4efa3a,yamlRuleToApi:_0x2fe1df,validateSegmentRule:_0x5a9a30}=_0x56dd71,_0x5f02c0=new Map(),_0x173557=new Map();recoverSegmentIdsFromPushRecovery(_0x207455,_0x5f02c0,_0x1c36d4['segmentNameToId']);const _0x3cd8bb=new Map(),_0x165f3f=new Map(),_0xccf4b0=new Map();let _0x358d64;const _0x3fff16=async()=>{const _0x38b343=a152_0x4f7b;if(_0x358d64)return;_0x358d64=new Map();if(!_0x207455['existingJourney'])return;const _0x2e53ae=await _0x1c17c4[_0x38b343(0x20c)][_0x38b343(0x198)](_0x207455[_0x38b343(0x19b)]['id']);for(const _0x3a8ad8 of _0x2e53ae){const _0x28539d=journeyActivationStepToYaml(_0x3a8ad8,_0x1c36d4[_0x38b343(0x234)],_0x1c36d4['connectionIdToNameMap']),_0x2fffee=activationSignature(_0x28539d);!_0x358d64[_0x38b343(0x15d)](_0x2fffee)&&_0x358d64[_0x38b343(0x174)](_0x2fffee,_0x3a8ad8['id']),_0x28539d[_0x38b343(0x1e6)]&&_0x173557[_0x38b343(0x174)](_0x28539d['name'],_0x3a8ad8['id']);}};await matchExistingJourneySegments(_0x1c17c4,_0x207455,_0x1d60bb[_0x371072(0x211)],_0x1c36d4['existingSegments'],_0x1c36d4['segmentNameToId']);const _0x3212d4={'resolveSegmentId':async _0x366330=>{const _0x3a6bdd=_0x371072,_0x37b597=_0x1c36d4[_0x3a6bdd(0x22d)]['get'](_0x366330);if(!_0x37b597)throw new SDKError(ErrorCode[_0x3a6bdd(0x1ee)],_0x3a6bdd(0x1fe)+_0x366330+_0x3a6bdd(0x1e0)+_0x207455[_0x3a6bdd(0x247)][_0x3a6bdd(0x1e6)]+')');return _0x37b597;},'resolveEmbeddedSegmentId':async(_0x2c0cc3,_0x541cb6)=>{const _0x5e5a78=_0x371072,_0x5575fc=_0x1c36d4[_0x5e5a78(0x22d)][_0x5e5a78(0x186)](_0x2c0cc3);if(_0x5575fc)return _0x5575fc;const _0x3d4ec8=_0x1c36d4['existingSegments']['find'](_0x2c5109=>_0x2c5109[_0x5e5a78(0x1e6)]===_0x2c0cc3);if(_0x3d4ec8)return _0x1c36d4['segmentNameToId'][_0x5e5a78(0x174)](_0x2c0cc3,_0x3d4ec8['id']),_0x3d4ec8['id'];if(_0x207455[_0x5e5a78(0x16f)]){const {stageName:_0x3ea6c6,criteriaName:_0x471fca}=findSegmentCriteriaLocation(_0x207455['yamlConfig'],_0x2c0cc3);return _0x5a9a30(_0x2c0cc3,_0x541cb6[_0x5e5a78(0x1a3)]),_0x165f3f[_0x5e5a78(0x174)](_0x2c0cc3,{'definition':_0x541cb6,'stageName':_0x3ea6c6,'criteriaName':_0x471fca}),createPendingSegmentId(_0x2c0cc3);}const _0x47150b=_0x207455[_0x5e5a78(0x19b)]?.['id'];if(!_0x47150b)throw new SDKError(ErrorCode[_0x5e5a78(0x1ad)],_0x5e5a78(0x17e));const _0x2bea73=_0x3cd8bb['get'](_0x2c0cc3);if(_0x2bea73)return _0x2bea73;const _0xebf00=((async()=>{const _0x224cbe=_0x5e5a78;_0x5a9a30(_0x2c0cc3,_0x541cb6[_0x224cbe(0x1a3)]);const _0x1a921d=generateDeterministicJourneySegmentName(_0x207455[_0x224cbe(0x247)]['name'],_0x2c0cc3),_0x42285a=_0x1c36d4[_0x224cbe(0x1df)][_0x224cbe(0x168)](_0x3fab7b=>_0x3fab7b['name']===_0x1a921d),_0x21bb78=createSegmentIdResolver(_0x1c36d4[_0x224cbe(0x22d)],_0x2c0cc3),_0x4aee23=await resolveRuleSegmentIds(_0x541cb6[_0x224cbe(0x1a3)],_0x21bb78);let _0x4ac438;return _0x42285a?(await _0x1c17c4[_0x224cbe(0x1a7)][_0x224cbe(0x1cc)](_0x1d60bb[_0x224cbe(0x211)],_0x42285a['id'],{'description':_0x541cb6[_0x224cbe(0x1ce)]||_0x224cbe(0x197)+_0x2c0cc3,'rule':_0x2fe1df(_0x4aee23),'countPopulation':!![]}),_0x4ac438=_0x42285a['id'],saveSegmentToPushRecovery(_0x207455['absolutePath'],_0x207455['yamlConfig'][_0x224cbe(0x1e6)],_0x2c0cc3,{'segmentId':_0x4ac438,'uniqueServerName':_0x1a921d,'createdAt':new Date()['toISOString']()})):_0x4ac438=await createOrRecoverEmbeddedSegment(_0x1c17c4,_0x207455,{'localName':_0x2c0cc3,'uniqueSegmentName':_0x1a921d,'description':_0x541cb6['description']||_0x224cbe(0x197)+_0x2c0cc3,'journeyId':_0x47150b,'resolvedRule':_0x4aee23,'parentId':_0x1d60bb['parentId'],'folderId':_0x1d60bb[_0x224cbe(0x1a4)]||''},_0x2fe1df),_0x1c36d4[_0x224cbe(0x22d)][_0x224cbe(0x174)](_0x2c0cc3,_0x4ac438),_0x5f02c0['set'](_0x2c0cc3,_0x4ac438),_0x4ac438;})());_0x3cd8bb[_0x5e5a78(0x174)](_0x2c0cc3,_0xebf00);try{return await _0xebf00;}finally{_0x3cd8bb['delete'](_0x2c0cc3);}},'resolveActivationId':async _0x1b9800=>{const _0xb58659=_0x371072,_0x3ec7cb=_0x173557[_0xb58659(0x186)](_0x1b9800);if(_0x3ec7cb)return _0x3ec7cb;if(_0x207455['existingJourney']){await _0x3fff16();const _0x5ab609=_0x173557[_0xb58659(0x186)](_0x1b9800);if(_0x5ab609)return _0x5ab609;}throw new SDKError(ErrorCode[_0xb58659(0x1b7)],_0xb58659(0x21a)+_0x1b9800+_0xb58659(0x1e0)+_0x207455[_0xb58659(0x247)][_0xb58659(0x1e6)]+_0xb58659(0x188)+_0xb58659(0x196));},'resolveEmbeddedActivationId':async(_0x4729d9,_0x36d7c5)=>{const _0x233cd3=_0x371072,_0x33dc7b=_0x173557['get'](_0x4729d9);if(_0x33dc7b)return _0x33dc7b;if(_0x207455[_0x233cd3(0x16f)])return _0xccf4b0[_0x233cd3(0x174)](_0x4729d9,_0x36d7c5),createPendingActivationId(_0x4729d9);if(_0x207455[_0x233cd3(0x19b)]){await _0x3fff16();const _0x12d23a=_0x173557[_0x233cd3(0x186)](_0x36d7c5[_0x233cd3(0x1e6)]);if(_0x12d23a)return _0x173557[_0x233cd3(0x174)](_0x4729d9,_0x12d23a),_0x12d23a;const _0x35c354=activationSignature(_0x36d7c5),_0x59528c=_0x358d64?.[_0x233cd3(0x186)](_0x35c354);if(_0x59528c)return _0x173557['set'](_0x4729d9,_0x59528c),_0x59528c;const _0x19ba4c=await _0x4efa3a(_0x36d7c5,_0x1c36d4[_0x233cd3(0x229)]),_0x10b589={..._0x19ba4c,..._0x36d7c5[_0x233cd3(0x24a)]!==undefined&&{'runAfterJourneyRefresh':_0x36d7c5['run_after_journey_refresh']}},_0x587417=await _0x1c17c4[_0x233cd3(0x20c)][_0x233cd3(0x22f)](_0x207455['existingJourney']['id'],_0x10b589);return _0x173557['set'](_0x4729d9,_0x587417['id']),_0x587417['id'];}throw new SDKError(ErrorCode[_0x233cd3(0x1ad)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x50f1d4=>{const _0xbd7680=_0x371072;try{return await _0x1c17c4[_0xbd7680(0x20c)][_0xbd7680(0x160)](_0x1d60bb[_0xbd7680(0x211)],_0x50f1d4);}catch(_0x5d9b98){throw new SDKError(ErrorCode[_0xbd7680(0x1b7)],_0xbd7680(0x195)+_0x50f1d4+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x207455[_0xbd7680(0x247)][_0xbd7680(0x1e6)]+'\x27)',_0x5d9b98);}},'resolveStageId':async(_0x6d9558,_0x49aaef)=>{const _0x1fa083=_0x371072,_0x173aef=await _0x1c17c4[_0x1fa083(0x20c)][_0x1fa083(0x16e)](_0x6d9558),_0x49fbc9=_0x173aef[_0x1fa083(0x1c5)][_0x1fa083(0x162)]['find'](_0x278c4f=>_0x278c4f[_0x1fa083(0x1e6)][_0x1fa083(0x21e)]()===_0x49aaef[_0x1fa083(0x21e)]());if(!_0x49fbc9?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x1fa083(0x17c)+_0x49aaef+_0x1fa083(0x21f)+(_0x173aef['attributes'][_0x1fa083(0x17f)]||_0x173aef[_0x1fa083(0x1c5)]['name'])+'\x27');return _0x49fbc9['id'];}},_0x52869b=await _0x159df6(_0x207455[_0x371072(0x247)],_0x1d60bb[_0x371072(0x211)],_0x3212d4),_0x45a70f=_0x1d60bb[_0x371072(0x1a6)]||_0x1d60bb['rootFolderId'];_0x45a70f&&(_0x52869b[_0x371072(0x15c)]={'parentFolder':{'data':{'id':_0x45a70f,'type':_0x371072(0x16c)}}});if(_0x207455[_0x371072(0x16f)]){if(_0x165f3f[_0x371072(0x22e)]>0x0||_0xccf4b0[_0x371072(0x22e)]>0x0)return await executeThreeStepJourneyCreate(_0x1c17c4,_0x207455,_0x52869b,{'pendingEmbeddedSegments':_0x165f3f,'pendingEmbeddedActivations':_0xccf4b0,'embeddedSegmentNameToId':_0x5f02c0,'journeyActivationNameToId':_0x173557},{..._0x1d60bb,'effectiveFolderId':_0x45a70f},_0x1c36d4,_0x3c1f36,_0x56dd71);else{ensureJourneyDefaults(_0x52869b[_0x371072(0x1c5)]);const _0x91face=await _0x1c17c4['journey'][_0x371072(0x248)](_0x52869b);return deletePushRecovery(_0x207455['absolutePath']),{'action':_0x371072(0x22b),'journeyId':_0x91face['id'],'embeddedSegmentNameToId':_0x5f02c0};}}else{if(_0x207455[_0x371072(0x204)]&&_0x207455[_0x371072(0x19b)]){_0x52869b['id']=_0x207455[_0x371072(0x19b)]['id'];const _0x397048=_0x52869b['attributes'];_0x207455[_0x371072(0x19b)][_0x371072(0x1c5)]?.['journeyBundleName']&&(_0x397048[_0x371072(0x17f)]=_0x207455[_0x371072(0x19b)][_0x371072(0x1c5)]['journeyBundleName']);const _0x45d30e=_0x207455[_0x371072(0x19b)][_0x371072(0x1c5)]?.[_0x371072(0x162)];return _0x45d30e&&_0x52869b['attributes'][_0x371072(0x162)]&&injectExistingStageIds(_0x52869b[_0x371072(0x1c5)][_0x371072(0x162)],_0x45d30e),ensureJourneyDefaults(_0x397048),await _0x1c17c4['journey'][_0x371072(0x179)](_0x207455[_0x371072(0x19b)]['id'],_0x52869b),deletePushRecovery(_0x207455['absolutePath']),{'action':'updated','journeyId':_0x207455[_0x371072(0x19b)]['id'],'embeddedSegmentNameToId':_0x5f02c0};}}return deletePushRecovery(_0x207455[_0x371072(0x210)]),{'action':'unchanged','journeyId':_0x207455[_0x371072(0x19b)]?.['id'],'embeddedSegmentNameToId':_0x5f02c0};}function findSegmentCriteriaLocation(_0x42b912,_0x23422f){const _0x584a92=a152_0x156079,_0xe9324c=_0x42b912['stages']||_0x42b912[_0x584a92(0x189)]?.[0x0]?.[_0x584a92(0x16b)]||[];let _0x189219=_0x584a92(0x1dd),_0x3e0244=_0x23422f;const _0x3774ce=_0x42b912[_0x584a92(0x190)]||_0x42b912[_0x584a92(0x189)]?.[0x0]?.[_0x584a92(0x190)];if(_0x3774ce?.[_0x584a92(0x1a7)]===_0x23422f)return{'stageName':_0x584a92(0x190),'criteriaName':_0x3774ce[_0x584a92(0x1e6)]||_0x23422f};_0x11747a:for(const _0x3a1b01 of _0xe9324c){if(_0x3a1b01[_0x584a92(0x218)]?.['segment']===_0x23422f){_0x189219=_0x3a1b01[_0x584a92(0x1e6)],_0x3e0244=_0x3a1b01[_0x584a92(0x218)][_0x584a92(0x1e6)]||_0x23422f;break;}if(_0x3a1b01[_0x584a92(0x1d1)])for(const _0x126351 of _0x3a1b01[_0x584a92(0x1d1)]){if(_0x126351[_0x584a92(0x217)]===_0x584a92(0x1c1)&&_0x126351[_0x584a92(0x16d)]?.[_0x584a92(0x1f0)])for(const _0x20f6d1 of _0x126351['with'][_0x584a92(0x1f0)]){if(_0x20f6d1[_0x584a92(0x1a7)]===_0x23422f){_0x189219=_0x3a1b01[_0x584a92(0x1e6)],_0x3e0244=_0x20f6d1[_0x584a92(0x1e6)]||_0x23422f;break _0x11747a;}}}}return{'stageName':_0x189219,'criteriaName':_0x3e0244};}function a152_0x4f7b(_0x29a64a,_0x1de0a7){_0x29a64a=_0x29a64a-0x152;const _0x2b9413=a152_0x2b94();let _0x4f7b8a=_0x2b9413[_0x29a64a];return _0x4f7b8a;}async function executeThreeStepJourneyCreate(_0x24cabd,_0x3b1cec,_0x3a2108,_0x3a3ce9,_0x48f261,_0x256bce,_0x2be594,_0x405958){const _0x41985a=a152_0x156079,{activationDefToCreateRequest:_0x4736b4,yamlRuleToApi:_0x265531}=_0x405958,{pendingEmbeddedSegments:_0x3b12c0,pendingEmbeddedActivations:_0x3e3ca5,embeddedSegmentNameToId:_0x6b436b}=_0x3a3ce9,_0x1006d1=JSON[_0x41985a(0x23b)](JSON[_0x41985a(0x1ff)](_0x3a2108));ensureJourneyDefaults(_0x1006d1[_0x41985a(0x1c5)]),stripPendingIds(_0x1006d1);const _0x59982f=await _0x24cabd[_0x41985a(0x20c)]['create'](_0x1006d1),_0x411570=_0x59982f['id'],_0x13f42a=new Map();for(const _0x3d7f5c of _0x59982f[_0x41985a(0x1c5)]['journeyStages']){_0x13f42a[_0x41985a(0x174)](_0x3d7f5c[_0x41985a(0x1e6)][_0x41985a(0x21e)](),_0x3d7f5c['id']);}recoverSegmentIdsFromPushRecovery(_0x3b1cec,_0x6b436b,_0x256bce[_0x41985a(0x22d)]);for(const [_0xc115cf,{definition:_0x22ca89}]of _0x3b12c0){if(_0x6b436b[_0x41985a(0x15d)](_0xc115cf)){_0x2be594[_0x41985a(0x1f1)]?.({'type':'embedded_segment_created','journeyName':_0x3b1cec[_0x41985a(0x247)]['name'],'segmentName':_0xc115cf});continue;}const _0x13acd2=generateDeterministicJourneySegmentName(_0x3b1cec[_0x41985a(0x247)][_0x41985a(0x1e6)],_0xc115cf);_0x2be594[_0x41985a(0x1f1)]?.({'type':'embedded_segment_creating','journeyName':_0x3b1cec[_0x41985a(0x247)][_0x41985a(0x1e6)],'segmentName':_0xc115cf});const _0x4de6f7=createSegmentIdResolver(_0x256bce[_0x41985a(0x22d)],_0xc115cf),_0x58dcd9=await resolveRuleSegmentIds(_0x22ca89[_0x41985a(0x1a3)],_0x4de6f7),_0x486118=await createOrRecoverEmbeddedSegment(_0x24cabd,_0x3b1cec,{'localName':_0xc115cf,'uniqueSegmentName':_0x13acd2,'description':_0x22ca89['description']||_0x41985a(0x197)+_0xc115cf,'journeyId':_0x411570,'resolvedRule':_0x58dcd9,'parentId':_0x48f261[_0x41985a(0x211)],'folderId':_0x48f261['effectiveFolderId']||''},_0x265531);_0x6b436b[_0x41985a(0x174)](_0xc115cf,_0x486118),_0x256bce[_0x41985a(0x22d)][_0x41985a(0x174)](_0xc115cf,_0x486118),_0x2be594[_0x41985a(0x1f1)]?.({'type':_0x41985a(0x212),'journeyName':_0x3b1cec[_0x41985a(0x247)][_0x41985a(0x1e6)],'segmentName':_0xc115cf});}const _0x46f350=new Map();for(const [_0x5d6df3,_0x3080b8]of _0x3e3ca5){_0x2be594[_0x41985a(0x1f1)]?.({'type':'embedded_activation_creating','journeyName':_0x3b1cec[_0x41985a(0x247)][_0x41985a(0x1e6)],'activationName':_0x5d6df3});const _0x520203=await _0x4736b4(_0x3080b8,_0x256bce[_0x41985a(0x229)]),_0x5d5bff={..._0x520203,..._0x3080b8[_0x41985a(0x24a)]!==undefined&&{'runAfterJourneyRefresh':_0x3080b8[_0x41985a(0x24a)]}},_0x35103b=await _0x24cabd[_0x41985a(0x20c)][_0x41985a(0x22f)](_0x411570,_0x5d5bff);_0x46f350[_0x41985a(0x174)](_0x5d6df3,_0x35103b['id']),_0x3a3ce9['journeyActivationNameToId']['set'](_0x5d6df3,_0x35103b['id']),_0x2be594['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x3b1cec[_0x41985a(0x247)][_0x41985a(0x1e6)],'activationName':_0x5d6df3});}const _0x253dc0=JSON[_0x41985a(0x23b)](JSON[_0x41985a(0x1ff)](_0x3a2108));return _0x253dc0['id']=_0x411570,ensureJourneyDefaults(_0x253dc0[_0x41985a(0x1c5)]),resolvePendingIdsInRequest(_0x253dc0,_0x3a2108,_0x13f42a,_0x6b436b,_0x46f350,_0x2be594),await _0x24cabd[_0x41985a(0x20c)][_0x41985a(0x179)](_0x411570,_0x253dc0),deletePushRecovery(_0x3b1cec['absolutePath']),{'action':_0x41985a(0x22b),'journeyId':_0x411570,'embeddedSegmentNameToId':_0x6b436b};}export function stripWaitStepPendingIds(_0x15fa1c){const _0x4d7e32=a152_0x156079,_0x458d52=_0x15fa1c[_0x4d7e32(0x177)]&&isPendingSegmentId(_0x15fa1c['conditionSegmentId']),_0x370f4e=_0x15fa1c[_0x4d7e32(0x1f8)]?.['some'](_0x7b875d=>_0x7b875d[_0x4d7e32(0x158)]&&isPendingSegmentId(_0x7b875d[_0x4d7e32(0x158)]));(_0x458d52||_0x370f4e)&&(_0x15fa1c[_0x4d7e32(0x1d9)]=_0x4d7e32(0x1e5),_0x15fa1c[_0x4d7e32(0x1e4)]=0x1,_0x15fa1c['waitStepUnit']=_0x4d7e32(0x173),delete _0x15fa1c['conditionSegmentId'],delete _0x15fa1c[_0x4d7e32(0x237)],delete _0x15fa1c[_0x4d7e32(0x201)],delete _0x15fa1c[_0x4d7e32(0x1f8)]);}export function resolveWaitStepPendingIds(_0x1f74d9,_0x256faa,_0x1e6097,_0x4031b7){const _0x71f547=a152_0x156079;if(_0x256faa[_0x71f547(0x177)]&&isPendingSegmentId(_0x256faa[_0x71f547(0x177)])){const _0x422bde=_0x1e6097(_0x256faa[_0x71f547(0x177)],'stage\x20\x27'+_0x4031b7+_0x71f547(0x219));_0x422bde&&(_0x1f74d9['waitStepType']=_0x71f547(0x154),_0x1f74d9[_0x71f547(0x177)]=_0x422bde,delete _0x1f74d9[_0x71f547(0x1e4)],delete _0x1f74d9['waitStepUnit'],_0x256faa[_0x71f547(0x237)]!==undefined&&(_0x1f74d9['conditionTimeoutDuration']=_0x256faa[_0x71f547(0x237)]),_0x256faa[_0x71f547(0x201)]&&(_0x1f74d9[_0x71f547(0x201)]=_0x256faa[_0x71f547(0x201)]));}if(_0x256faa[_0x71f547(0x1f8)]){const _0x4e1ac9=_0x256faa[_0x71f547(0x1f8)][_0x71f547(0x1cb)](_0x5127a6=>_0x5127a6[_0x71f547(0x158)]&&isPendingSegmentId(_0x5127a6['segmentId']));if(_0x4e1ac9){const _0x1dd1c2=_0x256faa[_0x71f547(0x1f8)][_0x71f547(0x1b4)](_0x593529=>{const _0x2aae73=_0x71f547;if(_0x593529[_0x2aae73(0x158)]&&isPendingSegmentId(_0x593529[_0x2aae73(0x158)])){const _0x189eed=_0x1e6097(_0x593529[_0x2aae73(0x158)],_0x2aae73(0x175)+_0x4031b7+_0x2aae73(0x219));return{..._0x593529,'segmentId':_0x189eed||_0x593529[_0x2aae73(0x158)]};}return{..._0x593529};});_0x1f74d9[_0x71f547(0x1d9)]=_0x71f547(0x154),_0x1f74d9['conditions']=_0x1dd1c2,delete _0x1f74d9['waitStep'],delete _0x1f74d9[_0x71f547(0x199)],delete _0x1f74d9['conditionSegmentId'],delete _0x1f74d9[_0x71f547(0x237)],delete _0x1f74d9[_0x71f547(0x201)];}}}function stripPendingIds(_0x5cfbc8){const _0x2b2d0f=a152_0x156079;_0x5cfbc8[_0x2b2d0f(0x1c5)][_0x2b2d0f(0x190)]?.[_0x2b2d0f(0x158)]&&isPendingSegmentId(_0x5cfbc8['attributes'][_0x2b2d0f(0x190)][_0x2b2d0f(0x158)])&&delete _0x5cfbc8[_0x2b2d0f(0x1c5)][_0x2b2d0f(0x190)];for(const _0x28022c of _0x5cfbc8[_0x2b2d0f(0x1c5)][_0x2b2d0f(0x162)]||[]){_0x28022c['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x28022c[_0x2b2d0f(0x23a)]['segmentId'])&&delete _0x28022c[_0x2b2d0f(0x23a)];_0x28022c[_0x2b2d0f(0x20d)]?.[_0x2b2d0f(0x158)]&&isPendingSegmentId(_0x28022c[_0x2b2d0f(0x20d)][_0x2b2d0f(0x158)])&&delete _0x28022c[_0x2b2d0f(0x20d)];_0x28022c[_0x2b2d0f(0x1ab)]&&(_0x28022c[_0x2b2d0f(0x1ab)]=_0x28022c[_0x2b2d0f(0x1ab)][_0x2b2d0f(0x207)](_0x307e59=>!_0x307e59[_0x2b2d0f(0x158)]||!isPendingSegmentId(_0x307e59[_0x2b2d0f(0x158)])));if(_0x28022c['steps'])for(const _0x93dc47 of Object[_0x2b2d0f(0x230)](_0x28022c['steps'])){const _0x16a129=_0x28022c[_0x2b2d0f(0x1d1)][_0x93dc47];_0x16a129[_0x2b2d0f(0x217)]===_0x2b2d0f(0x235)&&_0x16a129[_0x2b2d0f(0x1b5)]&&isPendingActivationId(_0x16a129[_0x2b2d0f(0x1b5)])&&(_0x16a129[_0x2b2d0f(0x1b5)]='');if(_0x16a129['type']===_0x2b2d0f(0x1e3)&&_0x16a129[_0x2b2d0f(0x1f0)])for(const _0x4c7540 of _0x16a129[_0x2b2d0f(0x1f0)]){_0x4c7540[_0x2b2d0f(0x158)]&&isPendingSegmentId(_0x4c7540['segmentId'])&&(_0x4c7540[_0x2b2d0f(0x158)]='');}_0x16a129[_0x2b2d0f(0x217)]===_0x2b2d0f(0x1ac)&&stripWaitStepPendingIds(_0x16a129);}}}function resolvePendingIdsInRequest(_0xe31574,_0x46b94f,_0x27e213,_0x1c3a5e,_0x309e5b,_0x57472c){const _0x5129dd=a152_0x156079,_0x4d9a50=(_0x41717c,_0x370420)=>{const _0xe43f09=a152_0x4f7b;if(!isPendingSegmentId(_0x41717c))return _0x41717c;const _0x34df8d=extractPendingSegmentName(_0x41717c),_0x353ec7=_0x1c3a5e[_0xe43f09(0x186)](_0x34df8d);return!_0x353ec7&&_0x57472c[_0xe43f09(0x19c)]?.(_0xe43f09(0x1c4)+_0x34df8d+_0xe43f09(0x1eb)+_0x370420),_0x353ec7;};if(_0xe31574[_0x5129dd(0x1c5)][_0x5129dd(0x190)]?.[_0x5129dd(0x158)]&&isPendingSegmentId(_0xe31574['attributes'][_0x5129dd(0x190)][_0x5129dd(0x158)])){const _0x9b6a8f=_0x4d9a50(_0xe31574[_0x5129dd(0x1c5)][_0x5129dd(0x190)][_0x5129dd(0x158)],_0x5129dd(0x209));_0x9b6a8f&&(_0xe31574['attributes'][_0x5129dd(0x190)][_0x5129dd(0x158)]=_0x9b6a8f);}for(const _0x544bab of _0xe31574['attributes'][_0x5129dd(0x162)]||[]){const _0xcb1d6=_0x27e213[_0x5129dd(0x186)](_0x544bab['name']['toLowerCase']());_0xcb1d6&&(_0x544bab['id']=_0xcb1d6);if(_0x544bab[_0x5129dd(0x23a)]?.[_0x5129dd(0x158)]&&isPendingSegmentId(_0x544bab[_0x5129dd(0x23a)]['segmentId'])){const _0x230adb=_0x4d9a50(_0x544bab[_0x5129dd(0x23a)][_0x5129dd(0x158)],_0x5129dd(0x175)+_0x544bab[_0x5129dd(0x1e6)]+_0x5129dd(0x1c0));_0x230adb&&(_0x544bab[_0x5129dd(0x23a)]['segmentId']=_0x230adb);}if(_0x544bab[_0x5129dd(0x1ab)])for(const _0x5edd62 of _0x544bab[_0x5129dd(0x1ab)]){if(_0x5edd62['segmentId']&&isPendingSegmentId(_0x5edd62[_0x5129dd(0x158)])){const _0x1990ee=_0x4d9a50(_0x5edd62['segmentId'],_0x5129dd(0x175)+_0x544bab[_0x5129dd(0x1e6)]+_0x5129dd(0x1b9));_0x1990ee&&(_0x5edd62['segmentId']=_0x1990ee);}}if(_0x544bab[_0x5129dd(0x20d)]?.[_0x5129dd(0x158)]&&isPendingSegmentId(_0x544bab[_0x5129dd(0x20d)]['segmentId'])){const _0x12571f=_0x4d9a50(_0x544bab['milestone'][_0x5129dd(0x158)],'stage\x20\x27'+_0x544bab['name']+_0x5129dd(0x1e2));_0x12571f&&(_0x544bab[_0x5129dd(0x20d)][_0x5129dd(0x158)]=_0x12571f);}if(_0x544bab[_0x5129dd(0x1d1)]){const _0xd4c842=_0x3e7077=>_0x46b94f['attributes'][_0x5129dd(0x162)]?.[_0x5129dd(0x168)](_0x147e39=>_0x147e39['name']['toLowerCase']()===_0x544bab[_0x5129dd(0x1e6)][_0x5129dd(0x21e)]())?.[_0x5129dd(0x1d1)]?.[_0x3e7077];for(const _0x310d7d of Object[_0x5129dd(0x230)](_0x544bab[_0x5129dd(0x1d1)])){const _0x2cf873=_0x544bab[_0x5129dd(0x1d1)][_0x310d7d],_0x1f89bf=_0xd4c842(_0x310d7d);if(_0x2cf873[_0x5129dd(0x217)]===_0x5129dd(0x235)&&_0x2cf873[_0x5129dd(0x1b5)]&&(isPendingActivationId(_0x2cf873[_0x5129dd(0x1b5)])||_0x2cf873[_0x5129dd(0x1b5)]==='')){if(_0x1f89bf?.[_0x5129dd(0x1b5)]&&isPendingActivationId(_0x1f89bf[_0x5129dd(0x1b5)])){const _0x1c5ad8=extractPendingActivationName(_0x1f89bf[_0x5129dd(0x1b5)]),_0x4d8275=_0x309e5b['get'](_0x1c5ad8);_0x4d8275&&(_0x2cf873[_0x5129dd(0x1b5)]=_0x4d8275);}}if(_0x2cf873['type']===_0x5129dd(0x1e3)&&_0x2cf873[_0x5129dd(0x1f0)]&&_0x1f89bf?.[_0x5129dd(0x1f0)])for(let _0x34a8fa=0x0;_0x34a8fa<_0x2cf873[_0x5129dd(0x1f0)]['length'];_0x34a8fa++){const _0x4044ac=_0x2cf873[_0x5129dd(0x1f0)][_0x34a8fa],_0xc54ddd=_0x1f89bf[_0x5129dd(0x1f0)][_0x34a8fa];if(_0xc54ddd?.[_0x5129dd(0x158)]&&isPendingSegmentId(_0xc54ddd[_0x5129dd(0x158)])){const _0xc20481=_0x4d9a50(_0xc54ddd['segmentId'],_0x5129dd(0x175)+_0x544bab[_0x5129dd(0x1e6)]+_0x5129dd(0x242)+(_0x4044ac['name']||_0x34a8fa)+'\x27');_0xc20481&&(_0x4044ac['segmentId']=_0xc20481);}}_0x2cf873['type']==='WaitStep'&&_0x1f89bf?.['type']==='WaitStep'&&resolveWaitStepPendingIds(_0x2cf873,_0x1f89bf,_0x4d9a50,_0x544bab[_0x5129dd(0x1e6)]);}}}}
1
+ const a152_0x547b34=a152_0x57d7;(function(_0x1ef6e3,_0x544879){const _0x195237=a152_0x57d7,_0x4bf6ce=_0x1ef6e3();while(!![]){try{const _0x1b8406=-parseInt(_0x195237(0x174))/0x1*(parseInt(_0x195237(0x1f3))/0x2)+parseInt(_0x195237(0x1e5))/0x3*(-parseInt(_0x195237(0x1f6))/0x4)+parseInt(_0x195237(0x1bb))/0x5+parseInt(_0x195237(0x180))/0x6*(-parseInt(_0x195237(0x1b4))/0x7)+-parseInt(_0x195237(0x194))/0x8+-parseInt(_0x195237(0x15d))/0x9*(parseInt(_0x195237(0x234))/0xa)+parseInt(_0x195237(0x216))/0xb;if(_0x1b8406===_0x544879)break;else _0x4bf6ce['push'](_0x4bf6ce['shift']());}catch(_0x183c52){_0x4bf6ce['push'](_0x4bf6ce['shift']());}}}(a152_0x2ff5,0xa0fcf));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_0x547b34(0x248);export const PENDING_ACTIVATION_PREFIX=a152_0x547b34(0x1ee);export function createPendingSegmentId(_0x2f4ebf){return''+PENDING_SEGMENT_PREFIX+_0x2f4ebf+'__';}export function isPendingSegmentId(_0x7f3a06){return _0x7f3a06['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x7f3a06['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x27ea0f){const _0x3a2d8e=a152_0x547b34;return _0x27ea0f[_0x3a2d8e(0x220)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3a0a13){return''+PENDING_ACTIVATION_PREFIX+_0x3a0a13+'__';}export function isPendingActivationId(_0x98fcf7){return _0x98fcf7['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3f0a6d){const _0x25af7d=a152_0x547b34;return _0x3f0a6d[_0x25af7d(0x220)](/^__pending_act_(.+)__$/,'$1');}function a152_0x2ff5(){const _0x264207=['relative','1276532mfydOU','split','Activation\x20not\x20found:\x20','journeys','localName','list','JOURNEY_UPDATE_ERROR','decision_point','INTERNAL','get','existingJourney','effectiveFolderId','push',').\x20','Name\x20has\x20already\x20been\x20taken','valid','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','nameToType','Failed\x20to\x20','buildUserMaps','journey_creating','existingSegments','folderPath','description','NOT_FOUND','\x20segment\x20from\x20file:\x20','./child-segment-yaml.js','conditionTimeoutDuration','run_after_journey_refresh','./journey-yaml.js','embeddedSegmentNameToId','deleteActivation','37140323PAfcGt','existingSegment','activationActions','segments','journeyBundleId','all_columns','createFolder','milestone','activations','stages','replace','folder_created','createdSegmentIds','getLatestJourneyId','item','notification','embedded_segment_created','Creating\x20activation\x20\x27','data','created','journeyBundleName','Created\x20activation\x20\x27','state','stage\x20\x27','schedule','set','createActivation','utf-8','match','\x20activation\x20\x27','10MtFfrK','debug','index','deps','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','isNew','all','segmentId','rootFolderId','../../utils/async.js','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','slice','dirname','JOURNEY_SYNTAX_ERROR','has','segment_created','segment','filter','journeyName','startsWith','__pending_','listActivations','existingActivation','createdSegmentId','attributes','size','Created\x20journey\x20\x27','Stage\x20\x27','getSegment','some','.$1.push-recovery.json','Created\x20folder\x20\x27','hasChanges','toISOString','rule','max','embedded_activation_created','waitStepType','relationships','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20to\x20local\x20\x27','behavior','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','conditions','activation_updated','toString','logSuccess','isArray','updated','SEGMENT_UPDATE_ERROR','diff','9086751VRRtwS','DecisionPoint','\x27\x20by\x20rule\x20content','day','errors','Entry\x20criteria:\x20','Segment\x20not\x20found','getJourney','parentId','entry_criteria','Updated\x20journey\x20\x27','entries','\x27\x20decision\x20point\x20branch\x20\x27','WaitStep','Failed\x20to\x20resolve\x20segment\x20','toLowerCase','connector_config','update','from','steps','uniqueSegmentName','embedded_activation_creating','flatMap','707CaRitO','\x20error(s)','and\x20the\x20server\x20segment,\x20then\x20retry.','Creating\x20segment\x20\x27','includes','Segment\x20not\x20found:\x20','results','journey_updating','createJourneySegment','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Activation','resolveSegment','25188qiDZEK','activation_deleted','segment_updated','keys','parse','\x27\x20wait\x20condition','activation_template_id','unchanged','user','length','journey_created','segment_deleted','\x20(referenced\x20in\x20journey\x20','\x0a\x20\x20','conditionSegmentId','yamlActivation','verbose','\x27\x20for\x20','goal','idToEmailMap','385184oBlebt','Deleted\x20activation\x20\x27','onProgress','folderPathToId','segmentByFolderAndName','Updating\x20activation\x20\x27','parseDocument','yamlConfig','\x27\x20milestone','add','name','skipSegments','exitCriterias','map','Updated\x20segment\x20\x27','Created\x20segment\x20\x27','absolutePath','find','delete','join','idToName','progress','segment_creating','Updating\x20segment\x20\x27','waitStepUnit','resolveJourneyId','journeyStages','getSegment\x20failed\x20for\x20','Condition','ACTIVATION_UPDATE_ERROR','waitStep','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','602rfxnLQ','journeyId','folder','\x27\x20entry\x20criteria','Journey\x20\x27','withProgress','segment_deleting','3858075SSpOuL','SEGMENT_SYNTAX_ERROR','Failed\x20to\x20fetch\x20referenced\x20segment\x20','Failed\x20to\x20resolve\x20activation\x20','branches','create','journeyActivationNameToId','entryCriteria','updateSegmentById','uniqueServerName','Deleting\x20activation\x20\x27','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','columns','connectionIdToNameMap','action','logDeleted',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','conditionTimeoutUnit','Matched\x20server\x20segment\x20\x27','activation_created','journeyById','\x27...','fetchJourney','journey','sort','parentSegmentFolder','connection','activationStepsById','reduce','Creating\x20folder\x20\x27','embedded_segment_creating','goal\x20criteria','versionNumber','resolvedRule','Fetching\x20','Duration','activation_creating','type','activation_deleting','sha1','with','folder_creating','12XvVJfE','validatedRequest','deleted','journeyBundlesByFolderAndName','segmentFolderId','logWarning','segmentNameToId','segment_updating','journeyActivationStepId','__pending_act_','message','activationContext','folderId','SEGMENT_NOT_FOUND','2244oYCGWW','stringify'];a152_0x2ff5=function(){return _0x264207;};return a152_0x2ff5();}export function generateDeterministicJourneySegmentName(_0x5379e5,_0x141f02){const _0x5a027b=a152_0x547b34,_0x169d14=_0x5379e5+'::'+(_0x141f02['trim']()||_0x5a027b(0x244)),_0x55b4a2=createHash(_0x5a027b(0x1e2))[_0x5a027b(0x16e)](_0x169d14)['digest']('hex')['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x55b4a2;}export function ensureJourneyDefaults(_0x315e43){const _0x4416c4=a152_0x547b34;!_0x315e43['description']&&(_0x315e43[_0x4416c4(0x20d)]=''),!_0x315e43[_0x4416c4(0x22c)]&&(_0x315e43['state']='draft');}export function injectExistingStageIds(_0x377ea1,_0x23abd7){const _0x1173a7=a152_0x547b34,_0x5abd86=new Map(_0x23abd7['map'](_0x5a023f=>[_0x5a023f[_0x1173a7(0x19e)],_0x5a023f['id']]));for(const _0x2593f0 of _0x377ea1){if(!_0x2593f0['id']){const _0x2d70ad=_0x5abd86[_0x1173a7(0x1ff)](_0x2593f0['name']);_0x2d70ad&&(_0x2593f0['id']=_0x2d70ad);}}}export function resolveTDFolderPath(_0x4fcb50,_0x38a290,_0x259952){const _0x41e1ef=a152_0x547b34;if(!_0x38a290)return _0x4fcb50;if(_0x4fcb50===_0x259952||_0x4fcb50[_0x41e1ef(0x247)](_0x259952+'/'))return _0x4fcb50;return _0x4fcb50?_0x259952+'/'+_0x4fcb50:_0x259952;}export function addFoldersToCreate(_0x585d1d,_0x1d49f1,_0x43bb80){const _0x3ea224=a152_0x547b34;if(!_0x585d1d)return;if(_0x1d49f1['has'](_0x585d1d))return;const _0x3a792b=_0x585d1d['split']('/');let _0x402bca='';for(const _0x196a47 of _0x3a792b){_0x402bca=_0x402bca?_0x402bca+'/'+_0x196a47:_0x196a47,!_0x1d49f1['has'](_0x402bca)&&_0x43bb80[_0x3ea224(0x19d)](_0x402bca);}}export function sortFoldersByDepth(_0x169e21){const _0x140a7f=a152_0x547b34;return[..._0x169e21][_0x140a7f(0x1d3)]((_0x5f271f,_0x4ae736)=>{const _0x4d254e=_0x140a7f,_0x58958b=(_0x5f271f['match'](/\//g)||[])['length'],_0x45b74f=(_0x4ae736[_0x4d254e(0x232)](/\//g)||[])[_0x4d254e(0x189)];return _0x58958b-_0x45b74f;});}import*as a152_0x2edd9c from'yaml';import{readFileSync}from'fs';import a152_0x339632 from'path';import{isJourneyDef,parseYamlString as a152_0x27da22,toYamlString as a152_0x3aa9ed,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(_0x1dcd37){const _0x8a5867=a152_0x547b34;if(Array[_0x8a5867(0x159)](_0x1dcd37))return'['+_0x1dcd37[_0x8a5867(0x1a1)](_0x3295a7=>stableStringify(_0x3295a7))[_0x8a5867(0x1a7)](',')+']';if(_0x1dcd37&&typeof _0x1dcd37==='object'){const _0xeafb6=_0x1dcd37,_0x52e2b1=Object[_0x8a5867(0x183)](_0xeafb6)[_0x8a5867(0x1d3)](),_0xcd6ebe=_0x52e2b1[_0x8a5867(0x1a1)](_0x8f1dfa=>'\x22'+_0x8f1dfa+'\x22:'+stableStringify(_0xeafb6[_0x8f1dfa]));return'{'+_0xcd6ebe['join'](',')+'}';}const _0x5850ba=JSON[_0x8a5867(0x1f4)](_0x1dcd37);return _0x5850ba===undefined?'null':_0x5850ba;}function activationSignature(_0x5b35f9){const _0x5664ed=a152_0x547b34,_0x146729={'connection':_0x5b35f9[_0x5664ed(0x1d5)],..._0x5b35f9[_0x5664ed(0x21b)]!==undefined&&{'all_columns':_0x5b35f9['all_columns']},..._0x5b35f9[_0x5664ed(0x1c7)]!==undefined&&{'columns':_0x5b35f9[_0x5664ed(0x1c7)]},..._0x5b35f9['behavior']!==undefined&&{'behavior':_0x5b35f9[_0x5664ed(0x152)]},..._0x5b35f9[_0x5664ed(0x22e)]!==undefined&&{'schedule':_0x5b35f9['schedule']},..._0x5b35f9[_0x5664ed(0x225)]!==undefined&&{'notification':_0x5b35f9['notification']},..._0x5b35f9[_0x5664ed(0x16d)]!==undefined&&{'connector_config':_0x5b35f9[_0x5664ed(0x16d)]},..._0x5b35f9[_0x5664ed(0x186)]!==undefined&&{'activation_template_id':_0x5b35f9[_0x5664ed(0x186)]}};return stableStringify(_0x146729);}async function fetchSegment(_0x476734,_0x36e05e,_0x105df8,_0x2c9db9){const _0x54d378=a152_0x547b34,_0x120183=_0x2c9db9?.[_0x54d378(0x1a5)](_0x3120d5=>_0x3120d5['id']===_0x105df8);if(_0x120183)return _0x120183;try{return await _0x476734[_0x54d378(0x244)][_0x54d378(0x250)](_0x36e05e,_0x105df8);}catch(_0x1311d9){logger[_0x54d378(0x235)](_0x54d378(0x1af)+_0x105df8+_0x54d378(0x1cb)+_0x1311d9);try{return await _0x476734[_0x54d378(0x244)]['getSegmentEntity'](_0x105df8);}catch(_0x1b22b9){return logger[_0x54d378(0x235)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x105df8+':\x20'+_0x1b22b9),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4b16ee,_0x57d393,_0x4b6d7a){const _0x284e85=a152_0x547b34,_0x3b1bba=readPushRecovery(_0x4b16ee[_0x284e85(0x1a4)]);if(_0x3b1bba?.['journeyName']===_0x4b16ee['yamlConfig']['name'])for(const [_0x3cdd85,_0x5b33ad]of Object[_0x284e85(0x168)](_0x3b1bba[_0x284e85(0x219)])){const _0x5ee21e=generateDeterministicJourneySegmentName(_0x4b16ee[_0x284e85(0x19b)]['name'],_0x3cdd85);_0x5b33ad[_0x284e85(0x1c4)]===_0x5ee21e&&(_0x57d393[_0x284e85(0x22f)](_0x3cdd85,_0x5b33ad[_0x284e85(0x23b)]),_0x4b6d7a[_0x284e85(0x22f)](_0x3cdd85,_0x5b33ad[_0x284e85(0x23b)]));}}async function createOrRecoverEmbeddedSegment(_0x549b70,_0x469a09,_0x12e61f,_0x3559f1){const _0x5d8c76=a152_0x547b34;let _0x27cb4b;try{_0x27cb4b=await _0x549b70['segment'][_0x5d8c76(0x17c)]({'name':_0x12e61f[_0x5d8c76(0x171)],'description':_0x12e61f[_0x5d8c76(0x20d)],'journeyId':_0x12e61f[_0x5d8c76(0x1b5)],'rule':_0x3559f1(_0x12e61f[_0x5d8c76(0x1dc)],!![]),'countPopulation':!![],'parentFolderId':_0x12e61f[_0x5d8c76(0x1f1)],'audienceId':_0x12e61f[_0x5d8c76(0x165)]});}catch(_0x35b4d3){const _0x19ca16=_0x35b4d3 instanceof Error&&_0x35b4d3[_0x5d8c76(0x1ef)][_0x5d8c76(0x178)](_0x5d8c76(0x204));if(_0x19ca16){const _0x36fe79=readPushRecovery(_0x469a09[_0x5d8c76(0x1a4)]),_0x151098=_0x36fe79?.[_0x5d8c76(0x246)]===_0x469a09[_0x5d8c76(0x19b)][_0x5d8c76(0x19e)]?_0x36fe79['segments'][_0x12e61f[_0x5d8c76(0x1fa)]]:undefined;if(_0x151098?.['uniqueServerName']===_0x12e61f[_0x5d8c76(0x171)])await _0x549b70['segment'][_0x5d8c76(0x1c3)](_0x12e61f[_0x5d8c76(0x165)],_0x151098[_0x5d8c76(0x23b)],{'description':_0x12e61f[_0x5d8c76(0x20d)],'rule':_0x3559f1(_0x12e61f[_0x5d8c76(0x1dc)],!![]),'countPopulation':!![]}),_0x27cb4b=_0x151098[_0x5d8c76(0x23b)];else throw new SDKError(ErrorCode[_0x5d8c76(0x15b)],'Embedded\x20segment\x20\x27'+_0x12e61f[_0x5d8c76(0x1fa)]+_0x5d8c76(0x17d)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x469a09[_0x5d8c76(0x1a4)]['replace'](/([^/]+)$/,_0x5d8c76(0x147))+')\x20')+_0x5d8c76(0x176),_0x35b4d3);}else throw _0x35b4d3;}return saveSegmentToPushRecovery(_0x469a09[_0x5d8c76(0x1a4)],_0x469a09[_0x5d8c76(0x19b)][_0x5d8c76(0x19e)],_0x12e61f[_0x5d8c76(0x1fa)],{'segmentId':_0x27cb4b,'uniqueServerName':_0x12e61f[_0x5d8c76(0x171)],'createdAt':new Date()[_0x5d8c76(0x14a)]()}),_0x27cb4b;}function a152_0x57d7(_0xa67ad2,_0xe04426){_0xa67ad2=_0xa67ad2-0x147;const _0x2ff589=a152_0x2ff5();let _0x57d70b=_0x2ff589[_0xa67ad2];return _0x57d70b;}export async function prepareSegmentFiles(_0x4c25c1,_0x5d99c7,_0x5cd59a,_0x2d64e0,_0xf2e2b5){const _0x547d0f=a152_0x547b34,{activationDefToCreateRequest:_0xeeb588}=await import(_0x547d0f(0x210)),_0xbc970=[],_0x4d6c55=new Set();for(const {yamlConfig:_0x1f12bb,folderPath:_0x2ce1c8,sourcePath:_0xeb31a7}of _0x4c25c1){const _0x43de31=resolveTDFolderPath(_0x2ce1c8,_0x2d64e0,_0xf2e2b5),_0x47348a=_0x43de31+':'+_0x1f12bb['name'],_0x32e662=_0x5d99c7[_0x547d0f(0x198)][_0x547d0f(0x1ff)](_0x47348a),_0x4b03b9=_0x32e662?_0x5d99c7['activationsBySegmentId'][_0x547d0f(0x1ff)](_0x32e662['id'])||[]:[];addFoldersToCreate(_0x43de31,_0x5d99c7[_0x547d0f(0x197)],_0x4d6c55);const _0x212edc=calculateActivationActions(_0x1f12bb[_0x547d0f(0x21e)]||[],_0x4b03b9,_0x5d99c7[_0x547d0f(0x193)],_0x5d99c7[_0x547d0f(0x1c8)]);for(const _0x4690ea of _0x212edc){(_0x4690ea['type']===_0x547d0f(0x1c0)||_0x4690ea[_0x547d0f(0x1e0)]==='update')&&_0x4690ea[_0x547d0f(0x18f)]&&(_0x4690ea[_0x547d0f(0x1e6)]=await _0xeeb588(_0x4690ea['yamlActivation'],_0x5cd59a));}const _0x935b74=calculateSegmentDiff(_0x1f12bb,_0x32e662,_0x4b03b9,_0x5d99c7[_0x547d0f(0x193)],_0x5d99c7[_0x547d0f(0x1c8)]);_0xbc970[_0x547d0f(0x202)]({'relativePath':_0x1f12bb[_0x547d0f(0x19e)],'absolutePath':_0xeb31a7,'yamlConfig':_0x1f12bb,'folderPath':_0x43de31,'existingSegment':_0x32e662,'existingActivations':_0x4b03b9,'isNew':_0x935b74['isNew'],'hasChanges':_0x935b74[_0x547d0f(0x149)],'diff':_0x935b74[_0x547d0f(0x15c)],'activationActions':_0x212edc});}return{'segmentFiles':_0xbc970,'foldersToCreate':_0x4d6c55};}export async function prepareJourneyFiles(_0x1c52dd,_0x3fe5ec,_0xaf524e,_0x36d46b){const _0xd8c6c8=a152_0x547b34,_0x274dab=[],_0x1f5f1b=new Set();for(const {yamlConfig:_0x4ade12,folderPath:_0x47ffd5,sourcePath:_0x85362c}of _0x1c52dd){const _0x54b409=resolveTDFolderPath(_0x47ffd5,_0xaf524e,_0x36d46b),_0x33d3c6=_0x54b409+':'+_0x4ade12['name'],_0x232484=_0x3fe5ec[_0xd8c6c8(0x1e8)][_0xd8c6c8(0x1ff)](_0x33d3c6);let _0x26c753,_0x371817;if(_0x232484&&_0x232484[_0xd8c6c8(0x189)]>0x0){const _0x238af3=buildLocalExpandedRuleMappings(_0x4ade12),{createYamlContext:_0x43ab7a,prefetchJourneySegments:_0x2d80f1}=createPushYamlContextForBundle(_0x3fe5ec['deps'],_0x3fe5ec[_0xd8c6c8(0x165)],_0x3fe5ec[_0xd8c6c8(0x20b)],_0x238af3,_0x3fe5ec['idToEmailMap'],_0x3fe5ec[_0xd8c6c8(0x1c8)],_0x3fe5ec[_0xd8c6c8(0x1d6)],_0x3fe5ec[_0xd8c6c8(0x1cf)]);await _0x2d80f1(_0x232484['map'](_0x4e826c=>_0x4e826c['id']));const _0x127f88=await _0x3fe5ec[_0xd8c6c8(0x237)][_0xd8c6c8(0x1d2)][_0xd8c6c8(0x223)](_0x232484[0x0][_0xd8c6c8(0x21a)]),_0x2907e9=hasMultipleVersions(_0x4ade12),_0x32ca88=async _0x3e5372=>{const _0x5b260a=_0xd8c6c8,_0xe59ed7=_0x3fe5ec[_0x5b260a(0x1cf)]?.['get'](_0x3e5372);if(_0xe59ed7)return _0xe59ed7;return _0x3fe5ec[_0x5b260a(0x1d1)]({'journeyId':_0x3e5372,'journeyName':_0x4ade12[_0x5b260a(0x19e)],'isMultiVersion':_0x232484[_0x5b260a(0x189)]>0x1});};if(_0x2907e9&&_0x232484['length']>0x1){const _0x51ef3f=[];for(const _0x315f2e of _0x232484){const _0x297153=_0x315f2e[_0xd8c6c8(0x1db)]||0x1;_0x3fe5ec[_0xd8c6c8(0x1a9)]?.[_0xd8c6c8(0x16e)](_0xd8c6c8(0x1dd)+_0x4ade12[_0xd8c6c8(0x19e)]+'\x20v'+_0x297153);const _0x15bb57=await _0x32ca88(_0x315f2e['id']),_0x326461=_0x43ab7a(_0x315f2e['id']),_0x36d4d3=await journeyResponseToDef(_0x15bb57,_0x326461);_0x51ef3f['push']({'item':_0x315f2e,'yaml':_0x36d4d3});}const _0x5df5f0=buildLocalRuleToNameMappingFromJourney(_0x4ade12);_0x371817=buildMergedJourneyDef(_0x51ef3f,_0x5df5f0,_0x127f88);const _0x2852fd=Math[_0xd8c6c8(0x14c)](..._0x51ef3f['map'](_0x233517=>_0x233517[_0xd8c6c8(0x224)][_0xd8c6c8(0x1db)]||0x0)),_0xd87b5d=_0x232484[_0xd8c6c8(0x1a5)](_0x80a182=>(_0x80a182[_0xd8c6c8(0x1db)]||0x0)===_0x2852fd);_0xd87b5d&&(_0x3fe5ec[_0xd8c6c8(0x1a9)]?.[_0xd8c6c8(0x16e)](_0xd8c6c8(0x1dd)+_0x4ade12['name']+'\x20v'+_0x2852fd),_0x26c753=await _0x32ca88(_0xd87b5d['id']));}else{const _0x4c35ad=_0x232484[_0x232484[_0xd8c6c8(0x189)]-0x1];_0x3fe5ec[_0xd8c6c8(0x1a9)]?.[_0xd8c6c8(0x16e)](_0xd8c6c8(0x1dd)+_0x4ade12[_0xd8c6c8(0x19e)]),_0x26c753=await _0x32ca88(_0x4c35ad['id']);const _0x118350=_0x43ab7a(_0x4c35ad['id']),_0x202e53=await journeyResponseToDef(_0x26c753,_0x118350),_0x40c45d=buildLocalRuleToNameMappingFromJourney(_0x4ade12);_0x371817=buildMergedJourneyDef([{'item':_0x4c35ad,'yaml':_0x202e53}],_0x40c45d,_0x127f88);}}addFoldersToCreate(_0x54b409,_0x3fe5ec['folderPathToId'],_0x1f5f1b);const _0x195acf=calculateJourneyDiff(_0x4ade12,_0x371817);_0x274dab[_0xd8c6c8(0x202)]({'relativePath':_0x4ade12['name'],'absolutePath':_0x85362c,'yamlConfig':_0x4ade12,'folderPath':_0x54b409,'existingJourney':_0x26c753,'isNew':_0x195acf['isNew'],'hasChanges':_0x195acf[_0xd8c6c8(0x149)],'diff':_0x195acf['diff']});}return{'journeyFiles':_0x274dab,'foldersToCreate':_0x1f5f1b};}export function calculateActivationActions(_0x2b0c8b,_0x48c460,_0x50f694,_0x14e994){const _0x155af2=a152_0x547b34,_0xf528ea=[],_0x5c51f9=new Map();for(const _0x5b38a0 of _0x48c460){_0x5c51f9[_0x155af2(0x22f)](_0x5b38a0[_0x155af2(0x19e)],_0x5b38a0);}const _0x1f8961=new Map();for(const _0x480e47 of _0x2b0c8b){_0x1f8961[_0x155af2(0x22f)](_0x480e47[_0x155af2(0x19e)],_0x480e47);}for(const _0x4c2714 of _0x2b0c8b){const _0x4daf1b=_0x5c51f9[_0x155af2(0x1ff)](_0x4c2714[_0x155af2(0x19e)]);if(!_0x4daf1b)_0xf528ea[_0x155af2(0x202)]({'type':_0x155af2(0x1c0),'name':_0x4c2714['name'],'yamlActivation':_0x4c2714});else{const _0x2a1be3=activationResponseToDef(_0x4daf1b,_0x50f694,_0x14e994),_0x1c4376=a152_0x2edd9c[_0x155af2(0x1f4)](_0x2a1be3),_0x562611=a152_0x2edd9c[_0x155af2(0x1f4)](_0x4c2714);_0x1c4376!==_0x562611&&_0xf528ea['push']({'type':_0x155af2(0x16e),'name':_0x4c2714[_0x155af2(0x19e)],'yamlActivation':_0x4c2714,'existingActivation':_0x4daf1b});}}for(const _0x166911 of _0x48c460){!_0x1f8961[_0x155af2(0x242)](_0x166911[_0x155af2(0x19e)])&&_0xf528ea['push']({'type':_0x155af2(0x1a6),'name':_0x166911[_0x155af2(0x19e)],'existingActivation':_0x166911});}return _0xf528ea;}function calculateYamlDiff(_0xcbc963,_0x55ed3b){if(_0x55ed3b){const _0x191931=generateDiff(_0x55ed3b,_0xcbc963),_0x4edc1d=hasChanges(_0x191931);return{'isNew':![],'hasChanges':_0x4edc1d,'diff':_0x4edc1d?formatDiffWithColors(_0x191931):undefined};}const _0x50b989=generateDiff('',_0xcbc963);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x50b989)};}export function calculateSegmentDiff(_0x33acd2,_0x448dcd,_0x4151d2,_0x2695b2,_0x411e79){const _0x17df91=segmentToYamlString(_0x33acd2),_0x1aed88=_0x448dcd?segmentToYamlString(segmentWithActivationsToYaml(_0x448dcd,_0x4151d2,undefined,_0x2695b2,_0x411e79)):undefined;return calculateYamlDiff(_0x17df91,_0x1aed88);}export function calculateJourneyDiff(_0x5f2eb5,_0x23dd6c){const _0x164523=normalizeJourneyDef(_0x5f2eb5,_0x5f2eb5),_0x15b739=a152_0x3aa9ed(_0x164523),_0x4aa784=_0x23dd6c?a152_0x3aa9ed(normalizeJourneyDef(_0x23dd6c,_0x5f2eb5)):undefined;return calculateYamlDiff(_0x15b739,_0x4aa784);}export function findSegmentsToDelete(_0x47b199,_0x3d71b,_0x390196,_0x35ffc6,_0x98bcd6){const _0xbb9678=a152_0x547b34,_0x41dd77=new Set();for(const {yamlConfig:_0x4ba77b,folderPath:_0x32a27f}of _0x3d71b){_0x41dd77[_0xbb9678(0x19d)](_0x32a27f+':'+_0x4ba77b[_0xbb9678(0x19e)]);}return _0x47b199[_0xbb9678(0x245)](_0x1509bc=>{const _0x2dfa4f=_0xbb9678,_0x52ad32=_0x1509bc['segmentFolderId']?_0x390196[_0x2dfa4f(0x1ff)](_0x1509bc[_0x2dfa4f(0x1e9)][_0x2dfa4f(0x157)]())||'':'',_0x2eeaf4=_0x52ad32+':'+_0x1509bc[_0x2dfa4f(0x19e)];if(_0x41dd77[_0x2dfa4f(0x242)](_0x2eeaf4))return![];if(_0x98bcd6)return _0x52ad32===_0x35ffc6||_0x52ad32[_0x2dfa4f(0x247)](_0x35ffc6+'/');return!![];});}export function findJourneysToDelete(_0x3504a8,_0x5bcaa9,_0x45e298,_0x4bbab8,_0x1988f3){const _0x1f1ffc=a152_0x547b34,_0x1e3c72=new Set();for(const {yamlConfig:_0x9698ab,folderPath:_0x1c0f43}of _0x5bcaa9){_0x1e3c72['add'](_0x1c0f43+':'+_0x9698ab[_0x1f1ffc(0x19e)]);}return _0x3504a8[_0x1f1ffc(0x245)](_0x4b9062=>{const _0x9904ef=_0x1f1ffc,_0x3a84bf=_0x4b9062[_0x9904ef(0x1f1)]?_0x45e298['get'](_0x4b9062[_0x9904ef(0x1f1)])||'':'',_0x3018e4=_0x3a84bf+':'+_0x4b9062[_0x9904ef(0x22a)];if(_0x1e3c72['has'](_0x3018e4))return![];if(_0x1988f3)return _0x3a84bf===_0x4bbab8||_0x3a84bf['startsWith'](_0x4bbab8+'/');return!![];});}export function buildSegmentLookupMap(_0x14e185,_0x432afd){const _0xc14349=a152_0x547b34,_0x3b43ed=new Map();for(const _0x274eed of _0x14e185){const _0xceeffe=_0x274eed[_0xc14349(0x1e9)]?_0x432afd['get'](_0x274eed['segmentFolderId'][_0xc14349(0x157)]())||'':'',_0x4d5beb=_0xceeffe+':'+_0x274eed['name'];_0x3b43ed[_0xc14349(0x22f)](_0x4d5beb,_0x274eed);}return _0x3b43ed;}export function buildSegmentNameToIdMap(_0x4eb3a1){const _0x40c71f=a152_0x547b34,_0x19656d=new Map();for(const _0x1edbb3 of _0x4eb3a1){_0x19656d[_0x40c71f(0x22f)](_0x1edbb3[_0x40c71f(0x19e)],_0x1edbb3['id']);}return _0x19656d;}export function buildJourneyBundleLookupMap(_0x209ccb,_0x3e3edb){const _0x2c8d13=a152_0x547b34,_0x56d1e9=new Map();for(const _0xdb4db4 of _0x209ccb){const _0x224fa2=_0xdb4db4[_0x2c8d13(0x1f1)]?_0x3e3edb[_0x2c8d13(0x1ff)](_0xdb4db4[_0x2c8d13(0x1f1)])||'':'',_0x19aaa9=_0x224fa2+':'+_0xdb4db4['journeyBundleName'];!_0x56d1e9[_0x2c8d13(0x242)](_0x19aaa9)&&_0x56d1e9[_0x2c8d13(0x22f)](_0x19aaa9,[]),_0x56d1e9[_0x2c8d13(0x1ff)](_0x19aaa9)['push'](_0xdb4db4);}for(const _0xa31830 of _0x56d1e9['values']()){_0xa31830[_0x2c8d13(0x1d3)]((_0x55ed8d,_0x374b8d)=>(_0x55ed8d[_0x2c8d13(0x1db)]||0x0)-(_0x374b8d[_0x2c8d13(0x1db)]||0x0));}return _0x56d1e9;}export function collectFoldersToCreate(_0xfbcfc0,_0x5d7df4){const _0x1f8674=a152_0x547b34,_0x31953e=new Set();for(const _0x5b34f2 of _0xfbcfc0){if(!_0x5b34f2)continue;if(_0x5d7df4[_0x1f8674(0x242)](_0x5b34f2))continue;const _0x25bdd2=_0x5b34f2[_0x1f8674(0x1f7)]('/');let _0x4b1df6='';for(const _0x3276e1 of _0x25bdd2){_0x4b1df6=_0x4b1df6?_0x4b1df6+'/'+_0x3276e1:_0x3276e1,!_0x5d7df4[_0x1f8674(0x242)](_0x4b1df6)&&_0x31953e[_0x1f8674(0x19d)](_0x4b1df6);}}return _0x31953e;}export function parseAndClassifyYamlFiles(_0x256426,_0x2c96a1,_0xbdb643){const _0x46778e=a152_0x547b34,_0x2db356=[],_0x1e3c3d=[];for(const _0x1a04ea of _0x256426){const _0x5979db=a152_0x339632[_0x46778e(0x1f5)](_0x2c96a1,a152_0x339632[_0x46778e(0x240)](_0x1a04ea)),_0x5d8874=_0x5979db==='.'?'':_0x5979db['replace'](/\\/g,'/'),_0x172b6c=readFileSync(_0x1a04ea,_0x46778e(0x231)),_0x9bdfc9=a152_0x2edd9c['parse'](_0x172b6c);if(isJourneyDef(_0x9bdfc9)){const _0x618835=a152_0x27da22(_0x172b6c);_0x1e3c3d[_0x46778e(0x202)]({'yamlConfig':_0x618835,'folderPath':_0x5d8874,'sourcePath':_0x1a04ea});}else{if(!_0xbdb643?.[_0x46778e(0x19f)]){const _0x5316bf=parseSegmentYamlFile(_0x172b6c),_0x27b453=normalizeChildSegmentYaml(_0x5316bf);_0x2db356[_0x46778e(0x202)]({'yamlConfig':_0x27b453,'folderPath':_0x5d8874,'sourcePath':_0x1a04ea});}}}return{'segments':_0x2db356,'journeys':_0x1e3c3d};}export function validateParsedFiles(_0x25d3d3,_0x38ad34){const _0x5a5c4f=a152_0x547b34,_0x157c5a=[];for(const {yamlConfig:_0x7be0e1,sourcePath:_0x314524}of _0x25d3d3[_0x5a5c4f(0x219)]){const _0x90ae9c=readFileSync(_0x314524,_0x5a5c4f(0x231)),_0x2b72ab=a152_0x2edd9c[_0x5a5c4f(0x19a)](_0x90ae9c),_0x5a8eec=validateSegmentDef(_0x7be0e1,{'source':_0x90ae9c,'document':_0x2b72ab},{'skipSchema':!![]});if(!_0x5a8eec[_0x5a5c4f(0x205)]){const _0x3b8531=a152_0x339632[_0x5a5c4f(0x1f5)](_0x38ad34,_0x314524);_0x157c5a[_0x5a5c4f(0x202)]({'filePath':_0x3b8531,'source':_0x90ae9c,'result':_0x5a8eec,'isJourney':![]});}}for(const {yamlConfig:_0x5d15c5,sourcePath:_0x4f5a89}of _0x25d3d3[_0x5a5c4f(0x1f9)]){const _0x402f3c=readFileSync(_0x4f5a89,_0x5a5c4f(0x231)),_0x3be16b=a152_0x2edd9c['parseDocument'](_0x402f3c),_0x384844=validateJourneyDef(_0x5d15c5,{'source':_0x402f3c,'document':_0x3be16b},{'skipSchema':!![]});if(!_0x384844[_0x5a5c4f(0x205)]){const _0x47ccbc=a152_0x339632[_0x5a5c4f(0x1f5)](_0x38ad34,_0x4f5a89);_0x157c5a['push']({'filePath':_0x47ccbc,'source':_0x402f3c,'result':_0x384844,'isJourney':!![]});}}return _0x157c5a;}export function formatValidationErrors(_0x41ddb8){const _0x19030a=a152_0x547b34,_0x179b39=[];for(const {filePath:_0x59be94,source:_0x1ccf9c,result:_0x46df7f,isJourney:_0x430402}of _0x41ddb8){const _0x1a3c4b=_0x430402?_0x19030a(0x1d2):_0x19030a(0x244);_0x179b39[_0x19030a(0x202)]('\x0a'+_0x59be94+'\x20('+_0x1a3c4b+'):\x20'+_0x46df7f[_0x19030a(0x161)][_0x19030a(0x189)]+_0x19030a(0x175)),_0x179b39[_0x19030a(0x202)](formatValidationResult(_0x46df7f,_0x1ccf9c,_0x59be94));}return _0x179b39['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x1adc1b){const _0x2c5c2a=a152_0x547b34,_0x2687cf=new Set(),_0x2511b0=new Map(),_0x2c68ad=collectSegmentUsageCounts(_0x1adc1b);if(_0x1adc1b[_0x2c5c2a(0x219)])for(const [_0x3e15b8,_0x433793]of Object[_0x2c5c2a(0x168)](_0x1adc1b[_0x2c5c2a(0x219)])){_0x2687cf['add'](_0x3e15b8);if(_0x433793['rule']){const _0x382c86=yamlRuleToApi(_0x433793[_0x2c5c2a(0x14b)]),_0x1b68e4=apiRuleToYaml(_0x382c86);_0x2511b0['set'](_0x3e15b8,_0x1b68e4);}}const _0x1d5f2e=new Map();let _0x36543c=0x0;for(const [_0x37dea3,_0x10f7f8]of _0x2511b0){const _0x2b4e45=serializeExpandedRule(_0x10f7f8,_0x2511b0),_0x1be5c8=_0x1d5f2e[_0x2c5c2a(0x1ff)](_0x2b4e45)||[];_0x1be5c8['push']({'name':_0x37dea3,'index':_0x36543c}),_0x1d5f2e[_0x2c5c2a(0x22f)](_0x2b4e45,_0x1be5c8),_0x36543c++;}const _0x568f4a=new Map();for(const [_0x3ae46a,_0x25ec82]of _0x1d5f2e){const _0x571890=_0x25ec82[_0x2c5c2a(0x23f)]()['sort']((_0x3de692,_0xe53ff)=>{const _0x4253da=_0x2c5c2a,_0x39ea30=_0x2c68ad[_0x4253da(0x1ff)](_0x3de692[_0x4253da(0x19e)])||0x0,_0x5ca007=_0x2c68ad[_0x4253da(0x1ff)](_0xe53ff[_0x4253da(0x19e)])||0x0;if(_0x39ea30!==_0x5ca007)return _0x5ca007-_0x39ea30;return _0x3de692['index']-_0xe53ff[_0x4253da(0x236)];})[_0x2c5c2a(0x1a1)](_0xa84a6b=>_0xa84a6b[_0x2c5c2a(0x19e)]),_0xe99dfc=[];for(const _0x129eee of _0x571890){const _0x2a00b6=_0x2c68ad['get'](_0x129eee)||0x0,_0x4fa7ca=Math['max'](_0x2a00b6,0x1);for(let _0x2a9d17=0x0;_0x2a9d17<_0x4fa7ca;_0x2a9d17++){_0xe99dfc[_0x2c5c2a(0x202)](_0x129eee);}}_0x568f4a[_0x2c5c2a(0x22f)](_0x3ae46a,_0xe99dfc);}return{'existingLocalSegmentNames':_0x2687cf,'localSegmentRules':_0x2511b0,'localExpandedRuleToNames':_0x568f4a};}export function createSegmentIdResolver(_0xe65d50,_0x1bbebf){return async _0x449d4e=>{const _0xeedc99=a152_0x57d7,_0x6f8fc4=_0xe65d50[_0xeedc99(0x1ff)](_0x449d4e);if(!_0x6f8fc4)throw new SDKError(ErrorCode[_0xeedc99(0x1f2)],'Segment\x20not\x20found:\x20'+_0x449d4e+_0xeedc99(0x23e)+_0x1bbebf+'\x27)');return _0x6f8fc4;};}export function extractRootFolderId(_0x565a6f){const _0x186972=a152_0x547b34;return _0x565a6f['relationships']?.[_0x186972(0x1d4)]?.[_0x186972(0x228)]?.['id']||_0x565a6f['relationships']?.['parentFolder']?.[_0x186972(0x228)]?.['id'];}export function buildConnectionMaps(_0x4386ee){const _0x1b7993=a152_0x547b34,_0xac8844=new Map(),_0x1bdbb3=new Map(),_0x30d22f=new Map();for(const _0x315d05 of _0x4386ee){_0xac8844['set'](_0x315d05['name'],parseInt(_0x315d05['id'],0xa)),_0x1bdbb3['set'](_0x315d05['id'],_0x315d05[_0x1b7993(0x19e)]),_0x30d22f[_0x1b7993(0x22f)](_0x315d05[_0x1b7993(0x19e)],_0x315d05['type']);}return{'nameToId':_0xac8844,'idToName':_0x1bdbb3,'nameToType':_0x30d22f};}export function calculatePushStats(_0x2a88d4,_0x33f8b1,_0x454dcf,_0x2eb637,_0x10cc3d,_0x2dcf9f,_0xe001fd){const _0x3064f4=a152_0x547b34,_0x234709=_0x2a88d4[_0x3064f4(0x245)](_0x251886=>_0x251886['isNew']),_0x63be0d=_0x2a88d4['filter'](_0x5a5817=>!_0x5a5817[_0x3064f4(0x239)]&&_0x5a5817[_0x3064f4(0x149)]),_0xaa1337=_0x2a88d4[_0x3064f4(0x245)](_0x4b0d34=>!_0x4b0d34['isNew']&&!_0x4b0d34['hasChanges']),_0x1e3878=_0x2dcf9f?_0x2eb637:[],_0x229896=_0x33f8b1[_0x3064f4(0x245)](_0x247432=>_0x247432[_0x3064f4(0x239)]),_0x25ff59=_0x33f8b1['filter'](_0x269262=>!_0x269262[_0x3064f4(0x239)]&&_0x269262[_0x3064f4(0x149)]),_0x3a8780=_0x33f8b1[_0x3064f4(0x245)](_0x20def6=>!_0x20def6['isNew']&&!_0x20def6['hasChanges']),_0x175ede=_0x2dcf9f?_0x10cc3d:[],_0x5dc12d=_0x2a88d4[_0x3064f4(0x173)](_0x5586e2=>_0x5586e2[_0x3064f4(0x218)]),_0x73a333=_0x5dc12d['filter'](_0xbdaacf=>_0xbdaacf[_0x3064f4(0x1e0)]==='create'),_0x1dc16d=_0x5dc12d['filter'](_0x44e4ba=>_0x44e4ba[_0x3064f4(0x1e0)]===_0x3064f4(0x16e)),_0x28bb8d=_0x5dc12d[_0x3064f4(0x245)](_0x2e8622=>_0x2e8622[_0x3064f4(0x1e0)]==='delete'),_0x51d35c=Array[_0x3064f4(0x16f)](_0x454dcf)[_0x3064f4(0x1d3)](),_0x27ed43=_0xe001fd?![]:_0x234709['length']>0x0||_0x63be0d[_0x3064f4(0x189)]>0x0||_0x1e3878[_0x3064f4(0x189)]>0x0,_0x1935a6=_0x229896['length']>0x0||_0x25ff59['length']>0x0||_0x175ede[_0x3064f4(0x189)]>0x0,_0x3bbd21=_0xe001fd?![]:_0x5dc12d[_0x3064f4(0x189)]>0x0,_0xae4f8d=_0x51d35c['length']>0x0;return{'segments':{'new':_0x234709,'changed':_0x63be0d,'unchanged':_0xaa1337,'toDelete':_0x1e3878},'journeys':{'new':_0x229896,'changed':_0x25ff59,'unchanged':_0x3a8780,'toDelete':_0x175ede},'activations':{'all':_0x5dc12d,'toCreate':_0x73a333,'toUpdate':_0x1dc16d,'toDelete':_0x28bb8d},'folders':{'toCreate':_0x51d35c},'counts':{'segments':{'new':_0x234709[_0x3064f4(0x189)],'changed':_0x63be0d[_0x3064f4(0x189)],'unchanged':_0xaa1337[_0x3064f4(0x189)],'toDelete':_0x1e3878[_0x3064f4(0x189)]},'journeys':{'new':_0x229896[_0x3064f4(0x189)],'changed':_0x25ff59[_0x3064f4(0x189)],'unchanged':_0x3a8780[_0x3064f4(0x189)],'toDelete':_0x175ede[_0x3064f4(0x189)]},'activations':{'create':_0x73a333[_0x3064f4(0x189)],'update':_0x1dc16d[_0x3064f4(0x189)],'delete':_0x28bb8d[_0x3064f4(0x189)]},'folders':_0x51d35c[_0x3064f4(0x189)]},'hasChanges':_0x27ed43||_0x1935a6||_0x3bbd21||_0xae4f8d};}export async function buildPushExecutionContext(_0x553d6c,_0x5a2c69,_0x461208,_0x38ff02,_0x477fe8,_0x449392){const _0x587811=a152_0x547b34,_0x24f42d=extractRootFolderId(_0x461208),{pathToId:_0xcaae49,idToPath:_0x2d4b9a}=buildFolderMaps(_0x477fe8),_0x1262ca=buildSegmentNameToIdMap(_0x38ff02),_0x12085e=new Map(),{batchAsync:_0x38ea96}=await import(_0x587811(0x23d)),[_0x83165c,_0x5e0341]=await Promise['all']([_0x553d6c[_0x587811(0x188)][_0x587811(0x209)](),_0x553d6c['connection'][_0x587811(0x1fb)](),((async()=>{const _0x49d397=_0x587811;!_0x449392&&_0x38ff02[_0x49d397(0x189)]>0x0&&await _0x38ea96(_0x38ff02,async _0x4a3c8f=>{const _0x373360=_0x49d397,_0x50ef78=await _0x553d6c[_0x373360(0x244)][_0x373360(0x249)](_0x5a2c69,_0x4a3c8f['id']);_0x12085e['set'](_0x4a3c8f['id'],_0x50ef78);});})())]),{emailToId:_0x4043ce,idToEmail:_0x39bbd7}=_0x83165c,_0x4a343a=buildConnectionMaps(_0x5e0341);return{'rootFolderId':_0x24f42d,'folderPathToId':_0xcaae49,'folderIdToPath':_0x2d4b9a,'segmentNameToId':_0x1262ca,'activationsBySegmentId':_0x12085e,'emailToIdMap':_0x4043ce,'idToEmailMap':_0x39bbd7,'connectionNameToIdMap':_0x4a343a['nameToId'],'connectionIdToNameMap':_0x4a343a[_0x587811(0x1a8)],'connectionNameToTypeMap':_0x4a343a[_0x587811(0x207)]};}export function createPushYamlContextForBundle(_0x272510,_0x15dbdf,_0x2b1bde,_0x349010,_0x11452f,_0x4f8a12,_0x596df2,_0x595922){const {existingLocalSegmentNames:_0x6e6817,localExpandedRuleToNames:_0x213d38}=_0x349010,_0x264928=new Set(),_0x227c52=new Map(),_0x591bf5=new Map(),_0x1f8e1f=new Map(),_0x48aacd=createJumpTargetCache(),_0x2fe59f=new Map(),_0x5e60d6=new Map(),_0x2cad72=new Set();let _0x4056ed;const _0xff15a=_0x122c92=>{const _0x367b48={'resolveSegment':async _0x87a69f=>{const _0x3c31c2=a152_0x57d7,_0x1685de=_0x1f8e1f[_0x3c31c2(0x1ff)](_0x87a69f);if(_0x1685de!==undefined)return{'name':_0x1685de,'isJourneyLocal':!![]};try{const _0x37abfb=await fetchSegment(_0x272510,_0x15dbdf,_0x87a69f,_0x2b1bde);if(!_0x37abfb)throw new Error(_0x3c31c2(0x163));const _0x2c74f6=generateJourneyLocalName(_0x37abfb[_0x3c31c2(0x19e)]),_0xa0fa0f=_0x37abfb['kind']===SEGMENT_KIND_JOURNEY&&_0x2c74f6!==undefined;let _0x3ddc67=_0x37abfb[_0x3c31c2(0x19e)],_0x2128d5;if(_0xa0fa0f&&_0x37abfb[_0x3c31c2(0x14b)]){const _0x267bd8=apiRuleToYaml(_0x37abfb[_0x3c31c2(0x14b)]);_0x5e60d6[_0x3c31c2(0x22f)](_0x87a69f,_0x267bd8);const _0x3063aa=async _0x2a8912=>{const _0x51b942=_0x3c31c2,_0x571dc9=collectSegmentRefsFromRule(_0x2a8912);for(const _0x2efbde of _0x571dc9){if(!_0x5e60d6[_0x51b942(0x242)](_0x2efbde))try{const _0x32717a=await fetchSegment(_0x272510,_0x15dbdf,_0x2efbde,_0x2b1bde);if(_0x32717a?.['rule']){const _0xf2f2ef=apiRuleToYaml(_0x32717a[_0x51b942(0x14b)]);_0x5e60d6[_0x51b942(0x22f)](_0x2efbde,_0xf2f2ef),await _0x3063aa(_0xf2f2ef);}}catch(_0x627297){logger[_0x51b942(0x235)](_0x51b942(0x1bd)+_0x2efbde+':\x20'+_0x627297);}}};await _0x3063aa(_0x267bd8);const _0x30a560=serializeExpandedRule(_0x267bd8,_0x5e60d6),_0x5aabc2=_0x213d38[_0x3c31c2(0x1ff)](_0x30a560);if(_0x5aabc2&&_0x5aabc2[_0x3c31c2(0x189)]>0x0){const _0x506309=_0x227c52[_0x3c31c2(0x1ff)](_0x30a560)||0x0,_0x1f9aee=_0x5aabc2[_0x506309]||_0x5aabc2[_0x5aabc2['length']-0x1];_0x227c52[_0x3c31c2(0x22f)](_0x30a560,_0x506309+0x1),_0x3ddc67=_0x1f9aee,_0x264928[_0x3c31c2(0x19d)](_0x3ddc67),_0x1f8e1f[_0x3c31c2(0x22f)](_0x87a69f,_0x3ddc67);const _0x15aa1d=await resolveRuleSegmentRefs(_0x267bd8,async _0x918b21=>{const _0x6ad2d8=_0x3c31c2,_0xcdc2a2=_0x1f8e1f[_0x6ad2d8(0x1ff)](_0x918b21);if(_0xcdc2a2)return _0xcdc2a2;const _0x469371=await _0x4056ed[_0x6ad2d8(0x17f)](_0x918b21);return _0x469371[_0x6ad2d8(0x19e)];});_0x2128d5={'description':_0x37abfb[_0x3c31c2(0x20d)],'rule':_0x15aa1d};}else{const _0x147d9f=_0x2fe59f['get'](_0x30a560);if(_0x147d9f)_0x3ddc67=_0x147d9f,_0x1f8e1f[_0x3c31c2(0x22f)](_0x87a69f,_0x3ddc67);else{if(_0x2c74f6){let _0x140c59=_0x2c74f6,_0x5e49c9=0x2;while(_0x264928[_0x3c31c2(0x242)](_0x140c59)||_0x6e6817['has'](_0x140c59)){_0x140c59=_0x2c74f6+'_'+_0x5e49c9,_0x5e49c9++;}_0x264928[_0x3c31c2(0x19d)](_0x140c59),_0x3ddc67=_0x140c59;}_0x1f8e1f[_0x3c31c2(0x22f)](_0x87a69f,_0x3ddc67),_0x2fe59f[_0x3c31c2(0x22f)](_0x30a560,_0x3ddc67);const _0x21801c=await resolveRuleSegmentRefs(_0x267bd8,async _0x485346=>{const _0x55a671=_0x3c31c2,_0x18285b=_0x1f8e1f['get'](_0x485346);if(_0x18285b)return _0x18285b;const _0x782da6=await _0x4056ed[_0x55a671(0x17f)](_0x485346);return _0x782da6[_0x55a671(0x19e)];});_0x2128d5={'description':_0x37abfb[_0x3c31c2(0x20d)],'rule':_0x21801c};}}}return{'name':_0x3ddc67,'isJourneyLocal':_0xa0fa0f,'definition':_0x2128d5};}catch(_0x29d5be){return logger[_0x3c31c2(0x235)](_0x3c31c2(0x16b)+_0x87a69f+':\x20'+_0x29d5be),{'name':_0x87a69f,'isJourneyLocal':![]};}},'resolveActivation':async _0xb9c740=>{const _0x350c33=a152_0x57d7,_0x5e8472=_0x591bf5['get'](_0xb9c740);if(_0x5e8472!==undefined)return{'name':_0x5e8472,'isJourneyLocal':!![]};try{let _0x1430f0=_0x596df2?.['get'](_0xb9c740);!_0x1430f0&&(_0x1430f0=await _0x272510[_0x350c33(0x1d2)]['getActivation'](_0x122c92,_0xb9c740));const _0x2ebd89=_0x1430f0[_0x350c33(0x24c)]['activationParams'][_0x350c33(0x19e)]||_0xb9c740,_0xf81cc5=sanitizeYamlKey(_0x2ebd89)||'activation_'+_0xb9c740,_0x60217d=_0xf81cc5;_0x591bf5[_0x350c33(0x22f)](_0xb9c740,_0x60217d);const _0x186e24=journeyActivationStepToYaml(_0x1430f0,_0x11452f,_0x4f8a12);return{'name':_0x60217d,'isJourneyLocal':!![],'definition':_0x186e24};}catch(_0x4d42b5){return logger[_0x350c33(0x235)](_0x350c33(0x1be)+_0xb9c740+':\x20'+_0x4d42b5),{'name':_0xb9c740,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2a82e6,_0xd71d5e)=>resolveJumpTarget(_0x2a82e6,_0xd71d5e,_0x48aacd,async _0x27183b=>{const _0x555fb8=a152_0x57d7,_0x217c45=_0x595922?.[_0x555fb8(0x1ff)](_0x27183b);if(_0x217c45)return _0x217c45;return _0x272510[_0x555fb8(0x1d2)][_0x555fb8(0x164)](_0x27183b);})};return _0x4056ed=_0x367b48,_0x367b48;},_0x710666=async _0x19e7a9=>{const _0x1c69a6=a152_0x57d7,{collectSegmentIdsFromJourneyApi:_0x3b0ea7}=await import(_0x1c69a6(0x213)),{batchAsync:_0x514b7f}=await import(_0x1c69a6(0x23d)),_0x524ee0=new Set();for(const _0x47a80e of _0x19e7a9){let _0xbe378c=_0x595922?.[_0x1c69a6(0x1ff)](_0x47a80e);!_0xbe378c&&(_0xbe378c=await _0x272510[_0x1c69a6(0x1d2)][_0x1c69a6(0x164)](_0x47a80e));const _0x41626d=_0x3b0ea7(_0xbe378c);for(const _0x2be9f6 of _0x41626d){_0x524ee0[_0x1c69a6(0x19d)](_0x2be9f6);}}let _0x35f81b=Array[_0x1c69a6(0x16f)](_0x524ee0);while(_0x35f81b[_0x1c69a6(0x189)]>0x0){const _0x7526f7=_0x35f81b[_0x1c69a6(0x245)](_0x3e832e=>!_0x2cad72['has'](_0x3e832e));if(_0x7526f7[_0x1c69a6(0x189)]===0x0)break;const _0x474780=await _0x514b7f(_0x7526f7,async _0xef40eb=>{const _0xdc78a3=_0x1c69a6;_0x2cad72[_0xdc78a3(0x19d)](_0xef40eb);const _0x16c449=await fetchSegment(_0x272510,_0x15dbdf,_0xef40eb,_0x2b1bde);if(!_0x16c449)return null;return{'segmentId':_0xef40eb,'segment':_0x16c449};},0xa),_0x1703c6=new Set();for(const _0x47f2cb of _0x474780){if(!_0x47f2cb?.[_0x1c69a6(0x244)]?.[_0x1c69a6(0x14b)])continue;const _0x2fffd6=apiRuleToYaml(_0x47f2cb[_0x1c69a6(0x244)]['rule']);_0x5e60d6['set'](_0x47f2cb[_0x1c69a6(0x23b)],_0x2fffd6);const _0x3f3cee=collectSegmentRefsFromRule(_0x2fffd6);for(const _0x29299e of _0x3f3cee){!_0x2cad72[_0x1c69a6(0x242)](_0x29299e)&&_0x1703c6['add'](_0x29299e);}}_0x35f81b=Array[_0x1c69a6(0x16f)](_0x1703c6);}};return{'createYamlContext':_0xff15a,'prefetchJourneySegments':_0x710666};}export async function executePushSegments(_0x4bf5f0,_0x2c01b8,_0x20b00c,_0x511e9e,_0x343bca){const _0x57a46e=a152_0x547b34,{segmentDefToCreateRequest:_0x30f6ed,segmentDefToUpdateRequest:_0x6dd503}=await import('./child-segment-yaml.js'),_0x39059b=_0x20b00c[_0x57a46e(0x197)],_0x111024=0x5,_0x4c4a88=async _0x24c11d=>{const _0xc54177=_0x57a46e,_0x556e1b=_0x24c11d[_0xc54177(0x20c)]?_0x39059b[_0xc54177(0x1ff)](_0x24c11d[_0xc54177(0x20c)]):undefined;let _0x43fefc;const _0x13c977={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5aa785=_0x24c11d['yamlConfig'];if(_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x14b)]){const _0x9de5e9=createSegmentIdResolver(_0x20b00c[_0xc54177(0x1eb)],_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]),_0x44753b=await resolveRuleSegmentIds(_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x14b)],_0x9de5e9);_0x5aa785={..._0x24c11d[_0xc54177(0x19b)],'rule':_0x44753b};}try{if(_0x24c11d['isNew']){_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x1aa),'name':_0x24c11d[_0xc54177(0x19b)]['name']});const _0x92cdaa=_0x30f6ed(_0x5aa785,_0x556e1b),_0x200cc2=await _0x343bca[_0xc54177(0x1b9)](_0xc54177(0x177)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+_0xc54177(0x1d0),()=>_0x4bf5f0[_0xc54177(0x244)]['createSegment'](_0x511e9e[_0xc54177(0x165)],_0x92cdaa));_0x43fefc=_0x200cc2[_0xc54177(0x228)]['id'],_0x20b00c['segmentNameToId'][_0xc54177(0x22f)](_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],_0x43fefc),_0x13c977[_0xc54177(0x24b)]={'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],'id':_0x43fefc},_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x243),'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],'segmentId':_0x43fefc}),_0x343bca[_0xc54177(0x158)]?.(_0xc54177(0x1a3)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+'\x27'),_0x13c977[_0xc54177(0x229)]=0x1;}else{if(_0x24c11d['hasChanges']){_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x1ec),'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]});const _0x451640=_0x6dd503(_0x5aa785);_0x556e1b!==_0x24c11d[_0xc54177(0x217)]?.[_0xc54177(0x1e9)]&&(_0x451640[_0xc54177(0x1e9)]=_0x556e1b?parseInt(_0x556e1b,0xa):undefined),await _0x343bca[_0xc54177(0x1b9)](_0xc54177(0x1ab)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+_0xc54177(0x1d0),()=>_0x4bf5f0['segment']['updateSegmentById'](_0x511e9e[_0xc54177(0x165)],_0x24c11d['existingSegment']['id'],_0x451640)),_0x43fefc=_0x24c11d['existingSegment']['id'],_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x182),'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]}),_0x343bca[_0xc54177(0x158)]?.(_0xc54177(0x1a2)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+'\x27'),_0x13c977[_0xc54177(0x15a)]=0x1;}else _0x43fefc=_0x24c11d[_0xc54177(0x217)]['id'];}}catch(_0x686bcb){const _0x3afd07=isHttp400Error(_0x686bcb),_0x1164d5=_0x3afd07?ErrorCode[_0xc54177(0x1bc)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x27e01a=getErrorMessage(_0x686bcb);throw new SDKError(_0x1164d5,_0xc54177(0x208)+(_0x24c11d['isNew']?_0xc54177(0x1c0):_0xc54177(0x16e))+_0xc54177(0x20f)+_0x24c11d['absolutePath']+_0xc54177(0x18d)+_0x27e01a,_0x686bcb);}try{const _0x1ed26e=await syncActivationsForSegment(_0x4bf5f0,_0x511e9e['parentId'],_0x43fefc,_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],_0x24c11d[_0xc54177(0x218)],_0x343bca,_0x24c11d['absolutePath']);_0x13c977['activations']=_0x1ed26e;}catch(_0x1ff70f){if(_0x1ff70f instanceof SDKError)throw _0x1ff70f;throw new SDKError(ErrorCode[_0xc54177(0x1b1)],_0xc54177(0x153)+_0x24c11d[_0xc54177(0x19b)]['name']+'\x27\x20from\x20file:\x20'+_0x24c11d[_0xc54177(0x1a4)]+_0xc54177(0x18d)+getErrorMessage(_0x1ff70f),_0x1ff70f);}return _0x13c977;},_0x3e823e=await batchAsync(_0x2c01b8,_0x4c4a88,_0x111024),_0x2eff6d={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x265f90 of _0x3e823e){_0x2eff6d[_0x57a46e(0x229)]+=_0x265f90[_0x57a46e(0x229)],_0x2eff6d[_0x57a46e(0x15a)]+=_0x265f90[_0x57a46e(0x15a)],_0x265f90[_0x57a46e(0x24b)]&&_0x2eff6d[_0x57a46e(0x222)][_0x57a46e(0x22f)](_0x265f90[_0x57a46e(0x24b)][_0x57a46e(0x19e)],_0x265f90[_0x57a46e(0x24b)]['id']),_0x2eff6d[_0x57a46e(0x21e)][_0x57a46e(0x229)]+=_0x265f90[_0x57a46e(0x21e)][_0x57a46e(0x229)],_0x2eff6d['activations']['updated']+=_0x265f90[_0x57a46e(0x21e)]['updated'],_0x2eff6d[_0x57a46e(0x21e)][_0x57a46e(0x1e7)]+=_0x265f90['activations']['deleted'];}return _0x2eff6d;}async function syncActivationsForSegment(_0x1e865c,_0x4ba063,_0x1b7892,_0x461909,_0x43f95a,_0x1cc348,_0x3e719c){const _0xfc6ed8=a152_0x547b34,_0x3f9b48={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xd0f04a of _0x43f95a){try{if(_0xd0f04a[_0xfc6ed8(0x1e0)]===_0xfc6ed8(0x1c0)&&_0xd0f04a[_0xfc6ed8(0x1e6)])_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x1df),'segmentName':_0x461909,'activationName':_0xd0f04a['name']}),await _0x1cc348[_0xfc6ed8(0x1b9)](_0xfc6ed8(0x227)+_0xd0f04a[_0xfc6ed8(0x19e)]+_0xfc6ed8(0x1d0),()=>_0x1e865c[_0xfc6ed8(0x244)][_0xfc6ed8(0x230)](_0x4ba063,_0x1b7892,_0xd0f04a[_0xfc6ed8(0x1e6)])),_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x1ce),'segmentName':_0x461909,'activationName':_0xd0f04a['name']}),_0x1cc348[_0xfc6ed8(0x158)]?.(_0xfc6ed8(0x22b)+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27'),_0x3f9b48['created']++;else{if(_0xd0f04a[_0xfc6ed8(0x1e0)]===_0xfc6ed8(0x16e)&&_0xd0f04a[_0xfc6ed8(0x1e6)]&&_0xd0f04a[_0xfc6ed8(0x24a)])_0x1cc348[_0xfc6ed8(0x196)]?.({'type':'activation_updating','segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),await _0x1cc348[_0xfc6ed8(0x1b9)](_0xfc6ed8(0x199)+_0xd0f04a[_0xfc6ed8(0x19e)]+_0xfc6ed8(0x1d0),()=>_0x1e865c[_0xfc6ed8(0x244)]['updateActivation'](_0x4ba063,_0x1b7892,_0xd0f04a['existingActivation']['id'],_0xd0f04a[_0xfc6ed8(0x1e6)])),_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x156),'segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),_0x1cc348['logSuccess']?.('Updated\x20activation\x20\x27'+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27'),_0x3f9b48['updated']++;else _0xd0f04a[_0xfc6ed8(0x1e0)]===_0xfc6ed8(0x1a6)&&_0xd0f04a[_0xfc6ed8(0x24a)]&&(_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x1e1),'segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),await _0x1cc348[_0xfc6ed8(0x1b9)](_0xfc6ed8(0x1c5)+_0xd0f04a['name']+'\x27...',()=>_0x1e865c['segment'][_0xfc6ed8(0x215)](_0x4ba063,_0x1b7892,_0xd0f04a[_0xfc6ed8(0x24a)]['id'])),_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x181),'segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),_0x1cc348[_0xfc6ed8(0x1ca)]?.(_0xfc6ed8(0x195)+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27'),_0x3f9b48['deleted']++);}}catch(_0x41df82){const _0x3cc43e=isHttp400Error(_0x41df82),_0x1d0daf=_0x3cc43e?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0xfc6ed8(0x1b1)],_0xe64495=getErrorMessage(_0x41df82);throw new SDKError(_0x1d0daf,_0xfc6ed8(0x208)+_0xd0f04a[_0xfc6ed8(0x1e0)]+_0xfc6ed8(0x233)+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27\x20from\x20file:\x20'+_0x3e719c+_0xfc6ed8(0x18d)+_0xe64495,_0x41df82);}}return _0x3f9b48;}export async function executePushFolders(_0x32b515,_0x337a38,_0x426063,_0xac7c0d,_0x355018){const _0x268fc7=a152_0x547b34,_0x10abde=new Map(_0x426063),_0x417451=sortFoldersByDepth(_0x337a38);for(const _0x2600d6 of _0x417451){const _0x2c0a0c=_0x2600d6[_0x268fc7(0x1f7)]('/'),_0x5b2dd7=_0x2c0a0c[_0x2c0a0c[_0x268fc7(0x189)]-0x1],_0xdc3124=_0x2c0a0c[_0x268fc7(0x23f)](0x0,-0x1)['join']('/'),_0x2276e0=_0x10abde[_0x268fc7(0x1ff)](_0xdc3124);_0x355018[_0x268fc7(0x196)]?.({'type':_0x268fc7(0x1e4),'folder':_0x2600d6});const _0x1a0d76={'name':_0x5b2dd7,'parentFolderId':_0x2276e0},_0x4d04a0=await _0x355018[_0x268fc7(0x1b9)](_0x268fc7(0x1d8)+_0x2600d6+'\x27...',()=>_0x32b515[_0x268fc7(0x244)][_0x268fc7(0x21c)](_0xac7c0d['parentId'],_0x1a0d76));_0x10abde[_0x268fc7(0x22f)](_0x2600d6,_0x4d04a0[_0x268fc7(0x228)]['id']),_0x355018[_0x268fc7(0x196)]?.({'type':_0x268fc7(0x221),'folder':_0x2600d6,'folderId':_0x4d04a0[_0x268fc7(0x228)]['id']}),_0x355018['logInfo']?.(_0x268fc7(0x148)+_0x2600d6+'\x27');}return _0x10abde;}export async function executePushSegmentDeletions(_0xedb0ed,_0x161b88,_0x24918e){const _0x4bb2d6=a152_0x547b34;if(_0x161b88[_0x4bb2d6(0x189)]===0x0)return 0x0;const {batchAsync:_0x7f9e23}=await import(_0x4bb2d6(0x23d)),_0x206624=0x5,_0x5a35f2=await _0x7f9e23(_0x161b88,async _0x2e03ad=>{const _0x4f947b=_0x4bb2d6;return _0x24918e[_0x4f947b(0x196)]?.({'type':_0x4f947b(0x1ba),'name':_0x2e03ad[_0x4f947b(0x19e)]}),await _0xedb0ed[_0x4f947b(0x244)]['deleteSegment'](_0x2e03ad['id']),_0x24918e[_0x4f947b(0x196)]?.({'type':_0x4f947b(0x18b),'name':_0x2e03ad[_0x4f947b(0x19e)]}),_0x24918e[_0x4f947b(0x1ca)]?.('Deleted\x20segment\x20\x27'+_0x2e03ad[_0x4f947b(0x19e)]+'\x27'),0x1;},_0x206624);return _0x5a35f2[_0x4bb2d6(0x1d7)]((_0x58803b,_0x366e98)=>_0x58803b+_0x366e98,0x0);}export async function executePushJourneys(_0xfab6f9,_0x25b28e,_0x12773f,_0x15c976,_0xcab0c9){const _0x515f52=a152_0x547b34,{journeyDefToRequest:_0x22e933}=await import(_0x515f52(0x213)),{activationDefToCreateRequest:_0x5d1af6,yamlRuleToApi:_0x59fddc,validateSegmentRule:_0xd85787}=await import(_0x515f52(0x210)),_0x4fcec5={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x547357=new Map(_0x12773f[_0x515f52(0x1eb)]),_0xfdae3a=0x5;for(let _0x5c28e7=0x0;_0x5c28e7<_0x25b28e[_0x515f52(0x189)];_0x5c28e7+=_0xfdae3a){const _0x23d0fe=_0x25b28e[_0x515f52(0x23f)](_0x5c28e7,_0x5c28e7+_0xfdae3a),_0x116c5a=await Promise[_0x515f52(0x23a)](_0x23d0fe['map'](async _0x132113=>{const _0x5b95a6=_0x515f52;if(!_0x132113[_0x5b95a6(0x239)]&&!_0x132113[_0x5b95a6(0x149)])return{'action':_0x5b95a6(0x187),'name':_0x132113[_0x5b95a6(0x19b)]['name'],'journeyId':_0x132113[_0x5b95a6(0x200)]?.['id']};const _0x589ad6=_0x132113['folderPath']?_0x12773f[_0x5b95a6(0x197)][_0x5b95a6(0x1ff)](_0x132113[_0x5b95a6(0x20c)]):undefined;_0xcab0c9[_0x5b95a6(0x196)]?.({'type':_0x132113[_0x5b95a6(0x239)]?_0x5b95a6(0x20a):_0x5b95a6(0x17b),'name':_0x132113['yamlConfig'][_0x5b95a6(0x19e)]});try{const _0x3c8dda=await executeSingleJourneyPush(_0xfab6f9,_0x132113,{..._0x12773f,'segmentNameToId':_0x547357},{'parentId':_0x15c976[_0x5b95a6(0x165)],'rootFolderId':_0x15c976[_0x5b95a6(0x23c)],'folderId':_0x589ad6,'verbose':_0x15c976[_0x5b95a6(0x190)]},_0xcab0c9,{'journeyDefToRequest':_0x22e933,'activationDefToCreateRequest':_0x5d1af6,'yamlRuleToApi':_0x59fddc,'validateSegmentRule':_0xd85787});for(const [_0x39c799,_0x3aa608]of _0x3c8dda[_0x5b95a6(0x214)]){_0x547357['set'](_0x39c799,_0x3aa608),_0x4fcec5[_0x5b95a6(0x214)]['set'](_0x39c799,_0x3aa608);}if(_0x3c8dda['action']===_0x5b95a6(0x229))_0xcab0c9[_0x5b95a6(0x196)]?.({'type':_0x5b95a6(0x18a),'name':_0x132113[_0x5b95a6(0x19b)][_0x5b95a6(0x19e)],'journeyId':_0x3c8dda[_0x5b95a6(0x1b5)]}),_0xcab0c9[_0x5b95a6(0x158)]?.(_0x5b95a6(0x24e)+_0x132113[_0x5b95a6(0x19b)][_0x5b95a6(0x19e)]+'\x27'),_0x4fcec5['created']++;else _0x3c8dda[_0x5b95a6(0x1c9)]===_0x5b95a6(0x15a)&&(_0xcab0c9[_0x5b95a6(0x196)]?.({'type':'journey_updated','name':_0x132113[_0x5b95a6(0x19b)][_0x5b95a6(0x19e)]}),_0xcab0c9[_0x5b95a6(0x158)]?.(_0x5b95a6(0x167)+_0x132113[_0x5b95a6(0x19b)]['name']+'\x27'),_0x4fcec5['updated']++);return{'action':_0x3c8dda[_0x5b95a6(0x1c9)],'name':_0x132113['yamlConfig'][_0x5b95a6(0x19e)],'journeyId':_0x3c8dda[_0x5b95a6(0x1b5)]};}catch(_0x2491d3){const _0x6f9407=isHttp400Error(_0x2491d3),_0x214304=_0x6f9407?ErrorCode[_0x5b95a6(0x241)]:ErrorCode[_0x5b95a6(0x1fc)],_0x2deb1d=getErrorMessage(_0x2491d3);throw new SDKError(_0x214304,'Failed\x20to\x20'+(_0x132113[_0x5b95a6(0x239)]?_0x5b95a6(0x1c0):_0x5b95a6(0x16e))+'\x20journey\x20from\x20file:\x20'+_0x132113['absolutePath']+_0x5b95a6(0x18d)+_0x2deb1d,_0x2491d3);}}));_0x4fcec5[_0x515f52(0x17a)][_0x515f52(0x202)](..._0x116c5a);}return _0x4fcec5;}async function matchExistingJourneySegments(_0x57f901,_0x6fe8e0,_0x15cca8,_0x3aeb0e,_0x49badc){const _0x23f147=a152_0x547b34;if(!_0x6fe8e0[_0x23f147(0x200)]||!_0x6fe8e0[_0x23f147(0x19b)]['segments'])return;const _0x8418b5=new Map(),_0x2940bd=new Set();for(const _0x1e35c1 of Object[_0x23f147(0x183)](_0x6fe8e0[_0x23f147(0x19b)]['segments'])){const _0x32eab2=generateDeterministicJourneySegmentName(_0x6fe8e0[_0x23f147(0x19b)][_0x23f147(0x19e)],_0x1e35c1);_0x8418b5[_0x23f147(0x22f)](_0x32eab2,_0x1e35c1),_0x2940bd[_0x23f147(0x19d)](_0x1e35c1);}const _0x37f769=[],_0x14892b=collectSegmentIdsFromJourneyApi(_0x6fe8e0['existingJourney']);for(const _0x30ae26 of _0x14892b){const _0x1387c7=await fetchSegment(_0x57f901,_0x15cca8,_0x30ae26,_0x3aeb0e);if(!_0x1387c7?.[_0x23f147(0x19e)])continue;const _0x111eb0=_0x8418b5['get'](_0x1387c7['name']);_0x111eb0?(_0x49badc[_0x23f147(0x22f)](_0x111eb0,_0x30ae26),_0x2940bd[_0x23f147(0x1a6)](_0x111eb0)):_0x37f769[_0x23f147(0x202)]({'id':_0x30ae26,'seg':_0x1387c7});}if(_0x2940bd[_0x23f147(0x24d)]>0x0&&_0x37f769['length']>0x0){const {localExpandedRuleToNames:_0x3513aa}=buildLocalExpandedRuleMappings(_0x6fe8e0['yamlConfig']),_0xefb764=new Map();for(const {id:_0x2f32d7,seg:_0x479dc3}of _0x37f769){if(_0x479dc3['rule']){const _0x37b6cc=apiRuleToYaml(_0x479dc3[_0x23f147(0x14b)]);_0xefb764[_0x23f147(0x22f)](_0x2f32d7,_0x37b6cc);}}for(const {id:_0x50fa31,seg:_0x3038ee}of _0x37f769){if(!_0x3038ee[_0x23f147(0x14b)])continue;const _0x5db973=_0xefb764[_0x23f147(0x1ff)](_0x50fa31);if(!_0x5db973)continue;const _0x2c079d=serializeExpandedRule(_0x5db973,_0xefb764),_0x2031b3=_0x3513aa[_0x23f147(0x1ff)](_0x2c079d);if(_0x2031b3){const _0x3f465e=_0x2031b3[_0x23f147(0x1a5)](_0x3172ed=>_0x2940bd[_0x23f147(0x242)](_0x3172ed));_0x3f465e&&(_0x49badc[_0x23f147(0x22f)](_0x3f465e,_0x50fa31),_0x2940bd[_0x23f147(0x1a6)](_0x3f465e),logger[_0x23f147(0x235)](_0x23f147(0x1cd)+_0x3038ee[_0x23f147(0x19e)]+_0x23f147(0x151)+_0x3f465e+_0x23f147(0x15f)));}}}}async function executeSingleJourneyPush(_0x5850df,_0x1e2fe3,_0x4a5978,_0x5d82bd,_0x2ea48f,_0x1a3a76){const _0x252e70=a152_0x547b34,{journeyDefToRequest:_0x22ea62,activationDefToCreateRequest:_0x14028b,yamlRuleToApi:_0x455a46,validateSegmentRule:_0xa8c6c9}=_0x1a3a76,_0xf3f02b=new Map(),_0x4ffbb6=new Map();recoverSegmentIdsFromPushRecovery(_0x1e2fe3,_0xf3f02b,_0x4a5978[_0x252e70(0x1eb)]);const _0x16e885=new Map(),_0x10de09=new Map(),_0x59462b=new Map();let _0x1f9696;const _0x1773ca=async()=>{const _0x36fbaa=_0x252e70;if(_0x1f9696)return;_0x1f9696=new Map();if(!_0x1e2fe3[_0x36fbaa(0x200)])return;const _0x250381=await _0x5850df[_0x36fbaa(0x1d2)][_0x36fbaa(0x249)](_0x1e2fe3[_0x36fbaa(0x200)]['id']);for(const _0x405319 of _0x250381){const _0x5be6dd=journeyActivationStepToYaml(_0x405319,_0x4a5978[_0x36fbaa(0x193)],_0x4a5978[_0x36fbaa(0x1c8)]),_0x2d256a=activationSignature(_0x5be6dd);!_0x1f9696[_0x36fbaa(0x242)](_0x2d256a)&&_0x1f9696[_0x36fbaa(0x22f)](_0x2d256a,_0x405319['id']),_0x5be6dd[_0x36fbaa(0x19e)]&&_0x4ffbb6[_0x36fbaa(0x22f)](_0x5be6dd[_0x36fbaa(0x19e)],_0x405319['id']);}};await matchExistingJourneySegments(_0x5850df,_0x1e2fe3,_0x5d82bd[_0x252e70(0x165)],_0x4a5978[_0x252e70(0x20b)],_0x4a5978[_0x252e70(0x1eb)]);const _0x5e543f={'resolveSegmentId':async _0x36e489=>{const _0x186ea2=_0x252e70,_0x11857a=_0x4a5978['segmentNameToId'][_0x186ea2(0x1ff)](_0x36e489);if(!_0x11857a)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x186ea2(0x179)+_0x36e489+_0x186ea2(0x18c)+_0x1e2fe3[_0x186ea2(0x19b)][_0x186ea2(0x19e)]+')');return _0x11857a;},'resolveEmbeddedSegmentId':async(_0x5743f2,_0x3a6419)=>{const _0x33c00e=_0x252e70,_0x2bb3a2=_0x4a5978[_0x33c00e(0x1eb)][_0x33c00e(0x1ff)](_0x5743f2);if(_0x2bb3a2)return _0x2bb3a2;const _0x26e142=_0x4a5978['existingSegments'][_0x33c00e(0x1a5)](_0x2e4902=>_0x2e4902[_0x33c00e(0x19e)]===_0x5743f2);if(_0x26e142)return _0x4a5978[_0x33c00e(0x1eb)]['set'](_0x5743f2,_0x26e142['id']),_0x26e142['id'];if(_0x1e2fe3[_0x33c00e(0x239)]){const {stageName:_0x295ac1,criteriaName:_0x20dded}=findSegmentCriteriaLocation(_0x1e2fe3[_0x33c00e(0x19b)],_0x5743f2);return _0xa8c6c9(_0x5743f2,_0x3a6419[_0x33c00e(0x14b)]),_0x10de09[_0x33c00e(0x22f)](_0x5743f2,{'definition':_0x3a6419,'stageName':_0x295ac1,'criteriaName':_0x20dded}),createPendingSegmentId(_0x5743f2);}const _0x4008bd=_0x1e2fe3['existingJourney']?.['id'];if(!_0x4008bd)throw new SDKError(ErrorCode[_0x33c00e(0x1fe)],_0x33c00e(0x1b3));const _0x31b2bd=_0x16e885[_0x33c00e(0x1ff)](_0x5743f2);if(_0x31b2bd)return _0x31b2bd;const _0x4e64d8=((async()=>{const _0x1f296c=_0x33c00e;_0xa8c6c9(_0x5743f2,_0x3a6419[_0x1f296c(0x14b)]);const _0x125b14=generateDeterministicJourneySegmentName(_0x1e2fe3[_0x1f296c(0x19b)]['name'],_0x5743f2),_0x10b209=_0x4a5978[_0x1f296c(0x20b)][_0x1f296c(0x1a5)](_0x2cc809=>_0x2cc809[_0x1f296c(0x19e)]===_0x125b14),_0x8b096f=createSegmentIdResolver(_0x4a5978[_0x1f296c(0x1eb)],_0x5743f2),_0x43f63c=await resolveRuleSegmentIds(_0x3a6419[_0x1f296c(0x14b)],_0x8b096f);let _0x2d3e4e;return _0x10b209?(await _0x5850df[_0x1f296c(0x244)][_0x1f296c(0x1c3)](_0x5d82bd[_0x1f296c(0x165)],_0x10b209['id'],{'description':_0x3a6419[_0x1f296c(0x20d)]||_0x1f296c(0x162)+_0x5743f2,'rule':_0x455a46(_0x43f63c),'countPopulation':!![]}),_0x2d3e4e=_0x10b209['id'],saveSegmentToPushRecovery(_0x1e2fe3['absolutePath'],_0x1e2fe3[_0x1f296c(0x19b)][_0x1f296c(0x19e)],_0x5743f2,{'segmentId':_0x2d3e4e,'uniqueServerName':_0x125b14,'createdAt':new Date()['toISOString']()})):_0x2d3e4e=await createOrRecoverEmbeddedSegment(_0x5850df,_0x1e2fe3,{'localName':_0x5743f2,'uniqueSegmentName':_0x125b14,'description':_0x3a6419[_0x1f296c(0x20d)]||_0x1f296c(0x162)+_0x5743f2,'journeyId':_0x4008bd,'resolvedRule':_0x43f63c,'parentId':_0x5d82bd['parentId'],'folderId':_0x5d82bd[_0x1f296c(0x23c)]||''},_0x455a46),_0x4a5978[_0x1f296c(0x1eb)][_0x1f296c(0x22f)](_0x5743f2,_0x2d3e4e),_0xf3f02b[_0x1f296c(0x22f)](_0x5743f2,_0x2d3e4e),_0x2d3e4e;})());_0x16e885[_0x33c00e(0x22f)](_0x5743f2,_0x4e64d8);try{return await _0x4e64d8;}finally{_0x16e885['delete'](_0x5743f2);}},'resolveActivationId':async _0x701edc=>{const _0x7578a2=_0x252e70,_0x11dc11=_0x4ffbb6[_0x7578a2(0x1ff)](_0x701edc);if(_0x11dc11)return _0x11dc11;if(_0x1e2fe3[_0x7578a2(0x200)]){await _0x1773ca();const _0x37f452=_0x4ffbb6[_0x7578a2(0x1ff)](_0x701edc);if(_0x37f452)return _0x37f452;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x7578a2(0x1f8)+_0x701edc+_0x7578a2(0x18c)+_0x1e2fe3[_0x7578a2(0x19b)]['name']+_0x7578a2(0x203)+_0x7578a2(0x206));},'resolveEmbeddedActivationId':async(_0x4ec027,_0x1152b9)=>{const _0x1b324a=_0x252e70,_0x46c8c1=_0x4ffbb6[_0x1b324a(0x1ff)](_0x4ec027);if(_0x46c8c1)return _0x46c8c1;if(_0x1e2fe3[_0x1b324a(0x239)])return _0x59462b[_0x1b324a(0x22f)](_0x4ec027,_0x1152b9),createPendingActivationId(_0x4ec027);if(_0x1e2fe3[_0x1b324a(0x200)]){await _0x1773ca();const _0x4cc9df=_0x4ffbb6[_0x1b324a(0x1ff)](_0x1152b9[_0x1b324a(0x19e)]);if(_0x4cc9df)return _0x4ffbb6['set'](_0x4ec027,_0x4cc9df),_0x4cc9df;const _0x2d423d=activationSignature(_0x1152b9),_0x29262d=_0x1f9696?.['get'](_0x2d423d);if(_0x29262d)return _0x4ffbb6[_0x1b324a(0x22f)](_0x4ec027,_0x29262d),_0x29262d;const _0x2c9f1a=await _0x14028b(_0x1152b9,_0x4a5978['activationContext']),_0x3c23d1={..._0x2c9f1a,..._0x1152b9[_0x1b324a(0x212)]!==undefined&&{'runAfterJourneyRefresh':_0x1152b9[_0x1b324a(0x212)]}},_0x5301e2=await _0x5850df['journey']['createActivation'](_0x1e2fe3['existingJourney']['id'],_0x3c23d1);return _0x4ffbb6[_0x1b324a(0x22f)](_0x4ec027,_0x5301e2['id']),_0x5301e2['id'];}throw new SDKError(ErrorCode[_0x1b324a(0x1fe)],_0x1b324a(0x238));},'resolveJourneyId':async _0x408f1f=>{const _0x4f8b30=_0x252e70;try{return await _0x5850df[_0x4f8b30(0x1d2)][_0x4f8b30(0x1ad)](_0x5d82bd[_0x4f8b30(0x165)],_0x408f1f);}catch(_0x542e88){throw new SDKError(ErrorCode['NOT_FOUND'],_0x4f8b30(0x1b8)+_0x408f1f+_0x4f8b30(0x1c6)+_0x1e2fe3[_0x4f8b30(0x19b)][_0x4f8b30(0x19e)]+'\x27)',_0x542e88);}},'resolveStageId':async(_0x20e79,_0x36da83)=>{const _0x93b809=_0x252e70,_0x574afe=await _0x5850df['journey'][_0x93b809(0x164)](_0x20e79),_0x223519=_0x574afe['attributes']['journeyStages'][_0x93b809(0x1a5)](_0x2cf562=>_0x2cf562[_0x93b809(0x19e)][_0x93b809(0x16c)]()===_0x36da83[_0x93b809(0x16c)]());if(!_0x223519?.['id'])throw new SDKError(ErrorCode[_0x93b809(0x20e)],_0x93b809(0x24f)+_0x36da83+_0x93b809(0x150)+(_0x574afe[_0x93b809(0x24c)]['journeyBundleName']||_0x574afe[_0x93b809(0x24c)][_0x93b809(0x19e)])+'\x27');return _0x223519['id'];}},_0x1aed60=await _0x22ea62(_0x1e2fe3[_0x252e70(0x19b)],_0x5d82bd[_0x252e70(0x165)],_0x5e543f),_0x799f6=_0x5d82bd[_0x252e70(0x1f1)]||_0x5d82bd[_0x252e70(0x23c)];_0x799f6&&(_0x1aed60[_0x252e70(0x14f)]={'parentFolder':{'data':{'id':_0x799f6,'type':_0x252e70(0x1b6)}}});if(_0x1e2fe3[_0x252e70(0x239)]){if(_0x10de09[_0x252e70(0x24d)]>0x0||_0x59462b[_0x252e70(0x24d)]>0x0)return await executeThreeStepJourneyCreate(_0x5850df,_0x1e2fe3,_0x1aed60,{'pendingEmbeddedSegments':_0x10de09,'pendingEmbeddedActivations':_0x59462b,'embeddedSegmentNameToId':_0xf3f02b,'journeyActivationNameToId':_0x4ffbb6},{..._0x5d82bd,'effectiveFolderId':_0x799f6},_0x4a5978,_0x2ea48f,_0x1a3a76);else{ensureJourneyDefaults(_0x1aed60[_0x252e70(0x24c)]);const _0x3ebc89=await _0x5850df[_0x252e70(0x1d2)][_0x252e70(0x1c0)](_0x1aed60);return deletePushRecovery(_0x1e2fe3[_0x252e70(0x1a4)]),{'action':_0x252e70(0x229),'journeyId':_0x3ebc89['id'],'embeddedSegmentNameToId':_0xf3f02b};}}else{if(_0x1e2fe3['hasChanges']&&_0x1e2fe3[_0x252e70(0x200)]){_0x1aed60['id']=_0x1e2fe3['existingJourney']['id'];const _0x51bd9a=_0x1aed60[_0x252e70(0x24c)];_0x1e2fe3[_0x252e70(0x200)][_0x252e70(0x24c)]?.[_0x252e70(0x22a)]&&(_0x51bd9a[_0x252e70(0x22a)]=_0x1e2fe3['existingJourney']['attributes']['journeyBundleName']);const _0x4cdaa4=_0x1e2fe3[_0x252e70(0x200)]['attributes']?.['journeyStages'];return _0x4cdaa4&&_0x1aed60[_0x252e70(0x24c)][_0x252e70(0x1ae)]&&injectExistingStageIds(_0x1aed60['attributes']['journeyStages'],_0x4cdaa4),ensureJourneyDefaults(_0x51bd9a),await _0x5850df['journey']['update'](_0x1e2fe3[_0x252e70(0x200)]['id'],_0x1aed60),deletePushRecovery(_0x1e2fe3[_0x252e70(0x1a4)]),{'action':_0x252e70(0x15a),'journeyId':_0x1e2fe3[_0x252e70(0x200)]['id'],'embeddedSegmentNameToId':_0xf3f02b};}}return deletePushRecovery(_0x1e2fe3[_0x252e70(0x1a4)]),{'action':_0x252e70(0x187),'journeyId':_0x1e2fe3[_0x252e70(0x200)]?.['id'],'embeddedSegmentNameToId':_0xf3f02b};}function findSegmentCriteriaLocation(_0x1842be,_0xd462fd){const _0x3f0a9d=a152_0x547b34,_0xe39ad1=_0x1842be[_0x3f0a9d(0x21f)]||_0x1842be['journeys']?.[0x0]?.['stages']||[];let _0x3b377d='entry',_0x30d45e=_0xd462fd;const _0x4fb5dc=_0x1842be[_0x3f0a9d(0x192)]||_0x1842be[_0x3f0a9d(0x1f9)]?.[0x0]?.[_0x3f0a9d(0x192)];if(_0x4fb5dc?.[_0x3f0a9d(0x244)]===_0xd462fd)return{'stageName':'goal','criteriaName':_0x4fb5dc['name']||_0xd462fd};_0x4122c0:for(const _0x386955 of _0xe39ad1){if(_0x386955[_0x3f0a9d(0x166)]?.['segment']===_0xd462fd){_0x3b377d=_0x386955[_0x3f0a9d(0x19e)],_0x30d45e=_0x386955[_0x3f0a9d(0x166)][_0x3f0a9d(0x19e)]||_0xd462fd;break;}if(_0x386955['steps'])for(const _0x58bb80 of _0x386955['steps']){if(_0x58bb80['type']===_0x3f0a9d(0x1fd)&&_0x58bb80[_0x3f0a9d(0x1e3)]?.[_0x3f0a9d(0x1bf)])for(const _0x3ed243 of _0x58bb80[_0x3f0a9d(0x1e3)][_0x3f0a9d(0x1bf)]){if(_0x3ed243['segment']===_0xd462fd){_0x3b377d=_0x386955[_0x3f0a9d(0x19e)],_0x30d45e=_0x3ed243[_0x3f0a9d(0x19e)]||_0xd462fd;break _0x4122c0;}}}}return{'stageName':_0x3b377d,'criteriaName':_0x30d45e};}async function executeThreeStepJourneyCreate(_0x3d6cef,_0x30c967,_0x39bf72,_0x1d1021,_0x4cbaee,_0x3ad2ee,_0x102b33,_0x57c35f){const _0x241986=a152_0x547b34,{activationDefToCreateRequest:_0x455cfb,yamlRuleToApi:_0x2d10e0}=_0x57c35f,{pendingEmbeddedSegments:_0x5628d6,pendingEmbeddedActivations:_0x2f178a,embeddedSegmentNameToId:_0x5da67a}=_0x1d1021,_0x286fe8=JSON[_0x241986(0x184)](JSON['stringify'](_0x39bf72));ensureJourneyDefaults(_0x286fe8[_0x241986(0x24c)]),stripPendingIds(_0x286fe8);const _0x2e4836=await _0x3d6cef[_0x241986(0x1d2)][_0x241986(0x1c0)](_0x286fe8),_0x19bd23=_0x2e4836['id'],_0x46ec5e=new Map();for(const _0x5f3389 of _0x2e4836['attributes']['journeyStages']){_0x46ec5e[_0x241986(0x22f)](_0x5f3389[_0x241986(0x19e)][_0x241986(0x16c)](),_0x5f3389['id']);}recoverSegmentIdsFromPushRecovery(_0x30c967,_0x5da67a,_0x3ad2ee[_0x241986(0x1eb)]);for(const [_0x5a9ce3,{definition:_0x415d83}]of _0x5628d6){if(_0x5da67a['has'](_0x5a9ce3)){_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x226),'journeyName':_0x30c967['yamlConfig'][_0x241986(0x19e)],'segmentName':_0x5a9ce3});continue;}const _0x322213=generateDeterministicJourneySegmentName(_0x30c967[_0x241986(0x19b)][_0x241986(0x19e)],_0x5a9ce3);_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x1d9),'journeyName':_0x30c967[_0x241986(0x19b)][_0x241986(0x19e)],'segmentName':_0x5a9ce3});const _0x280cd8=createSegmentIdResolver(_0x3ad2ee[_0x241986(0x1eb)],_0x5a9ce3),_0x2bc42f=await resolveRuleSegmentIds(_0x415d83[_0x241986(0x14b)],_0x280cd8),_0x55e85d=await createOrRecoverEmbeddedSegment(_0x3d6cef,_0x30c967,{'localName':_0x5a9ce3,'uniqueSegmentName':_0x322213,'description':_0x415d83[_0x241986(0x20d)]||_0x241986(0x162)+_0x5a9ce3,'journeyId':_0x19bd23,'resolvedRule':_0x2bc42f,'parentId':_0x4cbaee[_0x241986(0x165)],'folderId':_0x4cbaee[_0x241986(0x201)]||''},_0x2d10e0);_0x5da67a[_0x241986(0x22f)](_0x5a9ce3,_0x55e85d),_0x3ad2ee['segmentNameToId'][_0x241986(0x22f)](_0x5a9ce3,_0x55e85d),_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x226),'journeyName':_0x30c967[_0x241986(0x19b)][_0x241986(0x19e)],'segmentName':_0x5a9ce3});}const _0x2957c6=new Map();for(const [_0x2249f7,_0x121796]of _0x2f178a){_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x172),'journeyName':_0x30c967['yamlConfig'][_0x241986(0x19e)],'activationName':_0x2249f7});const _0x32f8b6=await _0x455cfb(_0x121796,_0x3ad2ee[_0x241986(0x1f0)]),_0x112d11={..._0x32f8b6,..._0x121796['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x121796['run_after_journey_refresh']}},_0x4ed264=await _0x3d6cef[_0x241986(0x1d2)][_0x241986(0x230)](_0x19bd23,_0x112d11);_0x2957c6[_0x241986(0x22f)](_0x2249f7,_0x4ed264['id']),_0x1d1021[_0x241986(0x1c1)]['set'](_0x2249f7,_0x4ed264['id']),_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x14d),'journeyName':_0x30c967['yamlConfig'][_0x241986(0x19e)],'activationName':_0x2249f7});}const _0x54ad80=JSON[_0x241986(0x184)](JSON[_0x241986(0x1f4)](_0x39bf72));return _0x54ad80['id']=_0x19bd23,ensureJourneyDefaults(_0x54ad80[_0x241986(0x24c)]),resolvePendingIdsInRequest(_0x54ad80,_0x39bf72,_0x46ec5e,_0x5da67a,_0x2957c6,_0x102b33),await _0x3d6cef['journey'][_0x241986(0x16e)](_0x19bd23,_0x54ad80),deletePushRecovery(_0x30c967['absolutePath']),{'action':_0x241986(0x229),'journeyId':_0x19bd23,'embeddedSegmentNameToId':_0x5da67a};}export function stripWaitStepPendingIds(_0x458ba8){const _0x1f530c=a152_0x547b34,_0x509b6a=_0x458ba8[_0x1f530c(0x18e)]&&isPendingSegmentId(_0x458ba8[_0x1f530c(0x18e)]),_0x4013fc=_0x458ba8['conditions']?.[_0x1f530c(0x251)](_0x34be67=>_0x34be67[_0x1f530c(0x23b)]&&isPendingSegmentId(_0x34be67[_0x1f530c(0x23b)]));(_0x509b6a||_0x4013fc)&&(_0x458ba8['waitStepType']=_0x1f530c(0x1de),_0x458ba8[_0x1f530c(0x1b2)]=0x1,_0x458ba8[_0x1f530c(0x1ac)]=_0x1f530c(0x160),delete _0x458ba8['conditionSegmentId'],delete _0x458ba8[_0x1f530c(0x211)],delete _0x458ba8[_0x1f530c(0x1cc)],delete _0x458ba8[_0x1f530c(0x155)]);}export function resolveWaitStepPendingIds(_0x384cef,_0x3f6325,_0x3360a8,_0x55a724){const _0x414ca8=a152_0x547b34;if(_0x3f6325['conditionSegmentId']&&isPendingSegmentId(_0x3f6325[_0x414ca8(0x18e)])){const _0x49c2fd=_0x3360a8(_0x3f6325[_0x414ca8(0x18e)],'stage\x20\x27'+_0x55a724+_0x414ca8(0x185));_0x49c2fd&&(_0x384cef['waitStepType']=_0x414ca8(0x1b0),_0x384cef[_0x414ca8(0x18e)]=_0x49c2fd,delete _0x384cef[_0x414ca8(0x1b2)],delete _0x384cef['waitStepUnit'],_0x3f6325[_0x414ca8(0x211)]!==undefined&&(_0x384cef[_0x414ca8(0x211)]=_0x3f6325[_0x414ca8(0x211)]),_0x3f6325[_0x414ca8(0x1cc)]&&(_0x384cef['conditionTimeoutUnit']=_0x3f6325[_0x414ca8(0x1cc)]));}if(_0x3f6325[_0x414ca8(0x155)]){const _0x558e0e=_0x3f6325[_0x414ca8(0x155)][_0x414ca8(0x251)](_0x25b29b=>_0x25b29b[_0x414ca8(0x23b)]&&isPendingSegmentId(_0x25b29b['segmentId']));if(_0x558e0e){const _0x112c27=_0x3f6325['conditions']['map'](_0x5b308f=>{const _0x594ae0=_0x414ca8;if(_0x5b308f[_0x594ae0(0x23b)]&&isPendingSegmentId(_0x5b308f[_0x594ae0(0x23b)])){const _0x3ce599=_0x3360a8(_0x5b308f[_0x594ae0(0x23b)],'stage\x20\x27'+_0x55a724+_0x594ae0(0x185));return{..._0x5b308f,'segmentId':_0x3ce599||_0x5b308f[_0x594ae0(0x23b)]};}return{..._0x5b308f};});_0x384cef[_0x414ca8(0x14e)]=_0x414ca8(0x1b0),_0x384cef[_0x414ca8(0x155)]=_0x112c27,delete _0x384cef[_0x414ca8(0x1b2)],delete _0x384cef[_0x414ca8(0x1ac)],delete _0x384cef[_0x414ca8(0x18e)],delete _0x384cef[_0x414ca8(0x211)],delete _0x384cef['conditionTimeoutUnit'];}}}function stripPendingIds(_0x4c5dc1){const _0x59e5d8=a152_0x547b34;_0x4c5dc1[_0x59e5d8(0x24c)][_0x59e5d8(0x192)]?.[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x4c5dc1[_0x59e5d8(0x24c)][_0x59e5d8(0x192)][_0x59e5d8(0x23b)])&&delete _0x4c5dc1['attributes'][_0x59e5d8(0x192)];for(const _0x583d22 of _0x4c5dc1['attributes'][_0x59e5d8(0x1ae)]||[]){_0x583d22[_0x59e5d8(0x1c2)]?.[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x583d22[_0x59e5d8(0x1c2)]['segmentId'])&&delete _0x583d22['entryCriteria'];_0x583d22[_0x59e5d8(0x21d)]?.[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x583d22[_0x59e5d8(0x21d)][_0x59e5d8(0x23b)])&&delete _0x583d22[_0x59e5d8(0x21d)];_0x583d22[_0x59e5d8(0x1a0)]&&(_0x583d22['exitCriterias']=_0x583d22[_0x59e5d8(0x1a0)]['filter'](_0x50b479=>!_0x50b479[_0x59e5d8(0x23b)]||!isPendingSegmentId(_0x50b479['segmentId'])));if(_0x583d22[_0x59e5d8(0x170)])for(const _0x19294d of Object[_0x59e5d8(0x183)](_0x583d22[_0x59e5d8(0x170)])){const _0x248093=_0x583d22[_0x59e5d8(0x170)][_0x19294d];_0x248093[_0x59e5d8(0x1e0)]==='Activation'&&_0x248093[_0x59e5d8(0x1ed)]&&isPendingActivationId(_0x248093['journeyActivationStepId'])&&(_0x248093[_0x59e5d8(0x1ed)]='');if(_0x248093[_0x59e5d8(0x1e0)]===_0x59e5d8(0x15e)&&_0x248093[_0x59e5d8(0x1bf)])for(const _0x115407 of _0x248093[_0x59e5d8(0x1bf)]){_0x115407[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x115407[_0x59e5d8(0x23b)])&&(_0x115407['segmentId']='');}_0x248093['type']==='WaitStep'&&stripWaitStepPendingIds(_0x248093);}}}function resolvePendingIdsInRequest(_0x5e926a,_0xd557ad,_0x30e578,_0xb7a08b,_0x378c36,_0x45a2a5){const _0x136046=a152_0x547b34,_0x2625a6=(_0x24507a,_0xf4c273)=>{const _0x4c7423=a152_0x57d7;if(!isPendingSegmentId(_0x24507a))return _0x24507a;const _0x45f2b4=extractPendingSegmentName(_0x24507a),_0x30dca4=_0xb7a08b[_0x4c7423(0x1ff)](_0x45f2b4);return!_0x30dca4&&_0x45a2a5[_0x4c7423(0x1ea)]?.(_0x4c7423(0x154)+_0x45f2b4+_0x4c7423(0x191)+_0xf4c273),_0x30dca4;};if(_0x5e926a['attributes']['goal']?.[_0x136046(0x23b)]&&isPendingSegmentId(_0x5e926a[_0x136046(0x24c)][_0x136046(0x192)][_0x136046(0x23b)])){const _0x20b7a0=_0x2625a6(_0x5e926a[_0x136046(0x24c)][_0x136046(0x192)][_0x136046(0x23b)],_0x136046(0x1da));_0x20b7a0&&(_0x5e926a[_0x136046(0x24c)]['goal'][_0x136046(0x23b)]=_0x20b7a0);}for(const _0x2c541d of _0x5e926a[_0x136046(0x24c)][_0x136046(0x1ae)]||[]){const _0x357484=_0x30e578[_0x136046(0x1ff)](_0x2c541d[_0x136046(0x19e)][_0x136046(0x16c)]());_0x357484&&(_0x2c541d['id']=_0x357484);if(_0x2c541d[_0x136046(0x1c2)]?.['segmentId']&&isPendingSegmentId(_0x2c541d[_0x136046(0x1c2)][_0x136046(0x23b)])){const _0x31cbf2=_0x2625a6(_0x2c541d[_0x136046(0x1c2)][_0x136046(0x23b)],_0x136046(0x22d)+_0x2c541d[_0x136046(0x19e)]+_0x136046(0x1b7));_0x31cbf2&&(_0x2c541d['entryCriteria'][_0x136046(0x23b)]=_0x31cbf2);}if(_0x2c541d[_0x136046(0x1a0)])for(const _0x4905c2 of _0x2c541d['exitCriterias']){if(_0x4905c2[_0x136046(0x23b)]&&isPendingSegmentId(_0x4905c2[_0x136046(0x23b)])){const _0xba6d56=_0x2625a6(_0x4905c2[_0x136046(0x23b)],'stage\x20\x27'+_0x2c541d[_0x136046(0x19e)]+'\x27\x20exit\x20criteria');_0xba6d56&&(_0x4905c2[_0x136046(0x23b)]=_0xba6d56);}}if(_0x2c541d[_0x136046(0x21d)]?.['segmentId']&&isPendingSegmentId(_0x2c541d[_0x136046(0x21d)][_0x136046(0x23b)])){const _0x5c0a28=_0x2625a6(_0x2c541d['milestone'][_0x136046(0x23b)],'stage\x20\x27'+_0x2c541d[_0x136046(0x19e)]+_0x136046(0x19c));_0x5c0a28&&(_0x2c541d['milestone'][_0x136046(0x23b)]=_0x5c0a28);}if(_0x2c541d[_0x136046(0x170)]){const _0x1d0fa0=_0x118304=>_0xd557ad[_0x136046(0x24c)][_0x136046(0x1ae)]?.['find'](_0x653e81=>_0x653e81[_0x136046(0x19e)]['toLowerCase']()===_0x2c541d[_0x136046(0x19e)]['toLowerCase']())?.['steps']?.[_0x118304];for(const _0x55c76d of Object['keys'](_0x2c541d[_0x136046(0x170)])){const _0x55a90d=_0x2c541d['steps'][_0x55c76d],_0x526e06=_0x1d0fa0(_0x55c76d);if(_0x55a90d[_0x136046(0x1e0)]===_0x136046(0x17e)&&_0x55a90d[_0x136046(0x1ed)]&&(isPendingActivationId(_0x55a90d[_0x136046(0x1ed)])||_0x55a90d[_0x136046(0x1ed)]==='')){if(_0x526e06?.[_0x136046(0x1ed)]&&isPendingActivationId(_0x526e06[_0x136046(0x1ed)])){const _0x2c4aca=extractPendingActivationName(_0x526e06[_0x136046(0x1ed)]),_0x54a4c5=_0x378c36[_0x136046(0x1ff)](_0x2c4aca);_0x54a4c5&&(_0x55a90d[_0x136046(0x1ed)]=_0x54a4c5);}}if(_0x55a90d[_0x136046(0x1e0)]==='DecisionPoint'&&_0x55a90d[_0x136046(0x1bf)]&&_0x526e06?.[_0x136046(0x1bf)])for(let _0xefaf36=0x0;_0xefaf36<_0x55a90d[_0x136046(0x1bf)]['length'];_0xefaf36++){const _0x32a84d=_0x55a90d['branches'][_0xefaf36],_0x1a7326=_0x526e06['branches'][_0xefaf36];if(_0x1a7326?.['segmentId']&&isPendingSegmentId(_0x1a7326[_0x136046(0x23b)])){const _0x2ee94d=_0x2625a6(_0x1a7326[_0x136046(0x23b)],_0x136046(0x22d)+_0x2c541d[_0x136046(0x19e)]+_0x136046(0x169)+(_0x32a84d[_0x136046(0x19e)]||_0xefaf36)+'\x27');_0x2ee94d&&(_0x32a84d[_0x136046(0x23b)]=_0x2ee94d);}}_0x55a90d[_0x136046(0x1e0)]===_0x136046(0x16a)&&_0x526e06?.[_0x136046(0x1e0)]===_0x136046(0x16a)&&resolveWaitStepPendingIds(_0x55a90d,_0x526e06,_0x2625a6,_0x2c541d['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x5c08da,_0x3c62a6){const _0x541c76=a153_0x263a,_0x1cb2f=_0x5c08da();while(!![]){try{const _0x1dc709=-parseInt(_0x541c76(0x11d))/0x1*(-parseInt(_0x541c76(0x11f))/0x2)+parseInt(_0x541c76(0x128))/0x3+-parseInt(_0x541c76(0x123))/0x4+-parseInt(_0x541c76(0x121))/0x5+-parseInt(_0x541c76(0x120))/0x6*(-parseInt(_0x541c76(0x125))/0x7)+-parseInt(_0x541c76(0x126))/0x8*(-parseInt(_0x541c76(0x129))/0x9)+-parseInt(_0x541c76(0x12a))/0xa;if(_0x1dc709===_0x3c62a6)break;else _0x1cb2f['push'](_0x1cb2f['shift']());}catch(_0x552cfa){_0x1cb2f['push'](_0x1cb2f['shift']());}}}(a153_0x528e,0x8a5bc));export function buildFolderIdToPathMap(_0x12482f){const _0x53cdb3=a153_0x263a,_0xe25903=new Map(),_0x4e3bec=new Map();for(const _0x4a80a6 of _0x12482f){_0x4e3bec[_0x53cdb3(0x12b)](_0x4a80a6['id'],_0x4a80a6);}const _0x509f91=new Set();for(const _0x369754 of _0x12482f){!_0x369754[_0x53cdb3(0x122)]&&_0x509f91[_0x53cdb3(0x127)](_0x369754['id']);}function _0x49ec8e(_0x14070e){const _0x761868=_0x53cdb3;if(_0xe25903[_0x761868(0x124)](_0x14070e['id']))return _0xe25903['get'](_0x14070e['id']);if(_0x509f91['has'](_0x14070e['id']))return _0xe25903[_0x761868(0x12b)](_0x14070e['id'],''),'';if(_0x14070e['parentFolderId']){const _0x8a12db=_0x4e3bec[_0x761868(0x11e)](_0x14070e[_0x761868(0x122)]);if(_0x8a12db){const _0xdb670d=_0x49ec8e(_0x8a12db),_0x489f17=_0xdb670d?_0xdb670d+'/'+_0x14070e[_0x761868(0x11c)]:_0x14070e['name'];return _0xe25903[_0x761868(0x12b)](_0x14070e['id'],_0x489f17),_0x489f17;}}const _0x19bb65=_0x14070e[_0x761868(0x11c)];return _0xe25903[_0x761868(0x12b)](_0x14070e['id'],_0x19bb65),_0x19bb65;}for(const _0x1cd96e of _0x12482f){_0x49ec8e(_0x1cd96e);}return _0xe25903;}function a153_0x528e(){const _0x254e14=['2484855WOuQxJ','3054960AJhwwv','set','name','1CRZrGV','get','411874hBdpjc','154056fDkpPC','960900cgGKvM','parentFolderId','3068188tRMGKQ','has','105tWiguu','24jXOFzg','add','1236231OKVPKN'];a153_0x528e=function(){return _0x254e14;};return a153_0x528e();}function a153_0x263a(_0xd84605,_0x4b16d4){_0xd84605=_0xd84605-0x11c;const _0x528e4d=a153_0x528e();let _0x263a67=_0x528e4d[_0xd84605];return _0x263a67;}export function buildFolderPathToIdMap(_0x482f09){const _0x518e29=a153_0x263a,_0x1808f4=new Map(),_0x3af93d=new Map();for(const _0xef4dda of _0x482f09){_0x3af93d['set'](_0xef4dda['id'],_0xef4dda);}const _0x379b5c=new Set();for(const _0x1c1cbe of _0x482f09){!_0x1c1cbe[_0x518e29(0x122)]&&_0x379b5c[_0x518e29(0x127)](_0x1c1cbe['id']);}function _0x51a630(_0x493296){const _0x59d5b4=_0x518e29;if(_0x379b5c[_0x59d5b4(0x124)](_0x493296['id']))return'';if(_0x493296['parentFolderId']){const _0x1c3f06=_0x3af93d['get'](_0x493296[_0x59d5b4(0x122)]);if(_0x1c3f06){const _0x5835e5=_0x51a630(_0x1c3f06);return _0x5835e5?_0x5835e5+'/'+_0x493296[_0x59d5b4(0x11c)]:_0x493296[_0x59d5b4(0x11c)];}}return _0x493296[_0x59d5b4(0x11c)];}for(const _0x4fa4a1 of _0x482f09){const _0x110954=_0x51a630(_0x4fa4a1);_0x1808f4[_0x518e29(0x12b)](_0x110954,_0x4fa4a1['id']);}return _0x1808f4;}export function buildFolderMaps(_0x473839){const _0x270dfb=a153_0x263a,_0x32e67d=buildFolderIdToPathMap(_0x473839),_0x40b1fe=new Map();for(const [_0x38d877,_0x267eaa]of _0x32e67d){_0x40b1fe[_0x270dfb(0x12b)](_0x267eaa,_0x38d877);}return{'idToPath':_0x32e67d,'pathToId':_0x40b1fe};}export function getFolderPath(_0x32837c,_0x208cf0){const _0x48edee=a153_0x263a;if(!_0x32837c)return'';return _0x208cf0[_0x48edee(0x11e)](_0x32837c)??'';}
1
+ (function(_0x368f6b,_0xa5b264){const _0x38cc27=a153_0x34fe,_0x3741d8=_0x368f6b();while(!![]){try{const _0x556cea=-parseInt(_0x38cc27(0xe3))/0x1*(-parseInt(_0x38cc27(0xe9))/0x2)+parseInt(_0x38cc27(0xdd))/0x3*(parseInt(_0x38cc27(0xe4))/0x4)+-parseInt(_0x38cc27(0xdf))/0x5+-parseInt(_0x38cc27(0xe5))/0x6+parseInt(_0x38cc27(0xde))/0x7+-parseInt(_0x38cc27(0xe7))/0x8*(parseInt(_0x38cc27(0xe2))/0x9)+parseInt(_0x38cc27(0xe1))/0xa;if(_0x556cea===_0xa5b264)break;else _0x3741d8['push'](_0x3741d8['shift']());}catch(_0x247d86){_0x3741d8['push'](_0x3741d8['shift']());}}}(a153_0x2296,0xde1c5));export function buildFolderIdToPathMap(_0x4c5a4e){const _0x549ec1=a153_0x34fe,_0x1adc90=new Map(),_0x4a27e2=new Map();for(const _0x599ed7 of _0x4c5a4e){_0x4a27e2[_0x549ec1(0xea)](_0x599ed7['id'],_0x599ed7);}const _0x442762=new Set();for(const _0x566555 of _0x4c5a4e){!_0x566555[_0x549ec1(0xdb)]&&_0x442762[_0x549ec1(0xe6)](_0x566555['id']);}function _0x36c4c5(_0x131919){const _0x1b1ecf=_0x549ec1;if(_0x1adc90['has'](_0x131919['id']))return _0x1adc90[_0x1b1ecf(0xe0)](_0x131919['id']);if(_0x442762[_0x1b1ecf(0xe8)](_0x131919['id']))return _0x1adc90['set'](_0x131919['id'],''),'';if(_0x131919[_0x1b1ecf(0xdb)]){const _0x574e8b=_0x4a27e2[_0x1b1ecf(0xe0)](_0x131919[_0x1b1ecf(0xdb)]);if(_0x574e8b){const _0x385581=_0x36c4c5(_0x574e8b),_0x203203=_0x385581?_0x385581+'/'+_0x131919[_0x1b1ecf(0xdc)]:_0x131919[_0x1b1ecf(0xdc)];return _0x1adc90['set'](_0x131919['id'],_0x203203),_0x203203;}}const _0x5d0bfe=_0x131919[_0x1b1ecf(0xdc)];return _0x1adc90[_0x1b1ecf(0xea)](_0x131919['id'],_0x5d0bfe),_0x5d0bfe;}for(const _0x33e1a8 of _0x4c5a4e){_0x36c4c5(_0x33e1a8);}return _0x1adc90;}export function buildFolderPathToIdMap(_0x3da3c9){const _0x29b048=a153_0x34fe,_0x374ab2=new Map(),_0x507c40=new Map();for(const _0x1daaa5 of _0x3da3c9){_0x507c40[_0x29b048(0xea)](_0x1daaa5['id'],_0x1daaa5);}const _0x1f314b=new Set();for(const _0x5b2fe1 of _0x3da3c9){!_0x5b2fe1[_0x29b048(0xdb)]&&_0x1f314b[_0x29b048(0xe6)](_0x5b2fe1['id']);}function _0x1b27ec(_0x39dc3b){const _0x2bdfdc=_0x29b048;if(_0x1f314b[_0x2bdfdc(0xe8)](_0x39dc3b['id']))return'';if(_0x39dc3b['parentFolderId']){const _0x386fcf=_0x507c40[_0x2bdfdc(0xe0)](_0x39dc3b[_0x2bdfdc(0xdb)]);if(_0x386fcf){const _0x1af7b3=_0x1b27ec(_0x386fcf);return _0x1af7b3?_0x1af7b3+'/'+_0x39dc3b[_0x2bdfdc(0xdc)]:_0x39dc3b[_0x2bdfdc(0xdc)];}}return _0x39dc3b[_0x2bdfdc(0xdc)];}for(const _0x19189e of _0x3da3c9){const _0x24b893=_0x1b27ec(_0x19189e);_0x374ab2[_0x29b048(0xea)](_0x24b893,_0x19189e['id']);}return _0x374ab2;}export function buildFolderMaps(_0xddcb45){const _0x215f30=a153_0x34fe,_0x155f42=buildFolderIdToPathMap(_0xddcb45),_0x4d51c3=new Map();for(const [_0x13309a,_0x5775f8]of _0x155f42){_0x4d51c3[_0x215f30(0xea)](_0x5775f8,_0x13309a);}return{'idToPath':_0x155f42,'pathToId':_0x4d51c3};}function a153_0x34fe(_0x5b7380,_0x3070cb){_0x5b7380=_0x5b7380-0xdb;const _0x229640=a153_0x2296();let _0x34feb2=_0x229640[_0x5b7380];return _0x34feb2;}function a153_0x2296(){const _0x438d7b=['1EXvIZN','16ZbrRaa','2986734dKrtSw','add','30136ydBlCy','has','3528288ksrbzV','set','parentFolderId','name','373512QUZVso','9151072tjnjwn','5616360Otwsgk','get','5736460LceltG','3852CpiQSc'];a153_0x2296=function(){return _0x438d7b;};return a153_0x2296();}export function getFolderPath(_0x15bdb1,_0x2a26fe){const _0x411f71=a153_0x34fe;if(!_0x15bdb1)return'';return _0x2a26fe[_0x411f71(0xe0)](_0x15bdb1)??'';}
@@ -1 +1 @@
1
- (function(_0x47e7b9,_0xce1ec3){const _0x140b30=a154_0x2444,_0x3f50b3=_0x47e7b9();while(!![]){try{const _0x139dd0=parseInt(_0x140b30(0x9d))/0x1+-parseInt(_0x140b30(0x92))/0x2*(-parseInt(_0x140b30(0x90))/0x3)+parseInt(_0x140b30(0x97))/0x4*(parseInt(_0x140b30(0x85))/0x5)+-parseInt(_0x140b30(0x95))/0x6+-parseInt(_0x140b30(0x8a))/0x7+parseInt(_0x140b30(0x89))/0x8+-parseInt(_0x140b30(0xa9))/0x9*(parseInt(_0x140b30(0xa6))/0xa);if(_0x139dd0===_0xce1ec3)break;else _0x3f50b3['push'](_0x3f50b3['shift']());}catch(_0x285255){_0x3f50b3['push'](_0x3f50b3['shift']());}}}(a154_0x5e8a,0xb9630));import a154_0x363446 from'path';import{parse as a154_0x9ff12c}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x202db9){const _0x326d9b=a154_0x2444;if(!_0x202db9||_0x202db9[_0x326d9b(0x88)]()==='')throw new Error(_0x326d9b(0x99));const _0x1570d2=_0x202db9[_0x326d9b(0x88)]();if(_0x1570d2==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x202db9};const _0x4d6e9d=_0x1570d2[_0x326d9b(0xa4)]('/')?_0x1570d2[_0x326d9b(0x7a)](0x1):_0x1570d2,_0x298985=_0x4d6e9d['split']('/')[_0x326d9b(0x98)](_0x283beb=>_0x283beb!=='');if(_0x298985[_0x326d9b(0x86)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x3e96df=_0x1570d2[_0x326d9b(0xa4)]('/')||!isRelativePathSegment(_0x298985[0x0]);for(const _0x49d85d of _0x298985){validatePathSegment(_0x49d85d);}return{'segments':_0x298985,'isAbsolute':_0x3e96df,'raw':_0x202db9};}function isRelativePathSegment(_0x346de6){return _0x346de6==='.'||_0x346de6==='..';}function validatePathSegment(_0x34a990){const _0x478d86=a154_0x2444;if(_0x34a990==='')throw new Error(_0x478d86(0x81));if(_0x34a990==='.'||_0x34a990==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x34a990))throw new Error(_0x478d86(0x7e)+_0x34a990);if(_0x34a990!==_0x34a990[_0x478d86(0x88)]()){}}function a154_0x5e8a(){const _0x5e9a59=['Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','journey','resolve','Path\x20segment\x20cannot\x20be\x20empty','pop','File\x20not\x20found:\x20','raw','5OgNqZP','length','type','trim','5736664MctkVN','6638037NxOCQE','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','readFile','relative','parse','tdx.json','4069707wsOWJo','join','2jgCPIm','dirname','endsWith','1424190UjoBun','push','1044076IuoRMS','filter','Path\x20cannot\x20be\x20empty','Path\x20attempts\x20to\x20navigate\x20above\x20root','Cannot\x20navigate\x20above\x20root','name','704330ZPiLfi','root','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','.yml','Relative\x20path\x20cannot\x20be\x20empty','No\x20tdx.json\x20found\x20for\x20file:\x20','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','startsWith','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','3646670DuYuuq','exists','segments','27iBMeGH','substring','slice','Cannot\x20split\x20empty\x20path','isAbsolute'];a154_0x5e8a=function(){return _0x5e9a59;};return a154_0x5e8a();}export function validatePath(_0x28d492){const _0x484bbe=a154_0x2444;if(_0x28d492[_0x484bbe(0xa8)]['length']===0x0&&!_0x28d492['isAbsolute'])throw new Error(_0x484bbe(0xa1));if(_0x28d492[_0x484bbe(0x7d)]){if(_0x28d492['segments'][0x0]==='..')throw new Error(_0x484bbe(0xa3));let _0xd7744a=0x0;for(const _0x3394d6 of _0x28d492[_0x484bbe(0xa8)]){if(_0x3394d6==='..'){if(_0xd7744a===0x0)throw new Error(_0x484bbe(0x9a));_0xd7744a--;}else _0x3394d6!=='.'&&_0xd7744a++;}}}function a154_0x2444(_0x31c0aa,_0x1c3817){_0x31c0aa=_0x31c0aa-0x7a;const _0x5e8a66=a154_0x5e8a();let _0x2444de=_0x5e8a66[_0x31c0aa];return _0x2444de;}export function joinPaths(_0x201c64,_0x27b9d2){const _0x1be5be=a154_0x2444;if(!_0x201c64||_0x201c64==='/')return _0x27b9d2;if(!_0x27b9d2||_0x27b9d2==='.')return _0x201c64;if(_0x27b9d2[_0x1be5be(0xa4)]('/'))return _0x27b9d2;const _0x2e11e8=parsePath(_0x201c64),_0x566177=parsePath(_0x27b9d2),_0x9ea592=[..._0x2e11e8[_0x1be5be(0xa8)]];for(const _0x9284fa of _0x566177['segments']){if(_0x9284fa==='.')continue;else{if(_0x9284fa==='..'){if(_0x9ea592[_0x1be5be(0x86)]===0x0)throw new Error(_0x1be5be(0x9b));_0x9ea592[_0x1be5be(0x82)]();}else _0x9ea592[_0x1be5be(0x96)](_0x9284fa);}}const _0x558ca2=_0x9ea592['join']('/');return _0x2e11e8[_0x1be5be(0x84)][_0x1be5be(0xa4)]('/')?'/'+_0x558ca2:_0x558ca2;}export function normalizePath(_0x38bd65){const _0x34b3e2=a154_0x2444,_0x4895c0=parsePath(_0x38bd65),_0x3ed63b=[];for(const _0x5eea43 of _0x4895c0[_0x34b3e2(0xa8)]){if(_0x5eea43==='.')continue;else{if(_0x5eea43==='..'){if(_0x3ed63b[_0x34b3e2(0x86)]===0x0){if(_0x4895c0[_0x34b3e2(0x7d)])throw new Error(_0x34b3e2(0x9b));_0x3ed63b[_0x34b3e2(0x96)]('..');}else _0x3ed63b[_0x3ed63b['length']-0x1]==='..'?_0x3ed63b['push']('..'):_0x3ed63b[_0x34b3e2(0x82)]();}else _0x3ed63b['push'](_0x5eea43);}}if(_0x3ed63b[_0x34b3e2(0x86)]===0x0)return _0x4895c0[_0x34b3e2(0x7d)]?'/':'.';const _0x338013=_0x3ed63b[_0x34b3e2(0x91)]('/');return _0x4895c0[_0x34b3e2(0x84)][_0x34b3e2(0xa4)]('/')?'/'+_0x338013:_0x338013;}export function getParentPath(_0x334675){const _0x37b089=a154_0x2444,_0x59a1f9=parsePath(_0x334675);if(_0x59a1f9['segments'][_0x37b089(0x86)]<=0x1)return'/';const _0x23f34a=_0x59a1f9[_0x37b089(0xa8)][_0x37b089(0x7b)](0x0,-0x1)[_0x37b089(0x91)]('/');return _0x59a1f9[_0x37b089(0x84)][_0x37b089(0xa4)]('/')?'/'+_0x23f34a:_0x23f34a;}export function getBaseName(_0x13b289){const _0x5124cc=a154_0x2444,_0x127e2f=parsePath(_0x13b289);return _0x127e2f[_0x5124cc(0xa8)][_0x127e2f[_0x5124cc(0xa8)][_0x5124cc(0x86)]-0x1]||'';}export function isChildPath(_0x34d361,_0x2d02e5){const _0x35dd21=a154_0x2444,_0x21dfd1=parsePath(_0x34d361),_0x5b0488=parsePath(_0x2d02e5);if(_0x21dfd1[_0x35dd21(0xa8)][_0x35dd21(0x86)]<=_0x5b0488[_0x35dd21(0xa8)][_0x35dd21(0x86)])return![];for(let _0x4c3cd8=0x0;_0x4c3cd8<_0x5b0488[_0x35dd21(0xa8)][_0x35dd21(0x86)];_0x4c3cd8++){if(_0x21dfd1[_0x35dd21(0xa8)][_0x4c3cd8]!==_0x5b0488[_0x35dd21(0xa8)][_0x4c3cd8])return![];}return!![];}export function splitPath(_0x3b29f3){const _0x59301d=a154_0x2444,_0x34b4d3=parsePath(_0x3b29f3);if(_0x34b4d3[_0x59301d(0xa8)][_0x59301d(0x86)]===0x0)throw new Error(_0x59301d(0x7c));if(_0x34b4d3[_0x59301d(0xa8)][_0x59301d(0x86)]===0x1)return{'parent':_0x34b4d3['segments'][0x0]};return{'parent':_0x34b4d3['segments'][0x0],'child':_0x34b4d3[_0x59301d(0xa8)][_0x59301d(0x7b)](0x1)[_0x59301d(0x91)]('/')};}export function isYamlFilePath(_0x2e312c){const _0x159eb8=a154_0x2444;return _0x2e312c[_0x159eb8(0x94)](_0x159eb8(0xa0))||_0x2e312c[_0x159eb8(0x94)]('.yaml');}export async function resolveYamlFilePath(_0xb5d86e,_0x38ab18=nodeFileSystem){const _0x5a89bb=a154_0x2444,_0x155498=a154_0x363446[_0x5a89bb(0x80)](_0xb5d86e);if(!await _0x38ab18[_0x5a89bb(0xa7)](_0x155498))throw new Error(_0x5a89bb(0x83)+_0xb5d86e);let _0x279d86=a154_0x363446[_0x5a89bb(0x93)](_0x155498),_0x4adec3=null,_0x41b5a2=null;const _0x447a38=a154_0x363446[_0x5a89bb(0x8e)](_0x279d86)[_0x5a89bb(0x9e)];while(_0x279d86!==_0x447a38){const _0x117379=a154_0x363446[_0x5a89bb(0x91)](_0x279d86,_0x5a89bb(0x8f));if(await _0x38ab18['exists'](_0x117379)){_0x4adec3=_0x117379,_0x41b5a2=_0x279d86;break;}_0x279d86=a154_0x363446[_0x5a89bb(0x93)](_0x279d86);}if(!_0x4adec3||!_0x41b5a2)throw new Error(_0x5a89bb(0xa2)+_0xb5d86e+'\x0a'+_0x5a89bb(0x8b));const _0x387b75=await _0x38ab18[_0x5a89bb(0x8c)](_0x4adec3),_0x32cbba=JSON['parse'](_0x387b75),_0x3eda78=_0x32cbba['parent_segment'];if(!_0x3eda78)throw new Error(_0x5a89bb(0x9f));const _0x1b005a=await _0x38ab18[_0x5a89bb(0x8c)](_0x155498),_0x2894f7=a154_0x9ff12c(_0x1b005a),_0x442911=_0x2894f7[_0x5a89bb(0x9c)];if(!_0x442911)throw new Error(_0x5a89bb(0xa5)+_0xb5d86e);const _0x29de15=_0x2894f7[_0x5a89bb(0x87)]===_0x5a89bb(0x7f)?'journey':'segment',_0x421565=a154_0x363446[_0x5a89bb(0x8d)](_0x41b5a2,_0x155498),_0x434513=a154_0x363446['dirname'](_0x421565),_0x22510e=_0x434513==='.'?'':_0x434513['replace'](/\\/g,'/'),_0x179c9f=_0x22510e?_0x3eda78+'/'+_0x22510e+'/'+_0x442911:_0x3eda78+'/'+_0x442911;return{'parentSegment':_0x3eda78,'segmentName':_0x442911,'folderPath':_0x22510e,'fullPath':_0x179c9f,'resourceType':_0x29de15,'content':_0x1b005a};}
1
+ (function(_0x1cf657,_0x3013a6){const _0x19ec1d=a154_0x145f,_0x4e87b1=_0x1cf657();while(!![]){try{const _0x3a4fa1=-parseInt(_0x19ec1d(0x210))/0x1+parseInt(_0x19ec1d(0x206))/0x2*(-parseInt(_0x19ec1d(0x214))/0x3)+parseInt(_0x19ec1d(0x202))/0x4+parseInt(_0x19ec1d(0x1f5))/0x5*(parseInt(_0x19ec1d(0x204))/0x6)+-parseInt(_0x19ec1d(0x1f3))/0x7*(parseInt(_0x19ec1d(0x1eb))/0x8)+-parseInt(_0x19ec1d(0x1fd))/0x9+parseInt(_0x19ec1d(0x1f8))/0xa*(parseInt(_0x19ec1d(0x219))/0xb);if(_0x3a4fa1===_0x3013a6)break;else _0x4e87b1['push'](_0x4e87b1['shift']());}catch(_0x253af6){_0x4e87b1['push'](_0x4e87b1['shift']());}}}(a154_0x18b9,0xd4d64));function a154_0x18b9(){const _0x26d6fc=['exists','.yaml','parent_segment','filter','6936812yhyQtE','parse','20166NxHEHS','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','12cJwcnF','slice','segments','raw','Path\x20cannot\x20be\x20empty','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','No\x20tdx.json\x20found\x20for\x20file:\x20','resolve','Path\x20attempts\x20to\x20navigate\x20above\x20root','isAbsolute','165065TvxESP','trim','Cannot\x20navigate\x20above\x20root','Cannot\x20split\x20empty\x20path','124830hEwILp','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','root','test','Path\x20segment\x20cannot\x20be\x20empty','13156979INvmWz','split','join','File\x20not\x20found:\x20','readFile','136dhXRjq','pop','name','dirname','length','tdx.json','endsWith','push','257705roTRdJ','journey','715rWQPxj','replace','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','10cdvBxa','startsWith','relative','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','substring','13486995zROLaN'];a154_0x18b9=function(){return _0x26d6fc;};return a154_0x18b9();}import a154_0x5ee219 from'path';import{parse as a154_0x537b20}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xf292d1){const _0x2e2218=a154_0x145f;if(!_0xf292d1||_0xf292d1[_0x2e2218(0x211)]()==='')throw new Error(_0x2e2218(0x20a));const _0x2c3875=_0xf292d1[_0x2e2218(0x211)]();if(_0x2c3875==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xf292d1};const _0x48bf27=_0x2c3875[_0x2e2218(0x1f9)]('/')?_0x2c3875[_0x2e2218(0x1fc)](0x1):_0x2c3875,_0x4da826=_0x48bf27[_0x2e2218(0x1e7)]('/')[_0x2e2218(0x201)](_0x5dea0a=>_0x5dea0a!=='');if(_0x4da826[_0x2e2218(0x1ef)]===0x0)throw new Error(_0x2e2218(0x20b));const _0x5732eb=_0x2c3875['startsWith']('/')||!isRelativePathSegment(_0x4da826[0x0]);for(const _0x3ff8c3 of _0x4da826){validatePathSegment(_0x3ff8c3);}return{'segments':_0x4da826,'isAbsolute':_0x5732eb,'raw':_0xf292d1};}function isRelativePathSegment(_0x120bc6){return _0x120bc6==='.'||_0x120bc6==='..';}function validatePathSegment(_0x442ece){const _0x4f8e1c=a154_0x145f;if(_0x442ece==='')throw new Error(_0x4f8e1c(0x218));if(_0x442ece==='.'||_0x442ece==='..')return;if(/[\x00-\x1F\x7F]/[_0x4f8e1c(0x217)](_0x442ece))throw new Error(_0x4f8e1c(0x205)+_0x442ece);if(_0x442ece!==_0x442ece['trim']()){}}export function validatePath(_0x439e42){const _0x46ea94=a154_0x145f;if(_0x439e42['segments'][_0x46ea94(0x1ef)]===0x0&&!_0x439e42[_0x46ea94(0x20f)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x439e42[_0x46ea94(0x20f)]){if(_0x439e42[_0x46ea94(0x208)][0x0]==='..')throw new Error(_0x46ea94(0x215));let _0x2dce9e=0x0;for(const _0x13ab67 of _0x439e42[_0x46ea94(0x208)]){if(_0x13ab67==='..'){if(_0x2dce9e===0x0)throw new Error(_0x46ea94(0x20e));_0x2dce9e--;}else _0x13ab67!=='.'&&_0x2dce9e++;}}}function a154_0x145f(_0x56eca5,_0x540f86){_0x56eca5=_0x56eca5-0x1e7;const _0x18b9e4=a154_0x18b9();let _0x145fbf=_0x18b9e4[_0x56eca5];return _0x145fbf;}export function joinPaths(_0x2ec407,_0x33ef1e){const _0x5054a6=a154_0x145f;if(!_0x2ec407||_0x2ec407==='/')return _0x33ef1e;if(!_0x33ef1e||_0x33ef1e==='.')return _0x2ec407;if(_0x33ef1e[_0x5054a6(0x1f9)]('/'))return _0x33ef1e;const _0x1c71a9=parsePath(_0x2ec407),_0x1e3a5f=parsePath(_0x33ef1e),_0x2c43e2=[..._0x1c71a9[_0x5054a6(0x208)]];for(const _0x18a0e3 of _0x1e3a5f[_0x5054a6(0x208)]){if(_0x18a0e3==='.')continue;else{if(_0x18a0e3==='..'){if(_0x2c43e2['length']===0x0)throw new Error(_0x5054a6(0x212));_0x2c43e2[_0x5054a6(0x1ec)]();}else _0x2c43e2[_0x5054a6(0x1f2)](_0x18a0e3);}}const _0x198d22=_0x2c43e2[_0x5054a6(0x1e8)]('/');return _0x1c71a9[_0x5054a6(0x209)][_0x5054a6(0x1f9)]('/')?'/'+_0x198d22:_0x198d22;}export function normalizePath(_0x262ff1){const _0x1f2441=a154_0x145f,_0x5f2cb1=parsePath(_0x262ff1),_0x545d91=[];for(const _0x102077 of _0x5f2cb1[_0x1f2441(0x208)]){if(_0x102077==='.')continue;else{if(_0x102077==='..'){if(_0x545d91[_0x1f2441(0x1ef)]===0x0){if(_0x5f2cb1[_0x1f2441(0x20f)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x545d91[_0x1f2441(0x1f2)]('..');}else _0x545d91[_0x545d91['length']-0x1]==='..'?_0x545d91[_0x1f2441(0x1f2)]('..'):_0x545d91[_0x1f2441(0x1ec)]();}else _0x545d91[_0x1f2441(0x1f2)](_0x102077);}}if(_0x545d91[_0x1f2441(0x1ef)]===0x0)return _0x5f2cb1[_0x1f2441(0x20f)]?'/':'.';const _0x3d2613=_0x545d91[_0x1f2441(0x1e8)]('/');return _0x5f2cb1[_0x1f2441(0x209)][_0x1f2441(0x1f9)]('/')?'/'+_0x3d2613:_0x3d2613;}export function getParentPath(_0xc544d2){const _0xf27b0e=a154_0x145f,_0x24f04d=parsePath(_0xc544d2);if(_0x24f04d['segments'][_0xf27b0e(0x1ef)]<=0x1)return'/';const _0x53b199=_0x24f04d[_0xf27b0e(0x208)][_0xf27b0e(0x207)](0x0,-0x1)['join']('/');return _0x24f04d[_0xf27b0e(0x209)][_0xf27b0e(0x1f9)]('/')?'/'+_0x53b199:_0x53b199;}export function getBaseName(_0x29f685){const _0x5940ff=a154_0x145f,_0x4f9e20=parsePath(_0x29f685);return _0x4f9e20['segments'][_0x4f9e20[_0x5940ff(0x208)][_0x5940ff(0x1ef)]-0x1]||'';}export function isChildPath(_0x5e880e,_0x366411){const _0x4a4856=a154_0x145f,_0x46c789=parsePath(_0x5e880e),_0x2e816a=parsePath(_0x366411);if(_0x46c789[_0x4a4856(0x208)][_0x4a4856(0x1ef)]<=_0x2e816a[_0x4a4856(0x208)]['length'])return![];for(let _0x27dbf1=0x0;_0x27dbf1<_0x2e816a[_0x4a4856(0x208)][_0x4a4856(0x1ef)];_0x27dbf1++){if(_0x46c789[_0x4a4856(0x208)][_0x27dbf1]!==_0x2e816a['segments'][_0x27dbf1])return![];}return!![];}export function splitPath(_0x7b1cd9){const _0x4682e6=a154_0x145f,_0x53d321=parsePath(_0x7b1cd9);if(_0x53d321['segments'][_0x4682e6(0x1ef)]===0x0)throw new Error(_0x4682e6(0x213));if(_0x53d321['segments'][_0x4682e6(0x1ef)]===0x1)return{'parent':_0x53d321[_0x4682e6(0x208)][0x0]};return{'parent':_0x53d321['segments'][0x0],'child':_0x53d321[_0x4682e6(0x208)]['slice'](0x1)[_0x4682e6(0x1e8)]('/')};}export function isYamlFilePath(_0x5b6458){const _0x121c6a=a154_0x145f;return _0x5b6458[_0x121c6a(0x1f1)]('.yml')||_0x5b6458[_0x121c6a(0x1f1)](_0x121c6a(0x1ff));}export async function resolveYamlFilePath(_0x8d0a9c,_0x36fa34=nodeFileSystem){const _0x341f33=a154_0x145f,_0x342bb2=a154_0x5ee219[_0x341f33(0x20d)](_0x8d0a9c);if(!await _0x36fa34[_0x341f33(0x1fe)](_0x342bb2))throw new Error(_0x341f33(0x1e9)+_0x8d0a9c);let _0x575070=a154_0x5ee219[_0x341f33(0x1ee)](_0x342bb2),_0x264316=null,_0x15a623=null;const _0x3abb48=a154_0x5ee219['parse'](_0x575070)[_0x341f33(0x216)];while(_0x575070!==_0x3abb48){const _0x4e8ad8=a154_0x5ee219[_0x341f33(0x1e8)](_0x575070,_0x341f33(0x1f0));if(await _0x36fa34['exists'](_0x4e8ad8)){_0x264316=_0x4e8ad8,_0x15a623=_0x575070;break;}_0x575070=a154_0x5ee219['dirname'](_0x575070);}if(!_0x264316||!_0x15a623)throw new Error(_0x341f33(0x20c)+_0x8d0a9c+'\x0a'+_0x341f33(0x1fb));const _0x95cb65=await _0x36fa34['readFile'](_0x264316),_0xd4a923=JSON[_0x341f33(0x203)](_0x95cb65),_0x4a0526=_0xd4a923[_0x341f33(0x200)];if(!_0x4a0526)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1243b3=await _0x36fa34[_0x341f33(0x1ea)](_0x342bb2),_0x4200d8=a154_0x537b20(_0x1243b3),_0x4835d1=_0x4200d8[_0x341f33(0x1ed)];if(!_0x4835d1)throw new Error(_0x341f33(0x1f7)+_0x8d0a9c);const _0x43fb54=_0x4200d8['type']===_0x341f33(0x1f4)?_0x341f33(0x1f4):'segment',_0x17da4d=a154_0x5ee219[_0x341f33(0x1fa)](_0x15a623,_0x342bb2),_0x29ef29=a154_0x5ee219['dirname'](_0x17da4d),_0x14b719=_0x29ef29==='.'?'':_0x29ef29[_0x341f33(0x1f6)](/\\/g,'/'),_0x27f061=_0x14b719?_0x4a0526+'/'+_0x14b719+'/'+_0x4835d1:_0x4a0526+'/'+_0x4835d1;return{'parentSegment':_0x4a0526,'segmentName':_0x4835d1,'folderPath':_0x14b719,'fullPath':_0x27f061,'resourceType':_0x43fb54,'content':_0x1243b3};}
@@ -1 +1 @@
1
- function a155_0x3c51(_0xc57a04,_0x29dd44){_0xc57a04=_0xc57a04-0x11f;const _0x48a897=a155_0x48a8();let _0x3c5125=_0x48a897[_0xc57a04];return _0x3c5125;}function a155_0x48a8(){const _0x24dd19=['197634Rajaun','838143ciBsCF','15256MwFFoy','159rWptsU','2rQlbsU','15675924QlHeUc','indexOf','6515HCSGaZ','substring','994KDBJPt','21212kDJfCt','4367154OkKrtc','2418ufYRHb','Invalid\x20segment\x20reference\x20format:\x20','40ODftZN'];a155_0x48a8=function(){return _0x24dd19;};return a155_0x48a8();}(function(_0x150084,_0x453262){const _0x16cd4e=a155_0x3c51,_0x1ff5d5=_0x150084();while(!![]){try{const _0x5e2062=parseInt(_0x16cd4e(0x12d))/0x1*(-parseInt(_0x16cd4e(0x122))/0x2)+-parseInt(_0x16cd4e(0x121))/0x3*(-parseInt(_0x16cd4e(0x128))/0x4)+parseInt(_0x16cd4e(0x125))/0x5*(parseInt(_0x16cd4e(0x12a))/0x6)+parseInt(_0x16cd4e(0x127))/0x7*(parseInt(_0x16cd4e(0x120))/0x8)+parseInt(_0x16cd4e(0x11f))/0x9*(parseInt(_0x16cd4e(0x12c))/0xa)+parseInt(_0x16cd4e(0x129))/0xb+-parseInt(_0x16cd4e(0x123))/0xc;if(_0x5e2062===_0x453262)break;else _0x1ff5d5['push'](_0x1ff5d5['shift']());}catch(_0x26ba7c){_0x1ff5d5['push'](_0x1ff5d5['shift']());}}}(a155_0x48a8,0x539fb));export function parseSegmentRef(_0x5ca3ad){const _0x48abaf=a155_0x3c51,_0x14438e=_0x5ca3ad[_0x48abaf(0x124)]('/');if(_0x14438e===-0x1)return{'parentId':_0x5ca3ad};if(_0x14438e===0x0)throw new Error(_0x48abaf(0x12b)+_0x5ca3ad+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x45fc69=_0x5ca3ad[_0x48abaf(0x126)](0x0,_0x14438e),_0x2a2b3f=_0x5ca3ad[_0x48abaf(0x126)](_0x14438e+0x1);if(_0x2a2b3f==='')throw new Error(_0x48abaf(0x12b)+_0x5ca3ad+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x45fc69,'childId':_0x2a2b3f};}
1
+ (function(_0x5dffc0,_0x1df249){const _0x58701a=a155_0x53a7,_0x49ea3f=_0x5dffc0();while(!![]){try{const _0x5b5181=parseInt(_0x58701a(0x1e3))/0x1*(parseInt(_0x58701a(0x1d6))/0x2)+parseInt(_0x58701a(0x1d8))/0x3*(-parseInt(_0x58701a(0x1e4))/0x4)+parseInt(_0x58701a(0x1d5))/0x5*(-parseInt(_0x58701a(0x1de))/0x6)+-parseInt(_0x58701a(0x1dd))/0x7*(-parseInt(_0x58701a(0x1e1))/0x8)+-parseInt(_0x58701a(0x1e2))/0x9*(parseInt(_0x58701a(0x1d9))/0xa)+parseInt(_0x58701a(0x1da))/0xb+parseInt(_0x58701a(0x1df))/0xc;if(_0x5b5181===_0x1df249)break;else _0x49ea3f['push'](_0x49ea3f['shift']());}catch(_0x28aa59){_0x49ea3f['push'](_0x49ea3f['shift']());}}}(a155_0x34ca,0x1dcbc));export function parseSegmentRef(_0x10711d){const _0x16f8bf=a155_0x53a7,_0x27b3b0=_0x10711d[_0x16f8bf(0x1d7)]('/');if(_0x27b3b0===-0x1)return{'parentId':_0x10711d};if(_0x27b3b0===0x0)throw new Error(_0x16f8bf(0x1dc)+_0x10711d+_0x16f8bf(0x1db));const _0xb5ed08=_0x10711d['substring'](0x0,_0x27b3b0),_0xecf628=_0x10711d[_0x16f8bf(0x1e0)](_0x27b3b0+0x1);if(_0xecf628==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x10711d+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0xb5ed08,'childId':_0xecf628};}function a155_0x53a7(_0x174431,_0x3f70d8){_0x174431=_0x174431-0x1d5;const _0x34cacb=a155_0x34ca();let _0x53a739=_0x34cacb[_0x174431];return _0x53a739;}function a155_0x34ca(){const _0xef65b5=['12268cNaDoe','61025Mopdbx','280538MODLQi','indexOf','30WBnEES','1925260laoGBt','1056187iJVKYG','.\x20Parent\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','315vumzns','114GbJMmf','2704008EvRSrW','substring','20536DhdPHJ','9SYljMc','1rHTCjZ'];a155_0x34ca=function(){return _0xef65b5;};return a155_0x34ca();}
@@ -1 +1 @@
1
- function a156_0x25d4(){const _0x5e43e6=['code','MISSING_BETWEEN_BOUNDS','Attribute\x20\x27','4647452xCTybz','1312147aFvNhw','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','type','MISSING_SEGMENT_REFERENCE','symbol','level','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','.conditions[','includes','EMPTY_CONDITIONS','rule.type','INVALID_RULE_TYPE','rule','skipSchema','.operator.value','.source','safeParse','MISSING_OPERATOR_VALUE','match','attribute','.attribute','message','Behavior\x20source\x20\x27','5njifxm','endsWith','push','10bLgPUD','MISSING_TIME_UNIT','length','success','warning','.conditions','563716pftgrG','Attribute\x20name\x20cannot\x20be\x20empty','filter','3bEhrgp','NESTED_CONDITION_GROUP','path','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','invalid_value','aggregation','23977349SMqWvR','MISSING_CONDITIONS','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','map','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','INVALID_OPERATOR_TYPE','conditions','832632BTqHzM','72uAZBDe','source','document','data','issues','SEGMENT_SCHEMA_ERROR','MISSING_NAME','10337404XHdcxq','params','error','.type','6849918vSWIbD','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','validationCode','custom','description'];a156_0x25d4=function(){return _0x5e43e6;};return a156_0x25d4();}(function(_0x3e7c80,_0x2ea80d){const _0x593ed9=a156_0x367b,_0x1125d2=_0x3e7c80();while(!![]){try{const _0x49aaa6=-parseInt(_0x593ed9(0xf2))/0x1+parseInt(_0x593ed9(0x112))/0x2*(-parseInt(_0x593ed9(0x115))/0x3)+parseInt(_0x593ed9(0xf1))/0x4+-parseInt(_0x593ed9(0x109))/0x5*(-parseInt(_0x593ed9(0xe8))/0x6)+parseInt(_0x593ed9(0xe4))/0x7+parseInt(_0x593ed9(0xdc))/0x8*(parseInt(_0x593ed9(0xdd))/0x9)+-parseInt(_0x593ed9(0x10c))/0xa*(parseInt(_0x593ed9(0xd5))/0xb);if(_0x49aaa6===_0x2ea80d)break;else _0x1125d2['push'](_0x1125d2['shift']());}catch(_0x4331a5){_0x1125d2['push'](_0x1125d2['shift']());}}}(a156_0x25d4,0xccdf4));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x312322,_0x23b2f0={},_0x430b46={}){const _0x1b74b7=a156_0x367b;if(_0x430b46[_0x1b74b7(0xff)])return runSemanticChecks(_0x312322,_0x23b2f0);const _0x2dc2e9=SegmentDefSchema[_0x1b74b7(0x102)](_0x312322);if(_0x2dc2e9[_0x1b74b7(0x10f)])return runSemanticChecks(_0x2dc2e9[_0x1b74b7(0xe0)],_0x23b2f0);return zodErrorsToValidationResult(_0x2dc2e9['error'],_0x23b2f0);}export function validateRuleDef(_0x2ccdb6,_0x3b7bf9,_0x1c8c6f){const _0x366089=a156_0x367b;if(!_0x2ccdb6)return[];const _0x7b5bec=RuleDefSchema[_0x366089(0x102)](_0x2ccdb6);if(_0x7b5bec[_0x366089(0x10f)])return checkRule(_0x7b5bec[_0x366089(0xe0)],_0x3b7bf9,_0x1c8c6f);const _0x47b027=flattenZodIssues(_0x7b5bec[_0x366089(0xe6)][_0x366089(0xe1)]);return _0x47b027[_0x366089(0xd8)](_0x43beef=>{const _0xbd5276=_0x366089,_0x4a80d6=formatZodPath(_0x43beef[_0xbd5276(0x117)]),_0xfeba7c=_0x4a80d6?_0x3b7bf9+'.'+_0x4a80d6:_0x3b7bf9,_0x180183=mapZodIssueToCode(_0x43beef,_0x4a80d6),_0x3504e3=getLocationFromPath(_0x1c8c6f[_0xbd5276(0xdf)],_0x1c8c6f[_0xbd5276(0xde)],pathToArray(_0xfeba7c));return{'level':_0xbd5276(0xe6),'path':_0xfeba7c,'code':_0x180183,'message':_0x43beef['message'],..._0x3504e3&&{'location':_0x3504e3}};});}function a156_0x367b(_0x456f64,_0x57d2b2){_0x456f64=_0x456f64-0xd4;const _0x25d441=a156_0x25d4();let _0x367bbc=_0x25d441[_0x456f64];return _0x367bbc;}function zodErrorsToValidationResult(_0x4b8024,_0x508e80){const _0x297f1c=a156_0x367b,_0x50a3f5=flattenZodIssues(_0x4b8024[_0x297f1c(0xe1)]),_0x793fb6=_0x50a3f5[_0x297f1c(0xd8)](_0x20b06b=>{const _0x59a52f=_0x297f1c,_0x5d2090=formatZodPath(_0x20b06b[_0x59a52f(0x117)]),_0x5af6e6=mapZodIssueToCode(_0x20b06b,_0x5d2090),_0x3ae660=getLocationFromPath(_0x508e80[_0x59a52f(0xdf)],_0x508e80[_0x59a52f(0xde)],_0x20b06b[_0x59a52f(0x117)][_0x59a52f(0xd8)](_0x2efab9=>typeof _0x2efab9===_0x59a52f(0xf6)?String(_0x2efab9):_0x2efab9));return{'level':_0x59a52f(0xe6),'path':_0x5d2090,'code':_0x5af6e6,'message':_0x20b06b[_0x59a52f(0x107)],..._0x3ae660&&{'location':_0x3ae660}};});return{'valid':![],'errors':_0x793fb6,'warnings':[]};}function mapZodIssueToCode(_0x321b17,_0x55a234){const _0x3d9c0f=a156_0x367b,_0x2ccdfb=_0x321b17[_0x3d9c0f(0xee)]===_0x3d9c0f(0xec)?_0x321b17[_0x3d9c0f(0xe5)]:undefined;if(_0x55a234==='name')return _0x3d9c0f(0xe3);if(_0x55a234===_0x3d9c0f(0xfc)||_0x55a234[_0x3d9c0f(0x10a)](_0x3d9c0f(0xe7))){if(_0x321b17[_0x3d9c0f(0xee)]===_0x3d9c0f(0x119)){if(_0x55a234===_0x3d9c0f(0xfc)||_0x55a234[_0x3d9c0f(0x104)](/\.conditions\[\d+\]\.type$/))return _0x3d9c0f(0xfd);}}if(_0x55a234[_0x3d9c0f(0x10a)]('.operator.type'))return _0x3d9c0f(0xda);if(_0x55a234[_0x3d9c0f(0x10a)](_0x3d9c0f(0x100)))return _0x3d9c0f(0x103);if(_0x2ccdfb?.[_0x3d9c0f(0xeb)]===_0x3d9c0f(0xef))return _0x3d9c0f(0xef);if(_0x2ccdfb?.['validationCode']==='MISSING_TIME_UNIT')return _0x3d9c0f(0x10d);if(_0x55a234[_0x3d9c0f(0x10a)](_0x3d9c0f(0x111))||_0x55a234===_0x3d9c0f(0xdb))return _0x3d9c0f(0xd6);if(_0x55a234[_0x3d9c0f(0xfa)]('arrayMatching'))return'INVALID_ARRAY_MATCHING';if(_0x55a234['endsWith']('.segment'))return _0x3d9c0f(0xf5);return _0x3d9c0f(0xe2);}function runSemanticChecks(_0x147036,_0x4e6b67){const _0x32bfa4=a156_0x367b,_0x1e62f9=[];_0x147036[_0x32bfa4(0xfe)]&&_0x1e62f9[_0x32bfa4(0x10b)](...checkRule(_0x147036[_0x32bfa4(0xfe)],_0x32bfa4(0xfe),_0x4e6b67));const _0x3b2aa9=_0x1e62f9['filter'](_0x31493f=>_0x31493f['level']===_0x32bfa4(0xe6)),_0x4f6bfe=_0x1e62f9[_0x32bfa4(0x114)](_0x55b621=>_0x55b621[_0x32bfa4(0xf7)]===_0x32bfa4(0x110));return{'valid':_0x3b2aa9[_0x32bfa4(0x10e)]===0x0,'errors':_0x3b2aa9,'warnings':_0x4f6bfe};}function checkRule(_0x3b8147,_0x2a1c80,_0x118d29){const _0x396e8f=a156_0x367b,_0x4f8d5c=[];if(_0x3b8147[_0x396e8f(0xdb)][_0x396e8f(0x10e)]===0x0)return _0x4f8d5c['push']({'level':_0x396e8f(0xe6),'path':_0x2a1c80+'.conditions','code':_0x396e8f(0xfb),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x118d29[_0x396e8f(0xdf)],_0x118d29[_0x396e8f(0xde)],pathToArray(_0x2a1c80+'.conditions'))}),_0x4f8d5c;return _0x4f8d5c['push'](...checkConditions(_0x3b8147[_0x396e8f(0xdb)],_0x2a1c80,_0x118d29)),_0x4f8d5c;}function checkConditions(_0x4c45ec,_0x5a70a8,_0x2c06fc){const _0x31e422=a156_0x367b,_0x56d3b5=[];for(let _0x2b7e90=0x0;_0x2b7e90<_0x4c45ec[_0x31e422(0x10e)];_0x2b7e90++){const _0x3b5558=_0x4c45ec[_0x2b7e90],_0x2887a4=_0x5a70a8+_0x31e422(0xf9)+_0x2b7e90+']';_0x56d3b5[_0x31e422(0x10b)](...checkCondition(_0x3b5558,_0x2887a4,_0x2c06fc));}return _0x56d3b5;}function checkCondition(_0x1619cd,_0x6f5661,_0x11ab2a){const _0x4996b5=a156_0x367b,_0x5267c6=[];if(_0x1619cd[_0x4996b5(0xf4)]==='And'||_0x1619cd[_0x4996b5(0xf4)]==='Or'){if(_0x1619cd[_0x4996b5(0xdb)]['length']===0x0)_0x5267c6[_0x4996b5(0x10b)]({'level':_0x4996b5(0xe6),'path':_0x6f5661+'.conditions','code':_0x4996b5(0xfb),'message':_0x1619cd[_0x4996b5(0xf4)]+_0x4996b5(0xf3),'location':getLocationFromPath(_0x11ab2a[_0x4996b5(0xdf)],_0x11ab2a[_0x4996b5(0xde)],pathToArray(_0x6f5661+'.conditions'))});else{const _0x1325bf=_0x1619cd[_0x4996b5(0xed)]!==undefined;!_0x1325bf&&_0x5267c6[_0x4996b5(0x10b)]({'level':'warning','path':_0x6f5661,'code':_0x4996b5(0x116),'message':_0x1619cd[_0x4996b5(0xf4)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x4996b5(0xe9),'location':getLocationFromPath(_0x11ab2a[_0x4996b5(0xdf)],_0x11ab2a[_0x4996b5(0xde)],pathToArray(_0x6f5661))}),_0x5267c6[_0x4996b5(0x10b)](...checkConditions(_0x1619cd[_0x4996b5(0xdb)],_0x6f5661,_0x11ab2a));}return _0x5267c6;}if(_0x1619cd[_0x4996b5(0xf4)]==='Value'||_0x1619cd['type']==='Behavior'){const _0x5a7516=_0x1619cd,_0x501692=_0x5a7516[_0x4996b5(0xde)],_0x21197c=_0x5a7516[_0x4996b5(0xd4)],_0x26fa1b=_0x501692||_0x21197c;(!_0x5a7516[_0x4996b5(0x105)]||_0x5a7516[_0x4996b5(0x105)]==='')&&(!_0x26fa1b&&_0x5267c6[_0x4996b5(0x10b)]({'level':_0x4996b5(0xe6),'path':_0x6f5661+_0x4996b5(0x106),'code':'EMPTY_ATTRIBUTE','message':_0x4996b5(0x113),'location':getLocationFromPath(_0x11ab2a[_0x4996b5(0xdf)],_0x11ab2a[_0x4996b5(0xde)],pathToArray(_0x6f5661+'.attribute'))}));_0x5a7516[_0x4996b5(0x114)]&&_0x5267c6['push'](...checkRule(_0x5a7516[_0x4996b5(0x114)],_0x6f5661+'.filter',_0x11ab2a));if(_0x5a7516[_0x4996b5(0xde)]){const _0x4e7678=_0x5a7516['attribute']&&_0x5a7516[_0x4996b5(0x105)]!=='';_0x4e7678&&!_0x5a7516[_0x4996b5(0x114)]&&_0x5267c6['push']({'level':_0x4996b5(0xe6),'path':_0x6f5661+_0x4996b5(0x101),'code':'BEHAVIOR_SOURCE_MISSING_FILTER','message':_0x4996b5(0x108)+_0x5a7516[_0x4996b5(0xde)]+'\x27\x20with\x20attribute\x20\x27'+_0x5a7516[_0x4996b5(0x105)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x4996b5(0xd7)+_0x4996b5(0xea),'location':getLocationFromPath(_0x11ab2a[_0x4996b5(0xdf)],_0x11ab2a[_0x4996b5(0xde)],pathToArray(_0x6f5661+_0x4996b5(0x101)))}),_0x4e7678&&_0x5a7516[_0x4996b5(0x114)]&&_0x5267c6['push']({'level':_0x4996b5(0x110),'path':_0x6f5661+'.attribute','code':_0x4996b5(0x118),'message':_0x4996b5(0xf0)+_0x5a7516[_0x4996b5(0x105)]+_0x4996b5(0xd9)+_0x4996b5(0xf8),'location':getLocationFromPath(_0x11ab2a[_0x4996b5(0xdf)],_0x11ab2a[_0x4996b5(0xde)],pathToArray(_0x6f5661+_0x4996b5(0x106)))});}}return _0x5267c6;}
1
+ (function(_0x3c69fc,_0x55b892){const _0x384faf=a156_0x54b1,_0x2f200c=_0x3c69fc();while(!![]){try{const _0x16ac55=-parseInt(_0x384faf(0x1a9))/0x1+parseInt(_0x384faf(0x1b8))/0x2+-parseInt(_0x384faf(0x1a7))/0x3*(-parseInt(_0x384faf(0x193))/0x4)+parseInt(_0x384faf(0x1a3))/0x5+parseInt(_0x384faf(0x1d1))/0x6*(-parseInt(_0x384faf(0x19b))/0x7)+-parseInt(_0x384faf(0x1d5))/0x8*(parseInt(_0x384faf(0x195))/0x9)+parseInt(_0x384faf(0x1c0))/0xa;if(_0x16ac55===_0x55b892)break;else _0x2f200c['push'](_0x2f200c['shift']());}catch(_0x5453ad){_0x2f200c['push'](_0x2f200c['shift']());}}}(a156_0x5d9d,0x21fc8));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3f70de,_0x268f74={},_0x5d85ad={}){const _0x337b48=a156_0x54b1;if(_0x5d85ad[_0x337b48(0x1d3)])return runSemanticChecks(_0x3f70de,_0x268f74);const _0x17405c=SegmentDefSchema['safeParse'](_0x3f70de);if(_0x17405c[_0x337b48(0x1d6)])return runSemanticChecks(_0x17405c[_0x337b48(0x198)],_0x268f74);return zodErrorsToValidationResult(_0x17405c[_0x337b48(0x19a)],_0x268f74);}export function validateRuleDef(_0xe985c2,_0x564fdb,_0x51e81e){const _0x370085=a156_0x54b1;if(!_0xe985c2)return[];const _0x25444d=RuleDefSchema[_0x370085(0x1ac)](_0xe985c2);if(_0x25444d[_0x370085(0x1d6)])return checkRule(_0x25444d[_0x370085(0x198)],_0x564fdb,_0x51e81e);const _0x4ba102=flattenZodIssues(_0x25444d['error'][_0x370085(0x1a5)]);return _0x4ba102['map'](_0x2add16=>{const _0x462608=_0x370085,_0x83dd2d=formatZodPath(_0x2add16[_0x462608(0x1a4)]),_0x25895e=_0x83dd2d?_0x564fdb+'.'+_0x83dd2d:_0x564fdb,_0x5810c0=mapZodIssueToCode(_0x2add16,_0x83dd2d),_0x2c748c=getLocationFromPath(_0x51e81e[_0x462608(0x1cf)],_0x51e81e[_0x462608(0x1bd)],pathToArray(_0x25895e));return{'level':_0x462608(0x19a),'path':_0x25895e,'code':_0x5810c0,'message':_0x2add16[_0x462608(0x1aa)],..._0x2c748c&&{'location':_0x2c748c}};});}function a156_0x5d9d(){const _0x45794c=['endsWith','9150rwOdXn','invalid_value','skipSchema','INVALID_ARRAY_MATCHING','35720PWMDvo','success','length','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','Behavior','warning','rule','MISSING_OPERATOR_VALUE','EMPTY_ATTRIBUTE','rule.type','\x27\x20with\x20attribute\x20\x27','164XLjLwu','code','504WwsVQx','params','.operator.value','data','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','1113DZNSoZ','EMPTY_CONDITIONS','.type','MISSING_CONDITIONS','MISSING_SEGMENT_REFERENCE','.filter','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','BEHAVIOR_SOURCE_MISSING_FILTER','412490UfstiG','path','issues','conditions','5469RQsRHL','custom','66580AUvgri','message','.attribute','safeParse','INVALID_RULE_TYPE','arrayMatching','Value','.conditions[','.source','map','.segment','level','INVALID_OPERATOR_TYPE','filter','aggregation','133826LOOmkt','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','MISSING_TIME_UNIT','SEGMENT_SCHEMA_ERROR','symbol','source','match','Attribute\x20\x27','4741490RWZvLW','.conditions','And','validationCode','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','Behavior\x20source\x20\x27','description','includes','attribute','push','MISSING_NAME','NESTED_CONDITION_GROUP','MISSING_BETWEEN_BOUNDS','type','name','document'];a156_0x5d9d=function(){return _0x45794c;};return a156_0x5d9d();}function zodErrorsToValidationResult(_0x354fc4,_0x19d307){const _0x1560f3=a156_0x54b1,_0x2fc396=flattenZodIssues(_0x354fc4[_0x1560f3(0x1a5)]),_0x4b7007=_0x2fc396[_0x1560f3(0x1b2)](_0x58615c=>{const _0x511f41=_0x1560f3,_0x501bb3=formatZodPath(_0x58615c['path']),_0x340dc4=mapZodIssueToCode(_0x58615c,_0x501bb3),_0x3111d1=getLocationFromPath(_0x19d307[_0x511f41(0x1cf)],_0x19d307['source'],_0x58615c[_0x511f41(0x1a4)]['map'](_0x849b25=>typeof _0x849b25===_0x511f41(0x1bc)?String(_0x849b25):_0x849b25));return{'level':_0x511f41(0x19a),'path':_0x501bb3,'code':_0x340dc4,'message':_0x58615c[_0x511f41(0x1aa)],..._0x3111d1&&{'location':_0x3111d1}};});return{'valid':![],'errors':_0x4b7007,'warnings':[]};}function a156_0x54b1(_0x355cb6,_0x3fd955){_0x355cb6=_0x355cb6-0x18a;const _0x5d9df7=a156_0x5d9d();let _0x54b198=_0x5d9df7[_0x355cb6];return _0x54b198;}function mapZodIssueToCode(_0x2039b2,_0x343037){const _0x44cb0c=a156_0x54b1,_0x56e7c7=_0x2039b2[_0x44cb0c(0x194)]===_0x44cb0c(0x1a8)?_0x2039b2[_0x44cb0c(0x196)]:undefined;if(_0x343037===_0x44cb0c(0x1ce))return _0x44cb0c(0x1ca);if(_0x343037===_0x44cb0c(0x191)||_0x343037[_0x44cb0c(0x1d0)](_0x44cb0c(0x19d))){if(_0x2039b2[_0x44cb0c(0x194)]===_0x44cb0c(0x1d2)){if(_0x343037===_0x44cb0c(0x191)||_0x343037[_0x44cb0c(0x1be)](/\.conditions\[\d+\]\.type$/))return _0x44cb0c(0x1ad);}}if(_0x343037[_0x44cb0c(0x1d0)]('.operator.type'))return _0x44cb0c(0x1b5);if(_0x343037[_0x44cb0c(0x1d0)](_0x44cb0c(0x197)))return _0x44cb0c(0x18f);if(_0x56e7c7?.[_0x44cb0c(0x1c3)]===_0x44cb0c(0x1cc))return _0x44cb0c(0x1cc);if(_0x56e7c7?.[_0x44cb0c(0x1c3)]===_0x44cb0c(0x1ba))return _0x44cb0c(0x1ba);if(_0x343037[_0x44cb0c(0x1d0)](_0x44cb0c(0x1c1))||_0x343037===_0x44cb0c(0x1a6))return _0x44cb0c(0x19e);if(_0x343037[_0x44cb0c(0x1c7)](_0x44cb0c(0x1ae)))return _0x44cb0c(0x1d4);if(_0x343037['endsWith'](_0x44cb0c(0x1b3)))return _0x44cb0c(0x19f);return _0x44cb0c(0x1bb);}function runSemanticChecks(_0x13b1e7,_0x5723e3){const _0x3a65b6=a156_0x54b1,_0x43f03d=[];_0x13b1e7['rule']&&_0x43f03d['push'](...checkRule(_0x13b1e7[_0x3a65b6(0x18e)],_0x3a65b6(0x18e),_0x5723e3));const _0x578839=_0x43f03d['filter'](_0x1896eb=>_0x1896eb['level']===_0x3a65b6(0x19a)),_0xbc9f9f=_0x43f03d[_0x3a65b6(0x1b6)](_0x1650dc=>_0x1650dc[_0x3a65b6(0x1b4)]===_0x3a65b6(0x18d));return{'valid':_0x578839[_0x3a65b6(0x18a)]===0x0,'errors':_0x578839,'warnings':_0xbc9f9f};}function checkRule(_0x159999,_0x41ee6c,_0x130eb3){const _0xe32094=a156_0x54b1,_0x43b318=[];if(_0x159999[_0xe32094(0x1a6)][_0xe32094(0x18a)]===0x0)return _0x43b318[_0xe32094(0x1c9)]({'level':'error','path':_0x41ee6c+_0xe32094(0x1c1),'code':_0xe32094(0x19c),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x130eb3[_0xe32094(0x1cf)],_0x130eb3[_0xe32094(0x1bd)],pathToArray(_0x41ee6c+_0xe32094(0x1c1)))}),_0x43b318;return _0x43b318[_0xe32094(0x1c9)](...checkConditions(_0x159999['conditions'],_0x41ee6c,_0x130eb3)),_0x43b318;}function checkConditions(_0x394de3,_0x3c66de,_0x4950af){const _0x434eef=a156_0x54b1,_0x20e03b=[];for(let _0x57e312=0x0;_0x57e312<_0x394de3['length'];_0x57e312++){const _0x430157=_0x394de3[_0x57e312],_0x50b9a2=_0x3c66de+_0x434eef(0x1b0)+_0x57e312+']';_0x20e03b[_0x434eef(0x1c9)](...checkCondition(_0x430157,_0x50b9a2,_0x4950af));}return _0x20e03b;}function checkCondition(_0x2a7559,_0x1bec23,_0x50a1fe){const _0x4d3255=a156_0x54b1,_0x523e7f=[];if(_0x2a7559[_0x4d3255(0x1cd)]===_0x4d3255(0x1c2)||_0x2a7559['type']==='Or'){if(_0x2a7559['conditions']['length']===0x0)_0x523e7f[_0x4d3255(0x1c9)]({'level':_0x4d3255(0x19a),'path':_0x1bec23+_0x4d3255(0x1c1),'code':_0x4d3255(0x19c),'message':_0x2a7559['type']+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x50a1fe['document'],_0x50a1fe[_0x4d3255(0x1bd)],pathToArray(_0x1bec23+_0x4d3255(0x1c1)))});else{const _0xe81b38=_0x2a7559[_0x4d3255(0x1c6)]!==undefined;!_0xe81b38&&_0x523e7f['push']({'level':'warning','path':_0x1bec23,'code':_0x4d3255(0x1cb),'message':_0x2a7559[_0x4d3255(0x1cd)]+_0x4d3255(0x18b)+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x4d3255(0x1c4),'location':getLocationFromPath(_0x50a1fe[_0x4d3255(0x1cf)],_0x50a1fe[_0x4d3255(0x1bd)],pathToArray(_0x1bec23))}),_0x523e7f[_0x4d3255(0x1c9)](...checkConditions(_0x2a7559[_0x4d3255(0x1a6)],_0x1bec23,_0x50a1fe));}return _0x523e7f;}if(_0x2a7559[_0x4d3255(0x1cd)]===_0x4d3255(0x1af)||_0x2a7559[_0x4d3255(0x1cd)]===_0x4d3255(0x18c)){const _0x3b42c4=_0x2a7559,_0x33ae74=_0x3b42c4['source'],_0x42fe2c=_0x3b42c4[_0x4d3255(0x1b7)],_0x3ceecb=_0x33ae74||_0x42fe2c;(!_0x3b42c4[_0x4d3255(0x1c8)]||_0x3b42c4[_0x4d3255(0x1c8)]==='')&&(!_0x3ceecb&&_0x523e7f['push']({'level':'error','path':_0x1bec23+_0x4d3255(0x1ab),'code':_0x4d3255(0x190),'message':'Attribute\x20name\x20cannot\x20be\x20empty','location':getLocationFromPath(_0x50a1fe[_0x4d3255(0x1cf)],_0x50a1fe[_0x4d3255(0x1bd)],pathToArray(_0x1bec23+_0x4d3255(0x1ab)))}));_0x3b42c4['filter']&&_0x523e7f['push'](...checkRule(_0x3b42c4['filter'],_0x1bec23+_0x4d3255(0x1a0),_0x50a1fe));if(_0x3b42c4[_0x4d3255(0x1bd)]){const _0x4ce054=_0x3b42c4[_0x4d3255(0x1c8)]&&_0x3b42c4['attribute']!=='';_0x4ce054&&!_0x3b42c4[_0x4d3255(0x1b6)]&&_0x523e7f[_0x4d3255(0x1c9)]({'level':_0x4d3255(0x19a),'path':_0x1bec23+_0x4d3255(0x1b1),'code':_0x4d3255(0x1a2),'message':_0x4d3255(0x1c5)+_0x3b42c4['source']+_0x4d3255(0x192)+_0x3b42c4[_0x4d3255(0x1c8)]+'\x27\x20'+_0x4d3255(0x1a1)+_0x4d3255(0x199)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x50a1fe['document'],_0x50a1fe[_0x4d3255(0x1bd)],pathToArray(_0x1bec23+_0x4d3255(0x1b1)))}),_0x4ce054&&_0x3b42c4[_0x4d3255(0x1b6)]&&_0x523e7f[_0x4d3255(0x1c9)]({'level':'warning','path':_0x1bec23+_0x4d3255(0x1ab),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x4d3255(0x1bf)+_0x3b42c4[_0x4d3255(0x1c8)]+_0x4d3255(0x1b9)+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x50a1fe[_0x4d3255(0x1cf)],_0x50a1fe['source'],pathToArray(_0x1bec23+'.attribute'))});}}return _0x523e7f;}