@treasuredata/tdx 2026.3.40 → 2026.3.42

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 (224) 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.d.ts.map +1 -1
  141. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  143. package/dist/sdk/segment/fields-display.js +1 -1
  144. package/dist/sdk/segment/file-discovery.js +1 -1
  145. package/dist/sdk/segment/journey-utils.js +1 -1
  146. package/dist/sdk/segment/journey-validator.js +1 -1
  147. package/dist/sdk/segment/journey-yaml.js +1 -1
  148. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  149. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/pull-workflow.js +1 -1
  151. package/dist/sdk/segment/push-recovery.js +1 -1
  152. package/dist/sdk/segment/push-workflow.js +1 -1
  153. package/dist/sdk/segment/resolution-context.js +1 -1
  154. package/dist/sdk/segment/segment-path-parser.js +1 -1
  155. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  156. package/dist/sdk/segment/segment-validator.js +1 -1
  157. package/dist/sdk/segment/segment-validator.js.map +1 -1
  158. package/dist/sdk/segment/target-resolution.js +1 -1
  159. package/dist/sdk/segment/tdx-config.js +1 -1
  160. package/dist/sdk/segment/types/activation-schema.js +1 -1
  161. package/dist/sdk/segment/types/journey-def.js +1 -1
  162. package/dist/sdk/segment/types/journey-schema.js +1 -1
  163. package/dist/sdk/segment/types/segment-def.js +1 -1
  164. package/dist/sdk/segment/types/segment-schema.js +1 -1
  165. package/dist/sdk/segment/validate-files.js +1 -1
  166. package/dist/sdk/segment/yaml-validator.js +1 -1
  167. package/dist/sdk/segment.js +1 -1
  168. package/dist/sdk/types/cdp.d.ts +3 -0
  169. package/dist/sdk/types/cdp.d.ts.map +1 -1
  170. package/dist/sdk/types/index.js +1 -1
  171. package/dist/sdk/types/progress.js +1 -1
  172. package/dist/sdk/types/workspace.js +1 -1
  173. package/dist/sdk/user.js +1 -1
  174. package/dist/sdk/util/format-detector.js +1 -1
  175. package/dist/sdk/util/formatters.js +1 -1
  176. package/dist/sdk/util/index.js +1 -1
  177. package/dist/sdk/util/paginate.js +1 -1
  178. package/dist/sdk/util/tree-formatter.js +1 -1
  179. package/dist/sdk/workflow/archive-validation.js +1 -1
  180. package/dist/sdk/workflow/clone-workflow.js +1 -1
  181. package/dist/sdk/workflow/index.js +1 -1
  182. package/dist/sdk/workflow/pull-workflow.js +1 -1
  183. package/dist/sdk/workflow/push-workflow.js +1 -1
  184. package/dist/sdk/workflow/tdx-config.js +1 -1
  185. package/dist/sdk/workflow/workflow-utils.js +1 -1
  186. package/dist/sdk/workspace/frontmatter.js +1 -1
  187. package/dist/sdk/workspace/git.js +1 -1
  188. package/dist/sdk/workspace/index.js +1 -1
  189. package/dist/sdk/workspace/templates.js +1 -1
  190. package/dist/sdk/workspace/weekly.js +1 -1
  191. package/dist/sdk/workspace/wikilinks.js +1 -1
  192. package/dist/test-utils/command-runner.js +1 -1
  193. package/dist/test-utils/factories.js +1 -1
  194. package/dist/test-utils/fixtures.js +1 -1
  195. package/dist/test-utils/http-mock.js +1 -1
  196. package/dist/test-utils/index.js +1 -1
  197. package/dist/utils/async.js +1 -1
  198. package/dist/utils/colors.js +1 -1
  199. package/dist/utils/diff.js +1 -1
  200. package/dist/utils/file-permissions.js +1 -1
  201. package/dist/utils/file-reader.js +1 -1
  202. package/dist/utils/github-releases.js +1 -1
  203. package/dist/utils/global-cache.js +1 -1
  204. package/dist/utils/json-loader.js +1 -1
  205. package/dist/utils/local-cache.js +1 -1
  206. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  207. package/dist/utils/logger/formatters/index.js +1 -1
  208. package/dist/utils/logger/handlers/console-handler.js +1 -1
  209. package/dist/utils/logger/handlers/file-handler.js +1 -1
  210. package/dist/utils/logger/handlers/index.js +1 -1
  211. package/dist/utils/logger/handlers/null-handler.js +1 -1
  212. package/dist/utils/logger/index.js +1 -1
  213. package/dist/utils/logger/logger.js +1 -1
  214. package/dist/utils/logger/types.js +1 -1
  215. package/dist/utils/option-validation.js +1 -1
  216. package/dist/utils/process.js +1 -1
  217. package/dist/utils/prompt.js +1 -1
  218. package/dist/utils/spinner.js +1 -1
  219. package/dist/utils/sse-parser.js +1 -1
  220. package/dist/utils/string-utils.js +1 -1
  221. package/dist/utils/table-ref-parser.js +1 -1
  222. package/dist/utils/tdx-logger.js +1 -1
  223. package/dist/utils/version-check.js +1 -1
  224. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x38ecd4=a152_0x3394;(function(_0x52097d,_0x59f9f5){const _0x13dcd7=a152_0x3394,_0x56a35e=_0x52097d();while(!![]){try{const _0x8395b2=parseInt(_0x13dcd7(0x146))/0x1+parseInt(_0x13dcd7(0x11f))/0x2+-parseInt(_0x13dcd7(0x156))/0x3*(parseInt(_0x13dcd7(0x170))/0x4)+parseInt(_0x13dcd7(0x188))/0x5*(parseInt(_0x13dcd7(0x1ce))/0x6)+parseInt(_0x13dcd7(0x1cf))/0x7*(-parseInt(_0x13dcd7(0x142))/0x8)+parseInt(_0x13dcd7(0x17d))/0x9+parseInt(_0x13dcd7(0x114))/0xa*(parseInt(_0x13dcd7(0x178))/0xb);if(_0x8395b2===_0x59f9f5)break;else _0x56a35e['push'](_0x56a35e['shift']());}catch(_0x589bb4){_0x56a35e['push'](_0x56a35e['shift']());}}}(a152_0x2183,0x5cb83));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a152_0x38ecd4(0x171);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0xc44a78){return''+PENDING_SEGMENT_PREFIX+_0xc44a78+'__';}export function isPendingSegmentId(_0x3e518d){const _0x1f0260=a152_0x38ecd4;return _0x3e518d[_0x1f0260(0x1b8)](PENDING_SEGMENT_PREFIX)&&!_0x3e518d[_0x1f0260(0x1b8)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x24b402){return _0x24b402['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x2ce25a){return''+PENDING_ACTIVATION_PREFIX+_0x2ce25a+'__';}export function isPendingActivationId(_0x119f1d){return _0x119f1d['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5d7241){const _0x12c91c=a152_0x38ecd4;return _0x5d7241[_0x12c91c(0x1a8)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x303518,_0x188fae){const _0x546bbd=a152_0x38ecd4,_0x4a666c=_0x303518+'::'+(_0x188fae[_0x546bbd(0xf4)]()||_0x546bbd(0x1b6)),_0xf8f4ce=createHash('sha1')['update'](_0x4a666c)[_0x546bbd(0x1e0)](_0x546bbd(0xea))[_0x546bbd(0x1a1)](0x0,0xc);return _0x546bbd(0x1df)+_0xf8f4ce;}export function ensureJourneyDefaults(_0x5af5c4){const _0x43090d=a152_0x38ecd4;!_0x5af5c4[_0x43090d(0x1d9)]&&(_0x5af5c4[_0x43090d(0x1d9)]=''),!_0x5af5c4['state']&&(_0x5af5c4[_0x43090d(0x16f)]=_0x43090d(0x109));}export function injectExistingStageIds(_0x2d12c2,_0x5ab696){const _0x28e190=a152_0x38ecd4,_0x4e3322=new Map(_0x5ab696[_0x28e190(0x177)](_0x318a31=>[_0x318a31['name'],_0x318a31['id']]));for(const _0x2255bf of _0x2d12c2){if(!_0x2255bf['id']){const _0x34569d=_0x4e3322['get'](_0x2255bf['name']);_0x34569d&&(_0x2255bf['id']=_0x34569d);}}}export function resolveTDFolderPath(_0x3706b8,_0x1cf5af,_0x413529){if(!_0x1cf5af)return _0x3706b8;if(_0x3706b8===_0x413529||_0x3706b8['startsWith'](_0x413529+'/'))return _0x3706b8;return _0x3706b8?_0x413529+'/'+_0x3706b8:_0x413529;}export function addFoldersToCreate(_0x239c49,_0x414ec2,_0x50d061){const _0x57687c=a152_0x38ecd4;if(!_0x239c49)return;if(_0x414ec2[_0x57687c(0x153)](_0x239c49))return;const _0x280e01=_0x239c49[_0x57687c(0x16b)]('/');let _0x9874ff='';for(const _0x366284 of _0x280e01){_0x9874ff=_0x9874ff?_0x9874ff+'/'+_0x366284:_0x366284,!_0x414ec2[_0x57687c(0x153)](_0x9874ff)&&_0x50d061[_0x57687c(0x195)](_0x9874ff);}}export function sortFoldersByDepth(_0x35ddab){return[..._0x35ddab]['sort']((_0x66685b,_0x3e6a6a)=>{const _0x354b56=a152_0x3394,_0x53972c=(_0x66685b[_0x354b56(0x15f)](/\//g)||[])[_0x354b56(0x113)],_0x1c5659=(_0x3e6a6a[_0x354b56(0x15f)](/\//g)||[])[_0x354b56(0x113)];return _0x53972c-_0x1c5659;});}import*as a152_0x3f7eae from'yaml';import{readFileSync}from'fs';import a152_0x2dbdcb from'path';import{isJourneyDef,parseYamlString as a152_0x2ec597,toYamlString as a152_0x78dd6,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(_0x2afcd9){const _0x148fba=a152_0x38ecd4;if(Array['isArray'](_0x2afcd9))return'['+_0x2afcd9[_0x148fba(0x177)](_0x498c54=>stableStringify(_0x498c54))[_0x148fba(0x17f)](',')+']';if(_0x2afcd9&&typeof _0x2afcd9===_0x148fba(0x154)){const _0x33b4f9=_0x2afcd9,_0x52612c=Object['keys'](_0x33b4f9)[_0x148fba(0x1cd)](),_0x5ad10c=_0x52612c['map'](_0x32ea2c=>'\x22'+_0x32ea2c+'\x22:'+stableStringify(_0x33b4f9[_0x32ea2c]));return'{'+_0x5ad10c[_0x148fba(0x17f)](',')+'}';}const _0x3f8d66=JSON[_0x148fba(0x101)](_0x2afcd9);return _0x3f8d66===undefined?_0x148fba(0x1c4):_0x3f8d66;}function a152_0x2183(){const _0x3b8d8d=['branches','./journey-yaml.js','activation_template_id','\x27\x20by\x20rule\x20content','uniqueServerName','logInfo','Updated\x20segment\x20\x27','journeyStages','stage\x20\x27','behavior','entry','segmentFolderId','relative','Fetching\x20','\x27\x20wait\x20condition','find','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','unchanged','index','56ncIeuh','get','entryCriteria','relationships','304882bUdQtt','deleteActivation','dirname','run_after_journey_refresh','Creating\x20activation\x20\x27','Creating\x20segment\x20\x27','\x20journey\x20from\x20file:\x20','createJourneySegment','Deleting\x20activation\x20\x27','type','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','ACTIVATION_UPDATE_ERROR','\x27\x20entry\x20criteria','has','object','Created\x20folder\x20\x27','5889OBbaTH','conditionSegmentId','getSegmentEntity','goal','logDeleted','Stage\x20\x27','Updating\x20activation\x20\x27','decision_point','Entry\x20criteria:\x20','match','Deleted\x20activation\x20\x27','fetchJourney','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegmentEntity\x20also\x20failed\x20for\x20','Embedded\x20segment\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','results','activation_deleting','existingSegment','progress','WaitStep','split','embedded_segment_created','parse','embeddedSegmentNameToId','state','1212mCYeYG','__pending_','embedded_activation_created','folderPathToId','effectiveFolderId','Matched\x20server\x20segment\x20\x27','\x27\x20decision\x20point\x20branch\x20\x27','map','1646513NiXwFI','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','rootFolderId','Created\x20activation\x20\x27','journey','121968YCqIkc','segment_deleted','join','connection','\x20activation\x20\x27','diff','activationStepsById','from','Condition','existingJourney','getLatestJourneyId','2895vmybCf','folderId','debug','waitStepUnit','localName','conditions','activationContext','journeys','segmentNameToId','createFolder','notification','goal\x20criteria','push','add','activationActions','existingSegments',').\x20','journeyName','segments','Failed\x20to\x20resolve\x20segment\x20','waitStepType','yamlActivation','activation_updated','journeyId','SEGMENT_UPDATE_ERROR','slice','validatedRequest','getActivation','DecisionPoint','update','createActivation','deleted','replace','name','milestone','resolvedRule','createSegment','SEGMENT_NOT_FOUND','create','Activation','\x27\x20from\x20file:\x20','.$1.push-recovery.json','existingActivation','segmentByFolderAndName','./child-segment-yaml.js','kind','segment','flatMap','startsWith','getJourney','folder','segment_created','rule','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','deleteSegment','journey_created','toLowerCase','parseDocument','getSegment\x20failed\x20for\x20','journeyBundleName','null','data','INTERNAL','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','verbose','absolutePath','createdSegmentId','utf-8','hasChanges','sort','4110PvQQaU','557984amxqGY','stages','toString','\x27\x20for\x20','Failed\x20to\x20resolve\x20activation\x20','entries','exitCriterias','filter',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','segment_creating','description','folderPath','connectionIdToNameMap','onProgress','updated','NOT_FOUND','journey_entry_criteria_','digest','created','conditionTimeoutDuration','entry_criteria','buildUserMaps','listActivations','Segment\x20not\x20found','hex','yamlConfig','activation_updating','createdSegmentIds','deps','Updated\x20journey\x20\x27','conditionTimeoutUnit','activations','nameToType','\x20segment\x20from\x20file:\x20','trim','parentSegmentFolder','logWarning','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','values','keys','ACTIVATION_SYNTAX_ERROR','withProgress','waitStep','columns','Segment\x20not\x20found:\x20','journeyBundleId','logSuccess','stringify','folder_created','connector_config','steps','\x27...','isNew','message','Failed\x20to\x20','draft','updateActivation','toISOString','\x0a\x20\x20','action','set','attributes','activationParams','versionNumber','schedule','length','40VLprej','errors','journeyActivationStepId','valid','some','segmentId','JOURNEY_SYNTAX_ERROR','Name\x20has\x20already\x20been\x20taken','idToEmailMap','with','resolveSegment','437542oLREWq','\x27\x20exit\x20criteria','uniqueSegmentName','all_columns','SEGMENT_SYNTAX_ERROR','Deleted\x20segment\x20\x27','Created\x20segment\x20\x27','../../utils/async.js','journey_creating','day','JOURNEY_UPDATE_ERROR','parentId','updateSegmentById','Updated\x20activation\x20\x27','nameToId','delete'];a152_0x2183=function(){return _0x3b8d8d;};return a152_0x2183();}function activationSignature(_0x4e4f03){const _0x5e5db1=a152_0x38ecd4,_0x33ae1e={'connection':_0x4e4f03[_0x5e5db1(0x180)],..._0x4e4f03[_0x5e5db1(0x122)]!==undefined&&{'all_columns':_0x4e4f03[_0x5e5db1(0x122)]},..._0x4e4f03[_0x5e5db1(0xfd)]!==undefined&&{'columns':_0x4e4f03[_0x5e5db1(0xfd)]},..._0x4e4f03[_0x5e5db1(0x138)]!==undefined&&{'behavior':_0x4e4f03[_0x5e5db1(0x138)]},..._0x4e4f03[_0x5e5db1(0x112)]!==undefined&&{'schedule':_0x4e4f03[_0x5e5db1(0x112)]},..._0x4e4f03['notification']!==undefined&&{'notification':_0x4e4f03[_0x5e5db1(0x192)]},..._0x4e4f03[_0x5e5db1(0x103)]!==undefined&&{'connector_config':_0x4e4f03[_0x5e5db1(0x103)]},..._0x4e4f03[_0x5e5db1(0x131)]!==undefined&&{'activation_template_id':_0x4e4f03['activation_template_id']}};return stableStringify(_0x33ae1e);}async function fetchSegment(_0x222574,_0x482ebe,_0x4533f1,_0x48df1c){const _0x126333=a152_0x38ecd4,_0x3da401=_0x48df1c?.['find'](_0x921162=>_0x921162['id']===_0x4533f1);if(_0x3da401)return _0x3da401;try{return await _0x222574[_0x126333(0x1b6)]['getSegment'](_0x482ebe,_0x4533f1);}catch(_0x294a82){logger[_0x126333(0x18a)](_0x126333(0x1c2)+_0x4533f1+_0x126333(0x1d7)+_0x294a82);try{return await _0x222574[_0x126333(0x1b6)][_0x126333(0x158)](_0x4533f1);}catch(_0x396387){return logger[_0x126333(0x18a)](_0x126333(0x163)+_0x4533f1+':\x20'+_0x396387),null;}}}function recoverSegmentIdsFromPushRecovery(_0x20b619,_0x1bad22,_0x545441){const _0xfe1030=a152_0x38ecd4,_0x521b61=readPushRecovery(_0x20b619['absolutePath']);if(_0x521b61?.['journeyName']===_0x20b619[_0xfe1030(0xeb)][_0xfe1030(0x1a9)])for(const [_0x130885,_0x51e5c2]of Object[_0xfe1030(0x1d4)](_0x521b61['segments'])){const _0x28154c=generateDeterministicJourneySegmentName(_0x20b619[_0xfe1030(0xeb)]['name'],_0x130885);_0x51e5c2['uniqueServerName']===_0x28154c&&(_0x1bad22['set'](_0x130885,_0x51e5c2[_0xfe1030(0x119)]),_0x545441[_0xfe1030(0x10e)](_0x130885,_0x51e5c2[_0xfe1030(0x119)]));}}async function createOrRecoverEmbeddedSegment(_0x59ac77,_0x3675db,_0x324b18,_0x1028f1){const _0xc3acad=a152_0x38ecd4;let _0x477a45;try{_0x477a45=await _0x59ac77[_0xc3acad(0x1b6)][_0xc3acad(0x14d)]({'name':_0x324b18[_0xc3acad(0x121)],'description':_0x324b18[_0xc3acad(0x1d9)],'journeyId':_0x324b18[_0xc3acad(0x19f)],'rule':_0x1028f1(_0x324b18['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x324b18[_0xc3acad(0x189)],'audienceId':_0x324b18[_0xc3acad(0x12a)]});}catch(_0x5f0e94){const _0x2698ea=_0x5f0e94 instanceof Error&&_0x5f0e94[_0xc3acad(0x107)]['includes'](_0xc3acad(0x11b));if(_0x2698ea){const _0x3354ac=readPushRecovery(_0x3675db[_0xc3acad(0x1c9)]),_0x4cc198=_0x3354ac?.[_0xc3acad(0x199)]===_0x3675db['yamlConfig'][_0xc3acad(0x1a9)]?_0x3354ac['segments'][_0x324b18[_0xc3acad(0x18c)]]:undefined;if(_0x4cc198?.[_0xc3acad(0x133)]===_0x324b18[_0xc3acad(0x121)])await _0x59ac77[_0xc3acad(0x1b6)][_0xc3acad(0x12b)](_0x324b18[_0xc3acad(0x12a)],_0x4cc198[_0xc3acad(0x119)],{'description':_0x324b18['description'],'rule':_0x1028f1(_0x324b18[_0xc3acad(0x1ab)],!![]),'countPopulation':!![]}),_0x477a45=_0x4cc198[_0xc3acad(0x119)];else throw new SDKError(ErrorCode[_0xc3acad(0x1a0)],_0xc3acad(0x164)+_0x324b18[_0xc3acad(0x18c)]+_0xc3acad(0x179)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x3675db[_0xc3acad(0x1c9)][_0xc3acad(0x1a8)](/([^/]+)$/,_0xc3acad(0x1b1))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x5f0e94);}else throw _0x5f0e94;}return saveSegmentToPushRecovery(_0x3675db['absolutePath'],_0x3675db[_0xc3acad(0xeb)][_0xc3acad(0x1a9)],_0x324b18[_0xc3acad(0x18c)],{'segmentId':_0x477a45,'uniqueServerName':_0x324b18['uniqueSegmentName'],'createdAt':new Date()[_0xc3acad(0x10b)]()}),_0x477a45;}export async function prepareSegmentFiles(_0x59ab94,_0x49d513,_0x20a6d2,_0x1494c6,_0x597c4f){const _0x2b9444=a152_0x38ecd4,{activationDefToCreateRequest:_0x5772d0}=await import(_0x2b9444(0x1b4)),_0x51cc7f=[],_0x37c10f=new Set();for(const {yamlConfig:_0x4c7013,folderPath:_0x3ce4b0,sourcePath:_0x129dc1}of _0x59ab94){const _0x365d65=resolveTDFolderPath(_0x3ce4b0,_0x1494c6,_0x597c4f),_0x104e60=_0x365d65+':'+_0x4c7013[_0x2b9444(0x1a9)],_0x1e1e6c=_0x49d513[_0x2b9444(0x1b3)]['get'](_0x104e60),_0x20246c=_0x1e1e6c?_0x49d513['activationsBySegmentId'][_0x2b9444(0x143)](_0x1e1e6c['id'])||[]:[];addFoldersToCreate(_0x365d65,_0x49d513[_0x2b9444(0x173)],_0x37c10f);const _0xffd309=calculateActivationActions(_0x4c7013[_0x2b9444(0xf1)]||[],_0x20246c,_0x49d513[_0x2b9444(0x11c)],_0x49d513[_0x2b9444(0x1db)]);for(const _0x21829a of _0xffd309){(_0x21829a[_0x2b9444(0x14f)]==='create'||_0x21829a[_0x2b9444(0x14f)]===_0x2b9444(0x1a5))&&_0x21829a[_0x2b9444(0x19d)]&&(_0x21829a['validatedRequest']=await _0x5772d0(_0x21829a['yamlActivation'],_0x20a6d2));}const _0xc797f2=calculateSegmentDiff(_0x4c7013,_0x1e1e6c,_0x20246c,_0x49d513[_0x2b9444(0x11c)],_0x49d513['connectionIdToNameMap']);_0x51cc7f['push']({'relativePath':_0x4c7013[_0x2b9444(0x1a9)],'absolutePath':_0x129dc1,'yamlConfig':_0x4c7013,'folderPath':_0x365d65,'existingSegment':_0x1e1e6c,'existingActivations':_0x20246c,'isNew':_0xc797f2['isNew'],'hasChanges':_0xc797f2['hasChanges'],'diff':_0xc797f2[_0x2b9444(0x182)],'activationActions':_0xffd309});}return{'segmentFiles':_0x51cc7f,'foldersToCreate':_0x37c10f};}export async function prepareJourneyFiles(_0x21aa3f,_0x16d130,_0x55130a,_0x29dc0e){const _0x15fda3=a152_0x38ecd4,_0x4c211f=[],_0x52e55c=new Set();for(const {yamlConfig:_0x5d0eb5,folderPath:_0xeba90,sourcePath:_0x10bc9b}of _0x21aa3f){const _0x31c64f=resolveTDFolderPath(_0xeba90,_0x55130a,_0x29dc0e),_0x5d303c=_0x31c64f+':'+_0x5d0eb5[_0x15fda3(0x1a9)],_0x4e04fb=_0x16d130['journeyBundlesByFolderAndName']['get'](_0x5d303c);let _0x33fd55,_0x37c5da;if(_0x4e04fb&&_0x4e04fb['length']>0x0){const _0x426d7b=buildLocalExpandedRuleMappings(_0x5d0eb5),{createYamlContext:_0x3bf6eb,prefetchJourneySegments:_0x3e132e}=createPushYamlContextForBundle(_0x16d130[_0x15fda3(0xee)],_0x16d130['parentId'],_0x16d130[_0x15fda3(0x197)],_0x426d7b,_0x16d130[_0x15fda3(0x11c)],_0x16d130[_0x15fda3(0x1db)],_0x16d130[_0x15fda3(0x183)],_0x16d130['journeyById']);await _0x3e132e(_0x4e04fb[_0x15fda3(0x177)](_0x255beb=>_0x255beb['id']));const _0x55daf1=await _0x16d130[_0x15fda3(0xee)][_0x15fda3(0x17c)][_0x15fda3(0x187)](_0x4e04fb[0x0][_0x15fda3(0xff)]),_0x6f42ee=hasMultipleVersions(_0x5d0eb5),_0x27cb62=async _0x232030=>{const _0x556840=_0x15fda3,_0x29db54=_0x16d130['journeyById']?.[_0x556840(0x143)](_0x232030);if(_0x29db54)return _0x29db54;return _0x16d130[_0x556840(0x161)]({'journeyId':_0x232030,'journeyName':_0x5d0eb5[_0x556840(0x1a9)],'isMultiVersion':_0x4e04fb[_0x556840(0x113)]>0x1});};if(_0x6f42ee&&_0x4e04fb[_0x15fda3(0x113)]>0x1){const _0x56be00=[];for(const _0x58c3cb of _0x4e04fb){const _0x5cef9e=_0x58c3cb[_0x15fda3(0x111)]||0x1;_0x16d130[_0x15fda3(0x169)]?.[_0x15fda3(0x1a5)](_0x15fda3(0x13c)+_0x5d0eb5[_0x15fda3(0x1a9)]+'\x20v'+_0x5cef9e);const _0xd39a38=await _0x27cb62(_0x58c3cb['id']),_0x5a67a2=_0x3bf6eb(_0x58c3cb['id']),_0x38658a=await journeyResponseToDef(_0xd39a38,_0x5a67a2);_0x56be00['push']({'item':_0x58c3cb,'yaml':_0x38658a});}const _0x5a7a7b=buildLocalRuleToNameMappingFromJourney(_0x5d0eb5);_0x37c5da=buildMergedJourneyDef(_0x56be00,_0x5a7a7b,_0x55daf1);const _0x122e56=Math['max'](..._0x56be00['map'](_0x47fbe7=>_0x47fbe7['item'][_0x15fda3(0x111)]||0x0)),_0x5e67b0=_0x4e04fb[_0x15fda3(0x13e)](_0x3488a6=>(_0x3488a6[_0x15fda3(0x111)]||0x0)===_0x122e56);_0x5e67b0&&(_0x16d130[_0x15fda3(0x169)]?.[_0x15fda3(0x1a5)](_0x15fda3(0x13c)+_0x5d0eb5['name']+'\x20v'+_0x122e56),_0x33fd55=await _0x27cb62(_0x5e67b0['id']));}else{const _0x3c68b6=_0x4e04fb[_0x4e04fb[_0x15fda3(0x113)]-0x1];_0x16d130[_0x15fda3(0x169)]?.['update'](_0x15fda3(0x13c)+_0x5d0eb5[_0x15fda3(0x1a9)]),_0x33fd55=await _0x27cb62(_0x3c68b6['id']);const _0x38133f=_0x3bf6eb(_0x3c68b6['id']),_0xb958fc=await journeyResponseToDef(_0x33fd55,_0x38133f),_0x52b21a=buildLocalRuleToNameMappingFromJourney(_0x5d0eb5);_0x37c5da=buildMergedJourneyDef([{'item':_0x3c68b6,'yaml':_0xb958fc}],_0x52b21a,_0x55daf1);}}addFoldersToCreate(_0x31c64f,_0x16d130['folderPathToId'],_0x52e55c);const _0x2cfe2d=calculateJourneyDiff(_0x5d0eb5,_0x37c5da);_0x4c211f[_0x15fda3(0x194)]({'relativePath':_0x5d0eb5['name'],'absolutePath':_0x10bc9b,'yamlConfig':_0x5d0eb5,'folderPath':_0x31c64f,'existingJourney':_0x33fd55,'isNew':_0x2cfe2d[_0x15fda3(0x106)],'hasChanges':_0x2cfe2d[_0x15fda3(0x1cc)],'diff':_0x2cfe2d[_0x15fda3(0x182)]});}return{'journeyFiles':_0x4c211f,'foldersToCreate':_0x52e55c};}export function calculateActivationActions(_0x5bd585,_0x210d68,_0x11aa9c,_0x5e8025){const _0x394626=a152_0x38ecd4,_0x176053=[],_0x1daea8=new Map();for(const _0x9ed339 of _0x210d68){_0x1daea8[_0x394626(0x10e)](_0x9ed339[_0x394626(0x1a9)],_0x9ed339);}const _0x2306f0=new Map();for(const _0xd5ff52 of _0x5bd585){_0x2306f0[_0x394626(0x10e)](_0xd5ff52[_0x394626(0x1a9)],_0xd5ff52);}for(const _0x10db75 of _0x5bd585){const _0xc0de7c=_0x1daea8[_0x394626(0x143)](_0x10db75[_0x394626(0x1a9)]);if(!_0xc0de7c)_0x176053[_0x394626(0x194)]({'type':_0x394626(0x1ae),'name':_0x10db75[_0x394626(0x1a9)],'yamlActivation':_0x10db75});else{const _0x45f625=activationResponseToDef(_0xc0de7c,_0x11aa9c,_0x5e8025),_0x507b93=a152_0x3f7eae[_0x394626(0x101)](_0x45f625),_0x27264e=a152_0x3f7eae[_0x394626(0x101)](_0x10db75);_0x507b93!==_0x27264e&&_0x176053[_0x394626(0x194)]({'type':'update','name':_0x10db75['name'],'yamlActivation':_0x10db75,'existingActivation':_0xc0de7c});}}for(const _0x1b7212 of _0x210d68){!_0x2306f0[_0x394626(0x153)](_0x1b7212[_0x394626(0x1a9)])&&_0x176053['push']({'type':_0x394626(0x12e),'name':_0x1b7212[_0x394626(0x1a9)],'existingActivation':_0x1b7212});}return _0x176053;}function calculateYamlDiff(_0x5c280b,_0x596d5b){if(_0x596d5b){const _0x2f897a=generateDiff(_0x596d5b,_0x5c280b),_0x331881=hasChanges(_0x2f897a);return{'isNew':![],'hasChanges':_0x331881,'diff':_0x331881?formatDiffWithColors(_0x2f897a):undefined};}const _0x53a2ea=generateDiff('',_0x5c280b);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x53a2ea)};}export function calculateSegmentDiff(_0x81949a,_0x5c02e0,_0x34b359,_0x396254,_0x20fd3d){const _0x47bd9e=segmentToYamlString(_0x81949a),_0x383b05=_0x5c02e0?segmentToYamlString(segmentWithActivationsToYaml(_0x5c02e0,_0x34b359,undefined,_0x396254,_0x20fd3d)):undefined;return calculateYamlDiff(_0x47bd9e,_0x383b05);}export function calculateJourneyDiff(_0x4bb83e,_0x12db43){const _0x1d4980=normalizeJourneyDef(_0x4bb83e,_0x4bb83e),_0x27a8b2=a152_0x78dd6(_0x1d4980),_0x5b4ba5=_0x12db43?a152_0x78dd6(normalizeJourneyDef(_0x12db43,_0x4bb83e)):undefined;return calculateYamlDiff(_0x27a8b2,_0x5b4ba5);}export function findSegmentsToDelete(_0x535721,_0x427a3f,_0x36fa87,_0x4d4a6f,_0x450d14){const _0x35e7c4=a152_0x38ecd4,_0x35a4b3=new Set();for(const {yamlConfig:_0x1898ab,folderPath:_0x5318a9}of _0x427a3f){_0x35a4b3[_0x35e7c4(0x195)](_0x5318a9+':'+_0x1898ab[_0x35e7c4(0x1a9)]);}return _0x535721[_0x35e7c4(0x1d6)](_0x274a9f=>{const _0x4a26d0=_0x35e7c4,_0x420cb8=_0x274a9f[_0x4a26d0(0x13a)]?_0x36fa87[_0x4a26d0(0x143)](_0x274a9f[_0x4a26d0(0x13a)][_0x4a26d0(0x1d1)]())||'':'',_0x1fe0a4=_0x420cb8+':'+_0x274a9f[_0x4a26d0(0x1a9)];if(_0x35a4b3[_0x4a26d0(0x153)](_0x1fe0a4))return![];if(_0x450d14)return _0x420cb8===_0x4d4a6f||_0x420cb8[_0x4a26d0(0x1b8)](_0x4d4a6f+'/');return!![];});}export function findJourneysToDelete(_0x3df9e,_0x3c1eaa,_0x458391,_0x899a5a,_0x25adc1){const _0x4eb82d=a152_0x38ecd4,_0x5f47d6=new Set();for(const {yamlConfig:_0x3f443f,folderPath:_0x58ac0e}of _0x3c1eaa){_0x5f47d6['add'](_0x58ac0e+':'+_0x3f443f[_0x4eb82d(0x1a9)]);}return _0x3df9e[_0x4eb82d(0x1d6)](_0x4a365d=>{const _0x240bd0=_0x4eb82d,_0x591963=_0x4a365d['folderId']?_0x458391[_0x240bd0(0x143)](_0x4a365d[_0x240bd0(0x189)])||'':'',_0x4f6363=_0x591963+':'+_0x4a365d['journeyBundleName'];if(_0x5f47d6['has'](_0x4f6363))return![];if(_0x25adc1)return _0x591963===_0x899a5a||_0x591963[_0x240bd0(0x1b8)](_0x899a5a+'/');return!![];});}export function buildSegmentLookupMap(_0xa1122f,_0x19cab7){const _0x4cd869=a152_0x38ecd4,_0x40545b=new Map();for(const _0x569645 of _0xa1122f){const _0x57fe9a=_0x569645[_0x4cd869(0x13a)]?_0x19cab7[_0x4cd869(0x143)](_0x569645[_0x4cd869(0x13a)]['toString']())||'':'',_0x49c88f=_0x57fe9a+':'+_0x569645[_0x4cd869(0x1a9)];_0x40545b[_0x4cd869(0x10e)](_0x49c88f,_0x569645);}return _0x40545b;}export function buildSegmentNameToIdMap(_0x1139c2){const _0x27d0cb=a152_0x38ecd4,_0x12eb5b=new Map();for(const _0x5b997e of _0x1139c2){_0x12eb5b[_0x27d0cb(0x10e)](_0x5b997e[_0x27d0cb(0x1a9)],_0x5b997e['id']);}return _0x12eb5b;}export function buildJourneyBundleLookupMap(_0x20f5c3,_0x334483){const _0x35fd1f=a152_0x38ecd4,_0x15a538=new Map();for(const _0x5a97b5 of _0x20f5c3){const _0x38e0e9=_0x5a97b5[_0x35fd1f(0x189)]?_0x334483[_0x35fd1f(0x143)](_0x5a97b5['folderId'])||'':'',_0x1764a9=_0x38e0e9+':'+_0x5a97b5[_0x35fd1f(0x1c3)];!_0x15a538[_0x35fd1f(0x153)](_0x1764a9)&&_0x15a538['set'](_0x1764a9,[]),_0x15a538[_0x35fd1f(0x143)](_0x1764a9)[_0x35fd1f(0x194)](_0x5a97b5);}for(const _0x65beef of _0x15a538[_0x35fd1f(0xf8)]()){_0x65beef[_0x35fd1f(0x1cd)]((_0x47f0e9,_0x1b2e3c)=>(_0x47f0e9[_0x35fd1f(0x111)]||0x0)-(_0x1b2e3c['versionNumber']||0x0));}return _0x15a538;}export function collectFoldersToCreate(_0x20345c,_0x50982a){const _0x9ad2cd=a152_0x38ecd4,_0x186ba1=new Set();for(const _0x4d40d2 of _0x20345c){if(!_0x4d40d2)continue;if(_0x50982a[_0x9ad2cd(0x153)](_0x4d40d2))continue;const _0x4fdf4c=_0x4d40d2['split']('/');let _0x45450c='';for(const _0x2b68fa of _0x4fdf4c){_0x45450c=_0x45450c?_0x45450c+'/'+_0x2b68fa:_0x2b68fa,!_0x50982a[_0x9ad2cd(0x153)](_0x45450c)&&_0x186ba1[_0x9ad2cd(0x195)](_0x45450c);}}return _0x186ba1;}export function parseAndClassifyYamlFiles(_0x8d1851,_0x2d6183,_0x3c6205){const _0x34af86=a152_0x38ecd4,_0x1786b1=[],_0x1d4e7a=[];for(const _0x4afd60 of _0x8d1851){const _0x3dc1fe=a152_0x2dbdcb[_0x34af86(0x13b)](_0x2d6183,a152_0x2dbdcb[_0x34af86(0x148)](_0x4afd60)),_0x294ab1=_0x3dc1fe==='.'?'':_0x3dc1fe,_0x4741f6=readFileSync(_0x4afd60,_0x34af86(0x1cb)),_0x49b1ed=a152_0x3f7eae['parse'](_0x4741f6);if(isJourneyDef(_0x49b1ed)){const _0xe4482=a152_0x2ec597(_0x4741f6);_0x1d4e7a[_0x34af86(0x194)]({'yamlConfig':_0xe4482,'folderPath':_0x294ab1,'sourcePath':_0x4afd60});}else{if(!_0x3c6205?.['skipSegments']){const _0x3dcc0f=parseSegmentYamlFile(_0x4741f6),_0x5f201a=normalizeChildSegmentYaml(_0x3dcc0f);_0x1786b1[_0x34af86(0x194)]({'yamlConfig':_0x5f201a,'folderPath':_0x294ab1,'sourcePath':_0x4afd60});}}}return{'segments':_0x1786b1,'journeys':_0x1d4e7a};}export function validateParsedFiles(_0x94577f,_0x15cd2b){const _0x520b5f=a152_0x38ecd4,_0x44708a=[];for(const {yamlConfig:_0xfb5325,sourcePath:_0x17f63c}of _0x94577f['segments']){const _0x135c78=readFileSync(_0x17f63c,_0x520b5f(0x1cb)),_0x1babf3=a152_0x3f7eae[_0x520b5f(0x1c1)](_0x135c78),_0x5877d6=validateSegmentDef(_0xfb5325,{'source':_0x135c78,'document':_0x1babf3},{'skipSchema':!![]});if(!_0x5877d6[_0x520b5f(0x117)]){const _0x1e23e5=a152_0x2dbdcb[_0x520b5f(0x13b)](_0x15cd2b,_0x17f63c);_0x44708a[_0x520b5f(0x194)]({'filePath':_0x1e23e5,'source':_0x135c78,'result':_0x5877d6,'isJourney':![]});}}for(const {yamlConfig:_0x273e57,sourcePath:_0x33021e}of _0x94577f['journeys']){const _0x21ca44=readFileSync(_0x33021e,_0x520b5f(0x1cb)),_0x2d6133=a152_0x3f7eae['parseDocument'](_0x21ca44),_0x23a5f8=validateJourneyDef(_0x273e57,{'source':_0x21ca44,'document':_0x2d6133},{'skipSchema':!![]});if(!_0x23a5f8['valid']){const _0x151929=a152_0x2dbdcb[_0x520b5f(0x13b)](_0x15cd2b,_0x33021e);_0x44708a[_0x520b5f(0x194)]({'filePath':_0x151929,'source':_0x21ca44,'result':_0x23a5f8,'isJourney':!![]});}}return _0x44708a;}export function formatValidationErrors(_0x266ab6){const _0x30e322=a152_0x38ecd4,_0x19fae6=[];for(const {filePath:_0x2aabc7,source:_0x3d7180,result:_0x429a21,isJourney:_0x1fdabc}of _0x266ab6){const _0x44f757=_0x1fdabc?_0x30e322(0x17c):_0x30e322(0x1b6);_0x19fae6[_0x30e322(0x194)]('\x0a'+_0x2aabc7+'\x20('+_0x44f757+'):\x20'+_0x429a21[_0x30e322(0x115)]['length']+'\x20error(s)'),_0x19fae6[_0x30e322(0x194)](formatValidationResult(_0x429a21,_0x3d7180,_0x2aabc7));}return _0x19fae6[_0x30e322(0x17f)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x18de02){const _0x49a074=a152_0x38ecd4,_0x8d52dd=new Set(),_0x559ba1=new Map(),_0x2db9b4=collectSegmentUsageCounts(_0x18de02);if(_0x18de02[_0x49a074(0x19a)])for(const [_0x54647b,_0x55a520]of Object['entries'](_0x18de02[_0x49a074(0x19a)])){_0x8d52dd[_0x49a074(0x195)](_0x54647b);if(_0x55a520['rule']){const _0x598b10=yamlRuleToApi(_0x55a520[_0x49a074(0x1bc)]),_0x3c379e=apiRuleToYaml(_0x598b10);_0x559ba1[_0x49a074(0x10e)](_0x54647b,_0x3c379e);}}const _0x1aed14=new Map();let _0x46a50a=0x0;for(const [_0x59f5b8,_0x4b4cf7]of _0x559ba1){const _0x12b1b9=serializeExpandedRule(_0x4b4cf7,_0x559ba1),_0x4bbb56=_0x1aed14[_0x49a074(0x143)](_0x12b1b9)||[];_0x4bbb56[_0x49a074(0x194)]({'name':_0x59f5b8,'index':_0x46a50a}),_0x1aed14[_0x49a074(0x10e)](_0x12b1b9,_0x4bbb56),_0x46a50a++;}const _0x252e33=new Map();for(const [_0x29dfa9,_0x504b7c]of _0x1aed14){const _0x497e19=_0x504b7c['slice']()[_0x49a074(0x1cd)]((_0x1388a4,_0x484c26)=>{const _0xb5a0a3=_0x49a074,_0x479254=_0x2db9b4[_0xb5a0a3(0x143)](_0x1388a4[_0xb5a0a3(0x1a9)])||0x0,_0x29d346=_0x2db9b4[_0xb5a0a3(0x143)](_0x484c26[_0xb5a0a3(0x1a9)])||0x0;if(_0x479254!==_0x29d346)return _0x29d346-_0x479254;return _0x1388a4[_0xb5a0a3(0x141)]-_0x484c26['index'];})[_0x49a074(0x177)](_0x13156f=>_0x13156f['name']),_0x5d1ca7=[];for(const _0x2d5c49 of _0x497e19){const _0x497c1f=_0x2db9b4[_0x49a074(0x143)](_0x2d5c49)||0x0,_0x44d6bf=Math['max'](_0x497c1f,0x1);for(let _0x3b99d9=0x0;_0x3b99d9<_0x44d6bf;_0x3b99d9++){_0x5d1ca7[_0x49a074(0x194)](_0x2d5c49);}}_0x252e33[_0x49a074(0x10e)](_0x29dfa9,_0x5d1ca7);}return{'existingLocalSegmentNames':_0x8d52dd,'localSegmentRules':_0x559ba1,'localExpandedRuleToNames':_0x252e33};}export function createSegmentIdResolver(_0x486598,_0x2b5d85){return async _0x351437=>{const _0x35647f=a152_0x3394,_0x3ae6cb=_0x486598[_0x35647f(0x143)](_0x351437);if(!_0x3ae6cb)throw new SDKError(ErrorCode[_0x35647f(0x1ad)],_0x35647f(0xfe)+_0x351437+_0x35647f(0xf7)+_0x2b5d85+'\x27)');return _0x3ae6cb;};}export function extractRootFolderId(_0x2056c7){const _0x3fd616=a152_0x38ecd4;return _0x2056c7[_0x3fd616(0x145)]?.[_0x3fd616(0xf5)]?.[_0x3fd616(0x1c5)]?.['id']||_0x2056c7[_0x3fd616(0x145)]?.['parentFolder']?.[_0x3fd616(0x1c5)]?.['id'];}export function buildConnectionMaps(_0x2bd539){const _0x315531=a152_0x38ecd4,_0x36885e=new Map(),_0x4311d1=new Map(),_0x31815b=new Map();for(const _0x5672e4 of _0x2bd539){_0x36885e[_0x315531(0x10e)](_0x5672e4[_0x315531(0x1a9)],parseInt(_0x5672e4['id'],0xa)),_0x4311d1[_0x315531(0x10e)](_0x5672e4['id'],_0x5672e4[_0x315531(0x1a9)]),_0x31815b['set'](_0x5672e4['name'],_0x5672e4[_0x315531(0x14f)]);}return{'nameToId':_0x36885e,'idToName':_0x4311d1,'nameToType':_0x31815b};}export function calculatePushStats(_0x31e1e0,_0x2516ec,_0x1c03c9,_0x5c152f,_0x3b0299,_0x2041ed,_0x53b1a5){const _0x261ca2=a152_0x38ecd4,_0x2a9091=_0x31e1e0[_0x261ca2(0x1d6)](_0x3d42c9=>_0x3d42c9[_0x261ca2(0x106)]),_0x53b7ae=_0x31e1e0[_0x261ca2(0x1d6)](_0xb341c7=>!_0xb341c7[_0x261ca2(0x106)]&&_0xb341c7[_0x261ca2(0x1cc)]),_0x21d0ec=_0x31e1e0[_0x261ca2(0x1d6)](_0x45c75a=>!_0x45c75a['isNew']&&!_0x45c75a[_0x261ca2(0x1cc)]),_0x4bb683=_0x2041ed?_0x5c152f:[],_0x33f175=_0x2516ec[_0x261ca2(0x1d6)](_0x23115f=>_0x23115f[_0x261ca2(0x106)]),_0xfec66d=_0x2516ec['filter'](_0x51d137=>!_0x51d137[_0x261ca2(0x106)]&&_0x51d137[_0x261ca2(0x1cc)]),_0x41f236=_0x2516ec[_0x261ca2(0x1d6)](_0xad5286=>!_0xad5286[_0x261ca2(0x106)]&&!_0xad5286[_0x261ca2(0x1cc)]),_0x36c3a8=_0x2041ed?_0x3b0299:[],_0x5dd00b=_0x31e1e0[_0x261ca2(0x1b7)](_0x4f577a=>_0x4f577a['activationActions']),_0x3c8bbe=_0x5dd00b[_0x261ca2(0x1d6)](_0x54e144=>_0x54e144['type']==='create'),_0x443e11=_0x5dd00b['filter'](_0x280bd4=>_0x280bd4[_0x261ca2(0x14f)]===_0x261ca2(0x1a5)),_0x5c7c28=_0x5dd00b[_0x261ca2(0x1d6)](_0x5c3633=>_0x5c3633[_0x261ca2(0x14f)]==='delete'),_0x1d8c54=Array[_0x261ca2(0x184)](_0x1c03c9)[_0x261ca2(0x1cd)](),_0x4c8970=_0x53b1a5?![]:_0x2a9091[_0x261ca2(0x113)]>0x0||_0x53b7ae[_0x261ca2(0x113)]>0x0||_0x4bb683['length']>0x0,_0x4254b2=_0x33f175[_0x261ca2(0x113)]>0x0||_0xfec66d[_0x261ca2(0x113)]>0x0||_0x36c3a8[_0x261ca2(0x113)]>0x0,_0x271d18=_0x53b1a5?![]:_0x5dd00b[_0x261ca2(0x113)]>0x0,_0x1e78b0=_0x1d8c54[_0x261ca2(0x113)]>0x0;return{'segments':{'new':_0x2a9091,'changed':_0x53b7ae,'unchanged':_0x21d0ec,'toDelete':_0x4bb683},'journeys':{'new':_0x33f175,'changed':_0xfec66d,'unchanged':_0x41f236,'toDelete':_0x36c3a8},'activations':{'all':_0x5dd00b,'toCreate':_0x3c8bbe,'toUpdate':_0x443e11,'toDelete':_0x5c7c28},'folders':{'toCreate':_0x1d8c54},'counts':{'segments':{'new':_0x2a9091[_0x261ca2(0x113)],'changed':_0x53b7ae[_0x261ca2(0x113)],'unchanged':_0x21d0ec[_0x261ca2(0x113)],'toDelete':_0x4bb683['length']},'journeys':{'new':_0x33f175[_0x261ca2(0x113)],'changed':_0xfec66d['length'],'unchanged':_0x41f236[_0x261ca2(0x113)],'toDelete':_0x36c3a8[_0x261ca2(0x113)]},'activations':{'create':_0x3c8bbe['length'],'update':_0x443e11[_0x261ca2(0x113)],'delete':_0x5c7c28[_0x261ca2(0x113)]},'folders':_0x1d8c54[_0x261ca2(0x113)]},'hasChanges':_0x4c8970||_0x4254b2||_0x271d18||_0x1e78b0};}export async function buildPushExecutionContext(_0x1013bf,_0x572cf3,_0x1cacc2,_0x23bc96,_0x323442,_0x149320){const _0x4fb31e=a152_0x38ecd4,_0x282354=extractRootFolderId(_0x1cacc2),{pathToId:_0x3dda1c,idToPath:_0x447d7b}=buildFolderMaps(_0x323442),_0x56bbf4=buildSegmentNameToIdMap(_0x23bc96),_0x333c32=new Map(),{batchAsync:_0x3623dc}=await import(_0x4fb31e(0x126)),[_0x3777ee,_0x5d2298]=await Promise['all']([_0x1013bf['user'][_0x4fb31e(0xe7)](),_0x1013bf['connection']['list'](),((async()=>{const _0x3351e0=_0x4fb31e;!_0x149320&&_0x23bc96[_0x3351e0(0x113)]>0x0&&await _0x3623dc(_0x23bc96,async _0x592c46=>{const _0x1a0c5b=_0x3351e0,_0x33db36=await _0x1013bf[_0x1a0c5b(0x1b6)]['listActivations'](_0x572cf3,_0x592c46['id']);_0x333c32['set'](_0x592c46['id'],_0x33db36);});})())]),{emailToId:_0x281083,idToEmail:_0x56cc52}=_0x3777ee,_0x247348=buildConnectionMaps(_0x5d2298);return{'rootFolderId':_0x282354,'folderPathToId':_0x3dda1c,'folderIdToPath':_0x447d7b,'segmentNameToId':_0x56bbf4,'activationsBySegmentId':_0x333c32,'emailToIdMap':_0x281083,'idToEmailMap':_0x56cc52,'connectionNameToIdMap':_0x247348[_0x4fb31e(0x12d)],'connectionIdToNameMap':_0x247348['idToName'],'connectionNameToTypeMap':_0x247348[_0x4fb31e(0xf2)]};}export function createPushYamlContextForBundle(_0x44eaba,_0x3f5bb6,_0x1820d6,_0x303b8f,_0x3186eb,_0x312838,_0x1a90cd,_0x4153e2){const {existingLocalSegmentNames:_0x5dc69d,localExpandedRuleToNames:_0x944d4e}=_0x303b8f,_0xa2a2b2=new Set(),_0x2c09d4=new Map(),_0xc632a1=new Map(),_0x3af23f=new Map(),_0x426c6d=createJumpTargetCache(),_0x5d908a=new Map(),_0x1a8fb3=new Map(),_0x439759=new Set();let _0x35f71e;const _0x1105b4=_0x1d47f1=>{const _0x4508ab={'resolveSegment':async _0xf550db=>{const _0x4759a9=a152_0x3394,_0x282b0d=_0x3af23f[_0x4759a9(0x143)](_0xf550db);if(_0x282b0d!==undefined)return{'name':_0x282b0d,'isJourneyLocal':!![]};try{const _0x2a4ee5=await fetchSegment(_0x44eaba,_0x3f5bb6,_0xf550db,_0x1820d6);if(!_0x2a4ee5)throw new Error(_0x4759a9(0xe9));const _0x3f91b4=generateJourneyLocalName(_0x2a4ee5[_0x4759a9(0x1a9)]),_0x5041c5=_0x2a4ee5[_0x4759a9(0x1b5)]===SEGMENT_KIND_JOURNEY&&_0x3f91b4!==undefined;let _0x34d4fc=_0x2a4ee5[_0x4759a9(0x1a9)],_0x56717b;if(_0x5041c5&&_0x2a4ee5['rule']){const _0x3f16e8=apiRuleToYaml(_0x2a4ee5[_0x4759a9(0x1bc)]);_0x1a8fb3[_0x4759a9(0x10e)](_0xf550db,_0x3f16e8);const _0x45e20b=async _0x38bca0=>{const _0x3f2e11=_0x4759a9,_0x3f48fa=collectSegmentRefsFromRule(_0x38bca0);for(const _0x2c7ae7 of _0x3f48fa){if(!_0x1a8fb3['has'](_0x2c7ae7))try{const _0x101b77=await fetchSegment(_0x44eaba,_0x3f5bb6,_0x2c7ae7,_0x1820d6);if(_0x101b77?.[_0x3f2e11(0x1bc)]){const _0x3f75d0=apiRuleToYaml(_0x101b77['rule']);_0x1a8fb3[_0x3f2e11(0x10e)](_0x2c7ae7,_0x3f75d0),await _0x45e20b(_0x3f75d0);}}catch(_0x41c934){logger[_0x3f2e11(0x18a)](_0x3f2e11(0x162)+_0x2c7ae7+':\x20'+_0x41c934);}}};await _0x45e20b(_0x3f16e8);const _0xbbc76a=serializeExpandedRule(_0x3f16e8,_0x1a8fb3),_0x56b88b=_0x944d4e[_0x4759a9(0x143)](_0xbbc76a);if(_0x56b88b&&_0x56b88b[_0x4759a9(0x113)]>0x0){const _0x1fa090=_0x2c09d4[_0x4759a9(0x143)](_0xbbc76a)||0x0,_0x16dfc8=_0x56b88b[_0x1fa090]||_0x56b88b[_0x56b88b['length']-0x1];_0x2c09d4[_0x4759a9(0x10e)](_0xbbc76a,_0x1fa090+0x1),_0x34d4fc=_0x16dfc8,_0xa2a2b2[_0x4759a9(0x195)](_0x34d4fc),_0x3af23f[_0x4759a9(0x10e)](_0xf550db,_0x34d4fc);const _0xf22d06=await resolveRuleSegmentRefs(_0x3f16e8,async _0x3fd95d=>{const _0x3face8=_0x4759a9,_0x53e9c4=_0x3af23f[_0x3face8(0x143)](_0x3fd95d);if(_0x53e9c4)return _0x53e9c4;const _0x48b7f0=await _0x35f71e[_0x3face8(0x11e)](_0x3fd95d);return _0x48b7f0['name'];});_0x56717b={'description':_0x2a4ee5[_0x4759a9(0x1d9)],'rule':_0xf22d06};}else{const _0x3c9ab3=_0x5d908a[_0x4759a9(0x143)](_0xbbc76a);if(_0x3c9ab3)_0x34d4fc=_0x3c9ab3,_0x3af23f['set'](_0xf550db,_0x34d4fc);else{if(_0x3f91b4){let _0x5e4420=_0x3f91b4,_0xc11f3e=0x2;while(_0xa2a2b2['has'](_0x5e4420)||_0x5dc69d[_0x4759a9(0x153)](_0x5e4420)){_0x5e4420=_0x3f91b4+'_'+_0xc11f3e,_0xc11f3e++;}_0xa2a2b2[_0x4759a9(0x195)](_0x5e4420),_0x34d4fc=_0x5e4420;}_0x3af23f[_0x4759a9(0x10e)](_0xf550db,_0x34d4fc),_0x5d908a[_0x4759a9(0x10e)](_0xbbc76a,_0x34d4fc);const _0x3adab9=await resolveRuleSegmentRefs(_0x3f16e8,async _0x48fa81=>{const _0x1e52be=_0x4759a9,_0x26f258=_0x3af23f[_0x1e52be(0x143)](_0x48fa81);if(_0x26f258)return _0x26f258;const _0x507276=await _0x35f71e[_0x1e52be(0x11e)](_0x48fa81);return _0x507276[_0x1e52be(0x1a9)];});_0x56717b={'description':_0x2a4ee5[_0x4759a9(0x1d9)],'rule':_0x3adab9};}}}return{'name':_0x34d4fc,'isJourneyLocal':_0x5041c5,'definition':_0x56717b};}catch(_0x4dfe1f){return logger['debug'](_0x4759a9(0x19b)+_0xf550db+':\x20'+_0x4dfe1f),{'name':_0xf550db,'isJourneyLocal':![]};}},'resolveActivation':async _0x46aa3f=>{const _0x2b419e=a152_0x3394,_0x5c9d9a=_0xc632a1[_0x2b419e(0x143)](_0x46aa3f);if(_0x5c9d9a!==undefined)return{'name':_0x5c9d9a,'isJourneyLocal':!![]};try{let _0x527fb4=_0x1a90cd?.[_0x2b419e(0x143)](_0x46aa3f);!_0x527fb4&&(_0x527fb4=await _0x44eaba[_0x2b419e(0x17c)][_0x2b419e(0x1a3)](_0x1d47f1,_0x46aa3f));const _0x21be4f=_0x527fb4[_0x2b419e(0x10f)][_0x2b419e(0x110)][_0x2b419e(0x1a9)]||_0x46aa3f,_0x2fc66f=sanitizeYamlKey(_0x21be4f)||'activation_'+_0x46aa3f,_0x28226c=_0x2fc66f;_0xc632a1['set'](_0x46aa3f,_0x28226c);const _0x35bf0f=journeyActivationStepToYaml(_0x527fb4,_0x3186eb,_0x312838);return{'name':_0x28226c,'isJourneyLocal':!![],'definition':_0x35bf0f};}catch(_0x19c493){return logger[_0x2b419e(0x18a)](_0x2b419e(0x1d3)+_0x46aa3f+':\x20'+_0x19c493),{'name':_0x46aa3f,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x525b47,_0x1ccb7b)=>resolveJumpTarget(_0x525b47,_0x1ccb7b,_0x426c6d,async _0x10a8ef=>{const _0x4f31bd=a152_0x3394,_0x21f1b7=_0x4153e2?.[_0x4f31bd(0x143)](_0x10a8ef);if(_0x21f1b7)return _0x21f1b7;return _0x44eaba['journey'][_0x4f31bd(0x1b9)](_0x10a8ef);})};return _0x35f71e=_0x4508ab,_0x4508ab;},_0x3bf564=async _0x530cf1=>{const _0x28f314=a152_0x3394,{collectSegmentIdsFromJourneyApi:_0x52b3c8}=await import('./journey-yaml.js'),{batchAsync:_0x43d34d}=await import(_0x28f314(0x126)),_0x761aab=new Set();for(const _0x2738e7 of _0x530cf1){let _0x336e87=_0x4153e2?.[_0x28f314(0x143)](_0x2738e7);!_0x336e87&&(_0x336e87=await _0x44eaba[_0x28f314(0x17c)]['getJourney'](_0x2738e7));const _0xa5ebf5=_0x52b3c8(_0x336e87);for(const _0x2f4dd6 of _0xa5ebf5){_0x761aab[_0x28f314(0x195)](_0x2f4dd6);}}let _0x162d41=Array[_0x28f314(0x184)](_0x761aab);while(_0x162d41['length']>0x0){const _0x276016=_0x162d41['filter'](_0x5f35bc=>!_0x439759['has'](_0x5f35bc));if(_0x276016['length']===0x0)break;const _0x5482b7=await _0x43d34d(_0x276016,async _0x3e7174=>{const _0x909251=_0x28f314;_0x439759[_0x909251(0x195)](_0x3e7174);const _0x1255c9=await fetchSegment(_0x44eaba,_0x3f5bb6,_0x3e7174,_0x1820d6);if(!_0x1255c9)return null;return{'segmentId':_0x3e7174,'segment':_0x1255c9};},0xa),_0x28dea4=new Set();for(const _0x3fea52 of _0x5482b7){if(!_0x3fea52?.['segment']?.[_0x28f314(0x1bc)])continue;const _0x3cd326=apiRuleToYaml(_0x3fea52[_0x28f314(0x1b6)][_0x28f314(0x1bc)]);_0x1a8fb3['set'](_0x3fea52['segmentId'],_0x3cd326);const _0x56b144=collectSegmentRefsFromRule(_0x3cd326);for(const _0x52ee75 of _0x56b144){!_0x439759[_0x28f314(0x153)](_0x52ee75)&&_0x28dea4[_0x28f314(0x195)](_0x52ee75);}}_0x162d41=Array['from'](_0x28dea4);}};return{'createYamlContext':_0x1105b4,'prefetchJourneySegments':_0x3bf564};}export async function executePushSegments(_0x306af7,_0x1cd670,_0x410a80,_0x80c4d1,_0x10d436){const _0x449086=a152_0x38ecd4,{segmentDefToCreateRequest:_0x4ecf11,segmentDefToUpdateRequest:_0x264954}=await import(_0x449086(0x1b4)),_0x17767e=_0x410a80[_0x449086(0x173)],_0x3a4da7=0x5,_0x70429d=async _0x10df95=>{const _0x41b644=_0x449086,_0x1733bf=_0x10df95[_0x41b644(0x1da)]?_0x17767e[_0x41b644(0x143)](_0x10df95[_0x41b644(0x1da)]):undefined;let _0x1befaa;const _0x4a304f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x394775=_0x10df95[_0x41b644(0xeb)];if(_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1bc)]){const _0x5e2757=createSegmentIdResolver(_0x410a80[_0x41b644(0x190)],_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]),_0x10d313=await resolveRuleSegmentIds(_0x10df95[_0x41b644(0xeb)]['rule'],_0x5e2757);_0x394775={..._0x10df95[_0x41b644(0xeb)],'rule':_0x10d313};}try{if(_0x10df95['isNew']){_0x10d436['onProgress']?.({'type':_0x41b644(0x1d8),'name':_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]});const _0x966fe6=_0x4ecf11(_0x394775,_0x1733bf),_0x32afba=await _0x10d436[_0x41b644(0xfb)](_0x41b644(0x14b)+_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]+_0x41b644(0x105),()=>_0x306af7[_0x41b644(0x1b6)][_0x41b644(0x1ac)](_0x80c4d1[_0x41b644(0x12a)],_0x966fe6));_0x1befaa=_0x32afba[_0x41b644(0x1c5)]['id'],_0x410a80[_0x41b644(0x190)][_0x41b644(0x10e)](_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)],_0x1befaa),_0x4a304f[_0x41b644(0x1ca)]={'name':_0x10df95['yamlConfig']['name'],'id':_0x1befaa},_0x10d436[_0x41b644(0x1dc)]?.({'type':_0x41b644(0x1bb),'name':_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)],'segmentId':_0x1befaa}),_0x10d436[_0x41b644(0x100)]?.(_0x41b644(0x125)+_0x10df95['yamlConfig']['name']+'\x27'),_0x4a304f[_0x41b644(0x1e1)]=0x1;}else{if(_0x10df95['hasChanges']){_0x10d436['onProgress']?.({'type':'segment_updating','name':_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]});const _0x1a37f2=_0x264954(_0x394775);_0x1733bf!==_0x10df95[_0x41b644(0x168)]?.[_0x41b644(0x13a)]&&(_0x1a37f2[_0x41b644(0x13a)]=_0x1733bf?parseInt(_0x1733bf,0xa):undefined),await _0x10d436[_0x41b644(0xfb)]('Updating\x20segment\x20\x27'+_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]+'\x27...',()=>_0x306af7[_0x41b644(0x1b6)][_0x41b644(0x12b)](_0x80c4d1[_0x41b644(0x12a)],_0x10df95['existingSegment']['id'],_0x1a37f2)),_0x1befaa=_0x10df95['existingSegment']['id'],_0x10d436[_0x41b644(0x1dc)]?.({'type':'segment_updated','name':_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]}),_0x10d436[_0x41b644(0x100)]?.(_0x41b644(0x135)+_0x10df95[_0x41b644(0xeb)][_0x41b644(0x1a9)]+'\x27'),_0x4a304f[_0x41b644(0x1dd)]=0x1;}else _0x1befaa=_0x10df95['existingSegment']['id'];}}catch(_0x29bfb2){const _0x44ef59=isHttp400Error(_0x29bfb2),_0x54346c=_0x44ef59?ErrorCode[_0x41b644(0x123)]:ErrorCode[_0x41b644(0x1a0)],_0x85fa84=getErrorMessage(_0x29bfb2);throw new SDKError(_0x54346c,_0x41b644(0x108)+(_0x10df95[_0x41b644(0x106)]?_0x41b644(0x1ae):_0x41b644(0x1a5))+_0x41b644(0xf3)+_0x10df95['absolutePath']+_0x41b644(0x10c)+_0x85fa84,_0x29bfb2);}try{const _0x5ee8a4=await syncActivationsForSegment(_0x306af7,_0x80c4d1[_0x41b644(0x12a)],_0x1befaa,_0x10df95['yamlConfig'][_0x41b644(0x1a9)],_0x10df95[_0x41b644(0x196)],_0x10d436,_0x10df95[_0x41b644(0x1c9)]);_0x4a304f[_0x41b644(0xf1)]=_0x5ee8a4;}catch(_0x3ed550){if(_0x3ed550 instanceof SDKError)throw _0x3ed550;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x10df95[_0x41b644(0xeb)]['name']+_0x41b644(0x1b0)+_0x10df95[_0x41b644(0x1c9)]+'\x0a\x20\x20'+getErrorMessage(_0x3ed550),_0x3ed550);}return _0x4a304f;},_0x33cddd=await batchAsync(_0x1cd670,_0x70429d,_0x3a4da7),_0xdfbe0e={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1c8207 of _0x33cddd){_0xdfbe0e['created']+=_0x1c8207['created'],_0xdfbe0e[_0x449086(0x1dd)]+=_0x1c8207['updated'],_0x1c8207[_0x449086(0x1ca)]&&_0xdfbe0e[_0x449086(0xed)]['set'](_0x1c8207[_0x449086(0x1ca)][_0x449086(0x1a9)],_0x1c8207[_0x449086(0x1ca)]['id']),_0xdfbe0e[_0x449086(0xf1)][_0x449086(0x1e1)]+=_0x1c8207[_0x449086(0xf1)][_0x449086(0x1e1)],_0xdfbe0e[_0x449086(0xf1)][_0x449086(0x1dd)]+=_0x1c8207[_0x449086(0xf1)][_0x449086(0x1dd)],_0xdfbe0e[_0x449086(0xf1)][_0x449086(0x1a7)]+=_0x1c8207[_0x449086(0xf1)]['deleted'];}return _0xdfbe0e;}async function syncActivationsForSegment(_0xde025f,_0x579ddc,_0x58d8ef,_0x137852,_0x3924e2,_0x54bcc5,_0x3b5459){const _0x2e113b=a152_0x38ecd4,_0x19eef5={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2fd3a7 of _0x3924e2){try{if(_0x2fd3a7[_0x2e113b(0x14f)]===_0x2e113b(0x1ae)&&_0x2fd3a7[_0x2e113b(0x1a2)])_0x54bcc5[_0x2e113b(0x1dc)]?.({'type':'activation_creating','segmentName':_0x137852,'activationName':_0x2fd3a7[_0x2e113b(0x1a9)]}),await _0x54bcc5['withProgress'](_0x2e113b(0x14a)+_0x2fd3a7[_0x2e113b(0x1a9)]+_0x2e113b(0x105),()=>_0xde025f[_0x2e113b(0x1b6)][_0x2e113b(0x1a6)](_0x579ddc,_0x58d8ef,_0x2fd3a7[_0x2e113b(0x1a2)])),_0x54bcc5[_0x2e113b(0x1dc)]?.({'type':'activation_created','segmentName':_0x137852,'activationName':_0x2fd3a7['name']}),_0x54bcc5['logSuccess']?.(_0x2e113b(0x17b)+_0x2fd3a7[_0x2e113b(0x1a9)]+'\x27'),_0x19eef5[_0x2e113b(0x1e1)]++;else{if(_0x2fd3a7[_0x2e113b(0x14f)]===_0x2e113b(0x1a5)&&_0x2fd3a7[_0x2e113b(0x1a2)]&&_0x2fd3a7[_0x2e113b(0x1b2)])_0x54bcc5[_0x2e113b(0x1dc)]?.({'type':_0x2e113b(0xec),'segmentName':_0x137852,'activationName':_0x2fd3a7['name']}),await _0x54bcc5['withProgress'](_0x2e113b(0x15c)+_0x2fd3a7['name']+_0x2e113b(0x105),()=>_0xde025f['segment'][_0x2e113b(0x10a)](_0x579ddc,_0x58d8ef,_0x2fd3a7[_0x2e113b(0x1b2)]['id'],_0x2fd3a7[_0x2e113b(0x1a2)])),_0x54bcc5[_0x2e113b(0x1dc)]?.({'type':_0x2e113b(0x19e),'segmentName':_0x137852,'activationName':_0x2fd3a7[_0x2e113b(0x1a9)]}),_0x54bcc5[_0x2e113b(0x100)]?.(_0x2e113b(0x12c)+_0x2fd3a7[_0x2e113b(0x1a9)]+'\x27'),_0x19eef5[_0x2e113b(0x1dd)]++;else _0x2fd3a7[_0x2e113b(0x14f)]==='delete'&&_0x2fd3a7[_0x2e113b(0x1b2)]&&(_0x54bcc5['onProgress']?.({'type':_0x2e113b(0x167),'segmentName':_0x137852,'activationName':_0x2fd3a7['name']}),await _0x54bcc5[_0x2e113b(0xfb)](_0x2e113b(0x14e)+_0x2fd3a7['name']+_0x2e113b(0x105),()=>_0xde025f['segment'][_0x2e113b(0x147)](_0x579ddc,_0x58d8ef,_0x2fd3a7[_0x2e113b(0x1b2)]['id'])),_0x54bcc5[_0x2e113b(0x1dc)]?.({'type':'activation_deleted','segmentName':_0x137852,'activationName':_0x2fd3a7[_0x2e113b(0x1a9)]}),_0x54bcc5['logDeleted']?.(_0x2e113b(0x160)+_0x2fd3a7[_0x2e113b(0x1a9)]+'\x27'),_0x19eef5['deleted']++);}}catch(_0x5ef30c){const _0x39b1bc=isHttp400Error(_0x5ef30c),_0x2eae4a=_0x39b1bc?ErrorCode[_0x2e113b(0xfa)]:ErrorCode[_0x2e113b(0x151)],_0x4db2d0=getErrorMessage(_0x5ef30c);throw new SDKError(_0x2eae4a,_0x2e113b(0x108)+_0x2fd3a7[_0x2e113b(0x14f)]+_0x2e113b(0x181)+_0x2fd3a7['name']+_0x2e113b(0x1b0)+_0x3b5459+'\x0a\x20\x20'+_0x4db2d0,_0x5ef30c);}}return _0x19eef5;}export async function executePushFolders(_0x10a2b4,_0x2303e3,_0x390473,_0x34734f,_0x1d2736){const _0x1a302b=a152_0x38ecd4,_0x49e96b=new Map(_0x390473),_0x23b4ff=sortFoldersByDepth(_0x2303e3);for(const _0xecab76 of _0x23b4ff){const _0x508194=_0xecab76['split']('/'),_0x84be5c=_0x508194[_0x508194[_0x1a302b(0x113)]-0x1],_0x51c0e6=_0x508194[_0x1a302b(0x1a1)](0x0,-0x1)[_0x1a302b(0x17f)]('/'),_0x2b5f3b=_0x49e96b[_0x1a302b(0x143)](_0x51c0e6);_0x1d2736[_0x1a302b(0x1dc)]?.({'type':'folder_creating','folder':_0xecab76});const _0x1f9871={'name':_0x84be5c,'parentFolderId':_0x2b5f3b},_0x312fac=await _0x1d2736[_0x1a302b(0xfb)]('Creating\x20folder\x20\x27'+_0xecab76+_0x1a302b(0x105),()=>_0x10a2b4[_0x1a302b(0x1b6)][_0x1a302b(0x191)](_0x34734f['parentId'],_0x1f9871));_0x49e96b[_0x1a302b(0x10e)](_0xecab76,_0x312fac[_0x1a302b(0x1c5)]['id']),_0x1d2736['onProgress']?.({'type':_0x1a302b(0x102),'folder':_0xecab76,'folderId':_0x312fac['data']['id']}),_0x1d2736[_0x1a302b(0x134)]?.(_0x1a302b(0x155)+_0xecab76+'\x27');}return _0x49e96b;}export async function executePushSegmentDeletions(_0xa3159d,_0x38d525,_0x1df865){const _0x3e646b=a152_0x38ecd4;if(_0x38d525['length']===0x0)return 0x0;const {batchAsync:_0x109ab2}=await import(_0x3e646b(0x126)),_0x23a9e8=0x5,_0xc961c3=await _0x109ab2(_0x38d525,async _0xd627be=>{const _0x5f2813=_0x3e646b;return _0x1df865[_0x5f2813(0x1dc)]?.({'type':'segment_deleting','name':_0xd627be[_0x5f2813(0x1a9)]}),await _0xa3159d[_0x5f2813(0x1b6)][_0x5f2813(0x1be)](_0xd627be['id']),_0x1df865[_0x5f2813(0x1dc)]?.({'type':_0x5f2813(0x17e),'name':_0xd627be[_0x5f2813(0x1a9)]}),_0x1df865[_0x5f2813(0x15a)]?.(_0x5f2813(0x124)+_0xd627be[_0x5f2813(0x1a9)]+'\x27'),0x1;},_0x23a9e8);return _0xc961c3['reduce']((_0x5c751b,_0x3d21e0)=>_0x5c751b+_0x3d21e0,0x0);}export async function executePushJourneys(_0x134ea1,_0x1e6408,_0x3fb166,_0x34b827,_0x1c1579){const _0x49cb69=a152_0x38ecd4,{journeyDefToRequest:_0x1f6daf}=await import(_0x49cb69(0x130)),{activationDefToCreateRequest:_0x38b9ec,yamlRuleToApi:_0xc801bd,validateSegmentRule:_0x46c89a}=await import(_0x49cb69(0x1b4)),_0x20c767={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5673c9=new Map(_0x3fb166[_0x49cb69(0x190)]),_0xc7458e=0x5;for(let _0x1c406c=0x0;_0x1c406c<_0x1e6408[_0x49cb69(0x113)];_0x1c406c+=_0xc7458e){const _0x1ac652=_0x1e6408[_0x49cb69(0x1a1)](_0x1c406c,_0x1c406c+_0xc7458e),_0x2aa985=await Promise['all'](_0x1ac652[_0x49cb69(0x177)](async _0x570742=>{const _0x19603b=_0x49cb69;if(!_0x570742['isNew']&&!_0x570742[_0x19603b(0x1cc)])return{'action':_0x19603b(0x140),'name':_0x570742[_0x19603b(0xeb)][_0x19603b(0x1a9)],'journeyId':_0x570742[_0x19603b(0x186)]?.['id']};const _0x30354d=_0x570742[_0x19603b(0x1da)]?_0x3fb166[_0x19603b(0x173)][_0x19603b(0x143)](_0x570742[_0x19603b(0x1da)]):undefined;_0x1c1579[_0x19603b(0x1dc)]?.({'type':_0x570742[_0x19603b(0x106)]?_0x19603b(0x127):'journey_updating','name':_0x570742[_0x19603b(0xeb)]['name']});try{const _0x4659f1=await executeSingleJourneyPush(_0x134ea1,_0x570742,{..._0x3fb166,'segmentNameToId':_0x5673c9},{'parentId':_0x34b827[_0x19603b(0x12a)],'rootFolderId':_0x34b827[_0x19603b(0x17a)],'folderId':_0x30354d,'verbose':_0x34b827[_0x19603b(0x1c8)]},_0x1c1579,{'journeyDefToRequest':_0x1f6daf,'activationDefToCreateRequest':_0x38b9ec,'yamlRuleToApi':_0xc801bd,'validateSegmentRule':_0x46c89a});for(const [_0x414368,_0x1b3057]of _0x4659f1[_0x19603b(0x16e)]){_0x5673c9[_0x19603b(0x10e)](_0x414368,_0x1b3057),_0x20c767[_0x19603b(0x16e)][_0x19603b(0x10e)](_0x414368,_0x1b3057);}if(_0x4659f1['action']==='created')_0x1c1579[_0x19603b(0x1dc)]?.({'type':_0x19603b(0x1bf),'name':_0x570742['yamlConfig']['name'],'journeyId':_0x4659f1['journeyId']}),_0x1c1579[_0x19603b(0x100)]?.('Created\x20journey\x20\x27'+_0x570742[_0x19603b(0xeb)][_0x19603b(0x1a9)]+'\x27'),_0x20c767['created']++;else _0x4659f1[_0x19603b(0x10d)]===_0x19603b(0x1dd)&&(_0x1c1579['onProgress']?.({'type':'journey_updated','name':_0x570742[_0x19603b(0xeb)][_0x19603b(0x1a9)]}),_0x1c1579[_0x19603b(0x100)]?.(_0x19603b(0xef)+_0x570742[_0x19603b(0xeb)][_0x19603b(0x1a9)]+'\x27'),_0x20c767[_0x19603b(0x1dd)]++);return{'action':_0x4659f1[_0x19603b(0x10d)],'name':_0x570742[_0x19603b(0xeb)][_0x19603b(0x1a9)],'journeyId':_0x4659f1[_0x19603b(0x19f)]};}catch(_0x10c791){const _0x2d3fcc=isHttp400Error(_0x10c791),_0x351f7c=_0x2d3fcc?ErrorCode[_0x19603b(0x11a)]:ErrorCode[_0x19603b(0x129)],_0x530957=getErrorMessage(_0x10c791);throw new SDKError(_0x351f7c,'Failed\x20to\x20'+(_0x570742[_0x19603b(0x106)]?_0x19603b(0x1ae):_0x19603b(0x1a5))+_0x19603b(0x14c)+_0x570742[_0x19603b(0x1c9)]+_0x19603b(0x10c)+_0x530957,_0x10c791);}}));_0x20c767[_0x49cb69(0x166)][_0x49cb69(0x194)](..._0x2aa985);}return _0x20c767;}function a152_0x3394(_0x59196f,_0x4f5d48){_0x59196f=_0x59196f-0xe5;const _0x2183c7=a152_0x2183();let _0x3394d4=_0x2183c7[_0x59196f];return _0x3394d4;}async function matchExistingJourneySegments(_0x4412f9,_0x55f40c,_0x399a85,_0x319898,_0x2f8a5d){const _0x562dfd=a152_0x38ecd4;if(!_0x55f40c[_0x562dfd(0x186)]||!_0x55f40c['yamlConfig'][_0x562dfd(0x19a)])return;const _0x33db70=new Map(),_0x401fe5=new Set();for(const _0x567947 of Object[_0x562dfd(0xf9)](_0x55f40c[_0x562dfd(0xeb)][_0x562dfd(0x19a)])){const _0xb17904=generateDeterministicJourneySegmentName(_0x55f40c[_0x562dfd(0xeb)][_0x562dfd(0x1a9)],_0x567947);_0x33db70[_0x562dfd(0x10e)](_0xb17904,_0x567947),_0x401fe5[_0x562dfd(0x195)](_0x567947);}const _0xdd3489=[],_0x535fc5=collectSegmentIdsFromJourneyApi(_0x55f40c[_0x562dfd(0x186)]);for(const _0x61166f of _0x535fc5){const _0x5a1f83=await fetchSegment(_0x4412f9,_0x399a85,_0x61166f,_0x319898);if(!_0x5a1f83?.[_0x562dfd(0x1a9)])continue;const _0x3675f8=_0x33db70['get'](_0x5a1f83[_0x562dfd(0x1a9)]);_0x3675f8?(_0x2f8a5d[_0x562dfd(0x10e)](_0x3675f8,_0x61166f),_0x401fe5[_0x562dfd(0x12e)](_0x3675f8)):_0xdd3489[_0x562dfd(0x194)]({'id':_0x61166f,'seg':_0x5a1f83});}if(_0x401fe5['size']>0x0&&_0xdd3489[_0x562dfd(0x113)]>0x0){const {localExpandedRuleToNames:_0x5c91d9}=buildLocalExpandedRuleMappings(_0x55f40c[_0x562dfd(0xeb)]),_0x23dfc1=new Map();for(const {id:_0x5acac5,seg:_0x12ac76}of _0xdd3489){if(_0x12ac76['rule']){const _0x4e067b=apiRuleToYaml(_0x12ac76[_0x562dfd(0x1bc)]);_0x23dfc1[_0x562dfd(0x10e)](_0x5acac5,_0x4e067b);}}for(const {id:_0x397078,seg:_0x46f8d6}of _0xdd3489){if(!_0x46f8d6[_0x562dfd(0x1bc)])continue;const _0x1116b5=_0x23dfc1[_0x562dfd(0x143)](_0x397078);if(!_0x1116b5)continue;const _0x5632df=serializeExpandedRule(_0x1116b5,_0x23dfc1),_0x2f262b=_0x5c91d9[_0x562dfd(0x143)](_0x5632df);if(_0x2f262b){const _0x2a68e8=_0x2f262b[_0x562dfd(0x13e)](_0x292dff=>_0x401fe5[_0x562dfd(0x153)](_0x292dff));_0x2a68e8&&(_0x2f8a5d[_0x562dfd(0x10e)](_0x2a68e8,_0x397078),_0x401fe5[_0x562dfd(0x12e)](_0x2a68e8),logger['debug'](_0x562dfd(0x175)+_0x46f8d6[_0x562dfd(0x1a9)]+'\x27\x20to\x20local\x20\x27'+_0x2a68e8+_0x562dfd(0x132)));}}}}async function executeSingleJourneyPush(_0x48eca7,_0x520c75,_0x53e7e1,_0xe28982,_0x4f2703,_0x546446){const _0x45cc29=a152_0x38ecd4,{journeyDefToRequest:_0x34c7b6,activationDefToCreateRequest:_0x4b5881,yamlRuleToApi:_0x4c99cc,validateSegmentRule:_0x5d4c1d}=_0x546446,_0x5c9595=new Map(),_0x2cad29=new Map();recoverSegmentIdsFromPushRecovery(_0x520c75,_0x5c9595,_0x53e7e1['segmentNameToId']);const _0x144579=new Map(),_0x58a2fc=new Map(),_0x24f179=new Map();let _0x3cc218;const _0x5185d3=async()=>{const _0x3f95c9=a152_0x3394;if(_0x3cc218)return;_0x3cc218=new Map();if(!_0x520c75['existingJourney'])return;const _0x2da942=await _0x48eca7[_0x3f95c9(0x17c)][_0x3f95c9(0xe8)](_0x520c75[_0x3f95c9(0x186)]['id']);for(const _0x514979 of _0x2da942){const _0x12baff=journeyActivationStepToYaml(_0x514979,_0x53e7e1['idToEmailMap'],_0x53e7e1[_0x3f95c9(0x1db)]),_0x1e8630=activationSignature(_0x12baff);!_0x3cc218[_0x3f95c9(0x153)](_0x1e8630)&&_0x3cc218[_0x3f95c9(0x10e)](_0x1e8630,_0x514979['id']),_0x12baff['name']&&_0x2cad29[_0x3f95c9(0x10e)](_0x12baff[_0x3f95c9(0x1a9)],_0x514979['id']);}};await matchExistingJourneySegments(_0x48eca7,_0x520c75,_0xe28982[_0x45cc29(0x12a)],_0x53e7e1[_0x45cc29(0x197)],_0x53e7e1[_0x45cc29(0x190)]);const _0x2eab3c={'resolveSegmentId':async _0x12c68e=>{const _0x36a652=_0x45cc29,_0x1c7c54=_0x53e7e1[_0x36a652(0x190)][_0x36a652(0x143)](_0x12c68e);if(!_0x1c7c54)throw new SDKError(ErrorCode[_0x36a652(0x1ad)],'Segment\x20not\x20found:\x20'+_0x12c68e+'\x20(referenced\x20in\x20journey\x20'+_0x520c75[_0x36a652(0xeb)][_0x36a652(0x1a9)]+')');return _0x1c7c54;},'resolveEmbeddedSegmentId':async(_0x432c8f,_0x15728d)=>{const _0x301f07=_0x45cc29,_0x545379=_0x53e7e1['segmentNameToId'][_0x301f07(0x143)](_0x432c8f);if(_0x545379)return _0x545379;const _0x5c2559=_0x53e7e1[_0x301f07(0x197)][_0x301f07(0x13e)](_0x511c5e=>_0x511c5e[_0x301f07(0x1a9)]===_0x432c8f);if(_0x5c2559)return _0x53e7e1[_0x301f07(0x190)][_0x301f07(0x10e)](_0x432c8f,_0x5c2559['id']),_0x5c2559['id'];if(_0x520c75[_0x301f07(0x106)]){const {stageName:_0x35cd2b,criteriaName:_0x11bb75}=findSegmentCriteriaLocation(_0x520c75[_0x301f07(0xeb)],_0x432c8f);return _0x5d4c1d(_0x432c8f,_0x15728d[_0x301f07(0x1bc)]),_0x58a2fc['set'](_0x432c8f,{'definition':_0x15728d,'stageName':_0x35cd2b,'criteriaName':_0x11bb75}),createPendingSegmentId(_0x432c8f);}const _0x4019bb=_0x520c75[_0x301f07(0x186)]?.['id'];if(!_0x4019bb)throw new SDKError(ErrorCode[_0x301f07(0x1c6)],_0x301f07(0x13f));const _0x7134b0=_0x144579['get'](_0x432c8f);if(_0x7134b0)return _0x7134b0;const _0x3f5c20=((async()=>{const _0x580943=_0x301f07;_0x5d4c1d(_0x432c8f,_0x15728d['rule']);const _0x5f98a2=generateDeterministicJourneySegmentName(_0x520c75[_0x580943(0xeb)]['name'],_0x432c8f),_0x4bb8bd=_0x53e7e1[_0x580943(0x197)]['find'](_0x4ddf6c=>_0x4ddf6c[_0x580943(0x1a9)]===_0x5f98a2),_0x25afcd=createSegmentIdResolver(_0x53e7e1[_0x580943(0x190)],_0x432c8f),_0x2c1be8=await resolveRuleSegmentIds(_0x15728d[_0x580943(0x1bc)],_0x25afcd);let _0x197af2;return _0x4bb8bd?(await _0x48eca7[_0x580943(0x1b6)][_0x580943(0x12b)](_0xe28982[_0x580943(0x12a)],_0x4bb8bd['id'],{'description':_0x15728d[_0x580943(0x1d9)]||_0x580943(0x15e)+_0x432c8f,'rule':_0x4c99cc(_0x2c1be8),'countPopulation':!![]}),_0x197af2=_0x4bb8bd['id'],saveSegmentToPushRecovery(_0x520c75['absolutePath'],_0x520c75[_0x580943(0xeb)][_0x580943(0x1a9)],_0x432c8f,{'segmentId':_0x197af2,'uniqueServerName':_0x5f98a2,'createdAt':new Date()[_0x580943(0x10b)]()})):_0x197af2=await createOrRecoverEmbeddedSegment(_0x48eca7,_0x520c75,{'localName':_0x432c8f,'uniqueSegmentName':_0x5f98a2,'description':_0x15728d['description']||_0x580943(0x15e)+_0x432c8f,'journeyId':_0x4019bb,'resolvedRule':_0x2c1be8,'parentId':_0xe28982[_0x580943(0x12a)],'folderId':_0xe28982[_0x580943(0x17a)]||''},_0x4c99cc),_0x53e7e1[_0x580943(0x190)]['set'](_0x432c8f,_0x197af2),_0x5c9595[_0x580943(0x10e)](_0x432c8f,_0x197af2),_0x197af2;})());_0x144579['set'](_0x432c8f,_0x3f5c20);try{return await _0x3f5c20;}finally{_0x144579[_0x301f07(0x12e)](_0x432c8f);}},'resolveActivationId':async _0x2282e0=>{const _0x4a805e=_0x45cc29,_0x1c1905=_0x2cad29[_0x4a805e(0x143)](_0x2282e0);if(_0x1c1905)return _0x1c1905;if(_0x520c75[_0x4a805e(0x186)]){await _0x5185d3();const _0x4a675f=_0x2cad29[_0x4a805e(0x143)](_0x2282e0);if(_0x4a675f)return _0x4a675f;}throw new SDKError(ErrorCode[_0x4a805e(0x1de)],'Activation\x20not\x20found:\x20'+_0x2282e0+'\x20(referenced\x20in\x20journey\x20'+_0x520c75[_0x4a805e(0xeb)][_0x4a805e(0x1a9)]+_0x4a805e(0x198)+_0x4a805e(0x1c7));},'resolveEmbeddedActivationId':async(_0x47563e,_0x4018be)=>{const _0x4a8cdc=_0x45cc29,_0x1ff705=_0x2cad29[_0x4a8cdc(0x143)](_0x47563e);if(_0x1ff705)return _0x1ff705;if(_0x520c75[_0x4a8cdc(0x106)])return _0x24f179[_0x4a8cdc(0x10e)](_0x47563e,_0x4018be),createPendingActivationId(_0x47563e);if(_0x520c75['existingJourney']){await _0x5185d3();const _0x36ad27=_0x2cad29[_0x4a8cdc(0x143)](_0x4018be['name']);if(_0x36ad27)return _0x2cad29['set'](_0x47563e,_0x36ad27),_0x36ad27;const _0x4e832f=activationSignature(_0x4018be),_0x3c3bbc=_0x3cc218?.[_0x4a8cdc(0x143)](_0x4e832f);if(_0x3c3bbc)return _0x2cad29[_0x4a8cdc(0x10e)](_0x47563e,_0x3c3bbc),_0x3c3bbc;const _0x1ec586=await _0x4b5881(_0x4018be,_0x53e7e1[_0x4a8cdc(0x18e)]),_0xd33e1={..._0x1ec586,..._0x4018be[_0x4a8cdc(0x149)]!==undefined&&{'runAfterJourneyRefresh':_0x4018be[_0x4a8cdc(0x149)]}},_0x16cb7e=await _0x48eca7['journey'][_0x4a8cdc(0x1a6)](_0x520c75['existingJourney']['id'],_0xd33e1);return _0x2cad29[_0x4a8cdc(0x10e)](_0x47563e,_0x16cb7e['id']),_0x16cb7e['id'];}throw new SDKError(ErrorCode[_0x4a8cdc(0x1c6)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x159cf4=>{const _0x27c9be=_0x45cc29;try{return await _0x48eca7[_0x27c9be(0x17c)]['resolveJourneyId'](_0xe28982[_0x27c9be(0x12a)],_0x159cf4);}catch(_0x4585ab){throw new SDKError(ErrorCode[_0x27c9be(0x1de)],'Journey\x20\x27'+_0x159cf4+_0x27c9be(0x150)+_0x520c75[_0x27c9be(0xeb)][_0x27c9be(0x1a9)]+'\x27)',_0x4585ab);}},'resolveStageId':async(_0x3dd67f,_0x4c5709)=>{const _0x47f306=_0x45cc29,_0x225337=await _0x48eca7['journey'][_0x47f306(0x1b9)](_0x3dd67f),_0x43bacf=_0x225337['attributes'][_0x47f306(0x136)][_0x47f306(0x13e)](_0x2ad2a0=>_0x2ad2a0[_0x47f306(0x1a9)][_0x47f306(0x1c0)]()===_0x4c5709[_0x47f306(0x1c0)]());if(!_0x43bacf?.['id'])throw new SDKError(ErrorCode[_0x47f306(0x1de)],_0x47f306(0x15b)+_0x4c5709+_0x47f306(0x165)+(_0x225337[_0x47f306(0x10f)][_0x47f306(0x1c3)]||_0x225337[_0x47f306(0x10f)]['name'])+'\x27');return _0x43bacf['id'];}},_0x115a87=await _0x34c7b6(_0x520c75['yamlConfig'],_0xe28982[_0x45cc29(0x12a)],_0x2eab3c),_0x1c00f4=_0xe28982[_0x45cc29(0x189)]||_0xe28982[_0x45cc29(0x17a)];_0x1c00f4&&(_0x115a87[_0x45cc29(0x145)]={'parentFolder':{'data':{'id':_0x1c00f4,'type':_0x45cc29(0x1ba)}}});if(_0x520c75[_0x45cc29(0x106)]){if(_0x58a2fc['size']>0x0||_0x24f179['size']>0x0)return await executeThreeStepJourneyCreate(_0x48eca7,_0x520c75,_0x115a87,{'pendingEmbeddedSegments':_0x58a2fc,'pendingEmbeddedActivations':_0x24f179,'embeddedSegmentNameToId':_0x5c9595,'journeyActivationNameToId':_0x2cad29},{..._0xe28982,'effectiveFolderId':_0x1c00f4},_0x53e7e1,_0x4f2703,_0x546446);else{ensureJourneyDefaults(_0x115a87[_0x45cc29(0x10f)]);const _0x1afeb0=await _0x48eca7[_0x45cc29(0x17c)][_0x45cc29(0x1ae)](_0x115a87);return deletePushRecovery(_0x520c75['absolutePath']),{'action':'created','journeyId':_0x1afeb0['id'],'embeddedSegmentNameToId':_0x5c9595};}}else{if(_0x520c75['hasChanges']&&_0x520c75['existingJourney']){_0x115a87['id']=_0x520c75[_0x45cc29(0x186)]['id'];const _0x42631c=_0x115a87[_0x45cc29(0x10f)];_0x520c75[_0x45cc29(0x186)][_0x45cc29(0x10f)]?.['journeyBundleName']&&(_0x42631c['journeyBundleName']=_0x520c75[_0x45cc29(0x186)]['attributes'][_0x45cc29(0x1c3)]);const _0x2e9e72=_0x520c75[_0x45cc29(0x186)][_0x45cc29(0x10f)]?.[_0x45cc29(0x136)];return _0x2e9e72&&_0x115a87[_0x45cc29(0x10f)][_0x45cc29(0x136)]&&injectExistingStageIds(_0x115a87[_0x45cc29(0x10f)][_0x45cc29(0x136)],_0x2e9e72),ensureJourneyDefaults(_0x42631c),await _0x48eca7[_0x45cc29(0x17c)][_0x45cc29(0x1a5)](_0x520c75['existingJourney']['id'],_0x115a87),deletePushRecovery(_0x520c75[_0x45cc29(0x1c9)]),{'action':_0x45cc29(0x1dd),'journeyId':_0x520c75[_0x45cc29(0x186)]['id'],'embeddedSegmentNameToId':_0x5c9595};}}return deletePushRecovery(_0x520c75['absolutePath']),{'action':'unchanged','journeyId':_0x520c75[_0x45cc29(0x186)]?.['id'],'embeddedSegmentNameToId':_0x5c9595};}function findSegmentCriteriaLocation(_0x4d0017,_0x34534e){const _0x570bc5=a152_0x38ecd4,_0x1ae407=_0x4d0017[_0x570bc5(0x1d0)]||_0x4d0017[_0x570bc5(0x18f)]?.[0x0]?.[_0x570bc5(0x1d0)]||[];let _0x28c8d6=_0x570bc5(0x139),_0x3e525a=_0x34534e;const _0x49c37d=_0x4d0017['goal']||_0x4d0017[_0x570bc5(0x18f)]?.[0x0]?.['goal'];if(_0x49c37d?.[_0x570bc5(0x1b6)]===_0x34534e)return{'stageName':_0x570bc5(0x159),'criteriaName':_0x49c37d['name']||_0x34534e};_0x9af5a7:for(const _0x28d9c9 of _0x1ae407){if(_0x28d9c9[_0x570bc5(0xe6)]?.[_0x570bc5(0x1b6)]===_0x34534e){_0x28c8d6=_0x28d9c9[_0x570bc5(0x1a9)],_0x3e525a=_0x28d9c9[_0x570bc5(0xe6)][_0x570bc5(0x1a9)]||_0x34534e;break;}if(_0x28d9c9[_0x570bc5(0x104)])for(const _0x5a8f02 of _0x28d9c9[_0x570bc5(0x104)]){if(_0x5a8f02[_0x570bc5(0x14f)]===_0x570bc5(0x15d)&&_0x5a8f02[_0x570bc5(0x11d)]?.[_0x570bc5(0x12f)])for(const _0x1f1cd9 of _0x5a8f02[_0x570bc5(0x11d)][_0x570bc5(0x12f)]){if(_0x1f1cd9[_0x570bc5(0x1b6)]===_0x34534e){_0x28c8d6=_0x28d9c9['name'],_0x3e525a=_0x1f1cd9[_0x570bc5(0x1a9)]||_0x34534e;break _0x9af5a7;}}}}return{'stageName':_0x28c8d6,'criteriaName':_0x3e525a};}async function executeThreeStepJourneyCreate(_0x7cb357,_0x2c256a,_0x132f9c,_0x4276f7,_0x5675eb,_0x47918b,_0x54056f,_0x1e2892){const _0x3901a0=a152_0x38ecd4,{activationDefToCreateRequest:_0x1f9062,yamlRuleToApi:_0x362896}=_0x1e2892,{pendingEmbeddedSegments:_0x12af29,pendingEmbeddedActivations:_0x23521b,embeddedSegmentNameToId:_0x41210b}=_0x4276f7,_0x168068=JSON['parse'](JSON['stringify'](_0x132f9c));ensureJourneyDefaults(_0x168068[_0x3901a0(0x10f)]),stripPendingIds(_0x168068);const _0x13bd18=await _0x7cb357['journey'][_0x3901a0(0x1ae)](_0x168068),_0xfe6a69=_0x13bd18['id'],_0x2a8ebc=new Map();for(const _0x3d653e of _0x13bd18[_0x3901a0(0x10f)][_0x3901a0(0x136)]){_0x2a8ebc[_0x3901a0(0x10e)](_0x3d653e[_0x3901a0(0x1a9)][_0x3901a0(0x1c0)](),_0x3d653e['id']);}recoverSegmentIdsFromPushRecovery(_0x2c256a,_0x41210b,_0x47918b['segmentNameToId']);for(const [_0x31c438,{definition:_0x34dd9a}]of _0x12af29){if(_0x41210b[_0x3901a0(0x153)](_0x31c438)){_0x54056f[_0x3901a0(0x1dc)]?.({'type':_0x3901a0(0x16c),'journeyName':_0x2c256a['yamlConfig'][_0x3901a0(0x1a9)],'segmentName':_0x31c438});continue;}const _0x405863=generateDeterministicJourneySegmentName(_0x2c256a[_0x3901a0(0xeb)][_0x3901a0(0x1a9)],_0x31c438);_0x54056f[_0x3901a0(0x1dc)]?.({'type':'embedded_segment_creating','journeyName':_0x2c256a['yamlConfig'][_0x3901a0(0x1a9)],'segmentName':_0x31c438});const _0x491a61=createSegmentIdResolver(_0x47918b['segmentNameToId'],_0x31c438),_0x2f126c=await resolveRuleSegmentIds(_0x34dd9a['rule'],_0x491a61),_0x1eb186=await createOrRecoverEmbeddedSegment(_0x7cb357,_0x2c256a,{'localName':_0x31c438,'uniqueSegmentName':_0x405863,'description':_0x34dd9a['description']||_0x3901a0(0x15e)+_0x31c438,'journeyId':_0xfe6a69,'resolvedRule':_0x2f126c,'parentId':_0x5675eb['parentId'],'folderId':_0x5675eb[_0x3901a0(0x174)]||''},_0x362896);_0x41210b[_0x3901a0(0x10e)](_0x31c438,_0x1eb186),_0x47918b[_0x3901a0(0x190)]['set'](_0x31c438,_0x1eb186),_0x54056f[_0x3901a0(0x1dc)]?.({'type':_0x3901a0(0x16c),'journeyName':_0x2c256a[_0x3901a0(0xeb)][_0x3901a0(0x1a9)],'segmentName':_0x31c438});}const _0xf975a8=new Map();for(const [_0x30cccc,_0x2aacb5]of _0x23521b){_0x54056f[_0x3901a0(0x1dc)]?.({'type':'embedded_activation_creating','journeyName':_0x2c256a[_0x3901a0(0xeb)][_0x3901a0(0x1a9)],'activationName':_0x30cccc});const _0x5e5f9e=await _0x1f9062(_0x2aacb5,_0x47918b['activationContext']),_0x52b1fb={..._0x5e5f9e,..._0x2aacb5[_0x3901a0(0x149)]!==undefined&&{'runAfterJourneyRefresh':_0x2aacb5['run_after_journey_refresh']}},_0x4b5ef0=await _0x7cb357['journey'][_0x3901a0(0x1a6)](_0xfe6a69,_0x52b1fb);_0xf975a8[_0x3901a0(0x10e)](_0x30cccc,_0x4b5ef0['id']),_0x4276f7['journeyActivationNameToId'][_0x3901a0(0x10e)](_0x30cccc,_0x4b5ef0['id']),_0x54056f[_0x3901a0(0x1dc)]?.({'type':_0x3901a0(0x172),'journeyName':_0x2c256a['yamlConfig'][_0x3901a0(0x1a9)],'activationName':_0x30cccc});}const _0x1a7211=JSON[_0x3901a0(0x16d)](JSON['stringify'](_0x132f9c));return _0x1a7211['id']=_0xfe6a69,ensureJourneyDefaults(_0x1a7211[_0x3901a0(0x10f)]),resolvePendingIdsInRequest(_0x1a7211,_0x132f9c,_0x2a8ebc,_0x41210b,_0xf975a8,_0x54056f),await _0x7cb357[_0x3901a0(0x17c)][_0x3901a0(0x1a5)](_0xfe6a69,_0x1a7211),deletePushRecovery(_0x2c256a[_0x3901a0(0x1c9)]),{'action':_0x3901a0(0x1e1),'journeyId':_0xfe6a69,'embeddedSegmentNameToId':_0x41210b};}export function stripWaitStepPendingIds(_0x1b3e7d){const _0x267b60=a152_0x38ecd4,_0x5d1637=_0x1b3e7d[_0x267b60(0x157)]&&isPendingSegmentId(_0x1b3e7d['conditionSegmentId']),_0xc444b6=_0x1b3e7d[_0x267b60(0x18d)]?.[_0x267b60(0x118)](_0x4b3ead=>_0x4b3ead[_0x267b60(0x119)]&&isPendingSegmentId(_0x4b3ead[_0x267b60(0x119)]));(_0x5d1637||_0xc444b6)&&(_0x1b3e7d[_0x267b60(0x19c)]='Duration',_0x1b3e7d[_0x267b60(0xfc)]=0x1,_0x1b3e7d['waitStepUnit']=_0x267b60(0x128),delete _0x1b3e7d[_0x267b60(0x157)],delete _0x1b3e7d[_0x267b60(0xe5)],delete _0x1b3e7d[_0x267b60(0xf0)],delete _0x1b3e7d['conditions']);}export function resolveWaitStepPendingIds(_0x5a55aa,_0x1c9e9f,_0x1fced4,_0x22ea9a){const _0x141efb=a152_0x38ecd4;if(_0x1c9e9f[_0x141efb(0x157)]&&isPendingSegmentId(_0x1c9e9f[_0x141efb(0x157)])){const _0x23e5f6=_0x1fced4(_0x1c9e9f[_0x141efb(0x157)],_0x141efb(0x137)+_0x22ea9a+_0x141efb(0x13d));_0x23e5f6&&(_0x5a55aa['waitStepType']=_0x141efb(0x185),_0x5a55aa[_0x141efb(0x157)]=_0x23e5f6,delete _0x5a55aa[_0x141efb(0xfc)],delete _0x5a55aa[_0x141efb(0x18b)],_0x1c9e9f[_0x141efb(0xe5)]!==undefined&&(_0x5a55aa[_0x141efb(0xe5)]=_0x1c9e9f['conditionTimeoutDuration']),_0x1c9e9f['conditionTimeoutUnit']&&(_0x5a55aa['conditionTimeoutUnit']=_0x1c9e9f[_0x141efb(0xf0)]));}if(_0x1c9e9f[_0x141efb(0x18d)]){const _0x1e4cf4=_0x1c9e9f[_0x141efb(0x18d)][_0x141efb(0x118)](_0x724b2=>_0x724b2['segmentId']&&isPendingSegmentId(_0x724b2[_0x141efb(0x119)]));if(_0x1e4cf4){const _0x1d1888=_0x1c9e9f[_0x141efb(0x18d)][_0x141efb(0x177)](_0x41ad4f=>{const _0x35c64e=_0x141efb;if(_0x41ad4f['segmentId']&&isPendingSegmentId(_0x41ad4f['segmentId'])){const _0x2e4a93=_0x1fced4(_0x41ad4f[_0x35c64e(0x119)],_0x35c64e(0x137)+_0x22ea9a+_0x35c64e(0x13d));return{..._0x41ad4f,'segmentId':_0x2e4a93||_0x41ad4f['segmentId']};}return{..._0x41ad4f};});_0x5a55aa['waitStepType']=_0x141efb(0x185),_0x5a55aa[_0x141efb(0x18d)]=_0x1d1888,delete _0x5a55aa[_0x141efb(0xfc)],delete _0x5a55aa['waitStepUnit'],delete _0x5a55aa['conditionSegmentId'],delete _0x5a55aa[_0x141efb(0xe5)],delete _0x5a55aa[_0x141efb(0xf0)];}}}function stripPendingIds(_0x211dd1){const _0x177f8b=a152_0x38ecd4;_0x211dd1['attributes']['goal']?.[_0x177f8b(0x119)]&&isPendingSegmentId(_0x211dd1[_0x177f8b(0x10f)]['goal'][_0x177f8b(0x119)])&&delete _0x211dd1[_0x177f8b(0x10f)][_0x177f8b(0x159)];for(const _0x2e5081 of _0x211dd1[_0x177f8b(0x10f)][_0x177f8b(0x136)]||[]){_0x2e5081[_0x177f8b(0x144)]?.[_0x177f8b(0x119)]&&isPendingSegmentId(_0x2e5081[_0x177f8b(0x144)][_0x177f8b(0x119)])&&delete _0x2e5081['entryCriteria'];_0x2e5081[_0x177f8b(0x1aa)]?.[_0x177f8b(0x119)]&&isPendingSegmentId(_0x2e5081[_0x177f8b(0x1aa)][_0x177f8b(0x119)])&&delete _0x2e5081[_0x177f8b(0x1aa)];_0x2e5081[_0x177f8b(0x1d5)]&&(_0x2e5081[_0x177f8b(0x1d5)]=_0x2e5081[_0x177f8b(0x1d5)][_0x177f8b(0x1d6)](_0x1c848c=>!_0x1c848c[_0x177f8b(0x119)]||!isPendingSegmentId(_0x1c848c[_0x177f8b(0x119)])));if(_0x2e5081[_0x177f8b(0x104)])for(const _0x31e094 of Object[_0x177f8b(0xf9)](_0x2e5081[_0x177f8b(0x104)])){const _0x2c25f6=_0x2e5081[_0x177f8b(0x104)][_0x31e094];_0x2c25f6[_0x177f8b(0x14f)]===_0x177f8b(0x1af)&&_0x2c25f6[_0x177f8b(0x116)]&&isPendingActivationId(_0x2c25f6['journeyActivationStepId'])&&(_0x2c25f6[_0x177f8b(0x116)]='');if(_0x2c25f6[_0x177f8b(0x14f)]===_0x177f8b(0x1a4)&&_0x2c25f6[_0x177f8b(0x12f)])for(const _0x36e7d3 of _0x2c25f6['branches']){_0x36e7d3[_0x177f8b(0x119)]&&isPendingSegmentId(_0x36e7d3[_0x177f8b(0x119)])&&(_0x36e7d3[_0x177f8b(0x119)]='');}_0x2c25f6[_0x177f8b(0x14f)]===_0x177f8b(0x16a)&&stripWaitStepPendingIds(_0x2c25f6);}}}function resolvePendingIdsInRequest(_0x4e041f,_0x3b13fd,_0x37a77b,_0xffe0ca,_0x7c85a7,_0x60d12){const _0x4d2b13=a152_0x38ecd4,_0x11aa77=(_0x445aee,_0x32fcab)=>{const _0x2279b1=a152_0x3394;if(!isPendingSegmentId(_0x445aee))return _0x445aee;const _0x76a747=extractPendingSegmentName(_0x445aee),_0x4d60d6=_0xffe0ca[_0x2279b1(0x143)](_0x76a747);return!_0x4d60d6&&_0x60d12[_0x2279b1(0xf6)]?.(_0x2279b1(0x1bd)+_0x76a747+_0x2279b1(0x1d2)+_0x32fcab),_0x4d60d6;};if(_0x4e041f[_0x4d2b13(0x10f)][_0x4d2b13(0x159)]?.[_0x4d2b13(0x119)]&&isPendingSegmentId(_0x4e041f['attributes'][_0x4d2b13(0x159)][_0x4d2b13(0x119)])){const _0x5b252d=_0x11aa77(_0x4e041f[_0x4d2b13(0x10f)][_0x4d2b13(0x159)][_0x4d2b13(0x119)],_0x4d2b13(0x193));_0x5b252d&&(_0x4e041f['attributes'][_0x4d2b13(0x159)][_0x4d2b13(0x119)]=_0x5b252d);}for(const _0x4c2f21 of _0x4e041f['attributes'][_0x4d2b13(0x136)]||[]){const _0x143e26=_0x37a77b['get'](_0x4c2f21['name'][_0x4d2b13(0x1c0)]());_0x143e26&&(_0x4c2f21['id']=_0x143e26);if(_0x4c2f21[_0x4d2b13(0x144)]?.[_0x4d2b13(0x119)]&&isPendingSegmentId(_0x4c2f21[_0x4d2b13(0x144)][_0x4d2b13(0x119)])){const _0x2fc767=_0x11aa77(_0x4c2f21['entryCriteria'][_0x4d2b13(0x119)],_0x4d2b13(0x137)+_0x4c2f21[_0x4d2b13(0x1a9)]+_0x4d2b13(0x152));_0x2fc767&&(_0x4c2f21[_0x4d2b13(0x144)][_0x4d2b13(0x119)]=_0x2fc767);}if(_0x4c2f21['exitCriterias'])for(const _0x2181f9 of _0x4c2f21[_0x4d2b13(0x1d5)]){if(_0x2181f9['segmentId']&&isPendingSegmentId(_0x2181f9[_0x4d2b13(0x119)])){const _0x352c42=_0x11aa77(_0x2181f9[_0x4d2b13(0x119)],_0x4d2b13(0x137)+_0x4c2f21[_0x4d2b13(0x1a9)]+_0x4d2b13(0x120));_0x352c42&&(_0x2181f9[_0x4d2b13(0x119)]=_0x352c42);}}if(_0x4c2f21[_0x4d2b13(0x1aa)]?.['segmentId']&&isPendingSegmentId(_0x4c2f21[_0x4d2b13(0x1aa)][_0x4d2b13(0x119)])){const _0x53a032=_0x11aa77(_0x4c2f21['milestone']['segmentId'],_0x4d2b13(0x137)+_0x4c2f21[_0x4d2b13(0x1a9)]+'\x27\x20milestone');_0x53a032&&(_0x4c2f21[_0x4d2b13(0x1aa)][_0x4d2b13(0x119)]=_0x53a032);}if(_0x4c2f21['steps']){const _0x4293df=_0x503521=>_0x3b13fd[_0x4d2b13(0x10f)][_0x4d2b13(0x136)]?.[_0x4d2b13(0x13e)](_0x3c3b92=>_0x3c3b92[_0x4d2b13(0x1a9)]['toLowerCase']()===_0x4c2f21['name'][_0x4d2b13(0x1c0)]())?.['steps']?.[_0x503521];for(const _0x4387ff of Object[_0x4d2b13(0xf9)](_0x4c2f21[_0x4d2b13(0x104)])){const _0x5ebbdb=_0x4c2f21[_0x4d2b13(0x104)][_0x4387ff],_0x1183ea=_0x4293df(_0x4387ff);if(_0x5ebbdb[_0x4d2b13(0x14f)]===_0x4d2b13(0x1af)&&_0x5ebbdb[_0x4d2b13(0x116)]&&(isPendingActivationId(_0x5ebbdb[_0x4d2b13(0x116)])||_0x5ebbdb[_0x4d2b13(0x116)]==='')){if(_0x1183ea?.[_0x4d2b13(0x116)]&&isPendingActivationId(_0x1183ea[_0x4d2b13(0x116)])){const _0x4023a2=extractPendingActivationName(_0x1183ea[_0x4d2b13(0x116)]),_0x496373=_0x7c85a7['get'](_0x4023a2);_0x496373&&(_0x5ebbdb[_0x4d2b13(0x116)]=_0x496373);}}if(_0x5ebbdb[_0x4d2b13(0x14f)]===_0x4d2b13(0x1a4)&&_0x5ebbdb[_0x4d2b13(0x12f)]&&_0x1183ea?.['branches'])for(let _0x322bb2=0x0;_0x322bb2<_0x5ebbdb[_0x4d2b13(0x12f)][_0x4d2b13(0x113)];_0x322bb2++){const _0x3f3c99=_0x5ebbdb['branches'][_0x322bb2],_0x31b6ff=_0x1183ea[_0x4d2b13(0x12f)][_0x322bb2];if(_0x31b6ff?.[_0x4d2b13(0x119)]&&isPendingSegmentId(_0x31b6ff[_0x4d2b13(0x119)])){const _0x3476b3=_0x11aa77(_0x31b6ff['segmentId'],_0x4d2b13(0x137)+_0x4c2f21[_0x4d2b13(0x1a9)]+_0x4d2b13(0x176)+(_0x3f3c99['name']||_0x322bb2)+'\x27');_0x3476b3&&(_0x3f3c99[_0x4d2b13(0x119)]=_0x3476b3);}}_0x5ebbdb[_0x4d2b13(0x14f)]==='WaitStep'&&_0x1183ea?.[_0x4d2b13(0x14f)]===_0x4d2b13(0x16a)&&resolveWaitStepPendingIds(_0x5ebbdb,_0x1183ea,_0x11aa77,_0x4c2f21['name']);}}}}
1
+ const a152_0x33e6a2=a152_0x591f;(function(_0xb03d36,_0x1c8cc2){const _0x650d8f=a152_0x591f,_0x663443=_0xb03d36();while(!![]){try{const _0x38832b=parseInt(_0x650d8f(0x13c))/0x1*(-parseInt(_0x650d8f(0xa4))/0x2)+parseInt(_0x650d8f(0xa9))/0x3+parseInt(_0x650d8f(0x139))/0x4*(parseInt(_0x650d8f(0x12b))/0x5)+parseInt(_0x650d8f(0x112))/0x6*(parseInt(_0x650d8f(0xcc))/0x7)+parseInt(_0x650d8f(0x113))/0x8+-parseInt(_0x650d8f(0x108))/0x9+-parseInt(_0x650d8f(0xee))/0xa;if(_0x38832b===_0x1c8cc2)break;else _0x663443['push'](_0x663443['shift']());}catch(_0x2c8aaf){_0x663443['push'](_0x663443['shift']());}}}(a152_0x555c,0x710fc));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a152_0x33e6a2(0xef);export const PENDING_ACTIVATION_PREFIX=a152_0x33e6a2(0x13f);export function createPendingSegmentId(_0x25074c){return''+PENDING_SEGMENT_PREFIX+_0x25074c+'__';}export function isPendingSegmentId(_0x5d247e){const _0x4089cf=a152_0x33e6a2;return _0x5d247e['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x5d247e[_0x4089cf(0xe8)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3e1139){return _0x3e1139['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4cc1b8){return''+PENDING_ACTIVATION_PREFIX+_0x4cc1b8+'__';}export function isPendingActivationId(_0x4fe5f5){const _0x45944c=a152_0x33e6a2;return _0x4fe5f5[_0x45944c(0xe8)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5531b1){const _0x2c167d=a152_0x33e6a2;return _0x5531b1[_0x2c167d(0xb7)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x2a9aa9,_0x1234de){const _0xa104dd=a152_0x33e6a2,_0x59876a=_0x2a9aa9+'::'+(_0x1234de[_0xa104dd(0xc5)]()||_0xa104dd(0x197)),_0x241209=createHash('sha1')['update'](_0x59876a)[_0xa104dd(0x158)](_0xa104dd(0x12d))[_0xa104dd(0x12c)](0x0,0xc);return _0xa104dd(0x15d)+_0x241209;}export function ensureJourneyDefaults(_0x3ce02b){const _0x1d1fdb=a152_0x33e6a2;!_0x3ce02b[_0x1d1fdb(0xdf)]&&(_0x3ce02b[_0x1d1fdb(0xdf)]=''),!_0x3ce02b[_0x1d1fdb(0x19a)]&&(_0x3ce02b[_0x1d1fdb(0x19a)]=_0x1d1fdb(0x14a));}export function injectExistingStageIds(_0x348a16,_0xdbe24c){const _0x20b5bd=a152_0x33e6a2,_0x2ba503=new Map(_0xdbe24c[_0x20b5bd(0x129)](_0x14f4e2=>[_0x14f4e2['name'],_0x14f4e2['id']]));for(const _0x5151f3 of _0x348a16){if(!_0x5151f3['id']){const _0x37c7a3=_0x2ba503['get'](_0x5151f3[_0x20b5bd(0x121)]);_0x37c7a3&&(_0x5151f3['id']=_0x37c7a3);}}}export function resolveTDFolderPath(_0x18e0df,_0xe080b3,_0x4c293d){const _0x1f9fef=a152_0x33e6a2;if(!_0xe080b3)return _0x18e0df;if(_0x18e0df===_0x4c293d||_0x18e0df[_0x1f9fef(0xe8)](_0x4c293d+'/'))return _0x18e0df;return _0x18e0df?_0x4c293d+'/'+_0x18e0df:_0x4c293d;}export function addFoldersToCreate(_0x18df84,_0xab9533,_0xa408b8){const _0x423bc7=a152_0x33e6a2;if(!_0x18df84)return;if(_0xab9533[_0x423bc7(0x198)](_0x18df84))return;const _0x15f4fa=_0x18df84[_0x423bc7(0xc9)]('/');let _0x2d6ed2='';for(const _0x178ca6 of _0x15f4fa){_0x2d6ed2=_0x2d6ed2?_0x2d6ed2+'/'+_0x178ca6:_0x178ca6,!_0xab9533[_0x423bc7(0x198)](_0x2d6ed2)&&_0xa408b8[_0x423bc7(0xbb)](_0x2d6ed2);}}export function sortFoldersByDepth(_0x2c5b46){const _0x297dfd=a152_0x33e6a2;return[..._0x2c5b46][_0x297dfd(0xb8)]((_0x557bb4,_0x329d1a)=>{const _0x21e981=_0x297dfd,_0x45a6a6=(_0x557bb4['match'](/\//g)||[])[_0x21e981(0xae)],_0x5c190a=(_0x329d1a[_0x21e981(0x17f)](/\//g)||[])[_0x21e981(0xae)];return _0x45a6a6-_0x5c190a;});}import*as a152_0x559f5b from'yaml';import{readFileSync}from'fs';function a152_0x555c(){const _0xf23850=['isArray','unchanged','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','isNew','journey','segmentFolderId','deps','journey_created','SEGMENT_SYNTAX_ERROR','137542NwjgED','get','hasChanges','activation_updating','uniqueServerName','811680mRqQlQ','activation_template_id','Activation','updateActivation','\x20segment\x20from\x20file:\x20','length','push','attributes','some','parseDocument','journey_updated','conditionTimeoutDuration','NOT_FOUND','\x27\x20exit\x20criteria','replace','sort','Activation\x20not\x20found:\x20','nameToId','add','join','segment_deleted','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','withProgress','journeys','data','):\x20','DecisionPoint','SEGMENT_NOT_FOUND','trim','journeyActivationStepId','conditionTimeoutUnit','Creating\x20segment\x20\x27','split','utf-8','resolveSegment','3227FblMEh','Created\x20folder\x20\x27','listActivations','onProgress','\x20journey\x20from\x20file:\x20','from','journeyBundleName','activationActions','uniqueSegmentName',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','relationships','\x0a\x20\x20','relative','connectionIdToNameMap','localName','segments','flatMap','Embedded\x20segment\x20\x27','embeddedSegmentNameToId','description','deleteSegment','create','folderPath','reduce','item','\x27\x20decision\x20point\x20branch\x20\x27','createdSegmentId','getJourney','startsWith','entry_criteria','logDeleted','Condition','segmentNameToId','kind','396280pKCQUk','__pending_','size','columns','all_columns','activations','entryCriteria','includes','debug','waitStepType','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Segment\x20not\x20found:\x20','schedule','waitStep','steps','diff','journeyName','folderPathToId','goal','rootFolderId','activation_deleting','journeyStages','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20from\x20file:\x20','yamlConfig','activation_','4839102efQFZJ','find','\x27\x20by\x20rule\x20content','parentId','valid','activation_created','\x27\x20for\x20','journey_creating','updateSegmentById','validatedRequest','8508thXWFm','3243400yzbLQj','segment_created','SEGMENT_UPDATE_ERROR','getLatestJourneyId','values','type','\x20error(s)','max','yamlActivation','entry','created','activationContext','JOURNEY_SYNTAX_ERROR','updated','name','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20','conditionSegmentId','existingJourney','activation_deleted','conditions','branches','map','toISOString','136445adsFaC','slice','hex','notification','filter','createActivation','embedded_segment_creating','stage\x20\x27','journey_updating','getSegment','toLowerCase','keys','activationsBySegmentId','journeyId','8UvJNiy','WaitStep','segment_updating','5pNysIJ','logSuccess','run_after_journey_refresh','__pending_act_','rule','segment_deleting','activationStepsById','Updating\x20segment\x20\x27','Creating\x20folder\x20\x27','ACTIVATION_SYNTAX_ERROR','goal\x20criteria','verbose','with','embedded_segment_created','draft','Entry\x20criteria:\x20','Created\x20activation\x20\x27','progress','idToName','null','waitStepUnit','createJourneySegment','skipSegments','set','\x27...','fetchJourney','update','toString','digest','./journey-yaml.js','exitCriterias','action','Updated\x20journey\x20\x27','journey_entry_criteria_','segmentId','entries','Creating\x20activation\x20\x27','./child-segment-yaml.js','\x20activation\x20\x27','getActivation','embedded_activation_created','resolveJourneyId','behavior','getSegmentEntity\x20also\x20failed\x20for\x20','segment_updated','Created\x20segment\x20\x27','createSegment','results','idToEmailMap','connector_config','createdSegmentIds','dirname','embedded_activation_creating','connection','Fetching\x20','Name\x20has\x20already\x20been\x20taken','day','parentFolder','activationParams','ACTIVATION_UPDATE_ERROR','Segment\x20not\x20found','effectiveFolderId','logInfo','Delete\x20the\x20push\x20recovery\x20file\x20(','parse','all','buildUserMaps','match','Stage\x20\x27','deleted','delete','index','milestone','Failed\x20to\x20resolve\x20activation\x20','journeyBundlesByFolderAndName','existingSegments','existingActivation','INTERNAL','activation_updated','\x27\x20wait\x20condition','../../utils/async.js','stringify','\x27\x20milestone','folderId','absolutePath','nameToType','existingSegment','\x20(referenced\x20in\x20journey\x20','Failed\x20to\x20resolve\x20segment\x20','stages','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','segment','has','deleteActivation','state','versionNumber','journeyById'];a152_0x555c=function(){return _0xf23850;};return a152_0x555c();}import a152_0x3c1d30 from'path';import{isJourneyDef,parseYamlString as a152_0x418e5c,toYamlString as a152_0x2bc7f9,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(_0x24a935){const _0x4240bb=a152_0x33e6a2;if(Array[_0x4240bb(0x19d)](_0x24a935))return'['+_0x24a935[_0x4240bb(0x129)](_0x581763=>stableStringify(_0x581763))[_0x4240bb(0xbc)](',')+']';if(_0x24a935&&typeof _0x24a935==='object'){const _0x6b456d=_0x24a935,_0x266d22=Object[_0x4240bb(0x136)](_0x6b456d)[_0x4240bb(0xb8)](),_0x28a545=_0x266d22[_0x4240bb(0x129)](_0x5cf121=>'\x22'+_0x5cf121+'\x22:'+stableStringify(_0x6b456d[_0x5cf121]));return'{'+_0x28a545[_0x4240bb(0xbc)](',')+'}';}const _0x58f8c9=JSON[_0x4240bb(0x18d)](_0x24a935);return _0x58f8c9===undefined?_0x4240bb(0x14f):_0x58f8c9;}function activationSignature(_0x1f1791){const _0x59e2f1=a152_0x33e6a2,_0x17e38d={'connection':_0x1f1791[_0x59e2f1(0x171)],..._0x1f1791[_0x59e2f1(0xf2)]!==undefined&&{'all_columns':_0x1f1791[_0x59e2f1(0xf2)]},..._0x1f1791[_0x59e2f1(0xf1)]!==undefined&&{'columns':_0x1f1791['columns']},..._0x1f1791[_0x59e2f1(0x166)]!==undefined&&{'behavior':_0x1f1791[_0x59e2f1(0x166)]},..._0x1f1791[_0x59e2f1(0xfa)]!==undefined&&{'schedule':_0x1f1791[_0x59e2f1(0xfa)]},..._0x1f1791[_0x59e2f1(0x12e)]!==undefined&&{'notification':_0x1f1791[_0x59e2f1(0x12e)]},..._0x1f1791[_0x59e2f1(0x16d)]!==undefined&&{'connector_config':_0x1f1791[_0x59e2f1(0x16d)]},..._0x1f1791[_0x59e2f1(0xaa)]!==undefined&&{'activation_template_id':_0x1f1791[_0x59e2f1(0xaa)]}};return stableStringify(_0x17e38d);}async function fetchSegment(_0x463d73,_0x1d4932,_0x4ff9a7,_0x1256c3){const _0x3b3429=a152_0x33e6a2,_0x30f91a=_0x1256c3?.['find'](_0x4cc5aa=>_0x4cc5aa['id']===_0x4ff9a7);if(_0x30f91a)return _0x30f91a;try{return await _0x463d73[_0x3b3429(0x197)][_0x3b3429(0x134)](_0x1d4932,_0x4ff9a7);}catch(_0x23cf96){logger[_0x3b3429(0xf6)]('getSegment\x20failed\x20for\x20'+_0x4ff9a7+_0x3b3429(0xd5)+_0x23cf96);try{return await _0x463d73[_0x3b3429(0x197)]['getSegmentEntity'](_0x4ff9a7);}catch(_0x236c65){return logger[_0x3b3429(0xf6)](_0x3b3429(0x167)+_0x4ff9a7+':\x20'+_0x236c65),null;}}}function recoverSegmentIdsFromPushRecovery(_0x553793,_0x3278ba,_0x14e130){const _0x3bb337=a152_0x33e6a2,_0x27c549=readPushRecovery(_0x553793[_0x3bb337(0x190)]);if(_0x27c549?.['journeyName']===_0x553793[_0x3bb337(0x106)][_0x3bb337(0x121)])for(const [_0x7f2afe,_0x3a8ae2]of Object[_0x3bb337(0x15f)](_0x27c549[_0x3bb337(0xdb)])){const _0x463ddd=generateDeterministicJourneySegmentName(_0x553793[_0x3bb337(0x106)][_0x3bb337(0x121)],_0x7f2afe);_0x3a8ae2[_0x3bb337(0xa8)]===_0x463ddd&&(_0x3278ba[_0x3bb337(0x153)](_0x7f2afe,_0x3a8ae2['segmentId']),_0x14e130[_0x3bb337(0x153)](_0x7f2afe,_0x3a8ae2[_0x3bb337(0x15e)]));}}async function createOrRecoverEmbeddedSegment(_0x556482,_0x9c8c83,_0xbfcac7,_0x14b0d3){const _0x53517f=a152_0x33e6a2;let _0x58ec29;try{_0x58ec29=await _0x556482[_0x53517f(0x197)][_0x53517f(0x151)]({'name':_0xbfcac7[_0x53517f(0xd4)],'description':_0xbfcac7[_0x53517f(0xdf)],'journeyId':_0xbfcac7[_0x53517f(0x138)],'rule':_0x14b0d3(_0xbfcac7['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xbfcac7[_0x53517f(0x18f)],'audienceId':_0xbfcac7[_0x53517f(0x10b)]});}catch(_0x447780){const _0x5e8dda=_0x447780 instanceof Error&&_0x447780['message'][_0x53517f(0xf5)](_0x53517f(0x173));if(_0x5e8dda){const _0x441477=readPushRecovery(_0x9c8c83[_0x53517f(0x190)]),_0x16eb3e=_0x441477?.[_0x53517f(0xfe)]===_0x9c8c83[_0x53517f(0x106)][_0x53517f(0x121)]?_0x441477['segments'][_0xbfcac7[_0x53517f(0xda)]]:undefined;if(_0x16eb3e?.[_0x53517f(0xa8)]===_0xbfcac7[_0x53517f(0xd4)])await _0x556482[_0x53517f(0x197)]['updateSegmentById'](_0xbfcac7[_0x53517f(0x10b)],_0x16eb3e[_0x53517f(0x15e)],{'description':_0xbfcac7['description'],'rule':_0x14b0d3(_0xbfcac7['resolvedRule'],!![]),'countPopulation':!![]}),_0x58ec29=_0x16eb3e[_0x53517f(0x15e)];else throw new SDKError(ErrorCode[_0x53517f(0x115)],_0x53517f(0xdd)+_0xbfcac7[_0x53517f(0xda)]+_0x53517f(0x196)+(_0x53517f(0x17b)+_0x9c8c83[_0x53517f(0x190)][_0x53517f(0xb7)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x447780);}else throw _0x447780;}return saveSegmentToPushRecovery(_0x9c8c83[_0x53517f(0x190)],_0x9c8c83['yamlConfig'][_0x53517f(0x121)],_0xbfcac7[_0x53517f(0xda)],{'segmentId':_0x58ec29,'uniqueServerName':_0xbfcac7[_0x53517f(0xd4)],'createdAt':new Date()[_0x53517f(0x12a)]()}),_0x58ec29;}export async function prepareSegmentFiles(_0x2edf4a,_0x3d1a9a,_0x27d68c,_0x588e2e,_0x370860){const _0x55a8ce=a152_0x33e6a2,{activationDefToCreateRequest:_0x232941}=await import('./child-segment-yaml.js'),_0x22a503=[],_0x2a35a5=new Set();for(const {yamlConfig:_0x4fc187,folderPath:_0x1e7b93,sourcePath:_0x402780}of _0x2edf4a){const _0x55032c=resolveTDFolderPath(_0x1e7b93,_0x588e2e,_0x370860),_0x50f4bc=_0x55032c+':'+_0x4fc187[_0x55a8ce(0x121)],_0xe7e5fd=_0x3d1a9a['segmentByFolderAndName']['get'](_0x50f4bc),_0x43c628=_0xe7e5fd?_0x3d1a9a[_0x55a8ce(0x137)]['get'](_0xe7e5fd['id'])||[]:[];addFoldersToCreate(_0x55032c,_0x3d1a9a['folderPathToId'],_0x2a35a5);const _0x16f7ce=calculateActivationActions(_0x4fc187[_0x55a8ce(0xf3)]||[],_0x43c628,_0x3d1a9a[_0x55a8ce(0x16c)],_0x3d1a9a[_0x55a8ce(0xd9)]);for(const _0x301aa4 of _0x16f7ce){(_0x301aa4['type']===_0x55a8ce(0xe1)||_0x301aa4[_0x55a8ce(0x118)]==='update')&&_0x301aa4[_0x55a8ce(0x11b)]&&(_0x301aa4['validatedRequest']=await _0x232941(_0x301aa4[_0x55a8ce(0x11b)],_0x27d68c));}const _0x2cc3a9=calculateSegmentDiff(_0x4fc187,_0xe7e5fd,_0x43c628,_0x3d1a9a[_0x55a8ce(0x16c)],_0x3d1a9a[_0x55a8ce(0xd9)]);_0x22a503[_0x55a8ce(0xaf)]({'relativePath':_0x4fc187[_0x55a8ce(0x121)],'absolutePath':_0x402780,'yamlConfig':_0x4fc187,'folderPath':_0x55032c,'existingSegment':_0xe7e5fd,'existingActivations':_0x43c628,'isNew':_0x2cc3a9[_0x55a8ce(0x9e)],'hasChanges':_0x2cc3a9['hasChanges'],'diff':_0x2cc3a9[_0x55a8ce(0xfd)],'activationActions':_0x16f7ce});}return{'segmentFiles':_0x22a503,'foldersToCreate':_0x2a35a5};}export async function prepareJourneyFiles(_0x473c65,_0x50f831,_0x265fd1,_0x26ebf4){const _0x2f2807=a152_0x33e6a2,_0x18cc49=[],_0x26c00b=new Set();for(const {yamlConfig:_0x4a1679,folderPath:_0x5685ef,sourcePath:_0x1385c8}of _0x473c65){const _0x44c1aa=resolveTDFolderPath(_0x5685ef,_0x265fd1,_0x26ebf4),_0x2333df=_0x44c1aa+':'+_0x4a1679[_0x2f2807(0x121)],_0x15063c=_0x50f831[_0x2f2807(0x186)][_0x2f2807(0xa5)](_0x2333df);let _0x14e035,_0x4f0b3c;if(_0x15063c&&_0x15063c[_0x2f2807(0xae)]>0x0){const _0xb6b9e=buildLocalExpandedRuleMappings(_0x4a1679),{createYamlContext:_0x3ec505,prefetchJourneySegments:_0x1873ef}=createPushYamlContextForBundle(_0x50f831[_0x2f2807(0xa1)],_0x50f831[_0x2f2807(0x10b)],_0x50f831[_0x2f2807(0x187)],_0xb6b9e,_0x50f831['idToEmailMap'],_0x50f831['connectionIdToNameMap'],_0x50f831[_0x2f2807(0x142)],_0x50f831['journeyById']);await _0x1873ef(_0x15063c[_0x2f2807(0x129)](_0x440f9a=>_0x440f9a['id']));const _0x2c1a7a=await _0x50f831['deps'][_0x2f2807(0x9f)][_0x2f2807(0x116)](_0x15063c[0x0]['journeyBundleId']),_0x585727=hasMultipleVersions(_0x4a1679),_0x174c03=async _0x4e3726=>{const _0x4856f2=_0x2f2807,_0x55090c=_0x50f831[_0x4856f2(0x19c)]?.['get'](_0x4e3726);if(_0x55090c)return _0x55090c;return _0x50f831[_0x4856f2(0x155)]({'journeyId':_0x4e3726,'journeyName':_0x4a1679['name'],'isMultiVersion':_0x15063c[_0x4856f2(0xae)]>0x1});};if(_0x585727&&_0x15063c[_0x2f2807(0xae)]>0x1){const _0x462815=[];for(const _0x442236 of _0x15063c){const _0x386af0=_0x442236[_0x2f2807(0x19b)]||0x1;_0x50f831[_0x2f2807(0x14d)]?.['update'](_0x2f2807(0x172)+_0x4a1679[_0x2f2807(0x121)]+'\x20v'+_0x386af0);const _0x13f378=await _0x174c03(_0x442236['id']),_0x1ec861=_0x3ec505(_0x442236['id']),_0x4ca480=await journeyResponseToDef(_0x13f378,_0x1ec861);_0x462815['push']({'item':_0x442236,'yaml':_0x4ca480});}const _0x14c579=buildLocalRuleToNameMappingFromJourney(_0x4a1679);_0x4f0b3c=buildMergedJourneyDef(_0x462815,_0x14c579,_0x2c1a7a);const _0x396681=Math['max'](..._0x462815[_0x2f2807(0x129)](_0x57aa28=>_0x57aa28[_0x2f2807(0xe4)]['versionNumber']||0x0)),_0x2752c8=_0x15063c[_0x2f2807(0x109)](_0xa8965d=>(_0xa8965d['versionNumber']||0x0)===_0x396681);_0x2752c8&&(_0x50f831[_0x2f2807(0x14d)]?.[_0x2f2807(0x156)](_0x2f2807(0x172)+_0x4a1679[_0x2f2807(0x121)]+'\x20v'+_0x396681),_0x14e035=await _0x174c03(_0x2752c8['id']));}else{const _0x33a6f4=_0x15063c[_0x15063c['length']-0x1];_0x50f831[_0x2f2807(0x14d)]?.[_0x2f2807(0x156)](_0x2f2807(0x172)+_0x4a1679[_0x2f2807(0x121)]),_0x14e035=await _0x174c03(_0x33a6f4['id']);const _0x57a842=_0x3ec505(_0x33a6f4['id']),_0x5447a0=await journeyResponseToDef(_0x14e035,_0x57a842),_0x58e9d1=buildLocalRuleToNameMappingFromJourney(_0x4a1679);_0x4f0b3c=buildMergedJourneyDef([{'item':_0x33a6f4,'yaml':_0x5447a0}],_0x58e9d1,_0x2c1a7a);}}addFoldersToCreate(_0x44c1aa,_0x50f831[_0x2f2807(0xff)],_0x26c00b);const _0x3834a1=calculateJourneyDiff(_0x4a1679,_0x4f0b3c);_0x18cc49['push']({'relativePath':_0x4a1679['name'],'absolutePath':_0x1385c8,'yamlConfig':_0x4a1679,'folderPath':_0x44c1aa,'existingJourney':_0x14e035,'isNew':_0x3834a1[_0x2f2807(0x9e)],'hasChanges':_0x3834a1['hasChanges'],'diff':_0x3834a1[_0x2f2807(0xfd)]});}return{'journeyFiles':_0x18cc49,'foldersToCreate':_0x26c00b};}export function calculateActivationActions(_0xb1f854,_0x5b389a,_0x51dee0,_0x459648){const _0x23295d=a152_0x33e6a2,_0x351b15=[],_0x2f5884=new Map();for(const _0x326916 of _0x5b389a){_0x2f5884[_0x23295d(0x153)](_0x326916['name'],_0x326916);}const _0x212b3a=new Map();for(const _0x335b55 of _0xb1f854){_0x212b3a[_0x23295d(0x153)](_0x335b55[_0x23295d(0x121)],_0x335b55);}for(const _0x50cc1f of _0xb1f854){const _0x277779=_0x2f5884[_0x23295d(0xa5)](_0x50cc1f[_0x23295d(0x121)]);if(!_0x277779)_0x351b15[_0x23295d(0xaf)]({'type':'create','name':_0x50cc1f[_0x23295d(0x121)],'yamlActivation':_0x50cc1f});else{const _0xaf33c6=activationResponseToDef(_0x277779,_0x51dee0,_0x459648),_0x572acb=a152_0x559f5b[_0x23295d(0x18d)](_0xaf33c6),_0x4dd1c0=a152_0x559f5b[_0x23295d(0x18d)](_0x50cc1f);_0x572acb!==_0x4dd1c0&&_0x351b15[_0x23295d(0xaf)]({'type':_0x23295d(0x156),'name':_0x50cc1f['name'],'yamlActivation':_0x50cc1f,'existingActivation':_0x277779});}}for(const _0x39c0ad of _0x5b389a){!_0x212b3a[_0x23295d(0x198)](_0x39c0ad[_0x23295d(0x121)])&&_0x351b15[_0x23295d(0xaf)]({'type':_0x23295d(0x182),'name':_0x39c0ad[_0x23295d(0x121)],'existingActivation':_0x39c0ad});}return _0x351b15;}function calculateYamlDiff(_0x5ef664,_0x14c685){if(_0x14c685){const _0x34932f=generateDiff(_0x14c685,_0x5ef664),_0x4d9679=hasChanges(_0x34932f);return{'isNew':![],'hasChanges':_0x4d9679,'diff':_0x4d9679?formatDiffWithColors(_0x34932f):undefined};}const _0x4470dc=generateDiff('',_0x5ef664);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4470dc)};}export function calculateSegmentDiff(_0x1522a2,_0x16604a,_0x21a0f9,_0x421983,_0x4c9046){const _0x3bdf9f=segmentToYamlString(_0x1522a2),_0x343abe=_0x16604a?segmentToYamlString(segmentWithActivationsToYaml(_0x16604a,_0x21a0f9,undefined,_0x421983,_0x4c9046)):undefined;return calculateYamlDiff(_0x3bdf9f,_0x343abe);}export function calculateJourneyDiff(_0x41b5ce,_0x4d0796){const _0x8500cd=normalizeJourneyDef(_0x41b5ce,_0x41b5ce),_0x291cb8=a152_0x2bc7f9(_0x8500cd),_0x1e9817=_0x4d0796?a152_0x2bc7f9(normalizeJourneyDef(_0x4d0796,_0x41b5ce)):undefined;return calculateYamlDiff(_0x291cb8,_0x1e9817);}export function findSegmentsToDelete(_0x2d4871,_0x2f7a10,_0x402693,_0x1f9997,_0x2f8340){const _0x4c1238=a152_0x33e6a2,_0x21edac=new Set();for(const {yamlConfig:_0x532855,folderPath:_0x58f119}of _0x2f7a10){_0x21edac['add'](_0x58f119+':'+_0x532855['name']);}return _0x2d4871[_0x4c1238(0x12f)](_0x571e84=>{const _0x149089=_0x4c1238,_0x558d17=_0x571e84[_0x149089(0xa0)]?_0x402693['get'](_0x571e84[_0x149089(0xa0)]['toString']())||'':'',_0x4d3d89=_0x558d17+':'+_0x571e84[_0x149089(0x121)];if(_0x21edac[_0x149089(0x198)](_0x4d3d89))return![];if(_0x2f8340)return _0x558d17===_0x1f9997||_0x558d17[_0x149089(0xe8)](_0x1f9997+'/');return!![];});}export function findJourneysToDelete(_0x298d83,_0x5aac0d,_0x3dacf3,_0x2c523a,_0x2d0447){const _0x2b034d=a152_0x33e6a2,_0x92a97b=new Set();for(const {yamlConfig:_0x3ad6a0,folderPath:_0x4f024f}of _0x5aac0d){_0x92a97b[_0x2b034d(0xbb)](_0x4f024f+':'+_0x3ad6a0['name']);}return _0x298d83[_0x2b034d(0x12f)](_0x44db89=>{const _0x4f3c15=_0x2b034d,_0x37ff64=_0x44db89[_0x4f3c15(0x18f)]?_0x3dacf3[_0x4f3c15(0xa5)](_0x44db89[_0x4f3c15(0x18f)])||'':'',_0x305d67=_0x37ff64+':'+_0x44db89[_0x4f3c15(0xd2)];if(_0x92a97b[_0x4f3c15(0x198)](_0x305d67))return![];if(_0x2d0447)return _0x37ff64===_0x2c523a||_0x37ff64[_0x4f3c15(0xe8)](_0x2c523a+'/');return!![];});}function a152_0x591f(_0x58e09e,_0x41bff5){_0x58e09e=_0x58e09e-0x9c;const _0x555cdf=a152_0x555c();let _0x591f20=_0x555cdf[_0x58e09e];return _0x591f20;}export function buildSegmentLookupMap(_0x337b62,_0xcdaf73){const _0x2c8c75=a152_0x33e6a2,_0x1722ec=new Map();for(const _0x46b749 of _0x337b62){const _0x13af04=_0x46b749[_0x2c8c75(0xa0)]?_0xcdaf73[_0x2c8c75(0xa5)](_0x46b749[_0x2c8c75(0xa0)][_0x2c8c75(0x157)]())||'':'',_0x45b2dd=_0x13af04+':'+_0x46b749[_0x2c8c75(0x121)];_0x1722ec[_0x2c8c75(0x153)](_0x45b2dd,_0x46b749);}return _0x1722ec;}export function buildSegmentNameToIdMap(_0x4dab46){const _0x2d2fae=a152_0x33e6a2,_0x3e1648=new Map();for(const _0x240a96 of _0x4dab46){_0x3e1648[_0x2d2fae(0x153)](_0x240a96[_0x2d2fae(0x121)],_0x240a96['id']);}return _0x3e1648;}export function buildJourneyBundleLookupMap(_0x13336b,_0x40a2d0){const _0x5463fe=a152_0x33e6a2,_0x22df47=new Map();for(const _0x48ee76 of _0x13336b){const _0x617d32=_0x48ee76['folderId']?_0x40a2d0['get'](_0x48ee76['folderId'])||'':'',_0x25f950=_0x617d32+':'+_0x48ee76[_0x5463fe(0xd2)];!_0x22df47[_0x5463fe(0x198)](_0x25f950)&&_0x22df47[_0x5463fe(0x153)](_0x25f950,[]),_0x22df47['get'](_0x25f950)[_0x5463fe(0xaf)](_0x48ee76);}for(const _0x372029 of _0x22df47[_0x5463fe(0x117)]()){_0x372029[_0x5463fe(0xb8)]((_0x4c979e,_0x46ea0b)=>(_0x4c979e['versionNumber']||0x0)-(_0x46ea0b['versionNumber']||0x0));}return _0x22df47;}export function collectFoldersToCreate(_0xc3d22b,_0x4113e7){const _0x155c1a=a152_0x33e6a2,_0x5e75b1=new Set();for(const _0x399515 of _0xc3d22b){if(!_0x399515)continue;if(_0x4113e7[_0x155c1a(0x198)](_0x399515))continue;const _0x4348eb=_0x399515[_0x155c1a(0xc9)]('/');let _0x1bc667='';for(const _0x5d841d of _0x4348eb){_0x1bc667=_0x1bc667?_0x1bc667+'/'+_0x5d841d:_0x5d841d,!_0x4113e7[_0x155c1a(0x198)](_0x1bc667)&&_0x5e75b1[_0x155c1a(0xbb)](_0x1bc667);}}return _0x5e75b1;}export function parseAndClassifyYamlFiles(_0x5f2ef3,_0x12dae6,_0x53fef9){const _0x50eea7=a152_0x33e6a2,_0x5b1bf8=[],_0x35627f=[];for(const _0x425514 of _0x5f2ef3){const _0x2b4a33=a152_0x3c1d30[_0x50eea7(0xd8)](_0x12dae6,a152_0x3c1d30[_0x50eea7(0x16f)](_0x425514)),_0x2dc6f5=_0x2b4a33==='.'?'':_0x2b4a33,_0x430528=readFileSync(_0x425514,'utf-8'),_0x1a141d=a152_0x559f5b['parse'](_0x430528);if(isJourneyDef(_0x1a141d)){const _0x5c573d=a152_0x418e5c(_0x430528);_0x35627f[_0x50eea7(0xaf)]({'yamlConfig':_0x5c573d,'folderPath':_0x2dc6f5,'sourcePath':_0x425514});}else{if(!_0x53fef9?.[_0x50eea7(0x152)]){const _0x103ca8=parseSegmentYamlFile(_0x430528),_0x5a2655=normalizeChildSegmentYaml(_0x103ca8);_0x5b1bf8[_0x50eea7(0xaf)]({'yamlConfig':_0x5a2655,'folderPath':_0x2dc6f5,'sourcePath':_0x425514});}}}return{'segments':_0x5b1bf8,'journeys':_0x35627f};}export function validateParsedFiles(_0x55e620,_0x57f2c1){const _0x20898c=a152_0x33e6a2,_0x3a350d=[];for(const {yamlConfig:_0x1c8316,sourcePath:_0x177d16}of _0x55e620[_0x20898c(0xdb)]){const _0xa158df=readFileSync(_0x177d16,_0x20898c(0xca)),_0x21b040=a152_0x559f5b[_0x20898c(0xb2)](_0xa158df),_0x1d3a9c=validateSegmentDef(_0x1c8316,{'source':_0xa158df,'document':_0x21b040},{'skipSchema':!![]});if(!_0x1d3a9c['valid']){const _0x10c7a9=a152_0x3c1d30[_0x20898c(0xd8)](_0x57f2c1,_0x177d16);_0x3a350d[_0x20898c(0xaf)]({'filePath':_0x10c7a9,'source':_0xa158df,'result':_0x1d3a9c,'isJourney':![]});}}for(const {yamlConfig:_0x1b9614,sourcePath:_0x151e1e}of _0x55e620[_0x20898c(0xc0)]){const _0x37c9fe=readFileSync(_0x151e1e,_0x20898c(0xca)),_0x32eedc=a152_0x559f5b[_0x20898c(0xb2)](_0x37c9fe),_0x4c7f02=validateJourneyDef(_0x1b9614,{'source':_0x37c9fe,'document':_0x32eedc},{'skipSchema':!![]});if(!_0x4c7f02[_0x20898c(0x10c)]){const _0x3e94d9=a152_0x3c1d30[_0x20898c(0xd8)](_0x57f2c1,_0x151e1e);_0x3a350d[_0x20898c(0xaf)]({'filePath':_0x3e94d9,'source':_0x37c9fe,'result':_0x4c7f02,'isJourney':!![]});}}return _0x3a350d;}export function formatValidationErrors(_0x177f54){const _0x465aa9=a152_0x33e6a2,_0x43c6eb=[];for(const {filePath:_0x25ab7c,source:_0x212d40,result:_0x623cb8,isJourney:_0x363e67}of _0x177f54){const _0x20a1aa=_0x363e67?_0x465aa9(0x9f):'segment';_0x43c6eb['push']('\x0a'+_0x25ab7c+'\x20('+_0x20a1aa+_0x465aa9(0xc2)+_0x623cb8['errors'][_0x465aa9(0xae)]+_0x465aa9(0x119)),_0x43c6eb['push'](formatValidationResult(_0x623cb8,_0x212d40,_0x25ab7c));}return _0x43c6eb[_0x465aa9(0xbc)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x11275c){const _0x1ca8d8=a152_0x33e6a2,_0xa0efab=new Set(),_0x390810=new Map(),_0x5dc4c6=collectSegmentUsageCounts(_0x11275c);if(_0x11275c[_0x1ca8d8(0xdb)])for(const [_0x35dbaa,_0x26f282]of Object[_0x1ca8d8(0x15f)](_0x11275c[_0x1ca8d8(0xdb)])){_0xa0efab[_0x1ca8d8(0xbb)](_0x35dbaa);if(_0x26f282[_0x1ca8d8(0x140)]){const _0x2ae9a8=yamlRuleToApi(_0x26f282[_0x1ca8d8(0x140)]),_0x1f5a79=apiRuleToYaml(_0x2ae9a8);_0x390810['set'](_0x35dbaa,_0x1f5a79);}}const _0x589d3b=new Map();let _0x567047=0x0;for(const [_0xa66869,_0x20d3c3]of _0x390810){const _0x329419=serializeExpandedRule(_0x20d3c3,_0x390810),_0x100899=_0x589d3b[_0x1ca8d8(0xa5)](_0x329419)||[];_0x100899[_0x1ca8d8(0xaf)]({'name':_0xa66869,'index':_0x567047}),_0x589d3b[_0x1ca8d8(0x153)](_0x329419,_0x100899),_0x567047++;}const _0x435f79=new Map();for(const [_0x2d09dc,_0x44a45f]of _0x589d3b){const _0x40a39e=_0x44a45f[_0x1ca8d8(0x12c)]()[_0x1ca8d8(0xb8)]((_0x41c8ba,_0x19394e)=>{const _0x5b8c5f=_0x1ca8d8,_0x4609c9=_0x5dc4c6['get'](_0x41c8ba[_0x5b8c5f(0x121)])||0x0,_0x2dc9c0=_0x5dc4c6[_0x5b8c5f(0xa5)](_0x19394e[_0x5b8c5f(0x121)])||0x0;if(_0x4609c9!==_0x2dc9c0)return _0x2dc9c0-_0x4609c9;return _0x41c8ba[_0x5b8c5f(0x183)]-_0x19394e['index'];})['map'](_0x46794a=>_0x46794a[_0x1ca8d8(0x121)]),_0x53fedc=[];for(const _0x30712a of _0x40a39e){const _0x1c8faa=_0x5dc4c6[_0x1ca8d8(0xa5)](_0x30712a)||0x0,_0xd92337=Math[_0x1ca8d8(0x11a)](_0x1c8faa,0x1);for(let _0x49f01a=0x0;_0x49f01a<_0xd92337;_0x49f01a++){_0x53fedc[_0x1ca8d8(0xaf)](_0x30712a);}}_0x435f79['set'](_0x2d09dc,_0x53fedc);}return{'existingLocalSegmentNames':_0xa0efab,'localSegmentRules':_0x390810,'localExpandedRuleToNames':_0x435f79};}export function createSegmentIdResolver(_0x4fd46e,_0x3b0223){return async _0x17463e=>{const _0x3d10c7=a152_0x591f,_0x3329e1=_0x4fd46e['get'](_0x17463e);if(!_0x3329e1)throw new SDKError(ErrorCode[_0x3d10c7(0xc4)],_0x3d10c7(0xf9)+_0x17463e+_0x3d10c7(0xbe)+_0x3b0223+'\x27)');return _0x3329e1;};}export function extractRootFolderId(_0x35ab43){const _0x2124e1=a152_0x33e6a2;return _0x35ab43[_0x2124e1(0xd6)]?.['parentSegmentFolder']?.[_0x2124e1(0xc1)]?.['id']||_0x35ab43[_0x2124e1(0xd6)]?.[_0x2124e1(0x175)]?.[_0x2124e1(0xc1)]?.['id'];}export function buildConnectionMaps(_0x383a8c){const _0x1eb918=a152_0x33e6a2,_0x46c07f=new Map(),_0x25c9f2=new Map(),_0x29b85e=new Map();for(const _0x41d33c of _0x383a8c){_0x46c07f[_0x1eb918(0x153)](_0x41d33c[_0x1eb918(0x121)],parseInt(_0x41d33c['id'],0xa)),_0x25c9f2['set'](_0x41d33c['id'],_0x41d33c['name']),_0x29b85e[_0x1eb918(0x153)](_0x41d33c['name'],_0x41d33c[_0x1eb918(0x118)]);}return{'nameToId':_0x46c07f,'idToName':_0x25c9f2,'nameToType':_0x29b85e};}export function calculatePushStats(_0x16ccde,_0x4c5eec,_0x9fc129,_0x44ad8d,_0x1cc621,_0x951c8b,_0x53a039){const _0x5cc5de=a152_0x33e6a2,_0x56cbe2=_0x16ccde['filter'](_0x48fb40=>_0x48fb40[_0x5cc5de(0x9e)]),_0x30c027=_0x16ccde[_0x5cc5de(0x12f)](_0x52ef0b=>!_0x52ef0b[_0x5cc5de(0x9e)]&&_0x52ef0b[_0x5cc5de(0xa6)]),_0x39cc60=_0x16ccde[_0x5cc5de(0x12f)](_0x31502c=>!_0x31502c[_0x5cc5de(0x9e)]&&!_0x31502c[_0x5cc5de(0xa6)]),_0x4efd62=_0x951c8b?_0x44ad8d:[],_0x566e68=_0x4c5eec['filter'](_0x427fcd=>_0x427fcd[_0x5cc5de(0x9e)]),_0x44e9d9=_0x4c5eec[_0x5cc5de(0x12f)](_0x495de3=>!_0x495de3[_0x5cc5de(0x9e)]&&_0x495de3[_0x5cc5de(0xa6)]),_0x292159=_0x4c5eec[_0x5cc5de(0x12f)](_0x1c6f6e=>!_0x1c6f6e[_0x5cc5de(0x9e)]&&!_0x1c6f6e[_0x5cc5de(0xa6)]),_0x1dc476=_0x951c8b?_0x1cc621:[],_0x5df468=_0x16ccde[_0x5cc5de(0xdc)](_0x453092=>_0x453092[_0x5cc5de(0xd3)]),_0x4fccdb=_0x5df468[_0x5cc5de(0x12f)](_0x59d905=>_0x59d905[_0x5cc5de(0x118)]==='create'),_0x2f3279=_0x5df468[_0x5cc5de(0x12f)](_0x41223a=>_0x41223a[_0x5cc5de(0x118)]===_0x5cc5de(0x156)),_0x2e77e7=_0x5df468[_0x5cc5de(0x12f)](_0x3580a6=>_0x3580a6['type']===_0x5cc5de(0x182)),_0x118c20=Array[_0x5cc5de(0xd1)](_0x9fc129)['sort'](),_0x487ba4=_0x53a039?![]:_0x56cbe2[_0x5cc5de(0xae)]>0x0||_0x30c027[_0x5cc5de(0xae)]>0x0||_0x4efd62[_0x5cc5de(0xae)]>0x0,_0x18df8e=_0x566e68[_0x5cc5de(0xae)]>0x0||_0x44e9d9['length']>0x0||_0x1dc476[_0x5cc5de(0xae)]>0x0,_0x849921=_0x53a039?![]:_0x5df468[_0x5cc5de(0xae)]>0x0,_0x2d8bbb=_0x118c20[_0x5cc5de(0xae)]>0x0;return{'segments':{'new':_0x56cbe2,'changed':_0x30c027,'unchanged':_0x39cc60,'toDelete':_0x4efd62},'journeys':{'new':_0x566e68,'changed':_0x44e9d9,'unchanged':_0x292159,'toDelete':_0x1dc476},'activations':{'all':_0x5df468,'toCreate':_0x4fccdb,'toUpdate':_0x2f3279,'toDelete':_0x2e77e7},'folders':{'toCreate':_0x118c20},'counts':{'segments':{'new':_0x56cbe2[_0x5cc5de(0xae)],'changed':_0x30c027[_0x5cc5de(0xae)],'unchanged':_0x39cc60[_0x5cc5de(0xae)],'toDelete':_0x4efd62[_0x5cc5de(0xae)]},'journeys':{'new':_0x566e68['length'],'changed':_0x44e9d9[_0x5cc5de(0xae)],'unchanged':_0x292159['length'],'toDelete':_0x1dc476[_0x5cc5de(0xae)]},'activations':{'create':_0x4fccdb['length'],'update':_0x2f3279['length'],'delete':_0x2e77e7[_0x5cc5de(0xae)]},'folders':_0x118c20['length']},'hasChanges':_0x487ba4||_0x18df8e||_0x849921||_0x2d8bbb};}export async function buildPushExecutionContext(_0xdd37ae,_0x5aaefd,_0x2dc5a0,_0x47231f,_0x132412,_0x3d6511){const _0x393564=a152_0x33e6a2,_0x57834c=extractRootFolderId(_0x2dc5a0),{pathToId:_0x5259b4,idToPath:_0x2374ee}=buildFolderMaps(_0x132412),_0x3e5c64=buildSegmentNameToIdMap(_0x47231f),_0x4d5e84=new Map(),{batchAsync:_0x2316c1}=await import('../../utils/async.js'),[_0x4031ed,_0x4a2229]=await Promise[_0x393564(0x17d)]([_0xdd37ae['user'][_0x393564(0x17e)](),_0xdd37ae[_0x393564(0x171)]['list'](),((async()=>{const _0x57cc4c=_0x393564;!_0x3d6511&&_0x47231f[_0x57cc4c(0xae)]>0x0&&await _0x2316c1(_0x47231f,async _0x572a06=>{const _0x13ded1=_0x57cc4c,_0x26677c=await _0xdd37ae['segment'][_0x13ded1(0xce)](_0x5aaefd,_0x572a06['id']);_0x4d5e84[_0x13ded1(0x153)](_0x572a06['id'],_0x26677c);});})())]),{emailToId:_0x5bdc82,idToEmail:_0xac7604}=_0x4031ed,_0x49e0b8=buildConnectionMaps(_0x4a2229);return{'rootFolderId':_0x57834c,'folderPathToId':_0x5259b4,'folderIdToPath':_0x2374ee,'segmentNameToId':_0x3e5c64,'activationsBySegmentId':_0x4d5e84,'emailToIdMap':_0x5bdc82,'idToEmailMap':_0xac7604,'connectionNameToIdMap':_0x49e0b8[_0x393564(0xba)],'connectionIdToNameMap':_0x49e0b8[_0x393564(0x14e)],'connectionNameToTypeMap':_0x49e0b8[_0x393564(0x191)]};}export function createPushYamlContextForBundle(_0x1eba3d,_0xd5778,_0x5de546,_0x441d59,_0x7a1481,_0x4f07b4,_0x1b275b,_0x3bd82e){const {existingLocalSegmentNames:_0x162a0d,localExpandedRuleToNames:_0x4504cb}=_0x441d59,_0x806b05=new Set(),_0x1b4b49=new Map(),_0xb6183e=new Map(),_0x239d3a=new Map(),_0x49c073=createJumpTargetCache(),_0x5ec82b=new Map(),_0xe02e74=new Map(),_0x4aa9e4=new Set();let _0x2d5cab;const _0x498462=_0x32bbc0=>{const _0x213894={'resolveSegment':async _0x15c9cb=>{const _0x280164=a152_0x591f,_0x1ba673=_0x239d3a[_0x280164(0xa5)](_0x15c9cb);if(_0x1ba673!==undefined)return{'name':_0x1ba673,'isJourneyLocal':!![]};try{const _0x10334a=await fetchSegment(_0x1eba3d,_0xd5778,_0x15c9cb,_0x5de546);if(!_0x10334a)throw new Error(_0x280164(0x178));const _0x48f49e=generateJourneyLocalName(_0x10334a[_0x280164(0x121)]),_0x2f4fbc=_0x10334a[_0x280164(0xed)]===SEGMENT_KIND_JOURNEY&&_0x48f49e!==undefined;let _0x18146c=_0x10334a[_0x280164(0x121)],_0x47f63e;if(_0x2f4fbc&&_0x10334a[_0x280164(0x140)]){const _0x5402d4=apiRuleToYaml(_0x10334a[_0x280164(0x140)]);_0xe02e74['set'](_0x15c9cb,_0x5402d4);const _0x334dcb=async _0x4a1112=>{const _0x2f49b3=_0x280164,_0x57cf48=collectSegmentRefsFromRule(_0x4a1112);for(const _0x14c109 of _0x57cf48){if(!_0xe02e74[_0x2f49b3(0x198)](_0x14c109))try{const _0x2d6227=await fetchSegment(_0x1eba3d,_0xd5778,_0x14c109,_0x5de546);if(_0x2d6227?.['rule']){const _0x5a9741=apiRuleToYaml(_0x2d6227['rule']);_0xe02e74['set'](_0x14c109,_0x5a9741),await _0x334dcb(_0x5a9741);}}catch(_0x24af56){logger['debug']('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x14c109+':\x20'+_0x24af56);}}};await _0x334dcb(_0x5402d4);const _0x18acd8=serializeExpandedRule(_0x5402d4,_0xe02e74),_0xaaa6dc=_0x4504cb[_0x280164(0xa5)](_0x18acd8);if(_0xaaa6dc&&_0xaaa6dc[_0x280164(0xae)]>0x0){const _0x2c2adc=_0x1b4b49['get'](_0x18acd8)||0x0,_0xa81225=_0xaaa6dc[_0x2c2adc]||_0xaaa6dc[_0xaaa6dc[_0x280164(0xae)]-0x1];_0x1b4b49['set'](_0x18acd8,_0x2c2adc+0x1),_0x18146c=_0xa81225,_0x806b05[_0x280164(0xbb)](_0x18146c),_0x239d3a['set'](_0x15c9cb,_0x18146c);const _0x2678ae=await resolveRuleSegmentRefs(_0x5402d4,async _0x15aaf1=>{const _0x428af4=_0x280164,_0x549db9=_0x239d3a[_0x428af4(0xa5)](_0x15aaf1);if(_0x549db9)return _0x549db9;const _0x38c493=await _0x2d5cab[_0x428af4(0xcb)](_0x15aaf1);return _0x38c493[_0x428af4(0x121)];});_0x47f63e={'description':_0x10334a['description'],'rule':_0x2678ae};}else{const _0x4a873f=_0x5ec82b[_0x280164(0xa5)](_0x18acd8);if(_0x4a873f)_0x18146c=_0x4a873f,_0x239d3a[_0x280164(0x153)](_0x15c9cb,_0x18146c);else{if(_0x48f49e){let _0x612669=_0x48f49e,_0x1ad5d4=0x2;while(_0x806b05['has'](_0x612669)||_0x162a0d[_0x280164(0x198)](_0x612669)){_0x612669=_0x48f49e+'_'+_0x1ad5d4,_0x1ad5d4++;}_0x806b05[_0x280164(0xbb)](_0x612669),_0x18146c=_0x612669;}_0x239d3a[_0x280164(0x153)](_0x15c9cb,_0x18146c),_0x5ec82b[_0x280164(0x153)](_0x18acd8,_0x18146c);const _0x483960=await resolveRuleSegmentRefs(_0x5402d4,async _0x4ac869=>{const _0xd93948=_0x280164,_0x5a6805=_0x239d3a[_0xd93948(0xa5)](_0x4ac869);if(_0x5a6805)return _0x5a6805;const _0x365b1d=await _0x2d5cab[_0xd93948(0xcb)](_0x4ac869);return _0x365b1d[_0xd93948(0x121)];});_0x47f63e={'description':_0x10334a['description'],'rule':_0x483960};}}}return{'name':_0x18146c,'isJourneyLocal':_0x2f4fbc,'definition':_0x47f63e};}catch(_0x4af34e){return logger[_0x280164(0xf6)](_0x280164(0x194)+_0x15c9cb+':\x20'+_0x4af34e),{'name':_0x15c9cb,'isJourneyLocal':![]};}},'resolveActivation':async _0x329a69=>{const _0x181e9e=a152_0x591f,_0x3f2880=_0xb6183e[_0x181e9e(0xa5)](_0x329a69);if(_0x3f2880!==undefined)return{'name':_0x3f2880,'isJourneyLocal':!![]};try{let _0xb3061f=_0x1b275b?.[_0x181e9e(0xa5)](_0x329a69);!_0xb3061f&&(_0xb3061f=await _0x1eba3d[_0x181e9e(0x9f)][_0x181e9e(0x163)](_0x32bbc0,_0x329a69));const _0x38867f=_0xb3061f[_0x181e9e(0xb0)][_0x181e9e(0x176)]['name']||_0x329a69,_0x162937=sanitizeYamlKey(_0x38867f)||_0x181e9e(0x107)+_0x329a69,_0x34a848=_0x162937;_0xb6183e[_0x181e9e(0x153)](_0x329a69,_0x34a848);const _0x24e965=journeyActivationStepToYaml(_0xb3061f,_0x7a1481,_0x4f07b4);return{'name':_0x34a848,'isJourneyLocal':!![],'definition':_0x24e965};}catch(_0x4ee82d){return logger[_0x181e9e(0xf6)](_0x181e9e(0x185)+_0x329a69+':\x20'+_0x4ee82d),{'name':_0x329a69,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x307f0f,_0x29b892)=>resolveJumpTarget(_0x307f0f,_0x29b892,_0x49c073,async _0x2aed46=>{const _0x336885=a152_0x591f,_0x568bda=_0x3bd82e?.[_0x336885(0xa5)](_0x2aed46);if(_0x568bda)return _0x568bda;return _0x1eba3d[_0x336885(0x9f)]['getJourney'](_0x2aed46);})};return _0x2d5cab=_0x213894,_0x213894;},_0xb572d8=async _0x387ee3=>{const _0x2fd00d=a152_0x591f,{collectSegmentIdsFromJourneyApi:_0x41119b}=await import(_0x2fd00d(0x159)),{batchAsync:_0x1d2e04}=await import(_0x2fd00d(0x18c)),_0x380f1e=new Set();for(const _0x36ae11 of _0x387ee3){let _0x1bb1fb=_0x3bd82e?.[_0x2fd00d(0xa5)](_0x36ae11);!_0x1bb1fb&&(_0x1bb1fb=await _0x1eba3d[_0x2fd00d(0x9f)]['getJourney'](_0x36ae11));const _0x401800=_0x41119b(_0x1bb1fb);for(const _0x5b7283 of _0x401800){_0x380f1e['add'](_0x5b7283);}}let _0xee95e9=Array[_0x2fd00d(0xd1)](_0x380f1e);while(_0xee95e9[_0x2fd00d(0xae)]>0x0){const _0x4e3ae3=_0xee95e9[_0x2fd00d(0x12f)](_0x25f681=>!_0x4aa9e4['has'](_0x25f681));if(_0x4e3ae3[_0x2fd00d(0xae)]===0x0)break;const _0x728295=await _0x1d2e04(_0x4e3ae3,async _0x209be7=>{const _0x5e7d23=_0x2fd00d;_0x4aa9e4[_0x5e7d23(0xbb)](_0x209be7);const _0x23d810=await fetchSegment(_0x1eba3d,_0xd5778,_0x209be7,_0x5de546);if(!_0x23d810)return null;return{'segmentId':_0x209be7,'segment':_0x23d810};},0xa),_0xf34fdc=new Set();for(const _0x44b060 of _0x728295){if(!_0x44b060?.[_0x2fd00d(0x197)]?.[_0x2fd00d(0x140)])continue;const _0xaa3a11=apiRuleToYaml(_0x44b060['segment']['rule']);_0xe02e74[_0x2fd00d(0x153)](_0x44b060['segmentId'],_0xaa3a11);const _0x4d0062=collectSegmentRefsFromRule(_0xaa3a11);for(const _0x190e3f of _0x4d0062){!_0x4aa9e4[_0x2fd00d(0x198)](_0x190e3f)&&_0xf34fdc['add'](_0x190e3f);}}_0xee95e9=Array[_0x2fd00d(0xd1)](_0xf34fdc);}};return{'createYamlContext':_0x498462,'prefetchJourneySegments':_0xb572d8};}export async function executePushSegments(_0x538128,_0x420e83,_0x2678ac,_0x37f7e4,_0x263a87){const _0x445226=a152_0x33e6a2,{segmentDefToCreateRequest:_0x389a6c,segmentDefToUpdateRequest:_0x41db06}=await import(_0x445226(0x161)),_0x252afc=_0x2678ac['folderPathToId'],_0xb8ff94=0x5,_0x143aec=async _0x51e1ed=>{const _0x1f13a1=_0x445226,_0x12e03b=_0x51e1ed[_0x1f13a1(0xe2)]?_0x252afc[_0x1f13a1(0xa5)](_0x51e1ed['folderPath']):undefined;let _0x1f215e;const _0x878891={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x29c847=_0x51e1ed[_0x1f13a1(0x106)];if(_0x51e1ed['yamlConfig'][_0x1f13a1(0x140)]){const _0x5dda2e=createSegmentIdResolver(_0x2678ac[_0x1f13a1(0xec)],_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]),_0x589126=await resolveRuleSegmentIds(_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x140)],_0x5dda2e);_0x29c847={..._0x51e1ed[_0x1f13a1(0x106)],'rule':_0x589126};}try{if(_0x51e1ed[_0x1f13a1(0x9e)]){_0x263a87['onProgress']?.({'type':'segment_creating','name':_0x51e1ed['yamlConfig']['name']});const _0x1af404=_0x389a6c(_0x29c847,_0x12e03b),_0x5b1621=await _0x263a87['withProgress'](_0x1f13a1(0xc8)+_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]+'\x27...',()=>_0x538128[_0x1f13a1(0x197)][_0x1f13a1(0x16a)](_0x37f7e4[_0x1f13a1(0x10b)],_0x1af404));_0x1f215e=_0x5b1621['data']['id'],_0x2678ac[_0x1f13a1(0xec)][_0x1f13a1(0x153)](_0x51e1ed['yamlConfig'][_0x1f13a1(0x121)],_0x1f215e),_0x878891[_0x1f13a1(0xe6)]={'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)],'id':_0x1f215e},_0x263a87[_0x1f13a1(0xcf)]?.({'type':_0x1f13a1(0x114),'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)],'segmentId':_0x1f215e}),_0x263a87['logSuccess']?.(_0x1f13a1(0x169)+_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]+'\x27'),_0x878891[_0x1f13a1(0x11d)]=0x1;}else{if(_0x51e1ed[_0x1f13a1(0xa6)]){_0x263a87[_0x1f13a1(0xcf)]?.({'type':_0x1f13a1(0x13b),'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]});const _0x4a7ad5=_0x41db06(_0x29c847);_0x12e03b!==_0x51e1ed['existingSegment']?.[_0x1f13a1(0xa0)]&&(_0x4a7ad5[_0x1f13a1(0xa0)]=_0x12e03b?parseInt(_0x12e03b,0xa):undefined),await _0x263a87['withProgress'](_0x1f13a1(0x143)+_0x51e1ed['yamlConfig']['name']+'\x27...',()=>_0x538128[_0x1f13a1(0x197)][_0x1f13a1(0x110)](_0x37f7e4[_0x1f13a1(0x10b)],_0x51e1ed[_0x1f13a1(0x192)]['id'],_0x4a7ad5)),_0x1f215e=_0x51e1ed['existingSegment']['id'],_0x263a87[_0x1f13a1(0xcf)]?.({'type':_0x1f13a1(0x168),'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]}),_0x263a87[_0x1f13a1(0x13d)]?.('Updated\x20segment\x20\x27'+_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]+'\x27'),_0x878891[_0x1f13a1(0x120)]=0x1;}else _0x1f215e=_0x51e1ed[_0x1f13a1(0x192)]['id'];}}catch(_0x488cd2){const _0x165fc3=isHttp400Error(_0x488cd2),_0x17f23c=_0x165fc3?ErrorCode[_0x1f13a1(0xa3)]:ErrorCode[_0x1f13a1(0x115)],_0x3b6e8d=getErrorMessage(_0x488cd2);throw new SDKError(_0x17f23c,'Failed\x20to\x20'+(_0x51e1ed[_0x1f13a1(0x9e)]?_0x1f13a1(0xe1):_0x1f13a1(0x156))+_0x1f13a1(0xad)+_0x51e1ed[_0x1f13a1(0x190)]+_0x1f13a1(0xd7)+_0x3b6e8d,_0x488cd2);}try{const _0x26f167=await syncActivationsForSegment(_0x538128,_0x37f7e4[_0x1f13a1(0x10b)],_0x1f215e,_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)],_0x51e1ed['activationActions'],_0x263a87,_0x51e1ed[_0x1f13a1(0x190)]);_0x878891[_0x1f13a1(0xf3)]=_0x26f167;}catch(_0xb98fd3){if(_0xb98fd3 instanceof SDKError)throw _0xb98fd3;throw new SDKError(ErrorCode[_0x1f13a1(0x177)],_0x1f13a1(0xf8)+_0x51e1ed['yamlConfig']['name']+_0x1f13a1(0x105)+_0x51e1ed[_0x1f13a1(0x190)]+_0x1f13a1(0xd7)+getErrorMessage(_0xb98fd3),_0xb98fd3);}return _0x878891;},_0x2bf2d3=await batchAsync(_0x420e83,_0x143aec,_0xb8ff94),_0x29d6fe={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x581dd4 of _0x2bf2d3){_0x29d6fe[_0x445226(0x11d)]+=_0x581dd4[_0x445226(0x11d)],_0x29d6fe[_0x445226(0x120)]+=_0x581dd4[_0x445226(0x120)],_0x581dd4[_0x445226(0xe6)]&&_0x29d6fe[_0x445226(0x16e)][_0x445226(0x153)](_0x581dd4[_0x445226(0xe6)]['name'],_0x581dd4[_0x445226(0xe6)]['id']),_0x29d6fe[_0x445226(0xf3)]['created']+=_0x581dd4[_0x445226(0xf3)][_0x445226(0x11d)],_0x29d6fe[_0x445226(0xf3)][_0x445226(0x120)]+=_0x581dd4[_0x445226(0xf3)][_0x445226(0x120)],_0x29d6fe[_0x445226(0xf3)][_0x445226(0x181)]+=_0x581dd4[_0x445226(0xf3)][_0x445226(0x181)];}return _0x29d6fe;}async function syncActivationsForSegment(_0x1ea013,_0x4138f4,_0x121bf8,_0x5b81e9,_0x1cc9f3,_0x55f172,_0x2fd188){const _0x525360=a152_0x33e6a2,_0x1e9b6d={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2a16bd of _0x1cc9f3){try{if(_0x2a16bd[_0x525360(0x118)]===_0x525360(0xe1)&&_0x2a16bd[_0x525360(0x111)])_0x55f172[_0x525360(0xcf)]?.({'type':'activation_creating','segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),await _0x55f172[_0x525360(0xbf)](_0x525360(0x160)+_0x2a16bd[_0x525360(0x121)]+_0x525360(0x154),()=>_0x1ea013[_0x525360(0x197)][_0x525360(0x130)](_0x4138f4,_0x121bf8,_0x2a16bd[_0x525360(0x111)])),_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x10d),'segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),_0x55f172[_0x525360(0x13d)]?.(_0x525360(0x14c)+_0x2a16bd[_0x525360(0x121)]+'\x27'),_0x1e9b6d[_0x525360(0x11d)]++;else{if(_0x2a16bd[_0x525360(0x118)]===_0x525360(0x156)&&_0x2a16bd[_0x525360(0x111)]&&_0x2a16bd['existingActivation'])_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0xa7),'segmentName':_0x5b81e9,'activationName':_0x2a16bd['name']}),await _0x55f172[_0x525360(0xbf)]('Updating\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27...',()=>_0x1ea013[_0x525360(0x197)][_0x525360(0xac)](_0x4138f4,_0x121bf8,_0x2a16bd['existingActivation']['id'],_0x2a16bd[_0x525360(0x111)])),_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x18a),'segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),_0x55f172[_0x525360(0x13d)]?.('Updated\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27'),_0x1e9b6d[_0x525360(0x120)]++;else _0x2a16bd[_0x525360(0x118)]===_0x525360(0x182)&&_0x2a16bd[_0x525360(0x188)]&&(_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x102),'segmentName':_0x5b81e9,'activationName':_0x2a16bd['name']}),await _0x55f172[_0x525360(0xbf)]('Deleting\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27...',()=>_0x1ea013['segment'][_0x525360(0x199)](_0x4138f4,_0x121bf8,_0x2a16bd[_0x525360(0x188)]['id'])),_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x126),'segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),_0x55f172[_0x525360(0xea)]?.('Deleted\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27'),_0x1e9b6d[_0x525360(0x181)]++);}}catch(_0x15062e){const _0x3a4ed6=isHttp400Error(_0x15062e),_0x2bcaef=_0x3a4ed6?ErrorCode[_0x525360(0x145)]:ErrorCode[_0x525360(0x177)],_0x358d6b=getErrorMessage(_0x15062e);throw new SDKError(_0x2bcaef,'Failed\x20to\x20'+_0x2a16bd[_0x525360(0x118)]+_0x525360(0x162)+_0x2a16bd[_0x525360(0x121)]+_0x525360(0x105)+_0x2fd188+_0x525360(0xd7)+_0x358d6b,_0x15062e);}}return _0x1e9b6d;}export async function executePushFolders(_0x292e7c,_0x47fcfb,_0x15afd7,_0x1b4682,_0x5c69b1){const _0xd4dd4f=a152_0x33e6a2,_0x237320=new Map(_0x15afd7),_0x24b803=sortFoldersByDepth(_0x47fcfb);for(const _0x283a9b of _0x24b803){const _0x294acc=_0x283a9b[_0xd4dd4f(0xc9)]('/'),_0x41e9ea=_0x294acc[_0x294acc[_0xd4dd4f(0xae)]-0x1],_0x4a3b40=_0x294acc[_0xd4dd4f(0x12c)](0x0,-0x1)[_0xd4dd4f(0xbc)]('/'),_0x23d4eb=_0x237320[_0xd4dd4f(0xa5)](_0x4a3b40);_0x5c69b1['onProgress']?.({'type':'folder_creating','folder':_0x283a9b});const _0x287a81={'name':_0x41e9ea,'parentFolderId':_0x23d4eb},_0x2043ba=await _0x5c69b1[_0xd4dd4f(0xbf)](_0xd4dd4f(0x144)+_0x283a9b+_0xd4dd4f(0x154),()=>_0x292e7c['segment']['createFolder'](_0x1b4682[_0xd4dd4f(0x10b)],_0x287a81));_0x237320[_0xd4dd4f(0x153)](_0x283a9b,_0x2043ba[_0xd4dd4f(0xc1)]['id']),_0x5c69b1['onProgress']?.({'type':'folder_created','folder':_0x283a9b,'folderId':_0x2043ba[_0xd4dd4f(0xc1)]['id']}),_0x5c69b1[_0xd4dd4f(0x17a)]?.(_0xd4dd4f(0xcd)+_0x283a9b+'\x27');}return _0x237320;}export async function executePushSegmentDeletions(_0x52b6e0,_0x39038d,_0x4e3295){const _0x591765=a152_0x33e6a2;if(_0x39038d[_0x591765(0xae)]===0x0)return 0x0;const {batchAsync:_0x1084dd}=await import(_0x591765(0x18c)),_0x18802e=0x5,_0x5ae023=await _0x1084dd(_0x39038d,async _0x4a3a9c=>{const _0x497ba9=_0x591765;return _0x4e3295['onProgress']?.({'type':_0x497ba9(0x141),'name':_0x4a3a9c[_0x497ba9(0x121)]}),await _0x52b6e0[_0x497ba9(0x197)][_0x497ba9(0xe0)](_0x4a3a9c['id']),_0x4e3295[_0x497ba9(0xcf)]?.({'type':_0x497ba9(0xbd),'name':_0x4a3a9c[_0x497ba9(0x121)]}),_0x4e3295[_0x497ba9(0xea)]?.('Deleted\x20segment\x20\x27'+_0x4a3a9c['name']+'\x27'),0x1;},_0x18802e);return _0x5ae023[_0x591765(0xe3)]((_0x38cbd6,_0x265816)=>_0x38cbd6+_0x265816,0x0);}export async function executePushJourneys(_0x357343,_0x24393d,_0x2319c0,_0x2f62b5,_0x1f4547){const _0x181a9f=a152_0x33e6a2,{journeyDefToRequest:_0x446b09}=await import(_0x181a9f(0x159)),{activationDefToCreateRequest:_0x273f29,yamlRuleToApi:_0x5709a3,validateSegmentRule:_0x3a3229}=await import(_0x181a9f(0x161)),_0x1e34be={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x40012d=new Map(_0x2319c0[_0x181a9f(0xec)]),_0x33de8d=0x5;for(let _0x58d45c=0x0;_0x58d45c<_0x24393d[_0x181a9f(0xae)];_0x58d45c+=_0x33de8d){const _0x23bb24=_0x24393d['slice'](_0x58d45c,_0x58d45c+_0x33de8d),_0xbf76aa=await Promise[_0x181a9f(0x17d)](_0x23bb24['map'](async _0x19c607=>{const _0x101c1=_0x181a9f;if(!_0x19c607[_0x101c1(0x9e)]&&!_0x19c607[_0x101c1(0xa6)])return{'action':_0x101c1(0x9c),'name':_0x19c607[_0x101c1(0x106)][_0x101c1(0x121)],'journeyId':_0x19c607['existingJourney']?.['id']};const _0x3cbca4=_0x19c607[_0x101c1(0xe2)]?_0x2319c0[_0x101c1(0xff)]['get'](_0x19c607[_0x101c1(0xe2)]):undefined;_0x1f4547['onProgress']?.({'type':_0x19c607[_0x101c1(0x9e)]?_0x101c1(0x10f):_0x101c1(0x133),'name':_0x19c607['yamlConfig'][_0x101c1(0x121)]});try{const _0x4dd991=await executeSingleJourneyPush(_0x357343,_0x19c607,{..._0x2319c0,'segmentNameToId':_0x40012d},{'parentId':_0x2f62b5[_0x101c1(0x10b)],'rootFolderId':_0x2f62b5['rootFolderId'],'folderId':_0x3cbca4,'verbose':_0x2f62b5[_0x101c1(0x147)]},_0x1f4547,{'journeyDefToRequest':_0x446b09,'activationDefToCreateRequest':_0x273f29,'yamlRuleToApi':_0x5709a3,'validateSegmentRule':_0x3a3229});for(const [_0x4fb436,_0x589fbb]of _0x4dd991[_0x101c1(0xde)]){_0x40012d[_0x101c1(0x153)](_0x4fb436,_0x589fbb),_0x1e34be[_0x101c1(0xde)][_0x101c1(0x153)](_0x4fb436,_0x589fbb);}if(_0x4dd991[_0x101c1(0x15b)]===_0x101c1(0x11d))_0x1f4547['onProgress']?.({'type':_0x101c1(0xa2),'name':_0x19c607[_0x101c1(0x106)][_0x101c1(0x121)],'journeyId':_0x4dd991[_0x101c1(0x138)]}),_0x1f4547[_0x101c1(0x13d)]?.('Created\x20journey\x20\x27'+_0x19c607['yamlConfig']['name']+'\x27'),_0x1e34be[_0x101c1(0x11d)]++;else _0x4dd991[_0x101c1(0x15b)]===_0x101c1(0x120)&&(_0x1f4547[_0x101c1(0xcf)]?.({'type':_0x101c1(0xb3),'name':_0x19c607['yamlConfig'][_0x101c1(0x121)]}),_0x1f4547[_0x101c1(0x13d)]?.(_0x101c1(0x15c)+_0x19c607[_0x101c1(0x106)][_0x101c1(0x121)]+'\x27'),_0x1e34be[_0x101c1(0x120)]++);return{'action':_0x4dd991[_0x101c1(0x15b)],'name':_0x19c607[_0x101c1(0x106)]['name'],'journeyId':_0x4dd991[_0x101c1(0x138)]};}catch(_0x4b80f1){const _0x237c12=isHttp400Error(_0x4b80f1),_0x84cf19=_0x237c12?ErrorCode[_0x101c1(0x11f)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5acc06=getErrorMessage(_0x4b80f1);throw new SDKError(_0x84cf19,_0x101c1(0x123)+(_0x19c607[_0x101c1(0x9e)]?'create':_0x101c1(0x156))+_0x101c1(0xd0)+_0x19c607[_0x101c1(0x190)]+'\x0a\x20\x20'+_0x5acc06,_0x4b80f1);}}));_0x1e34be[_0x181a9f(0x16b)]['push'](..._0xbf76aa);}return _0x1e34be;}async function matchExistingJourneySegments(_0x3f9b84,_0x21051e,_0x28af5f,_0x60b601,_0x2b9919){const _0x5b2cd6=a152_0x33e6a2;if(!_0x21051e[_0x5b2cd6(0x125)]||!_0x21051e[_0x5b2cd6(0x106)][_0x5b2cd6(0xdb)])return;const _0xb13f8c=new Map(),_0x164c85=new Set();for(const _0x3bdc8d of Object[_0x5b2cd6(0x136)](_0x21051e[_0x5b2cd6(0x106)]['segments'])){const _0x79b3c6=generateDeterministicJourneySegmentName(_0x21051e[_0x5b2cd6(0x106)]['name'],_0x3bdc8d);_0xb13f8c[_0x5b2cd6(0x153)](_0x79b3c6,_0x3bdc8d),_0x164c85[_0x5b2cd6(0xbb)](_0x3bdc8d);}const _0x5221da=[],_0x59101b=collectSegmentIdsFromJourneyApi(_0x21051e[_0x5b2cd6(0x125)]);for(const _0x2d6564 of _0x59101b){const _0x265258=await fetchSegment(_0x3f9b84,_0x28af5f,_0x2d6564,_0x60b601);if(!_0x265258?.[_0x5b2cd6(0x121)])continue;const _0x467707=_0xb13f8c[_0x5b2cd6(0xa5)](_0x265258[_0x5b2cd6(0x121)]);_0x467707?(_0x2b9919[_0x5b2cd6(0x153)](_0x467707,_0x2d6564),_0x164c85['delete'](_0x467707)):_0x5221da[_0x5b2cd6(0xaf)]({'id':_0x2d6564,'seg':_0x265258});}if(_0x164c85[_0x5b2cd6(0xf0)]>0x0&&_0x5221da[_0x5b2cd6(0xae)]>0x0){const {localExpandedRuleToNames:_0x2e4f60}=buildLocalExpandedRuleMappings(_0x21051e[_0x5b2cd6(0x106)]),_0x55f100=new Map();for(const {id:_0x1df259,seg:_0x21e616}of _0x5221da){if(_0x21e616[_0x5b2cd6(0x140)]){const _0x390bee=apiRuleToYaml(_0x21e616[_0x5b2cd6(0x140)]);_0x55f100[_0x5b2cd6(0x153)](_0x1df259,_0x390bee);}}for(const {id:_0x137fa0,seg:_0x1fbd57}of _0x5221da){if(!_0x1fbd57[_0x5b2cd6(0x140)])continue;const _0x564e98=_0x55f100['get'](_0x137fa0);if(!_0x564e98)continue;const _0x5f0117=serializeExpandedRule(_0x564e98,_0x55f100),_0x3e2699=_0x2e4f60['get'](_0x5f0117);if(_0x3e2699){const _0x4e903b=_0x3e2699[_0x5b2cd6(0x109)](_0x57553f=>_0x164c85['has'](_0x57553f));_0x4e903b&&(_0x2b9919[_0x5b2cd6(0x153)](_0x4e903b,_0x137fa0),_0x164c85['delete'](_0x4e903b),logger[_0x5b2cd6(0xf6)](_0x5b2cd6(0x122)+_0x1fbd57[_0x5b2cd6(0x121)]+'\x27\x20to\x20local\x20\x27'+_0x4e903b+_0x5b2cd6(0x10a)));}}}}async function executeSingleJourneyPush(_0x462dad,_0x4fe26f,_0x3cb75e,_0x36e76b,_0x2755eb,_0x57d1a6){const _0x47f847=a152_0x33e6a2,{journeyDefToRequest:_0x29dc0b,activationDefToCreateRequest:_0x7b5474,yamlRuleToApi:_0x9d1fb,validateSegmentRule:_0x2dd4ec}=_0x57d1a6,_0x1cf98a=new Map(),_0x1e81fa=new Map();recoverSegmentIdsFromPushRecovery(_0x4fe26f,_0x1cf98a,_0x3cb75e[_0x47f847(0xec)]);const _0x228704=new Map(),_0x2a916b=new Map(),_0x4f0a27=new Map();let _0xa55795;const _0x487a80=async()=>{const _0x9adfa2=_0x47f847;if(_0xa55795)return;_0xa55795=new Map();if(!_0x4fe26f[_0x9adfa2(0x125)])return;const _0x2be5a5=await _0x462dad[_0x9adfa2(0x9f)]['listActivations'](_0x4fe26f[_0x9adfa2(0x125)]['id']);for(const _0x345907 of _0x2be5a5){const _0x100da=journeyActivationStepToYaml(_0x345907,_0x3cb75e['idToEmailMap'],_0x3cb75e[_0x9adfa2(0xd9)]),_0x577da5=activationSignature(_0x100da);!_0xa55795['has'](_0x577da5)&&_0xa55795[_0x9adfa2(0x153)](_0x577da5,_0x345907['id']),_0x100da['name']&&_0x1e81fa[_0x9adfa2(0x153)](_0x100da[_0x9adfa2(0x121)],_0x345907['id']);}};await matchExistingJourneySegments(_0x462dad,_0x4fe26f,_0x36e76b[_0x47f847(0x10b)],_0x3cb75e[_0x47f847(0x187)],_0x3cb75e['segmentNameToId']);const _0xa368c2={'resolveSegmentId':async _0x45ba7e=>{const _0x2bd3e1=_0x47f847,_0x32858d=_0x3cb75e[_0x2bd3e1(0xec)][_0x2bd3e1(0xa5)](_0x45ba7e);if(!_0x32858d)throw new SDKError(ErrorCode[_0x2bd3e1(0xc4)],_0x2bd3e1(0xf9)+_0x45ba7e+'\x20(referenced\x20in\x20journey\x20'+_0x4fe26f[_0x2bd3e1(0x106)][_0x2bd3e1(0x121)]+')');return _0x32858d;},'resolveEmbeddedSegmentId':async(_0x2f1187,_0x760a77)=>{const _0x21d137=_0x47f847,_0x4544d0=_0x3cb75e[_0x21d137(0xec)]['get'](_0x2f1187);if(_0x4544d0)return _0x4544d0;const _0x2ef4df=_0x3cb75e[_0x21d137(0x187)][_0x21d137(0x109)](_0x489cf2=>_0x489cf2[_0x21d137(0x121)]===_0x2f1187);if(_0x2ef4df)return _0x3cb75e[_0x21d137(0xec)]['set'](_0x2f1187,_0x2ef4df['id']),_0x2ef4df['id'];if(_0x4fe26f[_0x21d137(0x9e)]){const {stageName:_0x55edc0,criteriaName:_0x34def6}=findSegmentCriteriaLocation(_0x4fe26f['yamlConfig'],_0x2f1187);return _0x2dd4ec(_0x2f1187,_0x760a77[_0x21d137(0x140)]),_0x2a916b[_0x21d137(0x153)](_0x2f1187,{'definition':_0x760a77,'stageName':_0x55edc0,'criteriaName':_0x34def6}),createPendingSegmentId(_0x2f1187);}const _0x3e3d6d=_0x4fe26f['existingJourney']?.['id'];if(!_0x3e3d6d)throw new SDKError(ErrorCode[_0x21d137(0x189)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x4b6430=_0x228704[_0x21d137(0xa5)](_0x2f1187);if(_0x4b6430)return _0x4b6430;const _0x3acd68=((async()=>{const _0x5bde8b=_0x21d137;_0x2dd4ec(_0x2f1187,_0x760a77[_0x5bde8b(0x140)]);const _0x24af52=generateDeterministicJourneySegmentName(_0x4fe26f[_0x5bde8b(0x106)][_0x5bde8b(0x121)],_0x2f1187),_0x88a03a=_0x3cb75e[_0x5bde8b(0x187)][_0x5bde8b(0x109)](_0x388d35=>_0x388d35['name']===_0x24af52),_0x177ca1=createSegmentIdResolver(_0x3cb75e[_0x5bde8b(0xec)],_0x2f1187),_0x36a548=await resolveRuleSegmentIds(_0x760a77[_0x5bde8b(0x140)],_0x177ca1);let _0x20ee00;return _0x88a03a?(await _0x462dad[_0x5bde8b(0x197)][_0x5bde8b(0x110)](_0x36e76b[_0x5bde8b(0x10b)],_0x88a03a['id'],{'description':_0x760a77[_0x5bde8b(0xdf)]||_0x5bde8b(0x14b)+_0x2f1187,'rule':_0x9d1fb(_0x36a548),'countPopulation':!![]}),_0x20ee00=_0x88a03a['id'],saveSegmentToPushRecovery(_0x4fe26f[_0x5bde8b(0x190)],_0x4fe26f[_0x5bde8b(0x106)][_0x5bde8b(0x121)],_0x2f1187,{'segmentId':_0x20ee00,'uniqueServerName':_0x24af52,'createdAt':new Date()['toISOString']()})):_0x20ee00=await createOrRecoverEmbeddedSegment(_0x462dad,_0x4fe26f,{'localName':_0x2f1187,'uniqueSegmentName':_0x24af52,'description':_0x760a77['description']||_0x5bde8b(0x14b)+_0x2f1187,'journeyId':_0x3e3d6d,'resolvedRule':_0x36a548,'parentId':_0x36e76b[_0x5bde8b(0x10b)],'folderId':_0x36e76b[_0x5bde8b(0x101)]||''},_0x9d1fb),_0x3cb75e[_0x5bde8b(0xec)][_0x5bde8b(0x153)](_0x2f1187,_0x20ee00),_0x1cf98a['set'](_0x2f1187,_0x20ee00),_0x20ee00;})());_0x228704[_0x21d137(0x153)](_0x2f1187,_0x3acd68);try{return await _0x3acd68;}finally{_0x228704['delete'](_0x2f1187);}},'resolveActivationId':async _0x17e2dd=>{const _0x85c3f0=_0x47f847,_0x546c12=_0x1e81fa['get'](_0x17e2dd);if(_0x546c12)return _0x546c12;if(_0x4fe26f[_0x85c3f0(0x125)]){await _0x487a80();const _0x23e765=_0x1e81fa[_0x85c3f0(0xa5)](_0x17e2dd);if(_0x23e765)return _0x23e765;}throw new SDKError(ErrorCode[_0x85c3f0(0xb5)],_0x85c3f0(0xb9)+_0x17e2dd+_0x85c3f0(0x193)+_0x4fe26f[_0x85c3f0(0x106)][_0x85c3f0(0x121)]+').\x20'+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x1f9156,_0x30e0ce)=>{const _0x7301c=_0x47f847,_0x54cee6=_0x1e81fa[_0x7301c(0xa5)](_0x1f9156);if(_0x54cee6)return _0x54cee6;if(_0x4fe26f[_0x7301c(0x9e)])return _0x4f0a27[_0x7301c(0x153)](_0x1f9156,_0x30e0ce),createPendingActivationId(_0x1f9156);if(_0x4fe26f[_0x7301c(0x125)]){await _0x487a80();const _0x151ca0=_0x1e81fa[_0x7301c(0xa5)](_0x30e0ce[_0x7301c(0x121)]);if(_0x151ca0)return _0x1e81fa[_0x7301c(0x153)](_0x1f9156,_0x151ca0),_0x151ca0;const _0x128053=activationSignature(_0x30e0ce),_0x8175b5=_0xa55795?.[_0x7301c(0xa5)](_0x128053);if(_0x8175b5)return _0x1e81fa[_0x7301c(0x153)](_0x1f9156,_0x8175b5),_0x8175b5;const _0x3f5289=await _0x7b5474(_0x30e0ce,_0x3cb75e['activationContext']),_0x57a20c={..._0x3f5289,..._0x30e0ce['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x30e0ce[_0x7301c(0x13e)]}},_0x22f08f=await _0x462dad['journey'][_0x7301c(0x130)](_0x4fe26f['existingJourney']['id'],_0x57a20c);return _0x1e81fa['set'](_0x1f9156,_0x22f08f['id']),_0x22f08f['id'];}throw new SDKError(ErrorCode[_0x7301c(0x189)],_0x7301c(0x9d));},'resolveJourneyId':async _0x222c53=>{const _0x5da819=_0x47f847;try{return await _0x462dad[_0x5da819(0x9f)][_0x5da819(0x165)](_0x36e76b['parentId'],_0x222c53);}catch(_0x526571){throw new SDKError(ErrorCode[_0x5da819(0xb5)],'Journey\x20\x27'+_0x222c53+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x4fe26f[_0x5da819(0x106)][_0x5da819(0x121)]+'\x27)',_0x526571);}},'resolveStageId':async(_0x81388,_0x500dda)=>{const _0x52cb6d=_0x47f847,_0x532871=await _0x462dad[_0x52cb6d(0x9f)][_0x52cb6d(0xe7)](_0x81388),_0x5d1c74=_0x532871[_0x52cb6d(0xb0)][_0x52cb6d(0x103)]['find'](_0x2c681d=>_0x2c681d[_0x52cb6d(0x121)][_0x52cb6d(0x135)]()===_0x500dda['toLowerCase']());if(!_0x5d1c74?.['id'])throw new SDKError(ErrorCode[_0x52cb6d(0xb5)],_0x52cb6d(0x180)+_0x500dda+_0x52cb6d(0x104)+(_0x532871[_0x52cb6d(0xb0)]['journeyBundleName']||_0x532871[_0x52cb6d(0xb0)][_0x52cb6d(0x121)])+'\x27');return _0x5d1c74['id'];}},_0x3dd5cb=await _0x29dc0b(_0x4fe26f['yamlConfig'],_0x36e76b['parentId'],_0xa368c2),_0x2a483f=_0x36e76b['folderId']||_0x36e76b['rootFolderId'];_0x2a483f&&(_0x3dd5cb[_0x47f847(0xd6)]={'parentFolder':{'data':{'id':_0x2a483f,'type':'folder'}}});if(_0x4fe26f[_0x47f847(0x9e)]){if(_0x2a916b[_0x47f847(0xf0)]>0x0||_0x4f0a27[_0x47f847(0xf0)]>0x0)return await executeThreeStepJourneyCreate(_0x462dad,_0x4fe26f,_0x3dd5cb,{'pendingEmbeddedSegments':_0x2a916b,'pendingEmbeddedActivations':_0x4f0a27,'embeddedSegmentNameToId':_0x1cf98a,'journeyActivationNameToId':_0x1e81fa},{..._0x36e76b,'effectiveFolderId':_0x2a483f},_0x3cb75e,_0x2755eb,_0x57d1a6);else{ensureJourneyDefaults(_0x3dd5cb[_0x47f847(0xb0)]);const _0x508020=await _0x462dad['journey'][_0x47f847(0xe1)](_0x3dd5cb);return deletePushRecovery(_0x4fe26f['absolutePath']),{'action':_0x47f847(0x11d),'journeyId':_0x508020['id'],'embeddedSegmentNameToId':_0x1cf98a};}}else{if(_0x4fe26f[_0x47f847(0xa6)]&&_0x4fe26f[_0x47f847(0x125)]){_0x3dd5cb['id']=_0x4fe26f[_0x47f847(0x125)]['id'];const _0x305079=_0x3dd5cb[_0x47f847(0xb0)];_0x4fe26f[_0x47f847(0x125)]['attributes']?.['journeyBundleName']&&(_0x305079[_0x47f847(0xd2)]=_0x4fe26f[_0x47f847(0x125)][_0x47f847(0xb0)][_0x47f847(0xd2)]);const _0x4c25ce=_0x4fe26f[_0x47f847(0x125)][_0x47f847(0xb0)]?.['journeyStages'];return _0x4c25ce&&_0x3dd5cb[_0x47f847(0xb0)][_0x47f847(0x103)]&&injectExistingStageIds(_0x3dd5cb[_0x47f847(0xb0)]['journeyStages'],_0x4c25ce),ensureJourneyDefaults(_0x305079),await _0x462dad[_0x47f847(0x9f)][_0x47f847(0x156)](_0x4fe26f['existingJourney']['id'],_0x3dd5cb),deletePushRecovery(_0x4fe26f[_0x47f847(0x190)]),{'action':_0x47f847(0x120),'journeyId':_0x4fe26f['existingJourney']['id'],'embeddedSegmentNameToId':_0x1cf98a};}}return deletePushRecovery(_0x4fe26f[_0x47f847(0x190)]),{'action':_0x47f847(0x9c),'journeyId':_0x4fe26f[_0x47f847(0x125)]?.['id'],'embeddedSegmentNameToId':_0x1cf98a};}function findSegmentCriteriaLocation(_0x1d4c68,_0x55c82f){const _0x3835f9=a152_0x33e6a2,_0x32a4ef=_0x1d4c68['stages']||_0x1d4c68[_0x3835f9(0xc0)]?.[0x0]?.[_0x3835f9(0x195)]||[];let _0x1f6a50=_0x3835f9(0x11c),_0xd97e7d=_0x55c82f;const _0x4a03b5=_0x1d4c68['goal']||_0x1d4c68[_0x3835f9(0xc0)]?.[0x0]?.[_0x3835f9(0x100)];if(_0x4a03b5?.[_0x3835f9(0x197)]===_0x55c82f)return{'stageName':_0x3835f9(0x100),'criteriaName':_0x4a03b5[_0x3835f9(0x121)]||_0x55c82f};_0x1a077f:for(const _0x5ceeaf of _0x32a4ef){if(_0x5ceeaf[_0x3835f9(0xe9)]?.[_0x3835f9(0x197)]===_0x55c82f){_0x1f6a50=_0x5ceeaf[_0x3835f9(0x121)],_0xd97e7d=_0x5ceeaf[_0x3835f9(0xe9)][_0x3835f9(0x121)]||_0x55c82f;break;}if(_0x5ceeaf[_0x3835f9(0xfc)])for(const _0x2c0e2b of _0x5ceeaf['steps']){if(_0x2c0e2b[_0x3835f9(0x118)]==='decision_point'&&_0x2c0e2b[_0x3835f9(0x148)]?.['branches'])for(const _0x43ebe8 of _0x2c0e2b['with']['branches']){if(_0x43ebe8['segment']===_0x55c82f){_0x1f6a50=_0x5ceeaf[_0x3835f9(0x121)],_0xd97e7d=_0x43ebe8[_0x3835f9(0x121)]||_0x55c82f;break _0x1a077f;}}}}return{'stageName':_0x1f6a50,'criteriaName':_0xd97e7d};}async function executeThreeStepJourneyCreate(_0x2666f1,_0x378337,_0x786708,_0x41c490,_0x4b57b9,_0x1ff56d,_0x114800,_0x433d51){const _0x28038a=a152_0x33e6a2,{activationDefToCreateRequest:_0x5b42fc,yamlRuleToApi:_0x2c96d3}=_0x433d51,{pendingEmbeddedSegments:_0x3c7d89,pendingEmbeddedActivations:_0x5b6936,embeddedSegmentNameToId:_0x490a54}=_0x41c490,_0x12b337=JSON[_0x28038a(0x17c)](JSON[_0x28038a(0x18d)](_0x786708));ensureJourneyDefaults(_0x12b337['attributes']),stripPendingIds(_0x12b337);const _0x5f162d=await _0x2666f1[_0x28038a(0x9f)][_0x28038a(0xe1)](_0x12b337),_0x4f9852=_0x5f162d['id'],_0x574476=new Map();for(const _0x5995d9 of _0x5f162d[_0x28038a(0xb0)][_0x28038a(0x103)]){_0x574476[_0x28038a(0x153)](_0x5995d9['name']['toLowerCase'](),_0x5995d9['id']);}recoverSegmentIdsFromPushRecovery(_0x378337,_0x490a54,_0x1ff56d[_0x28038a(0xec)]);for(const [_0x36bf19,{definition:_0x53ed92}]of _0x3c7d89){if(_0x490a54[_0x28038a(0x198)](_0x36bf19)){_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x149),'journeyName':_0x378337['yamlConfig']['name'],'segmentName':_0x36bf19});continue;}const _0x3155b2=generateDeterministicJourneySegmentName(_0x378337['yamlConfig'][_0x28038a(0x121)],_0x36bf19);_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x131),'journeyName':_0x378337['yamlConfig'][_0x28038a(0x121)],'segmentName':_0x36bf19});const _0x1e19ba=createSegmentIdResolver(_0x1ff56d['segmentNameToId'],_0x36bf19),_0x342005=await resolveRuleSegmentIds(_0x53ed92[_0x28038a(0x140)],_0x1e19ba),_0x1caf9c=await createOrRecoverEmbeddedSegment(_0x2666f1,_0x378337,{'localName':_0x36bf19,'uniqueSegmentName':_0x3155b2,'description':_0x53ed92[_0x28038a(0xdf)]||_0x28038a(0x14b)+_0x36bf19,'journeyId':_0x4f9852,'resolvedRule':_0x342005,'parentId':_0x4b57b9[_0x28038a(0x10b)],'folderId':_0x4b57b9[_0x28038a(0x179)]||''},_0x2c96d3);_0x490a54[_0x28038a(0x153)](_0x36bf19,_0x1caf9c),_0x1ff56d[_0x28038a(0xec)][_0x28038a(0x153)](_0x36bf19,_0x1caf9c),_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x149),'journeyName':_0x378337['yamlConfig']['name'],'segmentName':_0x36bf19});}const _0x44ac71=new Map();for(const [_0x260540,_0x43a35c]of _0x5b6936){_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x170),'journeyName':_0x378337[_0x28038a(0x106)]['name'],'activationName':_0x260540});const _0x3be364=await _0x5b42fc(_0x43a35c,_0x1ff56d[_0x28038a(0x11e)]),_0x429a46={..._0x3be364,..._0x43a35c[_0x28038a(0x13e)]!==undefined&&{'runAfterJourneyRefresh':_0x43a35c['run_after_journey_refresh']}},_0x172867=await _0x2666f1[_0x28038a(0x9f)]['createActivation'](_0x4f9852,_0x429a46);_0x44ac71[_0x28038a(0x153)](_0x260540,_0x172867['id']),_0x41c490['journeyActivationNameToId'][_0x28038a(0x153)](_0x260540,_0x172867['id']),_0x114800['onProgress']?.({'type':_0x28038a(0x164),'journeyName':_0x378337['yamlConfig'][_0x28038a(0x121)],'activationName':_0x260540});}const _0x23bbd9=JSON[_0x28038a(0x17c)](JSON[_0x28038a(0x18d)](_0x786708));return _0x23bbd9['id']=_0x4f9852,ensureJourneyDefaults(_0x23bbd9['attributes']),resolvePendingIdsInRequest(_0x23bbd9,_0x786708,_0x574476,_0x490a54,_0x44ac71,_0x114800),await _0x2666f1[_0x28038a(0x9f)][_0x28038a(0x156)](_0x4f9852,_0x23bbd9),deletePushRecovery(_0x378337[_0x28038a(0x190)]),{'action':_0x28038a(0x11d),'journeyId':_0x4f9852,'embeddedSegmentNameToId':_0x490a54};}export function stripWaitStepPendingIds(_0x25b1de){const _0x2c837e=a152_0x33e6a2,_0x82a929=_0x25b1de[_0x2c837e(0x124)]&&isPendingSegmentId(_0x25b1de[_0x2c837e(0x124)]),_0x3bac09=_0x25b1de[_0x2c837e(0x127)]?.['some'](_0x23dd75=>_0x23dd75['segmentId']&&isPendingSegmentId(_0x23dd75['segmentId']));(_0x82a929||_0x3bac09)&&(_0x25b1de[_0x2c837e(0xf7)]='Duration',_0x25b1de[_0x2c837e(0xfb)]=0x1,_0x25b1de[_0x2c837e(0x150)]=_0x2c837e(0x174),delete _0x25b1de[_0x2c837e(0x124)],delete _0x25b1de[_0x2c837e(0xb4)],delete _0x25b1de['conditionTimeoutUnit'],delete _0x25b1de[_0x2c837e(0x127)]);}export function resolveWaitStepPendingIds(_0x7edd65,_0xff8e3c,_0x41dd23,_0x4fb0e5){const _0x363ffc=a152_0x33e6a2;if(_0xff8e3c['conditionSegmentId']&&isPendingSegmentId(_0xff8e3c['conditionSegmentId'])){const _0x2af9fb=_0x41dd23(_0xff8e3c[_0x363ffc(0x124)],'stage\x20\x27'+_0x4fb0e5+'\x27\x20wait\x20condition');_0x2af9fb&&(_0x7edd65[_0x363ffc(0xf7)]=_0x363ffc(0xeb),_0x7edd65['conditionSegmentId']=_0x2af9fb,delete _0x7edd65[_0x363ffc(0xfb)],delete _0x7edd65['waitStepUnit'],_0xff8e3c[_0x363ffc(0xb4)]!==undefined&&(_0x7edd65[_0x363ffc(0xb4)]=_0xff8e3c[_0x363ffc(0xb4)]),_0xff8e3c[_0x363ffc(0xc7)]&&(_0x7edd65[_0x363ffc(0xc7)]=_0xff8e3c['conditionTimeoutUnit']));}if(_0xff8e3c[_0x363ffc(0x127)]){const _0x51e1ce=_0xff8e3c[_0x363ffc(0x127)][_0x363ffc(0xb1)](_0x5913cd=>_0x5913cd['segmentId']&&isPendingSegmentId(_0x5913cd['segmentId']));if(_0x51e1ce){const _0x4c7023=_0xff8e3c[_0x363ffc(0x127)]['map'](_0xb10799=>{const _0x513040=_0x363ffc;if(_0xb10799['segmentId']&&isPendingSegmentId(_0xb10799['segmentId'])){const _0x19ce17=_0x41dd23(_0xb10799[_0x513040(0x15e)],_0x513040(0x132)+_0x4fb0e5+_0x513040(0x18b));return{..._0xb10799,'segmentId':_0x19ce17||_0xb10799[_0x513040(0x15e)]};}return{..._0xb10799};});_0x7edd65[_0x363ffc(0xf7)]=_0x363ffc(0xeb),_0x7edd65[_0x363ffc(0x127)]=_0x4c7023,delete _0x7edd65['waitStep'],delete _0x7edd65[_0x363ffc(0x150)],delete _0x7edd65[_0x363ffc(0x124)],delete _0x7edd65[_0x363ffc(0xb4)],delete _0x7edd65[_0x363ffc(0xc7)];}}}function stripPendingIds(_0x577235){const _0x4815cd=a152_0x33e6a2;_0x577235[_0x4815cd(0xb0)]['goal']?.['segmentId']&&isPendingSegmentId(_0x577235[_0x4815cd(0xb0)][_0x4815cd(0x100)][_0x4815cd(0x15e)])&&delete _0x577235[_0x4815cd(0xb0)][_0x4815cd(0x100)];for(const _0x4c1d3d of _0x577235['attributes'][_0x4815cd(0x103)]||[]){_0x4c1d3d[_0x4815cd(0xf4)]?.[_0x4815cd(0x15e)]&&isPendingSegmentId(_0x4c1d3d[_0x4815cd(0xf4)][_0x4815cd(0x15e)])&&delete _0x4c1d3d['entryCriteria'];_0x4c1d3d['milestone']?.[_0x4815cd(0x15e)]&&isPendingSegmentId(_0x4c1d3d[_0x4815cd(0x184)][_0x4815cd(0x15e)])&&delete _0x4c1d3d[_0x4815cd(0x184)];_0x4c1d3d[_0x4815cd(0x15a)]&&(_0x4c1d3d[_0x4815cd(0x15a)]=_0x4c1d3d['exitCriterias'][_0x4815cd(0x12f)](_0x6e19d9=>!_0x6e19d9['segmentId']||!isPendingSegmentId(_0x6e19d9['segmentId'])));if(_0x4c1d3d[_0x4815cd(0xfc)])for(const _0x569601 of Object['keys'](_0x4c1d3d['steps'])){const _0x483a41=_0x4c1d3d[_0x4815cd(0xfc)][_0x569601];_0x483a41[_0x4815cd(0x118)]==='Activation'&&_0x483a41[_0x4815cd(0xc6)]&&isPendingActivationId(_0x483a41[_0x4815cd(0xc6)])&&(_0x483a41[_0x4815cd(0xc6)]='');if(_0x483a41[_0x4815cd(0x118)]===_0x4815cd(0xc3)&&_0x483a41['branches'])for(const _0x28f9d4 of _0x483a41['branches']){_0x28f9d4[_0x4815cd(0x15e)]&&isPendingSegmentId(_0x28f9d4['segmentId'])&&(_0x28f9d4[_0x4815cd(0x15e)]='');}_0x483a41[_0x4815cd(0x118)]==='WaitStep'&&stripWaitStepPendingIds(_0x483a41);}}}function resolvePendingIdsInRequest(_0x460254,_0x4a3dd7,_0xc4bb68,_0x53107d,_0xddfff3,_0xd30293){const _0x58c033=a152_0x33e6a2,_0x200d10=(_0x2ed343,_0x4bfefc)=>{const _0x3ff864=a152_0x591f;if(!isPendingSegmentId(_0x2ed343))return _0x2ed343;const _0x1f7383=extractPendingSegmentName(_0x2ed343),_0x16d1f6=_0x53107d[_0x3ff864(0xa5)](_0x1f7383);return!_0x16d1f6&&_0xd30293['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x1f7383+_0x3ff864(0x10e)+_0x4bfefc),_0x16d1f6;};if(_0x460254[_0x58c033(0xb0)][_0x58c033(0x100)]?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x460254[_0x58c033(0xb0)][_0x58c033(0x100)]['segmentId'])){const _0x4a682e=_0x200d10(_0x460254['attributes'][_0x58c033(0x100)]['segmentId'],_0x58c033(0x146));_0x4a682e&&(_0x460254['attributes'][_0x58c033(0x100)][_0x58c033(0x15e)]=_0x4a682e);}for(const _0x3bdf98 of _0x460254[_0x58c033(0xb0)]['journeyStages']||[]){const _0xe4abbd=_0xc4bb68[_0x58c033(0xa5)](_0x3bdf98[_0x58c033(0x121)]['toLowerCase']());_0xe4abbd&&(_0x3bdf98['id']=_0xe4abbd);if(_0x3bdf98['entryCriteria']?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x3bdf98['entryCriteria']['segmentId'])){const _0x5102d8=_0x200d10(_0x3bdf98[_0x58c033(0xf4)][_0x58c033(0x15e)],_0x58c033(0x132)+_0x3bdf98[_0x58c033(0x121)]+'\x27\x20entry\x20criteria');_0x5102d8&&(_0x3bdf98['entryCriteria']['segmentId']=_0x5102d8);}if(_0x3bdf98[_0x58c033(0x15a)])for(const _0xb649de of _0x3bdf98[_0x58c033(0x15a)]){if(_0xb649de['segmentId']&&isPendingSegmentId(_0xb649de[_0x58c033(0x15e)])){const _0x2a756b=_0x200d10(_0xb649de[_0x58c033(0x15e)],_0x58c033(0x132)+_0x3bdf98['name']+_0x58c033(0xb6));_0x2a756b&&(_0xb649de[_0x58c033(0x15e)]=_0x2a756b);}}if(_0x3bdf98['milestone']?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x3bdf98[_0x58c033(0x184)][_0x58c033(0x15e)])){const _0x20f2a2=_0x200d10(_0x3bdf98[_0x58c033(0x184)]['segmentId'],_0x58c033(0x132)+_0x3bdf98[_0x58c033(0x121)]+_0x58c033(0x18e));_0x20f2a2&&(_0x3bdf98[_0x58c033(0x184)][_0x58c033(0x15e)]=_0x20f2a2);}if(_0x3bdf98['steps']){const _0x543ab5=_0x5dc41b=>_0x4a3dd7['attributes'][_0x58c033(0x103)]?.['find'](_0x5a1c1b=>_0x5a1c1b[_0x58c033(0x121)][_0x58c033(0x135)]()===_0x3bdf98[_0x58c033(0x121)]['toLowerCase']())?.[_0x58c033(0xfc)]?.[_0x5dc41b];for(const _0x2dd287 of Object[_0x58c033(0x136)](_0x3bdf98['steps'])){const _0x2cb03a=_0x3bdf98[_0x58c033(0xfc)][_0x2dd287],_0x5c8529=_0x543ab5(_0x2dd287);if(_0x2cb03a[_0x58c033(0x118)]===_0x58c033(0xab)&&_0x2cb03a[_0x58c033(0xc6)]&&(isPendingActivationId(_0x2cb03a[_0x58c033(0xc6)])||_0x2cb03a[_0x58c033(0xc6)]==='')){if(_0x5c8529?.[_0x58c033(0xc6)]&&isPendingActivationId(_0x5c8529['journeyActivationStepId'])){const _0x43aca0=extractPendingActivationName(_0x5c8529[_0x58c033(0xc6)]),_0xbeaea9=_0xddfff3[_0x58c033(0xa5)](_0x43aca0);_0xbeaea9&&(_0x2cb03a[_0x58c033(0xc6)]=_0xbeaea9);}}if(_0x2cb03a[_0x58c033(0x118)]===_0x58c033(0xc3)&&_0x2cb03a[_0x58c033(0x128)]&&_0x5c8529?.[_0x58c033(0x128)])for(let _0x26fa1f=0x0;_0x26fa1f<_0x2cb03a[_0x58c033(0x128)]['length'];_0x26fa1f++){const _0x1232b2=_0x2cb03a[_0x58c033(0x128)][_0x26fa1f],_0x389f74=_0x5c8529['branches'][_0x26fa1f];if(_0x389f74?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x389f74[_0x58c033(0x15e)])){const _0x3ef391=_0x200d10(_0x389f74['segmentId'],'stage\x20\x27'+_0x3bdf98['name']+_0x58c033(0xe5)+(_0x1232b2[_0x58c033(0x121)]||_0x26fa1f)+'\x27');_0x3ef391&&(_0x1232b2[_0x58c033(0x15e)]=_0x3ef391);}}_0x2cb03a[_0x58c033(0x118)]===_0x58c033(0x13a)&&_0x5c8529?.['type']===_0x58c033(0x13a)&&resolveWaitStepPendingIds(_0x2cb03a,_0x5c8529,_0x200d10,_0x3bdf98['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x4092f8,_0x20dcb0){const _0x32a46b=a153_0x647d,_0x299a96=_0x4092f8();while(!![]){try{const _0x4e082e=-parseInt(_0x32a46b(0x110))/0x1*(parseInt(_0x32a46b(0x10e))/0x2)+-parseInt(_0x32a46b(0x101))/0x3+-parseInt(_0x32a46b(0x104))/0x4+parseInt(_0x32a46b(0x108))/0x5*(parseInt(_0x32a46b(0x107))/0x6)+parseInt(_0x32a46b(0x102))/0x7+-parseInt(_0x32a46b(0x10b))/0x8*(parseInt(_0x32a46b(0x10a))/0x9)+parseInt(_0x32a46b(0x103))/0xa;if(_0x4e082e===_0x20dcb0)break;else _0x299a96['push'](_0x299a96['shift']());}catch(_0x578004){_0x299a96['push'](_0x299a96['shift']());}}}(a153_0x3d00,0x9b25b));function a153_0x647d(_0x4a2168,_0x4c66ef){_0x4a2168=_0x4a2168-0x101;const _0x3d00de=a153_0x3d00();let _0x647d8=_0x3d00de[_0x4a2168];return _0x647d8;}export function buildFolderIdToPathMap(_0x8471b7){const _0x420ab0=a153_0x647d,_0x19f2dc=new Map(),_0x1374e8=new Map();for(const _0x147be5 of _0x8471b7){_0x1374e8[_0x420ab0(0x10c)](_0x147be5['id'],_0x147be5);}const _0x2af252=new Set();for(const _0x4736a3 of _0x8471b7){!_0x4736a3[_0x420ab0(0x106)]&&_0x2af252[_0x420ab0(0x10d)](_0x4736a3['id']);}function _0x59322e(_0x9ac3cc){const _0x422df4=_0x420ab0;if(_0x19f2dc[_0x422df4(0x109)](_0x9ac3cc['id']))return _0x19f2dc[_0x422df4(0x105)](_0x9ac3cc['id']);if(_0x2af252[_0x422df4(0x109)](_0x9ac3cc['id']))return _0x19f2dc[_0x422df4(0x10c)](_0x9ac3cc['id'],''),'';if(_0x9ac3cc[_0x422df4(0x106)]){const _0x516f40=_0x1374e8[_0x422df4(0x105)](_0x9ac3cc[_0x422df4(0x106)]);if(_0x516f40){const _0x1feb42=_0x59322e(_0x516f40),_0x402d3a=_0x1feb42?_0x1feb42+'/'+_0x9ac3cc[_0x422df4(0x10f)]:_0x9ac3cc[_0x422df4(0x10f)];return _0x19f2dc[_0x422df4(0x10c)](_0x9ac3cc['id'],_0x402d3a),_0x402d3a;}}const _0x1e3bc7=_0x9ac3cc[_0x422df4(0x10f)];return _0x19f2dc[_0x422df4(0x10c)](_0x9ac3cc['id'],_0x1e3bc7),_0x1e3bc7;}for(const _0x50f7a0 of _0x8471b7){_0x59322e(_0x50f7a0);}return _0x19f2dc;}export function buildFolderPathToIdMap(_0x11b64f){const _0x5b53ef=a153_0x647d,_0x1b5562=new Map(),_0x54278d=new Map();for(const _0x299258 of _0x11b64f){_0x54278d[_0x5b53ef(0x10c)](_0x299258['id'],_0x299258);}const _0x68d016=new Set();for(const _0x5e1891 of _0x11b64f){!_0x5e1891[_0x5b53ef(0x106)]&&_0x68d016[_0x5b53ef(0x10d)](_0x5e1891['id']);}function _0x15fb13(_0x241494){if(_0x68d016['has'](_0x241494['id']))return'';if(_0x241494['parentFolderId']){const _0x17a17a=_0x54278d['get'](_0x241494['parentFolderId']);if(_0x17a17a){const _0x102a85=_0x15fb13(_0x17a17a);return _0x102a85?_0x102a85+'/'+_0x241494['name']:_0x241494['name'];}}return _0x241494['name'];}for(const _0x3bb5cd of _0x11b64f){const _0x2c3eb5=_0x15fb13(_0x3bb5cd);_0x1b5562[_0x5b53ef(0x10c)](_0x2c3eb5,_0x3bb5cd['id']);}return _0x1b5562;}export function buildFolderMaps(_0x2f9e6d){const _0x416a7c=a153_0x647d,_0x30b6aa=buildFolderIdToPathMap(_0x2f9e6d),_0x35dfdf=new Map();for(const [_0x7ac10e,_0x35b274]of _0x30b6aa){_0x35dfdf[_0x416a7c(0x10c)](_0x35b274,_0x7ac10e);}return{'idToPath':_0x30b6aa,'pathToId':_0x35dfdf};}function a153_0x3d00(){const _0x33a4a9=['23889270XtMuaw','2381644ymdrlP','get','parentFolderId','24IdgeNB','1299525OUUSRY','has','417879vYQSjq','80WBdjUF','set','add','382VEyLUj','name','6101DehvdR','3555918oBLRgl','4320778LlLtUO'];a153_0x3d00=function(){return _0x33a4a9;};return a153_0x3d00();}export function getFolderPath(_0xee07b2,_0x25687b){if(!_0xee07b2)return'';return _0x25687b['get'](_0xee07b2)??'';}
1
+ function a153_0x3fba(_0x4d0b19,_0xe1cb89){_0x4d0b19=_0x4d0b19-0x80;const _0x48e1c5=a153_0x48e1();let _0x3fba49=_0x48e1c5[_0x4d0b19];return _0x3fba49;}(function(_0x83797f,_0x2b735b){const _0x18c133=a153_0x3fba,_0x49f194=_0x83797f();while(!![]){try{const _0xfd8228=parseInt(_0x18c133(0x82))/0x1+parseInt(_0x18c133(0x81))/0x2*(-parseInt(_0x18c133(0x90))/0x3)+parseInt(_0x18c133(0x89))/0x4+-parseInt(_0x18c133(0x8e))/0x5*(parseInt(_0x18c133(0x8a))/0x6)+-parseInt(_0x18c133(0x85))/0x7*(parseInt(_0x18c133(0x8b))/0x8)+-parseInt(_0x18c133(0x86))/0x9*(-parseInt(_0x18c133(0x91))/0xa)+parseInt(_0x18c133(0x8d))/0xb*(parseInt(_0x18c133(0x84))/0xc);if(_0xfd8228===_0x2b735b)break;else _0x49f194['push'](_0x49f194['shift']());}catch(_0x739cdb){_0x49f194['push'](_0x49f194['shift']());}}}(a153_0x48e1,0x2b912));function a153_0x48e1(){const _0x10e5a3=['7001401TPiGAM','5vPxOdx','add','15474bvJEXJ','10yLtAnb','name','118OgEeSJ','134548kRMxBq','get','12ntRfRX','7eDQeMR','408627rFGFGC','has','set','141048nONlJT','666714YrquEL','2062504ouAhmT','parentFolderId'];a153_0x48e1=function(){return _0x10e5a3;};return a153_0x48e1();}export function buildFolderIdToPathMap(_0xa9227e){const _0x5cdfd4=a153_0x3fba,_0xd9a9b5=new Map(),_0x41f3dc=new Map();for(const _0x16fd50 of _0xa9227e){_0x41f3dc[_0x5cdfd4(0x88)](_0x16fd50['id'],_0x16fd50);}const _0x4a9446=new Set();for(const _0x3d5126 of _0xa9227e){!_0x3d5126['parentFolderId']&&_0x4a9446[_0x5cdfd4(0x8f)](_0x3d5126['id']);}function _0x5e20cf(_0x327c94){const _0x1c761e=_0x5cdfd4;if(_0xd9a9b5[_0x1c761e(0x87)](_0x327c94['id']))return _0xd9a9b5['get'](_0x327c94['id']);if(_0x4a9446[_0x1c761e(0x87)](_0x327c94['id']))return _0xd9a9b5['set'](_0x327c94['id'],''),'';if(_0x327c94[_0x1c761e(0x8c)]){const _0x4fd7f1=_0x41f3dc[_0x1c761e(0x83)](_0x327c94[_0x1c761e(0x8c)]);if(_0x4fd7f1){const _0x459de7=_0x5e20cf(_0x4fd7f1),_0x4a86f6=_0x459de7?_0x459de7+'/'+_0x327c94[_0x1c761e(0x80)]:_0x327c94[_0x1c761e(0x80)];return _0xd9a9b5[_0x1c761e(0x88)](_0x327c94['id'],_0x4a86f6),_0x4a86f6;}}const _0x197795=_0x327c94[_0x1c761e(0x80)];return _0xd9a9b5['set'](_0x327c94['id'],_0x197795),_0x197795;}for(const _0x3c031c of _0xa9227e){_0x5e20cf(_0x3c031c);}return _0xd9a9b5;}export function buildFolderPathToIdMap(_0x2dfdfa){const _0x50c99f=a153_0x3fba,_0x4990bb=new Map(),_0x5c3d8e=new Map();for(const _0x344f7f of _0x2dfdfa){_0x5c3d8e['set'](_0x344f7f['id'],_0x344f7f);}const _0x38caf3=new Set();for(const _0x2c426c of _0x2dfdfa){!_0x2c426c[_0x50c99f(0x8c)]&&_0x38caf3['add'](_0x2c426c['id']);}function _0x32d53c(_0x37d397){const _0x4dfad4=_0x50c99f;if(_0x38caf3[_0x4dfad4(0x87)](_0x37d397['id']))return'';if(_0x37d397[_0x4dfad4(0x8c)]){const _0x578903=_0x5c3d8e['get'](_0x37d397['parentFolderId']);if(_0x578903){const _0x239068=_0x32d53c(_0x578903);return _0x239068?_0x239068+'/'+_0x37d397[_0x4dfad4(0x80)]:_0x37d397[_0x4dfad4(0x80)];}}return _0x37d397['name'];}for(const _0x1c631f of _0x2dfdfa){const _0xfe3af4=_0x32d53c(_0x1c631f);_0x4990bb[_0x50c99f(0x88)](_0xfe3af4,_0x1c631f['id']);}return _0x4990bb;}export function buildFolderMaps(_0x120d7d){const _0x55739c=a153_0x3fba,_0x29fdff=buildFolderIdToPathMap(_0x120d7d),_0x2f0270=new Map();for(const [_0x1474ab,_0x35c45a]of _0x29fdff){_0x2f0270[_0x55739c(0x88)](_0x35c45a,_0x1474ab);}return{'idToPath':_0x29fdff,'pathToId':_0x2f0270};}export function getFolderPath(_0x40b2c4,_0x5261c2){const _0x1dd159=a153_0x3fba;if(!_0x40b2c4)return'';return _0x5261c2[_0x1dd159(0x83)](_0x40b2c4)??'';}
@@ -1 +1 @@
1
- (function(_0x5438cf,_0x54cc3d){const _0x2ee959=a154_0x2e8b,_0x26d1e4=_0x5438cf();while(!![]){try{const _0x74c74e=-parseInt(_0x2ee959(0x146))/0x1+parseInt(_0x2ee959(0x15d))/0x2+parseInt(_0x2ee959(0x15a))/0x3+parseInt(_0x2ee959(0x159))/0x4*(parseInt(_0x2ee959(0x14c))/0x5)+-parseInt(_0x2ee959(0x14d))/0x6+parseInt(_0x2ee959(0x13e))/0x7*(parseInt(_0x2ee959(0x147))/0x8)+parseInt(_0x2ee959(0x164))/0x9*(parseInt(_0x2ee959(0x13a))/0xa);if(_0x74c74e===_0x54cc3d)break;else _0x26d1e4['push'](_0x26d1e4['shift']());}catch(_0x275ce6){_0x26d1e4['push'](_0x26d1e4['shift']());}}}(a154_0x1cdf,0xbda40));function a154_0x1cdf(){const _0xb2a782=['pop','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','push','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','40zKmqvU','856968KepHRB','Path\x20segment\x20cannot\x20be\x20empty','segment','1705380CdgFPo','raw','trim','replace','.yml','startsWith','join','2007MGpuMR','slice','Relative\x20path\x20cannot\x20be\x20empty','isAbsolute','length','parse','13540DUiKRs','filter','segments','exists','60116nFLVxf','test','dirname','readFile','Cannot\x20navigate\x20above\x20root','tdx.json','relative','parent_segment','1411005qLnsoo','344KPzsao','Path\x20attempts\x20to\x20navigate\x20above\x20root','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','journey','File\x20not\x20found:\x20','695135ILSUDw','6072414qrrHor','endsWith','resolve','split','type','Path\x20cannot\x20be\x20empty','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Cannot\x20split\x20empty\x20path'];a154_0x1cdf=function(){return _0xb2a782;};return a154_0x1cdf();}import a154_0x496399 from'path';import{parse as a154_0xfe0204}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x4eb0b6){const _0x21f20a=a154_0x2e8b;if(!_0x4eb0b6||_0x4eb0b6[_0x21f20a(0x15f)]()==='')throw new Error(_0x21f20a(0x152));const _0x33cccb=_0x4eb0b6[_0x21f20a(0x15f)]();if(_0x33cccb==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x4eb0b6};const _0x43c665=_0x33cccb[_0x21f20a(0x162)]('/')?_0x33cccb['substring'](0x1):_0x33cccb,_0x245b70=_0x43c665[_0x21f20a(0x150)]('/')[_0x21f20a(0x13b)](_0x155cb9=>_0x155cb9!=='');if(_0x245b70[_0x21f20a(0x168)]===0x0)throw new Error(_0x21f20a(0x158));const _0x1b0553=_0x33cccb[_0x21f20a(0x162)]('/')||!isRelativePathSegment(_0x245b70[0x0]);for(const _0x162a6f of _0x245b70){validatePathSegment(_0x162a6f);}return{'segments':_0x245b70,'isAbsolute':_0x1b0553,'raw':_0x4eb0b6};}function isRelativePathSegment(_0x2ad8ab){return _0x2ad8ab==='.'||_0x2ad8ab==='..';}function validatePathSegment(_0xad69bc){const _0x1d7786=a154_0x2e8b;if(_0xad69bc==='')throw new Error(_0x1d7786(0x15b));if(_0xad69bc==='.'||_0xad69bc==='..')return;if(/[\x00-\x1F\x7F]/[_0x1d7786(0x13f)](_0xad69bc))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0xad69bc);if(_0xad69bc!==_0xad69bc[_0x1d7786(0x15f)]()){}}export function validatePath(_0x4dacd6){const _0x45b655=a154_0x2e8b;if(_0x4dacd6[_0x45b655(0x13c)][_0x45b655(0x168)]===0x0&&!_0x4dacd6['isAbsolute'])throw new Error(_0x45b655(0x166));if(_0x4dacd6[_0x45b655(0x167)]){if(_0x4dacd6[_0x45b655(0x13c)][0x0]==='..')throw new Error(_0x45b655(0x153));let _0xc8238e=0x0;for(const _0x3902b5 of _0x4dacd6[_0x45b655(0x13c)]){if(_0x3902b5==='..'){if(_0xc8238e===0x0)throw new Error(_0x45b655(0x148));_0xc8238e--;}else _0x3902b5!=='.'&&_0xc8238e++;}}}export function joinPaths(_0xc2e092,_0x3d3077){const _0x58fd2d=a154_0x2e8b;if(!_0xc2e092||_0xc2e092==='/')return _0x3d3077;if(!_0x3d3077||_0x3d3077==='.')return _0xc2e092;if(_0x3d3077[_0x58fd2d(0x162)]('/'))return _0x3d3077;const _0x4db595=parsePath(_0xc2e092),_0x312b9d=parsePath(_0x3d3077),_0x538f53=[..._0x4db595['segments']];for(const _0x46bc45 of _0x312b9d['segments']){if(_0x46bc45==='.')continue;else{if(_0x46bc45==='..'){if(_0x538f53[_0x58fd2d(0x168)]===0x0)throw new Error(_0x58fd2d(0x142));_0x538f53[_0x58fd2d(0x155)]();}else _0x538f53['push'](_0x46bc45);}}const _0x4e8c67=_0x538f53[_0x58fd2d(0x163)]('/');return _0x4db595[_0x58fd2d(0x15e)][_0x58fd2d(0x162)]('/')?'/'+_0x4e8c67:_0x4e8c67;}export function normalizePath(_0x2a9a9a){const _0x159844=a154_0x2e8b,_0x5ecec8=parsePath(_0x2a9a9a),_0x21c715=[];for(const _0x1911ae of _0x5ecec8['segments']){if(_0x1911ae==='.')continue;else{if(_0x1911ae==='..'){if(_0x21c715[_0x159844(0x168)]===0x0){if(_0x5ecec8[_0x159844(0x167)])throw new Error(_0x159844(0x142));_0x21c715[_0x159844(0x157)]('..');}else _0x21c715[_0x21c715[_0x159844(0x168)]-0x1]==='..'?_0x21c715['push']('..'):_0x21c715[_0x159844(0x155)]();}else _0x21c715[_0x159844(0x157)](_0x1911ae);}}if(_0x21c715[_0x159844(0x168)]===0x0)return _0x5ecec8[_0x159844(0x167)]?'/':'.';const _0x186ed9=_0x21c715['join']('/');return _0x5ecec8['raw'][_0x159844(0x162)]('/')?'/'+_0x186ed9:_0x186ed9;}export function getParentPath(_0x9823f4){const _0x249174=a154_0x2e8b,_0x4984ed=parsePath(_0x9823f4);if(_0x4984ed[_0x249174(0x13c)][_0x249174(0x168)]<=0x1)return'/';const _0x105fde=_0x4984ed[_0x249174(0x13c)][_0x249174(0x165)](0x0,-0x1)[_0x249174(0x163)]('/');return _0x4984ed[_0x249174(0x15e)][_0x249174(0x162)]('/')?'/'+_0x105fde:_0x105fde;}function a154_0x2e8b(_0x57f973,_0x2703db){_0x57f973=_0x57f973-0x139;const _0x1cdf55=a154_0x1cdf();let _0x2e8be9=_0x1cdf55[_0x57f973];return _0x2e8be9;}export function getBaseName(_0x575b2b){const _0x7c17e3=a154_0x2e8b,_0x59cffe=parsePath(_0x575b2b);return _0x59cffe[_0x7c17e3(0x13c)][_0x59cffe[_0x7c17e3(0x13c)][_0x7c17e3(0x168)]-0x1]||'';}export function isChildPath(_0x232d71,_0x11adc4){const _0x4ba72d=a154_0x2e8b,_0x5f1f94=parsePath(_0x232d71),_0x11bb55=parsePath(_0x11adc4);if(_0x5f1f94[_0x4ba72d(0x13c)][_0x4ba72d(0x168)]<=_0x11bb55['segments'][_0x4ba72d(0x168)])return![];for(let _0x50dfa2=0x0;_0x50dfa2<_0x11bb55[_0x4ba72d(0x13c)][_0x4ba72d(0x168)];_0x50dfa2++){if(_0x5f1f94[_0x4ba72d(0x13c)][_0x50dfa2]!==_0x11bb55['segments'][_0x50dfa2])return![];}return!![];}export function splitPath(_0x362595){const _0x28ec7f=a154_0x2e8b,_0x4d7272=parsePath(_0x362595);if(_0x4d7272[_0x28ec7f(0x13c)]['length']===0x0)throw new Error(_0x28ec7f(0x154));if(_0x4d7272[_0x28ec7f(0x13c)]['length']===0x1)return{'parent':_0x4d7272[_0x28ec7f(0x13c)][0x0]};return{'parent':_0x4d7272[_0x28ec7f(0x13c)][0x0],'child':_0x4d7272[_0x28ec7f(0x13c)][_0x28ec7f(0x165)](0x1)[_0x28ec7f(0x163)]('/')};}export function isYamlFilePath(_0x59cc6a){const _0x24ac88=a154_0x2e8b;return _0x59cc6a[_0x24ac88(0x14e)](_0x24ac88(0x161))||_0x59cc6a[_0x24ac88(0x14e)]('.yaml');}export async function resolveYamlFilePath(_0x526281,_0x5081dd=nodeFileSystem){const _0x1b8b17=a154_0x2e8b,_0x503343=a154_0x496399[_0x1b8b17(0x14f)](_0x526281);if(!await _0x5081dd[_0x1b8b17(0x13d)](_0x503343))throw new Error(_0x1b8b17(0x14b)+_0x526281);let _0x4667d1=a154_0x496399[_0x1b8b17(0x140)](_0x503343),_0x5ac430=null,_0x53361b=null;const _0x3c7bac=a154_0x496399[_0x1b8b17(0x139)](_0x4667d1)['root'];while(_0x4667d1!==_0x3c7bac){const _0x3c5152=a154_0x496399['join'](_0x4667d1,_0x1b8b17(0x143));if(await _0x5081dd[_0x1b8b17(0x13d)](_0x3c5152)){_0x5ac430=_0x3c5152,_0x53361b=_0x4667d1;break;}_0x4667d1=a154_0x496399[_0x1b8b17(0x140)](_0x4667d1);}if(!_0x5ac430||!_0x53361b)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x526281+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x4ba132=await _0x5081dd[_0x1b8b17(0x141)](_0x5ac430),_0x15446e=JSON['parse'](_0x4ba132),_0x418cad=_0x15446e[_0x1b8b17(0x145)];if(!_0x418cad)throw new Error(_0x1b8b17(0x156));const _0x4afb78=await _0x5081dd[_0x1b8b17(0x141)](_0x503343),_0x5ecea7=a154_0xfe0204(_0x4afb78),_0x3508ba=_0x5ecea7['name'];if(!_0x3508ba)throw new Error(_0x1b8b17(0x149)+_0x526281);const _0x4697af=_0x5ecea7[_0x1b8b17(0x151)]===_0x1b8b17(0x14a)?_0x1b8b17(0x14a):_0x1b8b17(0x15c),_0x5882ab=a154_0x496399[_0x1b8b17(0x144)](_0x53361b,_0x503343),_0x3adba7=a154_0x496399[_0x1b8b17(0x140)](_0x5882ab),_0x53ee55=_0x3adba7==='.'?'':_0x3adba7[_0x1b8b17(0x160)](/\\/g,'/'),_0x1f699b=_0x53ee55?_0x418cad+'/'+_0x53ee55+'/'+_0x3508ba:_0x418cad+'/'+_0x3508ba;return{'parentSegment':_0x418cad,'segmentName':_0x3508ba,'folderPath':_0x53ee55,'fullPath':_0x1f699b,'resourceType':_0x4697af,'content':_0x4afb78};}
1
+ (function(_0x3afc42,_0x1da322){const _0x4e977f=a154_0xe3c3,_0x45ca39=_0x3afc42();while(!![]){try{const _0x57f677=parseInt(_0x4e977f(0x1de))/0x1*(-parseInt(_0x4e977f(0x1cb))/0x2)+-parseInt(_0x4e977f(0x1c9))/0x3*(-parseInt(_0x4e977f(0x1eb))/0x4)+parseInt(_0x4e977f(0x1da))/0x5+parseInt(_0x4e977f(0x1db))/0x6+parseInt(_0x4e977f(0x1cd))/0x7+parseInt(_0x4e977f(0x1f0))/0x8*(-parseInt(_0x4e977f(0x1f1))/0x9)+-parseInt(_0x4e977f(0x1f4))/0xa*(parseInt(_0x4e977f(0x1d7))/0xb);if(_0x57f677===_0x1da322)break;else _0x45ca39['push'](_0x45ca39['shift']());}catch(_0xf13659){_0x45ca39['push'](_0x45ca39['shift']());}}}(a154_0x3569,0xa9297));import a154_0x34f677 from'path';import{parse as a154_0x5d3231}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x54d656){const _0x254ebc=a154_0xe3c3;if(!_0x54d656||_0x54d656[_0x254ebc(0x1e6)]()==='')throw new Error(_0x254ebc(0x1e2));const _0x5da9d1=_0x54d656['trim']();if(_0x5da9d1==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x54d656};const _0x4043df=_0x5da9d1[_0x254ebc(0x1d3)]('/')?_0x5da9d1[_0x254ebc(0x1dc)](0x1):_0x5da9d1,_0x51af5e=_0x4043df[_0x254ebc(0x1e5)]('/')[_0x254ebc(0x1e1)](_0x45fbb1=>_0x45fbb1!=='');if(_0x51af5e[_0x254ebc(0x1ce)]===0x0)throw new Error(_0x254ebc(0x1f3));const _0x2ae0f8=_0x5da9d1[_0x254ebc(0x1d3)]('/')||!isRelativePathSegment(_0x51af5e[0x0]);for(const _0x4712f4 of _0x51af5e){validatePathSegment(_0x4712f4);}return{'segments':_0x51af5e,'isAbsolute':_0x2ae0f8,'raw':_0x54d656};}function a154_0xe3c3(_0x171208,_0x595238){_0x171208=_0x171208-0x1c2;const _0x356915=a154_0x3569();let _0xe3c3b5=_0x356915[_0x171208];return _0xe3c3b5;}function isRelativePathSegment(_0xd07494){return _0xd07494==='.'||_0xd07494==='..';}function validatePathSegment(_0x48be36){const _0x4adcd1=a154_0xe3c3;if(_0x48be36==='')throw new Error(_0x4adcd1(0x1d8));if(_0x48be36==='.'||_0x48be36==='..')return;if(/[\x00-\x1F\x7F]/[_0x4adcd1(0x1c6)](_0x48be36))throw new Error(_0x4adcd1(0x1d2)+_0x48be36);if(_0x48be36!==_0x48be36[_0x4adcd1(0x1e6)]()){}}export function validatePath(_0x4c6e93){const _0x3f15f9=a154_0xe3c3;if(_0x4c6e93['segments']['length']===0x0&&!_0x4c6e93[_0x3f15f9(0x1c8)])throw new Error(_0x3f15f9(0x1c7));if(_0x4c6e93['isAbsolute']){if(_0x4c6e93[_0x3f15f9(0x1ef)][0x0]==='..')throw new Error(_0x3f15f9(0x1f2));let _0x303b7c=0x0;for(const _0x340176 of _0x4c6e93['segments']){if(_0x340176==='..'){if(_0x303b7c===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x303b7c--;}else _0x340176!=='.'&&_0x303b7c++;}}}export function joinPaths(_0x153cd9,_0x240107){const _0x31b4d5=a154_0xe3c3;if(!_0x153cd9||_0x153cd9==='/')return _0x240107;if(!_0x240107||_0x240107==='.')return _0x153cd9;if(_0x240107[_0x31b4d5(0x1d3)]('/'))return _0x240107;const _0x10064f=parsePath(_0x153cd9),_0x51f809=parsePath(_0x240107),_0x1c92ce=[..._0x10064f[_0x31b4d5(0x1ef)]];for(const _0x402230 of _0x51f809['segments']){if(_0x402230==='.')continue;else{if(_0x402230==='..'){if(_0x1c92ce[_0x31b4d5(0x1ce)]===0x0)throw new Error(_0x31b4d5(0x1ee));_0x1c92ce[_0x31b4d5(0x1c3)]();}else _0x1c92ce[_0x31b4d5(0x1c4)](_0x402230);}}const _0x3343b8=_0x1c92ce[_0x31b4d5(0x1e3)]('/');return _0x10064f[_0x31b4d5(0x1e4)][_0x31b4d5(0x1d3)]('/')?'/'+_0x3343b8:_0x3343b8;}export function normalizePath(_0x42815e){const _0xeb846d=a154_0xe3c3,_0x550e17=parsePath(_0x42815e),_0x2a044b=[];for(const _0x726e87 of _0x550e17['segments']){if(_0x726e87==='.')continue;else{if(_0x726e87==='..'){if(_0x2a044b['length']===0x0){if(_0x550e17[_0xeb846d(0x1c8)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x2a044b[_0xeb846d(0x1c4)]('..');}else _0x2a044b[_0x2a044b[_0xeb846d(0x1ce)]-0x1]==='..'?_0x2a044b['push']('..'):_0x2a044b[_0xeb846d(0x1c3)]();}else _0x2a044b['push'](_0x726e87);}}if(_0x2a044b['length']===0x0)return _0x550e17[_0xeb846d(0x1c8)]?'/':'.';const _0x2f883f=_0x2a044b['join']('/');return _0x550e17[_0xeb846d(0x1e4)][_0xeb846d(0x1d3)]('/')?'/'+_0x2f883f:_0x2f883f;}export function getParentPath(_0x29092a){const _0x91d56c=a154_0xe3c3,_0x5542b2=parsePath(_0x29092a);if(_0x5542b2[_0x91d56c(0x1ef)][_0x91d56c(0x1ce)]<=0x1)return'/';const _0xce45f9=_0x5542b2[_0x91d56c(0x1ef)]['slice'](0x0,-0x1)['join']('/');return _0x5542b2[_0x91d56c(0x1e4)][_0x91d56c(0x1d3)]('/')?'/'+_0xce45f9:_0xce45f9;}export function getBaseName(_0x5434a8){const _0x9d0495=a154_0xe3c3,_0x5cfc5b=parsePath(_0x5434a8);return _0x5cfc5b[_0x9d0495(0x1ef)][_0x5cfc5b[_0x9d0495(0x1ef)]['length']-0x1]||'';}function a154_0x3569(){const _0x29744e=['raw','split','trim','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','replace','.yaml','type','953896SqhQEP','root','relative','Cannot\x20navigate\x20above\x20root','segments','120wsCjDC','209268bDZZat','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','20vhPKCB','Cannot\x20split\x20empty\x20path','pop','push','parse','test','Relative\x20path\x20cannot\x20be\x20empty','isAbsolute','3WOVFFR','resolve','66pmItgq','segment','3204936awcmEb','length','endsWith','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','name','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','startsWith','dirname','exists','.yml','5491805pwtOPA','Path\x20segment\x20cannot\x20be\x20empty','File\x20not\x20found:\x20','5961840nUHbdg','2192556GOQgmH','substring','journey','6483MXifdv','readFile','slice','filter','Path\x20cannot\x20be\x20empty','join'];a154_0x3569=function(){return _0x29744e;};return a154_0x3569();}export function isChildPath(_0x357ddf,_0x4a24c2){const _0x370bbe=a154_0xe3c3,_0x35a578=parsePath(_0x357ddf),_0x5de4ba=parsePath(_0x4a24c2);if(_0x35a578[_0x370bbe(0x1ef)]['length']<=_0x5de4ba[_0x370bbe(0x1ef)]['length'])return![];for(let _0xe7bbfc=0x0;_0xe7bbfc<_0x5de4ba['segments'][_0x370bbe(0x1ce)];_0xe7bbfc++){if(_0x35a578[_0x370bbe(0x1ef)][_0xe7bbfc]!==_0x5de4ba[_0x370bbe(0x1ef)][_0xe7bbfc])return![];}return!![];}export function splitPath(_0x2ad2e1){const _0x11a487=a154_0xe3c3,_0x593d5f=parsePath(_0x2ad2e1);if(_0x593d5f[_0x11a487(0x1ef)]['length']===0x0)throw new Error(_0x11a487(0x1c2));if(_0x593d5f[_0x11a487(0x1ef)][_0x11a487(0x1ce)]===0x1)return{'parent':_0x593d5f[_0x11a487(0x1ef)][0x0]};return{'parent':_0x593d5f['segments'][0x0],'child':_0x593d5f[_0x11a487(0x1ef)][_0x11a487(0x1e0)](0x1)[_0x11a487(0x1e3)]('/')};}export function isYamlFilePath(_0x42bcb3){const _0x1227a4=a154_0xe3c3;return _0x42bcb3[_0x1227a4(0x1cf)](_0x1227a4(0x1d6))||_0x42bcb3[_0x1227a4(0x1cf)](_0x1227a4(0x1e9));}export async function resolveYamlFilePath(_0x38e37e,_0x3222b6=nodeFileSystem){const _0x2b2a2e=a154_0xe3c3,_0x2b4b4f=a154_0x34f677[_0x2b2a2e(0x1ca)](_0x38e37e);if(!await _0x3222b6[_0x2b2a2e(0x1d5)](_0x2b4b4f))throw new Error(_0x2b2a2e(0x1d9)+_0x38e37e);let _0x1f5ec2=a154_0x34f677['dirname'](_0x2b4b4f),_0x3a8a1a=null,_0x1f6dc8=null;const _0xd880d3=a154_0x34f677[_0x2b2a2e(0x1c5)](_0x1f5ec2)[_0x2b2a2e(0x1ec)];while(_0x1f5ec2!==_0xd880d3){const _0x2bf66e=a154_0x34f677[_0x2b2a2e(0x1e3)](_0x1f5ec2,'tdx.json');if(await _0x3222b6['exists'](_0x2bf66e)){_0x3a8a1a=_0x2bf66e,_0x1f6dc8=_0x1f5ec2;break;}_0x1f5ec2=a154_0x34f677[_0x2b2a2e(0x1d4)](_0x1f5ec2);}if(!_0x3a8a1a||!_0x1f6dc8)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x38e37e+'\x0a'+_0x2b2a2e(0x1d0));const _0x498c62=await _0x3222b6[_0x2b2a2e(0x1df)](_0x3a8a1a),_0x29189d=JSON['parse'](_0x498c62),_0x38faca=_0x29189d['parent_segment'];if(!_0x38faca)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1f1c98=await _0x3222b6[_0x2b2a2e(0x1df)](_0x2b4b4f),_0x3761f2=a154_0x5d3231(_0x1f1c98),_0x14bb96=_0x3761f2[_0x2b2a2e(0x1d1)];if(!_0x14bb96)throw new Error(_0x2b2a2e(0x1e7)+_0x38e37e);const _0x394582=_0x3761f2[_0x2b2a2e(0x1ea)]===_0x2b2a2e(0x1dd)?_0x2b2a2e(0x1dd):_0x2b2a2e(0x1cc),_0x439840=a154_0x34f677[_0x2b2a2e(0x1ed)](_0x1f6dc8,_0x2b4b4f),_0x38b050=a154_0x34f677[_0x2b2a2e(0x1d4)](_0x439840),_0x1dd34e=_0x38b050==='.'?'':_0x38b050[_0x2b2a2e(0x1e8)](/\\/g,'/'),_0x4fd846=_0x1dd34e?_0x38faca+'/'+_0x1dd34e+'/'+_0x14bb96:_0x38faca+'/'+_0x14bb96;return{'parentSegment':_0x38faca,'segmentName':_0x14bb96,'folderPath':_0x1dd34e,'fullPath':_0x4fd846,'resourceType':_0x394582,'content':_0x1f1c98};}
@@ -1 +1 @@
1
- (function(_0x2ad66d,_0x6e538b){const _0xb218a=a155_0x3342,_0x54d07b=_0x2ad66d();while(!![]){try{const _0x23a90f=-parseInt(_0xb218a(0xd6))/0x1*(parseInt(_0xb218a(0xda))/0x2)+parseInt(_0xb218a(0xde))/0x3*(-parseInt(_0xb218a(0xd7))/0x4)+parseInt(_0xb218a(0xdc))/0x5+-parseInt(_0xb218a(0xe2))/0x6+-parseInt(_0xb218a(0xd5))/0x7*(-parseInt(_0xb218a(0xdd))/0x8)+parseInt(_0xb218a(0xdf))/0x9*(-parseInt(_0xb218a(0xe1))/0xa)+parseInt(_0xb218a(0xd4))/0xb*(parseInt(_0xb218a(0xe3))/0xc);if(_0x23a90f===_0x6e538b)break;else _0x54d07b['push'](_0x54d07b['shift']());}catch(_0x495348){_0x54d07b['push'](_0x54d07b['shift']());}}}(a155_0x1ab6,0x368d8));function a155_0x1ab6(){const _0x6bf479=['Invalid\x20segment\x20reference\x20format:\x20','11DHPFPZ','686ZrthHN','317887OaqDob','8524UBpGdO','substring','indexOf','2QKmDea','.\x20Parent\x20name\x20cannot\x20be\x20empty','705740PnaaEr','14080ersqfE','393FOZvfY','93861RVArRK','.\x20Child\x20name\x20cannot\x20be\x20empty','390OjraJd','118890nkHZph','11200968AxmekR'];a155_0x1ab6=function(){return _0x6bf479;};return a155_0x1ab6();}function a155_0x3342(_0x5c7c57,_0x35ed34){_0x5c7c57=_0x5c7c57-0xd3;const _0x1ab608=a155_0x1ab6();let _0x3342d5=_0x1ab608[_0x5c7c57];return _0x3342d5;}export function parseSegmentRef(_0x15f38c){const _0x465b71=a155_0x3342,_0x129712=_0x15f38c[_0x465b71(0xd9)]('/');if(_0x129712===-0x1)return{'parentId':_0x15f38c};if(_0x129712===0x0)throw new Error(_0x465b71(0xd3)+_0x15f38c+_0x465b71(0xdb));const _0x8570e4=_0x15f38c[_0x465b71(0xd8)](0x0,_0x129712),_0x4b6bc5=_0x15f38c['substring'](_0x129712+0x1);if(_0x4b6bc5==='')throw new Error(_0x465b71(0xd3)+_0x15f38c+_0x465b71(0xe0));return{'parentId':_0x8570e4,'childId':_0x4b6bc5};}
1
+ function a155_0x5b4f(_0x570f67,_0x436fe1){_0x570f67=_0x570f67-0x185;const _0x1d7d03=a155_0x1d7d();let _0x5b4f31=_0x1d7d03[_0x570f67];return _0x5b4f31;}function a155_0x1d7d(){const _0x198a70=['12988woGdvs','indexOf','Invalid\x20segment\x20reference\x20format:\x20','276gjwhaj','814548mxSAPP','substring','193897YadeRc','60aKYJDe','.\x20Child\x20name\x20cannot\x20be\x20empty','187730VSrNcE','132507XlJXEe','40BudIwh','530nLYzkW','4827632Tcjinw','2625cNGqPE','.\x20Parent\x20name\x20cannot\x20be\x20empty','8796SPPHsx'];a155_0x1d7d=function(){return _0x198a70;};return a155_0x1d7d();}(function(_0x4667fe,_0x421527){const _0xdd3ff4=a155_0x5b4f,_0xa8d9c5=_0x4667fe();while(!![]){try{const _0x5b265a=parseInt(_0xdd3ff4(0x185))/0x1+parseInt(_0xdd3ff4(0x192))/0x2*(-parseInt(_0xdd3ff4(0x195))/0x3)+parseInt(_0xdd3ff4(0x18c))/0x4*(-parseInt(_0xdd3ff4(0x18a))/0x5)+parseInt(_0xdd3ff4(0x191))/0x6*(parseInt(_0xdd3ff4(0x18f))/0x7)+-parseInt(_0xdd3ff4(0x18e))/0x8+-parseInt(_0xdd3ff4(0x18b))/0x9*(-parseInt(_0xdd3ff4(0x18d))/0xa)+-parseInt(_0xdd3ff4(0x187))/0xb*(-parseInt(_0xdd3ff4(0x188))/0xc);if(_0x5b265a===_0x421527)break;else _0xa8d9c5['push'](_0xa8d9c5['shift']());}catch(_0x1dfd31){_0xa8d9c5['push'](_0xa8d9c5['shift']());}}}(a155_0x1d7d,0xa0406));export function parseSegmentRef(_0x4445cc){const _0x940394=a155_0x5b4f,_0x5868ed=_0x4445cc[_0x940394(0x193)]('/');if(_0x5868ed===-0x1)return{'parentId':_0x4445cc};if(_0x5868ed===0x0)throw new Error(_0x940394(0x194)+_0x4445cc+_0x940394(0x190));const _0x416067=_0x4445cc[_0x940394(0x186)](0x0,_0x5868ed),_0x31b318=_0x4445cc[_0x940394(0x186)](_0x5868ed+0x1);if(_0x31b318==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x4445cc+_0x940394(0x189));return{'parentId':_0x416067,'childId':_0x31b318};}
@@ -1 +1 @@
1
- function a156_0x4e49(_0x1efe7b,_0xd6baff){_0x1efe7b=_0x1efe7b-0x81;const _0x361ed3=a156_0x361e();let _0x4e494d=_0x361ed3[_0x1efe7b];return _0x4e494d;}(function(_0x18b978,_0x5429a8){const _0x3c4c5f=a156_0x4e49,_0x1a079d=_0x18b978();while(!![]){try{const _0x41b9c2=parseInt(_0x3c4c5f(0xaf))/0x1+parseInt(_0x3c4c5f(0xa5))/0x2+parseInt(_0x3c4c5f(0xb4))/0x3*(parseInt(_0x3c4c5f(0x8c))/0x4)+-parseInt(_0x3c4c5f(0x83))/0x5+parseInt(_0x3c4c5f(0x93))/0x6*(parseInt(_0x3c4c5f(0x98))/0x7)+-parseInt(_0x3c4c5f(0x94))/0x8*(-parseInt(_0x3c4c5f(0x99))/0x9)+-parseInt(_0x3c4c5f(0x84))/0xa;if(_0x41b9c2===_0x5429a8)break;else _0x1a079d['push'](_0x1a079d['shift']());}catch(_0xe5e9dc){_0x1a079d['push'](_0x1a079d['shift']());}}}(a156_0x361e,0x6908e));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x33fea7,_0x171941={},_0x3f4329={}){const _0x186fe7=a156_0x4e49;if(_0x3f4329[_0x186fe7(0xb2)])return runSemanticChecks(_0x33fea7,_0x171941);const _0x4ef0f4=SegmentDefSchema[_0x186fe7(0x96)](_0x33fea7);if(_0x4ef0f4[_0x186fe7(0x89)])return runSemanticChecks(_0x4ef0f4['data'],_0x171941);return zodErrorsToValidationResult(_0x4ef0f4[_0x186fe7(0xc1)],_0x171941);}export function validateRuleDef(_0x1bd765,_0x4a6651,_0x33ffec){const _0x4945c8=a156_0x4e49;if(!_0x1bd765)return[];const _0x1e98d6=RuleDefSchema[_0x4945c8(0x96)](_0x1bd765);if(_0x1e98d6[_0x4945c8(0x89)])return checkRule(_0x1e98d6['data'],_0x4a6651,_0x33ffec);const _0x34ba1a=flattenZodIssues(_0x1e98d6[_0x4945c8(0xc1)][_0x4945c8(0x88)]);return _0x34ba1a['map'](_0x1d783f=>{const _0x31349e=_0x4945c8,_0xab01ea=formatZodPath(_0x1d783f[_0x31349e(0x9c)]),_0x5433ca=_0xab01ea?_0x4a6651+'.'+_0xab01ea:_0x4a6651,_0x34ca75=mapZodIssueToCode(_0x1d783f,_0xab01ea),_0x5eca7a=getLocationFromPath(_0x33ffec[_0x31349e(0xbc)],_0x33ffec[_0x31349e(0xa7)],pathToArray(_0x5433ca));return{'level':_0x31349e(0xc1),'path':_0x5433ca,'code':_0x34ca75,'message':_0x1d783f['message'],..._0x5eca7a&&{'location':_0x5eca7a}};});}function zodErrorsToValidationResult(_0x1091ef,_0x151351){const _0x4f81c1=a156_0x4e49,_0x1e2000=flattenZodIssues(_0x1091ef['issues']),_0xa1aa70=_0x1e2000[_0x4f81c1(0x9a)](_0x2a58a5=>{const _0x46b75a=_0x4f81c1,_0xdb8d4f=formatZodPath(_0x2a58a5[_0x46b75a(0x9c)]),_0x2437e6=mapZodIssueToCode(_0x2a58a5,_0xdb8d4f),_0x2584b6=getLocationFromPath(_0x151351[_0x46b75a(0xbc)],_0x151351[_0x46b75a(0xa7)],_0x2a58a5[_0x46b75a(0x9c)][_0x46b75a(0x9a)](_0x3556a1=>typeof _0x3556a1===_0x46b75a(0xbf)?String(_0x3556a1):_0x3556a1));return{'level':_0x46b75a(0xc1),'path':_0xdb8d4f,'code':_0x2437e6,'message':_0x2a58a5[_0x46b75a(0x8e)],..._0x2584b6&&{'location':_0x2584b6}};});return{'valid':![],'errors':_0xa1aa70,'warnings':[]};}function mapZodIssueToCode(_0x32c572,_0x121660){const _0x40995e=a156_0x4e49,_0x5c6f8c=_0x32c572[_0x40995e(0x8b)]===_0x40995e(0x9e)?_0x32c572[_0x40995e(0xa3)]:undefined;if(_0x121660===_0x40995e(0x9f))return'MISSING_NAME';if(_0x121660==='rule.type'||_0x121660['endsWith'](_0x40995e(0xb7))){if(_0x32c572['code']===_0x40995e(0xbe)){if(_0x121660===_0x40995e(0xa6)||_0x121660['match'](/\.conditions\[\d+\]\.type$/))return _0x40995e(0xa8);}}if(_0x121660[_0x40995e(0xc4)]('.operator.type'))return'INVALID_OPERATOR_TYPE';if(_0x121660[_0x40995e(0xc4)](_0x40995e(0x86)))return _0x40995e(0xa2);if(_0x5c6f8c?.[_0x40995e(0x81)]===_0x40995e(0xbd))return _0x40995e(0xbd);if(_0x5c6f8c?.[_0x40995e(0x81)]===_0x40995e(0x8d))return _0x40995e(0x8d);if(_0x121660[_0x40995e(0xc4)](_0x40995e(0xc0))||_0x121660===_0x40995e(0xb8))return'MISSING_CONDITIONS';if(_0x121660[_0x40995e(0xa9)](_0x40995e(0xb6)))return _0x40995e(0x85);if(_0x121660[_0x40995e(0xc4)]('.segment'))return'MISSING_SEGMENT_REFERENCE';return _0x40995e(0xa1);}function runSemanticChecks(_0x49914b,_0x2f221b){const _0x3f7cab=a156_0x4e49,_0x2d27fc=[];_0x49914b[_0x3f7cab(0x9d)]&&_0x2d27fc[_0x3f7cab(0x87)](...checkRule(_0x49914b['rule'],_0x3f7cab(0x9d),_0x2f221b));const _0x32c632=_0x2d27fc[_0x3f7cab(0xa4)](_0x5eb9b0=>_0x5eb9b0[_0x3f7cab(0xac)]===_0x3f7cab(0xc1)),_0x330a1a=_0x2d27fc[_0x3f7cab(0xa4)](_0x3dd207=>_0x3dd207[_0x3f7cab(0xac)]===_0x3f7cab(0xaa));return{'valid':_0x32c632[_0x3f7cab(0xb3)]===0x0,'errors':_0x32c632,'warnings':_0x330a1a};}function checkRule(_0x56ffe3,_0x4487d0,_0x1ab3fd){const _0x24acd0=a156_0x4e49,_0x11633d=[];if(_0x56ffe3[_0x24acd0(0xb8)][_0x24acd0(0xb3)]===0x0)return _0x11633d[_0x24acd0(0x87)]({'level':_0x24acd0(0xc1),'path':_0x4487d0+_0x24acd0(0xc0),'code':_0x24acd0(0x92),'message':_0x24acd0(0xc5),'location':getLocationFromPath(_0x1ab3fd['document'],_0x1ab3fd['source'],pathToArray(_0x4487d0+'.conditions'))}),_0x11633d;return _0x11633d[_0x24acd0(0x87)](...checkConditions(_0x56ffe3[_0x24acd0(0xb8)],_0x4487d0,_0x1ab3fd)),_0x11633d;}function a156_0x361e(){const _0x22ce78=['Attribute\x20\x27','\x27\x20with\x20attribute\x20\x27','And','EMPTY_CONDITIONS','1646826LpVnbX','1001760NTDKrx','Behavior\x20source\x20\x27','safeParse','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','14JFkszj','18Zymjcp','map','type','path','rule','custom','name','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','SEGMENT_SCHEMA_ERROR','MISSING_OPERATOR_VALUE','params','filter','1171830lvQLIa','rule.type','source','INVALID_RULE_TYPE','includes','warning','.filter','level','BEHAVIOR_SOURCE_MISSING_FILTER','.conditions[','305517QSdDwK','attribute','NESTED_CONDITION_GROUP','skipSchema','length','42879XWHgtq','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','arrayMatching','.type','conditions','aggregation','.source','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','document','MISSING_BETWEEN_BOUNDS','invalid_value','symbol','.conditions','error','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','endsWith','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','Attribute\x20name\x20cannot\x20be\x20empty','validationCode','.attribute','2566810aowmFC','9187460fyhKCl','INVALID_ARRAY_MATCHING','.operator.value','push','issues','success','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','code','48UmVJzS','MISSING_TIME_UNIT','message'];a156_0x361e=function(){return _0x22ce78;};return a156_0x361e();}function checkConditions(_0xe3d541,_0x46bbb0,_0x2721d6){const _0x113c2e=a156_0x4e49,_0x58f71f=[];for(let _0x4df05a=0x0;_0x4df05a<_0xe3d541[_0x113c2e(0xb3)];_0x4df05a++){const _0x447f6c=_0xe3d541[_0x4df05a],_0x2f5cf5=_0x46bbb0+_0x113c2e(0xae)+_0x4df05a+']';_0x58f71f[_0x113c2e(0x87)](...checkCondition(_0x447f6c,_0x2f5cf5,_0x2721d6));}return _0x58f71f;}function checkCondition(_0x57ab69,_0x3234c6,_0x1ce08f){const _0xe16445=a156_0x4e49,_0x28a72b=[];if(_0x57ab69[_0xe16445(0x9b)]===_0xe16445(0x91)||_0x57ab69[_0xe16445(0x9b)]==='Or')return _0x57ab69[_0xe16445(0xb8)][_0xe16445(0xb3)]===0x0?_0x28a72b[_0xe16445(0x87)]({'level':_0xe16445(0xc1),'path':_0x3234c6+_0xe16445(0xc0),'code':_0xe16445(0x92),'message':_0x57ab69[_0xe16445(0x9b)]+_0xe16445(0x97),'location':getLocationFromPath(_0x1ce08f[_0xe16445(0xbc)],_0x1ce08f['source'],pathToArray(_0x3234c6+'.conditions'))}):(_0x28a72b['push']({'level':'warning','path':_0x3234c6,'code':_0xe16445(0xb1),'message':_0x57ab69['type']+_0xe16445(0xc3)+_0xe16445(0xc2)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x1ce08f['document'],_0x1ce08f[_0xe16445(0xa7)],pathToArray(_0x3234c6))}),_0x28a72b['push'](...checkConditions(_0x57ab69[_0xe16445(0xb8)],_0x3234c6,_0x1ce08f))),_0x28a72b;if(_0x57ab69[_0xe16445(0x9b)]==='Value'||_0x57ab69[_0xe16445(0x9b)]==='Behavior'){const _0x4c7c3f=_0x57ab69,_0x5dda58=_0x4c7c3f[_0xe16445(0xa7)],_0x2c9df7=_0x4c7c3f[_0xe16445(0xb9)],_0x320b5b=_0x5dda58||_0x2c9df7;(!_0x4c7c3f['attribute']||_0x4c7c3f[_0xe16445(0xb0)]==='')&&(!_0x320b5b&&_0x28a72b['push']({'level':_0xe16445(0xc1),'path':_0x3234c6+_0xe16445(0x82),'code':'EMPTY_ATTRIBUTE','message':_0xe16445(0xc6),'location':getLocationFromPath(_0x1ce08f['document'],_0x1ce08f[_0xe16445(0xa7)],pathToArray(_0x3234c6+_0xe16445(0x82)))}));_0x4c7c3f[_0xe16445(0xa4)]&&_0x28a72b[_0xe16445(0x87)](...checkRule(_0x4c7c3f['filter'],_0x3234c6+_0xe16445(0xab),_0x1ce08f));if(_0x4c7c3f[_0xe16445(0xa7)]){const _0x514287=_0x4c7c3f[_0xe16445(0xb0)]&&_0x4c7c3f[_0xe16445(0xb0)]!=='';_0x514287&&!_0x4c7c3f['filter']&&_0x28a72b[_0xe16445(0x87)]({'level':_0xe16445(0xc1),'path':_0x3234c6+_0xe16445(0xba),'code':_0xe16445(0xad),'message':_0xe16445(0x95)+_0x4c7c3f[_0xe16445(0xa7)]+_0xe16445(0x90)+_0x4c7c3f[_0xe16445(0xb0)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0xe16445(0xb5)+_0xe16445(0x8a),'location':getLocationFromPath(_0x1ce08f['document'],_0x1ce08f[_0xe16445(0xa7)],pathToArray(_0x3234c6+_0xe16445(0xba)))}),_0x514287&&_0x4c7c3f[_0xe16445(0xa4)]&&_0x28a72b['push']({'level':_0xe16445(0xaa),'path':_0x3234c6+_0xe16445(0x82),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0xe16445(0x8f)+_0x4c7c3f[_0xe16445(0xb0)]+_0xe16445(0xbb)+_0xe16445(0xa0),'location':getLocationFromPath(_0x1ce08f[_0xe16445(0xbc)],_0x1ce08f[_0xe16445(0xa7)],pathToArray(_0x3234c6+_0xe16445(0x82)))});}}return _0x28a72b;}
1
+ (function(_0x25a650,_0x396a61){const _0x130cbd=a156_0x525d,_0xe8d3d7=_0x25a650();while(!![]){try{const _0xaa8fb2=-parseInt(_0x130cbd(0x17d))/0x1*(parseInt(_0x130cbd(0x152))/0x2)+parseInt(_0x130cbd(0x170))/0x3+-parseInt(_0x130cbd(0x13e))/0x4+parseInt(_0x130cbd(0x172))/0x5+parseInt(_0x130cbd(0x16c))/0x6*(parseInt(_0x130cbd(0x150))/0x7)+parseInt(_0x130cbd(0x174))/0x8+parseInt(_0x130cbd(0x158))/0x9*(-parseInt(_0x130cbd(0x140))/0xa);if(_0xaa8fb2===_0x396a61)break;else _0xe8d3d7['push'](_0xe8d3d7['shift']());}catch(_0x5dd830){_0xe8d3d7['push'](_0xe8d3d7['shift']());}}}(a156_0x4ed3,0x8ab08));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0xae5c63,_0x5a70e8={},_0x127a69={}){const _0x46eea8=a156_0x525d;if(_0x127a69[_0x46eea8(0x14b)])return runSemanticChecks(_0xae5c63,_0x5a70e8);const _0x5695c4=SegmentDefSchema[_0x46eea8(0x149)](_0xae5c63);if(_0x5695c4[_0x46eea8(0x157)])return runSemanticChecks(_0x5695c4[_0x46eea8(0x166)],_0x5a70e8);return zodErrorsToValidationResult(_0x5695c4[_0x46eea8(0x15c)],_0x5a70e8);}function a156_0x525d(_0x7531e8,_0x3f1a99){_0x7531e8=_0x7531e8-0x13a;const _0x4ed3c8=a156_0x4ed3();let _0x525d34=_0x4ed3c8[_0x7531e8];return _0x525d34;}function a156_0x4ed3(){const _0x106701=['MISSING_NAME','360IhIDYD','attribute','description','INVALID_ARRAY_MATCHING','validationCode','success','144HlpMrk','code','invalid_value','conditions','error','path','rule','document','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','length','level','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','warning','data','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','MISSING_SEGMENT_REFERENCE','Attribute\x20name\x20cannot\x20be\x20empty','\x27\x20with\x20attribute\x20\x27','12qJaKeI','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','INVALID_OPERATOR_TYPE','Value','838299NfjTng','.attribute','3202490qCQZmB','MISSING_BETWEEN_BOUNDS','6744608GglHRa','name','rule.type','map','aggregation','type','filter','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','message','3772IGXeOu','Behavior','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','INVALID_RULE_TYPE','Attribute\x20\x27','MISSING_CONDITIONS','arrayMatching','MISSING_TIME_UNIT','SEGMENT_SCHEMA_ERROR','.conditions[','279692gWLgTv','And','827990seYPBe','endsWith','source','push','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','BEHAVIOR_SOURCE_MISSING_FILTER','NESTED_CONDITION_GROUP','EMPTY_CONDITIONS','issues','safeParse','params','skipSchema','.operator.value','.conditions','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','match','3075562ormGtX'];a156_0x4ed3=function(){return _0x106701;};return a156_0x4ed3();}export function validateRuleDef(_0xc67f6,_0x170a6c,_0x2bc0b4){const _0x47ef64=a156_0x525d;if(!_0xc67f6)return[];const _0x420375=RuleDefSchema[_0x47ef64(0x149)](_0xc67f6);if(_0x420375['success'])return checkRule(_0x420375['data'],_0x170a6c,_0x2bc0b4);const _0x2199eb=flattenZodIssues(_0x420375['error']['issues']);return _0x2199eb[_0x47ef64(0x177)](_0x2f4a9f=>{const _0xbd5ae7=_0x47ef64,_0x1475de=formatZodPath(_0x2f4a9f[_0xbd5ae7(0x15d)]),_0x841bb=_0x1475de?_0x170a6c+'.'+_0x1475de:_0x170a6c,_0x559157=mapZodIssueToCode(_0x2f4a9f,_0x1475de),_0xcfed4=getLocationFromPath(_0x2bc0b4[_0xbd5ae7(0x15f)],_0x2bc0b4[_0xbd5ae7(0x142)],pathToArray(_0x841bb));return{'level':_0xbd5ae7(0x15c),'path':_0x841bb,'code':_0x559157,'message':_0x2f4a9f[_0xbd5ae7(0x17c)],..._0xcfed4&&{'location':_0xcfed4}};});}function zodErrorsToValidationResult(_0x436af0,_0x203fa1){const _0x1f5e62=a156_0x525d,_0x131552=flattenZodIssues(_0x436af0[_0x1f5e62(0x148)]),_0x2af63a=_0x131552[_0x1f5e62(0x177)](_0x182e6f=>{const _0x47e569=_0x1f5e62,_0x15b259=formatZodPath(_0x182e6f['path']),_0x599755=mapZodIssueToCode(_0x182e6f,_0x15b259),_0x536009=getLocationFromPath(_0x203fa1[_0x47e569(0x15f)],_0x203fa1[_0x47e569(0x142)],_0x182e6f[_0x47e569(0x15d)][_0x47e569(0x177)](_0x2c51c4=>typeof _0x2c51c4==='symbol'?String(_0x2c51c4):_0x2c51c4));return{'level':_0x47e569(0x15c),'path':_0x15b259,'code':_0x599755,'message':_0x182e6f[_0x47e569(0x17c)],..._0x536009&&{'location':_0x536009}};});return{'valid':![],'errors':_0x2af63a,'warnings':[]};}function mapZodIssueToCode(_0x29c47b,_0x5cf22c){const _0x596598=a156_0x525d,_0x368575=_0x29c47b[_0x596598(0x159)]==='custom'?_0x29c47b[_0x596598(0x14a)]:undefined;if(_0x5cf22c===_0x596598(0x175))return _0x596598(0x151);if(_0x5cf22c===_0x596598(0x176)||_0x5cf22c[_0x596598(0x141)]('.type')){if(_0x29c47b[_0x596598(0x159)]===_0x596598(0x15a)){if(_0x5cf22c===_0x596598(0x176)||_0x5cf22c[_0x596598(0x14f)](/\.conditions\[\d+\]\.type$/))return _0x596598(0x180);}}if(_0x5cf22c[_0x596598(0x141)]('.operator.type'))return _0x596598(0x16e);if(_0x5cf22c[_0x596598(0x141)](_0x596598(0x14c)))return'MISSING_OPERATOR_VALUE';if(_0x368575?.['validationCode']===_0x596598(0x173))return _0x596598(0x173);if(_0x368575?.[_0x596598(0x156)]===_0x596598(0x13b))return _0x596598(0x13b);if(_0x5cf22c['endsWith'](_0x596598(0x14d))||_0x5cf22c===_0x596598(0x15b))return _0x596598(0x182);if(_0x5cf22c['includes'](_0x596598(0x13a)))return _0x596598(0x155);if(_0x5cf22c[_0x596598(0x141)]('.segment'))return _0x596598(0x169);return _0x596598(0x13c);}function runSemanticChecks(_0x305b9c,_0x211e0f){const _0x1ca710=a156_0x525d,_0x2a1124=[];_0x305b9c['rule']&&_0x2a1124[_0x1ca710(0x143)](...checkRule(_0x305b9c[_0x1ca710(0x15e)],_0x1ca710(0x15e),_0x211e0f));const _0x15fe8e=_0x2a1124[_0x1ca710(0x17a)](_0x6d8809=>_0x6d8809[_0x1ca710(0x162)]===_0x1ca710(0x15c)),_0x4aef51=_0x2a1124[_0x1ca710(0x17a)](_0x5d25c2=>_0x5d25c2['level']==='warning');return{'valid':_0x15fe8e['length']===0x0,'errors':_0x15fe8e,'warnings':_0x4aef51};}function checkRule(_0x4a0ff8,_0x201e91,_0x1a9598){const _0x4854ce=a156_0x525d,_0x479eed=[];if(_0x4a0ff8[_0x4854ce(0x15b)]['length']===0x0)return _0x479eed[_0x4854ce(0x143)]({'level':'error','path':_0x201e91+'.conditions','code':_0x4854ce(0x147),'message':_0x4854ce(0x168),'location':getLocationFromPath(_0x1a9598[_0x4854ce(0x15f)],_0x1a9598['source'],pathToArray(_0x201e91+_0x4854ce(0x14d)))}),_0x479eed;return _0x479eed[_0x4854ce(0x143)](...checkConditions(_0x4a0ff8[_0x4854ce(0x15b)],_0x201e91,_0x1a9598)),_0x479eed;}function checkConditions(_0x1f2b36,_0x5ca794,_0x1e8e8b){const _0x168e51=a156_0x525d,_0x8af913=[];for(let _0x412032=0x0;_0x412032<_0x1f2b36[_0x168e51(0x161)];_0x412032++){const _0x28b25a=_0x1f2b36[_0x412032],_0x572670=_0x5ca794+_0x168e51(0x13d)+_0x412032+']';_0x8af913[_0x168e51(0x143)](...checkCondition(_0x28b25a,_0x572670,_0x1e8e8b));}return _0x8af913;}function checkCondition(_0x384bde,_0x5bc70c,_0x162078){const _0x4f3f5d=a156_0x525d,_0x1b1831=[];if(_0x384bde[_0x4f3f5d(0x179)]===_0x4f3f5d(0x13f)||_0x384bde[_0x4f3f5d(0x179)]==='Or'){if(_0x384bde['conditions'][_0x4f3f5d(0x161)]===0x0)_0x1b1831['push']({'level':'error','path':_0x5bc70c+_0x4f3f5d(0x14d),'code':'EMPTY_CONDITIONS','message':_0x384bde[_0x4f3f5d(0x179)]+_0x4f3f5d(0x17f),'location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c+_0x4f3f5d(0x14d)))});else{const _0xb03869=_0x384bde[_0x4f3f5d(0x154)]!==undefined;!_0xb03869&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x165),'path':_0x5bc70c,'code':_0x4f3f5d(0x146),'message':_0x384bde[_0x4f3f5d(0x179)]+_0x4f3f5d(0x17b)+_0x4f3f5d(0x144)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c))}),_0x1b1831[_0x4f3f5d(0x143)](...checkConditions(_0x384bde[_0x4f3f5d(0x15b)],_0x5bc70c,_0x162078));}return _0x1b1831;}if(_0x384bde[_0x4f3f5d(0x179)]===_0x4f3f5d(0x16f)||_0x384bde[_0x4f3f5d(0x179)]===_0x4f3f5d(0x17e)){const _0x5be8e3=_0x384bde,_0x308458=_0x5be8e3[_0x4f3f5d(0x142)],_0x6b3e28=_0x5be8e3[_0x4f3f5d(0x178)],_0x506378=_0x308458||_0x6b3e28;(!_0x5be8e3[_0x4f3f5d(0x153)]||_0x5be8e3[_0x4f3f5d(0x153)]==='')&&(!_0x506378&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x15c),'path':_0x5bc70c+_0x4f3f5d(0x171),'code':'EMPTY_ATTRIBUTE','message':_0x4f3f5d(0x16a),'location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078['source'],pathToArray(_0x5bc70c+_0x4f3f5d(0x171)))}));_0x5be8e3['filter']&&_0x1b1831[_0x4f3f5d(0x143)](...checkRule(_0x5be8e3[_0x4f3f5d(0x17a)],_0x5bc70c+'.filter',_0x162078));if(_0x5be8e3[_0x4f3f5d(0x142)]){const _0x37a176=_0x5be8e3[_0x4f3f5d(0x153)]&&_0x5be8e3[_0x4f3f5d(0x153)]!=='';_0x37a176&&!_0x5be8e3['filter']&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x15c),'path':_0x5bc70c+'.source','code':_0x4f3f5d(0x145),'message':'Behavior\x20source\x20\x27'+_0x5be8e3['source']+_0x4f3f5d(0x16b)+_0x5be8e3[_0x4f3f5d(0x153)]+'\x27\x20'+_0x4f3f5d(0x167)+_0x4f3f5d(0x16d)+_0x4f3f5d(0x164),'location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c+'.source'))}),_0x37a176&&_0x5be8e3[_0x4f3f5d(0x17a)]&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x165),'path':_0x5bc70c+_0x4f3f5d(0x171),'code':_0x4f3f5d(0x163),'message':_0x4f3f5d(0x181)+_0x5be8e3[_0x4f3f5d(0x153)]+_0x4f3f5d(0x14e)+_0x4f3f5d(0x160),'location':getLocationFromPath(_0x162078['document'],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c+_0x4f3f5d(0x171)))});}}return _0x1b1831;}