@treasuredata/tdx 2026.3.35 → 2026.3.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(_0x491e0a,_0x235da5){const _0x518209=a152_0x57cc,_0x2d8857=_0x491e0a();while(!![]){try{const _0xc2f0b5=-parseInt(_0x518209(0x1b9))/0x1*(-parseInt(_0x518209(0x185))/0x2)+-parseInt(_0x518209(0x195))/0x3*(parseInt(_0x518209(0x1a9))/0x4)+-parseInt(_0x518209(0x1af))/0x5+parseInt(_0x518209(0x1ad))/0x6+-parseInt(_0x518209(0x20e))/0x7+parseInt(_0x518209(0x1c5))/0x8*(parseInt(_0x518209(0x1d1))/0x9)+parseInt(_0x518209(0x1d9))/0xa;if(_0xc2f0b5===_0x235da5)break;else _0x2d8857['push'](_0x2d8857['shift']());}catch(_0x396a54){_0x2d8857['push'](_0x2d8857['shift']());}}}(a152_0x1b16,0x9440d));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x390dd1){return''+PENDING_SEGMENT_PREFIX+_0x390dd1+'__';}export function isPendingSegmentId(_0x26d9a9){const _0x3452fe=a152_0x57cc;return _0x26d9a9[_0x3452fe(0x192)](PENDING_SEGMENT_PREFIX)&&!_0x26d9a9['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x14c2b0){const _0x50df62=a152_0x57cc;return _0x14c2b0[_0x50df62(0x1a3)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5adc20){return''+PENDING_ACTIVATION_PREFIX+_0x5adc20+'__';}function a152_0x57cc(_0x42abd5,_0x446139){_0x42abd5=_0x42abd5-0x123;const _0x1b1617=a152_0x1b16();let _0x57ccc0=_0x1b1617[_0x42abd5];return _0x57ccc0;}export function isPendingActivationId(_0x4c88bc){const _0x534eba=a152_0x57cc;return _0x4c88bc[_0x534eba(0x192)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x142c23){const _0x1280b9=a152_0x57cc;return _0x142c23[_0x1280b9(0x1a3)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x51e788,_0x36ccd7){const _0x5c4240=a152_0x57cc,_0x531e0f=_0x51e788+'::'+(_0x36ccd7[_0x5c4240(0x1ed)]()||_0x5c4240(0x1ef)),_0x275189=createHash('sha1')[_0x5c4240(0x1fe)](_0x531e0f)[_0x5c4240(0x21f)]('hex')['slice'](0x0,0xc);return _0x5c4240(0x186)+_0x275189;}export function ensureJourneyDefaults(_0x4ff2cf){const _0xe254b8=a152_0x57cc;!_0x4ff2cf[_0xe254b8(0x151)]&&(_0x4ff2cf['description']=''),!_0x4ff2cf['state']&&(_0x4ff2cf['state']=_0xe254b8(0x1e1));}export function injectExistingStageIds(_0x4851ff,_0x213e44){const _0x34a577=a152_0x57cc,_0x3a7ba1=new Map(_0x213e44[_0x34a577(0x1dd)](_0x5f246c=>[_0x5f246c[_0x34a577(0x128)],_0x5f246c['id']]));for(const _0x46c5a9 of _0x4851ff){if(!_0x46c5a9['id']){const _0x44d8ae=_0x3a7ba1[_0x34a577(0x1bc)](_0x46c5a9[_0x34a577(0x128)]);_0x44d8ae&&(_0x46c5a9['id']=_0x44d8ae);}}}export function resolveTDFolderPath(_0x1853c5,_0x2661d8,_0x5d9250){const _0x4bf710=a152_0x57cc;if(!_0x2661d8)return _0x1853c5;if(_0x1853c5===_0x5d9250||_0x1853c5[_0x4bf710(0x192)](_0x5d9250+'/'))return _0x1853c5;return _0x1853c5?_0x5d9250+'/'+_0x1853c5:_0x5d9250;}export function addFoldersToCreate(_0x55c120,_0x37b4d2,_0x54a2cb){const _0x162c52=a152_0x57cc;if(!_0x55c120)return;if(_0x37b4d2[_0x162c52(0x169)](_0x55c120))return;const _0x199db2=_0x55c120[_0x162c52(0x21d)]('/');let _0x4a4453='';for(const _0x895c97 of _0x199db2){_0x4a4453=_0x4a4453?_0x4a4453+'/'+_0x895c97:_0x895c97,!_0x37b4d2[_0x162c52(0x169)](_0x4a4453)&&_0x54a2cb[_0x162c52(0x180)](_0x4a4453);}}export function sortFoldersByDepth(_0x5c74ac){const _0x51c98e=a152_0x57cc;return[..._0x5c74ac][_0x51c98e(0x13f)]((_0x5ab314,_0x6ce942)=>{const _0x1afa41=_0x51c98e,_0x5f4679=(_0x5ab314[_0x1afa41(0x191)](/\//g)||[])[_0x1afa41(0x1d7)],_0x157d55=(_0x6ce942[_0x1afa41(0x191)](/\//g)||[])['length'];return _0x5f4679-_0x157d55;});}import*as a152_0x21a271 from'yaml';import{readFileSync}from'fs';import a152_0x54c886 from'path';import{isJourneyDef,parseYamlString as a152_0x1367fb,toYamlString as a152_0x57e6e8,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(_0x3d9b75){const _0x42978e=a152_0x57cc;if(Array['isArray'](_0x3d9b75))return'['+_0x3d9b75['map'](_0x51a449=>stableStringify(_0x51a449))['join'](',')+']';if(_0x3d9b75&&typeof _0x3d9b75===_0x42978e(0x182)){const _0x58952a=_0x3d9b75,_0x26ec9b=Object[_0x42978e(0x14f)](_0x58952a)[_0x42978e(0x13f)](),_0x34cc06=_0x26ec9b[_0x42978e(0x1dd)](_0x369ea7=>'\x22'+_0x369ea7+'\x22:'+stableStringify(_0x58952a[_0x369ea7]));return'{'+_0x34cc06[_0x42978e(0x136)](',')+'}';}const _0x17fea1=JSON[_0x42978e(0x1bb)](_0x3d9b75);return _0x17fea1===undefined?_0x42978e(0x223):_0x17fea1;}function activationSignature(_0x221496){const _0x4e76d7=a152_0x57cc,_0x26f087={'connection':_0x221496['connection'],..._0x221496[_0x4e76d7(0x1b6)]!==undefined&&{'all_columns':_0x221496[_0x4e76d7(0x1b6)]},..._0x221496[_0x4e76d7(0x150)]!==undefined&&{'columns':_0x221496[_0x4e76d7(0x150)]},..._0x221496[_0x4e76d7(0x1b3)]!==undefined&&{'behavior':_0x221496['behavior']},..._0x221496[_0x4e76d7(0x1c7)]!==undefined&&{'schedule':_0x221496[_0x4e76d7(0x1c7)]},..._0x221496[_0x4e76d7(0x1bf)]!==undefined&&{'notification':_0x221496[_0x4e76d7(0x1bf)]},..._0x221496[_0x4e76d7(0x17e)]!==undefined&&{'connector_config':_0x221496[_0x4e76d7(0x17e)]},..._0x221496[_0x4e76d7(0x135)]!==undefined&&{'activation_template_id':_0x221496['activation_template_id']}};return stableStringify(_0x26f087);}async function fetchSegment(_0x50d25c,_0x354969,_0x485ef4,_0x3f2971){const _0x354098=a152_0x57cc,_0x43c7ad=_0x3f2971?.['find'](_0x4ff43f=>_0x4ff43f['id']===_0x485ef4);if(_0x43c7ad)return _0x43c7ad;try{return await _0x50d25c[_0x354098(0x1ef)]['getSegment'](_0x354969,_0x485ef4);}catch(_0xb8494b){logger[_0x354098(0x1d2)]('getSegment\x20failed\x20for\x20'+_0x485ef4+_0x354098(0x17d)+_0xb8494b);try{return await _0x50d25c[_0x354098(0x1ef)]['getSegmentEntity'](_0x485ef4);}catch(_0x2e3cc9){return logger['debug'](_0x354098(0x167)+_0x485ef4+':\x20'+_0x2e3cc9),null;}}}function recoverSegmentIdsFromPushRecovery(_0x23b684,_0x9a489a,_0x21cbcc){const _0x456d8f=a152_0x57cc,_0xae37f5=readPushRecovery(_0x23b684[_0x456d8f(0x1f2)]);if(_0xae37f5?.['journeyName']===_0x23b684[_0x456d8f(0x20f)]['name'])for(const [_0x44cfd0,_0x440947]of Object[_0x456d8f(0x1ec)](_0xae37f5[_0x456d8f(0x155)])){const _0x27b929=generateDeterministicJourneySegmentName(_0x23b684[_0x456d8f(0x20f)][_0x456d8f(0x128)],_0x44cfd0);_0x440947[_0x456d8f(0x16c)]===_0x27b929&&(_0x9a489a['set'](_0x44cfd0,_0x440947[_0x456d8f(0x1c9)]),_0x21cbcc[_0x456d8f(0x1a0)](_0x44cfd0,_0x440947[_0x456d8f(0x1c9)]));}}async function createOrRecoverEmbeddedSegment(_0x512621,_0x273007,_0x549e4c,_0x57b7b6){const _0x2990b4=a152_0x57cc;let _0x1d9116;try{_0x1d9116=await _0x512621[_0x2990b4(0x1ef)][_0x2990b4(0x189)]({'name':_0x549e4c[_0x2990b4(0x1c2)],'description':_0x549e4c[_0x2990b4(0x151)],'journeyId':_0x549e4c[_0x2990b4(0x14c)],'rule':_0x57b7b6(_0x549e4c[_0x2990b4(0x1ac)],!![]),'countPopulation':!![],'parentFolderId':_0x549e4c['folderId'],'audienceId':_0x549e4c[_0x2990b4(0x1b2)]});}catch(_0x30c100){const _0x3a81a4=_0x30c100 instanceof Error&&_0x30c100[_0x2990b4(0x19b)][_0x2990b4(0x132)]('Name\x20has\x20already\x20been\x20taken');if(_0x3a81a4){const _0x6f4204=readPushRecovery(_0x273007[_0x2990b4(0x1f2)]),_0x1c3e0f=_0x6f4204?.[_0x2990b4(0x201)]===_0x273007[_0x2990b4(0x20f)][_0x2990b4(0x128)]?_0x6f4204['segments'][_0x549e4c[_0x2990b4(0x1e8)]]:undefined;if(_0x1c3e0f?.[_0x2990b4(0x16c)]===_0x549e4c['uniqueSegmentName'])await _0x512621[_0x2990b4(0x1ef)][_0x2990b4(0x1f5)](_0x549e4c[_0x2990b4(0x1b2)],_0x1c3e0f[_0x2990b4(0x1c9)],{'description':_0x549e4c[_0x2990b4(0x151)],'rule':_0x57b7b6(_0x549e4c[_0x2990b4(0x1ac)],!![]),'countPopulation':!![]}),_0x1d9116=_0x1c3e0f[_0x2990b4(0x1c9)];else throw new SDKError(ErrorCode[_0x2990b4(0x181)],_0x2990b4(0x160)+_0x549e4c[_0x2990b4(0x1e8)]+_0x2990b4(0x1a7)+(_0x2990b4(0x140)+_0x273007[_0x2990b4(0x1f2)][_0x2990b4(0x1a3)](/([^/]+)$/,_0x2990b4(0x130))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x30c100);}else throw _0x30c100;}return saveSegmentToPushRecovery(_0x273007[_0x2990b4(0x1f2)],_0x273007[_0x2990b4(0x20f)][_0x2990b4(0x128)],_0x549e4c[_0x2990b4(0x1e8)],{'segmentId':_0x1d9116,'uniqueServerName':_0x549e4c[_0x2990b4(0x1c2)],'createdAt':new Date()[_0x2990b4(0x17b)]()}),_0x1d9116;}export async function prepareSegmentFiles(_0x2f8016,_0x2b2770,_0x424111,_0x22dc08,_0x31658){const _0x5301df=a152_0x57cc,{activationDefToCreateRequest:_0x3faf84}=await import(_0x5301df(0x13d)),_0x2cef5b=[],_0x5d76b1=new Set();for(const {yamlConfig:_0x1775bf,folderPath:_0x4e3b7c,sourcePath:_0x244648}of _0x2f8016){const _0x38135b=resolveTDFolderPath(_0x4e3b7c,_0x22dc08,_0x31658),_0x441741=_0x38135b+':'+_0x1775bf[_0x5301df(0x128)],_0x543f5f=_0x2b2770[_0x5301df(0x1b8)]['get'](_0x441741),_0x544210=_0x543f5f?_0x2b2770[_0x5301df(0x1d8)][_0x5301df(0x1bc)](_0x543f5f['id'])||[]:[];addFoldersToCreate(_0x38135b,_0x2b2770['folderPathToId'],_0x5d76b1);const _0x44e87d=calculateActivationActions(_0x1775bf[_0x5301df(0x222)]||[],_0x544210,_0x2b2770['idToEmailMap'],_0x2b2770['connectionIdToNameMap']);for(const _0x38ebd0 of _0x44e87d){(_0x38ebd0[_0x5301df(0x19e)]==='create'||_0x38ebd0[_0x5301df(0x19e)]===_0x5301df(0x1fe))&&_0x38ebd0['yamlActivation']&&(_0x38ebd0[_0x5301df(0x13c)]=await _0x3faf84(_0x38ebd0[_0x5301df(0x1f6)],_0x424111));}const _0x2dce62=calculateSegmentDiff(_0x1775bf,_0x543f5f,_0x544210,_0x2b2770[_0x5301df(0x1f7)],_0x2b2770['connectionIdToNameMap']);_0x2cef5b['push']({'relativePath':_0x1775bf[_0x5301df(0x128)],'absolutePath':_0x244648,'yamlConfig':_0x1775bf,'folderPath':_0x38135b,'existingSegment':_0x543f5f,'existingActivations':_0x544210,'isNew':_0x2dce62['isNew'],'hasChanges':_0x2dce62[_0x5301df(0x15b)],'diff':_0x2dce62['diff'],'activationActions':_0x44e87d});}return{'segmentFiles':_0x2cef5b,'foldersToCreate':_0x5d76b1};}export async function prepareJourneyFiles(_0x54322d,_0x138399,_0x51b773,_0x5819fc){const _0x59272a=a152_0x57cc,_0x4a4970=[],_0x1573d0=new Set();for(const {yamlConfig:_0x1a9315,folderPath:_0x101321,sourcePath:_0x116470}of _0x54322d){const _0x539b18=resolveTDFolderPath(_0x101321,_0x51b773,_0x5819fc),_0x381e04=_0x539b18+':'+_0x1a9315[_0x59272a(0x128)],_0x5700d0=_0x138399[_0x59272a(0x20b)][_0x59272a(0x1bc)](_0x381e04);let _0x577afb,_0x264fdb;if(_0x5700d0&&_0x5700d0[_0x59272a(0x1d7)]>0x0){const _0xef5f46=buildLocalExpandedRuleMappings(_0x1a9315),{createYamlContext:_0x35318b,prefetchJourneySegments:_0x5dea00}=createPushYamlContextForBundle(_0x138399[_0x59272a(0x14d)],_0x138399[_0x59272a(0x1b2)],_0x138399['existingSegments'],_0xef5f46,_0x138399[_0x59272a(0x1f7)],_0x138399[_0x59272a(0x1a4)],_0x138399[_0x59272a(0x213)],_0x138399[_0x59272a(0x1c6)]);await _0x5dea00(_0x5700d0['map'](_0x4a6b44=>_0x4a6b44['id']));const _0x2a699c=await _0x138399[_0x59272a(0x14d)][_0x59272a(0x1a8)]['getLatestJourneyId'](_0x5700d0[0x0][_0x59272a(0x164)]),_0x2d2140=hasMultipleVersions(_0x1a9315),_0x3aa860=async _0x1392f9=>{const _0x3aa233=_0x59272a,_0x3e3592=_0x138399[_0x3aa233(0x1c6)]?.[_0x3aa233(0x1bc)](_0x1392f9);if(_0x3e3592)return _0x3e3592;return _0x138399['fetchJourney']({'journeyId':_0x1392f9,'journeyName':_0x1a9315[_0x3aa233(0x128)],'isMultiVersion':_0x5700d0[_0x3aa233(0x1d7)]>0x1});};if(_0x2d2140&&_0x5700d0['length']>0x1){const _0x4445fd=[];for(const _0x12211b of _0x5700d0){const _0x5e30d3=_0x12211b[_0x59272a(0x219)]||0x1;_0x138399[_0x59272a(0x1c1)]?.[_0x59272a(0x1fe)](_0x59272a(0x1b0)+_0x1a9315[_0x59272a(0x128)]+'\x20v'+_0x5e30d3);const _0x491f3e=await _0x3aa860(_0x12211b['id']),_0x154834=_0x35318b(_0x12211b['id']),_0x4facd9=await journeyResponseToDef(_0x491f3e,_0x154834);_0x4445fd['push']({'item':_0x12211b,'yaml':_0x4facd9});}const _0x564c99=buildLocalRuleToNameMappingFromJourney(_0x1a9315);_0x264fdb=buildMergedJourneyDef(_0x4445fd,_0x564c99,_0x2a699c);const _0x370204=Math[_0x59272a(0x1cd)](..._0x4445fd[_0x59272a(0x1dd)](_0x3a8de1=>_0x3a8de1[_0x59272a(0x207)][_0x59272a(0x219)]||0x0)),_0x1e1906=_0x5700d0[_0x59272a(0x1e6)](_0x1ab634=>(_0x1ab634[_0x59272a(0x219)]||0x0)===_0x370204);_0x1e1906&&(_0x138399[_0x59272a(0x1c1)]?.[_0x59272a(0x1fe)](_0x59272a(0x1b0)+_0x1a9315['name']+'\x20v'+_0x370204),_0x577afb=await _0x3aa860(_0x1e1906['id']));}else{const _0x3c3400=_0x5700d0[_0x5700d0[_0x59272a(0x1d7)]-0x1];_0x138399[_0x59272a(0x1c1)]?.[_0x59272a(0x1fe)](_0x59272a(0x1b0)+_0x1a9315[_0x59272a(0x128)]),_0x577afb=await _0x3aa860(_0x3c3400['id']);const _0x580a04=_0x35318b(_0x3c3400['id']),_0x5753a0=await journeyResponseToDef(_0x577afb,_0x580a04),_0x412d72=buildLocalRuleToNameMappingFromJourney(_0x1a9315);_0x264fdb=buildMergedJourneyDef([{'item':_0x3c3400,'yaml':_0x5753a0}],_0x412d72,_0x2a699c);}}addFoldersToCreate(_0x539b18,_0x138399[_0x59272a(0x204)],_0x1573d0);const _0xe9a593=calculateJourneyDiff(_0x1a9315,_0x264fdb);_0x4a4970[_0x59272a(0x168)]({'relativePath':_0x1a9315['name'],'absolutePath':_0x116470,'yamlConfig':_0x1a9315,'folderPath':_0x539b18,'existingJourney':_0x577afb,'isNew':_0xe9a593['isNew'],'hasChanges':_0xe9a593[_0x59272a(0x15b)],'diff':_0xe9a593[_0x59272a(0x21b)]});}return{'journeyFiles':_0x4a4970,'foldersToCreate':_0x1573d0};}export function calculateActivationActions(_0x9bebc1,_0x264ef0,_0x378b4e,_0x110ee2){const _0x589fd5=a152_0x57cc,_0x458a33=[],_0x2fadc6=new Map();for(const _0x539b73 of _0x264ef0){_0x2fadc6['set'](_0x539b73['name'],_0x539b73);}const _0x5857b1=new Map();for(const _0x15e72f of _0x9bebc1){_0x5857b1['set'](_0x15e72f[_0x589fd5(0x128)],_0x15e72f);}for(const _0x227248 of _0x9bebc1){const _0x3f3b2c=_0x2fadc6[_0x589fd5(0x1bc)](_0x227248[_0x589fd5(0x128)]);if(!_0x3f3b2c)_0x458a33[_0x589fd5(0x168)]({'type':_0x589fd5(0x1c0),'name':_0x227248[_0x589fd5(0x128)],'yamlActivation':_0x227248});else{const _0x4c4c0c=activationResponseToDef(_0x3f3b2c,_0x378b4e,_0x110ee2),_0x423a17=a152_0x21a271[_0x589fd5(0x1bb)](_0x4c4c0c),_0x16271c=a152_0x21a271[_0x589fd5(0x1bb)](_0x227248);_0x423a17!==_0x16271c&&_0x458a33[_0x589fd5(0x168)]({'type':_0x589fd5(0x1fe),'name':_0x227248[_0x589fd5(0x128)],'yamlActivation':_0x227248,'existingActivation':_0x3f3b2c});}}for(const _0x5a6bbf of _0x264ef0){!_0x5857b1['has'](_0x5a6bbf['name'])&&_0x458a33[_0x589fd5(0x168)]({'type':_0x589fd5(0x141),'name':_0x5a6bbf['name'],'existingActivation':_0x5a6bbf});}return _0x458a33;}function calculateYamlDiff(_0x2cda00,_0x559ea7){if(_0x559ea7){const _0x51ff76=generateDiff(_0x559ea7,_0x2cda00),_0x332745=hasChanges(_0x51ff76);return{'isNew':![],'hasChanges':_0x332745,'diff':_0x332745?formatDiffWithColors(_0x51ff76):undefined};}const _0x316e7a=generateDiff('',_0x2cda00);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x316e7a)};}export function calculateSegmentDiff(_0x3c3af8,_0x21c47e,_0x57fe51,_0x3cd949,_0x32b728){const _0x10146f=segmentToYamlString(_0x3c3af8),_0x58aacc=_0x21c47e?segmentToYamlString(segmentWithActivationsToYaml(_0x21c47e,_0x57fe51,undefined,_0x3cd949,_0x32b728)):undefined;return calculateYamlDiff(_0x10146f,_0x58aacc);}export function calculateJourneyDiff(_0x3916e3,_0x266558){const _0x3bfe1c=normalizeJourneyDef(_0x3916e3,_0x3916e3),_0x2ba5d5=a152_0x57e6e8(_0x3bfe1c),_0x2e5c42=_0x266558?a152_0x57e6e8(normalizeJourneyDef(_0x266558,_0x3916e3)):undefined;return calculateYamlDiff(_0x2ba5d5,_0x2e5c42);}export function findSegmentsToDelete(_0x2b5690,_0x2f974b,_0x56156c,_0xc6f274,_0x1aa30a){const _0x284b82=a152_0x57cc,_0x2688a0=new Set();for(const {yamlConfig:_0x548b45,folderPath:_0x52db10}of _0x2f974b){_0x2688a0['add'](_0x52db10+':'+_0x548b45[_0x284b82(0x128)]);}return _0x2b5690[_0x284b82(0x203)](_0x1ab374=>{const _0x299187=_0x284b82,_0x57a03d=_0x1ab374[_0x299187(0x19c)]?_0x56156c[_0x299187(0x1bc)](_0x1ab374[_0x299187(0x19c)]['toString']())||'':'',_0x64f6aa=_0x57a03d+':'+_0x1ab374[_0x299187(0x128)];if(_0x2688a0[_0x299187(0x169)](_0x64f6aa))return![];if(_0x1aa30a)return _0x57a03d===_0xc6f274||_0x57a03d[_0x299187(0x192)](_0xc6f274+'/');return!![];});}export function findJourneysToDelete(_0x587df4,_0x4b5d6e,_0x18c252,_0x4f2572,_0x60f707){const _0xef41b9=a152_0x57cc,_0x54d236=new Set();for(const {yamlConfig:_0x3b022d,folderPath:_0x3921f5}of _0x4b5d6e){_0x54d236[_0xef41b9(0x180)](_0x3921f5+':'+_0x3b022d[_0xef41b9(0x128)]);}return _0x587df4[_0xef41b9(0x203)](_0x538d8f=>{const _0x5b5890=_0xef41b9,_0x570a32=_0x538d8f[_0x5b5890(0x18f)]?_0x18c252['get'](_0x538d8f[_0x5b5890(0x18f)])||'':'',_0x1a63c5=_0x570a32+':'+_0x538d8f[_0x5b5890(0x170)];if(_0x54d236[_0x5b5890(0x169)](_0x1a63c5))return![];if(_0x60f707)return _0x570a32===_0x4f2572||_0x570a32['startsWith'](_0x4f2572+'/');return!![];});}export function buildSegmentLookupMap(_0x71cc98,_0x46cdef){const _0xe02542=a152_0x57cc,_0x33352c=new Map();for(const _0xfe0a94 of _0x71cc98){const _0x5c41d3=_0xfe0a94[_0xe02542(0x19c)]?_0x46cdef['get'](_0xfe0a94[_0xe02542(0x19c)][_0xe02542(0x206)]())||'':'',_0x32da7f=_0x5c41d3+':'+_0xfe0a94['name'];_0x33352c['set'](_0x32da7f,_0xfe0a94);}return _0x33352c;}export function buildSegmentNameToIdMap(_0x1dd9a5){const _0x408e87=a152_0x57cc,_0x33852d=new Map();for(const _0x21328b of _0x1dd9a5){_0x33852d[_0x408e87(0x1a0)](_0x21328b[_0x408e87(0x128)],_0x21328b['id']);}return _0x33852d;}export function buildJourneyBundleLookupMap(_0x521958,_0x18217b){const _0x6fe094=a152_0x57cc,_0x373e2d=new Map();for(const _0x5e5c9f of _0x521958){const _0x4f6eb5=_0x5e5c9f['folderId']?_0x18217b[_0x6fe094(0x1bc)](_0x5e5c9f[_0x6fe094(0x18f)])||'':'',_0xaf984e=_0x4f6eb5+':'+_0x5e5c9f[_0x6fe094(0x170)];!_0x373e2d[_0x6fe094(0x169)](_0xaf984e)&&_0x373e2d[_0x6fe094(0x1a0)](_0xaf984e,[]),_0x373e2d['get'](_0xaf984e)[_0x6fe094(0x168)](_0x5e5c9f);}for(const _0x516853 of _0x373e2d[_0x6fe094(0x20c)]()){_0x516853[_0x6fe094(0x13f)]((_0x22d86b,_0x22efc4)=>(_0x22d86b[_0x6fe094(0x219)]||0x0)-(_0x22efc4['versionNumber']||0x0));}return _0x373e2d;}export function collectFoldersToCreate(_0x14665f,_0x25e696){const _0x2709a8=new Set();for(const _0x1b19d6 of _0x14665f){if(!_0x1b19d6)continue;if(_0x25e696['has'](_0x1b19d6))continue;const _0x41bf7b=_0x1b19d6['split']('/');let _0xe20679='';for(const _0x15d181 of _0x41bf7b){_0xe20679=_0xe20679?_0xe20679+'/'+_0x15d181:_0x15d181,!_0x25e696['has'](_0xe20679)&&_0x2709a8['add'](_0xe20679);}}return _0x2709a8;}export function parseAndClassifyYamlFiles(_0x14cdfb,_0x1b3c8b,_0x2e1132){const _0x2677d9=a152_0x57cc,_0x87f108=[],_0x1684df=[];for(const _0x664d64 of _0x14cdfb){const _0x287999=a152_0x54c886['relative'](_0x1b3c8b,a152_0x54c886[_0x2677d9(0x1ae)](_0x664d64)),_0x2c73ce=_0x287999==='.'?'':_0x287999,_0xdcae3f=readFileSync(_0x664d64,_0x2677d9(0x159)),_0x1f5848=a152_0x21a271[_0x2677d9(0x1f9)](_0xdcae3f);if(isJourneyDef(_0x1f5848)){const _0xfc3890=a152_0x1367fb(_0xdcae3f);_0x1684df[_0x2677d9(0x168)]({'yamlConfig':_0xfc3890,'folderPath':_0x2c73ce,'sourcePath':_0x664d64});}else{if(!_0x2e1132?.[_0x2677d9(0x17f)]){const _0x97fe57=parseSegmentYamlFile(_0xdcae3f),_0x1c8908=normalizeChildSegmentYaml(_0x97fe57);_0x87f108['push']({'yamlConfig':_0x1c8908,'folderPath':_0x2c73ce,'sourcePath':_0x664d64});}}}return{'segments':_0x87f108,'journeys':_0x1684df};}export function validateParsedFiles(_0x5dfcff,_0x325a51){const _0x14bb33=a152_0x57cc,_0x55afe8=[];for(const {yamlConfig:_0x39cbfc,sourcePath:_0x30a82d}of _0x5dfcff[_0x14bb33(0x155)]){const _0x101be4=readFileSync(_0x30a82d,_0x14bb33(0x159)),_0x29dd5b=a152_0x21a271[_0x14bb33(0x153)](_0x101be4),_0x479013=validateSegmentDef(_0x39cbfc,{'source':_0x101be4,'document':_0x29dd5b},{'skipSchema':!![]});if(!_0x479013[_0x14bb33(0x1fd)]){const _0x329de5=a152_0x54c886[_0x14bb33(0x156)](_0x325a51,_0x30a82d);_0x55afe8['push']({'filePath':_0x329de5,'source':_0x101be4,'result':_0x479013,'isJourney':![]});}}for(const {yamlConfig:_0x544d23,sourcePath:_0x237c4c}of _0x5dfcff[_0x14bb33(0x1f3)]){const _0xf315bb=readFileSync(_0x237c4c,_0x14bb33(0x159)),_0x38ede0=a152_0x21a271['parseDocument'](_0xf315bb),_0xcfc6fd=validateJourneyDef(_0x544d23,{'source':_0xf315bb,'document':_0x38ede0},{'skipSchema':!![]});if(!_0xcfc6fd[_0x14bb33(0x1fd)]){const _0x3e7df0=a152_0x54c886[_0x14bb33(0x156)](_0x325a51,_0x237c4c);_0x55afe8[_0x14bb33(0x168)]({'filePath':_0x3e7df0,'source':_0xf315bb,'result':_0xcfc6fd,'isJourney':!![]});}}return _0x55afe8;}export function formatValidationErrors(_0x14bbeb){const _0x3721e8=a152_0x57cc,_0x17a647=[];for(const {filePath:_0x6c530b,source:_0x3f4da8,result:_0xf4d13b,isJourney:_0x51bd7b}of _0x14bbeb){const _0x580929=_0x51bd7b?_0x3721e8(0x1a8):'segment';_0x17a647[_0x3721e8(0x168)]('\x0a'+_0x6c530b+'\x20('+_0x580929+'):\x20'+_0xf4d13b[_0x3721e8(0x127)][_0x3721e8(0x1d7)]+_0x3721e8(0x17a)),_0x17a647[_0x3721e8(0x168)](formatValidationResult(_0xf4d13b,_0x3f4da8,_0x6c530b));}return _0x17a647[_0x3721e8(0x136)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x337ea1){const _0x55dcec=a152_0x57cc,_0xf9cc68=new Set(),_0x24ee14=new Map(),_0x4dabda=collectSegmentUsageCounts(_0x337ea1);if(_0x337ea1[_0x55dcec(0x155)])for(const [_0x319ae8,_0x2fbffa]of Object[_0x55dcec(0x1ec)](_0x337ea1[_0x55dcec(0x155)])){_0xf9cc68['add'](_0x319ae8);if(_0x2fbffa['rule']){const _0x107714=yamlRuleToApi(_0x2fbffa['rule']),_0x2234d0=apiRuleToYaml(_0x107714);_0x24ee14['set'](_0x319ae8,_0x2234d0);}}const _0x1e3e3e=new Map();let _0xa35a99=0x0;for(const [_0x36723d,_0x37c5c2]of _0x24ee14){const _0x37e7af=serializeExpandedRule(_0x37c5c2,_0x24ee14),_0x357c08=_0x1e3e3e[_0x55dcec(0x1bc)](_0x37e7af)||[];_0x357c08[_0x55dcec(0x168)]({'name':_0x36723d,'index':_0xa35a99}),_0x1e3e3e[_0x55dcec(0x1a0)](_0x37e7af,_0x357c08),_0xa35a99++;}const _0x5d63dc=new Map();for(const [_0x25c9cb,_0x3ae750]of _0x1e3e3e){const _0x36e28b=_0x3ae750['slice']()[_0x55dcec(0x13f)]((_0x4c4c4b,_0x47b007)=>{const _0x504812=_0x55dcec,_0x11069d=_0x4dabda['get'](_0x4c4c4b[_0x504812(0x128)])||0x0,_0x48e8f0=_0x4dabda[_0x504812(0x1bc)](_0x47b007[_0x504812(0x128)])||0x0;if(_0x11069d!==_0x48e8f0)return _0x48e8f0-_0x11069d;return _0x4c4c4b['index']-_0x47b007[_0x504812(0x146)];})[_0x55dcec(0x1dd)](_0x16a1a3=>_0x16a1a3['name']),_0x101dd9=[];for(const _0xa77e5c of _0x36e28b){const _0x514cf3=_0x4dabda[_0x55dcec(0x1bc)](_0xa77e5c)||0x0,_0x35c9b1=Math[_0x55dcec(0x1cd)](_0x514cf3,0x1);for(let _0x5a1ddd=0x0;_0x5a1ddd<_0x35c9b1;_0x5a1ddd++){_0x101dd9['push'](_0xa77e5c);}}_0x5d63dc[_0x55dcec(0x1a0)](_0x25c9cb,_0x101dd9);}return{'existingLocalSegmentNames':_0xf9cc68,'localSegmentRules':_0x24ee14,'localExpandedRuleToNames':_0x5d63dc};}export function createSegmentIdResolver(_0x1ef830,_0x5d9246){return async _0x1ff042=>{const _0x4d8c3c=a152_0x57cc,_0x42675f=_0x1ef830[_0x4d8c3c(0x1bc)](_0x1ff042);if(!_0x42675f)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x1ff042+_0x4d8c3c(0x1b5)+_0x5d9246+'\x27)');return _0x42675f;};}export function extractRootFolderId(_0x155087){const _0x1d4f4c=a152_0x57cc;return _0x155087[_0x1d4f4c(0x143)]?.[_0x1d4f4c(0x1d4)]?.[_0x1d4f4c(0x144)]?.['id']||_0x155087[_0x1d4f4c(0x143)]?.['parentFolder']?.[_0x1d4f4c(0x144)]?.['id'];}export function buildConnectionMaps(_0x4ff041){const _0x284255=a152_0x57cc,_0x392593=new Map(),_0x52dd4d=new Map(),_0x143809=new Map();for(const _0x4cc3e7 of _0x4ff041){_0x392593[_0x284255(0x1a0)](_0x4cc3e7[_0x284255(0x128)],parseInt(_0x4cc3e7['id'],0xa)),_0x52dd4d['set'](_0x4cc3e7['id'],_0x4cc3e7[_0x284255(0x128)]),_0x143809[_0x284255(0x1a0)](_0x4cc3e7[_0x284255(0x128)],_0x4cc3e7['type']);}return{'nameToId':_0x392593,'idToName':_0x52dd4d,'nameToType':_0x143809};}export function calculatePushStats(_0x1bde59,_0x1c07f8,_0x240970,_0x5b24d4,_0x2f8e66,_0x3eba66,_0x57c447){const _0x3998b0=a152_0x57cc,_0x25ba90=_0x1bde59[_0x3998b0(0x203)](_0x16c2ae=>_0x16c2ae[_0x3998b0(0x13a)]),_0x5d9419=_0x1bde59[_0x3998b0(0x203)](_0x45f1a2=>!_0x45f1a2[_0x3998b0(0x13a)]&&_0x45f1a2[_0x3998b0(0x15b)]),_0x5ccd37=_0x1bde59[_0x3998b0(0x203)](_0x2b2775=>!_0x2b2775['isNew']&&!_0x2b2775[_0x3998b0(0x15b)]),_0x4ff7c8=_0x3eba66?_0x5b24d4:[],_0x2d010b=_0x1c07f8[_0x3998b0(0x203)](_0x593403=>_0x593403[_0x3998b0(0x13a)]),_0x35c333=_0x1c07f8[_0x3998b0(0x203)](_0x151863=>!_0x151863[_0x3998b0(0x13a)]&&_0x151863['hasChanges']),_0x5cf484=_0x1c07f8[_0x3998b0(0x203)](_0x182881=>!_0x182881[_0x3998b0(0x13a)]&&!_0x182881[_0x3998b0(0x15b)]),_0x82c61d=_0x3eba66?_0x2f8e66:[],_0x5c744d=_0x1bde59[_0x3998b0(0x1dc)](_0x548525=>_0x548525[_0x3998b0(0x21c)]),_0x4b2e0a=_0x5c744d[_0x3998b0(0x203)](_0x36d3e6=>_0x36d3e6[_0x3998b0(0x19e)]==='create'),_0x3b97ae=_0x5c744d[_0x3998b0(0x203)](_0x4c319b=>_0x4c319b[_0x3998b0(0x19e)]===_0x3998b0(0x1fe)),_0x2bcf45=_0x5c744d[_0x3998b0(0x203)](_0x2477b0=>_0x2477b0[_0x3998b0(0x19e)]===_0x3998b0(0x141)),_0x604368=Array[_0x3998b0(0x12b)](_0x240970)[_0x3998b0(0x13f)](),_0x3db326=_0x57c447?![]:_0x25ba90[_0x3998b0(0x1d7)]>0x0||_0x5d9419[_0x3998b0(0x1d7)]>0x0||_0x4ff7c8[_0x3998b0(0x1d7)]>0x0,_0x6015ce=_0x2d010b[_0x3998b0(0x1d7)]>0x0||_0x35c333[_0x3998b0(0x1d7)]>0x0||_0x82c61d[_0x3998b0(0x1d7)]>0x0,_0x24d863=_0x57c447?![]:_0x5c744d[_0x3998b0(0x1d7)]>0x0,_0x2ef30f=_0x604368[_0x3998b0(0x1d7)]>0x0;return{'segments':{'new':_0x25ba90,'changed':_0x5d9419,'unchanged':_0x5ccd37,'toDelete':_0x4ff7c8},'journeys':{'new':_0x2d010b,'changed':_0x35c333,'unchanged':_0x5cf484,'toDelete':_0x82c61d},'activations':{'all':_0x5c744d,'toCreate':_0x4b2e0a,'toUpdate':_0x3b97ae,'toDelete':_0x2bcf45},'folders':{'toCreate':_0x604368},'counts':{'segments':{'new':_0x25ba90[_0x3998b0(0x1d7)],'changed':_0x5d9419[_0x3998b0(0x1d7)],'unchanged':_0x5ccd37[_0x3998b0(0x1d7)],'toDelete':_0x4ff7c8['length']},'journeys':{'new':_0x2d010b[_0x3998b0(0x1d7)],'changed':_0x35c333[_0x3998b0(0x1d7)],'unchanged':_0x5cf484[_0x3998b0(0x1d7)],'toDelete':_0x82c61d['length']},'activations':{'create':_0x4b2e0a['length'],'update':_0x3b97ae[_0x3998b0(0x1d7)],'delete':_0x2bcf45[_0x3998b0(0x1d7)]},'folders':_0x604368[_0x3998b0(0x1d7)]},'hasChanges':_0x3db326||_0x6015ce||_0x24d863||_0x2ef30f};}export async function buildPushExecutionContext(_0x304b25,_0xe48373,_0x20174c,_0x3beefa,_0x5026ef,_0x4cf9d0){const _0x18a396=a152_0x57cc,_0x3c5dff=extractRootFolderId(_0x20174c),{pathToId:_0x3449e7,idToPath:_0x4092db}=buildFolderMaps(_0x5026ef),_0x1e4052=buildSegmentNameToIdMap(_0x3beefa),_0x5ccfbc=new Map(),{batchAsync:_0x31dcc5}=await import('../../utils/async.js'),[_0xe4f79a,_0x178332]=await Promise[_0x18a396(0x12c)]([_0x304b25['user'][_0x18a396(0x125)](),_0x304b25[_0x18a396(0x13e)][_0x18a396(0x1ee)](),((async()=>{const _0xee5238=_0x18a396;!_0x4cf9d0&&_0x3beefa[_0xee5238(0x1d7)]>0x0&&await _0x31dcc5(_0x3beefa,async _0x41f8da=>{const _0x166298=_0xee5238,_0x1feb47=await _0x304b25[_0x166298(0x1ef)][_0x166298(0x215)](_0xe48373,_0x41f8da['id']);_0x5ccfbc[_0x166298(0x1a0)](_0x41f8da['id'],_0x1feb47);});})())]),{emailToId:_0x1563ee,idToEmail:_0x2ef46b}=_0xe4f79a,_0x5b36f5=buildConnectionMaps(_0x178332);return{'rootFolderId':_0x3c5dff,'folderPathToId':_0x3449e7,'folderIdToPath':_0x4092db,'segmentNameToId':_0x1e4052,'activationsBySegmentId':_0x5ccfbc,'emailToIdMap':_0x1563ee,'idToEmailMap':_0x2ef46b,'connectionNameToIdMap':_0x5b36f5['nameToId'],'connectionIdToNameMap':_0x5b36f5['idToName'],'connectionNameToTypeMap':_0x5b36f5[_0x18a396(0x131)]};}export function createPushYamlContextForBundle(_0xf8770a,_0x442b7b,_0x598d7c,_0xad6487,_0x471d6d,_0x70d829,_0x56efef,_0x7eb8e9){const {existingLocalSegmentNames:_0x316d60,localExpandedRuleToNames:_0x18c3be}=_0xad6487,_0x3de5f3=new Set(),_0x45d3fb=new Map(),_0x4a8ccb=new Map(),_0x3c833a=new Map(),_0x1e81c9=createJumpTargetCache(),_0xaba3bc=new Map(),_0x2c516e=new Map(),_0x1f3b4f=new Set();let _0x4b06c8;const _0x40636b=_0x273531=>{const _0x2c2fae={'resolveSegment':async _0x20ee0f=>{const _0xa93937=a152_0x57cc,_0xc136db=_0x3c833a[_0xa93937(0x1bc)](_0x20ee0f);if(_0xc136db!==undefined)return{'name':_0xc136db,'isJourneyLocal':!![]};try{const _0x46e20d=await fetchSegment(_0xf8770a,_0x442b7b,_0x20ee0f,_0x598d7c);if(!_0x46e20d)throw new Error(_0xa93937(0x172));const _0x3cf4ff=generateJourneyLocalName(_0x46e20d['name']),_0x264735=_0x46e20d[_0xa93937(0x18e)]===SEGMENT_KIND_JOURNEY&&_0x3cf4ff!==undefined;let _0x526414=_0x46e20d[_0xa93937(0x128)],_0xc87e7c;if(_0x264735&&_0x46e20d[_0xa93937(0x154)]){const _0x45fdbf=apiRuleToYaml(_0x46e20d[_0xa93937(0x154)]);_0x2c516e[_0xa93937(0x1a0)](_0x20ee0f,_0x45fdbf);const _0x28d734=async _0x1e5130=>{const _0x4fc5b6=_0xa93937,_0x572f09=collectSegmentRefsFromRule(_0x1e5130);for(const _0x327ebe of _0x572f09){if(!_0x2c516e[_0x4fc5b6(0x169)](_0x327ebe))try{const _0x5e40cd=await fetchSegment(_0xf8770a,_0x442b7b,_0x327ebe,_0x598d7c);if(_0x5e40cd?.[_0x4fc5b6(0x154)]){const _0x15ff83=apiRuleToYaml(_0x5e40cd[_0x4fc5b6(0x154)]);_0x2c516e[_0x4fc5b6(0x1a0)](_0x327ebe,_0x15ff83),await _0x28d734(_0x15ff83);}}catch(_0x44d0e5){logger[_0x4fc5b6(0x1d2)](_0x4fc5b6(0x1b7)+_0x327ebe+':\x20'+_0x44d0e5);}}};await _0x28d734(_0x45fdbf);const _0x1b6217=serializeExpandedRule(_0x45fdbf,_0x2c516e),_0x174a44=_0x18c3be[_0xa93937(0x1bc)](_0x1b6217);if(_0x174a44&&_0x174a44[_0xa93937(0x1d7)]>0x0){const _0xfd9b3=_0x45d3fb['get'](_0x1b6217)||0x0,_0x266497=_0x174a44[_0xfd9b3]||_0x174a44[_0x174a44[_0xa93937(0x1d7)]-0x1];_0x45d3fb[_0xa93937(0x1a0)](_0x1b6217,_0xfd9b3+0x1),_0x526414=_0x266497,_0x3de5f3['add'](_0x526414),_0x3c833a[_0xa93937(0x1a0)](_0x20ee0f,_0x526414);const _0x56a87c=await resolveRuleSegmentRefs(_0x45fdbf,async _0x3c2e6d=>{const _0x17e928=_0xa93937,_0x3c9d17=_0x3c833a[_0x17e928(0x1bc)](_0x3c2e6d);if(_0x3c9d17)return _0x3c9d17;const _0x21292e=await _0x4b06c8[_0x17e928(0x15c)](_0x3c2e6d);return _0x21292e[_0x17e928(0x128)];});_0xc87e7c={'description':_0x46e20d['description'],'rule':_0x56a87c};}else{const _0x41f2f0=_0xaba3bc[_0xa93937(0x1bc)](_0x1b6217);if(_0x41f2f0)_0x526414=_0x41f2f0,_0x3c833a['set'](_0x20ee0f,_0x526414);else{if(_0x3cf4ff){let _0x5aedde=_0x3cf4ff,_0x2d1bfb=0x2;while(_0x3de5f3[_0xa93937(0x169)](_0x5aedde)||_0x316d60[_0xa93937(0x169)](_0x5aedde)){_0x5aedde=_0x3cf4ff+'_'+_0x2d1bfb,_0x2d1bfb++;}_0x3de5f3['add'](_0x5aedde),_0x526414=_0x5aedde;}_0x3c833a[_0xa93937(0x1a0)](_0x20ee0f,_0x526414),_0xaba3bc[_0xa93937(0x1a0)](_0x1b6217,_0x526414);const _0x13a44d=await resolveRuleSegmentRefs(_0x45fdbf,async _0x2f05b8=>{const _0x14c82b=_0xa93937,_0x278bc7=_0x3c833a[_0x14c82b(0x1bc)](_0x2f05b8);if(_0x278bc7)return _0x278bc7;const _0x36fa24=await _0x4b06c8[_0x14c82b(0x15c)](_0x2f05b8);return _0x36fa24[_0x14c82b(0x128)];});_0xc87e7c={'description':_0x46e20d[_0xa93937(0x151)],'rule':_0x13a44d};}}}return{'name':_0x526414,'isJourneyLocal':_0x264735,'definition':_0xc87e7c};}catch(_0x35fbda){return logger['debug'](_0xa93937(0x1d3)+_0x20ee0f+':\x20'+_0x35fbda),{'name':_0x20ee0f,'isJourneyLocal':![]};}},'resolveActivation':async _0x57091b=>{const _0x35472a=a152_0x57cc,_0x14ba30=_0x4a8ccb['get'](_0x57091b);if(_0x14ba30!==undefined)return{'name':_0x14ba30,'isJourneyLocal':!![]};try{let _0x4b9f74=_0x56efef?.[_0x35472a(0x1bc)](_0x57091b);!_0x4b9f74&&(_0x4b9f74=await _0xf8770a['journey']['getActivation'](_0x273531,_0x57091b));const _0x12b48b=_0x4b9f74[_0x35472a(0x16e)]['activationParams'][_0x35472a(0x128)]||_0x57091b,_0x384dac=sanitizeYamlKey(_0x12b48b)||_0x35472a(0x174)+_0x57091b,_0xa775e2=_0x384dac;_0x4a8ccb[_0x35472a(0x1a0)](_0x57091b,_0xa775e2);const _0x27f1d0=journeyActivationStepToYaml(_0x4b9f74,_0x471d6d,_0x70d829);return{'name':_0xa775e2,'isJourneyLocal':!![],'definition':_0x27f1d0};}catch(_0x2ba1cb){return logger['debug'](_0x35472a(0x1a2)+_0x57091b+':\x20'+_0x2ba1cb),{'name':_0x57091b,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x549d18,_0x5557d1)=>resolveJumpTarget(_0x549d18,_0x5557d1,_0x1e81c9,async _0x49ddfb=>{const _0x544084=a152_0x57cc,_0x154e05=_0x7eb8e9?.['get'](_0x49ddfb);if(_0x154e05)return _0x154e05;return _0xf8770a[_0x544084(0x1a8)][_0x544084(0x217)](_0x49ddfb);})};return _0x4b06c8=_0x2c2fae,_0x2c2fae;},_0x2b13de=async _0x100736=>{const _0x36fee3=a152_0x57cc,{collectSegmentIdsFromJourneyApi:_0x583bc5}=await import('./journey-yaml.js'),{batchAsync:_0x44874f}=await import(_0x36fee3(0x16d)),_0x4fbb32=new Set();for(const _0x2704f3 of _0x100736){let _0x40de24=_0x7eb8e9?.[_0x36fee3(0x1bc)](_0x2704f3);!_0x40de24&&(_0x40de24=await _0xf8770a['journey']['getJourney'](_0x2704f3));const _0x11edf2=_0x583bc5(_0x40de24);for(const _0x3fbb3f of _0x11edf2){_0x4fbb32[_0x36fee3(0x180)](_0x3fbb3f);}}let _0x17b2de=Array[_0x36fee3(0x12b)](_0x4fbb32);while(_0x17b2de[_0x36fee3(0x1d7)]>0x0){const _0x2b07ef=_0x17b2de['filter'](_0x2b4bfc=>!_0x1f3b4f[_0x36fee3(0x169)](_0x2b4bfc));if(_0x2b07ef[_0x36fee3(0x1d7)]===0x0)break;const _0x2ffe59=await _0x44874f(_0x2b07ef,async _0x211263=>{_0x1f3b4f['add'](_0x211263);const _0x8a5fa6=await fetchSegment(_0xf8770a,_0x442b7b,_0x211263,_0x598d7c);if(!_0x8a5fa6)return null;return{'segmentId':_0x211263,'segment':_0x8a5fa6};},0xa),_0x428083=new Set();for(const _0x14ac94 of _0x2ffe59){if(!_0x14ac94?.['segment']?.['rule'])continue;const _0x42cade=apiRuleToYaml(_0x14ac94[_0x36fee3(0x1ef)][_0x36fee3(0x154)]);_0x2c516e[_0x36fee3(0x1a0)](_0x14ac94['segmentId'],_0x42cade);const _0x2a850f=collectSegmentRefsFromRule(_0x42cade);for(const _0x4a3c63 of _0x2a850f){!_0x1f3b4f[_0x36fee3(0x169)](_0x4a3c63)&&_0x428083[_0x36fee3(0x180)](_0x4a3c63);}}_0x17b2de=Array[_0x36fee3(0x12b)](_0x428083);}};return{'createYamlContext':_0x40636b,'prefetchJourneySegments':_0x2b13de};}export async function executePushSegments(_0x341d6b,_0x591fec,_0x40d161,_0x3bd71a,_0x2b5aa){const _0x4875ad=a152_0x57cc,{segmentDefToCreateRequest:_0x348cb6,segmentDefToUpdateRequest:_0x504b28}=await import(_0x4875ad(0x13d)),_0x2c6dd8=_0x40d161[_0x4875ad(0x204)],_0x7425cf=0x5,_0x16150d=async _0x431258=>{const _0x539304=_0x4875ad,_0x55acbc=_0x431258[_0x539304(0x1bd)]?_0x2c6dd8[_0x539304(0x1bc)](_0x431258[_0x539304(0x1bd)]):undefined;let _0x4f9043;const _0x4e115f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x59865f=_0x431258[_0x539304(0x20f)];if(_0x431258[_0x539304(0x20f)][_0x539304(0x154)]){const _0x42fbec=createSegmentIdResolver(_0x40d161['segmentNameToId'],_0x431258['yamlConfig'][_0x539304(0x128)]),_0x54509b=await resolveRuleSegmentIds(_0x431258[_0x539304(0x20f)]['rule'],_0x42fbec);_0x59865f={..._0x431258[_0x539304(0x20f)],'rule':_0x54509b};}try{if(_0x431258[_0x539304(0x13a)]){_0x2b5aa[_0x539304(0x1cc)]?.({'type':_0x539304(0x16b),'name':_0x431258[_0x539304(0x20f)]['name']});const _0x315516=_0x348cb6(_0x59865f,_0x55acbc),_0x761002=await _0x2b5aa[_0x539304(0x176)](_0x539304(0x1a6)+_0x431258[_0x539304(0x20f)][_0x539304(0x128)]+'\x27...',()=>_0x341d6b['segment'][_0x539304(0x142)](_0x3bd71a[_0x539304(0x1b2)],_0x315516));_0x4f9043=_0x761002['data']['id'],_0x40d161['segmentNameToId'][_0x539304(0x1a0)](_0x431258[_0x539304(0x20f)][_0x539304(0x128)],_0x4f9043),_0x4e115f['createdSegmentId']={'name':_0x431258['yamlConfig'][_0x539304(0x128)],'id':_0x4f9043},_0x2b5aa[_0x539304(0x1cc)]?.({'type':_0x539304(0x21a),'name':_0x431258['yamlConfig'][_0x539304(0x128)],'segmentId':_0x4f9043}),_0x2b5aa[_0x539304(0x190)]?.(_0x539304(0x1e9)+_0x431258[_0x539304(0x20f)]['name']+'\x27'),_0x4e115f[_0x539304(0x1f1)]=0x1;}else{if(_0x431258[_0x539304(0x15b)]){_0x2b5aa[_0x539304(0x1cc)]?.({'type':'segment_updating','name':_0x431258['yamlConfig'][_0x539304(0x128)]});const _0x5f3830=_0x504b28(_0x59865f);_0x55acbc!==_0x431258[_0x539304(0x216)]?.[_0x539304(0x19c)]&&(_0x5f3830[_0x539304(0x19c)]=_0x55acbc?parseInt(_0x55acbc,0xa):undefined),await _0x2b5aa['withProgress'](_0x539304(0x15d)+_0x431258[_0x539304(0x20f)]['name']+'\x27...',()=>_0x341d6b['segment'][_0x539304(0x1f5)](_0x3bd71a['parentId'],_0x431258[_0x539304(0x216)]['id'],_0x5f3830)),_0x4f9043=_0x431258[_0x539304(0x216)]['id'],_0x2b5aa[_0x539304(0x1cc)]?.({'type':_0x539304(0x1cf),'name':_0x431258[_0x539304(0x20f)]['name']}),_0x2b5aa[_0x539304(0x190)]?.(_0x539304(0x138)+_0x431258['yamlConfig'][_0x539304(0x128)]+'\x27'),_0x4e115f[_0x539304(0x123)]=0x1;}else _0x4f9043=_0x431258['existingSegment']['id'];}}catch(_0x2e0744){const _0x3c3503=isHttp400Error(_0x2e0744),_0x28f3a6=_0x3c3503?ErrorCode[_0x539304(0x221)]:ErrorCode[_0x539304(0x181)],_0xf2b4a2=getErrorMessage(_0x2e0744);throw new SDKError(_0x28f3a6,_0x539304(0x19a)+(_0x431258['isNew']?_0x539304(0x1c0):_0x539304(0x1fe))+_0x539304(0x129)+_0x431258['absolutePath']+'\x0a\x20\x20'+_0xf2b4a2,_0x2e0744);}try{const _0x2ad0c7=await syncActivationsForSegment(_0x341d6b,_0x3bd71a[_0x539304(0x1b2)],_0x4f9043,_0x431258[_0x539304(0x20f)]['name'],_0x431258[_0x539304(0x21c)],_0x2b5aa,_0x431258['absolutePath']);_0x4e115f[_0x539304(0x222)]=_0x2ad0c7;}catch(_0x4d89f0){if(_0x4d89f0 instanceof SDKError)throw _0x4d89f0;throw new SDKError(ErrorCode[_0x539304(0x171)],_0x539304(0x1b4)+_0x431258[_0x539304(0x20f)][_0x539304(0x128)]+_0x539304(0x212)+_0x431258[_0x539304(0x1f2)]+_0x539304(0x183)+getErrorMessage(_0x4d89f0),_0x4d89f0);}return _0x4e115f;},_0x4de721=await batchAsync(_0x591fec,_0x16150d,_0x7425cf),_0x38ff0b={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1371f6 of _0x4de721){_0x38ff0b[_0x4875ad(0x1f1)]+=_0x1371f6['created'],_0x38ff0b[_0x4875ad(0x123)]+=_0x1371f6[_0x4875ad(0x123)],_0x1371f6[_0x4875ad(0x1f4)]&&_0x38ff0b[_0x4875ad(0x162)][_0x4875ad(0x1a0)](_0x1371f6[_0x4875ad(0x1f4)]['name'],_0x1371f6['createdSegmentId']['id']),_0x38ff0b[_0x4875ad(0x222)][_0x4875ad(0x1f1)]+=_0x1371f6['activations'][_0x4875ad(0x1f1)],_0x38ff0b[_0x4875ad(0x222)]['updated']+=_0x1371f6[_0x4875ad(0x222)]['updated'],_0x38ff0b[_0x4875ad(0x222)][_0x4875ad(0x205)]+=_0x1371f6[_0x4875ad(0x222)]['deleted'];}return _0x38ff0b;}async function syncActivationsForSegment(_0xac4a07,_0x59156f,_0x4759dc,_0x42769b,_0x335b97,_0x56d9d4,_0x1410c7){const _0x29b1ac=a152_0x57cc,_0x13ee5c={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xace67c of _0x335b97){try{if(_0xace67c[_0x29b1ac(0x19e)]===_0x29b1ac(0x1c0)&&_0xace67c['validatedRequest'])_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x1ab),'segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),await _0x56d9d4[_0x29b1ac(0x176)](_0x29b1ac(0x1ea)+_0xace67c['name']+_0x29b1ac(0x18d),()=>_0xac4a07[_0x29b1ac(0x1ef)][_0x29b1ac(0x12e)](_0x59156f,_0x4759dc,_0xace67c['validatedRequest'])),_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x1a1),'segmentName':_0x42769b,'activationName':_0xace67c['name']}),_0x56d9d4[_0x29b1ac(0x190)]?.('Created\x20activation\x20\x27'+_0xace67c[_0x29b1ac(0x128)]+'\x27'),_0x13ee5c[_0x29b1ac(0x1f1)]++;else{if(_0xace67c[_0x29b1ac(0x19e)]===_0x29b1ac(0x1fe)&&_0xace67c['validatedRequest']&&_0xace67c[_0x29b1ac(0x184)])_0x56d9d4['onProgress']?.({'type':_0x29b1ac(0x1c4),'segmentName':_0x42769b,'activationName':_0xace67c['name']}),await _0x56d9d4[_0x29b1ac(0x176)](_0x29b1ac(0x1ba)+_0xace67c['name']+_0x29b1ac(0x18d),()=>_0xac4a07[_0x29b1ac(0x1ef)][_0x29b1ac(0x220)](_0x59156f,_0x4759dc,_0xace67c[_0x29b1ac(0x184)]['id'],_0xace67c[_0x29b1ac(0x13c)])),_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x12a),'segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),_0x56d9d4[_0x29b1ac(0x190)]?.(_0x29b1ac(0x14e)+_0xace67c[_0x29b1ac(0x128)]+'\x27'),_0x13ee5c[_0x29b1ac(0x123)]++;else _0xace67c[_0x29b1ac(0x19e)]===_0x29b1ac(0x141)&&_0xace67c[_0x29b1ac(0x184)]&&(_0x56d9d4['onProgress']?.({'type':'activation_deleting','segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),await _0x56d9d4[_0x29b1ac(0x176)](_0x29b1ac(0x224)+_0xace67c[_0x29b1ac(0x128)]+_0x29b1ac(0x18d),()=>_0xac4a07['segment']['deleteActivation'](_0x59156f,_0x4759dc,_0xace67c['existingActivation']['id'])),_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x1cb),'segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),_0x56d9d4[_0x29b1ac(0x208)]?.('Deleted\x20activation\x20\x27'+_0xace67c[_0x29b1ac(0x128)]+'\x27'),_0x13ee5c[_0x29b1ac(0x205)]++);}}catch(_0x1f8e0d){const _0x142df0=isHttp400Error(_0x1f8e0d),_0x415289=_0x142df0?ErrorCode[_0x29b1ac(0x1f8)]:ErrorCode[_0x29b1ac(0x171)],_0x44c144=getErrorMessage(_0x1f8e0d);throw new SDKError(_0x415289,_0x29b1ac(0x19a)+_0xace67c[_0x29b1ac(0x19e)]+'\x20activation\x20\x27'+_0xace67c[_0x29b1ac(0x128)]+_0x29b1ac(0x212)+_0x1410c7+_0x29b1ac(0x183)+_0x44c144,_0x1f8e0d);}}return _0x13ee5c;}export async function executePushFolders(_0x2df1fd,_0x50bdb9,_0xf5d02,_0x177e9b,_0x205384){const _0x20dfe0=a152_0x57cc,_0x35d212=new Map(_0xf5d02),_0x2a5e84=sortFoldersByDepth(_0x50bdb9);for(const _0x13ed1c of _0x2a5e84){const _0x36265a=_0x13ed1c[_0x20dfe0(0x21d)]('/'),_0x5f2a28=_0x36265a[_0x36265a['length']-0x1],_0x36a966=_0x36265a[_0x20dfe0(0x149)](0x0,-0x1)[_0x20dfe0(0x136)]('/'),_0x37f671=_0x35d212[_0x20dfe0(0x1bc)](_0x36a966);_0x205384[_0x20dfe0(0x1cc)]?.({'type':_0x20dfe0(0x137),'folder':_0x13ed1c});const _0x4db192={'name':_0x5f2a28,'parentFolderId':_0x37f671},_0x258fa3=await _0x205384[_0x20dfe0(0x176)](_0x20dfe0(0x1db)+_0x13ed1c+_0x20dfe0(0x18d),()=>_0x2df1fd[_0x20dfe0(0x1ef)][_0x20dfe0(0x209)](_0x177e9b[_0x20dfe0(0x1b2)],_0x4db192));_0x35d212['set'](_0x13ed1c,_0x258fa3['data']['id']),_0x205384[_0x20dfe0(0x1cc)]?.({'type':'folder_created','folder':_0x13ed1c,'folderId':_0x258fa3[_0x20dfe0(0x144)]['id']}),_0x205384['logInfo']?.(_0x20dfe0(0x1ce)+_0x13ed1c+'\x27');}return _0x35d212;}export async function executePushSegmentDeletions(_0xab26f6,_0x2610ed,_0x5d921c){const _0x200813=a152_0x57cc;if(_0x2610ed['length']===0x0)return 0x0;const {batchAsync:_0x4f9cab}=await import('../../utils/async.js'),_0x1c3302=0x5,_0xe6b757=await _0x4f9cab(_0x2610ed,async _0x127cae=>{const _0xd648a=a152_0x57cc;return _0x5d921c[_0xd648a(0x1cc)]?.({'type':_0xd648a(0x157),'name':_0x127cae['name']}),await _0xab26f6[_0xd648a(0x1ef)][_0xd648a(0x1a5)](_0x127cae['id']),_0x5d921c[_0xd648a(0x1cc)]?.({'type':_0xd648a(0x1d0),'name':_0x127cae[_0xd648a(0x128)]}),_0x5d921c[_0xd648a(0x208)]?.(_0xd648a(0x18a)+_0x127cae['name']+'\x27'),0x1;},_0x1c3302);return _0xe6b757[_0x200813(0x133)]((_0x4e1af4,_0x546f8c)=>_0x4e1af4+_0x546f8c,0x0);}export async function executePushJourneys(_0x162905,_0x5b5f04,_0x5bb89a,_0x320da8,_0x303c40){const _0x5d2eff=a152_0x57cc,{journeyDefToRequest:_0x28bc06}=await import(_0x5d2eff(0x14a)),{activationDefToCreateRequest:_0x223f2d,yamlRuleToApi:_0x11ba87,validateSegmentRule:_0xce459b}=await import(_0x5d2eff(0x13d)),_0x2b0b7d={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x27cb2b=new Map(_0x5bb89a['segmentNameToId']),_0xa0b377=0x5;for(let _0x6a50ba=0x0;_0x6a50ba<_0x5b5f04['length'];_0x6a50ba+=_0xa0b377){const _0x52024c=_0x5b5f04[_0x5d2eff(0x149)](_0x6a50ba,_0x6a50ba+_0xa0b377),_0x203c30=await Promise[_0x5d2eff(0x12c)](_0x52024c['map'](async _0x353bd5=>{const _0x53a77e=_0x5d2eff;if(!_0x353bd5[_0x53a77e(0x13a)]&&!_0x353bd5[_0x53a77e(0x15b)])return{'action':_0x53a77e(0x178),'name':_0x353bd5[_0x53a77e(0x20f)]['name'],'journeyId':_0x353bd5[_0x53a77e(0x1c3)]?.['id']};const _0x4b3f2b=_0x353bd5['folderPath']?_0x5bb89a[_0x53a77e(0x204)][_0x53a77e(0x1bc)](_0x353bd5[_0x53a77e(0x1bd)]):undefined;_0x303c40[_0x53a77e(0x1cc)]?.({'type':_0x353bd5[_0x53a77e(0x13a)]?_0x53a77e(0x1ff):_0x53a77e(0x179),'name':_0x353bd5['yamlConfig'][_0x53a77e(0x128)]});try{const _0x576991=await executeSingleJourneyPush(_0x162905,_0x353bd5,{..._0x5bb89a,'segmentNameToId':_0x27cb2b},{'parentId':_0x320da8['parentId'],'rootFolderId':_0x320da8[_0x53a77e(0x16f)],'folderId':_0x4b3f2b,'verbose':_0x320da8[_0x53a77e(0x18b)]},_0x303c40,{'journeyDefToRequest':_0x28bc06,'activationDefToCreateRequest':_0x223f2d,'yamlRuleToApi':_0x11ba87,'validateSegmentRule':_0xce459b});for(const [_0x2d2986,_0x56d2ae]of _0x576991[_0x53a77e(0x124)]){_0x27cb2b[_0x53a77e(0x1a0)](_0x2d2986,_0x56d2ae),_0x2b0b7d[_0x53a77e(0x124)][_0x53a77e(0x1a0)](_0x2d2986,_0x56d2ae);}if(_0x576991[_0x53a77e(0x15a)]===_0x53a77e(0x1f1))_0x303c40[_0x53a77e(0x1cc)]?.({'type':_0x53a77e(0x15f),'name':_0x353bd5[_0x53a77e(0x20f)]['name'],'journeyId':_0x576991[_0x53a77e(0x14c)]}),_0x303c40[_0x53a77e(0x190)]?.(_0x53a77e(0x21e)+_0x353bd5[_0x53a77e(0x20f)]['name']+'\x27'),_0x2b0b7d[_0x53a77e(0x1f1)]++;else _0x576991[_0x53a77e(0x15a)]===_0x53a77e(0x123)&&(_0x303c40['onProgress']?.({'type':_0x53a77e(0x1f0),'name':_0x353bd5['yamlConfig'][_0x53a77e(0x128)]}),_0x303c40[_0x53a77e(0x190)]?.(_0x53a77e(0x202)+_0x353bd5[_0x53a77e(0x20f)][_0x53a77e(0x128)]+'\x27'),_0x2b0b7d[_0x53a77e(0x123)]++);return{'action':_0x576991[_0x53a77e(0x15a)],'name':_0x353bd5['yamlConfig'][_0x53a77e(0x128)],'journeyId':_0x576991[_0x53a77e(0x14c)]};}catch(_0x3f59ab){const _0x3adf88=isHttp400Error(_0x3f59ab),_0xa018e3=_0x3adf88?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5c7f7e=getErrorMessage(_0x3f59ab);throw new SDKError(_0xa018e3,_0x53a77e(0x19a)+(_0x353bd5[_0x53a77e(0x13a)]?_0x53a77e(0x1c0):'update')+_0x53a77e(0x1ca)+_0x353bd5[_0x53a77e(0x1f2)]+'\x0a\x20\x20'+_0x5c7f7e,_0x3f59ab);}}));_0x2b0b7d[_0x5d2eff(0x1e2)]['push'](..._0x203c30);}return _0x2b0b7d;}async function matchExistingJourneySegments(_0x21db75,_0x71711d,_0x4e7ace,_0x231a08,_0x1a605f){const _0x2a68a5=a152_0x57cc;if(!_0x71711d[_0x2a68a5(0x1c3)]||!_0x71711d[_0x2a68a5(0x20f)][_0x2a68a5(0x155)])return;const _0x6b502c=new Map(),_0x23baeb=new Set();for(const _0x45c0da of Object[_0x2a68a5(0x14f)](_0x71711d[_0x2a68a5(0x20f)][_0x2a68a5(0x155)])){const _0x2b9ec3=generateDeterministicJourneySegmentName(_0x71711d[_0x2a68a5(0x20f)][_0x2a68a5(0x128)],_0x45c0da);_0x6b502c[_0x2a68a5(0x1a0)](_0x2b9ec3,_0x45c0da),_0x23baeb[_0x2a68a5(0x180)](_0x45c0da);}const _0x5b2bcc=[],_0x5457b1=collectSegmentIdsFromJourneyApi(_0x71711d[_0x2a68a5(0x1c3)]);for(const _0x276ebc of _0x5457b1){const _0x5f4d67=await fetchSegment(_0x21db75,_0x4e7ace,_0x276ebc,_0x231a08);if(!_0x5f4d67?.[_0x2a68a5(0x128)])continue;const _0x5e4aae=_0x6b502c['get'](_0x5f4d67[_0x2a68a5(0x128)]);_0x5e4aae?(_0x1a605f[_0x2a68a5(0x1a0)](_0x5e4aae,_0x276ebc),_0x23baeb['delete'](_0x5e4aae)):_0x5b2bcc[_0x2a68a5(0x168)]({'id':_0x276ebc,'seg':_0x5f4d67});}if(_0x23baeb[_0x2a68a5(0x1e3)]>0x0&&_0x5b2bcc[_0x2a68a5(0x1d7)]>0x0){const {localExpandedRuleToNames:_0x558eec}=buildLocalExpandedRuleMappings(_0x71711d[_0x2a68a5(0x20f)]),_0x51cef0=new Map();for(const {id:_0x5bf534,seg:_0x1f7926}of _0x5b2bcc){if(_0x1f7926[_0x2a68a5(0x154)]){const _0x6740f0=apiRuleToYaml(_0x1f7926['rule']);_0x51cef0[_0x2a68a5(0x1a0)](_0x5bf534,_0x6740f0);}}for(const {id:_0x5171dd,seg:_0x3214af}of _0x5b2bcc){if(!_0x3214af[_0x2a68a5(0x154)])continue;const _0x39ca7b=_0x51cef0[_0x2a68a5(0x1bc)](_0x5171dd);if(!_0x39ca7b)continue;const _0x3880c4=serializeExpandedRule(_0x39ca7b,_0x51cef0),_0x2460ac=_0x558eec[_0x2a68a5(0x1bc)](_0x3880c4);if(_0x2460ac){const _0x3344a0=_0x2460ac[_0x2a68a5(0x1e6)](_0xd9ab33=>_0x23baeb[_0x2a68a5(0x169)](_0xd9ab33));_0x3344a0&&(_0x1a605f[_0x2a68a5(0x1a0)](_0x3344a0,_0x5171dd),_0x23baeb['delete'](_0x3344a0),logger[_0x2a68a5(0x1d2)](_0x2a68a5(0x173)+_0x3214af[_0x2a68a5(0x128)]+_0x2a68a5(0x18c)+_0x3344a0+_0x2a68a5(0x12d)));}}}}async function executeSingleJourneyPush(_0x111c63,_0x2cda2d,_0x2efbd0,_0x1bbd6d,_0x251bce,_0x373145){const _0x1913d9=a152_0x57cc,{journeyDefToRequest:_0x117e94,activationDefToCreateRequest:_0x22585a,yamlRuleToApi:_0x15ae98,validateSegmentRule:_0x34af5d}=_0x373145,_0x401bfa=new Map(),_0x318c17=new Map();recoverSegmentIdsFromPushRecovery(_0x2cda2d,_0x401bfa,_0x2efbd0[_0x1913d9(0x197)]);const _0x2bb11c=new Map(),_0x5e64fd=new Map(),_0x39c00b=new Map();let _0x27c421;const _0x5192b5=async()=>{const _0x53dcd9=_0x1913d9;if(_0x27c421)return;_0x27c421=new Map();if(!_0x2cda2d[_0x53dcd9(0x1c3)])return;const _0x3a308e=await _0x111c63['journey'][_0x53dcd9(0x215)](_0x2cda2d[_0x53dcd9(0x1c3)]['id']);for(const _0x3e4c22 of _0x3a308e){const _0x8d434c=journeyActivationStepToYaml(_0x3e4c22,_0x2efbd0['idToEmailMap'],_0x2efbd0['connectionIdToNameMap']),_0x717404=activationSignature(_0x8d434c);!_0x27c421[_0x53dcd9(0x169)](_0x717404)&&_0x27c421[_0x53dcd9(0x1a0)](_0x717404,_0x3e4c22['id']),_0x8d434c[_0x53dcd9(0x128)]&&_0x318c17[_0x53dcd9(0x1a0)](_0x8d434c[_0x53dcd9(0x128)],_0x3e4c22['id']);}};await matchExistingJourneySegments(_0x111c63,_0x2cda2d,_0x1bbd6d[_0x1913d9(0x1b2)],_0x2efbd0[_0x1913d9(0x145)],_0x2efbd0[_0x1913d9(0x197)]);const _0x16f058={'resolveSegmentId':async _0x1c50ff=>{const _0x30e0f1=_0x1913d9,_0x3dd77f=_0x2efbd0['segmentNameToId'][_0x30e0f1(0x1bc)](_0x1c50ff);if(!_0x3dd77f)throw new SDKError(ErrorCode[_0x30e0f1(0x12f)],_0x30e0f1(0x196)+_0x1c50ff+'\x20(referenced\x20in\x20journey\x20'+_0x2cda2d[_0x30e0f1(0x20f)][_0x30e0f1(0x128)]+')');return _0x3dd77f;},'resolveEmbeddedSegmentId':async(_0x2b443e,_0x3a89e9)=>{const _0x351c93=_0x1913d9,_0xb508a5=_0x2efbd0[_0x351c93(0x197)]['get'](_0x2b443e);if(_0xb508a5)return _0xb508a5;const _0x4073ce=_0x2efbd0[_0x351c93(0x145)][_0x351c93(0x1e6)](_0x4151f1=>_0x4151f1[_0x351c93(0x128)]===_0x2b443e);if(_0x4073ce)return _0x2efbd0[_0x351c93(0x197)]['set'](_0x2b443e,_0x4073ce['id']),_0x4073ce['id'];if(_0x2cda2d[_0x351c93(0x13a)]){const {stageName:_0x38ee7c,criteriaName:_0x16836a}=findSegmentCriteriaLocation(_0x2cda2d[_0x351c93(0x20f)],_0x2b443e);return _0x34af5d(_0x2b443e,_0x3a89e9['rule']),_0x5e64fd[_0x351c93(0x1a0)](_0x2b443e,{'definition':_0x3a89e9,'stageName':_0x38ee7c,'criteriaName':_0x16836a}),createPendingSegmentId(_0x2b443e);}const _0x472935=_0x2cda2d['existingJourney']?.['id'];if(!_0x472935)throw new SDKError(ErrorCode[_0x351c93(0x1d5)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0xd0e5c2=_0x2bb11c[_0x351c93(0x1bc)](_0x2b443e);if(_0xd0e5c2)return _0xd0e5c2;const _0x8afec1=((async()=>{const _0x424cef=_0x351c93;_0x34af5d(_0x2b443e,_0x3a89e9[_0x424cef(0x154)]);const _0x4aedd3=generateDeterministicJourneySegmentName(_0x2cda2d[_0x424cef(0x20f)][_0x424cef(0x128)],_0x2b443e),_0x4b8c02=_0x2efbd0[_0x424cef(0x145)][_0x424cef(0x1e6)](_0x71dd9d=>_0x71dd9d['name']===_0x4aedd3),_0x1d1c75=createSegmentIdResolver(_0x2efbd0[_0x424cef(0x197)],_0x2b443e),_0x54a51e=await resolveRuleSegmentIds(_0x3a89e9[_0x424cef(0x154)],_0x1d1c75);let _0x454534;return _0x4b8c02?(await _0x111c63[_0x424cef(0x1ef)][_0x424cef(0x1f5)](_0x1bbd6d[_0x424cef(0x1b2)],_0x4b8c02['id'],{'description':_0x3a89e9[_0x424cef(0x151)]||_0x424cef(0x166)+_0x2b443e,'rule':_0x15ae98(_0x54a51e,!![]),'countPopulation':!![]}),_0x454534=_0x4b8c02['id'],saveSegmentToPushRecovery(_0x2cda2d[_0x424cef(0x1f2)],_0x2cda2d['yamlConfig'][_0x424cef(0x128)],_0x2b443e,{'segmentId':_0x454534,'uniqueServerName':_0x4aedd3,'createdAt':new Date()['toISOString']()})):_0x454534=await createOrRecoverEmbeddedSegment(_0x111c63,_0x2cda2d,{'localName':_0x2b443e,'uniqueSegmentName':_0x4aedd3,'description':_0x3a89e9[_0x424cef(0x151)]||_0x424cef(0x166)+_0x2b443e,'journeyId':_0x472935,'resolvedRule':_0x54a51e,'parentId':_0x1bbd6d[_0x424cef(0x1b2)],'folderId':_0x1bbd6d['rootFolderId']||''},_0x15ae98),_0x2efbd0['segmentNameToId'][_0x424cef(0x1a0)](_0x2b443e,_0x454534),_0x401bfa[_0x424cef(0x1a0)](_0x2b443e,_0x454534),_0x454534;})());_0x2bb11c[_0x351c93(0x1a0)](_0x2b443e,_0x8afec1);try{return await _0x8afec1;}finally{_0x2bb11c[_0x351c93(0x141)](_0x2b443e);}},'resolveActivationId':async _0x248c33=>{const _0xcc5c0a=_0x1913d9,_0x491ef8=_0x318c17[_0xcc5c0a(0x1bc)](_0x248c33);if(_0x491ef8)return _0x491ef8;if(_0x2cda2d[_0xcc5c0a(0x1c3)]){await _0x5192b5();const _0x4bc6fc=_0x318c17[_0xcc5c0a(0x1bc)](_0x248c33);if(_0x4bc6fc)return _0x4bc6fc;}throw new SDKError(ErrorCode[_0xcc5c0a(0x1be)],_0xcc5c0a(0x148)+_0x248c33+_0xcc5c0a(0x1d6)+_0x2cda2d[_0xcc5c0a(0x20f)][_0xcc5c0a(0x128)]+_0xcc5c0a(0x139)+_0xcc5c0a(0x1b1));},'resolveEmbeddedActivationId':async(_0x2344f4,_0xee7a7a)=>{const _0x2a2727=_0x1913d9,_0x4967ec=_0x318c17[_0x2a2727(0x1bc)](_0x2344f4);if(_0x4967ec)return _0x4967ec;if(_0x2cda2d[_0x2a2727(0x13a)])return _0x39c00b[_0x2a2727(0x1a0)](_0x2344f4,_0xee7a7a),createPendingActivationId(_0x2344f4);if(_0x2cda2d[_0x2a2727(0x1c3)]){await _0x5192b5();const _0x4b3985=_0x318c17['get'](_0xee7a7a[_0x2a2727(0x128)]);if(_0x4b3985)return _0x318c17[_0x2a2727(0x1a0)](_0x2344f4,_0x4b3985),_0x4b3985;const _0x40731f=activationSignature(_0xee7a7a),_0x1c86a2=_0x27c421?.[_0x2a2727(0x1bc)](_0x40731f);if(_0x1c86a2)return _0x318c17[_0x2a2727(0x1a0)](_0x2344f4,_0x1c86a2),_0x1c86a2;const _0x4c2f9d=await _0x22585a(_0xee7a7a,_0x2efbd0[_0x2a2727(0x20a)]),_0x252576={..._0x4c2f9d,..._0xee7a7a[_0x2a2727(0x20d)]!==undefined&&{'runAfterJourneyRefresh':_0xee7a7a['run_after_journey_refresh']}},_0x15c716=await _0x111c63[_0x2a2727(0x1a8)][_0x2a2727(0x12e)](_0x2cda2d[_0x2a2727(0x1c3)]['id'],_0x252576);return _0x318c17[_0x2a2727(0x1a0)](_0x2344f4,_0x15c716['id']),_0x15c716['id'];}throw new SDKError(ErrorCode[_0x2a2727(0x1d5)],_0x2a2727(0x188));},'resolveJourneyId':async _0x1bcf2f=>{const _0x53ff6f=_0x1913d9;try{return await _0x111c63[_0x53ff6f(0x1a8)][_0x53ff6f(0x13b)](_0x1bbd6d[_0x53ff6f(0x1b2)],_0x1bcf2f);}catch(_0x3ca0da){throw new SDKError(ErrorCode[_0x53ff6f(0x1be)],_0x53ff6f(0x200)+_0x1bcf2f+_0x53ff6f(0x1fb)+_0x2cda2d[_0x53ff6f(0x20f)][_0x53ff6f(0x128)]+'\x27)',_0x3ca0da);}},'resolveStageId':async(_0x225774,_0x56d4ad)=>{const _0x5167e0=_0x1913d9,_0x172c32=await _0x111c63[_0x5167e0(0x1a8)][_0x5167e0(0x217)](_0x225774),_0x19628c=_0x172c32['attributes']['journeyStages'][_0x5167e0(0x1e6)](_0x4a5ac7=>_0x4a5ac7[_0x5167e0(0x128)][_0x5167e0(0x211)]()===_0x56d4ad[_0x5167e0(0x211)]());if(!_0x19628c?.['id'])throw new SDKError(ErrorCode[_0x5167e0(0x1be)],_0x5167e0(0x1e7)+_0x56d4ad+_0x5167e0(0x1e0)+(_0x172c32['attributes'][_0x5167e0(0x170)]||_0x172c32[_0x5167e0(0x16e)][_0x5167e0(0x128)])+'\x27');return _0x19628c['id'];}},_0x5d605a=await _0x117e94(_0x2cda2d[_0x1913d9(0x20f)],_0x1bbd6d['parentId'],_0x16f058),_0x37b5a4=_0x1bbd6d[_0x1913d9(0x18f)]||_0x1bbd6d[_0x1913d9(0x16f)];_0x37b5a4&&(_0x5d605a[_0x1913d9(0x143)]={'parentFolder':{'data':{'id':_0x37b5a4,'type':_0x1913d9(0x147)}}});if(_0x2cda2d[_0x1913d9(0x13a)]){if(_0x5e64fd[_0x1913d9(0x1e3)]>0x0||_0x39c00b[_0x1913d9(0x1e3)]>0x0)return await executeThreeStepJourneyCreate(_0x111c63,_0x2cda2d,_0x5d605a,{'pendingEmbeddedSegments':_0x5e64fd,'pendingEmbeddedActivations':_0x39c00b,'embeddedSegmentNameToId':_0x401bfa,'journeyActivationNameToId':_0x318c17},{..._0x1bbd6d,'effectiveFolderId':_0x37b5a4},_0x2efbd0,_0x251bce,_0x373145);else{ensureJourneyDefaults(_0x5d605a[_0x1913d9(0x16e)]);const _0x13e8f8=await _0x111c63[_0x1913d9(0x1a8)]['create'](_0x5d605a);return deletePushRecovery(_0x2cda2d['absolutePath']),{'action':_0x1913d9(0x1f1),'journeyId':_0x13e8f8['id'],'embeddedSegmentNameToId':_0x401bfa};}}else{if(_0x2cda2d[_0x1913d9(0x15b)]&&_0x2cda2d[_0x1913d9(0x1c3)]){_0x5d605a['id']=_0x2cda2d[_0x1913d9(0x1c3)]['id'];const _0x434d35=_0x5d605a[_0x1913d9(0x16e)];_0x2cda2d[_0x1913d9(0x1c3)][_0x1913d9(0x16e)]?.[_0x1913d9(0x170)]&&(_0x434d35[_0x1913d9(0x170)]=_0x2cda2d['existingJourney'][_0x1913d9(0x16e)][_0x1913d9(0x170)]);const _0x583537=_0x2cda2d[_0x1913d9(0x1c3)]['attributes']?.['journeyStages'];return _0x583537&&_0x5d605a[_0x1913d9(0x16e)]['journeyStages']&&injectExistingStageIds(_0x5d605a[_0x1913d9(0x16e)]['journeyStages'],_0x583537),ensureJourneyDefaults(_0x434d35),await _0x111c63[_0x1913d9(0x1a8)][_0x1913d9(0x1fe)](_0x2cda2d[_0x1913d9(0x1c3)]['id'],_0x5d605a),deletePushRecovery(_0x2cda2d['absolutePath']),{'action':_0x1913d9(0x123),'journeyId':_0x2cda2d[_0x1913d9(0x1c3)]['id'],'embeddedSegmentNameToId':_0x401bfa};}}return deletePushRecovery(_0x2cda2d[_0x1913d9(0x1f2)]),{'action':'unchanged','journeyId':_0x2cda2d[_0x1913d9(0x1c3)]?.['id'],'embeddedSegmentNameToId':_0x401bfa};}function findSegmentCriteriaLocation(_0x45a55c,_0x4b20d7){const _0x294f10=a152_0x57cc,_0x3e4aaa=_0x45a55c['stages']||_0x45a55c[_0x294f10(0x1f3)]?.[0x0]?.[_0x294f10(0x1fc)]||[];let _0x21fa8a='entry',_0x27aa30=_0x4b20d7;const _0x2cdbb4=_0x45a55c['goal']||_0x45a55c[_0x294f10(0x1f3)]?.[0x0]?.['goal'];if(_0x2cdbb4?.[_0x294f10(0x1ef)]===_0x4b20d7)return{'stageName':_0x294f10(0x17c),'criteriaName':_0x2cdbb4[_0x294f10(0x128)]||_0x4b20d7};_0x56e4d9:for(const _0x184b66 of _0x3e4aaa){if(_0x184b66[_0x294f10(0x210)]?.['segment']===_0x4b20d7){_0x21fa8a=_0x184b66[_0x294f10(0x128)],_0x27aa30=_0x184b66[_0x294f10(0x210)][_0x294f10(0x128)]||_0x4b20d7;break;}if(_0x184b66[_0x294f10(0x214)])for(const _0x5823c of _0x184b66['steps']){if(_0x5823c['type']==='decision_point'&&_0x5823c[_0x294f10(0x14b)]?.['branches'])for(const _0x361d76 of _0x5823c[_0x294f10(0x14b)][_0x294f10(0x187)]){if(_0x361d76[_0x294f10(0x1ef)]===_0x4b20d7){_0x21fa8a=_0x184b66[_0x294f10(0x128)],_0x27aa30=_0x361d76[_0x294f10(0x128)]||_0x4b20d7;break _0x56e4d9;}}}}return{'stageName':_0x21fa8a,'criteriaName':_0x27aa30};}async function executeThreeStepJourneyCreate(_0x5afab1,_0x83663f,_0x5162d9,_0x4cc330,_0x3cee0c,_0x68a908,_0x18c0e1,_0x373aef){const _0x54b601=a152_0x57cc,{activationDefToCreateRequest:_0x901622,yamlRuleToApi:_0x26c9c1}=_0x373aef,{pendingEmbeddedSegments:_0x1efb74,pendingEmbeddedActivations:_0x2169ee,embeddedSegmentNameToId:_0x4b872b}=_0x4cc330,_0x325d40=JSON[_0x54b601(0x1f9)](JSON[_0x54b601(0x1bb)](_0x5162d9));ensureJourneyDefaults(_0x325d40[_0x54b601(0x16e)]),stripPendingIds(_0x325d40);const _0x2fa8b4=await _0x5afab1[_0x54b601(0x1a8)][_0x54b601(0x1c0)](_0x325d40),_0x20b1bd=_0x2fa8b4['id'],_0x123107=new Map();for(const _0x221fc5 of _0x2fa8b4[_0x54b601(0x16e)][_0x54b601(0x1de)]){_0x123107[_0x54b601(0x1a0)](_0x221fc5[_0x54b601(0x128)][_0x54b601(0x211)](),_0x221fc5['id']);}recoverSegmentIdsFromPushRecovery(_0x83663f,_0x4b872b,_0x68a908['segmentNameToId']);for(const [_0x122c0b,{definition:_0x31029a}]of _0x1efb74){if(_0x4b872b['has'](_0x122c0b)){_0x18c0e1[_0x54b601(0x1cc)]?.({'type':_0x54b601(0x199),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'segmentName':_0x122c0b});continue;}const _0x60c86d=generateDeterministicJourneySegmentName(_0x83663f[_0x54b601(0x20f)]['name'],_0x122c0b);_0x18c0e1[_0x54b601(0x1cc)]?.({'type':'embedded_segment_creating','journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'segmentName':_0x122c0b});const _0x3987a3=createSegmentIdResolver(_0x68a908[_0x54b601(0x197)],_0x122c0b),_0x240bb7=await resolveRuleSegmentIds(_0x31029a['rule'],_0x3987a3),_0x372d94=await createOrRecoverEmbeddedSegment(_0x5afab1,_0x83663f,{'localName':_0x122c0b,'uniqueSegmentName':_0x60c86d,'description':_0x31029a[_0x54b601(0x151)]||_0x54b601(0x166)+_0x122c0b,'journeyId':_0x20b1bd,'resolvedRule':_0x240bb7,'parentId':_0x3cee0c[_0x54b601(0x1b2)],'folderId':_0x3cee0c[_0x54b601(0x218)]||''},_0x26c9c1);_0x4b872b[_0x54b601(0x1a0)](_0x122c0b,_0x372d94),_0x68a908['segmentNameToId'][_0x54b601(0x1a0)](_0x122c0b,_0x372d94),_0x18c0e1['onProgress']?.({'type':_0x54b601(0x199),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'segmentName':_0x122c0b});}const _0x118750=new Map();for(const [_0x509458,_0x2f1b89]of _0x2169ee){_0x18c0e1['onProgress']?.({'type':_0x54b601(0x1df),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'activationName':_0x509458});const _0x368d06=await _0x901622(_0x2f1b89,_0x68a908[_0x54b601(0x20a)]),_0x5c008c={..._0x368d06,..._0x2f1b89[_0x54b601(0x20d)]!==undefined&&{'runAfterJourneyRefresh':_0x2f1b89['run_after_journey_refresh']}},_0x43f19d=await _0x5afab1[_0x54b601(0x1a8)][_0x54b601(0x12e)](_0x20b1bd,_0x5c008c);_0x118750[_0x54b601(0x1a0)](_0x509458,_0x43f19d['id']),_0x4cc330['journeyActivationNameToId'][_0x54b601(0x1a0)](_0x509458,_0x43f19d['id']),_0x18c0e1['onProgress']?.({'type':_0x54b601(0x1eb),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'activationName':_0x509458});}const _0x5aefdb=JSON['parse'](JSON[_0x54b601(0x1bb)](_0x5162d9));return _0x5aefdb['id']=_0x20b1bd,ensureJourneyDefaults(_0x5aefdb[_0x54b601(0x16e)]),resolvePendingIdsInRequest(_0x5aefdb,_0x5162d9,_0x123107,_0x4b872b,_0x118750,_0x18c0e1),await _0x5afab1['journey'][_0x54b601(0x1fe)](_0x20b1bd,_0x5aefdb),deletePushRecovery(_0x83663f[_0x54b601(0x1f2)]),{'action':_0x54b601(0x1f1),'journeyId':_0x20b1bd,'embeddedSegmentNameToId':_0x4b872b};}export function stripWaitStepPendingIds(_0x53c505){const _0x390887=a152_0x57cc,_0x5647ee=_0x53c505[_0x390887(0x175)]&&isPendingSegmentId(_0x53c505['conditionSegmentId']),_0x2f0363=_0x53c505[_0x390887(0x177)]?.[_0x390887(0x16a)](_0x3c2f1b=>_0x3c2f1b[_0x390887(0x1c9)]&&isPendingSegmentId(_0x3c2f1b['segmentId']));(_0x5647ee||_0x2f0363)&&(_0x53c505[_0x390887(0x134)]=_0x390887(0x1c8),_0x53c505[_0x390887(0x152)]=0x1,_0x53c505['waitStepUnit']=_0x390887(0x1e4),delete _0x53c505[_0x390887(0x175)],delete _0x53c505[_0x390887(0x1fa)],delete _0x53c505[_0x390887(0x19d)],delete _0x53c505[_0x390887(0x177)]);}export function resolveWaitStepPendingIds(_0x529a85,_0x24b9ec,_0xbed5b8,_0x2ff9fd){const _0x20cde7=a152_0x57cc;if(_0x24b9ec[_0x20cde7(0x175)]&&isPendingSegmentId(_0x24b9ec['conditionSegmentId'])){const _0x4c8853=_0xbed5b8(_0x24b9ec[_0x20cde7(0x175)],_0x20cde7(0x158)+_0x2ff9fd+_0x20cde7(0x126));_0x4c8853&&(_0x529a85[_0x20cde7(0x134)]=_0x20cde7(0x1da),_0x529a85[_0x20cde7(0x175)]=_0x4c8853,delete _0x529a85[_0x20cde7(0x152)],delete _0x529a85[_0x20cde7(0x1e5)],_0x24b9ec[_0x20cde7(0x1fa)]!==undefined&&(_0x529a85['conditionTimeoutDuration']=_0x24b9ec[_0x20cde7(0x1fa)]),_0x24b9ec[_0x20cde7(0x19d)]&&(_0x529a85['conditionTimeoutUnit']=_0x24b9ec[_0x20cde7(0x19d)]));}if(_0x24b9ec[_0x20cde7(0x177)]){const _0x313df5=_0x24b9ec[_0x20cde7(0x177)][_0x20cde7(0x16a)](_0xe88a20=>_0xe88a20['segmentId']&&isPendingSegmentId(_0xe88a20[_0x20cde7(0x1c9)]));if(_0x313df5){const _0xf43452=_0x24b9ec[_0x20cde7(0x177)][_0x20cde7(0x1dd)](_0x38dac2=>{const _0x1d2ea1=_0x20cde7;if(_0x38dac2[_0x1d2ea1(0x1c9)]&&isPendingSegmentId(_0x38dac2[_0x1d2ea1(0x1c9)])){const _0x4369c8=_0xbed5b8(_0x38dac2['segmentId'],_0x1d2ea1(0x158)+_0x2ff9fd+_0x1d2ea1(0x126));return{..._0x38dac2,'segmentId':_0x4369c8||_0x38dac2[_0x1d2ea1(0x1c9)]};}return{..._0x38dac2};});_0x529a85[_0x20cde7(0x134)]=_0x20cde7(0x1da),_0x529a85[_0x20cde7(0x177)]=_0xf43452,delete _0x529a85[_0x20cde7(0x152)],delete _0x529a85[_0x20cde7(0x1e5)],delete _0x529a85[_0x20cde7(0x175)],delete _0x529a85['conditionTimeoutDuration'],delete _0x529a85[_0x20cde7(0x19d)];}}}function a152_0x1b16(){const _0x304ed8=['resolveJourneyId','validatedRequest','./child-segment-yaml.js','connection','sort','Delete\x20the\x20push\x20recovery\x20file\x20(','delete','createSegment','relationships','data','existingSegments','index','folder','Activation\x20not\x20found:\x20','slice','./journey-yaml.js','with','journeyId','deps','Updated\x20activation\x20\x27','keys','columns','description','waitStep','parseDocument','rule','segments','relative','segment_deleting','stage\x20\x27','utf-8','action','hasChanges','resolveSegment','Updating\x20segment\x20\x27','DecisionPoint','journey_created','Embedded\x20segment\x20\x27','\x27\x20exit\x20criteria','createdSegmentIds','WaitStep','journeyBundleId','exitCriterias','Entry\x20criteria:\x20','getSegmentEntity\x20also\x20failed\x20for\x20','push','has','some','segment_creating','uniqueServerName','../../utils/async.js','attributes','rootFolderId','journeyBundleName','ACTIVATION_UPDATE_ERROR','Segment\x20not\x20found','Matched\x20server\x20segment\x20\x27','activation_','conditionSegmentId','withProgress','conditions','unchanged','journey_updating','\x20error(s)','toISOString','goal',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','connector_config','skipSegments','add','SEGMENT_UPDATE_ERROR','object','\x0a\x20\x20','existingActivation','60646SRzZCU','journey_entry_criteria_','branches','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createJourneySegment','Deleted\x20segment\x20\x27','verbose','\x27\x20to\x20local\x20\x27','\x27...','kind','folderId','logSuccess','match','startsWith','milestone','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','12BhSKCI','Segment\x20not\x20found:\x20','segmentNameToId','logWarning','embedded_segment_created','Failed\x20to\x20','message','segmentFolderId','conditionTimeoutUnit','type','entryCriteria','set','activation_created','Failed\x20to\x20resolve\x20activation\x20','replace','connectionIdToNameMap','deleteSegment','Creating\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','journey','926984TKQVFQ','\x27\x20decision\x20point\x20branch\x20\x27','activation_creating','resolvedRule','6057198vAbyQD','dirname','4857815mWNNPN','Fetching\x20','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','parentId','behavior','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','all_columns','Failed\x20to\x20fetch\x20referenced\x20segment\x20','segmentByFolderAndName','3iGsHSs','Updating\x20activation\x20\x27','stringify','get','folderPath','NOT_FOUND','notification','create','progress','uniqueSegmentName','existingJourney','activation_updating','15384xTjOgx','journeyById','schedule','Duration','segmentId','\x20journey\x20from\x20file:\x20','activation_deleted','onProgress','max','Created\x20folder\x20\x27','segment_updated','segment_deleted','5319FjoAGA','debug','Failed\x20to\x20resolve\x20segment\x20','parentSegmentFolder','INTERNAL','\x20(referenced\x20in\x20journey\x20','length','activationsBySegmentId','14367750ZMUCVZ','Condition','Creating\x20folder\x20\x27','flatMap','map','journeyStages','embedded_activation_creating','\x27\x20not\x20found\x20in\x20journey\x20\x27','draft','results','size','day','waitStepUnit','find','Stage\x20\x27','localName','Created\x20segment\x20\x27','Creating\x20activation\x20\x27','embedded_activation_created','entries','trim','list','segment','journey_updated','created','absolutePath','journeys','createdSegmentId','updateSegmentById','yamlActivation','idToEmailMap','ACTIVATION_SYNTAX_ERROR','parse','conditionTimeoutDuration','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','stages','valid','update','journey_creating','Journey\x20\x27','journeyName','Updated\x20journey\x20\x27','filter','folderPathToId','deleted','toString','item','logDeleted','createFolder','activationContext','journeyBundlesByFolderAndName','values','run_after_journey_refresh','8175846bxYuDB','yamlConfig','entry_criteria','toLowerCase','\x27\x20from\x20file:\x20','activationStepsById','steps','listActivations','existingSegment','getJourney','effectiveFolderId','versionNumber','segment_created','diff','activationActions','split','Created\x20journey\x20\x27','digest','updateActivation','SEGMENT_SYNTAX_ERROR','activations','null','Deleting\x20activation\x20\x27','journeyActivationStepId','updated','embeddedSegmentNameToId','buildUserMaps','\x27\x20wait\x20condition','errors','name','\x20segment\x20from\x20file:\x20','activation_updated','from','all','\x27\x20by\x20rule\x20content','createActivation','SEGMENT_NOT_FOUND','.$1.push-recovery.json','nameToType','includes','reduce','waitStepType','activation_template_id','join','folder_creating','Updated\x20segment\x20\x27',').\x20','isNew'];a152_0x1b16=function(){return _0x304ed8;};return a152_0x1b16();}function stripPendingIds(_0xdf4a43){const _0x1a8980=a152_0x57cc;_0xdf4a43['attributes'][_0x1a8980(0x17c)]?.[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0xdf4a43['attributes'][_0x1a8980(0x17c)][_0x1a8980(0x1c9)])&&delete _0xdf4a43[_0x1a8980(0x16e)]['goal'];for(const _0x49487c of _0xdf4a43[_0x1a8980(0x16e)][_0x1a8980(0x1de)]||[]){_0x49487c[_0x1a8980(0x19f)]?.[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0x49487c[_0x1a8980(0x19f)][_0x1a8980(0x1c9)])&&delete _0x49487c['entryCriteria'];_0x49487c['milestone']?.[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0x49487c[_0x1a8980(0x193)][_0x1a8980(0x1c9)])&&delete _0x49487c['milestone'];_0x49487c[_0x1a8980(0x165)]&&(_0x49487c[_0x1a8980(0x165)]=_0x49487c[_0x1a8980(0x165)]['filter'](_0xa2339a=>!_0xa2339a['segmentId']||!isPendingSegmentId(_0xa2339a['segmentId'])));if(_0x49487c[_0x1a8980(0x214)])for(const _0x4b6291 of Object[_0x1a8980(0x14f)](_0x49487c[_0x1a8980(0x214)])){const _0x1237b1=_0x49487c[_0x1a8980(0x214)][_0x4b6291];_0x1237b1[_0x1a8980(0x19e)]==='Activation'&&_0x1237b1[_0x1a8980(0x225)]&&isPendingActivationId(_0x1237b1[_0x1a8980(0x225)])&&(_0x1237b1[_0x1a8980(0x225)]='');if(_0x1237b1['type']===_0x1a8980(0x15e)&&_0x1237b1[_0x1a8980(0x187)])for(const _0x456d22 of _0x1237b1[_0x1a8980(0x187)]){_0x456d22[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0x456d22[_0x1a8980(0x1c9)])&&(_0x456d22[_0x1a8980(0x1c9)]='');}_0x1237b1['type']==='WaitStep'&&stripWaitStepPendingIds(_0x1237b1);}}}function resolvePendingIdsInRequest(_0x39f97a,_0x54b2bd,_0x50f04d,_0x31aef3,_0x1a6832,_0x502490){const _0x1dbb64=a152_0x57cc,_0x500bc9=(_0x76add9,_0x1a6d9c)=>{const _0x46c316=a152_0x57cc;if(!isPendingSegmentId(_0x76add9))return _0x76add9;const _0x4774e7=extractPendingSegmentName(_0x76add9),_0x4520f=_0x31aef3[_0x46c316(0x1bc)](_0x4774e7);return!_0x4520f&&_0x502490[_0x46c316(0x198)]?.(_0x46c316(0x194)+_0x4774e7+'\x27\x20for\x20'+_0x1a6d9c),_0x4520f;};if(_0x39f97a['attributes'][_0x1dbb64(0x17c)]?.['segmentId']&&isPendingSegmentId(_0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x17c)][_0x1dbb64(0x1c9)])){const _0x1e281a=_0x500bc9(_0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x17c)][_0x1dbb64(0x1c9)],'goal\x20criteria');_0x1e281a&&(_0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x17c)]['segmentId']=_0x1e281a);}for(const _0x2f8a60 of _0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x1de)]||[]){const _0x3f715d=_0x50f04d['get'](_0x2f8a60[_0x1dbb64(0x128)]['toLowerCase']());_0x3f715d&&(_0x2f8a60['id']=_0x3f715d);if(_0x2f8a60['entryCriteria']?.[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x2f8a60[_0x1dbb64(0x19f)][_0x1dbb64(0x1c9)])){const _0x99cccb=_0x500bc9(_0x2f8a60[_0x1dbb64(0x19f)]['segmentId'],'stage\x20\x27'+_0x2f8a60[_0x1dbb64(0x128)]+'\x27\x20entry\x20criteria');_0x99cccb&&(_0x2f8a60[_0x1dbb64(0x19f)][_0x1dbb64(0x1c9)]=_0x99cccb);}if(_0x2f8a60[_0x1dbb64(0x165)])for(const _0x401766 of _0x2f8a60[_0x1dbb64(0x165)]){if(_0x401766[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x401766[_0x1dbb64(0x1c9)])){const _0x11cb67=_0x500bc9(_0x401766[_0x1dbb64(0x1c9)],_0x1dbb64(0x158)+_0x2f8a60[_0x1dbb64(0x128)]+_0x1dbb64(0x161));_0x11cb67&&(_0x401766[_0x1dbb64(0x1c9)]=_0x11cb67);}}if(_0x2f8a60['milestone']?.[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x2f8a60[_0x1dbb64(0x193)]['segmentId'])){const _0x2e7236=_0x500bc9(_0x2f8a60[_0x1dbb64(0x193)][_0x1dbb64(0x1c9)],_0x1dbb64(0x158)+_0x2f8a60[_0x1dbb64(0x128)]+'\x27\x20milestone');_0x2e7236&&(_0x2f8a60['milestone'][_0x1dbb64(0x1c9)]=_0x2e7236);}if(_0x2f8a60[_0x1dbb64(0x214)]){const _0x45b7ba=_0x1565c3=>_0x54b2bd[_0x1dbb64(0x16e)][_0x1dbb64(0x1de)]?.['find'](_0x5227de=>_0x5227de[_0x1dbb64(0x128)]['toLowerCase']()===_0x2f8a60[_0x1dbb64(0x128)][_0x1dbb64(0x211)]())?.[_0x1dbb64(0x214)]?.[_0x1565c3];for(const _0x3ae8ac of Object[_0x1dbb64(0x14f)](_0x2f8a60[_0x1dbb64(0x214)])){const _0x322207=_0x2f8a60[_0x1dbb64(0x214)][_0x3ae8ac],_0x1b238b=_0x45b7ba(_0x3ae8ac);if(_0x322207['type']==='Activation'&&_0x322207['journeyActivationStepId']&&(isPendingActivationId(_0x322207[_0x1dbb64(0x225)])||_0x322207[_0x1dbb64(0x225)]==='')){if(_0x1b238b?.[_0x1dbb64(0x225)]&&isPendingActivationId(_0x1b238b[_0x1dbb64(0x225)])){const _0x410d39=extractPendingActivationName(_0x1b238b[_0x1dbb64(0x225)]),_0x39b510=_0x1a6832[_0x1dbb64(0x1bc)](_0x410d39);_0x39b510&&(_0x322207['journeyActivationStepId']=_0x39b510);}}if(_0x322207['type']===_0x1dbb64(0x15e)&&_0x322207[_0x1dbb64(0x187)]&&_0x1b238b?.[_0x1dbb64(0x187)])for(let _0x439035=0x0;_0x439035<_0x322207['branches']['length'];_0x439035++){const _0x19eca3=_0x322207[_0x1dbb64(0x187)][_0x439035],_0x220544=_0x1b238b[_0x1dbb64(0x187)][_0x439035];if(_0x220544?.[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x220544['segmentId'])){const _0x1d3db9=_0x500bc9(_0x220544[_0x1dbb64(0x1c9)],_0x1dbb64(0x158)+_0x2f8a60[_0x1dbb64(0x128)]+_0x1dbb64(0x1aa)+(_0x19eca3[_0x1dbb64(0x128)]||_0x439035)+'\x27');_0x1d3db9&&(_0x19eca3[_0x1dbb64(0x1c9)]=_0x1d3db9);}}_0x322207[_0x1dbb64(0x19e)]===_0x1dbb64(0x163)&&_0x1b238b?.['type']===_0x1dbb64(0x163)&&resolveWaitStepPendingIds(_0x322207,_0x1b238b,_0x500bc9,_0x2f8a60[_0x1dbb64(0x128)]);}}}}
1
+ const a152_0x59916b=a152_0x54b0;(function(_0x10bf40,_0x5bfdda){const _0x17cb40=a152_0x54b0,_0x2d5e3f=_0x10bf40();while(!![]){try{const _0x1044b0=-parseInt(_0x17cb40(0x212))/0x1*(parseInt(_0x17cb40(0x194))/0x2)+parseInt(_0x17cb40(0x1e3))/0x3+-parseInt(_0x17cb40(0x140))/0x4+-parseInt(_0x17cb40(0x148))/0x5*(-parseInt(_0x17cb40(0x147))/0x6)+-parseInt(_0x17cb40(0x225))/0x7*(-parseInt(_0x17cb40(0x1cb))/0x8)+-parseInt(_0x17cb40(0x15e))/0x9+-parseInt(_0x17cb40(0x1fe))/0xa*(-parseInt(_0x17cb40(0x235))/0xb);if(_0x1044b0===_0x5bfdda)break;else _0x2d5e3f['push'](_0x2d5e3f['shift']());}catch(_0x470ff5){_0x2d5e3f['push'](_0x2d5e3f['shift']());}}}(a152_0x481a,0xc984c));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';function a152_0x54b0(_0x296254,_0x5a0f4d){_0x296254=_0x296254-0x13d;const _0x481afa=a152_0x481a();let _0x54b076=_0x481afa[_0x296254];return _0x54b076;}const logger=Logger['of'](a152_0x59916b(0x1f3));export const PENDING_SEGMENT_PREFIX=a152_0x59916b(0x187);export const PENDING_ACTIVATION_PREFIX=a152_0x59916b(0x207);export function createPendingSegmentId(_0x963781){return''+PENDING_SEGMENT_PREFIX+_0x963781+'__';}export function isPendingSegmentId(_0x3f82cd){const _0x4806ba=a152_0x59916b;return _0x3f82cd[_0x4806ba(0x1d7)](PENDING_SEGMENT_PREFIX)&&!_0x3f82cd[_0x4806ba(0x1d7)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x4a6636){const _0x1a4a84=a152_0x59916b;return _0x4a6636[_0x1a4a84(0x221)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x455824){return''+PENDING_ACTIVATION_PREFIX+_0x455824+'__';}export function isPendingActivationId(_0x317624){const _0x467439=a152_0x59916b;return _0x317624[_0x467439(0x1d7)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x4de3e1){return _0x4de3e1['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x357e78,_0x3d16be){const _0x3aafb7=a152_0x59916b,_0x5449ab=_0x357e78+'::'+(_0x3d16be['trim']()||_0x3aafb7(0x240)),_0xd4ab46=createHash(_0x3aafb7(0x189))[_0x3aafb7(0x1b1)](_0x5449ab)['digest'](_0x3aafb7(0x14a))['slice'](0x0,0xc);return _0x3aafb7(0x238)+_0xd4ab46;}export function ensureJourneyDefaults(_0x459315){const _0x34772d=a152_0x59916b;!_0x459315[_0x34772d(0x1a3)]&&(_0x459315[_0x34772d(0x1a3)]=''),!_0x459315['state']&&(_0x459315[_0x34772d(0x20f)]=_0x34772d(0x14b));}export function injectExistingStageIds(_0x5d830a,_0x37d077){const _0x4d6f57=a152_0x59916b,_0x5ee23b=new Map(_0x37d077['map'](_0x3b3bb7=>[_0x3b3bb7[_0x4d6f57(0x1ce)],_0x3b3bb7['id']]));for(const _0x413767 of _0x5d830a){if(!_0x413767['id']){const _0x458c4c=_0x5ee23b[_0x4d6f57(0x21c)](_0x413767[_0x4d6f57(0x1ce)]);_0x458c4c&&(_0x413767['id']=_0x458c4c);}}}export function resolveTDFolderPath(_0x4fcad8,_0x4c90b8,_0x5e65ab){const _0xa9eccd=a152_0x59916b;if(!_0x4c90b8)return _0x4fcad8;if(_0x4fcad8===_0x5e65ab||_0x4fcad8[_0xa9eccd(0x1d7)](_0x5e65ab+'/'))return _0x4fcad8;return _0x4fcad8?_0x5e65ab+'/'+_0x4fcad8:_0x5e65ab;}export function addFoldersToCreate(_0xa3c18a,_0x3d8fe1,_0x12d163){const _0x149d5c=a152_0x59916b;if(!_0xa3c18a)return;if(_0x3d8fe1[_0x149d5c(0x145)](_0xa3c18a))return;const _0xf14c94=_0xa3c18a[_0x149d5c(0x1e8)]('/');let _0x4b0215='';for(const _0x4023ba of _0xf14c94){_0x4b0215=_0x4b0215?_0x4b0215+'/'+_0x4023ba:_0x4023ba,!_0x3d8fe1[_0x149d5c(0x145)](_0x4b0215)&&_0x12d163[_0x149d5c(0x180)](_0x4b0215);}}export function sortFoldersByDepth(_0x2dcad3){const _0x5dfd5a=a152_0x59916b;return[..._0x2dcad3][_0x5dfd5a(0x1a1)]((_0x29b06f,_0x277b72)=>{const _0xf1eba0=_0x5dfd5a,_0x54c009=(_0x29b06f['match'](/\//g)||[])[_0xf1eba0(0x1fd)],_0xf9fb25=(_0x277b72[_0xf1eba0(0x1fc)](/\//g)||[])[_0xf1eba0(0x1fd)];return _0x54c009-_0xf9fb25;});}import*as a152_0x329c1f from'yaml';import{readFileSync}from'fs';import a152_0x822047 from'path';import{isJourneyDef,parseYamlString as a152_0x73dd06,toYamlString as a152_0x4934de,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(_0x236e6f){const _0x51f1e4=a152_0x59916b;if(Array[_0x51f1e4(0x188)](_0x236e6f))return'['+_0x236e6f[_0x51f1e4(0x1da)](_0x2c108e=>stableStringify(_0x2c108e))['join'](',')+']';if(_0x236e6f&&typeof _0x236e6f===_0x51f1e4(0x20a)){const _0x5ec5d1=_0x236e6f,_0x220b42=Object[_0x51f1e4(0x141)](_0x5ec5d1)[_0x51f1e4(0x1a1)](),_0x1ae193=_0x220b42[_0x51f1e4(0x1da)](_0x554dce=>'\x22'+_0x554dce+'\x22:'+stableStringify(_0x5ec5d1[_0x554dce]));return'{'+_0x1ae193[_0x51f1e4(0x1d3)](',')+'}';}const _0x23d083=JSON[_0x51f1e4(0x18a)](_0x236e6f);return _0x23d083===undefined?_0x51f1e4(0x23c):_0x23d083;}function activationSignature(_0x33266d){const _0x45b8ff=a152_0x59916b,_0x3ecd1c={'connection':_0x33266d['connection'],..._0x33266d[_0x45b8ff(0x144)]!==undefined&&{'all_columns':_0x33266d[_0x45b8ff(0x144)]},..._0x33266d[_0x45b8ff(0x1c4)]!==undefined&&{'columns':_0x33266d[_0x45b8ff(0x1c4)]},..._0x33266d['behavior']!==undefined&&{'behavior':_0x33266d[_0x45b8ff(0x206)]},..._0x33266d[_0x45b8ff(0x14f)]!==undefined&&{'schedule':_0x33266d['schedule']},..._0x33266d['notification']!==undefined&&{'notification':_0x33266d[_0x45b8ff(0x17b)]},..._0x33266d[_0x45b8ff(0x1e1)]!==undefined&&{'connector_config':_0x33266d[_0x45b8ff(0x1e1)]},..._0x33266d[_0x45b8ff(0x1f2)]!==undefined&&{'activation_template_id':_0x33266d['activation_template_id']}};return stableStringify(_0x3ecd1c);}async function fetchSegment(_0xeb70e7,_0x4cbcc0,_0x281e31,_0x5e1659){const _0x107fab=a152_0x59916b,_0x105f19=_0x5e1659?.[_0x107fab(0x16c)](_0xc19c48=>_0xc19c48['id']===_0x281e31);if(_0x105f19)return _0x105f19;try{return await _0xeb70e7[_0x107fab(0x240)][_0x107fab(0x162)](_0x4cbcc0,_0x281e31);}catch(_0x17a173){logger['debug'](_0x107fab(0x218)+_0x281e31+_0x107fab(0x22b)+_0x17a173);try{return await _0xeb70e7[_0x107fab(0x240)][_0x107fab(0x1a8)](_0x281e31);}catch(_0x1f8d88){return logger['debug'](_0x107fab(0x1c9)+_0x281e31+':\x20'+_0x1f8d88),null;}}}function recoverSegmentIdsFromPushRecovery(_0x3d0926,_0x589c5b,_0x182064){const _0x95ec20=a152_0x59916b,_0x4c8d7c=readPushRecovery(_0x3d0926['absolutePath']);if(_0x4c8d7c?.['journeyName']===_0x3d0926[_0x95ec20(0x245)][_0x95ec20(0x1ce)])for(const [_0x56721d,_0x44d65b]of Object[_0x95ec20(0x199)](_0x4c8d7c[_0x95ec20(0x23d)])){const _0x353e56=generateDeterministicJourneySegmentName(_0x3d0926[_0x95ec20(0x245)][_0x95ec20(0x1ce)],_0x56721d);_0x44d65b['uniqueServerName']===_0x353e56&&(_0x589c5b[_0x95ec20(0x172)](_0x56721d,_0x44d65b[_0x95ec20(0x16d)]),_0x182064[_0x95ec20(0x172)](_0x56721d,_0x44d65b[_0x95ec20(0x16d)]));}}async function createOrRecoverEmbeddedSegment(_0x54f43d,_0x313a32,_0x237c26,_0x34e906){const _0x95549=a152_0x59916b;let _0x5dd774;try{_0x5dd774=await _0x54f43d[_0x95549(0x240)][_0x95549(0x1e7)]({'name':_0x237c26[_0x95549(0x1f5)],'description':_0x237c26[_0x95549(0x1a3)],'journeyId':_0x237c26[_0x95549(0x223)],'rule':_0x34e906(_0x237c26[_0x95549(0x1d4)],!![]),'countPopulation':!![],'parentFolderId':_0x237c26[_0x95549(0x169)],'audienceId':_0x237c26[_0x95549(0x1c5)]});}catch(_0x5eedc3){const _0x12b469=_0x5eedc3 instanceof Error&&_0x5eedc3[_0x95549(0x230)][_0x95549(0x1ec)]('Name\x20has\x20already\x20been\x20taken');if(_0x12b469){const _0x39c126=readPushRecovery(_0x313a32[_0x95549(0x202)]),_0x36a52a=_0x39c126?.[_0x95549(0x1fa)]===_0x313a32[_0x95549(0x245)][_0x95549(0x1ce)]?_0x39c126[_0x95549(0x23d)][_0x237c26[_0x95549(0x1c6)]]:undefined;if(_0x36a52a?.[_0x95549(0x15d)]===_0x237c26['uniqueSegmentName'])await _0x54f43d[_0x95549(0x240)]['updateSegmentById'](_0x237c26[_0x95549(0x1c5)],_0x36a52a[_0x95549(0x16d)],{'description':_0x237c26[_0x95549(0x1a3)],'rule':_0x34e906(_0x237c26[_0x95549(0x1d4)],!![]),'countPopulation':!![]}),_0x5dd774=_0x36a52a[_0x95549(0x16d)];else throw new SDKError(ErrorCode[_0x95549(0x1c3)],_0x95549(0x1a9)+_0x237c26[_0x95549(0x1c6)]+_0x95549(0x1a6)+(_0x95549(0x1be)+_0x313a32[_0x95549(0x202)][_0x95549(0x221)](/([^/]+)$/,_0x95549(0x1cd))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x5eedc3);}else throw _0x5eedc3;}return saveSegmentToPushRecovery(_0x313a32[_0x95549(0x202)],_0x313a32[_0x95549(0x245)][_0x95549(0x1ce)],_0x237c26[_0x95549(0x1c6)],{'segmentId':_0x5dd774,'uniqueServerName':_0x237c26['uniqueSegmentName'],'createdAt':new Date()[_0x95549(0x22d)]()}),_0x5dd774;}export async function prepareSegmentFiles(_0x1e6f2e,_0x479c51,_0x1b1c0e,_0x1120d7,_0x3f78d5){const _0x51cd1c=a152_0x59916b,{activationDefToCreateRequest:_0x5957fa}=await import(_0x51cd1c(0x20c)),_0xfbf0a9=[],_0x1184a6=new Set();for(const {yamlConfig:_0x493108,folderPath:_0x1ce061,sourcePath:_0x4d14c3}of _0x1e6f2e){const _0xe33ee6=resolveTDFolderPath(_0x1ce061,_0x1120d7,_0x3f78d5),_0x1abf0f=_0xe33ee6+':'+_0x493108[_0x51cd1c(0x1ce)],_0x433b5a=_0x479c51[_0x51cd1c(0x1a0)][_0x51cd1c(0x21c)](_0x1abf0f),_0x4a47ea=_0x433b5a?_0x479c51[_0x51cd1c(0x1db)][_0x51cd1c(0x21c)](_0x433b5a['id'])||[]:[];addFoldersToCreate(_0xe33ee6,_0x479c51[_0x51cd1c(0x1b0)],_0x1184a6);const _0x9b81a=calculateActivationActions(_0x493108[_0x51cd1c(0x1df)]||[],_0x4a47ea,_0x479c51['idToEmailMap'],_0x479c51[_0x51cd1c(0x247)]);for(const _0x538d18 of _0x9b81a){(_0x538d18['type']==='create'||_0x538d18['type']===_0x51cd1c(0x1b1))&&_0x538d18[_0x51cd1c(0x1b4)]&&(_0x538d18[_0x51cd1c(0x152)]=await _0x5957fa(_0x538d18[_0x51cd1c(0x1b4)],_0x1b1c0e));}const _0x48e44e=calculateSegmentDiff(_0x493108,_0x433b5a,_0x4a47ea,_0x479c51['idToEmailMap'],_0x479c51[_0x51cd1c(0x247)]);_0xfbf0a9[_0x51cd1c(0x1ae)]({'relativePath':_0x493108[_0x51cd1c(0x1ce)],'absolutePath':_0x4d14c3,'yamlConfig':_0x493108,'folderPath':_0xe33ee6,'existingSegment':_0x433b5a,'existingActivations':_0x4a47ea,'isNew':_0x48e44e[_0x51cd1c(0x190)],'hasChanges':_0x48e44e[_0x51cd1c(0x1f7)],'diff':_0x48e44e[_0x51cd1c(0x231)],'activationActions':_0x9b81a});}return{'segmentFiles':_0xfbf0a9,'foldersToCreate':_0x1184a6};}export async function prepareJourneyFiles(_0x25738e,_0x2e471d,_0x4245b8,_0xd0790f){const _0xc080cc=a152_0x59916b,_0x5a0999=[],_0x529873=new Set();for(const {yamlConfig:_0x5c9937,folderPath:_0x461e16,sourcePath:_0x443e42}of _0x25738e){const _0x3b8166=resolveTDFolderPath(_0x461e16,_0x4245b8,_0xd0790f),_0x3affbd=_0x3b8166+':'+_0x5c9937['name'],_0x4fa639=_0x2e471d[_0xc080cc(0x219)]['get'](_0x3affbd);let _0x2e82b4,_0x4e3219;if(_0x4fa639&&_0x4fa639[_0xc080cc(0x1fd)]>0x0){const _0x26a312=buildLocalExpandedRuleMappings(_0x5c9937),{createYamlContext:_0x42f116,prefetchJourneySegments:_0x3adc39}=createPushYamlContextForBundle(_0x2e471d[_0xc080cc(0x13d)],_0x2e471d['parentId'],_0x2e471d[_0xc080cc(0x1bf)],_0x26a312,_0x2e471d[_0xc080cc(0x1f1)],_0x2e471d['connectionIdToNameMap'],_0x2e471d[_0xc080cc(0x173)],_0x2e471d[_0xc080cc(0x236)]);await _0x3adc39(_0x4fa639['map'](_0x3611f7=>_0x3611f7['id']));const _0x24d278=await _0x2e471d[_0xc080cc(0x13d)]['journey'][_0xc080cc(0x1b5)](_0x4fa639[0x0]['journeyBundleId']),_0x549b1a=hasMultipleVersions(_0x5c9937),_0x52ac59=async _0x4e907d=>{const _0x6dc397=_0xc080cc,_0x34c1f2=_0x2e471d[_0x6dc397(0x236)]?.[_0x6dc397(0x21c)](_0x4e907d);if(_0x34c1f2)return _0x34c1f2;return _0x2e471d[_0x6dc397(0x217)]({'journeyId':_0x4e907d,'journeyName':_0x5c9937['name'],'isMultiVersion':_0x4fa639['length']>0x1});};if(_0x549b1a&&_0x4fa639[_0xc080cc(0x1fd)]>0x1){const _0x23e502=[];for(const _0x4d4233 of _0x4fa639){const _0x323cad=_0x4d4233[_0xc080cc(0x164)]||0x1;_0x2e471d[_0xc080cc(0x167)]?.[_0xc080cc(0x1b1)](_0xc080cc(0x1b3)+_0x5c9937[_0xc080cc(0x1ce)]+'\x20v'+_0x323cad);const _0x57c3fe=await _0x52ac59(_0x4d4233['id']),_0x138c7b=_0x42f116(_0x4d4233['id']),_0x406397=await journeyResponseToDef(_0x57c3fe,_0x138c7b);_0x23e502[_0xc080cc(0x1ae)]({'item':_0x4d4233,'yaml':_0x406397});}const _0x34be0b=buildLocalRuleToNameMappingFromJourney(_0x5c9937);_0x4e3219=buildMergedJourneyDef(_0x23e502,_0x34be0b,_0x24d278);const _0x33fb31=Math['max'](..._0x23e502[_0xc080cc(0x1da)](_0x299b5a=>_0x299b5a[_0xc080cc(0x1d5)][_0xc080cc(0x164)]||0x0)),_0x1e49b7=_0x4fa639['find'](_0x5dba9f=>(_0x5dba9f['versionNumber']||0x0)===_0x33fb31);_0x1e49b7&&(_0x2e471d['progress']?.[_0xc080cc(0x1b1)](_0xc080cc(0x1b3)+_0x5c9937[_0xc080cc(0x1ce)]+'\x20v'+_0x33fb31),_0x2e82b4=await _0x52ac59(_0x1e49b7['id']));}else{const _0x2532dd=_0x4fa639[_0x4fa639[_0xc080cc(0x1fd)]-0x1];_0x2e471d['progress']?.[_0xc080cc(0x1b1)](_0xc080cc(0x1b3)+_0x5c9937[_0xc080cc(0x1ce)]),_0x2e82b4=await _0x52ac59(_0x2532dd['id']);const _0x89808c=_0x42f116(_0x2532dd['id']),_0x4bc96b=await journeyResponseToDef(_0x2e82b4,_0x89808c),_0x6cff5c=buildLocalRuleToNameMappingFromJourney(_0x5c9937);_0x4e3219=buildMergedJourneyDef([{'item':_0x2532dd,'yaml':_0x4bc96b}],_0x6cff5c,_0x24d278);}}addFoldersToCreate(_0x3b8166,_0x2e471d[_0xc080cc(0x1b0)],_0x529873);const _0x3f1155=calculateJourneyDiff(_0x5c9937,_0x4e3219);_0x5a0999[_0xc080cc(0x1ae)]({'relativePath':_0x5c9937['name'],'absolutePath':_0x443e42,'yamlConfig':_0x5c9937,'folderPath':_0x3b8166,'existingJourney':_0x2e82b4,'isNew':_0x3f1155[_0xc080cc(0x190)],'hasChanges':_0x3f1155['hasChanges'],'diff':_0x3f1155[_0xc080cc(0x231)]});}return{'journeyFiles':_0x5a0999,'foldersToCreate':_0x529873};}export function calculateActivationActions(_0x1ecfd0,_0x2dde2a,_0x435a58,_0x31d94c){const _0x5ddca7=a152_0x59916b,_0x3592f9=[],_0x2437a8=new Map();for(const _0x19fe37 of _0x2dde2a){_0x2437a8[_0x5ddca7(0x172)](_0x19fe37[_0x5ddca7(0x1ce)],_0x19fe37);}const _0x2142bb=new Map();for(const _0x48ce1b of _0x1ecfd0){_0x2142bb['set'](_0x48ce1b[_0x5ddca7(0x1ce)],_0x48ce1b);}for(const _0x4e7e4a of _0x1ecfd0){const _0x696f50=_0x2437a8[_0x5ddca7(0x21c)](_0x4e7e4a['name']);if(!_0x696f50)_0x3592f9['push']({'type':'create','name':_0x4e7e4a[_0x5ddca7(0x1ce)],'yamlActivation':_0x4e7e4a});else{const _0x2c7c98=activationResponseToDef(_0x696f50,_0x435a58,_0x31d94c),_0x201451=a152_0x329c1f[_0x5ddca7(0x18a)](_0x2c7c98),_0x41a8f7=a152_0x329c1f['stringify'](_0x4e7e4a);_0x201451!==_0x41a8f7&&_0x3592f9[_0x5ddca7(0x1ae)]({'type':_0x5ddca7(0x1b1),'name':_0x4e7e4a['name'],'yamlActivation':_0x4e7e4a,'existingActivation':_0x696f50});}}for(const _0x399795 of _0x2dde2a){!_0x2142bb['has'](_0x399795[_0x5ddca7(0x1ce)])&&_0x3592f9[_0x5ddca7(0x1ae)]({'type':_0x5ddca7(0x193),'name':_0x399795[_0x5ddca7(0x1ce)],'existingActivation':_0x399795});}return _0x3592f9;}function calculateYamlDiff(_0x594cd9,_0x168954){if(_0x168954){const _0x5ea57a=generateDiff(_0x168954,_0x594cd9),_0x567ad2=hasChanges(_0x5ea57a);return{'isNew':![],'hasChanges':_0x567ad2,'diff':_0x567ad2?formatDiffWithColors(_0x5ea57a):undefined};}const _0x597aab=generateDiff('',_0x594cd9);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x597aab)};}export function calculateSegmentDiff(_0x276817,_0x3b1331,_0x336db0,_0x3b5eba,_0x40ab1b){const _0x4fa3f7=segmentToYamlString(_0x276817),_0x44e4cb=_0x3b1331?segmentToYamlString(segmentWithActivationsToYaml(_0x3b1331,_0x336db0,undefined,_0x3b5eba,_0x40ab1b)):undefined;return calculateYamlDiff(_0x4fa3f7,_0x44e4cb);}export function calculateJourneyDiff(_0x1933d3,_0x8694b9){const _0x4c86b8=normalizeJourneyDef(_0x1933d3,_0x1933d3),_0x4c8f26=a152_0x4934de(_0x4c86b8),_0x57e608=_0x8694b9?a152_0x4934de(normalizeJourneyDef(_0x8694b9,_0x1933d3)):undefined;return calculateYamlDiff(_0x4c8f26,_0x57e608);}export function findSegmentsToDelete(_0x557888,_0x3bfdcb,_0x156c30,_0xe710fd,_0x55cac8){const _0x1e609e=a152_0x59916b,_0x561717=new Set();for(const {yamlConfig:_0x5a5978,folderPath:_0x5c4061}of _0x3bfdcb){_0x561717[_0x1e609e(0x180)](_0x5c4061+':'+_0x5a5978[_0x1e609e(0x1ce)]);}return _0x557888['filter'](_0x1fd4c3=>{const _0x5b2c54=_0x1e609e,_0xfbf8cd=_0x1fd4c3['segmentFolderId']?_0x156c30['get'](_0x1fd4c3[_0x5b2c54(0x228)]['toString']())||'':'',_0x179d21=_0xfbf8cd+':'+_0x1fd4c3[_0x5b2c54(0x1ce)];if(_0x561717[_0x5b2c54(0x145)](_0x179d21))return![];if(_0x55cac8)return _0xfbf8cd===_0xe710fd||_0xfbf8cd[_0x5b2c54(0x1d7)](_0xe710fd+'/');return!![];});}function a152_0x481a(){const _0x1d54de=['valid','Updated\x20journey\x20\x27','Delete\x20the\x20push\x20recovery\x20file\x20(','existingSegments','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','parseDocument','embedded_segment_creating','SEGMENT_UPDATE_ERROR','columns','parentId','localName','deleted','values','getSegmentEntity\x20also\x20failed\x20for\x20','journeyStages','568jfGZHd','ACTIVATION_UPDATE_ERROR','.$1.push-recovery.json','name','Duration','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','toLowerCase','Failed\x20to\x20fetch\x20referenced\x20segment\x20','join','resolvedRule','item','\x27\x20wait\x20condition','startsWith','updateActivation','slice','map','activationsBySegmentId','created','segment_creating','WaitStep','activations','\x27\x20to\x20local\x20\x27','connector_config','INTERNAL','2300838YiZiHY','rootFolderId','journeyActivationStepId','logSuccess','createJourneySegment','split','waitStepType','createFolder','embeddedSegmentNameToId','includes','conditions','listActivations','relationships','existingJourney','idToEmailMap','activation_template_id','tdx.sdk.push-workflow','deleteActivation','uniqueSegmentName','existingSegment','hasChanges','Entry\x20criteria:\x20','stage\x20\x27','journeyName','segment_created','match','length','326310FIuOwH','size','createdSegmentIds','journey_creating','absolutePath','conditionTimeoutUnit','max','waitStepUnit','behavior','__pending_act_','connection','Segment\x20not\x20found','object','entry_criteria','./child-segment-yaml.js','segmentNameToId','\x20segment\x20from\x20file:\x20','state','branches','attributes','1510009TnKhov','Segment\x20not\x20found:\x20','activation_deleting','journeyActivationNameToId','type','fetchJourney','getSegment\x20failed\x20for\x20','journeyBundlesByFolderAndName','effectiveFolderId','activation_updated','get','conditionSegmentId','reduce',').\x20','idToName','replace','Created\x20activation\x20\x27','journeyId','onProgress','59395dAudvf','):\x20','goal','segmentFolderId','getJourney','journey_created',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','\x27\x20milestone','toISOString','deleteSegment','parentSegmentFolder','message','diff','journeys','entryCriteria','journey_updating','902hgrLpx','journeyById','embedded_activation_created','journey_entry_criteria_','\x27\x20not\x20found\x20in\x20journey\x20\x27','Activation','toString','null','segments','withProgress','resolveJourneyId','segment','create','activationActions','Condition','activation_updating','yamlConfig','list','connectionIdToNameMap','deps','journey','./journey-yaml.js','3055188PYayqo','keys','\x27\x20from\x20file:\x20','createActivation','all_columns','has','from','18HhrqJY','1035805NRELxS','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','hex','draft','parse','activation_','folderPath','schedule','Updated\x20activation\x20\x27','folder_created','validatedRequest','all','Failed\x20to\x20resolve\x20segment\x20','with','getActivation','\x27\x20decision\x20point\x20branch\x20\x27','../../utils/async.js','buildUserMaps','relative','DecisionPoint','journeyBundleName','uniqueServerName','14106420JnbmCO','NOT_FOUND','journey_updated','createdSegmentId','getSegment','Updating\x20segment\x20\x27','versionNumber','ACTIVATION_SYNTAX_ERROR','resolveSegment','progress','dirname','folderId','logWarning','logDeleted','find','segmentId','entry','day','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','exitCriterias','set','activationStepsById','folder_creating','\x27\x20exit\x20criteria','rule','\x20(referenced\x20in\x20journey\x20','segment_deleting','run_after_journey_refresh','\x27\x20by\x20rule\x20content','notification','updated','waitStep','segment_updating','\x20activation\x20\x27','add','unchanged','Deleting\x20activation\x20\x27','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20','logInfo','debug','__pending_','isArray','sha1','stringify','Journey\x20\x27','Created\x20segment\x20\x27','steps','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','decision_point','isNew','kind','some','delete','2QTRNoq','verbose','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','filter','Activation\x20not\x20found:\x20','entries','folder','JOURNEY_SYNTAX_ERROR','milestone','conditionTimeoutDuration','Stage\x20\x27','utf-8','segmentByFolderAndName','sort','\x27\x20entry\x20criteria','description','index','segment_updated','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','embedded_segment_created','getSegmentEntity','Embedded\x20segment\x20\x27','\x27...','\x0a\x20\x20','\x27\x20for\x20','updateSegmentById','push','existingActivation','folderPathToId','update','skipSegments','Fetching\x20','yamlActivation','getLatestJourneyId','data','action','activationContext','segment_deleted','stages','Deleted\x20activation\x20\x27'];a152_0x481a=function(){return _0x1d54de;};return a152_0x481a();}export function findJourneysToDelete(_0x2e5aa4,_0x18b731,_0x5e2379,_0x10dc21,_0x5c433c){const _0xf9fcaa=a152_0x59916b,_0x415253=new Set();for(const {yamlConfig:_0x1d612a,folderPath:_0x3dc2b6}of _0x18b731){_0x415253[_0xf9fcaa(0x180)](_0x3dc2b6+':'+_0x1d612a[_0xf9fcaa(0x1ce)]);}return _0x2e5aa4[_0xf9fcaa(0x197)](_0xeaceff=>{const _0x3e877a=_0xf9fcaa,_0x5a6098=_0xeaceff[_0x3e877a(0x169)]?_0x5e2379['get'](_0xeaceff[_0x3e877a(0x169)])||'':'',_0x115910=_0x5a6098+':'+_0xeaceff['journeyBundleName'];if(_0x415253[_0x3e877a(0x145)](_0x115910))return![];if(_0x5c433c)return _0x5a6098===_0x10dc21||_0x5a6098[_0x3e877a(0x1d7)](_0x10dc21+'/');return!![];});}export function buildSegmentLookupMap(_0x355c1e,_0x4bade7){const _0x5a3789=a152_0x59916b,_0x3d9099=new Map();for(const _0x1ebad8 of _0x355c1e){const _0x583d72=_0x1ebad8['segmentFolderId']?_0x4bade7['get'](_0x1ebad8[_0x5a3789(0x228)][_0x5a3789(0x23b)]())||'':'',_0x49e53d=_0x583d72+':'+_0x1ebad8[_0x5a3789(0x1ce)];_0x3d9099['set'](_0x49e53d,_0x1ebad8);}return _0x3d9099;}export function buildSegmentNameToIdMap(_0x36328a){const _0xe175e4=a152_0x59916b,_0x1fc74b=new Map();for(const _0x251cbe of _0x36328a){_0x1fc74b['set'](_0x251cbe[_0xe175e4(0x1ce)],_0x251cbe['id']);}return _0x1fc74b;}export function buildJourneyBundleLookupMap(_0x46ed9e,_0x483f55){const _0x5043bb=a152_0x59916b,_0x31523a=new Map();for(const _0x1bbe73 of _0x46ed9e){const _0x558b9a=_0x1bbe73[_0x5043bb(0x169)]?_0x483f55['get'](_0x1bbe73[_0x5043bb(0x169)])||'':'',_0x28965d=_0x558b9a+':'+_0x1bbe73[_0x5043bb(0x15c)];!_0x31523a[_0x5043bb(0x145)](_0x28965d)&&_0x31523a[_0x5043bb(0x172)](_0x28965d,[]),_0x31523a[_0x5043bb(0x21c)](_0x28965d)[_0x5043bb(0x1ae)](_0x1bbe73);}for(const _0x2d7c98 of _0x31523a[_0x5043bb(0x1c8)]()){_0x2d7c98[_0x5043bb(0x1a1)]((_0xcf814,_0x48c53c)=>(_0xcf814[_0x5043bb(0x164)]||0x0)-(_0x48c53c[_0x5043bb(0x164)]||0x0));}return _0x31523a;}export function collectFoldersToCreate(_0x21e01b,_0x273089){const _0x403d6e=a152_0x59916b,_0x347999=new Set();for(const _0x5e704b of _0x21e01b){if(!_0x5e704b)continue;if(_0x273089['has'](_0x5e704b))continue;const _0x29b81d=_0x5e704b[_0x403d6e(0x1e8)]('/');let _0x556726='';for(const _0x13883f of _0x29b81d){_0x556726=_0x556726?_0x556726+'/'+_0x13883f:_0x13883f,!_0x273089[_0x403d6e(0x145)](_0x556726)&&_0x347999[_0x403d6e(0x180)](_0x556726);}}return _0x347999;}export function parseAndClassifyYamlFiles(_0x5621ab,_0xa6b5d5,_0x789ab0){const _0x1ccd8f=a152_0x59916b,_0x2280b8=[],_0x38e218=[];for(const _0x4443e8 of _0x5621ab){const _0x5ca330=a152_0x822047['relative'](_0xa6b5d5,a152_0x822047[_0x1ccd8f(0x168)](_0x4443e8)),_0x18ea99=_0x5ca330==='.'?'':_0x5ca330,_0x4b9e96=readFileSync(_0x4443e8,_0x1ccd8f(0x19f)),_0x314467=a152_0x329c1f[_0x1ccd8f(0x14c)](_0x4b9e96);if(isJourneyDef(_0x314467)){const _0x22b732=a152_0x73dd06(_0x4b9e96);_0x38e218[_0x1ccd8f(0x1ae)]({'yamlConfig':_0x22b732,'folderPath':_0x18ea99,'sourcePath':_0x4443e8});}else{if(!_0x789ab0?.[_0x1ccd8f(0x1b2)]){const _0x18003f=parseSegmentYamlFile(_0x4b9e96),_0x24b919=normalizeChildSegmentYaml(_0x18003f);_0x2280b8[_0x1ccd8f(0x1ae)]({'yamlConfig':_0x24b919,'folderPath':_0x18ea99,'sourcePath':_0x4443e8});}}}return{'segments':_0x2280b8,'journeys':_0x38e218};}export function validateParsedFiles(_0x35c275,_0x2953af){const _0x376375=a152_0x59916b,_0x4e388b=[];for(const {yamlConfig:_0x50cb93,sourcePath:_0x275881}of _0x35c275[_0x376375(0x23d)]){const _0x296cb3=readFileSync(_0x275881,_0x376375(0x19f)),_0x258995=a152_0x329c1f['parseDocument'](_0x296cb3),_0x526ca5=validateSegmentDef(_0x50cb93,{'source':_0x296cb3,'document':_0x258995},{'skipSchema':!![]});if(!_0x526ca5[_0x376375(0x1bc)]){const _0x5b183e=a152_0x822047[_0x376375(0x15a)](_0x2953af,_0x275881);_0x4e388b[_0x376375(0x1ae)]({'filePath':_0x5b183e,'source':_0x296cb3,'result':_0x526ca5,'isJourney':![]});}}for(const {yamlConfig:_0x2404f5,sourcePath:_0x2b9893}of _0x35c275[_0x376375(0x232)]){const _0x355dce=readFileSync(_0x2b9893,_0x376375(0x19f)),_0x28b886=a152_0x329c1f[_0x376375(0x1c1)](_0x355dce),_0x2a3bc3=validateJourneyDef(_0x2404f5,{'source':_0x355dce,'document':_0x28b886},{'skipSchema':!![]});if(!_0x2a3bc3[_0x376375(0x1bc)]){const _0x2dc417=a152_0x822047[_0x376375(0x15a)](_0x2953af,_0x2b9893);_0x4e388b[_0x376375(0x1ae)]({'filePath':_0x2dc417,'source':_0x355dce,'result':_0x2a3bc3,'isJourney':!![]});}}return _0x4e388b;}export function formatValidationErrors(_0x57ea24){const _0x1607f4=a152_0x59916b,_0x1f35e9=[];for(const {filePath:_0x1efe27,source:_0x40d57c,result:_0x136d68,isJourney:_0x54bd2c}of _0x57ea24){const _0x2fb4f2=_0x54bd2c?'journey':_0x1607f4(0x240);_0x1f35e9[_0x1607f4(0x1ae)]('\x0a'+_0x1efe27+'\x20('+_0x2fb4f2+_0x1607f4(0x226)+_0x136d68['errors'][_0x1607f4(0x1fd)]+'\x20error(s)'),_0x1f35e9[_0x1607f4(0x1ae)](formatValidationResult(_0x136d68,_0x40d57c,_0x1efe27));}return _0x1f35e9[_0x1607f4(0x1d3)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x4fa36d){const _0x2212b8=a152_0x59916b,_0x222537=new Set(),_0x305b93=new Map(),_0x5dbd86=collectSegmentUsageCounts(_0x4fa36d);if(_0x4fa36d[_0x2212b8(0x23d)])for(const [_0x29e06d,_0x27430e]of Object[_0x2212b8(0x199)](_0x4fa36d[_0x2212b8(0x23d)])){_0x222537['add'](_0x29e06d);if(_0x27430e[_0x2212b8(0x176)]){const _0x1a4229=yamlRuleToApi(_0x27430e[_0x2212b8(0x176)]),_0x2a5b38=apiRuleToYaml(_0x1a4229);_0x305b93[_0x2212b8(0x172)](_0x29e06d,_0x2a5b38);}}const _0x70eef4=new Map();let _0x53af23=0x0;for(const [_0x27305a,_0x39c0ed]of _0x305b93){const _0x4372a2=serializeExpandedRule(_0x39c0ed,_0x305b93),_0x2671d7=_0x70eef4[_0x2212b8(0x21c)](_0x4372a2)||[];_0x2671d7[_0x2212b8(0x1ae)]({'name':_0x27305a,'index':_0x53af23}),_0x70eef4[_0x2212b8(0x172)](_0x4372a2,_0x2671d7),_0x53af23++;}const _0x5ba125=new Map();for(const [_0xea3cd4,_0x7b70ac]of _0x70eef4){const _0x115c08=_0x7b70ac[_0x2212b8(0x1d9)]()[_0x2212b8(0x1a1)]((_0x278699,_0x3e893b)=>{const _0x15912f=_0x2212b8,_0x1d32c4=_0x5dbd86['get'](_0x278699[_0x15912f(0x1ce)])||0x0,_0x3b6f31=_0x5dbd86[_0x15912f(0x21c)](_0x3e893b[_0x15912f(0x1ce)])||0x0;if(_0x1d32c4!==_0x3b6f31)return _0x3b6f31-_0x1d32c4;return _0x278699[_0x15912f(0x1a4)]-_0x3e893b[_0x15912f(0x1a4)];})[_0x2212b8(0x1da)](_0x442572=>_0x442572[_0x2212b8(0x1ce)]),_0x2b04db=[];for(const _0xda22d5 of _0x115c08){const _0x95ea08=_0x5dbd86['get'](_0xda22d5)||0x0,_0x4d2e86=Math[_0x2212b8(0x204)](_0x95ea08,0x1);for(let _0x55ed5e=0x0;_0x55ed5e<_0x4d2e86;_0x55ed5e++){_0x2b04db[_0x2212b8(0x1ae)](_0xda22d5);}}_0x5ba125[_0x2212b8(0x172)](_0xea3cd4,_0x2b04db);}return{'existingLocalSegmentNames':_0x222537,'localSegmentRules':_0x305b93,'localExpandedRuleToNames':_0x5ba125};}export function createSegmentIdResolver(_0x3e6707,_0x407dbd){return async _0xfa3dc8=>{const _0x16bf08=a152_0x54b0,_0x125bb4=_0x3e6707[_0x16bf08(0x21c)](_0xfa3dc8);if(!_0x125bb4)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x16bf08(0x213)+_0xfa3dc8+_0x16bf08(0x149)+_0x407dbd+'\x27)');return _0x125bb4;};}export function extractRootFolderId(_0xeec8f3){const _0x2a71ba=a152_0x59916b;return _0xeec8f3[_0x2a71ba(0x1ef)]?.[_0x2a71ba(0x22f)]?.[_0x2a71ba(0x1b6)]?.['id']||_0xeec8f3[_0x2a71ba(0x1ef)]?.['parentFolder']?.[_0x2a71ba(0x1b6)]?.['id'];}export function buildConnectionMaps(_0x492530){const _0x49377d=a152_0x59916b,_0x2a3b25=new Map(),_0x1880e7=new Map(),_0x5da601=new Map();for(const _0x27426f of _0x492530){_0x2a3b25[_0x49377d(0x172)](_0x27426f[_0x49377d(0x1ce)],parseInt(_0x27426f['id'],0xa)),_0x1880e7[_0x49377d(0x172)](_0x27426f['id'],_0x27426f['name']),_0x5da601['set'](_0x27426f['name'],_0x27426f[_0x49377d(0x216)]);}return{'nameToId':_0x2a3b25,'idToName':_0x1880e7,'nameToType':_0x5da601};}export function calculatePushStats(_0x40feca,_0x1b94a3,_0x2b8fbd,_0x57a439,_0x33374c,_0x44cfd7,_0x20b05e){const _0x3f7a34=a152_0x59916b,_0x164c3c=_0x40feca[_0x3f7a34(0x197)](_0xcd86e5=>_0xcd86e5['isNew']),_0x5cd377=_0x40feca[_0x3f7a34(0x197)](_0x340123=>!_0x340123[_0x3f7a34(0x190)]&&_0x340123[_0x3f7a34(0x1f7)]),_0x18b76d=_0x40feca[_0x3f7a34(0x197)](_0x46dc6d=>!_0x46dc6d[_0x3f7a34(0x190)]&&!_0x46dc6d['hasChanges']),_0x454394=_0x44cfd7?_0x57a439:[],_0x1f0ef2=_0x1b94a3['filter'](_0x2238b4=>_0x2238b4[_0x3f7a34(0x190)]),_0x592e26=_0x1b94a3[_0x3f7a34(0x197)](_0x13b137=>!_0x13b137[_0x3f7a34(0x190)]&&_0x13b137[_0x3f7a34(0x1f7)]),_0x1b1539=_0x1b94a3[_0x3f7a34(0x197)](_0x5f4333=>!_0x5f4333['isNew']&&!_0x5f4333[_0x3f7a34(0x1f7)]),_0x2bb857=_0x44cfd7?_0x33374c:[],_0x48771f=_0x40feca['flatMap'](_0xf4c441=>_0xf4c441[_0x3f7a34(0x242)]),_0x4210af=_0x48771f[_0x3f7a34(0x197)](_0x459745=>_0x459745[_0x3f7a34(0x216)]===_0x3f7a34(0x241)),_0xc6fc33=_0x48771f[_0x3f7a34(0x197)](_0x605ee5=>_0x605ee5[_0x3f7a34(0x216)]===_0x3f7a34(0x1b1)),_0x335604=_0x48771f['filter'](_0x52f8cc=>_0x52f8cc[_0x3f7a34(0x216)]===_0x3f7a34(0x193)),_0x543561=Array[_0x3f7a34(0x146)](_0x2b8fbd)[_0x3f7a34(0x1a1)](),_0x1b40db=_0x20b05e?![]:_0x164c3c[_0x3f7a34(0x1fd)]>0x0||_0x5cd377[_0x3f7a34(0x1fd)]>0x0||_0x454394[_0x3f7a34(0x1fd)]>0x0,_0x356425=_0x1f0ef2['length']>0x0||_0x592e26['length']>0x0||_0x2bb857[_0x3f7a34(0x1fd)]>0x0,_0x4f7b99=_0x20b05e?![]:_0x48771f['length']>0x0,_0x2350f1=_0x543561[_0x3f7a34(0x1fd)]>0x0;return{'segments':{'new':_0x164c3c,'changed':_0x5cd377,'unchanged':_0x18b76d,'toDelete':_0x454394},'journeys':{'new':_0x1f0ef2,'changed':_0x592e26,'unchanged':_0x1b1539,'toDelete':_0x2bb857},'activations':{'all':_0x48771f,'toCreate':_0x4210af,'toUpdate':_0xc6fc33,'toDelete':_0x335604},'folders':{'toCreate':_0x543561},'counts':{'segments':{'new':_0x164c3c[_0x3f7a34(0x1fd)],'changed':_0x5cd377[_0x3f7a34(0x1fd)],'unchanged':_0x18b76d[_0x3f7a34(0x1fd)],'toDelete':_0x454394['length']},'journeys':{'new':_0x1f0ef2[_0x3f7a34(0x1fd)],'changed':_0x592e26[_0x3f7a34(0x1fd)],'unchanged':_0x1b1539[_0x3f7a34(0x1fd)],'toDelete':_0x2bb857[_0x3f7a34(0x1fd)]},'activations':{'create':_0x4210af[_0x3f7a34(0x1fd)],'update':_0xc6fc33['length'],'delete':_0x335604[_0x3f7a34(0x1fd)]},'folders':_0x543561['length']},'hasChanges':_0x1b40db||_0x356425||_0x4f7b99||_0x2350f1};}export async function buildPushExecutionContext(_0x157c19,_0x407489,_0x1dfdcd,_0x58d0ac,_0x52a8cc,_0x50e85d){const _0x4b9d6a=a152_0x59916b,_0x72b821=extractRootFolderId(_0x1dfdcd),{pathToId:_0x274587,idToPath:_0x2f4168}=buildFolderMaps(_0x52a8cc),_0x121a62=buildSegmentNameToIdMap(_0x58d0ac),_0x52255f=new Map(),{batchAsync:_0x3f2276}=await import('../../utils/async.js'),[_0x5d8cad,_0x200f81]=await Promise[_0x4b9d6a(0x153)]([_0x157c19['user'][_0x4b9d6a(0x159)](),_0x157c19[_0x4b9d6a(0x208)][_0x4b9d6a(0x246)](),((async()=>{const _0x404c26=_0x4b9d6a;!_0x50e85d&&_0x58d0ac[_0x404c26(0x1fd)]>0x0&&await _0x3f2276(_0x58d0ac,async _0x2ee4a5=>{const _0x5c5f0c=_0x404c26,_0x4af888=await _0x157c19['segment'][_0x5c5f0c(0x1ee)](_0x407489,_0x2ee4a5['id']);_0x52255f[_0x5c5f0c(0x172)](_0x2ee4a5['id'],_0x4af888);});})())]),{emailToId:_0x53bb70,idToEmail:_0x3aac9d}=_0x5d8cad,_0x2ad7ab=buildConnectionMaps(_0x200f81);return{'rootFolderId':_0x72b821,'folderPathToId':_0x274587,'folderIdToPath':_0x2f4168,'segmentNameToId':_0x121a62,'activationsBySegmentId':_0x52255f,'emailToIdMap':_0x53bb70,'idToEmailMap':_0x3aac9d,'connectionNameToIdMap':_0x2ad7ab['nameToId'],'connectionIdToNameMap':_0x2ad7ab[_0x4b9d6a(0x220)],'connectionNameToTypeMap':_0x2ad7ab['nameToType']};}export function createPushYamlContextForBundle(_0x583450,_0x3206f3,_0xaf91ad,_0x2f188c,_0x444363,_0x797514,_0x419ca5,_0x36c585){const {existingLocalSegmentNames:_0x1cb67f,localExpandedRuleToNames:_0x34b9e8}=_0x2f188c,_0x383f34=new Set(),_0x5c6d44=new Map(),_0x5044fc=new Map(),_0x308c94=new Map(),_0x292d6e=createJumpTargetCache(),_0x2986a4=new Map(),_0x2eea8a=new Map(),_0x386c9b=new Set();let _0x302c75;const _0xd63835=_0x150acf=>{const _0x2fddc7={'resolveSegment':async _0xbf337c=>{const _0x5e90fc=a152_0x54b0,_0x5b7d62=_0x308c94[_0x5e90fc(0x21c)](_0xbf337c);if(_0x5b7d62!==undefined)return{'name':_0x5b7d62,'isJourneyLocal':!![]};try{const _0x5bb411=await fetchSegment(_0x583450,_0x3206f3,_0xbf337c,_0xaf91ad);if(!_0x5bb411)throw new Error(_0x5e90fc(0x209));const _0x4ae411=generateJourneyLocalName(_0x5bb411[_0x5e90fc(0x1ce)]),_0x5e432e=_0x5bb411[_0x5e90fc(0x191)]===SEGMENT_KIND_JOURNEY&&_0x4ae411!==undefined;let _0x2ae1c7=_0x5bb411[_0x5e90fc(0x1ce)],_0x3af4dc;if(_0x5e432e&&_0x5bb411['rule']){const _0x1202b1=apiRuleToYaml(_0x5bb411[_0x5e90fc(0x176)]);_0x2eea8a[_0x5e90fc(0x172)](_0xbf337c,_0x1202b1);const _0x12abf8=async _0x57501c=>{const _0x3f467d=_0x5e90fc,_0x2d7ad9=collectSegmentRefsFromRule(_0x57501c);for(const _0x4ccd92 of _0x2d7ad9){if(!_0x2eea8a[_0x3f467d(0x145)](_0x4ccd92))try{const _0x23cacf=await fetchSegment(_0x583450,_0x3206f3,_0x4ccd92,_0xaf91ad);if(_0x23cacf?.[_0x3f467d(0x176)]){const _0x40d47e=apiRuleToYaml(_0x23cacf[_0x3f467d(0x176)]);_0x2eea8a[_0x3f467d(0x172)](_0x4ccd92,_0x40d47e),await _0x12abf8(_0x40d47e);}}catch(_0x132beb){logger['debug'](_0x3f467d(0x1d2)+_0x4ccd92+':\x20'+_0x132beb);}}};await _0x12abf8(_0x1202b1);const _0x4e2f70=serializeExpandedRule(_0x1202b1,_0x2eea8a),_0x5e32e5=_0x34b9e8[_0x5e90fc(0x21c)](_0x4e2f70);if(_0x5e32e5&&_0x5e32e5[_0x5e90fc(0x1fd)]>0x0){const _0x49178b=_0x5c6d44[_0x5e90fc(0x21c)](_0x4e2f70)||0x0,_0x975881=_0x5e32e5[_0x49178b]||_0x5e32e5[_0x5e32e5['length']-0x1];_0x5c6d44[_0x5e90fc(0x172)](_0x4e2f70,_0x49178b+0x1),_0x2ae1c7=_0x975881,_0x383f34[_0x5e90fc(0x180)](_0x2ae1c7),_0x308c94['set'](_0xbf337c,_0x2ae1c7);const _0x11fa67=await resolveRuleSegmentRefs(_0x1202b1,async _0xfa465d=>{const _0x47b46b=_0x5e90fc,_0x239748=_0x308c94[_0x47b46b(0x21c)](_0xfa465d);if(_0x239748)return _0x239748;const _0x337ae5=await _0x302c75[_0x47b46b(0x166)](_0xfa465d);return _0x337ae5[_0x47b46b(0x1ce)];});_0x3af4dc={'description':_0x5bb411[_0x5e90fc(0x1a3)],'rule':_0x11fa67};}else{const _0x167a7f=_0x2986a4[_0x5e90fc(0x21c)](_0x4e2f70);if(_0x167a7f)_0x2ae1c7=_0x167a7f,_0x308c94[_0x5e90fc(0x172)](_0xbf337c,_0x2ae1c7);else{if(_0x4ae411){let _0x44305b=_0x4ae411,_0x231134=0x2;while(_0x383f34['has'](_0x44305b)||_0x1cb67f['has'](_0x44305b)){_0x44305b=_0x4ae411+'_'+_0x231134,_0x231134++;}_0x383f34[_0x5e90fc(0x180)](_0x44305b),_0x2ae1c7=_0x44305b;}_0x308c94['set'](_0xbf337c,_0x2ae1c7),_0x2986a4[_0x5e90fc(0x172)](_0x4e2f70,_0x2ae1c7);const _0x2b642c=await resolveRuleSegmentRefs(_0x1202b1,async _0x3cd97f=>{const _0x19c6e5=_0x308c94['get'](_0x3cd97f);if(_0x19c6e5)return _0x19c6e5;const _0x472fbf=await _0x302c75['resolveSegment'](_0x3cd97f);return _0x472fbf['name'];});_0x3af4dc={'description':_0x5bb411[_0x5e90fc(0x1a3)],'rule':_0x2b642c};}}}return{'name':_0x2ae1c7,'isJourneyLocal':_0x5e432e,'definition':_0x3af4dc};}catch(_0x1e1d2b){return logger[_0x5e90fc(0x186)](_0x5e90fc(0x154)+_0xbf337c+':\x20'+_0x1e1d2b),{'name':_0xbf337c,'isJourneyLocal':![]};}},'resolveActivation':async _0x407c11=>{const _0x366db3=a152_0x54b0,_0x559c19=_0x5044fc[_0x366db3(0x21c)](_0x407c11);if(_0x559c19!==undefined)return{'name':_0x559c19,'isJourneyLocal':!![]};try{let _0x65358=_0x419ca5?.['get'](_0x407c11);!_0x65358&&(_0x65358=await _0x583450[_0x366db3(0x13e)][_0x366db3(0x156)](_0x150acf,_0x407c11));const _0x32b44a=_0x65358[_0x366db3(0x211)]['activationParams']['name']||_0x407c11,_0x3172be=sanitizeYamlKey(_0x32b44a)||_0x366db3(0x14d)+_0x407c11,_0x5dd6d1=_0x3172be;_0x5044fc[_0x366db3(0x172)](_0x407c11,_0x5dd6d1);const _0x53028c=journeyActivationStepToYaml(_0x65358,_0x444363,_0x797514);return{'name':_0x5dd6d1,'isJourneyLocal':!![],'definition':_0x53028c};}catch(_0x16be4b){return logger[_0x366db3(0x186)]('Failed\x20to\x20resolve\x20activation\x20'+_0x407c11+':\x20'+_0x16be4b),{'name':_0x407c11,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x43015b,_0x48211d)=>resolveJumpTarget(_0x43015b,_0x48211d,_0x292d6e,async _0x1957b5=>{const _0x22720a=a152_0x54b0,_0x4eec75=_0x36c585?.[_0x22720a(0x21c)](_0x1957b5);if(_0x4eec75)return _0x4eec75;return _0x583450[_0x22720a(0x13e)][_0x22720a(0x229)](_0x1957b5);})};return _0x302c75=_0x2fddc7,_0x2fddc7;},_0x1c7190=async _0x4ec62d=>{const _0x4c3ee8=a152_0x54b0,{collectSegmentIdsFromJourneyApi:_0x18b53f}=await import(_0x4c3ee8(0x13f)),{batchAsync:_0x466468}=await import('../../utils/async.js'),_0x217a66=new Set();for(const _0x3bfe7d of _0x4ec62d){let _0x260845=_0x36c585?.[_0x4c3ee8(0x21c)](_0x3bfe7d);!_0x260845&&(_0x260845=await _0x583450[_0x4c3ee8(0x13e)][_0x4c3ee8(0x229)](_0x3bfe7d));const _0x19dd94=_0x18b53f(_0x260845);for(const _0x4a6afb of _0x19dd94){_0x217a66[_0x4c3ee8(0x180)](_0x4a6afb);}}let _0x2cffa1=Array[_0x4c3ee8(0x146)](_0x217a66);while(_0x2cffa1[_0x4c3ee8(0x1fd)]>0x0){const _0xecc5dc=_0x2cffa1['filter'](_0x3b2b15=>!_0x386c9b['has'](_0x3b2b15));if(_0xecc5dc[_0x4c3ee8(0x1fd)]===0x0)break;const _0x2a1471=await _0x466468(_0xecc5dc,async _0x419902=>{const _0x5330c1=_0x4c3ee8;_0x386c9b[_0x5330c1(0x180)](_0x419902);const _0x2c112b=await fetchSegment(_0x583450,_0x3206f3,_0x419902,_0xaf91ad);if(!_0x2c112b)return null;return{'segmentId':_0x419902,'segment':_0x2c112b};},0xa),_0x46cb6c=new Set();for(const _0x4ccdf2 of _0x2a1471){if(!_0x4ccdf2?.[_0x4c3ee8(0x240)]?.[_0x4c3ee8(0x176)])continue;const _0x2dbf11=apiRuleToYaml(_0x4ccdf2['segment'][_0x4c3ee8(0x176)]);_0x2eea8a[_0x4c3ee8(0x172)](_0x4ccdf2[_0x4c3ee8(0x16d)],_0x2dbf11);const _0x5e4ea0=collectSegmentRefsFromRule(_0x2dbf11);for(const _0x67f442 of _0x5e4ea0){!_0x386c9b[_0x4c3ee8(0x145)](_0x67f442)&&_0x46cb6c[_0x4c3ee8(0x180)](_0x67f442);}}_0x2cffa1=Array[_0x4c3ee8(0x146)](_0x46cb6c);}};return{'createYamlContext':_0xd63835,'prefetchJourneySegments':_0x1c7190};}export async function executePushSegments(_0x63d245,_0x4e74dc,_0x17ef44,_0x439987,_0x445ab7){const _0x2f9ad0=a152_0x59916b,{segmentDefToCreateRequest:_0x52ff48,segmentDefToUpdateRequest:_0x4b69d5}=await import('./child-segment-yaml.js'),_0x2bf66b=_0x17ef44['folderPathToId'],_0x416ec5=0x5,_0x43996b=async _0x88eccf=>{const _0x2f6c5d=a152_0x54b0,_0x2156aa=_0x88eccf[_0x2f6c5d(0x14e)]?_0x2bf66b[_0x2f6c5d(0x21c)](_0x88eccf[_0x2f6c5d(0x14e)]):undefined;let _0x4ca952;const _0xc9607d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x11d7c4=_0x88eccf[_0x2f6c5d(0x245)];if(_0x88eccf['yamlConfig']['rule']){const _0x447dd6=createSegmentIdResolver(_0x17ef44[_0x2f6c5d(0x20d)],_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)]),_0x2687ac=await resolveRuleSegmentIds(_0x88eccf['yamlConfig'][_0x2f6c5d(0x176)],_0x447dd6);_0x11d7c4={..._0x88eccf[_0x2f6c5d(0x245)],'rule':_0x2687ac};}try{if(_0x88eccf['isNew']){_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x1dd),'name':_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)]});const _0x485fa1=_0x52ff48(_0x11d7c4,_0x2156aa),_0x4c3abf=await _0x445ab7[_0x2f6c5d(0x23e)]('Creating\x20segment\x20\x27'+_0x88eccf['yamlConfig']['name']+_0x2f6c5d(0x1aa),()=>_0x63d245[_0x2f6c5d(0x240)]['createSegment'](_0x439987[_0x2f6c5d(0x1c5)],_0x485fa1));_0x4ca952=_0x4c3abf['data']['id'],_0x17ef44[_0x2f6c5d(0x20d)]['set'](_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)],_0x4ca952),_0xc9607d[_0x2f6c5d(0x161)]={'name':_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)],'id':_0x4ca952},_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x1fb),'name':_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)],'segmentId':_0x4ca952}),_0x445ab7[_0x2f6c5d(0x1e6)]?.(_0x2f6c5d(0x18c)+_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]+'\x27'),_0xc9607d['created']=0x1;}else{if(_0x88eccf[_0x2f6c5d(0x1f7)]){_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x17e),'name':_0x88eccf[_0x2f6c5d(0x245)]['name']});const _0x1ab5b4=_0x4b69d5(_0x11d7c4);_0x2156aa!==_0x88eccf[_0x2f6c5d(0x1f6)]?.[_0x2f6c5d(0x228)]&&(_0x1ab5b4['segmentFolderId']=_0x2156aa?parseInt(_0x2156aa,0xa):undefined),await _0x445ab7[_0x2f6c5d(0x23e)](_0x2f6c5d(0x163)+_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]+_0x2f6c5d(0x1aa),()=>_0x63d245[_0x2f6c5d(0x240)]['updateSegmentById'](_0x439987[_0x2f6c5d(0x1c5)],_0x88eccf[_0x2f6c5d(0x1f6)]['id'],_0x1ab5b4)),_0x4ca952=_0x88eccf[_0x2f6c5d(0x1f6)]['id'],_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x1a5),'name':_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]}),_0x445ab7[_0x2f6c5d(0x1e6)]?.('Updated\x20segment\x20\x27'+_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)]+'\x27'),_0xc9607d[_0x2f6c5d(0x17c)]=0x1;}else _0x4ca952=_0x88eccf['existingSegment']['id'];}}catch(_0x2f8165){const _0x406cec=isHttp400Error(_0x2f8165),_0x128ae9=_0x406cec?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x2f6c5d(0x1c3)],_0x15cfc1=getErrorMessage(_0x2f8165);throw new SDKError(_0x128ae9,'Failed\x20to\x20'+(_0x88eccf[_0x2f6c5d(0x190)]?_0x2f6c5d(0x241):_0x2f6c5d(0x1b1))+_0x2f6c5d(0x20e)+_0x88eccf[_0x2f6c5d(0x202)]+_0x2f6c5d(0x1ab)+_0x15cfc1,_0x2f8165);}try{const _0x557955=await syncActivationsForSegment(_0x63d245,_0x439987[_0x2f6c5d(0x1c5)],_0x4ca952,_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)],_0x88eccf[_0x2f6c5d(0x242)],_0x445ab7,_0x88eccf[_0x2f6c5d(0x202)]);_0xc9607d[_0x2f6c5d(0x1df)]=_0x557955;}catch(_0xc5f7d4){if(_0xc5f7d4 instanceof SDKError)throw _0xc5f7d4;throw new SDKError(ErrorCode[_0x2f6c5d(0x1cc)],_0x2f6c5d(0x196)+_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]+_0x2f6c5d(0x142)+_0x88eccf[_0x2f6c5d(0x202)]+'\x0a\x20\x20'+getErrorMessage(_0xc5f7d4),_0xc5f7d4);}return _0xc9607d;},_0x5d9334=await batchAsync(_0x4e74dc,_0x43996b,_0x416ec5),_0x5f4bc3={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1a0582 of _0x5d9334){_0x5f4bc3['created']+=_0x1a0582[_0x2f9ad0(0x1dc)],_0x5f4bc3[_0x2f9ad0(0x17c)]+=_0x1a0582[_0x2f9ad0(0x17c)],_0x1a0582[_0x2f9ad0(0x161)]&&_0x5f4bc3[_0x2f9ad0(0x200)][_0x2f9ad0(0x172)](_0x1a0582[_0x2f9ad0(0x161)]['name'],_0x1a0582[_0x2f9ad0(0x161)]['id']),_0x5f4bc3[_0x2f9ad0(0x1df)][_0x2f9ad0(0x1dc)]+=_0x1a0582[_0x2f9ad0(0x1df)][_0x2f9ad0(0x1dc)],_0x5f4bc3[_0x2f9ad0(0x1df)][_0x2f9ad0(0x17c)]+=_0x1a0582[_0x2f9ad0(0x1df)][_0x2f9ad0(0x17c)],_0x5f4bc3[_0x2f9ad0(0x1df)][_0x2f9ad0(0x1c7)]+=_0x1a0582['activations'][_0x2f9ad0(0x1c7)];}return _0x5f4bc3;}async function syncActivationsForSegment(_0x2cefd8,_0xe1c161,_0x4cd661,_0x39ca84,_0x369e83,_0x25a881,_0x359c99){const _0x3562e2=a152_0x59916b,_0xcb1fd8={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xbc1bc4 of _0x369e83){try{if(_0xbc1bc4[_0x3562e2(0x216)]==='create'&&_0xbc1bc4['validatedRequest'])_0x25a881[_0x3562e2(0x224)]?.({'type':'activation_creating','segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),await _0x25a881[_0x3562e2(0x23e)]('Creating\x20activation\x20\x27'+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x1aa),()=>_0x2cefd8[_0x3562e2(0x240)][_0x3562e2(0x143)](_0xe1c161,_0x4cd661,_0xbc1bc4[_0x3562e2(0x152)])),_0x25a881['onProgress']?.({'type':'activation_created','segmentName':_0x39ca84,'activationName':_0xbc1bc4['name']}),_0x25a881['logSuccess']?.(_0x3562e2(0x222)+_0xbc1bc4['name']+'\x27'),_0xcb1fd8[_0x3562e2(0x1dc)]++;else{if(_0xbc1bc4[_0x3562e2(0x216)]===_0x3562e2(0x1b1)&&_0xbc1bc4[_0x3562e2(0x152)]&&_0xbc1bc4['existingActivation'])_0x25a881[_0x3562e2(0x224)]?.({'type':_0x3562e2(0x244),'segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),await _0x25a881['withProgress']('Updating\x20activation\x20\x27'+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x1aa),()=>_0x2cefd8['segment'][_0x3562e2(0x1d8)](_0xe1c161,_0x4cd661,_0xbc1bc4[_0x3562e2(0x1af)]['id'],_0xbc1bc4[_0x3562e2(0x152)])),_0x25a881[_0x3562e2(0x224)]?.({'type':_0x3562e2(0x21b),'segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),_0x25a881['logSuccess']?.(_0x3562e2(0x150)+_0xbc1bc4['name']+'\x27'),_0xcb1fd8['updated']++;else _0xbc1bc4['type']===_0x3562e2(0x193)&&_0xbc1bc4[_0x3562e2(0x1af)]&&(_0x25a881[_0x3562e2(0x224)]?.({'type':_0x3562e2(0x214),'segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),await _0x25a881[_0x3562e2(0x23e)](_0x3562e2(0x182)+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x1aa),()=>_0x2cefd8[_0x3562e2(0x240)][_0x3562e2(0x1f4)](_0xe1c161,_0x4cd661,_0xbc1bc4[_0x3562e2(0x1af)]['id'])),_0x25a881[_0x3562e2(0x224)]?.({'type':'activation_deleted','segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),_0x25a881[_0x3562e2(0x16b)]?.(_0x3562e2(0x1bb)+_0xbc1bc4[_0x3562e2(0x1ce)]+'\x27'),_0xcb1fd8[_0x3562e2(0x1c7)]++);}}catch(_0x4010af){const _0x15bf09=isHttp400Error(_0x4010af),_0xafbbe5=_0x15bf09?ErrorCode[_0x3562e2(0x165)]:ErrorCode[_0x3562e2(0x1cc)],_0x121a92=getErrorMessage(_0x4010af);throw new SDKError(_0xafbbe5,_0x3562e2(0x184)+_0xbc1bc4[_0x3562e2(0x216)]+_0x3562e2(0x17f)+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x142)+_0x359c99+_0x3562e2(0x1ab)+_0x121a92,_0x4010af);}}return _0xcb1fd8;}export async function executePushFolders(_0x3d07a5,_0x327f0d,_0x189ecd,_0xeb48c1,_0x440b1a){const _0x50514a=a152_0x59916b,_0x205fe7=new Map(_0x189ecd),_0x3933b0=sortFoldersByDepth(_0x327f0d);for(const _0x33c87a of _0x3933b0){const _0x508381=_0x33c87a[_0x50514a(0x1e8)]('/'),_0x533c20=_0x508381[_0x508381[_0x50514a(0x1fd)]-0x1],_0x22548f=_0x508381['slice'](0x0,-0x1)['join']('/'),_0x194fd3=_0x205fe7['get'](_0x22548f);_0x440b1a[_0x50514a(0x224)]?.({'type':_0x50514a(0x174),'folder':_0x33c87a});const _0x24283f={'name':_0x533c20,'parentFolderId':_0x194fd3},_0x2aa1c1=await _0x440b1a[_0x50514a(0x23e)]('Creating\x20folder\x20\x27'+_0x33c87a+_0x50514a(0x1aa),()=>_0x3d07a5[_0x50514a(0x240)][_0x50514a(0x1ea)](_0xeb48c1[_0x50514a(0x1c5)],_0x24283f));_0x205fe7[_0x50514a(0x172)](_0x33c87a,_0x2aa1c1['data']['id']),_0x440b1a[_0x50514a(0x224)]?.({'type':_0x50514a(0x151),'folder':_0x33c87a,'folderId':_0x2aa1c1[_0x50514a(0x1b6)]['id']}),_0x440b1a[_0x50514a(0x185)]?.('Created\x20folder\x20\x27'+_0x33c87a+'\x27');}return _0x205fe7;}export async function executePushSegmentDeletions(_0x1068cc,_0x859a7,_0x13ad19){const _0x22f52d=a152_0x59916b;if(_0x859a7[_0x22f52d(0x1fd)]===0x0)return 0x0;const {batchAsync:_0x3f3164}=await import(_0x22f52d(0x158)),_0x2436a4=0x5,_0x39f5d8=await _0x3f3164(_0x859a7,async _0x472953=>{const _0x442197=_0x22f52d;return _0x13ad19[_0x442197(0x224)]?.({'type':_0x442197(0x178),'name':_0x472953[_0x442197(0x1ce)]}),await _0x1068cc['segment'][_0x442197(0x22e)](_0x472953['id']),_0x13ad19['onProgress']?.({'type':_0x442197(0x1b9),'name':_0x472953[_0x442197(0x1ce)]}),_0x13ad19[_0x442197(0x16b)]?.('Deleted\x20segment\x20\x27'+_0x472953[_0x442197(0x1ce)]+'\x27'),0x1;},_0x2436a4);return _0x39f5d8[_0x22f52d(0x21e)]((_0x332287,_0x2b2ea8)=>_0x332287+_0x2b2ea8,0x0);}export async function executePushJourneys(_0x5f1422,_0x2b7610,_0x21aa85,_0x3d4280,_0x49444e){const _0x4c3656=a152_0x59916b,{journeyDefToRequest:_0x462a49}=await import(_0x4c3656(0x13f)),{activationDefToCreateRequest:_0x17d97b,yamlRuleToApi:_0x1856f0,validateSegmentRule:_0x1af0f4}=await import(_0x4c3656(0x20c)),_0x58b820={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4c42bf=new Map(_0x21aa85['segmentNameToId']),_0x3f0173=0x5;for(let _0x3a2eea=0x0;_0x3a2eea<_0x2b7610[_0x4c3656(0x1fd)];_0x3a2eea+=_0x3f0173){const _0x51817a=_0x2b7610['slice'](_0x3a2eea,_0x3a2eea+_0x3f0173),_0x6f670=await Promise['all'](_0x51817a[_0x4c3656(0x1da)](async _0x4b0f62=>{const _0x33c20e=_0x4c3656;if(!_0x4b0f62[_0x33c20e(0x190)]&&!_0x4b0f62[_0x33c20e(0x1f7)])return{'action':_0x33c20e(0x181),'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)],'journeyId':_0x4b0f62[_0x33c20e(0x1f0)]?.['id']};const _0x45acad=_0x4b0f62[_0x33c20e(0x14e)]?_0x21aa85[_0x33c20e(0x1b0)][_0x33c20e(0x21c)](_0x4b0f62[_0x33c20e(0x14e)]):undefined;_0x49444e[_0x33c20e(0x224)]?.({'type':_0x4b0f62[_0x33c20e(0x190)]?_0x33c20e(0x201):_0x33c20e(0x234),'name':_0x4b0f62['yamlConfig'][_0x33c20e(0x1ce)]});try{const _0xbfae44=await executeSingleJourneyPush(_0x5f1422,_0x4b0f62,{..._0x21aa85,'segmentNameToId':_0x4c42bf},{'parentId':_0x3d4280[_0x33c20e(0x1c5)],'rootFolderId':_0x3d4280[_0x33c20e(0x1e4)],'folderId':_0x45acad,'verbose':_0x3d4280[_0x33c20e(0x195)]},_0x49444e,{'journeyDefToRequest':_0x462a49,'activationDefToCreateRequest':_0x17d97b,'yamlRuleToApi':_0x1856f0,'validateSegmentRule':_0x1af0f4});for(const [_0x55b2c3,_0x50713a]of _0xbfae44[_0x33c20e(0x1eb)]){_0x4c42bf[_0x33c20e(0x172)](_0x55b2c3,_0x50713a),_0x58b820[_0x33c20e(0x1eb)][_0x33c20e(0x172)](_0x55b2c3,_0x50713a);}if(_0xbfae44['action']===_0x33c20e(0x1dc))_0x49444e[_0x33c20e(0x224)]?.({'type':_0x33c20e(0x22a),'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)],'journeyId':_0xbfae44[_0x33c20e(0x223)]}),_0x49444e['logSuccess']?.('Created\x20journey\x20\x27'+_0x4b0f62[_0x33c20e(0x245)]['name']+'\x27'),_0x58b820[_0x33c20e(0x1dc)]++;else _0xbfae44[_0x33c20e(0x1b7)]==='updated'&&(_0x49444e[_0x33c20e(0x224)]?.({'type':_0x33c20e(0x160),'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)]}),_0x49444e[_0x33c20e(0x1e6)]?.(_0x33c20e(0x1bd)+_0x4b0f62[_0x33c20e(0x245)]['name']+'\x27'),_0x58b820[_0x33c20e(0x17c)]++);return{'action':_0xbfae44[_0x33c20e(0x1b7)],'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)],'journeyId':_0xbfae44[_0x33c20e(0x223)]};}catch(_0x152caa){const _0x13fdb9=isHttp400Error(_0x152caa),_0xc51b96=_0x13fdb9?ErrorCode[_0x33c20e(0x19b)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x22fa48=getErrorMessage(_0x152caa);throw new SDKError(_0xc51b96,_0x33c20e(0x184)+(_0x4b0f62['isNew']?_0x33c20e(0x241):_0x33c20e(0x1b1))+'\x20journey\x20from\x20file:\x20'+_0x4b0f62[_0x33c20e(0x202)]+'\x0a\x20\x20'+_0x22fa48,_0x152caa);}}));_0x58b820['results'][_0x4c3656(0x1ae)](..._0x6f670);}return _0x58b820;}async function matchExistingJourneySegments(_0x4115e2,_0x47cb7e,_0x36dbb8,_0x552acf,_0x3d6f91){const _0x59e8a1=a152_0x59916b;if(!_0x47cb7e[_0x59e8a1(0x1f0)]||!_0x47cb7e[_0x59e8a1(0x245)][_0x59e8a1(0x23d)])return;const _0x24b240=new Map(),_0x41d105=new Set();for(const _0x1496d2 of Object[_0x59e8a1(0x141)](_0x47cb7e['yamlConfig']['segments'])){const _0x1f6e85=generateDeterministicJourneySegmentName(_0x47cb7e[_0x59e8a1(0x245)][_0x59e8a1(0x1ce)],_0x1496d2);_0x24b240[_0x59e8a1(0x172)](_0x1f6e85,_0x1496d2),_0x41d105[_0x59e8a1(0x180)](_0x1496d2);}const _0x4d0f07=[],_0x4969ed=collectSegmentIdsFromJourneyApi(_0x47cb7e[_0x59e8a1(0x1f0)]);for(const _0x3fba49 of _0x4969ed){const _0x49b58e=await fetchSegment(_0x4115e2,_0x36dbb8,_0x3fba49,_0x552acf);if(!_0x49b58e?.[_0x59e8a1(0x1ce)])continue;const _0x50139c=_0x24b240[_0x59e8a1(0x21c)](_0x49b58e[_0x59e8a1(0x1ce)]);_0x50139c?(_0x3d6f91['set'](_0x50139c,_0x3fba49),_0x41d105[_0x59e8a1(0x193)](_0x50139c)):_0x4d0f07[_0x59e8a1(0x1ae)]({'id':_0x3fba49,'seg':_0x49b58e});}if(_0x41d105[_0x59e8a1(0x1ff)]>0x0&&_0x4d0f07[_0x59e8a1(0x1fd)]>0x0){const {localExpandedRuleToNames:_0x4589ca}=buildLocalExpandedRuleMappings(_0x47cb7e['yamlConfig']),_0x3ec683=new Map();for(const {id:_0x2d0d39,seg:_0x373dc2}of _0x4d0f07){if(_0x373dc2[_0x59e8a1(0x176)]){const _0x119a43=apiRuleToYaml(_0x373dc2[_0x59e8a1(0x176)]);_0x3ec683[_0x59e8a1(0x172)](_0x2d0d39,_0x119a43);}}for(const {id:_0xde403,seg:_0xc6b2f2}of _0x4d0f07){if(!_0xc6b2f2[_0x59e8a1(0x176)])continue;const _0x14e6d3=_0x3ec683[_0x59e8a1(0x21c)](_0xde403);if(!_0x14e6d3)continue;const _0x5e9316=serializeExpandedRule(_0x14e6d3,_0x3ec683),_0x52e184=_0x4589ca[_0x59e8a1(0x21c)](_0x5e9316);if(_0x52e184){const _0x50a840=_0x52e184[_0x59e8a1(0x16c)](_0x3fb4ec=>_0x41d105[_0x59e8a1(0x145)](_0x3fb4ec));_0x50a840&&(_0x3d6f91['set'](_0x50a840,_0xde403),_0x41d105[_0x59e8a1(0x193)](_0x50a840),logger[_0x59e8a1(0x186)](_0x59e8a1(0x183)+_0xc6b2f2[_0x59e8a1(0x1ce)]+_0x59e8a1(0x1e0)+_0x50a840+_0x59e8a1(0x17a)));}}}}async function executeSingleJourneyPush(_0x43f726,_0x2e525e,_0x26386d,_0x4e74da,_0x2c2f8f,_0x56b4d1){const _0xe4749c=a152_0x59916b,{journeyDefToRequest:_0x1452d3,activationDefToCreateRequest:_0x4c826a,yamlRuleToApi:_0x5a9b64,validateSegmentRule:_0x2965f7}=_0x56b4d1,_0x4286e6=new Map(),_0x1143c9=new Map();recoverSegmentIdsFromPushRecovery(_0x2e525e,_0x4286e6,_0x26386d['segmentNameToId']);const _0x2e4dd0=new Map(),_0x1da4b0=new Map(),_0x7af2ad=new Map();let _0x1d58b1;const _0x81162=async()=>{const _0x220232=a152_0x54b0;if(_0x1d58b1)return;_0x1d58b1=new Map();if(!_0x2e525e['existingJourney'])return;const _0x35f6fd=await _0x43f726[_0x220232(0x13e)][_0x220232(0x1ee)](_0x2e525e[_0x220232(0x1f0)]['id']);for(const _0x36163b of _0x35f6fd){const _0x1b7ae1=journeyActivationStepToYaml(_0x36163b,_0x26386d['idToEmailMap'],_0x26386d[_0x220232(0x247)]),_0x3a7046=activationSignature(_0x1b7ae1);!_0x1d58b1[_0x220232(0x145)](_0x3a7046)&&_0x1d58b1[_0x220232(0x172)](_0x3a7046,_0x36163b['id']),_0x1b7ae1[_0x220232(0x1ce)]&&_0x1143c9[_0x220232(0x172)](_0x1b7ae1[_0x220232(0x1ce)],_0x36163b['id']);}};await matchExistingJourneySegments(_0x43f726,_0x2e525e,_0x4e74da['parentId'],_0x26386d[_0xe4749c(0x1bf)],_0x26386d['segmentNameToId']);const _0x53bd51={'resolveSegmentId':async _0x5c1858=>{const _0x4e1fd7=_0xe4749c,_0x2d0fe0=_0x26386d[_0x4e1fd7(0x20d)][_0x4e1fd7(0x21c)](_0x5c1858);if(!_0x2d0fe0)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4e1fd7(0x213)+_0x5c1858+_0x4e1fd7(0x177)+_0x2e525e[_0x4e1fd7(0x245)]['name']+')');return _0x2d0fe0;},'resolveEmbeddedSegmentId':async(_0x130ec0,_0x173808)=>{const _0x3073ce=_0xe4749c,_0x13669f=_0x26386d[_0x3073ce(0x20d)]['get'](_0x130ec0);if(_0x13669f)return _0x13669f;const _0x154669=_0x26386d[_0x3073ce(0x1bf)][_0x3073ce(0x16c)](_0xd8f6e=>_0xd8f6e[_0x3073ce(0x1ce)]===_0x130ec0);if(_0x154669)return _0x26386d['segmentNameToId'][_0x3073ce(0x172)](_0x130ec0,_0x154669['id']),_0x154669['id'];if(_0x2e525e[_0x3073ce(0x190)]){const {stageName:_0x1c037a,criteriaName:_0x47f62e}=findSegmentCriteriaLocation(_0x2e525e[_0x3073ce(0x245)],_0x130ec0);return _0x2965f7(_0x130ec0,_0x173808[_0x3073ce(0x176)]),_0x1da4b0[_0x3073ce(0x172)](_0x130ec0,{'definition':_0x173808,'stageName':_0x1c037a,'criteriaName':_0x47f62e}),createPendingSegmentId(_0x130ec0);}const _0x320b60=_0x2e525e[_0x3073ce(0x1f0)]?.['id'];if(!_0x320b60)throw new SDKError(ErrorCode[_0x3073ce(0x1e2)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x4dbf6e=_0x2e4dd0['get'](_0x130ec0);if(_0x4dbf6e)return _0x4dbf6e;const _0x323695=((async()=>{const _0xa929bb=_0x3073ce;_0x2965f7(_0x130ec0,_0x173808[_0xa929bb(0x176)]);const _0x100520=generateDeterministicJourneySegmentName(_0x2e525e[_0xa929bb(0x245)][_0xa929bb(0x1ce)],_0x130ec0),_0x2f15e7=_0x26386d[_0xa929bb(0x1bf)][_0xa929bb(0x16c)](_0x2f6398=>_0x2f6398[_0xa929bb(0x1ce)]===_0x100520),_0x33c6e0=createSegmentIdResolver(_0x26386d[_0xa929bb(0x20d)],_0x130ec0),_0x3c3cf8=await resolveRuleSegmentIds(_0x173808[_0xa929bb(0x176)],_0x33c6e0);let _0x30ccc8;return _0x2f15e7?(await _0x43f726[_0xa929bb(0x240)][_0xa929bb(0x1ad)](_0x4e74da[_0xa929bb(0x1c5)],_0x2f15e7['id'],{'description':_0x173808[_0xa929bb(0x1a3)]||_0xa929bb(0x1f8)+_0x130ec0,'rule':_0x5a9b64(_0x3c3cf8,!![]),'countPopulation':!![]}),_0x30ccc8=_0x2f15e7['id'],saveSegmentToPushRecovery(_0x2e525e[_0xa929bb(0x202)],_0x2e525e[_0xa929bb(0x245)][_0xa929bb(0x1ce)],_0x130ec0,{'segmentId':_0x30ccc8,'uniqueServerName':_0x100520,'createdAt':new Date()[_0xa929bb(0x22d)]()})):_0x30ccc8=await createOrRecoverEmbeddedSegment(_0x43f726,_0x2e525e,{'localName':_0x130ec0,'uniqueSegmentName':_0x100520,'description':_0x173808[_0xa929bb(0x1a3)]||'Entry\x20criteria:\x20'+_0x130ec0,'journeyId':_0x320b60,'resolvedRule':_0x3c3cf8,'parentId':_0x4e74da['parentId'],'folderId':_0x4e74da[_0xa929bb(0x1e4)]||''},_0x5a9b64),_0x26386d[_0xa929bb(0x20d)]['set'](_0x130ec0,_0x30ccc8),_0x4286e6[_0xa929bb(0x172)](_0x130ec0,_0x30ccc8),_0x30ccc8;})());_0x2e4dd0[_0x3073ce(0x172)](_0x130ec0,_0x323695);try{return await _0x323695;}finally{_0x2e4dd0[_0x3073ce(0x193)](_0x130ec0);}},'resolveActivationId':async _0x412dfd=>{const _0x3d5e01=_0xe4749c,_0x14306a=_0x1143c9[_0x3d5e01(0x21c)](_0x412dfd);if(_0x14306a)return _0x14306a;if(_0x2e525e[_0x3d5e01(0x1f0)]){await _0x81162();const _0x3f9e8f=_0x1143c9[_0x3d5e01(0x21c)](_0x412dfd);if(_0x3f9e8f)return _0x3f9e8f;}throw new SDKError(ErrorCode[_0x3d5e01(0x15f)],_0x3d5e01(0x198)+_0x412dfd+_0x3d5e01(0x177)+_0x2e525e[_0x3d5e01(0x245)][_0x3d5e01(0x1ce)]+_0x3d5e01(0x21f)+_0x3d5e01(0x170));},'resolveEmbeddedActivationId':async(_0x5de786,_0x3f0c2d)=>{const _0x15b1c9=_0xe4749c,_0x18be07=_0x1143c9[_0x15b1c9(0x21c)](_0x5de786);if(_0x18be07)return _0x18be07;if(_0x2e525e['isNew'])return _0x7af2ad['set'](_0x5de786,_0x3f0c2d),createPendingActivationId(_0x5de786);if(_0x2e525e[_0x15b1c9(0x1f0)]){await _0x81162();const _0x5354df=_0x1143c9[_0x15b1c9(0x21c)](_0x3f0c2d[_0x15b1c9(0x1ce)]);if(_0x5354df)return _0x1143c9['set'](_0x5de786,_0x5354df),_0x5354df;const _0x41df67=activationSignature(_0x3f0c2d),_0x3c9f7d=_0x1d58b1?.['get'](_0x41df67);if(_0x3c9f7d)return _0x1143c9['set'](_0x5de786,_0x3c9f7d),_0x3c9f7d;const _0x20c667=await _0x4c826a(_0x3f0c2d,_0x26386d[_0x15b1c9(0x1b8)]),_0x1aadce={..._0x20c667,..._0x3f0c2d[_0x15b1c9(0x179)]!==undefined&&{'runAfterJourneyRefresh':_0x3f0c2d[_0x15b1c9(0x179)]}},_0x565582=await _0x43f726['journey'][_0x15b1c9(0x143)](_0x2e525e[_0x15b1c9(0x1f0)]['id'],_0x1aadce);return _0x1143c9[_0x15b1c9(0x172)](_0x5de786,_0x565582['id']),_0x565582['id'];}throw new SDKError(ErrorCode[_0x15b1c9(0x1e2)],_0x15b1c9(0x18e));},'resolveJourneyId':async _0x3f3a18=>{const _0x10651e=_0xe4749c;try{return await _0x43f726[_0x10651e(0x13e)][_0x10651e(0x23f)](_0x4e74da[_0x10651e(0x1c5)],_0x3f3a18);}catch(_0x4d3ad1){throw new SDKError(ErrorCode['NOT_FOUND'],_0x10651e(0x18b)+_0x3f3a18+_0x10651e(0x1d0)+_0x2e525e[_0x10651e(0x245)][_0x10651e(0x1ce)]+'\x27)',_0x4d3ad1);}},'resolveStageId':async(_0x355a56,_0xdd0803)=>{const _0x29c347=_0xe4749c,_0x5bf2f6=await _0x43f726[_0x29c347(0x13e)][_0x29c347(0x229)](_0x355a56),_0x24f640=_0x5bf2f6[_0x29c347(0x211)][_0x29c347(0x1ca)]['find'](_0x5af390=>_0x5af390['name'][_0x29c347(0x1d1)]()===_0xdd0803[_0x29c347(0x1d1)]());if(!_0x24f640?.['id'])throw new SDKError(ErrorCode[_0x29c347(0x15f)],_0x29c347(0x19e)+_0xdd0803+_0x29c347(0x239)+(_0x5bf2f6['attributes'][_0x29c347(0x15c)]||_0x5bf2f6[_0x29c347(0x211)][_0x29c347(0x1ce)])+'\x27');return _0x24f640['id'];}},_0x2b1519=await _0x1452d3(_0x2e525e[_0xe4749c(0x245)],_0x4e74da[_0xe4749c(0x1c5)],_0x53bd51),_0x46d0bf=_0x4e74da[_0xe4749c(0x169)]||_0x4e74da[_0xe4749c(0x1e4)];_0x46d0bf&&(_0x2b1519[_0xe4749c(0x1ef)]={'parentFolder':{'data':{'id':_0x46d0bf,'type':_0xe4749c(0x19a)}}});if(_0x2e525e[_0xe4749c(0x190)]){if(_0x1da4b0[_0xe4749c(0x1ff)]>0x0||_0x7af2ad[_0xe4749c(0x1ff)]>0x0)return await executeThreeStepJourneyCreate(_0x43f726,_0x2e525e,_0x2b1519,{'pendingEmbeddedSegments':_0x1da4b0,'pendingEmbeddedActivations':_0x7af2ad,'embeddedSegmentNameToId':_0x4286e6,'journeyActivationNameToId':_0x1143c9},{..._0x4e74da,'effectiveFolderId':_0x46d0bf},_0x26386d,_0x2c2f8f,_0x56b4d1);else{ensureJourneyDefaults(_0x2b1519[_0xe4749c(0x211)]);const _0x3590f8=await _0x43f726[_0xe4749c(0x13e)][_0xe4749c(0x241)](_0x2b1519);return deletePushRecovery(_0x2e525e[_0xe4749c(0x202)]),{'action':'created','journeyId':_0x3590f8['id'],'embeddedSegmentNameToId':_0x4286e6};}}else{if(_0x2e525e[_0xe4749c(0x1f7)]&&_0x2e525e[_0xe4749c(0x1f0)]){_0x2b1519['id']=_0x2e525e[_0xe4749c(0x1f0)]['id'];const _0x3da5bf=_0x2b1519[_0xe4749c(0x211)];_0x2e525e['existingJourney'][_0xe4749c(0x211)]?.[_0xe4749c(0x15c)]&&(_0x3da5bf['journeyBundleName']=_0x2e525e['existingJourney'][_0xe4749c(0x211)][_0xe4749c(0x15c)]);const _0x3769fe=_0x2e525e['existingJourney'][_0xe4749c(0x211)]?.[_0xe4749c(0x1ca)];return _0x3769fe&&_0x2b1519[_0xe4749c(0x211)][_0xe4749c(0x1ca)]&&injectExistingStageIds(_0x2b1519[_0xe4749c(0x211)][_0xe4749c(0x1ca)],_0x3769fe),ensureJourneyDefaults(_0x3da5bf),await _0x43f726['journey'][_0xe4749c(0x1b1)](_0x2e525e[_0xe4749c(0x1f0)]['id'],_0x2b1519),deletePushRecovery(_0x2e525e[_0xe4749c(0x202)]),{'action':_0xe4749c(0x17c),'journeyId':_0x2e525e[_0xe4749c(0x1f0)]['id'],'embeddedSegmentNameToId':_0x4286e6};}}return deletePushRecovery(_0x2e525e['absolutePath']),{'action':_0xe4749c(0x181),'journeyId':_0x2e525e[_0xe4749c(0x1f0)]?.['id'],'embeddedSegmentNameToId':_0x4286e6};}function findSegmentCriteriaLocation(_0x16fe36,_0x5ea9d3){const _0x18b84d=a152_0x59916b,_0x11c30f=_0x16fe36[_0x18b84d(0x1ba)]||_0x16fe36[_0x18b84d(0x232)]?.[0x0]?.[_0x18b84d(0x1ba)]||[];let _0x5528e8=_0x18b84d(0x16e),_0x5a646f=_0x5ea9d3;const _0x269714=_0x16fe36[_0x18b84d(0x227)]||_0x16fe36[_0x18b84d(0x232)]?.[0x0]?.[_0x18b84d(0x227)];if(_0x269714?.[_0x18b84d(0x240)]===_0x5ea9d3)return{'stageName':'goal','criteriaName':_0x269714[_0x18b84d(0x1ce)]||_0x5ea9d3};_0x215a08:for(const _0x97b1b4 of _0x11c30f){if(_0x97b1b4[_0x18b84d(0x20b)]?.['segment']===_0x5ea9d3){_0x5528e8=_0x97b1b4[_0x18b84d(0x1ce)],_0x5a646f=_0x97b1b4[_0x18b84d(0x20b)]['name']||_0x5ea9d3;break;}if(_0x97b1b4[_0x18b84d(0x18d)])for(const _0x594ad1 of _0x97b1b4[_0x18b84d(0x18d)]){if(_0x594ad1[_0x18b84d(0x216)]===_0x18b84d(0x18f)&&_0x594ad1[_0x18b84d(0x155)]?.['branches'])for(const _0x45913a of _0x594ad1[_0x18b84d(0x155)][_0x18b84d(0x210)]){if(_0x45913a['segment']===_0x5ea9d3){_0x5528e8=_0x97b1b4[_0x18b84d(0x1ce)],_0x5a646f=_0x45913a[_0x18b84d(0x1ce)]||_0x5ea9d3;break _0x215a08;}}}}return{'stageName':_0x5528e8,'criteriaName':_0x5a646f};}async function executeThreeStepJourneyCreate(_0x111b10,_0x4e323a,_0x16e2f4,_0x181b0b,_0x36211d,_0x35b752,_0x42d6f7,_0x1e6dd8){const _0x40f436=a152_0x59916b,{activationDefToCreateRequest:_0x5b23ef,yamlRuleToApi:_0x1ac70c}=_0x1e6dd8,{pendingEmbeddedSegments:_0x32f862,pendingEmbeddedActivations:_0x42847f,embeddedSegmentNameToId:_0x6739cd}=_0x181b0b,_0x1f00f8=JSON[_0x40f436(0x14c)](JSON[_0x40f436(0x18a)](_0x16e2f4));ensureJourneyDefaults(_0x1f00f8[_0x40f436(0x211)]),stripPendingIds(_0x1f00f8);const _0x15779c=await _0x111b10[_0x40f436(0x13e)]['create'](_0x1f00f8),_0x1bc42d=_0x15779c['id'],_0x5be842=new Map();for(const _0xbd7fad of _0x15779c[_0x40f436(0x211)][_0x40f436(0x1ca)]){_0x5be842[_0x40f436(0x172)](_0xbd7fad[_0x40f436(0x1ce)][_0x40f436(0x1d1)](),_0xbd7fad['id']);}recoverSegmentIdsFromPushRecovery(_0x4e323a,_0x6739cd,_0x35b752[_0x40f436(0x20d)]);for(const [_0x56eef1,{definition:_0x31e2f2}]of _0x32f862){if(_0x6739cd[_0x40f436(0x145)](_0x56eef1)){_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x1a7),'journeyName':_0x4e323a[_0x40f436(0x245)][_0x40f436(0x1ce)],'segmentName':_0x56eef1});continue;}const _0x3fe8ef=generateDeterministicJourneySegmentName(_0x4e323a[_0x40f436(0x245)][_0x40f436(0x1ce)],_0x56eef1);_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x1c2),'journeyName':_0x4e323a['yamlConfig'][_0x40f436(0x1ce)],'segmentName':_0x56eef1});const _0x4fe8aa=createSegmentIdResolver(_0x35b752['segmentNameToId'],_0x56eef1),_0x111c9c=await resolveRuleSegmentIds(_0x31e2f2[_0x40f436(0x176)],_0x4fe8aa),_0x209a2b=await createOrRecoverEmbeddedSegment(_0x111b10,_0x4e323a,{'localName':_0x56eef1,'uniqueSegmentName':_0x3fe8ef,'description':_0x31e2f2['description']||_0x40f436(0x1f8)+_0x56eef1,'journeyId':_0x1bc42d,'resolvedRule':_0x111c9c,'parentId':_0x36211d[_0x40f436(0x1c5)],'folderId':_0x36211d[_0x40f436(0x21a)]||''},_0x1ac70c);_0x6739cd[_0x40f436(0x172)](_0x56eef1,_0x209a2b),_0x35b752[_0x40f436(0x20d)][_0x40f436(0x172)](_0x56eef1,_0x209a2b),_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x1a7),'journeyName':_0x4e323a[_0x40f436(0x245)][_0x40f436(0x1ce)],'segmentName':_0x56eef1});}const _0x32ccec=new Map();for(const [_0x2f8476,_0x2fd152]of _0x42847f){_0x42d6f7['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x4e323a[_0x40f436(0x245)]['name'],'activationName':_0x2f8476});const _0x523776=await _0x5b23ef(_0x2fd152,_0x35b752[_0x40f436(0x1b8)]),_0x52a627={..._0x523776,..._0x2fd152[_0x40f436(0x179)]!==undefined&&{'runAfterJourneyRefresh':_0x2fd152[_0x40f436(0x179)]}},_0x4bbae5=await _0x111b10['journey'][_0x40f436(0x143)](_0x1bc42d,_0x52a627);_0x32ccec[_0x40f436(0x172)](_0x2f8476,_0x4bbae5['id']),_0x181b0b[_0x40f436(0x215)][_0x40f436(0x172)](_0x2f8476,_0x4bbae5['id']),_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x237),'journeyName':_0x4e323a['yamlConfig'][_0x40f436(0x1ce)],'activationName':_0x2f8476});}const _0x2cbc37=JSON['parse'](JSON['stringify'](_0x16e2f4));return _0x2cbc37['id']=_0x1bc42d,ensureJourneyDefaults(_0x2cbc37[_0x40f436(0x211)]),resolvePendingIdsInRequest(_0x2cbc37,_0x16e2f4,_0x5be842,_0x6739cd,_0x32ccec,_0x42d6f7),await _0x111b10[_0x40f436(0x13e)]['update'](_0x1bc42d,_0x2cbc37),deletePushRecovery(_0x4e323a[_0x40f436(0x202)]),{'action':'created','journeyId':_0x1bc42d,'embeddedSegmentNameToId':_0x6739cd};}export function stripWaitStepPendingIds(_0x20a5ac){const _0x3de059=a152_0x59916b,_0x22955b=_0x20a5ac[_0x3de059(0x21d)]&&isPendingSegmentId(_0x20a5ac[_0x3de059(0x21d)]),_0x2ceb84=_0x20a5ac['conditions']?.[_0x3de059(0x192)](_0x37411d=>_0x37411d[_0x3de059(0x16d)]&&isPendingSegmentId(_0x37411d[_0x3de059(0x16d)]));(_0x22955b||_0x2ceb84)&&(_0x20a5ac[_0x3de059(0x1e9)]=_0x3de059(0x1cf),_0x20a5ac[_0x3de059(0x17d)]=0x1,_0x20a5ac['waitStepUnit']=_0x3de059(0x16f),delete _0x20a5ac[_0x3de059(0x21d)],delete _0x20a5ac[_0x3de059(0x19d)],delete _0x20a5ac[_0x3de059(0x203)],delete _0x20a5ac[_0x3de059(0x1ed)]);}export function resolveWaitStepPendingIds(_0x56cfac,_0x1105eb,_0x4bad2b,_0x232a44){const _0x5cd8da=a152_0x59916b;if(_0x1105eb[_0x5cd8da(0x21d)]&&isPendingSegmentId(_0x1105eb[_0x5cd8da(0x21d)])){const _0x18267e=_0x4bad2b(_0x1105eb[_0x5cd8da(0x21d)],_0x5cd8da(0x1f9)+_0x232a44+'\x27\x20wait\x20condition');_0x18267e&&(_0x56cfac[_0x5cd8da(0x1e9)]=_0x5cd8da(0x243),_0x56cfac[_0x5cd8da(0x21d)]=_0x18267e,delete _0x56cfac['waitStep'],delete _0x56cfac[_0x5cd8da(0x205)],_0x1105eb[_0x5cd8da(0x19d)]!==undefined&&(_0x56cfac[_0x5cd8da(0x19d)]=_0x1105eb[_0x5cd8da(0x19d)]),_0x1105eb[_0x5cd8da(0x203)]&&(_0x56cfac['conditionTimeoutUnit']=_0x1105eb[_0x5cd8da(0x203)]));}if(_0x1105eb['conditions']){const _0x57d41e=_0x1105eb['conditions'][_0x5cd8da(0x192)](_0x447c52=>_0x447c52[_0x5cd8da(0x16d)]&&isPendingSegmentId(_0x447c52[_0x5cd8da(0x16d)]));if(_0x57d41e){const _0x1f484e=_0x1105eb[_0x5cd8da(0x1ed)][_0x5cd8da(0x1da)](_0x534963=>{const _0x66588f=_0x5cd8da;if(_0x534963['segmentId']&&isPendingSegmentId(_0x534963[_0x66588f(0x16d)])){const _0x2002fd=_0x4bad2b(_0x534963['segmentId'],_0x66588f(0x1f9)+_0x232a44+_0x66588f(0x1d6));return{..._0x534963,'segmentId':_0x2002fd||_0x534963[_0x66588f(0x16d)]};}return{..._0x534963};});_0x56cfac[_0x5cd8da(0x1e9)]=_0x5cd8da(0x243),_0x56cfac[_0x5cd8da(0x1ed)]=_0x1f484e,delete _0x56cfac[_0x5cd8da(0x17d)],delete _0x56cfac[_0x5cd8da(0x205)],delete _0x56cfac[_0x5cd8da(0x21d)],delete _0x56cfac[_0x5cd8da(0x19d)],delete _0x56cfac['conditionTimeoutUnit'];}}}function stripPendingIds(_0x506259){const _0x340f7a=a152_0x59916b;_0x506259['attributes'][_0x340f7a(0x227)]?.[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x506259['attributes'][_0x340f7a(0x227)][_0x340f7a(0x16d)])&&delete _0x506259[_0x340f7a(0x211)][_0x340f7a(0x227)];for(const _0x2bc24f of _0x506259[_0x340f7a(0x211)][_0x340f7a(0x1ca)]||[]){_0x2bc24f[_0x340f7a(0x233)]?.[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x2bc24f[_0x340f7a(0x233)][_0x340f7a(0x16d)])&&delete _0x2bc24f[_0x340f7a(0x233)];_0x2bc24f[_0x340f7a(0x19c)]?.[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x2bc24f['milestone'][_0x340f7a(0x16d)])&&delete _0x2bc24f[_0x340f7a(0x19c)];_0x2bc24f[_0x340f7a(0x171)]&&(_0x2bc24f[_0x340f7a(0x171)]=_0x2bc24f[_0x340f7a(0x171)][_0x340f7a(0x197)](_0x289704=>!_0x289704[_0x340f7a(0x16d)]||!isPendingSegmentId(_0x289704[_0x340f7a(0x16d)])));if(_0x2bc24f[_0x340f7a(0x18d)])for(const _0xec5ad6 of Object['keys'](_0x2bc24f[_0x340f7a(0x18d)])){const _0x3cd292=_0x2bc24f['steps'][_0xec5ad6];_0x3cd292[_0x340f7a(0x216)]===_0x340f7a(0x23a)&&_0x3cd292['journeyActivationStepId']&&isPendingActivationId(_0x3cd292[_0x340f7a(0x1e5)])&&(_0x3cd292[_0x340f7a(0x1e5)]='');if(_0x3cd292['type']===_0x340f7a(0x15b)&&_0x3cd292[_0x340f7a(0x210)])for(const _0x488d93 of _0x3cd292[_0x340f7a(0x210)]){_0x488d93[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x488d93[_0x340f7a(0x16d)])&&(_0x488d93[_0x340f7a(0x16d)]='');}_0x3cd292[_0x340f7a(0x216)]===_0x340f7a(0x1de)&&stripWaitStepPendingIds(_0x3cd292);}}}function resolvePendingIdsInRequest(_0x286472,_0x294d7d,_0x4287d6,_0x5180d8,_0x564360,_0x3b0d48){const _0xf752eb=a152_0x59916b,_0x3c47ca=(_0x2af67c,_0x4f6875)=>{const _0x5e8cb6=a152_0x54b0;if(!isPendingSegmentId(_0x2af67c))return _0x2af67c;const _0x2c91c3=extractPendingSegmentName(_0x2af67c),_0x547db1=_0x5180d8[_0x5e8cb6(0x21c)](_0x2c91c3);return!_0x547db1&&_0x3b0d48[_0x5e8cb6(0x16a)]?.(_0x5e8cb6(0x1c0)+_0x2c91c3+_0x5e8cb6(0x1ac)+_0x4f6875),_0x547db1;};if(_0x286472[_0xf752eb(0x211)]['goal']?.['segmentId']&&isPendingSegmentId(_0x286472['attributes'][_0xf752eb(0x227)]['segmentId'])){const _0x419e48=_0x3c47ca(_0x286472['attributes'][_0xf752eb(0x227)]['segmentId'],'goal\x20criteria');_0x419e48&&(_0x286472[_0xf752eb(0x211)][_0xf752eb(0x227)][_0xf752eb(0x16d)]=_0x419e48);}for(const _0x529792 of _0x286472[_0xf752eb(0x211)][_0xf752eb(0x1ca)]||[]){const _0x1dcc53=_0x4287d6[_0xf752eb(0x21c)](_0x529792[_0xf752eb(0x1ce)][_0xf752eb(0x1d1)]());_0x1dcc53&&(_0x529792['id']=_0x1dcc53);if(_0x529792['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x529792['entryCriteria'][_0xf752eb(0x16d)])){const _0x210df3=_0x3c47ca(_0x529792['entryCriteria'][_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792[_0xf752eb(0x1ce)]+_0xf752eb(0x1a2));_0x210df3&&(_0x529792['entryCriteria'][_0xf752eb(0x16d)]=_0x210df3);}if(_0x529792['exitCriterias'])for(const _0x44a75b of _0x529792[_0xf752eb(0x171)]){if(_0x44a75b[_0xf752eb(0x16d)]&&isPendingSegmentId(_0x44a75b[_0xf752eb(0x16d)])){const _0x3ed467=_0x3c47ca(_0x44a75b[_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792['name']+_0xf752eb(0x175));_0x3ed467&&(_0x44a75b[_0xf752eb(0x16d)]=_0x3ed467);}}if(_0x529792[_0xf752eb(0x19c)]?.[_0xf752eb(0x16d)]&&isPendingSegmentId(_0x529792[_0xf752eb(0x19c)][_0xf752eb(0x16d)])){const _0xb7d907=_0x3c47ca(_0x529792[_0xf752eb(0x19c)][_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792[_0xf752eb(0x1ce)]+_0xf752eb(0x22c));_0xb7d907&&(_0x529792['milestone'][_0xf752eb(0x16d)]=_0xb7d907);}if(_0x529792['steps']){const _0x38b293=_0x8a3230=>_0x294d7d[_0xf752eb(0x211)][_0xf752eb(0x1ca)]?.[_0xf752eb(0x16c)](_0x5be044=>_0x5be044[_0xf752eb(0x1ce)][_0xf752eb(0x1d1)]()===_0x529792[_0xf752eb(0x1ce)][_0xf752eb(0x1d1)]())?.[_0xf752eb(0x18d)]?.[_0x8a3230];for(const _0x354582 of Object[_0xf752eb(0x141)](_0x529792[_0xf752eb(0x18d)])){const _0x1d5bd9=_0x529792[_0xf752eb(0x18d)][_0x354582],_0x5167bb=_0x38b293(_0x354582);if(_0x1d5bd9[_0xf752eb(0x216)]==='Activation'&&_0x1d5bd9[_0xf752eb(0x1e5)]&&(isPendingActivationId(_0x1d5bd9[_0xf752eb(0x1e5)])||_0x1d5bd9[_0xf752eb(0x1e5)]==='')){if(_0x5167bb?.[_0xf752eb(0x1e5)]&&isPendingActivationId(_0x5167bb['journeyActivationStepId'])){const _0x1082eb=extractPendingActivationName(_0x5167bb[_0xf752eb(0x1e5)]),_0x18f862=_0x564360['get'](_0x1082eb);_0x18f862&&(_0x1d5bd9[_0xf752eb(0x1e5)]=_0x18f862);}}if(_0x1d5bd9[_0xf752eb(0x216)]===_0xf752eb(0x15b)&&_0x1d5bd9['branches']&&_0x5167bb?.[_0xf752eb(0x210)])for(let _0x57a4ab=0x0;_0x57a4ab<_0x1d5bd9[_0xf752eb(0x210)]['length'];_0x57a4ab++){const _0x357b16=_0x1d5bd9[_0xf752eb(0x210)][_0x57a4ab],_0x4a39a3=_0x5167bb[_0xf752eb(0x210)][_0x57a4ab];if(_0x4a39a3?.[_0xf752eb(0x16d)]&&isPendingSegmentId(_0x4a39a3[_0xf752eb(0x16d)])){const _0x16fd61=_0x3c47ca(_0x4a39a3[_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792[_0xf752eb(0x1ce)]+_0xf752eb(0x157)+(_0x357b16[_0xf752eb(0x1ce)]||_0x57a4ab)+'\x27');_0x16fd61&&(_0x357b16['segmentId']=_0x16fd61);}}_0x1d5bd9[_0xf752eb(0x216)]==='WaitStep'&&_0x5167bb?.[_0xf752eb(0x216)]===_0xf752eb(0x1de)&&resolveWaitStepPendingIds(_0x1d5bd9,_0x5167bb,_0x3c47ca,_0x529792['name']);}}}}
@@ -1 +1 @@
1
- function a153_0x2525(_0x285426,_0x4db367){_0x285426=_0x285426-0x175;const _0x5cd607=a153_0x5cd6();let _0x25253a=_0x5cd607[_0x285426];return _0x25253a;}(function(_0x12c9ff,_0x53ef92){const _0x53da24=a153_0x2525,_0x574a12=_0x12c9ff();while(!![]){try{const _0x192b0b=-parseInt(_0x53da24(0x17d))/0x1*(-parseInt(_0x53da24(0x17f))/0x2)+parseInt(_0x53da24(0x175))/0x3*(parseInt(_0x53da24(0x17b))/0x4)+-parseInt(_0x53da24(0x186))/0x5*(-parseInt(_0x53da24(0x177))/0x6)+-parseInt(_0x53da24(0x185))/0x7*(-parseInt(_0x53da24(0x180))/0x8)+parseInt(_0x53da24(0x184))/0x9+parseInt(_0x53da24(0x176))/0xa*(parseInt(_0x53da24(0x17e))/0xb)+-parseInt(_0x53da24(0x179))/0xc;if(_0x192b0b===_0x53ef92)break;else _0x574a12['push'](_0x574a12['shift']());}catch(_0x3aa119){_0x574a12['push'](_0x574a12['shift']());}}}(a153_0x5cd6,0x25dda));export function buildFolderIdToPathMap(_0x10437a){const _0x285ee9=a153_0x2525,_0x2fb789=new Map(),_0x493c04=new Map();for(const _0x1fcc97 of _0x10437a){_0x493c04['set'](_0x1fcc97['id'],_0x1fcc97);}const _0x1680f6=new Set();for(const _0x11dc34 of _0x10437a){!_0x11dc34['parentFolderId']&&_0x1680f6[_0x285ee9(0x178)](_0x11dc34['id']);}function _0x58c708(_0x3827bf){const _0x4ced79=_0x285ee9;if(_0x2fb789[_0x4ced79(0x17c)](_0x3827bf['id']))return _0x2fb789['get'](_0x3827bf['id']);if(_0x1680f6['has'](_0x3827bf['id']))return _0x2fb789['set'](_0x3827bf['id'],''),'';if(_0x3827bf['parentFolderId']){const _0x4a6cbd=_0x493c04[_0x4ced79(0x183)](_0x3827bf[_0x4ced79(0x181)]);if(_0x4a6cbd){const _0x845387=_0x58c708(_0x4a6cbd),_0x1a9a6f=_0x845387?_0x845387+'/'+_0x3827bf[_0x4ced79(0x17a)]:_0x3827bf[_0x4ced79(0x17a)];return _0x2fb789[_0x4ced79(0x182)](_0x3827bf['id'],_0x1a9a6f),_0x1a9a6f;}}const _0x2c9da9=_0x3827bf[_0x4ced79(0x17a)];return _0x2fb789[_0x4ced79(0x182)](_0x3827bf['id'],_0x2c9da9),_0x2c9da9;}for(const _0x36b13b of _0x10437a){_0x58c708(_0x36b13b);}return _0x2fb789;}export function buildFolderPathToIdMap(_0x3793ce){const _0x1fd7ba=a153_0x2525,_0x38acb8=new Map(),_0x3555f5=new Map();for(const _0x550059 of _0x3793ce){_0x3555f5[_0x1fd7ba(0x182)](_0x550059['id'],_0x550059);}const _0x425f78=new Set();for(const _0x38a474 of _0x3793ce){!_0x38a474[_0x1fd7ba(0x181)]&&_0x425f78[_0x1fd7ba(0x178)](_0x38a474['id']);}function _0x548e9f(_0x1d78e2){const _0x536b74=_0x1fd7ba;if(_0x425f78[_0x536b74(0x17c)](_0x1d78e2['id']))return'';if(_0x1d78e2[_0x536b74(0x181)]){const _0x37d530=_0x3555f5[_0x536b74(0x183)](_0x1d78e2[_0x536b74(0x181)]);if(_0x37d530){const _0x9f1e89=_0x548e9f(_0x37d530);return _0x9f1e89?_0x9f1e89+'/'+_0x1d78e2['name']:_0x1d78e2['name'];}}return _0x1d78e2[_0x536b74(0x17a)];}for(const _0x4912af of _0x3793ce){const _0x2d1bba=_0x548e9f(_0x4912af);_0x38acb8[_0x1fd7ba(0x182)](_0x2d1bba,_0x4912af['id']);}return _0x38acb8;}function a153_0x5cd6(){const _0x141b1f=['99302JjpWns','2865WXwEkH','155457bcgjiT','3057290boCovq','1734vHtwZS','add','13343544PCudRf','name','20vGrHsK','has','2ZgvJBR','11IwNefh','261910PmvmEQ','8DneqCE','parentFolderId','set','get','2344887LlTXgj'];a153_0x5cd6=function(){return _0x141b1f;};return a153_0x5cd6();}export function buildFolderMaps(_0x26f67e){const _0x40c370=a153_0x2525,_0x4c2b2b=buildFolderIdToPathMap(_0x26f67e),_0x33c72f=new Map();for(const [_0x262009,_0xf0c9fa]of _0x4c2b2b){_0x33c72f[_0x40c370(0x182)](_0xf0c9fa,_0x262009);}return{'idToPath':_0x4c2b2b,'pathToId':_0x33c72f};}export function getFolderPath(_0x5bbad0,_0x3d8bdb){if(!_0x5bbad0)return'';return _0x3d8bdb['get'](_0x5bbad0)??'';}
1
+ (function(_0x455e32,_0x43b296){const _0x14f28d=a153_0x4de1,_0x18e041=_0x455e32();while(!![]){try{const _0x157dd7=parseInt(_0x14f28d(0xbb))/0x1*(-parseInt(_0x14f28d(0xb8))/0x2)+-parseInt(_0x14f28d(0xbf))/0x3*(parseInt(_0x14f28d(0xba))/0x4)+-parseInt(_0x14f28d(0xbe))/0x5+-parseInt(_0x14f28d(0xb9))/0x6+parseInt(_0x14f28d(0xb2))/0x7*(-parseInt(_0x14f28d(0xb5))/0x8)+parseInt(_0x14f28d(0xb6))/0x9+-parseInt(_0x14f28d(0xb4))/0xa*(-parseInt(_0x14f28d(0xbc))/0xb);if(_0x157dd7===_0x43b296)break;else _0x18e041['push'](_0x18e041['shift']());}catch(_0xf21e88){_0x18e041['push'](_0x18e041['shift']());}}}(a153_0x5ed7,0x76ec7));export function buildFolderIdToPathMap(_0x3c822c){const _0x1a56f0=a153_0x4de1,_0x1942bf=new Map(),_0x8b773d=new Map();for(const _0x352c52 of _0x3c822c){_0x8b773d[_0x1a56f0(0xb3)](_0x352c52['id'],_0x352c52);}const _0x3c0747=new Set();for(const _0x301f44 of _0x3c822c){!_0x301f44[_0x1a56f0(0xc0)]&&_0x3c0747[_0x1a56f0(0xb7)](_0x301f44['id']);}function _0x578cbf(_0xba1268){const _0x41d75d=_0x1a56f0;if(_0x1942bf[_0x41d75d(0xb1)](_0xba1268['id']))return _0x1942bf['get'](_0xba1268['id']);if(_0x3c0747[_0x41d75d(0xb1)](_0xba1268['id']))return _0x1942bf[_0x41d75d(0xb3)](_0xba1268['id'],''),'';if(_0xba1268['parentFolderId']){const _0x15b84b=_0x8b773d[_0x41d75d(0xbd)](_0xba1268['parentFolderId']);if(_0x15b84b){const _0x45f8cc=_0x578cbf(_0x15b84b),_0x4167a6=_0x45f8cc?_0x45f8cc+'/'+_0xba1268[_0x41d75d(0xb0)]:_0xba1268['name'];return _0x1942bf[_0x41d75d(0xb3)](_0xba1268['id'],_0x4167a6),_0x4167a6;}}const _0x938cd4=_0xba1268['name'];return _0x1942bf[_0x41d75d(0xb3)](_0xba1268['id'],_0x938cd4),_0x938cd4;}for(const _0x4d1371 of _0x3c822c){_0x578cbf(_0x4d1371);}return _0x1942bf;}function a153_0x5ed7(){const _0x467191=['4GfwGcg','3YiliCs','91223XkEmkV','get','3211340tERhWk','155298ELlMyz','parentFolderId','name','has','2401819IYbkCX','set','3460jYeXwa','16tFCTYl','2400795RCPGOf','add','356360nccviZ','4405284LJfcEq'];a153_0x5ed7=function(){return _0x467191;};return a153_0x5ed7();}function a153_0x4de1(_0x367f9a,_0x200e10){_0x367f9a=_0x367f9a-0xb0;const _0x5ed7b9=a153_0x5ed7();let _0x4de125=_0x5ed7b9[_0x367f9a];return _0x4de125;}export function buildFolderPathToIdMap(_0x41c279){const _0x1f94dc=a153_0x4de1,_0x522682=new Map(),_0x43e052=new Map();for(const _0x5b4547 of _0x41c279){_0x43e052['set'](_0x5b4547['id'],_0x5b4547);}const _0x2301ab=new Set();for(const _0x2f02e2 of _0x41c279){!_0x2f02e2[_0x1f94dc(0xc0)]&&_0x2301ab[_0x1f94dc(0xb7)](_0x2f02e2['id']);}function _0x2d621f(_0x1bba51){const _0x9ac49e=_0x1f94dc;if(_0x2301ab[_0x9ac49e(0xb1)](_0x1bba51['id']))return'';if(_0x1bba51[_0x9ac49e(0xc0)]){const _0x2206ed=_0x43e052[_0x9ac49e(0xbd)](_0x1bba51[_0x9ac49e(0xc0)]);if(_0x2206ed){const _0x5a70f0=_0x2d621f(_0x2206ed);return _0x5a70f0?_0x5a70f0+'/'+_0x1bba51['name']:_0x1bba51[_0x9ac49e(0xb0)];}}return _0x1bba51[_0x9ac49e(0xb0)];}for(const _0x8fb70c of _0x41c279){const _0x2510fe=_0x2d621f(_0x8fb70c);_0x522682[_0x1f94dc(0xb3)](_0x2510fe,_0x8fb70c['id']);}return _0x522682;}export function buildFolderMaps(_0x3ef273){const _0x54eabb=a153_0x4de1,_0x3d6cf6=buildFolderIdToPathMap(_0x3ef273),_0x3d5ee3=new Map();for(const [_0x23c751,_0x4ad876]of _0x3d6cf6){_0x3d5ee3[_0x54eabb(0xb3)](_0x4ad876,_0x23c751);}return{'idToPath':_0x3d6cf6,'pathToId':_0x3d5ee3};}export function getFolderPath(_0x5d0948,_0x4c5a78){if(!_0x5d0948)return'';return _0x4c5a78['get'](_0x5d0948)??'';}
@@ -1 +1 @@
1
- (function(_0xe0642b,_0xe5e9df){const _0x31ef7d=a154_0x55fe,_0x4c74b5=_0xe0642b();while(!![]){try{const _0xeddb21=parseInt(_0x31ef7d(0x13e))/0x1*(-parseInt(_0x31ef7d(0x143))/0x2)+-parseInt(_0x31ef7d(0x159))/0x3*(-parseInt(_0x31ef7d(0x139))/0x4)+-parseInt(_0x31ef7d(0x154))/0x5+parseInt(_0x31ef7d(0x137))/0x6+-parseInt(_0x31ef7d(0x160))/0x7*(parseInt(_0x31ef7d(0x14d))/0x8)+parseInt(_0x31ef7d(0x15a))/0x9*(-parseInt(_0x31ef7d(0x149))/0xa)+parseInt(_0x31ef7d(0x151))/0xb;if(_0xeddb21===_0xe5e9df)break;else _0x4c74b5['push'](_0x4c74b5['shift']());}catch(_0x169ff0){_0x4c74b5['push'](_0x4c74b5['shift']());}}}(a154_0x225f,0x62fe2));import a154_0x285bf7 from'path';import{parse as a154_0x269aef}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xfedfbd){const _0x318eee=a154_0x55fe;if(!_0xfedfbd||_0xfedfbd[_0x318eee(0x155)]()==='')throw new Error(_0x318eee(0x141));const _0x101062=_0xfedfbd[_0x318eee(0x155)]();if(_0x101062==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xfedfbd};const _0x51b153=_0x101062[_0x318eee(0x152)]('/')?_0x101062['substring'](0x1):_0x101062,_0x365201=_0x51b153['split']('/')[_0x318eee(0x142)](_0x55c473=>_0x55c473!=='');if(_0x365201[_0x318eee(0x157)]===0x0)throw new Error(_0x318eee(0x153));const _0x532b81=_0x101062[_0x318eee(0x152)]('/')||!isRelativePathSegment(_0x365201[0x0]);for(const _0x3ffe80 of _0x365201){validatePathSegment(_0x3ffe80);}return{'segments':_0x365201,'isAbsolute':_0x532b81,'raw':_0xfedfbd};}function isRelativePathSegment(_0xbfe08a){return _0xbfe08a==='.'||_0xbfe08a==='..';}function a154_0x225f(){const _0x5665c6=['3832PxBOXX','push','slice','No\x20tdx.json\x20found\x20for\x20file:\x20','test','381911nFvbig','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Path\x20cannot\x20be\x20empty','filter','4uqlZMB','resolve','segments','journey','exists','File\x20not\x20found:\x20','67420VvKitr','tdx.json','join','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','16UhiFDR','pop','Cannot\x20split\x20empty\x20path','Path\x20segment\x20cannot\x20be\x20empty','14175205sWgOwH','startsWith','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','2417135DloXii','trim','parse','length','isAbsolute','2028OmtthJ','234lDHSFR','type','Path\x20attempts\x20to\x20navigate\x20above\x20root','segment','dirname','readFile','2009945aCGKuV','root','endsWith','2796132yRDAHS','raw'];a154_0x225f=function(){return _0x5665c6;};return a154_0x225f();}function validatePathSegment(_0x4278dc){const _0x2c94aa=a154_0x55fe;if(_0x4278dc==='')throw new Error(_0x2c94aa(0x150));if(_0x4278dc==='.'||_0x4278dc==='..')return;if(/[\x00-\x1F\x7F]/[_0x2c94aa(0x13d)](_0x4278dc))throw new Error(_0x2c94aa(0x140)+_0x4278dc);if(_0x4278dc!==_0x4278dc['trim']()){}}export function validatePath(_0x5394bc){const _0x3b7f2c=a154_0x55fe;if(_0x5394bc[_0x3b7f2c(0x145)][_0x3b7f2c(0x157)]===0x0&&!_0x5394bc[_0x3b7f2c(0x158)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x5394bc[_0x3b7f2c(0x158)]){if(_0x5394bc[_0x3b7f2c(0x145)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x4bbf15=0x0;for(const _0x481cf3 of _0x5394bc[_0x3b7f2c(0x145)]){if(_0x481cf3==='..'){if(_0x4bbf15===0x0)throw new Error(_0x3b7f2c(0x15c));_0x4bbf15--;}else _0x481cf3!=='.'&&_0x4bbf15++;}}}export function joinPaths(_0x596b98,_0x403f14){const _0x213034=a154_0x55fe;if(!_0x596b98||_0x596b98==='/')return _0x403f14;if(!_0x403f14||_0x403f14==='.')return _0x596b98;if(_0x403f14[_0x213034(0x152)]('/'))return _0x403f14;const _0x3a891d=parsePath(_0x596b98),_0x549199=parsePath(_0x403f14),_0x54b9ac=[..._0x3a891d[_0x213034(0x145)]];for(const _0x31e057 of _0x549199[_0x213034(0x145)]){if(_0x31e057==='.')continue;else{if(_0x31e057==='..'){if(_0x54b9ac['length']===0x0)throw new Error(_0x213034(0x13f));_0x54b9ac[_0x213034(0x14e)]();}else _0x54b9ac['push'](_0x31e057);}}const _0xe8ef07=_0x54b9ac[_0x213034(0x14b)]('/');return _0x3a891d[_0x213034(0x138)][_0x213034(0x152)]('/')?'/'+_0xe8ef07:_0xe8ef07;}export function normalizePath(_0x8d7b40){const _0x2d0b6b=a154_0x55fe,_0x2616da=parsePath(_0x8d7b40),_0xd55ca5=[];for(const _0x699e13 of _0x2616da[_0x2d0b6b(0x145)]){if(_0x699e13==='.')continue;else{if(_0x699e13==='..'){if(_0xd55ca5['length']===0x0){if(_0x2616da[_0x2d0b6b(0x158)])throw new Error(_0x2d0b6b(0x13f));_0xd55ca5[_0x2d0b6b(0x13a)]('..');}else _0xd55ca5[_0xd55ca5[_0x2d0b6b(0x157)]-0x1]==='..'?_0xd55ca5[_0x2d0b6b(0x13a)]('..'):_0xd55ca5['pop']();}else _0xd55ca5[_0x2d0b6b(0x13a)](_0x699e13);}}if(_0xd55ca5[_0x2d0b6b(0x157)]===0x0)return _0x2616da[_0x2d0b6b(0x158)]?'/':'.';const _0x561ae9=_0xd55ca5['join']('/');return _0x2616da[_0x2d0b6b(0x138)][_0x2d0b6b(0x152)]('/')?'/'+_0x561ae9:_0x561ae9;}export function getParentPath(_0x5f191d){const _0x1e3bed=a154_0x55fe,_0x57609e=parsePath(_0x5f191d);if(_0x57609e[_0x1e3bed(0x145)][_0x1e3bed(0x157)]<=0x1)return'/';const _0x301c00=_0x57609e['segments']['slice'](0x0,-0x1)['join']('/');return _0x57609e[_0x1e3bed(0x138)][_0x1e3bed(0x152)]('/')?'/'+_0x301c00:_0x301c00;}function a154_0x55fe(_0x13ace0,_0x370e2f){_0x13ace0=_0x13ace0-0x137;const _0x225f44=a154_0x225f();let _0x55fe3b=_0x225f44[_0x13ace0];return _0x55fe3b;}export function getBaseName(_0x2c10e7){const _0x3593e3=a154_0x55fe,_0x381aa4=parsePath(_0x2c10e7);return _0x381aa4[_0x3593e3(0x145)][_0x381aa4['segments'][_0x3593e3(0x157)]-0x1]||'';}export function isChildPath(_0x662bbf,_0x10a218){const _0x130199=a154_0x55fe,_0x47aa8f=parsePath(_0x662bbf),_0x1a815a=parsePath(_0x10a218);if(_0x47aa8f[_0x130199(0x145)][_0x130199(0x157)]<=_0x1a815a['segments'][_0x130199(0x157)])return![];for(let _0x52e83c=0x0;_0x52e83c<_0x1a815a[_0x130199(0x145)][_0x130199(0x157)];_0x52e83c++){if(_0x47aa8f['segments'][_0x52e83c]!==_0x1a815a[_0x130199(0x145)][_0x52e83c])return![];}return!![];}export function splitPath(_0x2628d6){const _0x230dcb=a154_0x55fe,_0x8c05e9=parsePath(_0x2628d6);if(_0x8c05e9[_0x230dcb(0x145)][_0x230dcb(0x157)]===0x0)throw new Error(_0x230dcb(0x14f));if(_0x8c05e9[_0x230dcb(0x145)][_0x230dcb(0x157)]===0x1)return{'parent':_0x8c05e9[_0x230dcb(0x145)][0x0]};return{'parent':_0x8c05e9[_0x230dcb(0x145)][0x0],'child':_0x8c05e9[_0x230dcb(0x145)][_0x230dcb(0x13b)](0x1)[_0x230dcb(0x14b)]('/')};}export function isYamlFilePath(_0x1f24d9){const _0x1a1f26=a154_0x55fe;return _0x1f24d9[_0x1a1f26(0x162)]('.yml')||_0x1f24d9[_0x1a1f26(0x162)]('.yaml');}export async function resolveYamlFilePath(_0x2f4c05,_0x570f2e=nodeFileSystem){const _0x116ad0=a154_0x55fe,_0x1dac70=a154_0x285bf7[_0x116ad0(0x144)](_0x2f4c05);if(!await _0x570f2e[_0x116ad0(0x147)](_0x1dac70))throw new Error(_0x116ad0(0x148)+_0x2f4c05);let _0x39ecdb=a154_0x285bf7[_0x116ad0(0x15e)](_0x1dac70),_0x2669c0=null,_0x18fe32=null;const _0x9c004=a154_0x285bf7['parse'](_0x39ecdb)[_0x116ad0(0x161)];while(_0x39ecdb!==_0x9c004){const _0x140a9f=a154_0x285bf7[_0x116ad0(0x14b)](_0x39ecdb,_0x116ad0(0x14a));if(await _0x570f2e['exists'](_0x140a9f)){_0x2669c0=_0x140a9f,_0x18fe32=_0x39ecdb;break;}_0x39ecdb=a154_0x285bf7[_0x116ad0(0x15e)](_0x39ecdb);}if(!_0x2669c0||!_0x18fe32)throw new Error(_0x116ad0(0x13c)+_0x2f4c05+'\x0a'+_0x116ad0(0x14c));const _0x4b21e9=await _0x570f2e[_0x116ad0(0x15f)](_0x2669c0),_0x24c528=JSON[_0x116ad0(0x156)](_0x4b21e9),_0x207bd4=_0x24c528['parent_segment'];if(!_0x207bd4)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x49b6c5=await _0x570f2e['readFile'](_0x1dac70),_0x1c7561=a154_0x269aef(_0x49b6c5),_0x1cb633=_0x1c7561['name'];if(!_0x1cb633)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x2f4c05);const _0x51ac9a=_0x1c7561[_0x116ad0(0x15b)]===_0x116ad0(0x146)?_0x116ad0(0x146):_0x116ad0(0x15d),_0x31d1e0=a154_0x285bf7['relative'](_0x18fe32,_0x1dac70),_0x2b8138=a154_0x285bf7[_0x116ad0(0x15e)](_0x31d1e0),_0x589b82=_0x2b8138==='.'?'':_0x2b8138['replace'](/\\/g,'/'),_0x5e6506=_0x589b82?_0x207bd4+'/'+_0x589b82+'/'+_0x1cb633:_0x207bd4+'/'+_0x1cb633;return{'parentSegment':_0x207bd4,'segmentName':_0x1cb633,'folderPath':_0x589b82,'fullPath':_0x5e6506,'resourceType':_0x51ac9a,'content':_0x49b6c5};}
1
+ function a154_0x193a(_0x3737ef,_0x2ae0af){_0x3737ef=_0x3737ef-0x70;const _0x5ab76b=a154_0x5ab7();let _0x193a8e=_0x5ab76b[_0x3737ef];return _0x193a8e;}(function(_0x257a5e,_0x4e5929){const _0xa55544=a154_0x193a,_0x91afa8=_0x257a5e();while(!![]){try{const _0x56c200=-parseInt(_0xa55544(0x7f))/0x1*(parseInt(_0xa55544(0x84))/0x2)+-parseInt(_0xa55544(0x8e))/0x3+parseInt(_0xa55544(0x77))/0x4+parseInt(_0xa55544(0x82))/0x5*(-parseInt(_0xa55544(0x8c))/0x6)+parseInt(_0xa55544(0x70))/0x7*(parseInt(_0xa55544(0x8b))/0x8)+parseInt(_0xa55544(0x9a))/0x9*(-parseInt(_0xa55544(0x83))/0xa)+parseInt(_0xa55544(0x72))/0xb;if(_0x56c200===_0x4e5929)break;else _0x91afa8['push'](_0x91afa8['shift']());}catch(_0x56250c){_0x91afa8['push'](_0x91afa8['shift']());}}}(a154_0x5ab7,0x5c1fc));import a154_0x4dfb95 from'path';import{parse as a154_0x5a57dd}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x5897f9){const _0x5231b8=a154_0x193a;if(!_0x5897f9||_0x5897f9['trim']()==='')throw new Error(_0x5231b8(0x8f));const _0x19251d=_0x5897f9['trim']();if(_0x19251d==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5897f9};const _0x1ae24e=_0x19251d[_0x5231b8(0x71)]('/')?_0x19251d[_0x5231b8(0x97)](0x1):_0x19251d,_0x4ddd01=_0x1ae24e[_0x5231b8(0x9d)]('/')[_0x5231b8(0x9c)](_0x37da2f=>_0x37da2f!=='');if(_0x4ddd01[_0x5231b8(0x90)]===0x0)throw new Error(_0x5231b8(0x7c));const _0x4a6d2a=_0x19251d['startsWith']('/')||!isRelativePathSegment(_0x4ddd01[0x0]);for(const _0x137ba2 of _0x4ddd01){validatePathSegment(_0x137ba2);}return{'segments':_0x4ddd01,'isAbsolute':_0x4a6d2a,'raw':_0x5897f9};}function isRelativePathSegment(_0x4e00af){return _0x4e00af==='.'||_0x4e00af==='..';}function validatePathSegment(_0x422d22){const _0x21fa75=a154_0x193a;if(_0x422d22==='')throw new Error(_0x21fa75(0x80));if(_0x422d22==='.'||_0x422d22==='..')return;if(/[\x00-\x1F\x7F]/[_0x21fa75(0x73)](_0x422d22))throw new Error(_0x21fa75(0x93)+_0x422d22);if(_0x422d22!==_0x422d22[_0x21fa75(0x78)]()){}}export function validatePath(_0xa2d723){const _0x2a7415=a154_0x193a;if(_0xa2d723[_0x2a7415(0x7e)][_0x2a7415(0x90)]===0x0&&!_0xa2d723[_0x2a7415(0x7d)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0xa2d723[_0x2a7415(0x7d)]){if(_0xa2d723[_0x2a7415(0x7e)][0x0]==='..')throw new Error(_0x2a7415(0x8a));let _0x33c74f=0x0;for(const _0x311405 of _0xa2d723[_0x2a7415(0x7e)]){if(_0x311405==='..'){if(_0x33c74f===0x0)throw new Error(_0x2a7415(0x7a));_0x33c74f--;}else _0x311405!=='.'&&_0x33c74f++;}}}export function joinPaths(_0x5a9375,_0x431acd){const _0x56a409=a154_0x193a;if(!_0x5a9375||_0x5a9375==='/')return _0x431acd;if(!_0x431acd||_0x431acd==='.')return _0x5a9375;if(_0x431acd['startsWith']('/'))return _0x431acd;const _0x167688=parsePath(_0x5a9375),_0x2b3a67=parsePath(_0x431acd),_0x149cd3=[..._0x167688[_0x56a409(0x7e)]];for(const _0x425dc6 of _0x2b3a67[_0x56a409(0x7e)]){if(_0x425dc6==='.')continue;else{if(_0x425dc6==='..'){if(_0x149cd3[_0x56a409(0x90)]===0x0)throw new Error(_0x56a409(0x81));_0x149cd3['pop']();}else _0x149cd3[_0x56a409(0x79)](_0x425dc6);}}const _0x51336e=_0x149cd3[_0x56a409(0x88)]('/');return _0x167688[_0x56a409(0x94)][_0x56a409(0x71)]('/')?'/'+_0x51336e:_0x51336e;}export function normalizePath(_0x7df32f){const _0x15c0bb=a154_0x193a,_0x47c043=parsePath(_0x7df32f),_0x28d96b=[];for(const _0x2e90f2 of _0x47c043[_0x15c0bb(0x7e)]){if(_0x2e90f2==='.')continue;else{if(_0x2e90f2==='..'){if(_0x28d96b[_0x15c0bb(0x90)]===0x0){if(_0x47c043['isAbsolute'])throw new Error('Cannot\x20navigate\x20above\x20root');_0x28d96b['push']('..');}else _0x28d96b[_0x28d96b['length']-0x1]==='..'?_0x28d96b[_0x15c0bb(0x79)]('..'):_0x28d96b[_0x15c0bb(0x9b)]();}else _0x28d96b[_0x15c0bb(0x79)](_0x2e90f2);}}if(_0x28d96b[_0x15c0bb(0x90)]===0x0)return _0x47c043[_0x15c0bb(0x7d)]?'/':'.';const _0x322220=_0x28d96b[_0x15c0bb(0x88)]('/');return _0x47c043[_0x15c0bb(0x94)][_0x15c0bb(0x71)]('/')?'/'+_0x322220:_0x322220;}export function getParentPath(_0x5e07c9){const _0x4b762b=a154_0x193a,_0x1bc197=parsePath(_0x5e07c9);if(_0x1bc197[_0x4b762b(0x7e)]['length']<=0x1)return'/';const _0x262b1c=_0x1bc197[_0x4b762b(0x7e)][_0x4b762b(0x85)](0x0,-0x1)[_0x4b762b(0x88)]('/');return _0x1bc197['raw'][_0x4b762b(0x71)]('/')?'/'+_0x262b1c:_0x262b1c;}function a154_0x5ab7(){const _0x22042b=['1056966kNXxgV','replace','1305156ZScTHz','Path\x20cannot\x20be\x20empty','length','name','File\x20not\x20found:\x20','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','raw','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','journey','substring','root','Cannot\x20split\x20empty\x20path','326493QqJjtx','pop','filter','split','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','exists','196DNfSQd','startsWith','4183553eTLnDC','test','tdx.json','relative','readFile','1948756cEUSMX','trim','push','Path\x20attempts\x20to\x20navigate\x20above\x20root','parent_segment','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','isAbsolute','segments','12406IXCmWn','Path\x20segment\x20cannot\x20be\x20empty','Cannot\x20navigate\x20above\x20root','5Omngct','10GicvMG','14mvegaZ','slice','.yaml','dirname','join','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','69760JVggLw'];a154_0x5ab7=function(){return _0x22042b;};return a154_0x5ab7();}export function getBaseName(_0x496ad8){const _0x126788=a154_0x193a,_0x17b4e4=parsePath(_0x496ad8);return _0x17b4e4[_0x126788(0x7e)][_0x17b4e4[_0x126788(0x7e)]['length']-0x1]||'';}export function isChildPath(_0x6d1c69,_0x518491){const _0x3d62a6=a154_0x193a,_0x48bcc1=parsePath(_0x6d1c69),_0x505cee=parsePath(_0x518491);if(_0x48bcc1[_0x3d62a6(0x7e)][_0x3d62a6(0x90)]<=_0x505cee[_0x3d62a6(0x7e)]['length'])return![];for(let _0x5afdd6=0x0;_0x5afdd6<_0x505cee[_0x3d62a6(0x7e)][_0x3d62a6(0x90)];_0x5afdd6++){if(_0x48bcc1[_0x3d62a6(0x7e)][_0x5afdd6]!==_0x505cee[_0x3d62a6(0x7e)][_0x5afdd6])return![];}return!![];}export function splitPath(_0x19673c){const _0x280cb8=a154_0x193a,_0xc25723=parsePath(_0x19673c);if(_0xc25723[_0x280cb8(0x7e)][_0x280cb8(0x90)]===0x0)throw new Error(_0x280cb8(0x99));if(_0xc25723[_0x280cb8(0x7e)][_0x280cb8(0x90)]===0x1)return{'parent':_0xc25723[_0x280cb8(0x7e)][0x0]};return{'parent':_0xc25723[_0x280cb8(0x7e)][0x0],'child':_0xc25723[_0x280cb8(0x7e)][_0x280cb8(0x85)](0x1)[_0x280cb8(0x88)]('/')};}export function isYamlFilePath(_0x88b868){const _0x192546=a154_0x193a;return _0x88b868['endsWith']('.yml')||_0x88b868['endsWith'](_0x192546(0x86));}export async function resolveYamlFilePath(_0x128292,_0x206bab=nodeFileSystem){const _0x2eb15a=a154_0x193a,_0x25c30e=a154_0x4dfb95['resolve'](_0x128292);if(!await _0x206bab[_0x2eb15a(0x9f)](_0x25c30e))throw new Error(_0x2eb15a(0x92)+_0x128292);let _0x2eda18=a154_0x4dfb95[_0x2eb15a(0x87)](_0x25c30e),_0x266848=null,_0x5736ae=null;const _0x568a05=a154_0x4dfb95['parse'](_0x2eda18)[_0x2eb15a(0x98)];while(_0x2eda18!==_0x568a05){const _0x302ee2=a154_0x4dfb95[_0x2eb15a(0x88)](_0x2eda18,_0x2eb15a(0x74));if(await _0x206bab['exists'](_0x302ee2)){_0x266848=_0x302ee2,_0x5736ae=_0x2eda18;break;}_0x2eda18=a154_0x4dfb95['dirname'](_0x2eda18);}if(!_0x266848||!_0x5736ae)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x128292+'\x0a'+_0x2eb15a(0x95));const _0x5eadcc=await _0x206bab[_0x2eb15a(0x76)](_0x266848),_0x3e10be=JSON['parse'](_0x5eadcc),_0x9d0b3=_0x3e10be[_0x2eb15a(0x7b)];if(!_0x9d0b3)throw new Error(_0x2eb15a(0x9e));const _0x199c17=await _0x206bab[_0x2eb15a(0x76)](_0x25c30e),_0x1f314c=a154_0x5a57dd(_0x199c17),_0x4ffceb=_0x1f314c[_0x2eb15a(0x91)];if(!_0x4ffceb)throw new Error(_0x2eb15a(0x89)+_0x128292);const _0x29632f=_0x1f314c['type']===_0x2eb15a(0x96)?_0x2eb15a(0x96):'segment',_0x3a9891=a154_0x4dfb95[_0x2eb15a(0x75)](_0x5736ae,_0x25c30e),_0x599cb0=a154_0x4dfb95[_0x2eb15a(0x87)](_0x3a9891),_0x52ac93=_0x599cb0==='.'?'':_0x599cb0[_0x2eb15a(0x8d)](/\\/g,'/'),_0x4a8b6c=_0x52ac93?_0x9d0b3+'/'+_0x52ac93+'/'+_0x4ffceb:_0x9d0b3+'/'+_0x4ffceb;return{'parentSegment':_0x9d0b3,'segmentName':_0x4ffceb,'folderPath':_0x52ac93,'fullPath':_0x4a8b6c,'resourceType':_0x29632f,'content':_0x199c17};}
@@ -1 +1 @@
1
- function a155_0x4e4a(_0x5f33d6,_0x3a3fc3){_0x5f33d6=_0x5f33d6-0xfa;const _0x101314=a155_0x1013();let _0x4e4a71=_0x101314[_0x5f33d6];return _0x4e4a71;}function a155_0x1013(){const _0x227749=['Invalid\x20segment\x20reference\x20format:\x20','6VQtaMg','631492JjrYge','5301Rzdemv','692625rBWjZk','1lvhCCY','818153JdRdUr','302674mohOma','144328kVmRIo','.\x20Child\x20name\x20cannot\x20be\x20empty','indexOf','990110RrQeLm','9zhKaei','substring'];a155_0x1013=function(){return _0x227749;};return a155_0x1013();}(function(_0x5a6990,_0x30a325){const _0x389f6a=a155_0x4e4a,_0x57b509=_0x5a6990();while(!![]){try{const _0x1b538f=parseInt(_0x389f6a(0x106))/0x1*(parseInt(_0x389f6a(0xfa))/0x2)+-parseInt(_0x389f6a(0x104))/0x3+parseInt(_0x389f6a(0x103))/0x4+-parseInt(_0x389f6a(0x105))/0x5+-parseInt(_0x389f6a(0x102))/0x6*(parseInt(_0x389f6a(0x107))/0x7)+-parseInt(_0x389f6a(0xfb))/0x8*(parseInt(_0x389f6a(0xff))/0x9)+parseInt(_0x389f6a(0xfe))/0xa;if(_0x1b538f===_0x30a325)break;else _0x57b509['push'](_0x57b509['shift']());}catch(_0x135b47){_0x57b509['push'](_0x57b509['shift']());}}}(a155_0x1013,0x20791));export function parseSegmentRef(_0x4c37ab){const _0x13b743=a155_0x4e4a,_0x58ba98=_0x4c37ab[_0x13b743(0xfd)]('/');if(_0x58ba98===-0x1)return{'parentId':_0x4c37ab};if(_0x58ba98===0x0)throw new Error(_0x13b743(0x101)+_0x4c37ab+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x496b01=_0x4c37ab[_0x13b743(0x100)](0x0,_0x58ba98),_0x5f42ce=_0x4c37ab[_0x13b743(0x100)](_0x58ba98+0x1);if(_0x5f42ce==='')throw new Error(_0x13b743(0x101)+_0x4c37ab+_0x13b743(0xfc));return{'parentId':_0x496b01,'childId':_0x5f42ce};}
1
+ (function(_0x33c70c,_0x53afe1){const _0xc00b92=a155_0x22c9,_0x1cd86f=_0x33c70c();while(!![]){try{const _0x49c083=-parseInt(_0xc00b92(0x179))/0x1*(-parseInt(_0xc00b92(0x180))/0x2)+-parseInt(_0xc00b92(0x177))/0x3+-parseInt(_0xc00b92(0x17f))/0x4*(parseInt(_0xc00b92(0x17d))/0x5)+parseInt(_0xc00b92(0x176))/0x6*(parseInt(_0xc00b92(0x178))/0x7)+-parseInt(_0xc00b92(0x17b))/0x8+-parseInt(_0xc00b92(0x174))/0x9+-parseInt(_0xc00b92(0x173))/0xa*(-parseInt(_0xc00b92(0x17a))/0xb);if(_0x49c083===_0x53afe1)break;else _0x1cd86f['push'](_0x1cd86f['shift']());}catch(_0x4a2e46){_0x1cd86f['push'](_0x1cd86f['shift']());}}}(a155_0x46a8,0x40342));function a155_0x46a8(){const _0x336796=['substring','70beqzzj','.\x20Parent\x20name\x20cannot\x20be\x20empty','111436BqHxPE','30loSHlH','13775290gMyyHV','4429836AkWpTn','Invalid\x20segment\x20reference\x20format:\x20','198MvNsjO','1565385dHhgfN','52255diGzql','30699eQkKql','11ZlybEK','3338848ySIpjD'];a155_0x46a8=function(){return _0x336796;};return a155_0x46a8();}function a155_0x22c9(_0x36828d,_0x3d77a0){_0x36828d=_0x36828d-0x173;const _0x46a8b9=a155_0x46a8();let _0x22c9f9=_0x46a8b9[_0x36828d];return _0x22c9f9;}export function parseSegmentRef(_0x5e59a0){const _0x39218f=a155_0x22c9,_0x325cdf=_0x5e59a0['indexOf']('/');if(_0x325cdf===-0x1)return{'parentId':_0x5e59a0};if(_0x325cdf===0x0)throw new Error(_0x39218f(0x175)+_0x5e59a0+_0x39218f(0x17e));const _0xf4a4fe=_0x5e59a0[_0x39218f(0x17c)](0x0,_0x325cdf),_0x3b5386=_0x5e59a0['substring'](_0x325cdf+0x1);if(_0x3b5386==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x5e59a0+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0xf4a4fe,'childId':_0x3b5386};}
@@ -1 +1 @@
1
- (function(_0x318002,_0x1f8e4d){const _0x50c02f=a156_0x5b95,_0x233064=_0x318002();while(!![]){try{const _0x271bca=parseInt(_0x50c02f(0x1f6))/0x1+-parseInt(_0x50c02f(0x1d8))/0x2+parseInt(_0x50c02f(0x1e8))/0x3*(parseInt(_0x50c02f(0x1fa))/0x4)+-parseInt(_0x50c02f(0x1f7))/0x5+-parseInt(_0x50c02f(0x1cc))/0x6*(-parseInt(_0x50c02f(0x1da))/0x7)+-parseInt(_0x50c02f(0x1d1))/0x8+parseInt(_0x50c02f(0x1d7))/0x9;if(_0x271bca===_0x1f8e4d)break;else _0x233064['push'](_0x233064['shift']());}catch(_0x3fdcb6){_0x233064['push'](_0x233064['shift']());}}}(a156_0x2727,0x5fddc));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a156_0x5b95(_0x1546ba,_0x479139){_0x1546ba=_0x1546ba-0x1c6;const _0x272730=a156_0x2727();let _0x5b95f8=_0x272730[_0x1546ba];return _0x5b95f8;}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3b62cf,_0x226b5e={},_0x544a13={}){const _0x538dd7=a156_0x5b95;if(_0x544a13[_0x538dd7(0x1fc)])return runSemanticChecks(_0x3b62cf,_0x226b5e);const _0x1759ae=SegmentDefSchema[_0x538dd7(0x1d4)](_0x3b62cf);if(_0x1759ae[_0x538dd7(0x1f4)])return runSemanticChecks(_0x1759ae['data'],_0x226b5e);return zodErrorsToValidationResult(_0x1759ae[_0x538dd7(0x1e0)],_0x226b5e);}export function validateRuleDef(_0x394356,_0x57f0d2,_0x3a8eec){const _0x2d7a99=a156_0x5b95;if(!_0x394356)return[];const _0x2d77e9=RuleDefSchema['safeParse'](_0x394356);if(_0x2d77e9[_0x2d7a99(0x1f4)])return checkRule(_0x2d77e9[_0x2d7a99(0x1c8)],_0x57f0d2,_0x3a8eec);const _0x256a13=flattenZodIssues(_0x2d77e9[_0x2d7a99(0x1e0)][_0x2d7a99(0x1d9)]);return _0x256a13[_0x2d7a99(0x1fb)](_0x38a7f8=>{const _0x22c7af=_0x2d7a99,_0x2376e4=formatZodPath(_0x38a7f8[_0x22c7af(0x1de)]),_0x5c4c10=_0x2376e4?_0x57f0d2+'.'+_0x2376e4:_0x57f0d2,_0x114a5d=mapZodIssueToCode(_0x38a7f8,_0x2376e4),_0x2f206a=getLocationFromPath(_0x3a8eec[_0x22c7af(0x1f3)],_0x3a8eec[_0x22c7af(0x201)],pathToArray(_0x5c4c10));return{'level':_0x22c7af(0x1e0),'path':_0x5c4c10,'code':_0x114a5d,'message':_0x38a7f8['message'],..._0x2f206a&&{'location':_0x2f206a}};});}function zodErrorsToValidationResult(_0x5e524e,_0x4de4d7){const _0x3e7af1=a156_0x5b95,_0x55e3af=flattenZodIssues(_0x5e524e[_0x3e7af1(0x1d9)]),_0x4fc4cc=_0x55e3af[_0x3e7af1(0x1fb)](_0x5d0d38=>{const _0x370752=_0x3e7af1,_0x20253b=formatZodPath(_0x5d0d38[_0x370752(0x1de)]),_0x20563e=mapZodIssueToCode(_0x5d0d38,_0x20253b),_0x142863=getLocationFromPath(_0x4de4d7[_0x370752(0x1f3)],_0x4de4d7['source'],_0x5d0d38['path'][_0x370752(0x1fb)](_0x2c29de=>typeof _0x2c29de==='symbol'?String(_0x2c29de):_0x2c29de));return{'level':_0x370752(0x1e0),'path':_0x20253b,'code':_0x20563e,'message':_0x5d0d38[_0x370752(0x208)],..._0x142863&&{'location':_0x142863}};});return{'valid':![],'errors':_0x4fc4cc,'warnings':[]};}function mapZodIssueToCode(_0x28762d,_0x22689d){const _0x3d9217=a156_0x5b95,_0x15b416=_0x28762d[_0x3d9217(0x203)]===_0x3d9217(0x1ea)?_0x28762d['params']:undefined;if(_0x22689d===_0x3d9217(0x1e5))return _0x3d9217(0x20a);if(_0x22689d==='rule.type'||_0x22689d[_0x3d9217(0x206)](_0x3d9217(0x1e6))){if(_0x28762d[_0x3d9217(0x203)]===_0x3d9217(0x1cf)){if(_0x22689d==='rule.type'||_0x22689d[_0x3d9217(0x1dc)](/\.conditions\[\d+\]\.type$/))return _0x3d9217(0x1f2);}}if(_0x22689d[_0x3d9217(0x206)](_0x3d9217(0x1f8)))return _0x3d9217(0x1c7);if(_0x22689d[_0x3d9217(0x206)](_0x3d9217(0x1e4)))return _0x3d9217(0x1cd);if(_0x15b416?.['validationCode']===_0x3d9217(0x1fd))return _0x3d9217(0x1fd);if(_0x15b416?.['validationCode']===_0x3d9217(0x20d))return _0x3d9217(0x20d);if(_0x22689d[_0x3d9217(0x206)](_0x3d9217(0x1db))||_0x22689d==='conditions')return'MISSING_CONDITIONS';if(_0x22689d[_0x3d9217(0x200)]('arrayMatching'))return _0x3d9217(0x20b);if(_0x22689d[_0x3d9217(0x206)]('.segment'))return _0x3d9217(0x1f0);return'SEGMENT_SCHEMA_ERROR';}function a156_0x2727(){const _0x4ba549=['\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','3418584wzIInj','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','Behavior','safeParse','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','6496704VhuhUM','1548702icXcRU','issues','14bbhsDX','.conditions','match','EMPTY_ATTRIBUTE','path','filter','error','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','.conditions[','length','.operator.value','name','.type','Attribute\x20\x27','3ynuhIs','\x27\x20with\x20attribute\x20\x27','custom','BEHAVIOR_SOURCE_MISSING_FILTER','rule','.attribute','Behavior\x20source\x20\x27','warning','MISSING_SEGMENT_REFERENCE','.source','INVALID_RULE_TYPE','document','success','aggregation','597037JAKpsY','2033315qQuRoO','.operator.type','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','183232KcCZML','map','skipSchema','MISSING_BETWEEN_BOUNDS','Attribute\x20name\x20cannot\x20be\x20empty','EMPTY_CONDITIONS','includes','source','NESTED_CONDITION_GROUP','code','conditions','type','endsWith','level','message','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','MISSING_NAME','INVALID_ARRAY_MATCHING','attribute','MISSING_TIME_UNIT','Value','INVALID_OPERATOR_TYPE','data','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','push','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','1908912FalNit','MISSING_OPERATOR_VALUE','.filter','invalid_value'];a156_0x2727=function(){return _0x4ba549;};return a156_0x2727();}function runSemanticChecks(_0x1c6057,_0x1d220f){const _0x1e3722=a156_0x5b95,_0x425a52=[];_0x1c6057['rule']&&_0x425a52[_0x1e3722(0x1ca)](...checkRule(_0x1c6057[_0x1e3722(0x1ec)],'rule',_0x1d220f));const _0x4ec6cf=_0x425a52[_0x1e3722(0x1df)](_0x3000a9=>_0x3000a9[_0x1e3722(0x207)]===_0x1e3722(0x1e0)),_0x8bfbb4=_0x425a52[_0x1e3722(0x1df)](_0x3a4a77=>_0x3a4a77[_0x1e3722(0x207)]===_0x1e3722(0x1ef));return{'valid':_0x4ec6cf[_0x1e3722(0x1e3)]===0x0,'errors':_0x4ec6cf,'warnings':_0x8bfbb4};}function checkRule(_0x359a39,_0x265fad,_0xe78cde){const _0x3c78f0=a156_0x5b95,_0x136ed1=[];if(_0x359a39[_0x3c78f0(0x204)]['length']===0x0)return _0x136ed1[_0x3c78f0(0x1ca)]({'level':_0x3c78f0(0x1e0),'path':_0x265fad+_0x3c78f0(0x1db),'code':_0x3c78f0(0x1ff),'message':_0x3c78f0(0x1d5),'location':getLocationFromPath(_0xe78cde[_0x3c78f0(0x1f3)],_0xe78cde[_0x3c78f0(0x201)],pathToArray(_0x265fad+_0x3c78f0(0x1db)))}),_0x136ed1;return _0x136ed1[_0x3c78f0(0x1ca)](...checkConditions(_0x359a39[_0x3c78f0(0x204)],_0x265fad,_0xe78cde)),_0x136ed1;}function checkConditions(_0x5c897d,_0x87a548,_0x32b194){const _0x15d4e0=a156_0x5b95,_0x33ac58=[];for(let _0x502ce0=0x0;_0x502ce0<_0x5c897d['length'];_0x502ce0++){const _0x29a9ee=_0x5c897d[_0x502ce0],_0x48df05=_0x87a548+_0x15d4e0(0x1e2)+_0x502ce0+']';_0x33ac58['push'](...checkCondition(_0x29a9ee,_0x48df05,_0x32b194));}return _0x33ac58;}function checkCondition(_0x2a0a10,_0x4962b0,_0x5efbf4){const _0x426f1e=a156_0x5b95,_0x4f13b1=[];if(_0x2a0a10[_0x426f1e(0x205)]==='And'||_0x2a0a10[_0x426f1e(0x205)]==='Or')return _0x2a0a10['conditions'][_0x426f1e(0x1e3)]===0x0?_0x4f13b1[_0x426f1e(0x1ca)]({'level':_0x426f1e(0x1e0),'path':_0x4962b0+_0x426f1e(0x1db),'code':_0x426f1e(0x1ff),'message':_0x2a0a10[_0x426f1e(0x205)]+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x5efbf4[_0x426f1e(0x1f3)],_0x5efbf4[_0x426f1e(0x201)],pathToArray(_0x4962b0+'.conditions'))}):(_0x4f13b1['push']({'level':_0x426f1e(0x1ef),'path':_0x4962b0,'code':_0x426f1e(0x202),'message':_0x2a0a10[_0x426f1e(0x205)]+_0x426f1e(0x1d2)+_0x426f1e(0x1f9)+_0x426f1e(0x1d6),'location':getLocationFromPath(_0x5efbf4['document'],_0x5efbf4[_0x426f1e(0x201)],pathToArray(_0x4962b0))}),_0x4f13b1[_0x426f1e(0x1ca)](...checkConditions(_0x2a0a10[_0x426f1e(0x204)],_0x4962b0,_0x5efbf4))),_0x4f13b1;if(_0x2a0a10['type']===_0x426f1e(0x1c6)||_0x2a0a10[_0x426f1e(0x205)]===_0x426f1e(0x1d3)){const _0x4f2324=_0x2a0a10,_0x28b880=_0x4f2324['source'],_0x189966=_0x4f2324[_0x426f1e(0x1f5)],_0x10875c=_0x28b880||_0x189966;(!_0x4f2324[_0x426f1e(0x20c)]||_0x4f2324[_0x426f1e(0x20c)]==='')&&(!_0x10875c&&_0x4f13b1[_0x426f1e(0x1ca)]({'level':_0x426f1e(0x1e0),'path':_0x4962b0+'.attribute','code':_0x426f1e(0x1dd),'message':_0x426f1e(0x1fe),'location':getLocationFromPath(_0x5efbf4[_0x426f1e(0x1f3)],_0x5efbf4['source'],pathToArray(_0x4962b0+'.attribute'))}));_0x4f2324[_0x426f1e(0x1df)]&&_0x4f13b1[_0x426f1e(0x1ca)](...checkRule(_0x4f2324[_0x426f1e(0x1df)],_0x4962b0+_0x426f1e(0x1ce),_0x5efbf4));if(_0x4f2324[_0x426f1e(0x201)]){const _0x3e17d7=_0x4f2324[_0x426f1e(0x20c)]&&_0x4f2324[_0x426f1e(0x20c)]!=='';_0x3e17d7&&!_0x4f2324[_0x426f1e(0x1df)]&&_0x4f13b1['push']({'level':_0x426f1e(0x1e0),'path':_0x4962b0+_0x426f1e(0x1f1),'code':_0x426f1e(0x1eb),'message':_0x426f1e(0x1ee)+_0x4f2324[_0x426f1e(0x201)]+_0x426f1e(0x1e9)+_0x4f2324[_0x426f1e(0x20c)]+'\x27\x20'+_0x426f1e(0x1cb)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x426f1e(0x1e1),'location':getLocationFromPath(_0x5efbf4['document'],_0x5efbf4[_0x426f1e(0x201)],pathToArray(_0x4962b0+_0x426f1e(0x1f1)))}),_0x3e17d7&&_0x4f2324[_0x426f1e(0x1df)]&&_0x4f13b1[_0x426f1e(0x1ca)]({'level':_0x426f1e(0x1ef),'path':_0x4962b0+_0x426f1e(0x1ed),'code':_0x426f1e(0x1c9),'message':_0x426f1e(0x1e7)+_0x4f2324[_0x426f1e(0x20c)]+_0x426f1e(0x1d0)+_0x426f1e(0x209),'location':getLocationFromPath(_0x5efbf4[_0x426f1e(0x1f3)],_0x5efbf4['source'],pathToArray(_0x4962b0+'.attribute'))});}}return _0x4f13b1;}
1
+ (function(_0x6f979c,_0x3a83af){const _0x101e72=a156_0x42ad,_0x2a1f0f=_0x6f979c();while(!![]){try{const _0x346708=-parseInt(_0x101e72(0x10d))/0x1*(parseInt(_0x101e72(0x10b))/0x2)+parseInt(_0x101e72(0xdf))/0x3*(-parseInt(_0x101e72(0xf0))/0x4)+-parseInt(_0x101e72(0xec))/0x5+parseInt(_0x101e72(0xdc))/0x6+-parseInt(_0x101e72(0xff))/0x7+parseInt(_0x101e72(0xe9))/0x8+parseInt(_0x101e72(0x122))/0x9*(parseInt(_0x101e72(0x121))/0xa);if(_0x346708===_0x3a83af)break;else _0x2a1f0f['push'](_0x2a1f0f['shift']());}catch(_0x425aae){_0x2a1f0f['push'](_0x2a1f0f['shift']());}}}(a156_0x3e57,0x5e135));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a156_0x3e57(){const _0x105550=['4040841thiDAX','EMPTY_ATTRIBUTE','issues','Attribute\x20\x27','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','Behavior\x20source\x20\x27','Attribute\x20name\x20cannot\x20be\x20empty','success','rule','validationCode','SEGMENT_SCHEMA_ERROR','10DWLTHh','conditions','83343USNWvD','symbol','.operator.type','MISSING_TIME_UNIT','.source','MISSING_OPERATOR_VALUE','match','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','.conditions','path','push','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','Value','arrayMatching','MISSING_SEGMENT_REFERENCE','EMPTY_CONDITIONS','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','custom','level','70mnYQvd','1226007dlNyxq','BEHAVIOR_SOURCE_MISSING_FILTER','4165818aiWdOF','safeParse','endsWith','24mRQCXD','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','name','type','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','.segment','length','INVALID_RULE_TYPE','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','invalid_value','3811280ieOgCf','.conditions[','data','2702455mwZhrA','source','.filter','skipSchema','102236kKfgfO','Behavior','\x27\x20with\x20attribute\x20\x27','aggregation','MISSING_BETWEEN_BOUNDS','map','document','rule.type','.attribute','message','attribute','code','NESTED_CONDITION_GROUP','warning','filter'];a156_0x3e57=function(){return _0x105550;};return a156_0x3e57();}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3f75e9,_0x463662={},_0x26e5d3={}){const _0x3f4c27=a156_0x42ad;if(_0x26e5d3[_0x3f4c27(0xef)])return runSemanticChecks(_0x3f75e9,_0x463662);const _0x1687fe=SegmentDefSchema[_0x3f4c27(0xdd)](_0x3f75e9);if(_0x1687fe[_0x3f4c27(0x107)])return runSemanticChecks(_0x1687fe[_0x3f4c27(0xeb)],_0x463662);return zodErrorsToValidationResult(_0x1687fe['error'],_0x463662);}export function validateRuleDef(_0x5e708a,_0x4faf2f,_0x732f99){const _0x560c62=a156_0x42ad;if(!_0x5e708a)return[];const _0x555399=RuleDefSchema[_0x560c62(0xdd)](_0x5e708a);if(_0x555399[_0x560c62(0x107)])return checkRule(_0x555399['data'],_0x4faf2f,_0x732f99);const _0x4980b4=flattenZodIssues(_0x555399[_0x560c62(0x104)][_0x560c62(0x101)]);return _0x4980b4[_0x560c62(0xf5)](_0x24d7cb=>{const _0x163b52=_0x560c62,_0x5526f3=formatZodPath(_0x24d7cb[_0x163b52(0x117)]),_0x4cfcf9=_0x5526f3?_0x4faf2f+'.'+_0x5526f3:_0x4faf2f,_0x9439a0=mapZodIssueToCode(_0x24d7cb,_0x5526f3),_0x13bc78=getLocationFromPath(_0x732f99[_0x163b52(0xf6)],_0x732f99[_0x163b52(0xed)],pathToArray(_0x4cfcf9));return{'level':_0x163b52(0x104),'path':_0x4cfcf9,'code':_0x9439a0,'message':_0x24d7cb[_0x163b52(0xf9)],..._0x13bc78&&{'location':_0x13bc78}};});}function zodErrorsToValidationResult(_0x1c5573,_0x50e6d5){const _0x1d8cc0=a156_0x42ad,_0x5ecc30=flattenZodIssues(_0x1c5573['issues']),_0x24b756=_0x5ecc30[_0x1d8cc0(0xf5)](_0x63cf08=>{const _0xe73581=_0x1d8cc0,_0x2fc46d=formatZodPath(_0x63cf08[_0xe73581(0x117)]),_0x3ff398=mapZodIssueToCode(_0x63cf08,_0x2fc46d),_0x3062cf=getLocationFromPath(_0x50e6d5[_0xe73581(0xf6)],_0x50e6d5[_0xe73581(0xed)],_0x63cf08[_0xe73581(0x117)][_0xe73581(0xf5)](_0x1b812c=>typeof _0x1b812c===_0xe73581(0x10e)?String(_0x1b812c):_0x1b812c));return{'level':_0xe73581(0x104),'path':_0x2fc46d,'code':_0x3ff398,'message':_0x63cf08[_0xe73581(0xf9)],..._0x3062cf&&{'location':_0x3062cf}};});return{'valid':![],'errors':_0x24b756,'warnings':[]};}function mapZodIssueToCode(_0xf25ff8,_0x4f9048){const _0x2275a7=a156_0x42ad,_0x43aaac=_0xf25ff8[_0x2275a7(0xfb)]===_0x2275a7(0x11f)?_0xf25ff8['params']:undefined;if(_0x4f9048===_0x2275a7(0xe1))return'MISSING_NAME';if(_0x4f9048===_0x2275a7(0xf7)||_0x4f9048['endsWith']('.type')){if(_0xf25ff8['code']===_0x2275a7(0xe8)){if(_0x4f9048==='rule.type'||_0x4f9048[_0x2275a7(0x113)](/\.conditions\[\d+\]\.type$/))return _0x2275a7(0xe6);}}if(_0x4f9048['endsWith'](_0x2275a7(0x10f)))return'INVALID_OPERATOR_TYPE';if(_0x4f9048[_0x2275a7(0xde)]('.operator.value'))return _0x2275a7(0x112);if(_0x43aaac?.[_0x2275a7(0x109)]==='MISSING_BETWEEN_BOUNDS')return _0x2275a7(0xf4);if(_0x43aaac?.['validationCode']===_0x2275a7(0x110))return'MISSING_TIME_UNIT';if(_0x4f9048[_0x2275a7(0xde)](_0x2275a7(0x116))||_0x4f9048===_0x2275a7(0x10c))return'MISSING_CONDITIONS';if(_0x4f9048['includes'](_0x2275a7(0x11b)))return'INVALID_ARRAY_MATCHING';if(_0x4f9048[_0x2275a7(0xde)](_0x2275a7(0xe4)))return _0x2275a7(0x11c);return _0x2275a7(0x10a);}function runSemanticChecks(_0x18b9cd,_0x2b439c){const _0xe897f6=a156_0x42ad,_0x195f12=[];_0x18b9cd[_0xe897f6(0x108)]&&_0x195f12[_0xe897f6(0x118)](...checkRule(_0x18b9cd[_0xe897f6(0x108)],_0xe897f6(0x108),_0x2b439c));const _0x1cda8b=_0x195f12[_0xe897f6(0xfe)](_0x6073fa=>_0x6073fa['level']===_0xe897f6(0x104)),_0x4b077d=_0x195f12[_0xe897f6(0xfe)](_0x1a70a9=>_0x1a70a9[_0xe897f6(0x120)]===_0xe897f6(0xfd));return{'valid':_0x1cda8b['length']===0x0,'errors':_0x1cda8b,'warnings':_0x4b077d};}function checkRule(_0x342ef5,_0x5140ca,_0x5c70f9){const _0x15b55a=a156_0x42ad,_0x357e60=[];if(_0x342ef5[_0x15b55a(0x10c)][_0x15b55a(0xe5)]===0x0)return _0x357e60[_0x15b55a(0x118)]({'level':_0x15b55a(0x104),'path':_0x5140ca+_0x15b55a(0x116),'code':_0x15b55a(0x11d),'message':_0x15b55a(0x11e),'location':getLocationFromPath(_0x5c70f9[_0x15b55a(0xf6)],_0x5c70f9[_0x15b55a(0xed)],pathToArray(_0x5140ca+'.conditions'))}),_0x357e60;return _0x357e60[_0x15b55a(0x118)](...checkConditions(_0x342ef5['conditions'],_0x5140ca,_0x5c70f9)),_0x357e60;}function checkConditions(_0x19bdd7,_0x29196f,_0x36a8e0){const _0x173e94=a156_0x42ad,_0x31c009=[];for(let _0x300aef=0x0;_0x300aef<_0x19bdd7['length'];_0x300aef++){const _0x5b0ca3=_0x19bdd7[_0x300aef],_0x4dd22c=_0x29196f+_0x173e94(0xea)+_0x300aef+']';_0x31c009['push'](...checkCondition(_0x5b0ca3,_0x4dd22c,_0x36a8e0));}return _0x31c009;}function a156_0x42ad(_0x57f1da,_0x4b446f){_0x57f1da=_0x57f1da-0xdc;const _0x3e57b2=a156_0x3e57();let _0x42ad61=_0x3e57b2[_0x57f1da];return _0x42ad61;}function checkCondition(_0x15d6b9,_0x14fa14,_0x241a70){const _0x3839a6=a156_0x42ad,_0x4ee718=[];if(_0x15d6b9['type']==='And'||_0x15d6b9[_0x3839a6(0xe2)]==='Or')return _0x15d6b9['conditions'][_0x3839a6(0xe5)]===0x0?_0x4ee718[_0x3839a6(0x118)]({'level':_0x3839a6(0x104),'path':_0x14fa14+_0x3839a6(0x116),'code':_0x3839a6(0x11d),'message':_0x15d6b9[_0x3839a6(0xe2)]+_0x3839a6(0x115),'location':getLocationFromPath(_0x241a70[_0x3839a6(0xf6)],_0x241a70['source'],pathToArray(_0x14fa14+_0x3839a6(0x116)))}):(_0x4ee718[_0x3839a6(0x118)]({'level':_0x3839a6(0xfd),'path':_0x14fa14,'code':_0x3839a6(0xfc),'message':_0x15d6b9[_0x3839a6(0xe2)]+_0x3839a6(0x114)+_0x3839a6(0xe7)+_0x3839a6(0xe0),'location':getLocationFromPath(_0x241a70[_0x3839a6(0xf6)],_0x241a70['source'],pathToArray(_0x14fa14))}),_0x4ee718[_0x3839a6(0x118)](...checkConditions(_0x15d6b9[_0x3839a6(0x10c)],_0x14fa14,_0x241a70))),_0x4ee718;if(_0x15d6b9[_0x3839a6(0xe2)]===_0x3839a6(0x11a)||_0x15d6b9['type']===_0x3839a6(0xf1)){const _0x4931c9=_0x15d6b9,_0x12e163=_0x4931c9['source'],_0xef97a9=_0x4931c9[_0x3839a6(0xf3)],_0x127ba2=_0x12e163||_0xef97a9;(!_0x4931c9[_0x3839a6(0xfa)]||_0x4931c9[_0x3839a6(0xfa)]==='')&&(!_0x127ba2&&_0x4ee718[_0x3839a6(0x118)]({'level':_0x3839a6(0x104),'path':_0x14fa14+_0x3839a6(0xf8),'code':_0x3839a6(0x100),'message':_0x3839a6(0x106),'location':getLocationFromPath(_0x241a70[_0x3839a6(0xf6)],_0x241a70[_0x3839a6(0xed)],pathToArray(_0x14fa14+_0x3839a6(0xf8)))}));_0x4931c9[_0x3839a6(0xfe)]&&_0x4ee718[_0x3839a6(0x118)](...checkRule(_0x4931c9[_0x3839a6(0xfe)],_0x14fa14+_0x3839a6(0xee),_0x241a70));if(_0x4931c9['source']){const _0x22d302=_0x4931c9[_0x3839a6(0xfa)]&&_0x4931c9[_0x3839a6(0xfa)]!=='';_0x22d302&&!_0x4931c9[_0x3839a6(0xfe)]&&_0x4ee718[_0x3839a6(0x118)]({'level':_0x3839a6(0x104),'path':_0x14fa14+'.source','code':_0x3839a6(0x123),'message':_0x3839a6(0x105)+_0x4931c9['source']+_0x3839a6(0xf2)+_0x4931c9['attribute']+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x3839a6(0x103)+_0x3839a6(0xe3),'location':getLocationFromPath(_0x241a70[_0x3839a6(0xf6)],_0x241a70[_0x3839a6(0xed)],pathToArray(_0x14fa14+_0x3839a6(0x111)))}),_0x22d302&&_0x4931c9[_0x3839a6(0xfe)]&&_0x4ee718[_0x3839a6(0x118)]({'level':_0x3839a6(0xfd),'path':_0x14fa14+_0x3839a6(0xf8),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x3839a6(0x102)+_0x4931c9[_0x3839a6(0xfa)]+_0x3839a6(0x119)+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x241a70[_0x3839a6(0xf6)],_0x241a70[_0x3839a6(0xed)],pathToArray(_0x14fa14+'.attribute'))});}}return _0x4ee718;}