@treasuredata/tdx 2026.7.2 → 2026.7.3

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 (246) 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.d.ts.map +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-command.js.map +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.d.ts.map +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-command.js.map +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/delivery-command.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-validate-command.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-template-pull-command.js +1 -1
  30. package/dist/commands/engage-template-push-command.js +1 -1
  31. package/dist/commands/engage-template-validate-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/journey-validate-command.js +1 -1
  35. package/dist/commands/llm-command.js +1 -1
  36. package/dist/commands/mcp-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-move-command.js +1 -1
  47. package/dist/commands/segment-pull-command.js +1 -1
  48. package/dist/commands/segment-push-command.js +1 -1
  49. package/dist/commands/segment-update-command.js +1 -1
  50. package/dist/commands/segment-use-command.js +1 -1
  51. package/dist/commands/segment-validate-command.js +1 -1
  52. package/dist/commands/segments.js +1 -1
  53. package/dist/commands/show.js +1 -1
  54. package/dist/commands/status-command.js +1 -1
  55. package/dist/commands/table-deleted.js +1 -1
  56. package/dist/commands/tables.js +1 -1
  57. package/dist/commands/unset-command.js +1 -1
  58. package/dist/commands/upgrade-command.js +1 -1
  59. package/dist/commands/use-command.js +1 -1
  60. package/dist/commands/user-command.js +1 -1
  61. package/dist/commands/work-command.js +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/core/auth.js +1 -1
  64. package/dist/core/command-output.js +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.d.ts +11 -2
  73. package/dist/core/oauth.d.ts.map +1 -1
  74. package/dist/core/oauth.js +1 -1
  75. package/dist/core/oauth.js.map +1 -1
  76. package/dist/core/profile.js +1 -1
  77. package/dist/core/project-config.js +1 -1
  78. package/dist/core/session.js +1 -1
  79. package/dist/core/user-cache.js +1 -1
  80. package/dist/core/version.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/mcp/server.js +1 -1
  83. package/dist/mcp/tools/index.js +1 -1
  84. package/dist/mcp/tools/tdx-run.js +1 -1
  85. package/dist/mcp/tools/tdx-search.js +1 -1
  86. package/dist/mcp/tools/work-create-item.js +1 -1
  87. package/dist/mcp/utils.js +1 -1
  88. package/dist/proxy/claude-usage-tracker.js +1 -1
  89. package/dist/proxy/passthrough-server.d.ts +16 -0
  90. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/passthrough-server.js.map +1 -1
  93. package/dist/proxy/sse-usage-parser.js +1 -1
  94. package/dist/sdk/agent/agent-config.js +1 -1
  95. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/test/evaluator.js +1 -1
  98. package/dist/sdk/agent/test/executor.js +1 -1
  99. package/dist/sdk/agent/test/index.js +1 -1
  100. package/dist/sdk/agent/test/output.js +1 -1
  101. package/dist/sdk/agent/test/parser.js +1 -1
  102. package/dist/sdk/agent/tool-target-registry.js +1 -1
  103. package/dist/sdk/api.js +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  106. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  107. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  108. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  109. package/dist/sdk/cas/index.js +1 -1
  110. package/dist/sdk/cas/pull-workflow.js +1 -1
  111. package/dist/sdk/cas/push-workflow.js +1 -1
  112. package/dist/sdk/cas/validate-files.js +1 -1
  113. package/dist/sdk/client/cdp-api-client.js +1 -1
  114. package/dist/sdk/client/delivery-api-client.js +1 -1
  115. package/dist/sdk/client/endpoints.js +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.js +1 -1
  119. package/dist/sdk/client/oauth-refresh.d.ts +5 -1
  120. package/dist/sdk/client/oauth-refresh.d.ts.map +1 -1
  121. package/dist/sdk/client/oauth-refresh.js +1 -1
  122. package/dist/sdk/client/oauth-refresh.js.map +1 -1
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.js +1 -1
  127. package/dist/sdk/connection-validator.js +1 -1
  128. package/dist/sdk/connection.js +1 -1
  129. package/dist/sdk/delivery.js +1 -1
  130. package/dist/sdk/engage/campaign-pull.js +1 -1
  131. package/dist/sdk/engage/campaign-push.js +1 -1
  132. package/dist/sdk/engage/campaign-validator.js +1 -1
  133. package/dist/sdk/engage/campaign-yaml.js +1 -1
  134. package/dist/sdk/engage/template-pull.js +1 -1
  135. package/dist/sdk/engage/template-push.js +1 -1
  136. package/dist/sdk/engage/template-validator.js +1 -1
  137. package/dist/sdk/engage/template-yaml.js +1 -1
  138. package/dist/sdk/engage/types/campaign-def.js +1 -1
  139. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  140. package/dist/sdk/engage/types/template-schema.js +1 -1
  141. package/dist/sdk/engage.js +1 -1
  142. package/dist/sdk/errors.js +1 -1
  143. package/dist/sdk/index.js +1 -1
  144. package/dist/sdk/io/index.js +1 -1
  145. package/dist/sdk/io/node-filesystem.js +1 -1
  146. package/dist/sdk/job.js +1 -1
  147. package/dist/sdk/journey.js +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/index.js +1 -1
  150. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  151. package/dist/sdk/llm/model-factors.js +1 -1
  152. package/dist/sdk/llm/user-settings.js +1 -1
  153. package/dist/sdk/personalization.js +1 -1
  154. package/dist/sdk/policy.js +1 -1
  155. package/dist/sdk/query/deleted-table-validation.js +1 -1
  156. package/dist/sdk/query/index.js +1 -1
  157. package/dist/sdk/query/sql-parser.js +1 -1
  158. package/dist/sdk/realtime.js +1 -1
  159. package/dist/sdk/schedule.js +1 -1
  160. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/fields-display.js +1 -1
  162. package/dist/sdk/segment/file-discovery.js +1 -1
  163. package/dist/sdk/segment/journey-utils.js +1 -1
  164. package/dist/sdk/segment/journey-validator.js +1 -1
  165. package/dist/sdk/segment/journey-yaml.js +1 -1
  166. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  167. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  168. package/dist/sdk/segment/pull-workflow.js +1 -1
  169. package/dist/sdk/segment/push-recovery.js +1 -1
  170. package/dist/sdk/segment/push-workflow.js +1 -1
  171. package/dist/sdk/segment/resolution-context.js +1 -1
  172. package/dist/sdk/segment/segment-path-parser.js +1 -1
  173. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  174. package/dist/sdk/segment/segment-validator.js +1 -1
  175. package/dist/sdk/segment/target-resolution.js +1 -1
  176. package/dist/sdk/segment/tdx-config.js +1 -1
  177. package/dist/sdk/segment/types/activation-schema.js +1 -1
  178. package/dist/sdk/segment/types/journey-def.js +1 -1
  179. package/dist/sdk/segment/types/journey-schema.js +1 -1
  180. package/dist/sdk/segment/types/segment-def.js +1 -1
  181. package/dist/sdk/segment/types/segment-schema.js +1 -1
  182. package/dist/sdk/segment/validate-files.js +1 -1
  183. package/dist/sdk/segment/yaml-validator.js +1 -1
  184. package/dist/sdk/segment.js +1 -1
  185. package/dist/sdk/types/index.js +1 -1
  186. package/dist/sdk/types/progress.js +1 -1
  187. package/dist/sdk/types/workspace.js +1 -1
  188. package/dist/sdk/user.js +1 -1
  189. package/dist/sdk/util/format-detector.js +1 -1
  190. package/dist/sdk/util/formatters.js +1 -1
  191. package/dist/sdk/util/index.js +1 -1
  192. package/dist/sdk/util/paginate.js +1 -1
  193. package/dist/sdk/util/tree-formatter.js +1 -1
  194. package/dist/sdk/util/tree-search.js +1 -1
  195. package/dist/sdk/workflow/archive-validation.js +1 -1
  196. package/dist/sdk/workflow/clone-workflow.js +1 -1
  197. package/dist/sdk/workflow/index.js +1 -1
  198. package/dist/sdk/workflow/pull-workflow.js +1 -1
  199. package/dist/sdk/workflow/push-workflow.js +1 -1
  200. package/dist/sdk/workflow/task-graph.js +1 -1
  201. package/dist/sdk/workflow/tdx-config.js +1 -1
  202. package/dist/sdk/workflow/workflow-utils.js +1 -1
  203. package/dist/sdk/workspace/access-tracker.js +1 -1
  204. package/dist/sdk/workspace/frontmatter.js +1 -1
  205. package/dist/sdk/workspace/git.js +1 -1
  206. package/dist/sdk/workspace/index.js +1 -1
  207. package/dist/sdk/workspace/templates.js +1 -1
  208. package/dist/sdk/workspace/weekly.js +1 -1
  209. package/dist/sdk/workspace/wikilinks.js +1 -1
  210. package/dist/test-utils/command-runner.js +1 -1
  211. package/dist/test-utils/factories.js +1 -1
  212. package/dist/test-utils/fixtures.js +1 -1
  213. package/dist/test-utils/http-mock.js +1 -1
  214. package/dist/test-utils/index.js +1 -1
  215. package/dist/utils/async.js +1 -1
  216. package/dist/utils/colors.js +1 -1
  217. package/dist/utils/diff.js +1 -1
  218. package/dist/utils/file-permissions.js +1 -1
  219. package/dist/utils/file-reader.js +1 -1
  220. package/dist/utils/github-releases.js +1 -1
  221. package/dist/utils/global-cache.js +1 -1
  222. package/dist/utils/json-loader.js +1 -1
  223. package/dist/utils/local-cache.js +1 -1
  224. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  225. package/dist/utils/logger/formatters/index.js +1 -1
  226. package/dist/utils/logger/handlers/console-handler.js +1 -1
  227. package/dist/utils/logger/handlers/file-handler.js +1 -1
  228. package/dist/utils/logger/handlers/index.js +1 -1
  229. package/dist/utils/logger/handlers/null-handler.js +1 -1
  230. package/dist/utils/logger/index.js +1 -1
  231. package/dist/utils/logger/logger.js +1 -1
  232. package/dist/utils/logger/types.js +1 -1
  233. package/dist/utils/option-validation.js +1 -1
  234. package/dist/utils/process.js +1 -1
  235. package/dist/utils/prompt.js +1 -1
  236. package/dist/utils/proxy-fetch.d.ts +29 -0
  237. package/dist/utils/proxy-fetch.d.ts.map +1 -0
  238. package/dist/utils/proxy-fetch.js +1 -0
  239. package/dist/utils/proxy-fetch.js.map +1 -0
  240. package/dist/utils/spinner.js +1 -1
  241. package/dist/utils/sse-parser.js +1 -1
  242. package/dist/utils/string-utils.js +1 -1
  243. package/dist/utils/table-ref-parser.js +1 -1
  244. package/dist/utils/tdx-logger.js +1 -1
  245. package/dist/utils/version-check.js +1 -1
  246. package/package.json +1 -1
@@ -1 +1 @@
1
- const a159_0x407fa0=a159_0x3097;(function(_0x5a5252,_0x26fc35){const _0x89ef54=a159_0x3097,_0x208ecb=_0x5a5252();while(!![]){try{const _0x2881e7=-parseInt(_0x89ef54(0x1b0))/0x1*(parseInt(_0x89ef54(0x19e))/0x2)+parseInt(_0x89ef54(0x19a))/0x3*(-parseInt(_0x89ef54(0x17a))/0x4)+-parseInt(_0x89ef54(0x1e4))/0x5*(parseInt(_0x89ef54(0x225))/0x6)+parseInt(_0x89ef54(0x1c2))/0x7+-parseInt(_0x89ef54(0x1ab))/0x8+-parseInt(_0x89ef54(0x1e0))/0x9+parseInt(_0x89ef54(0x1e9))/0xa*(parseInt(_0x89ef54(0x1c8))/0xb);if(_0x2881e7===_0x26fc35)break;else _0x208ecb['push'](_0x208ecb['shift']());}catch(_0x406fad){_0x208ecb['push'](_0x208ecb['shift']());}}}(a159_0x403a,0x3429c));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a159_0x407fa0(0x1c4));export const PENDING_SEGMENT_PREFIX=a159_0x407fa0(0x257);export const PENDING_ACTIVATION_PREFIX=a159_0x407fa0(0x1a0);export function createPendingSegmentId(_0x5eb0fe){return''+PENDING_SEGMENT_PREFIX+_0x5eb0fe+'__';}export function isPendingSegmentId(_0x4fbd13){const _0x273389=a159_0x407fa0;return _0x4fbd13[_0x273389(0x25e)](PENDING_SEGMENT_PREFIX)&&!_0x4fbd13[_0x273389(0x25e)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x431e07){const _0x5a5433=a159_0x407fa0;return _0x431e07[_0x5a5433(0x1b8)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5da64c){return''+PENDING_ACTIVATION_PREFIX+_0x5da64c+'__';}export function isPendingActivationId(_0x47eaac){const _0x573be1=a159_0x407fa0;return _0x47eaac[_0x573be1(0x25e)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1ec936){return _0x1ec936['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x33db9c,_0x24995f){const _0x108226=a159_0x407fa0,_0x3c36a5=_0x33db9c+'::'+(_0x24995f['trim']()||_0x108226(0x179)),_0xd3a2c9=createHash(_0x108226(0x1e8))[_0x108226(0x24c)](_0x3c36a5)[_0x108226(0x205)](_0x108226(0x16a))[_0x108226(0x198)](0x0,0xc);return _0x108226(0x220)+_0xd3a2c9;}export function ensureJourneyDefaults(_0x93118e){const _0x1b6429=a159_0x407fa0;!_0x93118e[_0x1b6429(0x197)]&&(_0x93118e[_0x1b6429(0x197)]=''),!_0x93118e[_0x1b6429(0x190)]&&(_0x93118e[_0x1b6429(0x190)]=_0x1b6429(0x1e7));}export function injectExistingStageIds(_0x224dc0,_0x2a1f98){const _0x429a94=a159_0x407fa0,_0x55d34c=new Map(_0x2a1f98['map'](_0x1560b6=>[_0x1560b6[_0x429a94(0x1c9)],_0x1560b6['id']]));for(const _0x363bdc of _0x224dc0){if(!_0x363bdc['id']){const _0x36d8cd=_0x55d34c[_0x429a94(0x1c7)](_0x363bdc[_0x429a94(0x1c9)]);_0x36d8cd&&(_0x363bdc['id']=_0x36d8cd);}}}export function resolveTDFolderPath(_0x4f846e,_0xab6c09,_0x36cada){const _0x286709=a159_0x407fa0;if(!_0xab6c09)return _0x4f846e;if(_0x4f846e===_0x36cada||_0x4f846e[_0x286709(0x25e)](_0x36cada+'/'))return _0x4f846e;return _0x4f846e?_0x36cada+'/'+_0x4f846e:_0x36cada;}export function addFoldersToCreate(_0x47a06f,_0x1d2e59,_0x2ad464){const _0xb613fb=a159_0x407fa0;if(!_0x47a06f)return;if(_0x1d2e59['has'](_0x47a06f))return;const _0x495f92=_0x47a06f[_0xb613fb(0x1f0)]('/');let _0x25df1c='';for(const _0x24ded5 of _0x495f92){_0x25df1c=_0x25df1c?_0x25df1c+'/'+_0x24ded5:_0x24ded5,!_0x1d2e59[_0xb613fb(0x18f)](_0x25df1c)&&_0x2ad464[_0xb613fb(0x181)](_0x25df1c);}}export function sortFoldersByDepth(_0x322641){const _0xa215d5=a159_0x407fa0;return[..._0x322641][_0xa215d5(0x264)]((_0x338ab4,_0x10d39e)=>{const _0x1970f1=_0xa215d5,_0x36ae42=(_0x338ab4['match'](/\//g)||[])[_0x1970f1(0x234)],_0x3f8a9b=(_0x10d39e['match'](/\//g)||[])[_0x1970f1(0x234)];return _0x36ae42-_0x3f8a9b;});}import*as a159_0x58614f from'yaml';import{readFileSync}from'fs';import a159_0x2127b0 from'path';import{isJourneyDef,parseYamlString as a159_0x3076f3,toYamlString as a159_0x336fa9,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';function a159_0x403a(){const _0x3f732c=['Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','existingActivation','sort','toString','ACTIVATION_SYNTAX_ERROR','segmentByFolderAndName','conditions','message','Segment\x20not\x20found','join','hex','INTERNAL','idToEmailMap','Fetching\x20','getSegmentEntity\x20also\x20failed\x20for\x20','journeyBundleId','journey_creating','uniqueServerName','existingSegments','\x27\x20to\x20local\x20\x27','listActivations','withProgress','results','SEGMENT_UPDATE_ERROR','milestone','segment','4sivSaq','delete','yamlConfig','\x27\x20from\x20file:\x20','find','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','parentId','add','waitStep','folderPath','\x0a\x20\x20','createSegment','\x27\x20entry\x20criteria','segmentNameToId','createdSegmentIds','.$1.push-recovery.json','journeyId','toLowerCase','Updated\x20journey\x20\x27','NOT_FOUND','activation_updating','has','state','\x20journey\x20from\x20file:\x20','set','values','run_after_journey_refresh','flatMap','max','description','slice','decision_point','643269CBlzeg','onProgress','DecisionPoint','goal\x20criteria','69994AraZac','all_columns','__pending_act_','fetchJourney','user','Activation','embeddedSegmentNameToId','embedded_segment_creating','Segment\x20not\x20found:\x20','Updating\x20segment\x20\x27','Updating\x20activation\x20\x27','activation_created','updateSegmentById','801808RdqoPL','activationActions','segment_updated','push','journeyById','6qfNMPS','effectiveFolderId','getSegment\x20failed\x20for\x20','folderId','unchanged','\x20activation\x20\x27','Failed\x20to\x20','Journey\x20\x27','replace','existingJourney','journeyBundlesByFolderAndName','\x27\x20wait\x20condition','diff','createActivation','journeyName','getSegment','parentFolder','conditionTimeoutDuration','944237qFuTzo','activation_creating','tdx.sdk.push-workflow','Failed\x20to\x20resolve\x20activation\x20','debug','get','11mbiCfk','name','folder_created','Name\x20has\x20already\x20been\x20taken','rootFolderId','keys','filter','map','data','rule','Matched\x20server\x20segment\x20\x27','activationsBySegmentId','segmentId','\x20(referenced\x20in\x20journey\x20','segments','Failed\x20to\x20resolve\x20segment\x20','index','Created\x20activation\x20\x27','versionNumber','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Created\x20journey\x20\x27','verbose','activation_','getJourney','1845KovhgA','segment_created','Duration','segment_updating','5cILVKL','updated','action','draft','sha1','8904570VDeYmG','buildUserMaps','journey_updating','./journey-yaml.js','embedded_activation_created','entryCriteria','validatedRequest','split','localName','\x27\x20by\x20rule\x20content','activationContext','journeyActivationStepId','conditionTimeoutUnit','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','journey_updated','\x27...',').\x20','activation_template_id','JOURNEY_SYNTAX_ERROR','connector_config','entry_criteria','nameToId','stringify','activation_deleting','\x27\x20exit\x20criteria','conditionSegmentId','Embedded\x20segment\x20\x27','with','digest','errors','deps','uniqueSegmentName','\x20segment\x20from\x20file:\x20','Entry\x20criteria:\x20','createJourneySegment','activationStepsById','created','utf-8','segment_deleted','dirname','all','includes','resolvedRule','branches','folder','waitStepType','steps','parentSegmentFolder','isNew','Deleting\x20activation\x20\x27','create','stages','journeyBundleName','absolutePath','yamlActivation','journey_entry_criteria_','relationships','activationParams','logSuccess','../../utils/async.js','1721112zYUJmU','progress','stage\x20\x27','Failed\x20to\x20fetch\x20referenced\x20segment\x20','createFolder','Created\x20segment\x20\x27','folder_creating','activations','deleteActivation','exitCriterias','\x27\x20decision\x20point\x20branch\x20\x27','waitStepUnit','entries','relative','Delete\x20the\x20push\x20recovery\x20file\x20(','length','notification','nameToType','SEGMENT_NOT_FOUND','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','createdSegmentId','journey_created','logWarning','hasChanges','journeyStages','segmentFolderId','./child-segment-yaml.js','list','folderPathToId','attributes','journeys','behavior','columns','goal','resolveSegment','segment_deleting','journey','and\x20the\x20server\x20segment,\x20then\x20retry.','object','update','connectionIdToNameMap','Updated\x20segment\x20\x27','from','schedule','day','type','getLatestJourneyId','parse','size','\x27\x20milestone','__pending_','getActivation','WaitStep','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','toISOString','reduce','Creating\x20activation\x20\x27','startsWith','Condition','Deleted\x20segment\x20\x27','existingSegment'];a159_0x403a=function(){return _0x3f732c;};return a159_0x403a();}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(_0x2c8f82){const _0x2314ad=a159_0x407fa0;if(Array['isArray'](_0x2c8f82))return'['+_0x2c8f82[_0x2314ad(0x1cf)](_0x481ba4=>stableStringify(_0x481ba4))[_0x2314ad(0x169)](',')+']';if(_0x2c8f82&&typeof _0x2c8f82===_0x2314ad(0x24b)){const _0x4b6d18=_0x2c8f82,_0x21bd69=Object[_0x2314ad(0x1cd)](_0x4b6d18)[_0x2314ad(0x264)](),_0x5d9944=_0x21bd69[_0x2314ad(0x1cf)](_0x1ffe56=>'\x22'+_0x1ffe56+'\x22:'+stableStringify(_0x4b6d18[_0x1ffe56]));return'{'+_0x5d9944[_0x2314ad(0x169)](',')+'}';}const _0x51a039=JSON['stringify'](_0x2c8f82);return _0x51a039===undefined?'null':_0x51a039;}function activationSignature(_0x1353ad){const _0x1d31e3=a159_0x407fa0,_0x3d11d7={'connection':_0x1353ad['connection'],..._0x1353ad[_0x1d31e3(0x19f)]!==undefined&&{'all_columns':_0x1353ad[_0x1d31e3(0x19f)]},..._0x1353ad['columns']!==undefined&&{'columns':_0x1353ad[_0x1d31e3(0x245)]},..._0x1353ad[_0x1d31e3(0x244)]!==undefined&&{'behavior':_0x1353ad[_0x1d31e3(0x244)]},..._0x1353ad[_0x1d31e3(0x250)]!==undefined&&{'schedule':_0x1353ad[_0x1d31e3(0x250)]},..._0x1353ad[_0x1d31e3(0x235)]!==undefined&&{'notification':_0x1353ad[_0x1d31e3(0x235)]},..._0x1353ad[_0x1d31e3(0x1fc)]!==undefined&&{'connector_config':_0x1353ad['connector_config']},..._0x1353ad[_0x1d31e3(0x1fa)]!==undefined&&{'activation_template_id':_0x1353ad[_0x1d31e3(0x1fa)]}};return stableStringify(_0x3d11d7);}async function fetchSegment(_0x1aa172,_0x37b6af,_0x4468a0,_0x313c9a){const _0x471180=a159_0x407fa0,_0x19d477=_0x313c9a?.[_0x471180(0x17e)](_0x242296=>_0x242296['id']===_0x4468a0);if(_0x19d477)return _0x19d477;try{return await _0x1aa172[_0x471180(0x179)][_0x471180(0x1bf)](_0x37b6af,_0x4468a0);}catch(_0x3bd233){logger[_0x471180(0x1c6)](_0x471180(0x1b2)+_0x4468a0+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x3bd233);try{return await _0x1aa172[_0x471180(0x179)]['getSegmentEntity'](_0x4468a0);}catch(_0x5eae14){return logger['debug'](_0x471180(0x16e)+_0x4468a0+':\x20'+_0x5eae14),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2a8793,_0xc71434,_0x5315af){const _0x4f59a3=a159_0x407fa0,_0x2c40a6=readPushRecovery(_0x2a8793['absolutePath']);if(_0x2c40a6?.[_0x4f59a3(0x1be)]===_0x2a8793[_0x4f59a3(0x17c)][_0x4f59a3(0x1c9)])for(const [_0xd6ecbf,_0x2acc08]of Object[_0x4f59a3(0x231)](_0x2c40a6[_0x4f59a3(0x1d6)])){const _0x3ce766=generateDeterministicJourneySegmentName(_0x2a8793['yamlConfig']['name'],_0xd6ecbf);_0x2acc08[_0x4f59a3(0x171)]===_0x3ce766&&(_0xc71434[_0x4f59a3(0x192)](_0xd6ecbf,_0x2acc08[_0x4f59a3(0x1d4)]),_0x5315af[_0x4f59a3(0x192)](_0xd6ecbf,_0x2acc08[_0x4f59a3(0x1d4)]));}}async function createOrRecoverEmbeddedSegment(_0x2ab79a,_0x4fda24,_0x1cd87f,_0x381dd0){const _0x2adf4d=a159_0x407fa0;let _0x2b587c;try{_0x2b587c=await _0x2ab79a['segment'][_0x2adf4d(0x20b)]({'name':_0x1cd87f[_0x2adf4d(0x208)],'description':_0x1cd87f[_0x2adf4d(0x197)],'journeyId':_0x1cd87f[_0x2adf4d(0x18a)],'rule':_0x381dd0(_0x1cd87f[_0x2adf4d(0x213)],!![]),'countPopulation':!![],'parentFolderId':_0x1cd87f[_0x2adf4d(0x1b3)],'audienceId':_0x1cd87f[_0x2adf4d(0x180)]});}catch(_0xbe2a71){const _0x28154c=_0xbe2a71 instanceof Error&&_0xbe2a71[_0x2adf4d(0x269)][_0x2adf4d(0x212)](_0x2adf4d(0x1cb));if(_0x28154c){const _0x13835a=readPushRecovery(_0x4fda24['absolutePath']),_0x78930b=_0x13835a?.[_0x2adf4d(0x1be)]===_0x4fda24[_0x2adf4d(0x17c)]['name']?_0x13835a[_0x2adf4d(0x1d6)][_0x1cd87f[_0x2adf4d(0x1f1)]]:undefined;if(_0x78930b?.['uniqueServerName']===_0x1cd87f[_0x2adf4d(0x208)])await _0x2ab79a['segment'][_0x2adf4d(0x1aa)](_0x1cd87f[_0x2adf4d(0x180)],_0x78930b[_0x2adf4d(0x1d4)],{'description':_0x1cd87f[_0x2adf4d(0x197)],'rule':_0x381dd0(_0x1cd87f[_0x2adf4d(0x213)],!![]),'countPopulation':!![]}),_0x2b587c=_0x78930b['segmentId'];else throw new SDKError(ErrorCode[_0x2adf4d(0x177)],_0x2adf4d(0x203)+_0x1cd87f['localName']+_0x2adf4d(0x25a)+(_0x2adf4d(0x233)+_0x4fda24[_0x2adf4d(0x21e)]['replace'](/([^/]+)$/,_0x2adf4d(0x189))+')\x20')+_0x2adf4d(0x24a),_0xbe2a71);}else throw _0xbe2a71;}return saveSegmentToPushRecovery(_0x4fda24[_0x2adf4d(0x21e)],_0x4fda24[_0x2adf4d(0x17c)][_0x2adf4d(0x1c9)],_0x1cd87f['localName'],{'segmentId':_0x2b587c,'uniqueServerName':_0x1cd87f[_0x2adf4d(0x208)],'createdAt':new Date()[_0x2adf4d(0x25b)]()}),_0x2b587c;}export async function prepareSegmentFiles(_0x2665e1,_0x42eafd,_0x28ba81,_0x22ecc7,_0x31325c){const _0x4f0345=a159_0x407fa0,{activationDefToCreateRequest:_0xc493f7}=await import(_0x4f0345(0x23f)),_0x33fcea=[],_0x3f9006=new Set();for(const {yamlConfig:_0x5b918d,folderPath:_0x3a49dc,sourcePath:_0x53eb6c}of _0x2665e1){const _0x1b184c=resolveTDFolderPath(_0x3a49dc,_0x22ecc7,_0x31325c),_0x4034b6=_0x1b184c+':'+_0x5b918d['name'],_0x5d82bb=_0x42eafd[_0x4f0345(0x267)][_0x4f0345(0x1c7)](_0x4034b6),_0x45360b=_0x5d82bb?_0x42eafd[_0x4f0345(0x1d3)][_0x4f0345(0x1c7)](_0x5d82bb['id'])||[]:[];addFoldersToCreate(_0x1b184c,_0x42eafd[_0x4f0345(0x241)],_0x3f9006);const _0x14e2b6=calculateActivationActions(_0x5b918d[_0x4f0345(0x22c)]||[],_0x45360b,_0x42eafd[_0x4f0345(0x16c)],_0x42eafd[_0x4f0345(0x24d)]);for(const _0x143059 of _0x14e2b6){(_0x143059[_0x4f0345(0x252)]===_0x4f0345(0x21b)||_0x143059[_0x4f0345(0x252)]===_0x4f0345(0x24c))&&_0x143059[_0x4f0345(0x21f)]&&(_0x143059[_0x4f0345(0x1ef)]=await _0xc493f7(_0x143059['yamlActivation'],_0x28ba81));}const _0x335919=calculateSegmentDiff(_0x5b918d,_0x5d82bb,_0x45360b,_0x42eafd['idToEmailMap'],_0x42eafd[_0x4f0345(0x24d)]);_0x33fcea[_0x4f0345(0x1ae)]({'relativePath':_0x5b918d['name'],'absolutePath':_0x53eb6c,'yamlConfig':_0x5b918d,'folderPath':_0x1b184c,'existingSegment':_0x5d82bb,'existingActivations':_0x45360b,'isNew':_0x335919['isNew'],'hasChanges':_0x335919[_0x4f0345(0x23c)],'diff':_0x335919[_0x4f0345(0x1bc)],'activationActions':_0x14e2b6});}return{'segmentFiles':_0x33fcea,'foldersToCreate':_0x3f9006};}export async function prepareJourneyFiles(_0x4009f1,_0x38e7f7,_0xde4bc8,_0x5d6b09){const _0x43ca62=a159_0x407fa0,_0x6b2ffc=[],_0x5d929a=new Set();for(const {yamlConfig:_0x134e75,folderPath:_0x298268,sourcePath:_0x11da83}of _0x4009f1){const _0x3914b2=resolveTDFolderPath(_0x298268,_0xde4bc8,_0x5d6b09),_0x3135cc=_0x3914b2+':'+_0x134e75[_0x43ca62(0x1c9)],_0x473c50=_0x38e7f7[_0x43ca62(0x1ba)][_0x43ca62(0x1c7)](_0x3135cc);let _0x20c74e,_0x54955e;if(_0x473c50&&_0x473c50[_0x43ca62(0x234)]>0x0){const _0x3f831c=buildLocalExpandedRuleMappings(_0x134e75),{createYamlContext:_0x50c79f,prefetchJourneySegments:_0x255cf6}=createPushYamlContextForBundle(_0x38e7f7[_0x43ca62(0x207)],_0x38e7f7[_0x43ca62(0x180)],_0x38e7f7[_0x43ca62(0x172)],_0x3f831c,_0x38e7f7[_0x43ca62(0x16c)],_0x38e7f7['connectionIdToNameMap'],_0x38e7f7[_0x43ca62(0x20c)],_0x38e7f7[_0x43ca62(0x1af)]);await _0x255cf6(_0x473c50[_0x43ca62(0x1cf)](_0x4d1352=>_0x4d1352['id']));const _0x252f3a=await _0x38e7f7[_0x43ca62(0x207)][_0x43ca62(0x249)][_0x43ca62(0x253)](_0x473c50[0x0][_0x43ca62(0x16f)]),_0x59165f=hasMultipleVersions(_0x134e75),_0x4f521c=async _0x3c5904=>{const _0x3d244e=_0x43ca62,_0x5aed56=_0x38e7f7[_0x3d244e(0x1af)]?.[_0x3d244e(0x1c7)](_0x3c5904);if(_0x5aed56)return _0x5aed56;return _0x38e7f7[_0x3d244e(0x1a1)]({'journeyId':_0x3c5904,'journeyName':_0x134e75['name'],'isMultiVersion':_0x473c50['length']>0x1});};if(_0x59165f&&_0x473c50['length']>0x1){const _0x5b2030=[];for(const _0x814ebb of _0x473c50){const _0x5f4e70=_0x814ebb[_0x43ca62(0x1da)]||0x1;_0x38e7f7['progress']?.[_0x43ca62(0x24c)](_0x43ca62(0x16d)+_0x134e75[_0x43ca62(0x1c9)]+'\x20v'+_0x5f4e70);const _0x69f7bb=await _0x4f521c(_0x814ebb['id']),_0x1f04be=_0x50c79f(_0x814ebb['id']),_0x38c921=await journeyResponseToDef(_0x69f7bb,_0x1f04be);_0x5b2030[_0x43ca62(0x1ae)]({'item':_0x814ebb,'yaml':_0x38c921});}const _0x5aa8e7=buildLocalRuleToNameMappingFromJourney(_0x134e75);_0x54955e=buildMergedJourneyDef(_0x5b2030,_0x5aa8e7,_0x252f3a);const _0x2aafec=Math['max'](..._0x5b2030[_0x43ca62(0x1cf)](_0x528600=>_0x528600['item'][_0x43ca62(0x1da)]||0x0)),_0xb1c66a=_0x473c50[_0x43ca62(0x17e)](_0x1bcee0=>(_0x1bcee0['versionNumber']||0x0)===_0x2aafec);_0xb1c66a&&(_0x38e7f7[_0x43ca62(0x226)]?.[_0x43ca62(0x24c)]('Fetching\x20'+_0x134e75['name']+'\x20v'+_0x2aafec),_0x20c74e=await _0x4f521c(_0xb1c66a['id']));}else{const _0x4c83fc=_0x473c50[_0x473c50[_0x43ca62(0x234)]-0x1];_0x38e7f7[_0x43ca62(0x226)]?.['update'](_0x43ca62(0x16d)+_0x134e75[_0x43ca62(0x1c9)]),_0x20c74e=await _0x4f521c(_0x4c83fc['id']);const _0x153266=_0x50c79f(_0x4c83fc['id']),_0x1d134a=await journeyResponseToDef(_0x20c74e,_0x153266),_0x878621=buildLocalRuleToNameMappingFromJourney(_0x134e75);_0x54955e=buildMergedJourneyDef([{'item':_0x4c83fc,'yaml':_0x1d134a}],_0x878621,_0x252f3a);}}addFoldersToCreate(_0x3914b2,_0x38e7f7[_0x43ca62(0x241)],_0x5d929a);const _0x3f1f5e=calculateJourneyDiff(_0x134e75,_0x54955e);_0x6b2ffc[_0x43ca62(0x1ae)]({'relativePath':_0x134e75[_0x43ca62(0x1c9)],'absolutePath':_0x11da83,'yamlConfig':_0x134e75,'folderPath':_0x3914b2,'existingJourney':_0x20c74e,'isNew':_0x3f1f5e[_0x43ca62(0x219)],'hasChanges':_0x3f1f5e['hasChanges'],'diff':_0x3f1f5e[_0x43ca62(0x1bc)]});}return{'journeyFiles':_0x6b2ffc,'foldersToCreate':_0x5d929a};}export function calculateActivationActions(_0x1ba293,_0x13c956,_0x5cebc8,_0x31d7ad){const _0x3d4dde=a159_0x407fa0,_0x1bdfa4=[],_0x2c4359=new Map();for(const _0x570942 of _0x13c956){_0x2c4359[_0x3d4dde(0x192)](_0x570942[_0x3d4dde(0x1c9)],_0x570942);}const _0x51de2d=new Map();for(const _0x3d0d13 of _0x1ba293){_0x51de2d['set'](_0x3d0d13['name'],_0x3d0d13);}for(const _0x439c7c of _0x1ba293){const _0x5bdd7a=_0x2c4359['get'](_0x439c7c[_0x3d4dde(0x1c9)]);if(!_0x5bdd7a)_0x1bdfa4[_0x3d4dde(0x1ae)]({'type':_0x3d4dde(0x21b),'name':_0x439c7c[_0x3d4dde(0x1c9)],'yamlActivation':_0x439c7c});else{const _0x20a749=activationResponseToDef(_0x5bdd7a,_0x5cebc8,_0x31d7ad),_0x431092=a159_0x58614f['stringify'](_0x20a749),_0x209990=a159_0x58614f[_0x3d4dde(0x1ff)](_0x439c7c);_0x431092!==_0x209990&&_0x1bdfa4['push']({'type':'update','name':_0x439c7c[_0x3d4dde(0x1c9)],'yamlActivation':_0x439c7c,'existingActivation':_0x5bdd7a});}}for(const _0x2b42d2 of _0x13c956){!_0x51de2d[_0x3d4dde(0x18f)](_0x2b42d2[_0x3d4dde(0x1c9)])&&_0x1bdfa4[_0x3d4dde(0x1ae)]({'type':_0x3d4dde(0x17b),'name':_0x2b42d2[_0x3d4dde(0x1c9)],'existingActivation':_0x2b42d2});}return _0x1bdfa4;}function calculateYamlDiff(_0x19a32a,_0x48bb0e){if(_0x48bb0e){const _0x22934a=generateDiff(_0x48bb0e,_0x19a32a),_0x238e1c=hasChanges(_0x22934a);return{'isNew':![],'hasChanges':_0x238e1c,'diff':_0x238e1c?formatDiffWithColors(_0x22934a):undefined};}const _0x5b9f68=generateDiff('',_0x19a32a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x5b9f68)};}export function calculateSegmentDiff(_0x33f7a8,_0x576e10,_0x208176,_0xe68d60,_0x37f77a){const _0x3cebce=segmentToYamlString(_0x33f7a8),_0x21d5eb=_0x576e10?segmentToYamlString(segmentWithActivationsToYaml(_0x576e10,_0x208176,undefined,_0xe68d60,_0x37f77a)):undefined;return calculateYamlDiff(_0x3cebce,_0x21d5eb);}export function calculateJourneyDiff(_0x55766b,_0x5a6d88){const _0x33a2d2=normalizeJourneyDef(_0x55766b,_0x55766b),_0x3933a5=a159_0x336fa9(_0x33a2d2),_0x54627f=_0x5a6d88?a159_0x336fa9(normalizeJourneyDef(_0x5a6d88,_0x55766b)):undefined;return calculateYamlDiff(_0x3933a5,_0x54627f);}export function findSegmentsToDelete(_0x12f426,_0x2b211b,_0x236b14,_0x1162fc,_0x3c1e5b){const _0x4833e6=a159_0x407fa0,_0x1cbe49=new Set();for(const {yamlConfig:_0x139a6f,folderPath:_0x40c65b}of _0x2b211b){_0x1cbe49['add'](_0x40c65b+':'+_0x139a6f[_0x4833e6(0x1c9)]);}return _0x12f426[_0x4833e6(0x1ce)](_0x691cbb=>{const _0x152b70=_0x4833e6,_0x29e1ea=_0x691cbb[_0x152b70(0x23e)]?_0x236b14['get'](_0x691cbb[_0x152b70(0x23e)][_0x152b70(0x265)]())||'':'',_0x3a843f=_0x29e1ea+':'+_0x691cbb[_0x152b70(0x1c9)];if(_0x1cbe49[_0x152b70(0x18f)](_0x3a843f))return![];if(_0x3c1e5b)return _0x29e1ea===_0x1162fc||_0x29e1ea['startsWith'](_0x1162fc+'/');return!![];});}export function findJourneysToDelete(_0x32f258,_0x1aba3c,_0x56077c,_0x4f94f8,_0x3498de){const _0x379b71=a159_0x407fa0,_0x1f37b6=new Set();for(const {yamlConfig:_0x6bfe3b,folderPath:_0x1a824f}of _0x1aba3c){_0x1f37b6[_0x379b71(0x181)](_0x1a824f+':'+_0x6bfe3b[_0x379b71(0x1c9)]);}return _0x32f258[_0x379b71(0x1ce)](_0x151c04=>{const _0x302a79=_0x379b71,_0x15262e=_0x151c04[_0x302a79(0x1b3)]?_0x56077c[_0x302a79(0x1c7)](_0x151c04[_0x302a79(0x1b3)])||'':'',_0x4a71f9=_0x15262e+':'+_0x151c04['journeyBundleName'];if(_0x1f37b6[_0x302a79(0x18f)](_0x4a71f9))return![];if(_0x3498de)return _0x15262e===_0x4f94f8||_0x15262e[_0x302a79(0x25e)](_0x4f94f8+'/');return!![];});}export function buildSegmentLookupMap(_0x1b0998,_0x5b3635){const _0x2292af=a159_0x407fa0,_0x50dca2=new Map();for(const _0x18541c of _0x1b0998){const _0x1142f4=_0x18541c[_0x2292af(0x23e)]?_0x5b3635[_0x2292af(0x1c7)](_0x18541c[_0x2292af(0x23e)][_0x2292af(0x265)]())||'':'',_0x3251a6=_0x1142f4+':'+_0x18541c['name'];_0x50dca2[_0x2292af(0x192)](_0x3251a6,_0x18541c);}return _0x50dca2;}export function buildSegmentNameToIdMap(_0x1b36e7){const _0x2ed5ea=a159_0x407fa0,_0x4cdbb3=new Map();for(const _0x54fade of _0x1b36e7){_0x4cdbb3['set'](_0x54fade[_0x2ed5ea(0x1c9)],_0x54fade['id']);}return _0x4cdbb3;}export function buildJourneyBundleLookupMap(_0xab2e52,_0x33ba69){const _0x364988=a159_0x407fa0,_0x1ae952=new Map();for(const _0x510358 of _0xab2e52){const _0x5f114b=_0x510358['folderId']?_0x33ba69[_0x364988(0x1c7)](_0x510358[_0x364988(0x1b3)])||'':'',_0xbfd777=_0x5f114b+':'+_0x510358[_0x364988(0x21d)];!_0x1ae952[_0x364988(0x18f)](_0xbfd777)&&_0x1ae952[_0x364988(0x192)](_0xbfd777,[]),_0x1ae952[_0x364988(0x1c7)](_0xbfd777)[_0x364988(0x1ae)](_0x510358);}for(const _0x5a5700 of _0x1ae952[_0x364988(0x193)]()){_0x5a5700[_0x364988(0x264)]((_0x33b1a2,_0x36ca4c)=>(_0x33b1a2[_0x364988(0x1da)]||0x0)-(_0x36ca4c[_0x364988(0x1da)]||0x0));}return _0x1ae952;}export function collectFoldersToCreate(_0x34f9ed,_0x4b8edd){const _0x100aa2=a159_0x407fa0,_0x5196cc=new Set();for(const _0x2a7052 of _0x34f9ed){if(!_0x2a7052)continue;if(_0x4b8edd[_0x100aa2(0x18f)](_0x2a7052))continue;const _0x23f1f3=_0x2a7052[_0x100aa2(0x1f0)]('/');let _0x585aee='';for(const _0x48a3f5 of _0x23f1f3){_0x585aee=_0x585aee?_0x585aee+'/'+_0x48a3f5:_0x48a3f5,!_0x4b8edd[_0x100aa2(0x18f)](_0x585aee)&&_0x5196cc[_0x100aa2(0x181)](_0x585aee);}}return _0x5196cc;}export function parseAndClassifyYamlFiles(_0x11ed42,_0x261c6b,_0x5ac460){const _0x52cdde=a159_0x407fa0,_0x1665b5=[],_0x564e15=[];for(const _0x5822de of _0x11ed42){const _0xbe8b95=a159_0x2127b0[_0x52cdde(0x232)](_0x261c6b,a159_0x2127b0[_0x52cdde(0x210)](_0x5822de)),_0x9f3fc8=_0xbe8b95==='.'?'':_0xbe8b95['replace'](/\\/g,'/'),_0x1a8c8e=readFileSync(_0x5822de,'utf-8'),_0x4d17b8=a159_0x58614f[_0x52cdde(0x254)](_0x1a8c8e);if(isJourneyDef(_0x4d17b8,_0x5822de)){const _0x30d1cf=a159_0x3076f3(_0x1a8c8e);_0x564e15['push']({'yamlConfig':_0x30d1cf,'folderPath':_0x9f3fc8,'sourcePath':_0x5822de});}else{if(!_0x5ac460?.['skipSegments']){const _0x2efef8=parseSegmentYamlFile(_0x1a8c8e),_0x28730b=normalizeChildSegmentYaml(_0x2efef8);_0x1665b5[_0x52cdde(0x1ae)]({'yamlConfig':_0x28730b,'folderPath':_0x9f3fc8,'sourcePath':_0x5822de});}}}return{'segments':_0x1665b5,'journeys':_0x564e15};}export function validateParsedFiles(_0x5e88b6,_0x511bb9){const _0xa3a14e=a159_0x407fa0,_0x501a4a=[];for(const {yamlConfig:_0x37712d,sourcePath:_0x4d15bd}of _0x5e88b6['segments']){const _0x30f3ff=readFileSync(_0x4d15bd,_0xa3a14e(0x20e)),_0xaf0622=a159_0x58614f['parseDocument'](_0x30f3ff),_0x5690aa=validateSegmentDef(_0x37712d,{'source':_0x30f3ff,'document':_0xaf0622},{'skipSchema':!![]});if(!_0x5690aa['valid']){const _0x3d1d9e=a159_0x2127b0['relative'](_0x511bb9,_0x4d15bd);_0x501a4a[_0xa3a14e(0x1ae)]({'filePath':_0x3d1d9e,'source':_0x30f3ff,'result':_0x5690aa,'isJourney':![]});}}for(const {yamlConfig:_0x1c95ce,sourcePath:_0x343812}of _0x5e88b6[_0xa3a14e(0x243)]){const _0x51cbfb=readFileSync(_0x343812,'utf-8'),_0x130023=a159_0x58614f['parseDocument'](_0x51cbfb),_0x5b4e5a=validateJourneyDef(_0x1c95ce,{'source':_0x51cbfb,'document':_0x130023},{'skipSchema':!![]});if(!_0x5b4e5a['valid']){const _0x4ccdaa=a159_0x2127b0[_0xa3a14e(0x232)](_0x511bb9,_0x343812);_0x501a4a[_0xa3a14e(0x1ae)]({'filePath':_0x4ccdaa,'source':_0x51cbfb,'result':_0x5b4e5a,'isJourney':!![]});}}return _0x501a4a;}export function formatValidationErrors(_0x4b2646){const _0x4f6735=a159_0x407fa0,_0x48843b=[];for(const {filePath:_0x4e4800,source:_0x588689,result:_0x307849,isJourney:_0x53ce48}of _0x4b2646){const _0x1c2100=_0x53ce48?_0x4f6735(0x249):_0x4f6735(0x179);_0x48843b['push']('\x0a'+_0x4e4800+'\x20('+_0x1c2100+'):\x20'+_0x307849[_0x4f6735(0x206)][_0x4f6735(0x234)]+'\x20error(s)'),_0x48843b[_0x4f6735(0x1ae)](formatValidationResult(_0x307849,_0x588689,_0x4e4800));}return _0x48843b['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x146325){const _0x38f903=a159_0x407fa0,_0x44bc16=new Set(),_0x2644f4=new Map(),_0x2cdff1=collectSegmentUsageCounts(_0x146325);if(_0x146325[_0x38f903(0x1d6)])for(const [_0x51bc16,_0x59c02d]of Object[_0x38f903(0x231)](_0x146325[_0x38f903(0x1d6)])){_0x44bc16[_0x38f903(0x181)](_0x51bc16);if(_0x59c02d[_0x38f903(0x1d1)]){const _0x4c11fb=yamlRuleToApi(_0x59c02d[_0x38f903(0x1d1)]),_0x474463=apiRuleToYaml(_0x4c11fb);_0x2644f4['set'](_0x51bc16,_0x474463);}}const _0x2c841d=new Map();let _0x1b4e9c=0x0;for(const [_0x135151,_0x454aac]of _0x2644f4){const _0x5e02f9=serializeExpandedRule(_0x454aac,_0x2644f4),_0x563fd1=_0x2c841d[_0x38f903(0x1c7)](_0x5e02f9)||[];_0x563fd1[_0x38f903(0x1ae)]({'name':_0x135151,'index':_0x1b4e9c}),_0x2c841d[_0x38f903(0x192)](_0x5e02f9,_0x563fd1),_0x1b4e9c++;}const _0x237249=new Map();for(const [_0x44f6fc,_0x4a5c33]of _0x2c841d){const _0x485fb9=_0x4a5c33[_0x38f903(0x198)]()[_0x38f903(0x264)]((_0x39f235,_0xf40955)=>{const _0x1de767=_0x38f903,_0x1969bb=_0x2cdff1[_0x1de767(0x1c7)](_0x39f235['name'])||0x0,_0x438b71=_0x2cdff1[_0x1de767(0x1c7)](_0xf40955[_0x1de767(0x1c9)])||0x0;if(_0x1969bb!==_0x438b71)return _0x438b71-_0x1969bb;return _0x39f235['index']-_0xf40955[_0x1de767(0x1d8)];})[_0x38f903(0x1cf)](_0x345b3e=>_0x345b3e['name']),_0x5052d3=[];for(const _0x20d60f of _0x485fb9){const _0x8115bc=_0x2cdff1['get'](_0x20d60f)||0x0,_0x3cd616=Math[_0x38f903(0x196)](_0x8115bc,0x1);for(let _0x52099b=0x0;_0x52099b<_0x3cd616;_0x52099b++){_0x5052d3['push'](_0x20d60f);}}_0x237249[_0x38f903(0x192)](_0x44f6fc,_0x5052d3);}return{'existingLocalSegmentNames':_0x44bc16,'localSegmentRules':_0x2644f4,'localExpandedRuleToNames':_0x237249};}export function createSegmentIdResolver(_0x5048cf,_0x321948){return async _0x41f8d6=>{const _0x49995d=a159_0x3097,_0x3edb52=_0x5048cf[_0x49995d(0x1c7)](_0x41f8d6);if(!_0x3edb52)throw new SDKError(ErrorCode[_0x49995d(0x237)],_0x49995d(0x1a6)+_0x41f8d6+_0x49995d(0x238)+_0x321948+'\x27)');return _0x3edb52;};}export function extractRootFolderId(_0x41d77d){const _0xbaf947=a159_0x407fa0;return _0x41d77d[_0xbaf947(0x221)]?.[_0xbaf947(0x218)]?.[_0xbaf947(0x1d0)]?.['id']||_0x41d77d[_0xbaf947(0x221)]?.[_0xbaf947(0x1c0)]?.['data']?.['id'];}export function buildConnectionMaps(_0x414e0d){const _0x63003c=a159_0x407fa0,_0x3b281e=new Map(),_0x2370a2=new Map(),_0x6725ef=new Map();for(const _0x1bd606 of _0x414e0d){_0x3b281e[_0x63003c(0x192)](_0x1bd606[_0x63003c(0x1c9)],parseInt(_0x1bd606['id'],0xa)),_0x2370a2[_0x63003c(0x192)](_0x1bd606['id'],_0x1bd606[_0x63003c(0x1c9)]),_0x6725ef[_0x63003c(0x192)](_0x1bd606[_0x63003c(0x1c9)],_0x1bd606['type']);}return{'nameToId':_0x3b281e,'idToName':_0x2370a2,'nameToType':_0x6725ef};}export function calculatePushStats(_0x214497,_0x1fe21b,_0x5f0bce,_0x4fb899,_0x4f0a5d,_0x2a8a31,_0xf90cdc){const _0x30738a=a159_0x407fa0,_0x1af71d=_0x214497['filter'](_0x5500ae=>_0x5500ae[_0x30738a(0x219)]),_0x57bc0d=_0x214497[_0x30738a(0x1ce)](_0x6aa9d6=>!_0x6aa9d6['isNew']&&_0x6aa9d6[_0x30738a(0x23c)]),_0x8187e5=_0x214497[_0x30738a(0x1ce)](_0x274dc6=>!_0x274dc6[_0x30738a(0x219)]&&!_0x274dc6[_0x30738a(0x23c)]),_0x829912=_0x2a8a31?_0x4fb899:[],_0x5a688d=_0x1fe21b[_0x30738a(0x1ce)](_0x55f19d=>_0x55f19d[_0x30738a(0x219)]),_0x434a83=_0x1fe21b[_0x30738a(0x1ce)](_0x1c5294=>!_0x1c5294[_0x30738a(0x219)]&&_0x1c5294[_0x30738a(0x23c)]),_0x3add75=_0x1fe21b[_0x30738a(0x1ce)](_0x3c7dd0=>!_0x3c7dd0[_0x30738a(0x219)]&&!_0x3c7dd0['hasChanges']),_0x3c63ca=_0x2a8a31?_0x4f0a5d:[],_0x403b1d=_0x214497[_0x30738a(0x195)](_0x1bc2ec=>_0x1bc2ec[_0x30738a(0x1ac)]),_0x5c3a92=_0x403b1d[_0x30738a(0x1ce)](_0x381d78=>_0x381d78[_0x30738a(0x252)]===_0x30738a(0x21b)),_0x56c0e0=_0x403b1d[_0x30738a(0x1ce)](_0x44b995=>_0x44b995[_0x30738a(0x252)]==='update'),_0x44431a=_0x403b1d['filter'](_0x2b8bf1=>_0x2b8bf1[_0x30738a(0x252)]===_0x30738a(0x17b)),_0x2e40b9=Array['from'](_0x5f0bce)['sort'](),_0x1647cf=_0xf90cdc?![]:_0x1af71d['length']>0x0||_0x57bc0d[_0x30738a(0x234)]>0x0||_0x829912[_0x30738a(0x234)]>0x0,_0x43a3f7=_0x5a688d[_0x30738a(0x234)]>0x0||_0x434a83[_0x30738a(0x234)]>0x0||_0x3c63ca['length']>0x0,_0xa88420=_0xf90cdc?![]:_0x403b1d[_0x30738a(0x234)]>0x0,_0x3dbccc=_0x2e40b9['length']>0x0;return{'segments':{'new':_0x1af71d,'changed':_0x57bc0d,'unchanged':_0x8187e5,'toDelete':_0x829912},'journeys':{'new':_0x5a688d,'changed':_0x434a83,'unchanged':_0x3add75,'toDelete':_0x3c63ca},'activations':{'all':_0x403b1d,'toCreate':_0x5c3a92,'toUpdate':_0x56c0e0,'toDelete':_0x44431a},'folders':{'toCreate':_0x2e40b9},'counts':{'segments':{'new':_0x1af71d[_0x30738a(0x234)],'changed':_0x57bc0d[_0x30738a(0x234)],'unchanged':_0x8187e5[_0x30738a(0x234)],'toDelete':_0x829912['length']},'journeys':{'new':_0x5a688d[_0x30738a(0x234)],'changed':_0x434a83['length'],'unchanged':_0x3add75[_0x30738a(0x234)],'toDelete':_0x3c63ca[_0x30738a(0x234)]},'activations':{'create':_0x5c3a92[_0x30738a(0x234)],'update':_0x56c0e0[_0x30738a(0x234)],'delete':_0x44431a[_0x30738a(0x234)]},'folders':_0x2e40b9[_0x30738a(0x234)]},'hasChanges':_0x1647cf||_0x43a3f7||_0xa88420||_0x3dbccc};}export async function buildPushExecutionContext(_0x4e03a7,_0x296afe,_0x47b1b2,_0x16e692,_0x9be59,_0x3d86b0){const _0x3a4466=a159_0x407fa0,_0x316194=extractRootFolderId(_0x47b1b2),{pathToId:_0x1d8ea1,idToPath:_0x996a14}=buildFolderMaps(_0x9be59),_0x387499=buildSegmentNameToIdMap(_0x16e692),_0xa2e050=new Map(),{batchAsync:_0xaded05}=await import(_0x3a4466(0x224)),[_0x128890,_0x217991]=await Promise[_0x3a4466(0x211)]([_0x4e03a7[_0x3a4466(0x1a2)][_0x3a4466(0x1ea)](),_0x4e03a7['connection'][_0x3a4466(0x240)](),((async()=>{!_0x3d86b0&&_0x16e692['length']>0x0&&await _0xaded05(_0x16e692,async _0x538deb=>{const _0x56f499=a159_0x3097,_0x499f06=await _0x4e03a7[_0x56f499(0x179)][_0x56f499(0x174)](_0x296afe,_0x538deb['id']);_0xa2e050[_0x56f499(0x192)](_0x538deb['id'],_0x499f06);});})())]),{emailToId:_0x19082d,idToEmail:_0x5f0b49}=_0x128890,_0x10e6ab=buildConnectionMaps(_0x217991);return{'rootFolderId':_0x316194,'folderPathToId':_0x1d8ea1,'folderIdToPath':_0x996a14,'segmentNameToId':_0x387499,'activationsBySegmentId':_0xa2e050,'emailToIdMap':_0x19082d,'idToEmailMap':_0x5f0b49,'connectionNameToIdMap':_0x10e6ab[_0x3a4466(0x1fe)],'connectionIdToNameMap':_0x10e6ab['idToName'],'connectionNameToTypeMap':_0x10e6ab[_0x3a4466(0x236)]};}export function createPushYamlContextForBundle(_0x23eb5e,_0x3b112e,_0x3560b6,_0x5a1c25,_0x466f89,_0x42579d,_0x57b57b,_0x52be4f){const {existingLocalSegmentNames:_0x3cdc48,localExpandedRuleToNames:_0x2d8e36}=_0x5a1c25,_0x29d432=new Set(),_0x40306a=new Map(),_0x13add5=new Map(),_0x38532f=new Map(),_0x12757c=createJumpTargetCache(),_0x13c9ad=new Map(),_0x24ce1b=new Map(),_0x23f417=new Set();let _0x16e0fb;const _0x39464b=_0x5e23ef=>{const _0x1951de={'resolveSegment':async _0x305bd5=>{const _0x126b03=a159_0x3097,_0x532baa=_0x38532f[_0x126b03(0x1c7)](_0x305bd5);if(_0x532baa!==undefined)return{'name':_0x532baa,'isJourneyLocal':!![]};try{const _0x2864bd=await fetchSegment(_0x23eb5e,_0x3b112e,_0x305bd5,_0x3560b6);if(!_0x2864bd)throw new Error(_0x126b03(0x168));const _0x3842d4=generateJourneyLocalName(_0x2864bd[_0x126b03(0x1c9)]),_0x42a1b9=_0x2864bd['kind']===SEGMENT_KIND_JOURNEY&&_0x3842d4!==undefined;let _0x349ce4=_0x2864bd[_0x126b03(0x1c9)],_0xaaf5a9;if(_0x42a1b9&&_0x2864bd['rule']){const _0x263e62=apiRuleToYaml(_0x2864bd[_0x126b03(0x1d1)]);_0x24ce1b[_0x126b03(0x192)](_0x305bd5,_0x263e62);const _0x231d67=async _0x5cb851=>{const _0x3fc4ab=_0x126b03,_0x5cfbf9=collectSegmentRefsFromRule(_0x5cb851);for(const _0x14da52 of _0x5cfbf9){if(!_0x24ce1b[_0x3fc4ab(0x18f)](_0x14da52))try{const _0x5e281f=await fetchSegment(_0x23eb5e,_0x3b112e,_0x14da52,_0x3560b6);if(_0x5e281f?.[_0x3fc4ab(0x1d1)]){const _0x4cdc90=apiRuleToYaml(_0x5e281f[_0x3fc4ab(0x1d1)]);_0x24ce1b['set'](_0x14da52,_0x4cdc90),await _0x231d67(_0x4cdc90);}}catch(_0x4c030d){logger['debug'](_0x3fc4ab(0x228)+_0x14da52+':\x20'+_0x4c030d);}}};await _0x231d67(_0x263e62);const _0x44130a=serializeExpandedRule(_0x263e62,_0x24ce1b),_0x5785e2=_0x2d8e36['get'](_0x44130a);if(_0x5785e2&&_0x5785e2[_0x126b03(0x234)]>0x0){const _0x3b73e8=_0x40306a['get'](_0x44130a)||0x0,_0x4b6bcd=_0x5785e2[_0x3b73e8]||_0x5785e2[_0x5785e2[_0x126b03(0x234)]-0x1];_0x40306a['set'](_0x44130a,_0x3b73e8+0x1),_0x349ce4=_0x4b6bcd,_0x29d432[_0x126b03(0x181)](_0x349ce4),_0x38532f['set'](_0x305bd5,_0x349ce4);const _0x4ef231=await resolveRuleSegmentRefs(_0x263e62,async _0xfc8629=>{const _0xd89744=_0x126b03,_0x152319=_0x38532f['get'](_0xfc8629);if(_0x152319)return _0x152319;const _0xf7d8ca=await _0x16e0fb[_0xd89744(0x247)](_0xfc8629);return _0xf7d8ca[_0xd89744(0x1c9)];});_0xaaf5a9={'description':_0x2864bd[_0x126b03(0x197)],'rule':_0x4ef231};}else{const _0x56a81a=_0x13c9ad[_0x126b03(0x1c7)](_0x44130a);if(_0x56a81a)_0x349ce4=_0x56a81a,_0x38532f[_0x126b03(0x192)](_0x305bd5,_0x349ce4);else{if(_0x3842d4){let _0x33fa18=_0x3842d4,_0x1eca02=0x2;while(_0x29d432['has'](_0x33fa18)||_0x3cdc48[_0x126b03(0x18f)](_0x33fa18)){_0x33fa18=_0x3842d4+'_'+_0x1eca02,_0x1eca02++;}_0x29d432[_0x126b03(0x181)](_0x33fa18),_0x349ce4=_0x33fa18;}_0x38532f[_0x126b03(0x192)](_0x305bd5,_0x349ce4),_0x13c9ad[_0x126b03(0x192)](_0x44130a,_0x349ce4);const _0x20552f=await resolveRuleSegmentRefs(_0x263e62,async _0x575c59=>{const _0x444da3=_0x126b03,_0x3860f3=_0x38532f[_0x444da3(0x1c7)](_0x575c59);if(_0x3860f3)return _0x3860f3;const _0x3a473e=await _0x16e0fb['resolveSegment'](_0x575c59);return _0x3a473e[_0x444da3(0x1c9)];});_0xaaf5a9={'description':_0x2864bd[_0x126b03(0x197)],'rule':_0x20552f};}}}return{'name':_0x349ce4,'isJourneyLocal':_0x42a1b9,'definition':_0xaaf5a9};}catch(_0xadbad0){return logger[_0x126b03(0x1c6)](_0x126b03(0x1d7)+_0x305bd5+':\x20'+_0xadbad0),{'name':_0x305bd5,'isJourneyLocal':![]};}},'resolveActivation':async _0x195e41=>{const _0x200516=a159_0x3097,_0x27f9fe=_0x13add5[_0x200516(0x1c7)](_0x195e41);if(_0x27f9fe!==undefined)return{'name':_0x27f9fe,'isJourneyLocal':!![]};try{let _0x507efc=_0x57b57b?.['get'](_0x195e41);!_0x507efc&&(_0x507efc=await _0x23eb5e['journey'][_0x200516(0x258)](_0x5e23ef,_0x195e41));const _0x471782=_0x507efc[_0x200516(0x242)][_0x200516(0x222)][_0x200516(0x1c9)]||_0x195e41,_0x1a35d6=sanitizeYamlKey(_0x471782)||_0x200516(0x1de)+_0x195e41,_0xdf0811=_0x1a35d6;_0x13add5[_0x200516(0x192)](_0x195e41,_0xdf0811);const _0x4d2b87=journeyActivationStepToYaml(_0x507efc,_0x466f89,_0x42579d);return{'name':_0xdf0811,'isJourneyLocal':!![],'definition':_0x4d2b87};}catch(_0x5aa320){return logger[_0x200516(0x1c6)](_0x200516(0x1c5)+_0x195e41+':\x20'+_0x5aa320),{'name':_0x195e41,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x47c227,_0x581268)=>resolveJumpTarget(_0x47c227,_0x581268,_0x12757c,async _0x41f925=>{const _0x40a776=a159_0x3097,_0x4968cd=_0x52be4f?.[_0x40a776(0x1c7)](_0x41f925);if(_0x4968cd)return _0x4968cd;return _0x23eb5e[_0x40a776(0x249)]['getJourney'](_0x41f925);})};return _0x16e0fb=_0x1951de,_0x1951de;},_0x564e4c=async _0x25d7c9=>{const _0x2bb974=a159_0x3097,{collectSegmentIdsFromJourneyApi:_0x5d918e}=await import('./journey-yaml.js'),{batchAsync:_0x3f2588}=await import(_0x2bb974(0x224)),_0x4f6cd7=new Set();for(const _0x1a423c of _0x25d7c9){let _0x522131=_0x52be4f?.[_0x2bb974(0x1c7)](_0x1a423c);!_0x522131&&(_0x522131=await _0x23eb5e[_0x2bb974(0x249)][_0x2bb974(0x1df)](_0x1a423c));const _0x4c9b32=_0x5d918e(_0x522131);for(const _0x1919c9 of _0x4c9b32){_0x4f6cd7['add'](_0x1919c9);}}let _0x3241ac=Array[_0x2bb974(0x24f)](_0x4f6cd7);while(_0x3241ac[_0x2bb974(0x234)]>0x0){const _0x80312d=_0x3241ac['filter'](_0xa2b0f0=>!_0x23f417[_0x2bb974(0x18f)](_0xa2b0f0));if(_0x80312d[_0x2bb974(0x234)]===0x0)break;const _0x5f1209=await _0x3f2588(_0x80312d,async _0x5982f0=>{_0x23f417['add'](_0x5982f0);const _0x3bb27b=await fetchSegment(_0x23eb5e,_0x3b112e,_0x5982f0,_0x3560b6);if(!_0x3bb27b)return null;return{'segmentId':_0x5982f0,'segment':_0x3bb27b};},0xa),_0x4df670=new Set();for(const _0x413bf4 of _0x5f1209){if(!_0x413bf4?.[_0x2bb974(0x179)]?.['rule'])continue;const _0x68543d=apiRuleToYaml(_0x413bf4['segment'][_0x2bb974(0x1d1)]);_0x24ce1b[_0x2bb974(0x192)](_0x413bf4['segmentId'],_0x68543d);const _0x5d6bd2=collectSegmentRefsFromRule(_0x68543d);for(const _0x3111a5 of _0x5d6bd2){!_0x23f417[_0x2bb974(0x18f)](_0x3111a5)&&_0x4df670[_0x2bb974(0x181)](_0x3111a5);}}_0x3241ac=Array[_0x2bb974(0x24f)](_0x4df670);}};return{'createYamlContext':_0x39464b,'prefetchJourneySegments':_0x564e4c};}export async function executePushSegments(_0x50249a,_0x31833f,_0x1c5aed,_0x5bad4e,_0x35a74a){const _0x163a11=a159_0x407fa0,{segmentDefToCreateRequest:_0x268324,segmentDefToUpdateRequest:_0x3ba75c}=await import(_0x163a11(0x23f)),_0x499766=_0x1c5aed[_0x163a11(0x241)],_0x3b30dd=0x5,_0x4e83cf=async _0x3b792a=>{const _0x249b99=_0x163a11,_0x10cc72=_0x3b792a[_0x249b99(0x183)]?_0x499766['get'](_0x3b792a['folderPath']):undefined;let _0x4c71a8;const _0xdc57d5={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5ec00b=_0x3b792a['yamlConfig'];if(_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1d1)]){const _0x471081=createSegmentIdResolver(_0x1c5aed[_0x249b99(0x187)],_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]),_0x351559=await resolveRuleSegmentIds(_0x3b792a['yamlConfig'][_0x249b99(0x1d1)],_0x471081);_0x5ec00b={..._0x3b792a[_0x249b99(0x17c)],'rule':_0x351559};}try{if(_0x3b792a['isNew']){_0x35a74a[_0x249b99(0x19b)]?.({'type':'segment_creating','name':_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]});const _0x476b9e=_0x268324(_0x5ec00b,_0x10cc72),_0x37ee=await _0x35a74a[_0x249b99(0x175)]('Creating\x20segment\x20\x27'+_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]+_0x249b99(0x1f8),()=>_0x50249a[_0x249b99(0x179)][_0x249b99(0x185)](_0x5bad4e[_0x249b99(0x180)],_0x476b9e));_0x4c71a8=_0x37ee[_0x249b99(0x1d0)]['id'],_0x1c5aed[_0x249b99(0x187)][_0x249b99(0x192)](_0x3b792a['yamlConfig'][_0x249b99(0x1c9)],_0x4c71a8),_0xdc57d5[_0x249b99(0x239)]={'name':_0x3b792a['yamlConfig'][_0x249b99(0x1c9)],'id':_0x4c71a8},_0x35a74a['onProgress']?.({'type':_0x249b99(0x1e1),'name':_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)],'segmentId':_0x4c71a8}),_0x35a74a[_0x249b99(0x223)]?.(_0x249b99(0x22a)+_0x3b792a['yamlConfig'][_0x249b99(0x1c9)]+'\x27'),_0xdc57d5['created']=0x1;}else{if(_0x3b792a[_0x249b99(0x23c)]){_0x35a74a[_0x249b99(0x19b)]?.({'type':_0x249b99(0x1e3),'name':_0x3b792a['yamlConfig'][_0x249b99(0x1c9)]});const _0x440835=_0x3ba75c(_0x5ec00b);_0x10cc72!==_0x3b792a[_0x249b99(0x261)]?.[_0x249b99(0x23e)]&&(_0x440835['segmentFolderId']=_0x10cc72?parseInt(_0x10cc72,0xa):undefined),await _0x35a74a[_0x249b99(0x175)](_0x249b99(0x1a7)+_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]+_0x249b99(0x1f8),()=>_0x50249a['segment'][_0x249b99(0x1aa)](_0x5bad4e[_0x249b99(0x180)],_0x3b792a['existingSegment']['id'],_0x440835)),_0x4c71a8=_0x3b792a[_0x249b99(0x261)]['id'],_0x35a74a[_0x249b99(0x19b)]?.({'type':_0x249b99(0x1ad),'name':_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]}),_0x35a74a[_0x249b99(0x223)]?.(_0x249b99(0x24e)+_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]+'\x27'),_0xdc57d5[_0x249b99(0x1e5)]=0x1;}else _0x4c71a8=_0x3b792a[_0x249b99(0x261)]['id'];}}catch(_0x125650){const _0x28951c=isHttp400Error(_0x125650),_0x357930=_0x28951c?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x249b99(0x177)],_0xfca2b7=getErrorMessage(_0x125650);throw new SDKError(_0x357930,_0x249b99(0x1b6)+(_0x3b792a['isNew']?'create':'update')+_0x249b99(0x209)+_0x3b792a['absolutePath']+_0x249b99(0x184)+_0xfca2b7,_0x125650);}try{const _0x516ade=await syncActivationsForSegment(_0x50249a,_0x5bad4e['parentId'],_0x4c71a8,_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)],_0x3b792a[_0x249b99(0x1ac)],_0x35a74a,_0x3b792a['absolutePath']);_0xdc57d5['activations']=_0x516ade;}catch(_0x1f6418){if(_0x1f6418 instanceof SDKError)throw _0x1f6418;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x3b792a[_0x249b99(0x17c)][_0x249b99(0x1c9)]+'\x27\x20from\x20file:\x20'+_0x3b792a[_0x249b99(0x21e)]+_0x249b99(0x184)+getErrorMessage(_0x1f6418),_0x1f6418);}return _0xdc57d5;},_0x33a3ed=await batchAsync(_0x31833f,_0x4e83cf,_0x3b30dd),_0x5d6e92={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x26a000 of _0x33a3ed){_0x5d6e92[_0x163a11(0x20d)]+=_0x26a000[_0x163a11(0x20d)],_0x5d6e92[_0x163a11(0x1e5)]+=_0x26a000[_0x163a11(0x1e5)],_0x26a000['createdSegmentId']&&_0x5d6e92[_0x163a11(0x188)]['set'](_0x26a000['createdSegmentId'][_0x163a11(0x1c9)],_0x26a000['createdSegmentId']['id']),_0x5d6e92['activations']['created']+=_0x26a000[_0x163a11(0x22c)][_0x163a11(0x20d)],_0x5d6e92[_0x163a11(0x22c)][_0x163a11(0x1e5)]+=_0x26a000[_0x163a11(0x22c)][_0x163a11(0x1e5)],_0x5d6e92['activations']['deleted']+=_0x26a000[_0x163a11(0x22c)]['deleted'];}return _0x5d6e92;}async function syncActivationsForSegment(_0x39ca62,_0x5aa1de,_0x5d0007,_0x1ab17b,_0x44d1b3,_0x41457f,_0x3189a9){const _0x57d449=a159_0x407fa0,_0x1edb4d={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x19cb3d of _0x44d1b3){try{if(_0x19cb3d[_0x57d449(0x252)]===_0x57d449(0x21b)&&_0x19cb3d[_0x57d449(0x1ef)])_0x41457f[_0x57d449(0x19b)]?.({'type':_0x57d449(0x1c3),'segmentName':_0x1ab17b,'activationName':_0x19cb3d[_0x57d449(0x1c9)]}),await _0x41457f[_0x57d449(0x175)](_0x57d449(0x25d)+_0x19cb3d[_0x57d449(0x1c9)]+_0x57d449(0x1f8),()=>_0x39ca62[_0x57d449(0x179)]['createActivation'](_0x5aa1de,_0x5d0007,_0x19cb3d[_0x57d449(0x1ef)])),_0x41457f[_0x57d449(0x19b)]?.({'type':_0x57d449(0x1a9),'segmentName':_0x1ab17b,'activationName':_0x19cb3d[_0x57d449(0x1c9)]}),_0x41457f[_0x57d449(0x223)]?.(_0x57d449(0x1d9)+_0x19cb3d[_0x57d449(0x1c9)]+'\x27'),_0x1edb4d[_0x57d449(0x20d)]++;else{if(_0x19cb3d[_0x57d449(0x252)]===_0x57d449(0x24c)&&_0x19cb3d[_0x57d449(0x1ef)]&&_0x19cb3d['existingActivation'])_0x41457f[_0x57d449(0x19b)]?.({'type':_0x57d449(0x18e),'segmentName':_0x1ab17b,'activationName':_0x19cb3d[_0x57d449(0x1c9)]}),await _0x41457f[_0x57d449(0x175)](_0x57d449(0x1a8)+_0x19cb3d['name']+_0x57d449(0x1f8),()=>_0x39ca62[_0x57d449(0x179)]['updateActivation'](_0x5aa1de,_0x5d0007,_0x19cb3d[_0x57d449(0x263)]['id'],_0x19cb3d[_0x57d449(0x1ef)])),_0x41457f['onProgress']?.({'type':'activation_updated','segmentName':_0x1ab17b,'activationName':_0x19cb3d['name']}),_0x41457f[_0x57d449(0x223)]?.('Updated\x20activation\x20\x27'+_0x19cb3d['name']+'\x27'),_0x1edb4d[_0x57d449(0x1e5)]++;else _0x19cb3d[_0x57d449(0x252)]===_0x57d449(0x17b)&&_0x19cb3d[_0x57d449(0x263)]&&(_0x41457f[_0x57d449(0x19b)]?.({'type':_0x57d449(0x200),'segmentName':_0x1ab17b,'activationName':_0x19cb3d[_0x57d449(0x1c9)]}),await _0x41457f[_0x57d449(0x175)](_0x57d449(0x21a)+_0x19cb3d[_0x57d449(0x1c9)]+_0x57d449(0x1f8),()=>_0x39ca62[_0x57d449(0x179)][_0x57d449(0x22d)](_0x5aa1de,_0x5d0007,_0x19cb3d[_0x57d449(0x263)]['id'])),_0x41457f[_0x57d449(0x19b)]?.({'type':'activation_deleted','segmentName':_0x1ab17b,'activationName':_0x19cb3d[_0x57d449(0x1c9)]}),_0x41457f['logDeleted']?.('Deleted\x20activation\x20\x27'+_0x19cb3d[_0x57d449(0x1c9)]+'\x27'),_0x1edb4d['deleted']++);}}catch(_0x46cd48){const _0x5984bf=isHttp400Error(_0x46cd48),_0x31c6d5=_0x5984bf?ErrorCode[_0x57d449(0x266)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x7da050=getErrorMessage(_0x46cd48);throw new SDKError(_0x31c6d5,_0x57d449(0x1b6)+_0x19cb3d[_0x57d449(0x252)]+_0x57d449(0x1b5)+_0x19cb3d[_0x57d449(0x1c9)]+_0x57d449(0x17d)+_0x3189a9+_0x57d449(0x184)+_0x7da050,_0x46cd48);}}return _0x1edb4d;}export async function executePushFolders(_0x2fe45c,_0x4289d7,_0x4293f7,_0x2849b7,_0x52dbf8){const _0x37526c=a159_0x407fa0,_0x583c9d=new Map(_0x4293f7),_0x279f1f=sortFoldersByDepth(_0x4289d7);for(const _0x31c5f8 of _0x279f1f){const _0x6dd13e=_0x31c5f8[_0x37526c(0x1f0)]('/'),_0x7bea01=_0x6dd13e[_0x6dd13e[_0x37526c(0x234)]-0x1],_0x21a800=_0x6dd13e[_0x37526c(0x198)](0x0,-0x1)[_0x37526c(0x169)]('/'),_0x12ac3e=_0x583c9d[_0x37526c(0x1c7)](_0x21a800);_0x52dbf8['onProgress']?.({'type':_0x37526c(0x22b),'folder':_0x31c5f8});const _0x21286d={'name':_0x7bea01,'parentFolderId':_0x12ac3e},_0x53f7ca=await _0x52dbf8[_0x37526c(0x175)]('Creating\x20folder\x20\x27'+_0x31c5f8+_0x37526c(0x1f8),()=>_0x2fe45c[_0x37526c(0x179)][_0x37526c(0x229)](_0x2849b7['parentId'],_0x21286d));_0x583c9d[_0x37526c(0x192)](_0x31c5f8,_0x53f7ca[_0x37526c(0x1d0)]['id']),_0x52dbf8[_0x37526c(0x19b)]?.({'type':_0x37526c(0x1ca),'folder':_0x31c5f8,'folderId':_0x53f7ca[_0x37526c(0x1d0)]['id']}),_0x52dbf8['logInfo']?.('Created\x20folder\x20\x27'+_0x31c5f8+'\x27');}return _0x583c9d;}export async function executePushSegmentDeletions(_0x1137aa,_0x5cdf8f,_0x40a30b){const _0x159b3b=a159_0x407fa0;if(_0x5cdf8f[_0x159b3b(0x234)]===0x0)return 0x0;const {batchAsync:_0x3a5465}=await import(_0x159b3b(0x224)),_0x2db9e2=0x5,_0x131fae=await _0x3a5465(_0x5cdf8f,async _0x5f071a=>{const _0x1c79e8=_0x159b3b;return _0x40a30b[_0x1c79e8(0x19b)]?.({'type':_0x1c79e8(0x248),'name':_0x5f071a[_0x1c79e8(0x1c9)]}),await _0x1137aa[_0x1c79e8(0x179)]['deleteSegment'](_0x5f071a['id']),_0x40a30b[_0x1c79e8(0x19b)]?.({'type':_0x1c79e8(0x20f),'name':_0x5f071a[_0x1c79e8(0x1c9)]}),_0x40a30b['logDeleted']?.(_0x1c79e8(0x260)+_0x5f071a[_0x1c79e8(0x1c9)]+'\x27'),0x1;},_0x2db9e2);return _0x131fae[_0x159b3b(0x25c)]((_0x345c8a,_0x1fb9de)=>_0x345c8a+_0x1fb9de,0x0);}export async function executePushJourneys(_0x1c1cc4,_0x4f790e,_0x43ac2a,_0x56f409,_0x4de633){const _0x5aa199=a159_0x407fa0,{journeyDefToRequest:_0x2e002b}=await import(_0x5aa199(0x1ec)),{activationDefToCreateRequest:_0x4e7294,yamlRuleToApi:_0x316399,validateSegmentRule:_0x3909c1}=await import(_0x5aa199(0x23f)),_0x1339e1={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2debf0=new Map(_0x43ac2a[_0x5aa199(0x187)]),_0x1b4e58=0x5;for(let _0x5926c5=0x0;_0x5926c5<_0x4f790e[_0x5aa199(0x234)];_0x5926c5+=_0x1b4e58){const _0x156a04=_0x4f790e[_0x5aa199(0x198)](_0x5926c5,_0x5926c5+_0x1b4e58),_0x82ba7c=await Promise[_0x5aa199(0x211)](_0x156a04[_0x5aa199(0x1cf)](async _0x4e39f1=>{const _0x120b7d=_0x5aa199;if(!_0x4e39f1[_0x120b7d(0x219)]&&!_0x4e39f1['hasChanges'])return{'action':_0x120b7d(0x1b4),'name':_0x4e39f1[_0x120b7d(0x17c)]['name'],'journeyId':_0x4e39f1[_0x120b7d(0x1b9)]?.['id']};const _0x387d58=_0x4e39f1[_0x120b7d(0x183)]?_0x43ac2a[_0x120b7d(0x241)][_0x120b7d(0x1c7)](_0x4e39f1[_0x120b7d(0x183)]):undefined;_0x4de633[_0x120b7d(0x19b)]?.({'type':_0x4e39f1['isNew']?_0x120b7d(0x170):_0x120b7d(0x1eb),'name':_0x4e39f1[_0x120b7d(0x17c)]['name']});try{const _0x158bf2=await executeSingleJourneyPush(_0x1c1cc4,_0x4e39f1,{..._0x43ac2a,'segmentNameToId':_0x2debf0},{'parentId':_0x56f409[_0x120b7d(0x180)],'rootFolderId':_0x56f409[_0x120b7d(0x1cc)],'folderId':_0x387d58,'verbose':_0x56f409[_0x120b7d(0x1dd)]},_0x4de633,{'journeyDefToRequest':_0x2e002b,'activationDefToCreateRequest':_0x4e7294,'yamlRuleToApi':_0x316399,'validateSegmentRule':_0x3909c1});for(const [_0x3dde97,_0x5cbb24]of _0x158bf2[_0x120b7d(0x1a4)]){_0x2debf0[_0x120b7d(0x192)](_0x3dde97,_0x5cbb24),_0x1339e1[_0x120b7d(0x1a4)]['set'](_0x3dde97,_0x5cbb24);}if(_0x158bf2[_0x120b7d(0x1e6)]===_0x120b7d(0x20d))_0x4de633[_0x120b7d(0x19b)]?.({'type':_0x120b7d(0x23a),'name':_0x4e39f1[_0x120b7d(0x17c)][_0x120b7d(0x1c9)],'journeyId':_0x158bf2[_0x120b7d(0x18a)]}),_0x4de633[_0x120b7d(0x223)]?.(_0x120b7d(0x1dc)+_0x4e39f1['yamlConfig'][_0x120b7d(0x1c9)]+'\x27'),_0x1339e1[_0x120b7d(0x20d)]++;else _0x158bf2[_0x120b7d(0x1e6)]===_0x120b7d(0x1e5)&&(_0x4de633[_0x120b7d(0x19b)]?.({'type':_0x120b7d(0x1f7),'name':_0x4e39f1[_0x120b7d(0x17c)][_0x120b7d(0x1c9)]}),_0x4de633[_0x120b7d(0x223)]?.(_0x120b7d(0x18c)+_0x4e39f1[_0x120b7d(0x17c)]['name']+'\x27'),_0x1339e1[_0x120b7d(0x1e5)]++);return{'action':_0x158bf2[_0x120b7d(0x1e6)],'name':_0x4e39f1['yamlConfig'][_0x120b7d(0x1c9)],'journeyId':_0x158bf2[_0x120b7d(0x18a)]};}catch(_0x2ddbd6){const _0x39983b=isHttp400Error(_0x2ddbd6),_0x3fdd61=_0x39983b?ErrorCode[_0x120b7d(0x1fb)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5ccdc4=getErrorMessage(_0x2ddbd6);throw new SDKError(_0x3fdd61,_0x120b7d(0x1b6)+(_0x4e39f1[_0x120b7d(0x219)]?_0x120b7d(0x21b):_0x120b7d(0x24c))+_0x120b7d(0x191)+_0x4e39f1[_0x120b7d(0x21e)]+'\x0a\x20\x20'+_0x5ccdc4,_0x2ddbd6);}}));_0x1339e1[_0x5aa199(0x176)][_0x5aa199(0x1ae)](..._0x82ba7c);}return _0x1339e1;}async function matchExistingJourneySegments(_0x3efd60,_0x30d99b,_0x1f1e7d,_0x45b6d6,_0x3d3f2d){const _0x4b1e1f=a159_0x407fa0;if(!_0x30d99b[_0x4b1e1f(0x1b9)]||!_0x30d99b[_0x4b1e1f(0x17c)][_0x4b1e1f(0x1d6)])return;const _0x1ff8bf=new Map(),_0x5bd56f=new Set();for(const _0x14d775 of Object['keys'](_0x30d99b['yamlConfig']['segments'])){const _0x22386e=generateDeterministicJourneySegmentName(_0x30d99b[_0x4b1e1f(0x17c)][_0x4b1e1f(0x1c9)],_0x14d775);_0x1ff8bf[_0x4b1e1f(0x192)](_0x22386e,_0x14d775),_0x5bd56f['add'](_0x14d775);}const _0x437abf=[],_0x15bf25=collectSegmentIdsFromJourneyApi(_0x30d99b[_0x4b1e1f(0x1b9)]);for(const _0x303235 of _0x15bf25){const _0x902e08=await fetchSegment(_0x3efd60,_0x1f1e7d,_0x303235,_0x45b6d6);if(!_0x902e08?.['name'])continue;const _0x546f39=_0x1ff8bf['get'](_0x902e08[_0x4b1e1f(0x1c9)]);_0x546f39?(_0x3d3f2d['set'](_0x546f39,_0x303235),_0x5bd56f[_0x4b1e1f(0x17b)](_0x546f39)):_0x437abf[_0x4b1e1f(0x1ae)]({'id':_0x303235,'seg':_0x902e08});}if(_0x5bd56f[_0x4b1e1f(0x255)]>0x0&&_0x437abf[_0x4b1e1f(0x234)]>0x0){const {localExpandedRuleToNames:_0x198e0f}=buildLocalExpandedRuleMappings(_0x30d99b[_0x4b1e1f(0x17c)]),_0x2febce=new Map();for(const {id:_0x550419,seg:_0xad1a45}of _0x437abf){if(_0xad1a45[_0x4b1e1f(0x1d1)]){const _0xa49d1=apiRuleToYaml(_0xad1a45[_0x4b1e1f(0x1d1)]);_0x2febce[_0x4b1e1f(0x192)](_0x550419,_0xa49d1);}}for(const {id:_0x26433c,seg:_0x21a8b8}of _0x437abf){if(!_0x21a8b8[_0x4b1e1f(0x1d1)])continue;const _0x323a32=_0x2febce[_0x4b1e1f(0x1c7)](_0x26433c);if(!_0x323a32)continue;const _0x916ea4=serializeExpandedRule(_0x323a32,_0x2febce),_0x1ceb05=_0x198e0f[_0x4b1e1f(0x1c7)](_0x916ea4);if(_0x1ceb05){const _0xafcbe7=_0x1ceb05[_0x4b1e1f(0x17e)](_0x5956c3=>_0x5bd56f[_0x4b1e1f(0x18f)](_0x5956c3));_0xafcbe7&&(_0x3d3f2d[_0x4b1e1f(0x192)](_0xafcbe7,_0x26433c),_0x5bd56f['delete'](_0xafcbe7),logger[_0x4b1e1f(0x1c6)](_0x4b1e1f(0x1d2)+_0x21a8b8[_0x4b1e1f(0x1c9)]+_0x4b1e1f(0x173)+_0xafcbe7+_0x4b1e1f(0x1f2)));}}}}async function executeSingleJourneyPush(_0x39d999,_0x29bf6b,_0x494ac9,_0x5ae78e,_0xaeca92,_0x5b2bc8){const _0x2cddf4=a159_0x407fa0,{journeyDefToRequest:_0x395aba,activationDefToCreateRequest:_0x4c1e55,yamlRuleToApi:_0x2678d8,validateSegmentRule:_0x2c2962}=_0x5b2bc8,_0x2a61d9=new Map(),_0x335624=new Map();recoverSegmentIdsFromPushRecovery(_0x29bf6b,_0x2a61d9,_0x494ac9[_0x2cddf4(0x187)]);const _0x587ae3=new Map(),_0x52c88f=new Map(),_0x1685c8=new Map();let _0x180515;const _0x4e8c65=async()=>{const _0x1f0c60=_0x2cddf4;if(_0x180515)return;_0x180515=new Map();if(!_0x29bf6b[_0x1f0c60(0x1b9)])return;const _0x58d491=await _0x39d999[_0x1f0c60(0x249)]['listActivations'](_0x29bf6b['existingJourney']['id']);for(const _0x1838d4 of _0x58d491){const _0x2813b3=journeyActivationStepToYaml(_0x1838d4,_0x494ac9[_0x1f0c60(0x16c)],_0x494ac9[_0x1f0c60(0x24d)]),_0x507988=activationSignature(_0x2813b3);!_0x180515[_0x1f0c60(0x18f)](_0x507988)&&_0x180515[_0x1f0c60(0x192)](_0x507988,_0x1838d4['id']),_0x2813b3[_0x1f0c60(0x1c9)]&&_0x335624[_0x1f0c60(0x192)](_0x2813b3['name'],_0x1838d4['id']);}};await matchExistingJourneySegments(_0x39d999,_0x29bf6b,_0x5ae78e[_0x2cddf4(0x180)],_0x494ac9[_0x2cddf4(0x172)],_0x494ac9[_0x2cddf4(0x187)]);const _0x2dd6ee={'resolveSegmentId':async _0x37d04d=>{const _0x4b8c5b=_0x2cddf4,_0x1e81f6=_0x494ac9[_0x4b8c5b(0x187)]['get'](_0x37d04d);if(!_0x1e81f6)throw new SDKError(ErrorCode[_0x4b8c5b(0x237)],'Segment\x20not\x20found:\x20'+_0x37d04d+_0x4b8c5b(0x1d5)+_0x29bf6b['yamlConfig']['name']+')');return _0x1e81f6;},'resolveEmbeddedSegmentId':async(_0x4bf859,_0x557ef2)=>{const _0x1e9fc7=_0x2cddf4,_0x746308=_0x494ac9[_0x1e9fc7(0x187)]['get'](_0x4bf859);if(_0x746308)return _0x746308;const _0x3aa8e2=_0x494ac9[_0x1e9fc7(0x172)]['find'](_0x5dee9c=>_0x5dee9c[_0x1e9fc7(0x1c9)]===_0x4bf859);if(_0x3aa8e2)return _0x494ac9[_0x1e9fc7(0x187)][_0x1e9fc7(0x192)](_0x4bf859,_0x3aa8e2['id']),_0x3aa8e2['id'];if(_0x29bf6b['isNew']){const {stageName:_0x1d4d0e,criteriaName:_0x3af915}=findSegmentCriteriaLocation(_0x29bf6b[_0x1e9fc7(0x17c)],_0x4bf859);return _0x2c2962(_0x4bf859,_0x557ef2['rule']),_0x52c88f[_0x1e9fc7(0x192)](_0x4bf859,{'definition':_0x557ef2,'stageName':_0x1d4d0e,'criteriaName':_0x3af915}),createPendingSegmentId(_0x4bf859);}const _0x572c20=_0x29bf6b[_0x1e9fc7(0x1b9)]?.['id'];if(!_0x572c20)throw new SDKError(ErrorCode[_0x1e9fc7(0x16b)],_0x1e9fc7(0x1db));const _0x29db49=_0x587ae3['get'](_0x4bf859);if(_0x29db49)return _0x29db49;const _0x13eba7=((async()=>{const _0x498297=_0x1e9fc7;_0x2c2962(_0x4bf859,_0x557ef2[_0x498297(0x1d1)]);const _0x588585=generateDeterministicJourneySegmentName(_0x29bf6b[_0x498297(0x17c)][_0x498297(0x1c9)],_0x4bf859),_0x4dbf8c=_0x494ac9[_0x498297(0x172)][_0x498297(0x17e)](_0x1789a3=>_0x1789a3[_0x498297(0x1c9)]===_0x588585),_0x2960d2=createSegmentIdResolver(_0x494ac9['segmentNameToId'],_0x4bf859),_0x3d24ee=await resolveRuleSegmentIds(_0x557ef2[_0x498297(0x1d1)],_0x2960d2);let _0x1b892d;return _0x4dbf8c?(await _0x39d999['segment'][_0x498297(0x1aa)](_0x5ae78e[_0x498297(0x180)],_0x4dbf8c['id'],{'description':_0x557ef2['description']||'Entry\x20criteria:\x20'+_0x4bf859,'rule':_0x2678d8(_0x3d24ee),'countPopulation':!![]}),_0x1b892d=_0x4dbf8c['id'],saveSegmentToPushRecovery(_0x29bf6b[_0x498297(0x21e)],_0x29bf6b[_0x498297(0x17c)][_0x498297(0x1c9)],_0x4bf859,{'segmentId':_0x1b892d,'uniqueServerName':_0x588585,'createdAt':new Date()[_0x498297(0x25b)]()})):_0x1b892d=await createOrRecoverEmbeddedSegment(_0x39d999,_0x29bf6b,{'localName':_0x4bf859,'uniqueSegmentName':_0x588585,'description':_0x557ef2[_0x498297(0x197)]||_0x498297(0x20a)+_0x4bf859,'journeyId':_0x572c20,'resolvedRule':_0x3d24ee,'parentId':_0x5ae78e['parentId'],'folderId':_0x5ae78e[_0x498297(0x1cc)]||''},_0x2678d8),_0x494ac9[_0x498297(0x187)][_0x498297(0x192)](_0x4bf859,_0x1b892d),_0x2a61d9['set'](_0x4bf859,_0x1b892d),_0x1b892d;})());_0x587ae3[_0x1e9fc7(0x192)](_0x4bf859,_0x13eba7);try{return await _0x13eba7;}finally{_0x587ae3[_0x1e9fc7(0x17b)](_0x4bf859);}},'resolveActivationId':async _0x3ccc2f=>{const _0x4a82aa=_0x2cddf4,_0x4bbc50=_0x335624[_0x4a82aa(0x1c7)](_0x3ccc2f);if(_0x4bbc50)return _0x4bbc50;if(_0x29bf6b[_0x4a82aa(0x1b9)]){await _0x4e8c65();const _0x5e7a56=_0x335624[_0x4a82aa(0x1c7)](_0x3ccc2f);if(_0x5e7a56)return _0x5e7a56;}throw new SDKError(ErrorCode[_0x4a82aa(0x18d)],'Activation\x20not\x20found:\x20'+_0x3ccc2f+_0x4a82aa(0x1d5)+_0x29bf6b[_0x4a82aa(0x17c)][_0x4a82aa(0x1c9)]+_0x4a82aa(0x1f9)+_0x4a82aa(0x17f));},'resolveEmbeddedActivationId':async(_0x2f8296,_0x3471b2)=>{const _0x1121ff=_0x2cddf4,_0x2bdef7=_0x335624[_0x1121ff(0x1c7)](_0x2f8296);if(_0x2bdef7)return _0x2bdef7;if(_0x29bf6b['isNew'])return _0x1685c8[_0x1121ff(0x192)](_0x2f8296,_0x3471b2),createPendingActivationId(_0x2f8296);if(_0x29bf6b[_0x1121ff(0x1b9)]){await _0x4e8c65();const _0x148e31=_0x335624[_0x1121ff(0x1c7)](_0x3471b2['name']);if(_0x148e31)return _0x335624[_0x1121ff(0x192)](_0x2f8296,_0x148e31),_0x148e31;const _0x435653=activationSignature(_0x3471b2),_0x11cee3=_0x180515?.[_0x1121ff(0x1c7)](_0x435653);if(_0x11cee3)return _0x335624[_0x1121ff(0x192)](_0x2f8296,_0x11cee3),_0x11cee3;const _0x4208ed=await _0x4c1e55(_0x3471b2,_0x494ac9[_0x1121ff(0x1f3)]),_0x37969b={..._0x4208ed,..._0x3471b2[_0x1121ff(0x194)]!==undefined&&{'runAfterJourneyRefresh':_0x3471b2[_0x1121ff(0x194)]}},_0x5e9984=await _0x39d999[_0x1121ff(0x249)]['createActivation'](_0x29bf6b[_0x1121ff(0x1b9)]['id'],_0x37969b);return _0x335624[_0x1121ff(0x192)](_0x2f8296,_0x5e9984['id']),_0x5e9984['id'];}throw new SDKError(ErrorCode[_0x1121ff(0x16b)],_0x1121ff(0x262));},'resolveJourneyId':async _0x41bb7c=>{const _0x96ff96=_0x2cddf4;try{return await _0x39d999[_0x96ff96(0x249)]['resolveJourneyId'](_0x5ae78e[_0x96ff96(0x180)],_0x41bb7c);}catch(_0x2eb93c){throw new SDKError(ErrorCode[_0x96ff96(0x18d)],_0x96ff96(0x1b7)+_0x41bb7c+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x29bf6b[_0x96ff96(0x17c)][_0x96ff96(0x1c9)]+'\x27)',_0x2eb93c);}},'resolveStageId':async(_0x33a4d5,_0x5845f3)=>{const _0x4f6cd6=_0x2cddf4,_0x24c73e=await _0x39d999[_0x4f6cd6(0x249)][_0x4f6cd6(0x1df)](_0x33a4d5),_0x4eeaaf=_0x24c73e[_0x4f6cd6(0x242)][_0x4f6cd6(0x23d)][_0x4f6cd6(0x17e)](_0x34c0ae=>_0x34c0ae[_0x4f6cd6(0x1c9)][_0x4f6cd6(0x18b)]()===_0x5845f3['toLowerCase']());if(!_0x4eeaaf?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x5845f3+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x24c73e[_0x4f6cd6(0x242)][_0x4f6cd6(0x21d)]||_0x24c73e[_0x4f6cd6(0x242)]['name'])+'\x27');return _0x4eeaaf['id'];}},_0x3510a7=await _0x395aba(_0x29bf6b[_0x2cddf4(0x17c)],_0x5ae78e[_0x2cddf4(0x180)],_0x2dd6ee),_0x39d42d=_0x5ae78e[_0x2cddf4(0x1b3)]||_0x5ae78e[_0x2cddf4(0x1cc)];_0x39d42d&&(_0x3510a7[_0x2cddf4(0x221)]={'parentFolder':{'data':{'id':_0x39d42d,'type':_0x2cddf4(0x215)}}});if(_0x29bf6b[_0x2cddf4(0x219)]){if(_0x52c88f['size']>0x0||_0x1685c8[_0x2cddf4(0x255)]>0x0)return await executeThreeStepJourneyCreate(_0x39d999,_0x29bf6b,_0x3510a7,{'pendingEmbeddedSegments':_0x52c88f,'pendingEmbeddedActivations':_0x1685c8,'embeddedSegmentNameToId':_0x2a61d9,'journeyActivationNameToId':_0x335624},{..._0x5ae78e,'effectiveFolderId':_0x39d42d},_0x494ac9,_0xaeca92,_0x5b2bc8);else{ensureJourneyDefaults(_0x3510a7['attributes']);const _0x47fab0=await _0x39d999[_0x2cddf4(0x249)][_0x2cddf4(0x21b)](_0x3510a7);return deletePushRecovery(_0x29bf6b['absolutePath']),{'action':'created','journeyId':_0x47fab0['id'],'embeddedSegmentNameToId':_0x2a61d9};}}else{if(_0x29bf6b[_0x2cddf4(0x23c)]&&_0x29bf6b[_0x2cddf4(0x1b9)]){_0x3510a7['id']=_0x29bf6b[_0x2cddf4(0x1b9)]['id'];const _0x2271ef=_0x3510a7[_0x2cddf4(0x242)];_0x29bf6b['existingJourney']['attributes']?.['journeyBundleName']&&(_0x2271ef[_0x2cddf4(0x21d)]=_0x29bf6b[_0x2cddf4(0x1b9)][_0x2cddf4(0x242)][_0x2cddf4(0x21d)]);const _0x4c505a=_0x29bf6b['existingJourney'][_0x2cddf4(0x242)]?.[_0x2cddf4(0x23d)];return _0x4c505a&&_0x3510a7['attributes'][_0x2cddf4(0x23d)]&&injectExistingStageIds(_0x3510a7[_0x2cddf4(0x242)][_0x2cddf4(0x23d)],_0x4c505a),ensureJourneyDefaults(_0x2271ef),await _0x39d999[_0x2cddf4(0x249)]['update'](_0x29bf6b[_0x2cddf4(0x1b9)]['id'],_0x3510a7),deletePushRecovery(_0x29bf6b[_0x2cddf4(0x21e)]),{'action':_0x2cddf4(0x1e5),'journeyId':_0x29bf6b[_0x2cddf4(0x1b9)]['id'],'embeddedSegmentNameToId':_0x2a61d9};}}return deletePushRecovery(_0x29bf6b['absolutePath']),{'action':_0x2cddf4(0x1b4),'journeyId':_0x29bf6b[_0x2cddf4(0x1b9)]?.['id'],'embeddedSegmentNameToId':_0x2a61d9};}function findSegmentCriteriaLocation(_0x45f6e2,_0x5cf4b9){const _0x359f70=a159_0x407fa0,_0x4f3808=_0x45f6e2[_0x359f70(0x21c)]||_0x45f6e2['journeys']?.[0x0]?.[_0x359f70(0x21c)]||[];let _0x45e238='entry',_0x55dabd=_0x5cf4b9;const _0x29152d=_0x45f6e2[_0x359f70(0x246)]||_0x45f6e2[_0x359f70(0x243)]?.[0x0]?.['goal'];if(_0x29152d?.[_0x359f70(0x179)]===_0x5cf4b9)return{'stageName':_0x359f70(0x246),'criteriaName':_0x29152d['name']||_0x5cf4b9};_0x53997f:for(const _0x4158e5 of _0x4f3808){if(_0x4158e5[_0x359f70(0x1fd)]?.[_0x359f70(0x179)]===_0x5cf4b9){_0x45e238=_0x4158e5[_0x359f70(0x1c9)],_0x55dabd=_0x4158e5[_0x359f70(0x1fd)][_0x359f70(0x1c9)]||_0x5cf4b9;break;}if(_0x4158e5['steps'])for(const _0x109261 of _0x4158e5[_0x359f70(0x217)]){if(_0x109261[_0x359f70(0x252)]===_0x359f70(0x199)&&_0x109261['with']?.[_0x359f70(0x214)])for(const _0x1899db of _0x109261[_0x359f70(0x204)][_0x359f70(0x214)]){if(_0x1899db[_0x359f70(0x179)]===_0x5cf4b9){_0x45e238=_0x4158e5[_0x359f70(0x1c9)],_0x55dabd=_0x1899db[_0x359f70(0x1c9)]||_0x5cf4b9;break _0x53997f;}}}}return{'stageName':_0x45e238,'criteriaName':_0x55dabd};}async function executeThreeStepJourneyCreate(_0x132772,_0x18f572,_0x257340,_0x589406,_0x5d146f,_0x251b7c,_0x301815,_0x2662d1){const _0x9745db=a159_0x407fa0,{activationDefToCreateRequest:_0x3f40cd,yamlRuleToApi:_0x46e310}=_0x2662d1,{pendingEmbeddedSegments:_0x29d090,pendingEmbeddedActivations:_0x159932,embeddedSegmentNameToId:_0x21da4a}=_0x589406,_0x524d2d=JSON[_0x9745db(0x254)](JSON['stringify'](_0x257340));ensureJourneyDefaults(_0x524d2d[_0x9745db(0x242)]),stripPendingIds(_0x524d2d);const _0x46769e=await _0x132772[_0x9745db(0x249)][_0x9745db(0x21b)](_0x524d2d),_0x270201=_0x46769e['id'],_0x58fc02=new Map();for(const _0x924ea9 of _0x46769e[_0x9745db(0x242)][_0x9745db(0x23d)]){_0x58fc02[_0x9745db(0x192)](_0x924ea9[_0x9745db(0x1c9)]['toLowerCase'](),_0x924ea9['id']);}recoverSegmentIdsFromPushRecovery(_0x18f572,_0x21da4a,_0x251b7c[_0x9745db(0x187)]);for(const [_0x1c5e0d,{definition:_0x5af4ee}]of _0x29d090){if(_0x21da4a[_0x9745db(0x18f)](_0x1c5e0d)){_0x301815[_0x9745db(0x19b)]?.({'type':'embedded_segment_created','journeyName':_0x18f572[_0x9745db(0x17c)][_0x9745db(0x1c9)],'segmentName':_0x1c5e0d});continue;}const _0x17f96e=generateDeterministicJourneySegmentName(_0x18f572[_0x9745db(0x17c)][_0x9745db(0x1c9)],_0x1c5e0d);_0x301815[_0x9745db(0x19b)]?.({'type':_0x9745db(0x1a5),'journeyName':_0x18f572[_0x9745db(0x17c)][_0x9745db(0x1c9)],'segmentName':_0x1c5e0d});const _0x27de34=createSegmentIdResolver(_0x251b7c[_0x9745db(0x187)],_0x1c5e0d),_0x4aa9c3=await resolveRuleSegmentIds(_0x5af4ee[_0x9745db(0x1d1)],_0x27de34),_0x2561dc=await createOrRecoverEmbeddedSegment(_0x132772,_0x18f572,{'localName':_0x1c5e0d,'uniqueSegmentName':_0x17f96e,'description':_0x5af4ee['description']||_0x9745db(0x20a)+_0x1c5e0d,'journeyId':_0x270201,'resolvedRule':_0x4aa9c3,'parentId':_0x5d146f[_0x9745db(0x180)],'folderId':_0x5d146f[_0x9745db(0x1b1)]||''},_0x46e310);_0x21da4a[_0x9745db(0x192)](_0x1c5e0d,_0x2561dc),_0x251b7c['segmentNameToId'][_0x9745db(0x192)](_0x1c5e0d,_0x2561dc),_0x301815['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x18f572[_0x9745db(0x17c)][_0x9745db(0x1c9)],'segmentName':_0x1c5e0d});}const _0x154550=new Map();for(const [_0x29f474,_0x25448e]of _0x159932){_0x301815['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x18f572[_0x9745db(0x17c)][_0x9745db(0x1c9)],'activationName':_0x29f474});const _0x11f51a=await _0x3f40cd(_0x25448e,_0x251b7c['activationContext']),_0x59f820={..._0x11f51a,..._0x25448e[_0x9745db(0x194)]!==undefined&&{'runAfterJourneyRefresh':_0x25448e[_0x9745db(0x194)]}},_0x152fdf=await _0x132772[_0x9745db(0x249)][_0x9745db(0x1bd)](_0x270201,_0x59f820);_0x154550['set'](_0x29f474,_0x152fdf['id']),_0x589406['journeyActivationNameToId'][_0x9745db(0x192)](_0x29f474,_0x152fdf['id']),_0x301815[_0x9745db(0x19b)]?.({'type':_0x9745db(0x1ed),'journeyName':_0x18f572['yamlConfig'][_0x9745db(0x1c9)],'activationName':_0x29f474});}const _0x42a06d=JSON['parse'](JSON[_0x9745db(0x1ff)](_0x257340));return _0x42a06d['id']=_0x270201,ensureJourneyDefaults(_0x42a06d['attributes']),resolvePendingIdsInRequest(_0x42a06d,_0x257340,_0x58fc02,_0x21da4a,_0x154550,_0x301815),await _0x132772[_0x9745db(0x249)][_0x9745db(0x24c)](_0x270201,_0x42a06d),deletePushRecovery(_0x18f572[_0x9745db(0x21e)]),{'action':_0x9745db(0x20d),'journeyId':_0x270201,'embeddedSegmentNameToId':_0x21da4a};}export function stripWaitStepPendingIds(_0x4384d0){const _0x5d43e0=a159_0x407fa0,_0xfc0da9=_0x4384d0[_0x5d43e0(0x202)]&&isPendingSegmentId(_0x4384d0[_0x5d43e0(0x202)]),_0x581c94=_0x4384d0[_0x5d43e0(0x268)]?.['some'](_0x4ef639=>_0x4ef639[_0x5d43e0(0x1d4)]&&isPendingSegmentId(_0x4ef639[_0x5d43e0(0x1d4)]));(_0xfc0da9||_0x581c94)&&(_0x4384d0[_0x5d43e0(0x216)]=_0x5d43e0(0x1e2),_0x4384d0[_0x5d43e0(0x182)]=0x1,_0x4384d0['waitStepUnit']=_0x5d43e0(0x251),delete _0x4384d0[_0x5d43e0(0x202)],delete _0x4384d0[_0x5d43e0(0x1c1)],delete _0x4384d0['conditionTimeoutUnit'],delete _0x4384d0['conditions']);}export function resolveWaitStepPendingIds(_0x399574,_0xf68413,_0x58eb47,_0x55f68c){const _0x378cf2=a159_0x407fa0;if(_0xf68413[_0x378cf2(0x202)]&&isPendingSegmentId(_0xf68413[_0x378cf2(0x202)])){const _0x5d287b=_0x58eb47(_0xf68413[_0x378cf2(0x202)],_0x378cf2(0x227)+_0x55f68c+_0x378cf2(0x1bb));_0x5d287b&&(_0x399574['waitStepType']=_0x378cf2(0x25f),_0x399574[_0x378cf2(0x202)]=_0x5d287b,delete _0x399574[_0x378cf2(0x182)],delete _0x399574['waitStepUnit'],_0xf68413[_0x378cf2(0x1c1)]!==undefined&&(_0x399574['conditionTimeoutDuration']=_0xf68413[_0x378cf2(0x1c1)]),_0xf68413[_0x378cf2(0x1f5)]&&(_0x399574[_0x378cf2(0x1f5)]=_0xf68413[_0x378cf2(0x1f5)]));}if(_0xf68413[_0x378cf2(0x268)]){const _0x2439a5=_0xf68413[_0x378cf2(0x268)]['some'](_0x398d58=>_0x398d58['segmentId']&&isPendingSegmentId(_0x398d58[_0x378cf2(0x1d4)]));if(_0x2439a5){const _0x50ef65=_0xf68413[_0x378cf2(0x268)]['map'](_0x3e9dfc=>{const _0xa13248=_0x378cf2;if(_0x3e9dfc[_0xa13248(0x1d4)]&&isPendingSegmentId(_0x3e9dfc[_0xa13248(0x1d4)])){const _0x19c3d4=_0x58eb47(_0x3e9dfc[_0xa13248(0x1d4)],_0xa13248(0x227)+_0x55f68c+'\x27\x20wait\x20condition');return{..._0x3e9dfc,'segmentId':_0x19c3d4||_0x3e9dfc['segmentId']};}return{..._0x3e9dfc};});_0x399574['waitStepType']=_0x378cf2(0x25f),_0x399574[_0x378cf2(0x268)]=_0x50ef65,delete _0x399574[_0x378cf2(0x182)],delete _0x399574[_0x378cf2(0x230)],delete _0x399574[_0x378cf2(0x202)],delete _0x399574[_0x378cf2(0x1c1)],delete _0x399574['conditionTimeoutUnit'];}}}function a159_0x3097(_0x5e84be,_0x132804){_0x5e84be=_0x5e84be-0x168;const _0x403ac6=a159_0x403a();let _0x309715=_0x403ac6[_0x5e84be];return _0x309715;}function stripPendingIds(_0xa72be1){const _0x4dd518=a159_0x407fa0;_0xa72be1[_0x4dd518(0x242)][_0x4dd518(0x246)]?.[_0x4dd518(0x1d4)]&&isPendingSegmentId(_0xa72be1[_0x4dd518(0x242)][_0x4dd518(0x246)]['segmentId'])&&delete _0xa72be1[_0x4dd518(0x242)][_0x4dd518(0x246)];for(const _0x4042de of _0xa72be1[_0x4dd518(0x242)][_0x4dd518(0x23d)]||[]){_0x4042de['entryCriteria']?.[_0x4dd518(0x1d4)]&&isPendingSegmentId(_0x4042de[_0x4dd518(0x1ee)][_0x4dd518(0x1d4)])&&delete _0x4042de[_0x4dd518(0x1ee)];_0x4042de[_0x4dd518(0x178)]?.[_0x4dd518(0x1d4)]&&isPendingSegmentId(_0x4042de[_0x4dd518(0x178)][_0x4dd518(0x1d4)])&&delete _0x4042de['milestone'];_0x4042de[_0x4dd518(0x22e)]&&(_0x4042de[_0x4dd518(0x22e)]=_0x4042de[_0x4dd518(0x22e)][_0x4dd518(0x1ce)](_0x2b61eb=>!_0x2b61eb[_0x4dd518(0x1d4)]||!isPendingSegmentId(_0x2b61eb[_0x4dd518(0x1d4)])));if(_0x4042de[_0x4dd518(0x217)])for(const _0x5415c1 of Object['keys'](_0x4042de[_0x4dd518(0x217)])){const _0x1b52b1=_0x4042de['steps'][_0x5415c1];_0x1b52b1['type']===_0x4dd518(0x1a3)&&_0x1b52b1['journeyActivationStepId']&&isPendingActivationId(_0x1b52b1['journeyActivationStepId'])&&(_0x1b52b1[_0x4dd518(0x1f4)]='');if(_0x1b52b1['type']===_0x4dd518(0x19c)&&_0x1b52b1['branches'])for(const _0x3975ff of _0x1b52b1[_0x4dd518(0x214)]){_0x3975ff[_0x4dd518(0x1d4)]&&isPendingSegmentId(_0x3975ff['segmentId'])&&(_0x3975ff['segmentId']='');}_0x1b52b1['type']===_0x4dd518(0x259)&&stripWaitStepPendingIds(_0x1b52b1);}}}function resolvePendingIdsInRequest(_0x242932,_0x56cd25,_0x54acce,_0x3dcc5e,_0x4000a7,_0x380a61){const _0x3694b5=a159_0x407fa0,_0x2b72fa=(_0x28bc6a,_0x42a665)=>{const _0xb0ad25=a159_0x3097;if(!isPendingSegmentId(_0x28bc6a))return _0x28bc6a;const _0x8d7d57=extractPendingSegmentName(_0x28bc6a),_0x420046=_0x3dcc5e[_0xb0ad25(0x1c7)](_0x8d7d57);return!_0x420046&&_0x380a61[_0xb0ad25(0x23b)]?.(_0xb0ad25(0x1f6)+_0x8d7d57+'\x27\x20for\x20'+_0x42a665),_0x420046;};if(_0x242932[_0x3694b5(0x242)]['goal']?.[_0x3694b5(0x1d4)]&&isPendingSegmentId(_0x242932[_0x3694b5(0x242)][_0x3694b5(0x246)][_0x3694b5(0x1d4)])){const _0x2b6c0f=_0x2b72fa(_0x242932[_0x3694b5(0x242)][_0x3694b5(0x246)]['segmentId'],_0x3694b5(0x19d));_0x2b6c0f&&(_0x242932['attributes'][_0x3694b5(0x246)][_0x3694b5(0x1d4)]=_0x2b6c0f);}for(const _0x25fbad of _0x242932[_0x3694b5(0x242)][_0x3694b5(0x23d)]||[]){const _0x29a4f4=_0x54acce[_0x3694b5(0x1c7)](_0x25fbad['name'][_0x3694b5(0x18b)]());_0x29a4f4&&(_0x25fbad['id']=_0x29a4f4);if(_0x25fbad[_0x3694b5(0x1ee)]?.['segmentId']&&isPendingSegmentId(_0x25fbad[_0x3694b5(0x1ee)][_0x3694b5(0x1d4)])){const _0x5ce34e=_0x2b72fa(_0x25fbad['entryCriteria']['segmentId'],'stage\x20\x27'+_0x25fbad['name']+_0x3694b5(0x186));_0x5ce34e&&(_0x25fbad[_0x3694b5(0x1ee)][_0x3694b5(0x1d4)]=_0x5ce34e);}if(_0x25fbad['exitCriterias'])for(const _0xbc08da of _0x25fbad[_0x3694b5(0x22e)]){if(_0xbc08da['segmentId']&&isPendingSegmentId(_0xbc08da[_0x3694b5(0x1d4)])){const _0x19f65a=_0x2b72fa(_0xbc08da['segmentId'],_0x3694b5(0x227)+_0x25fbad['name']+_0x3694b5(0x201));_0x19f65a&&(_0xbc08da['segmentId']=_0x19f65a);}}if(_0x25fbad[_0x3694b5(0x178)]?.[_0x3694b5(0x1d4)]&&isPendingSegmentId(_0x25fbad['milestone'][_0x3694b5(0x1d4)])){const _0x5a29f5=_0x2b72fa(_0x25fbad[_0x3694b5(0x178)]['segmentId'],'stage\x20\x27'+_0x25fbad['name']+_0x3694b5(0x256));_0x5a29f5&&(_0x25fbad[_0x3694b5(0x178)][_0x3694b5(0x1d4)]=_0x5a29f5);}if(_0x25fbad[_0x3694b5(0x217)]){const _0xe01d15=_0x10723c=>_0x56cd25[_0x3694b5(0x242)]['journeyStages']?.[_0x3694b5(0x17e)](_0x30c4e8=>_0x30c4e8[_0x3694b5(0x1c9)][_0x3694b5(0x18b)]()===_0x25fbad[_0x3694b5(0x1c9)][_0x3694b5(0x18b)]())?.['steps']?.[_0x10723c];for(const _0x271d0b of Object['keys'](_0x25fbad[_0x3694b5(0x217)])){const _0x4ac3fc=_0x25fbad[_0x3694b5(0x217)][_0x271d0b],_0x9348ce=_0xe01d15(_0x271d0b);if(_0x4ac3fc[_0x3694b5(0x252)]===_0x3694b5(0x1a3)&&_0x4ac3fc[_0x3694b5(0x1f4)]&&(isPendingActivationId(_0x4ac3fc[_0x3694b5(0x1f4)])||_0x4ac3fc[_0x3694b5(0x1f4)]==='')){if(_0x9348ce?.[_0x3694b5(0x1f4)]&&isPendingActivationId(_0x9348ce['journeyActivationStepId'])){const _0x35ddc3=extractPendingActivationName(_0x9348ce[_0x3694b5(0x1f4)]),_0x582148=_0x4000a7[_0x3694b5(0x1c7)](_0x35ddc3);_0x582148&&(_0x4ac3fc[_0x3694b5(0x1f4)]=_0x582148);}}if(_0x4ac3fc[_0x3694b5(0x252)]===_0x3694b5(0x19c)&&_0x4ac3fc[_0x3694b5(0x214)]&&_0x9348ce?.[_0x3694b5(0x214)])for(let _0x46b104=0x0;_0x46b104<_0x4ac3fc[_0x3694b5(0x214)][_0x3694b5(0x234)];_0x46b104++){const _0x2f81fc=_0x4ac3fc[_0x3694b5(0x214)][_0x46b104],_0x283c63=_0x9348ce[_0x3694b5(0x214)][_0x46b104];if(_0x283c63?.[_0x3694b5(0x1d4)]&&isPendingSegmentId(_0x283c63[_0x3694b5(0x1d4)])){const _0x5be2d2=_0x2b72fa(_0x283c63['segmentId'],_0x3694b5(0x227)+_0x25fbad[_0x3694b5(0x1c9)]+_0x3694b5(0x22f)+(_0x2f81fc[_0x3694b5(0x1c9)]||_0x46b104)+'\x27');_0x5be2d2&&(_0x2f81fc[_0x3694b5(0x1d4)]=_0x5be2d2);}}_0x4ac3fc['type']===_0x3694b5(0x259)&&_0x9348ce?.[_0x3694b5(0x252)]==='WaitStep'&&resolveWaitStepPendingIds(_0x4ac3fc,_0x9348ce,_0x2b72fa,_0x25fbad[_0x3694b5(0x1c9)]);}}}}
1
+ const a159_0x1187c8=a159_0x35a2;(function(_0x101547,_0x3d4b16){const _0x42b22d=a159_0x35a2,_0x39c0d0=_0x101547();while(!![]){try{const _0x4c4bb3=-parseInt(_0x42b22d(0x17e))/0x1*(parseInt(_0x42b22d(0x140))/0x2)+-parseInt(_0x42b22d(0xed))/0x3+-parseInt(_0x42b22d(0x141))/0x4+-parseInt(_0x42b22d(0xf5))/0x5*(parseInt(_0x42b22d(0x189))/0x6)+parseInt(_0x42b22d(0xf6))/0x7+-parseInt(_0x42b22d(0x130))/0x8*(parseInt(_0x42b22d(0xca))/0x9)+parseInt(_0x42b22d(0xbb))/0xa;if(_0x4c4bb3===_0x3d4b16)break;else _0x39c0d0['push'](_0x39c0d0['shift']());}catch(_0x5ac1d7){_0x39c0d0['push'](_0x39c0d0['shift']());}}}(a159_0x1c6d,0xa2e4d));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a159_0x1187c8(0x11d));export const PENDING_SEGMENT_PREFIX=a159_0x1187c8(0x99);export const PENDING_ACTIVATION_PREFIX='__pending_act_';function a159_0x1c6d(){const _0x172b62=['\x20journey\x20from\x20file:\x20','steps','Journey\x20\x27','SEGMENT_NOT_FOUND','getLatestJourneyId','conditionTimeoutDuration','skipSegments','Updating\x20segment\x20\x27','isArray','parentId','folder_created','\x27\x20entry\x20criteria','Failed\x20to\x20fetch\x20referenced\x20segment\x20','\x27\x20to\x20local\x20\x27','\x27\x20wait\x20condition','versionNumber','journeyStages','segments','dirname','hasChanges','Creating\x20activation\x20\x27','from','segment_created','../../utils/async.js','folderPath','onProgress','63408AgZtGi','Stage\x20\x27','results','day','deleted','yamlConfig','deleteSegment','goal\x20criteria','5ALUvyJ','5536629JphmvS','Failed\x20to\x20resolve\x20segment\x20','\x27\x20by\x20rule\x20content','has','relationships','add','journey_entry_criteria_','activationStepsById','hex','DecisionPoint','list','segment_deleted',').\x20','entry','embedded_segment_creating','existingSegments','journeyBundleId','startsWith','Duration','ACTIVATION_SYNTAX_ERROR','all_columns','getSegment\x20failed\x20for\x20','size','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','journeyId','Failed\x20to\x20resolve\x20activation\x20','./journey-yaml.js','existingJourney','connectionIdToNameMap','INTERNAL','Entry\x20criteria:\x20','segmentNameToId','uniqueSegmentName','activation_deleting','withProgress','JOURNEY_SYNTAX_ERROR','resolveSegment','listActivations','journeyActivationStepId','tdx.sdk.push-workflow','includes','SEGMENT_UPDATE_ERROR','segment','SEGMENT_SYNTAX_ERROR','activation_updating','existingSegment','notification','stage\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','find','toLowerCase','segment_creating','logSuccess','./child-segment-yaml.js','waitStepUnit','activationParams','rule','rootFolderId','221944bALmIq','segment_updated','journeyById','Deleting\x20activation\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Condition','length','Updated\x20activation\x20\x27','conditionTimeoutUnit','relative','Segment\x20not\x20found:\x20','toString','journeyName','run_after_journey_refresh','activation_template_id','\x27\x20decision\x20point\x20branch\x20\x27','2ScQcyU','3072836Xdppnk','\x20(referenced\x20in\x20journey\x20','deleteActivation','Created\x20folder\x20\x27','journey_creating','branches','draft','activation_updated','resolveJourneyId','folder','schedule','index','journey_updated','parentSegmentFolder','debug','\x27...','create','exitCriterias','Created\x20journey\x20\x27','createdSegmentId','updateSegmentById','deps','match','filter','journey_updating','idToName','sha1','getJourney','logInfo','connector_config','sort','split','stages','Creating\x20folder\x20\x27','entries','Matched\x20server\x20segment\x20\x27','fetchJourney','absolutePath','Segment\x20not\x20found','embedded_segment_created','JOURNEY_UPDATE_ERROR','diff','conditions','activationActions','journeyBundleName','get','ACTIVATION_UPDATE_ERROR','Creating\x20segment\x20\x27','activationContext','createJourneySegment',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','waitStep','stringify','unchanged','item','errors','createdSegmentIds','user','utf-8','getSegmentEntity\x20also\x20failed\x20for\x20','slice','161561pgClbD','replace','null','values','\x27\x20from\x20file:\x20','journey_created','valid','segmentId','description','join','keys','168186qSuSgz','attributes','resolvedRule','yamlActivation','entryCriteria','Updating\x20activation\x20\x27','journeys','digest','Deleted\x20activation\x20\x27','Name\x20has\x20already\x20been\x20taken','logDeleted','folderId','\x20error(s)','isNew','progress','):\x20','update','max','\x0a\x20\x20','push','journey','__pending_','Activation','trim','activation_deleted','getActivation','parseDocument','entry_criteria','embeddedSegmentNameToId','embedded_activation_creating','conditionSegmentId','connection','goal','name','getSegment','all','NOT_FOUND','embedded_activation_created','waitStepType','behavior','WaitStep','validatedRequest','created','columns','activationsBySegmentId','segment_deleting','parentFolder','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','journeyBundlesByFolderAndName','folderPathToId','uniqueServerName','Created\x20segment\x20\x27','Activation\x20not\x20found:\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','localName','13823200rXJLKO','segmentFolderId','map','Failed\x20to\x20','parse','createActivation','activation_','nameToType','existingActivation','\x20segment\x20from\x20file:\x20','activations','delete','Created\x20activation\x20\x27','createFolder','folder_creating','171RzSWgg','updated','set','idToEmailMap','milestone','action','type','Fetching\x20','data'];a159_0x1c6d=function(){return _0x172b62;};return a159_0x1c6d();}export function createPendingSegmentId(_0xb44e85){return''+PENDING_SEGMENT_PREFIX+_0xb44e85+'__';}export function isPendingSegmentId(_0x4e34d7){const _0x5aae06=a159_0x1187c8;return _0x4e34d7[_0x5aae06(0x107)](PENDING_SEGMENT_PREFIX)&&!_0x4e34d7[_0x5aae06(0x107)](PENDING_ACTIVATION_PREFIX);}function a159_0x35a2(_0x1fe239,_0x4d16e7){_0x1fe239=_0x1fe239-0x87;const _0x1c6d2a=a159_0x1c6d();let _0x35a21e=_0x1c6d2a[_0x1fe239];return _0x35a21e;}export function extractPendingSegmentName(_0x2f9ad3){const _0x65bbb8=a159_0x1187c8;return _0x2f9ad3[_0x65bbb8(0x17f)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x6188af){return''+PENDING_ACTIVATION_PREFIX+_0x6188af+'__';}export function isPendingActivationId(_0xc9f347){return _0xc9f347['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5e8dc8){const _0x18a467=a159_0x1187c8;return _0x5e8dc8[_0x18a467(0x17f)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x492f06,_0x173277){const _0x1fc5a1=a159_0x1187c8,_0x1cf688=_0x492f06+'::'+(_0x173277[_0x1fc5a1(0x9b)]()||_0x1fc5a1(0x120)),_0x31ec24=createHash(_0x1fc5a1(0x15b))[_0x1fc5a1(0x94)](_0x1cf688)[_0x1fc5a1(0x8b)](_0x1fc5a1(0xfe))[_0x1fc5a1(0x17d)](0x0,0xc);return _0x1fc5a1(0xfc)+_0x31ec24;}export function ensureJourneyDefaults(_0x2b2d56){const _0x81dd15=a159_0x1187c8;!_0x2b2d56['description']&&(_0x2b2d56[_0x81dd15(0x186)]=''),!_0x2b2d56['state']&&(_0x2b2d56['state']=_0x81dd15(0x147));}export function injectExistingStageIds(_0x170c2b,_0xa994ec){const _0x296b44=a159_0x1187c8,_0x17a3a3=new Map(_0xa994ec[_0x296b44(0xbd)](_0x44ff64=>[_0x44ff64[_0x296b44(0xa5)],_0x44ff64['id']]));for(const _0x5190fa of _0x170c2b){if(!_0x5190fa['id']){const _0x7e262c=_0x17a3a3[_0x296b44(0x16e)](_0x5190fa['name']);_0x7e262c&&(_0x5190fa['id']=_0x7e262c);}}}export function resolveTDFolderPath(_0x55f6c9,_0x68f74e,_0x52436a){const _0x1acb9f=a159_0x1187c8;if(!_0x68f74e)return _0x55f6c9;if(_0x55f6c9===_0x52436a||_0x55f6c9[_0x1acb9f(0x107)](_0x52436a+'/'))return _0x55f6c9;return _0x55f6c9?_0x52436a+'/'+_0x55f6c9:_0x52436a;}export function addFoldersToCreate(_0x4ace33,_0x37c79f,_0x179abe){const _0x38acef=a159_0x1187c8;if(!_0x4ace33)return;if(_0x37c79f[_0x38acef(0xf9)](_0x4ace33))return;const _0x5be7a9=_0x4ace33[_0x38acef(0x160)]('/');let _0x54959a='';for(const _0x14f1b3 of _0x5be7a9){_0x54959a=_0x54959a?_0x54959a+'/'+_0x14f1b3:_0x14f1b3,!_0x37c79f[_0x38acef(0xf9)](_0x54959a)&&_0x179abe[_0x38acef(0xfb)](_0x54959a);}}export function sortFoldersByDepth(_0x4ff5ba){return[..._0x4ff5ba]['sort']((_0x40a38e,_0x284833)=>{const _0x247db3=a159_0x35a2,_0x23782e=(_0x40a38e[_0x247db3(0x157)](/\//g)||[])[_0x247db3(0x136)],_0x27364c=(_0x284833[_0x247db3(0x157)](/\//g)||[])['length'];return _0x23782e-_0x27364c;});}import*as a159_0x674282 from'yaml';import{readFileSync}from'fs';import a159_0x4ef545 from'path';import{isJourneyDef,parseYamlString as a159_0x29057a,toYamlString as a159_0x164755,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(_0x184fed){const _0xbc5a8a=a159_0x1187c8;if(Array[_0xbc5a8a(0xdb)](_0x184fed))return'['+_0x184fed[_0xbc5a8a(0xbd)](_0x43bff7=>stableStringify(_0x43bff7))[_0xbc5a8a(0x187)](',')+']';if(_0x184fed&&typeof _0x184fed==='object'){const _0x130943=_0x184fed,_0x3e48d7=Object[_0xbc5a8a(0x188)](_0x130943)['sort'](),_0x4121e1=_0x3e48d7[_0xbc5a8a(0xbd)](_0x39d05b=>'\x22'+_0x39d05b+'\x22:'+stableStringify(_0x130943[_0x39d05b]));return'{'+_0x4121e1[_0xbc5a8a(0x187)](',')+'}';}const _0x49e75d=JSON['stringify'](_0x184fed);return _0x49e75d===undefined?_0xbc5a8a(0x180):_0x49e75d;}function activationSignature(_0x133ec5){const _0x5e1ab0=a159_0x1187c8,_0x3c99cd={'connection':_0x133ec5[_0x5e1ab0(0xa3)],..._0x133ec5[_0x5e1ab0(0x10a)]!==undefined&&{'all_columns':_0x133ec5[_0x5e1ab0(0x10a)]},..._0x133ec5[_0x5e1ab0(0xaf)]!==undefined&&{'columns':_0x133ec5[_0x5e1ab0(0xaf)]},..._0x133ec5[_0x5e1ab0(0xab)]!==undefined&&{'behavior':_0x133ec5[_0x5e1ab0(0xab)]},..._0x133ec5[_0x5e1ab0(0x14b)]!==undefined&&{'schedule':_0x133ec5[_0x5e1ab0(0x14b)]},..._0x133ec5['notification']!==undefined&&{'notification':_0x133ec5[_0x5e1ab0(0x124)]},..._0x133ec5[_0x5e1ab0(0x15e)]!==undefined&&{'connector_config':_0x133ec5[_0x5e1ab0(0x15e)]},..._0x133ec5[_0x5e1ab0(0x13e)]!==undefined&&{'activation_template_id':_0x133ec5[_0x5e1ab0(0x13e)]}};return stableStringify(_0x3c99cd);}async function fetchSegment(_0x4c9253,_0x74c365,_0xd0b745,_0x22e32c){const _0x356744=a159_0x1187c8,_0xcd2e98=_0x22e32c?.['find'](_0x457b90=>_0x457b90['id']===_0xd0b745);if(_0xcd2e98)return _0xcd2e98;try{return await _0x4c9253[_0x356744(0x120)][_0x356744(0xa6)](_0x74c365,_0xd0b745);}catch(_0x4018d0){logger['debug'](_0x356744(0x10b)+_0xd0b745+_0x356744(0x173)+_0x4018d0);try{return await _0x4c9253[_0x356744(0x120)]['getSegmentEntity'](_0xd0b745);}catch(_0x530b8b){return logger[_0x356744(0x14f)](_0x356744(0x17c)+_0xd0b745+':\x20'+_0x530b8b),null;}}}function recoverSegmentIdsFromPushRecovery(_0x489554,_0x50d4b0,_0xd3fcbf){const _0x1f57da=a159_0x1187c8,_0x2be1bb=readPushRecovery(_0x489554[_0x1f57da(0x166)]);if(_0x2be1bb?.[_0x1f57da(0x13c)]===_0x489554[_0x1f57da(0xf2)][_0x1f57da(0xa5)])for(const [_0x5baf2e,_0x3631fb]of Object[_0x1f57da(0x163)](_0x2be1bb[_0x1f57da(0xe4)])){const _0x4b5abe=generateDeterministicJourneySegmentName(_0x489554[_0x1f57da(0xf2)]['name'],_0x5baf2e);_0x3631fb[_0x1f57da(0xb6)]===_0x4b5abe&&(_0x50d4b0[_0x1f57da(0xcc)](_0x5baf2e,_0x3631fb[_0x1f57da(0x185)]),_0xd3fcbf[_0x1f57da(0xcc)](_0x5baf2e,_0x3631fb['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x5ce824,_0x5a3f91,_0xf1613b,_0x5f0ac1){const _0x568c9b=a159_0x1187c8;let _0x12df31;try{_0x12df31=await _0x5ce824[_0x568c9b(0x120)][_0x568c9b(0x172)]({'name':_0xf1613b[_0x568c9b(0x116)],'description':_0xf1613b[_0x568c9b(0x186)],'journeyId':_0xf1613b['journeyId'],'rule':_0x5f0ac1(_0xf1613b[_0x568c9b(0x18b)],!![]),'countPopulation':!![],'parentFolderId':_0xf1613b['folderId'],'audienceId':_0xf1613b[_0x568c9b(0xdc)]});}catch(_0x49bd96){const _0x2e1059=_0x49bd96 instanceof Error&&_0x49bd96['message'][_0x568c9b(0x11e)](_0x568c9b(0x8d));if(_0x2e1059){const _0x5643f8=readPushRecovery(_0x5a3f91[_0x568c9b(0x166)]),_0x3cca04=_0x5643f8?.[_0x568c9b(0x13c)]===_0x5a3f91['yamlConfig'][_0x568c9b(0xa5)]?_0x5643f8['segments'][_0xf1613b[_0x568c9b(0xba)]]:undefined;if(_0x3cca04?.[_0x568c9b(0xb6)]===_0xf1613b[_0x568c9b(0x116)])await _0x5ce824[_0x568c9b(0x120)][_0x568c9b(0x155)](_0xf1613b[_0x568c9b(0xdc)],_0x3cca04[_0x568c9b(0x185)],{'description':_0xf1613b[_0x568c9b(0x186)],'rule':_0x5f0ac1(_0xf1613b[_0x568c9b(0x18b)],!![]),'countPopulation':!![]}),_0x12df31=_0x3cca04['segmentId'];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0xf1613b[_0x568c9b(0xba)]+_0x568c9b(0x10d)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x5a3f91['absolutePath'][_0x568c9b(0x17f)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x49bd96);}else throw _0x49bd96;}return saveSegmentToPushRecovery(_0x5a3f91[_0x568c9b(0x166)],_0x5a3f91['yamlConfig'][_0x568c9b(0xa5)],_0xf1613b['localName'],{'segmentId':_0x12df31,'uniqueServerName':_0xf1613b['uniqueSegmentName'],'createdAt':new Date()['toISOString']()}),_0x12df31;}export async function prepareSegmentFiles(_0x15e25f,_0x1478b5,_0x125931,_0x2bfd03,_0x398f42){const _0x3894bd=a159_0x1187c8,{activationDefToCreateRequest:_0x2da313}=await import(_0x3894bd(0x12b)),_0x100025=[],_0x57b6c6=new Set();for(const {yamlConfig:_0x4f20cb,folderPath:_0x4e1e1c,sourcePath:_0x27f64d}of _0x15e25f){const _0x314c91=resolveTDFolderPath(_0x4e1e1c,_0x2bfd03,_0x398f42),_0x3f6cbe=_0x314c91+':'+_0x4f20cb[_0x3894bd(0xa5)],_0x475138=_0x1478b5['segmentByFolderAndName'][_0x3894bd(0x16e)](_0x3f6cbe),_0x4e4cf4=_0x475138?_0x1478b5[_0x3894bd(0xb0)]['get'](_0x475138['id'])||[]:[];addFoldersToCreate(_0x314c91,_0x1478b5[_0x3894bd(0xb5)],_0x57b6c6);const _0x36fc9d=calculateActivationActions(_0x4f20cb['activations']||[],_0x4e4cf4,_0x1478b5['idToEmailMap'],_0x1478b5[_0x3894bd(0x112)]);for(const _0xb40994 of _0x36fc9d){(_0xb40994[_0x3894bd(0xd0)]===_0x3894bd(0x151)||_0xb40994['type']===_0x3894bd(0x94))&&_0xb40994[_0x3894bd(0x87)]&&(_0xb40994[_0x3894bd(0xad)]=await _0x2da313(_0xb40994[_0x3894bd(0x87)],_0x125931));}const _0x553d7e=calculateSegmentDiff(_0x4f20cb,_0x475138,_0x4e4cf4,_0x1478b5[_0x3894bd(0xcd)],_0x1478b5[_0x3894bd(0x112)]);_0x100025['push']({'relativePath':_0x4f20cb[_0x3894bd(0xa5)],'absolutePath':_0x27f64d,'yamlConfig':_0x4f20cb,'folderPath':_0x314c91,'existingSegment':_0x475138,'existingActivations':_0x4e4cf4,'isNew':_0x553d7e[_0x3894bd(0x91)],'hasChanges':_0x553d7e[_0x3894bd(0xe6)],'diff':_0x553d7e[_0x3894bd(0x16a)],'activationActions':_0x36fc9d});}return{'segmentFiles':_0x100025,'foldersToCreate':_0x57b6c6};}export async function prepareJourneyFiles(_0x3fde0d,_0x12a96d,_0x232d87,_0xafdbd3){const _0x45a777=a159_0x1187c8,_0x3343ac=[],_0x2956e1=new Set();for(const {yamlConfig:_0x1768e9,folderPath:_0x105585,sourcePath:_0x2ea9c5}of _0x3fde0d){const _0x1d2c6d=resolveTDFolderPath(_0x105585,_0x232d87,_0xafdbd3),_0x4e8337=_0x1d2c6d+':'+_0x1768e9[_0x45a777(0xa5)],_0x508903=_0x12a96d[_0x45a777(0xb4)][_0x45a777(0x16e)](_0x4e8337);let _0x6df062,_0x270a7b;if(_0x508903&&_0x508903['length']>0x0){const _0x3885a9=buildLocalExpandedRuleMappings(_0x1768e9),{createYamlContext:_0x315e9b,prefetchJourneySegments:_0x439d2e}=createPushYamlContextForBundle(_0x12a96d[_0x45a777(0x156)],_0x12a96d[_0x45a777(0xdc)],_0x12a96d[_0x45a777(0x105)],_0x3885a9,_0x12a96d[_0x45a777(0xcd)],_0x12a96d[_0x45a777(0x112)],_0x12a96d[_0x45a777(0xfd)],_0x12a96d[_0x45a777(0x132)]);await _0x439d2e(_0x508903[_0x45a777(0xbd)](_0x159323=>_0x159323['id']));const _0x5d03bd=await _0x12a96d[_0x45a777(0x156)][_0x45a777(0x98)][_0x45a777(0xd7)](_0x508903[0x0][_0x45a777(0x106)]),_0x388c62=hasMultipleVersions(_0x1768e9),_0x1381c6=async _0x325b61=>{const _0x274259=_0x45a777,_0x2ee838=_0x12a96d[_0x274259(0x132)]?.['get'](_0x325b61);if(_0x2ee838)return _0x2ee838;return _0x12a96d[_0x274259(0x165)]({'journeyId':_0x325b61,'journeyName':_0x1768e9[_0x274259(0xa5)],'isMultiVersion':_0x508903[_0x274259(0x136)]>0x1});};if(_0x388c62&&_0x508903[_0x45a777(0x136)]>0x1){const _0x57d380=[];for(const _0x4aa674 of _0x508903){const _0x40233c=_0x4aa674[_0x45a777(0xe2)]||0x1;_0x12a96d[_0x45a777(0x92)]?.[_0x45a777(0x94)](_0x45a777(0xd1)+_0x1768e9['name']+'\x20v'+_0x40233c);const _0x24c496=await _0x1381c6(_0x4aa674['id']),_0x16cc3e=_0x315e9b(_0x4aa674['id']),_0x1b336d=await journeyResponseToDef(_0x24c496,_0x16cc3e);_0x57d380['push']({'item':_0x4aa674,'yaml':_0x1b336d});}const _0x2638ed=buildLocalRuleToNameMappingFromJourney(_0x1768e9);_0x270a7b=buildMergedJourneyDef(_0x57d380,_0x2638ed,_0x5d03bd);const _0x4fe503=Math[_0x45a777(0x95)](..._0x57d380['map'](_0x374bde=>_0x374bde[_0x45a777(0x177)][_0x45a777(0xe2)]||0x0)),_0xc7d83c=_0x508903[_0x45a777(0x127)](_0x3b8e6b=>(_0x3b8e6b[_0x45a777(0xe2)]||0x0)===_0x4fe503);_0xc7d83c&&(_0x12a96d['progress']?.[_0x45a777(0x94)](_0x45a777(0xd1)+_0x1768e9[_0x45a777(0xa5)]+'\x20v'+_0x4fe503),_0x6df062=await _0x1381c6(_0xc7d83c['id']));}else{const _0x42d850=_0x508903[_0x508903[_0x45a777(0x136)]-0x1];_0x12a96d['progress']?.[_0x45a777(0x94)](_0x45a777(0xd1)+_0x1768e9[_0x45a777(0xa5)]),_0x6df062=await _0x1381c6(_0x42d850['id']);const _0x5d351d=_0x315e9b(_0x42d850['id']),_0x342fb7=await journeyResponseToDef(_0x6df062,_0x5d351d),_0x546d=buildLocalRuleToNameMappingFromJourney(_0x1768e9);_0x270a7b=buildMergedJourneyDef([{'item':_0x42d850,'yaml':_0x342fb7}],_0x546d,_0x5d03bd);}}addFoldersToCreate(_0x1d2c6d,_0x12a96d[_0x45a777(0xb5)],_0x2956e1);const _0x3b2245=calculateJourneyDiff(_0x1768e9,_0x270a7b);_0x3343ac[_0x45a777(0x97)]({'relativePath':_0x1768e9['name'],'absolutePath':_0x2ea9c5,'yamlConfig':_0x1768e9,'folderPath':_0x1d2c6d,'existingJourney':_0x6df062,'isNew':_0x3b2245[_0x45a777(0x91)],'hasChanges':_0x3b2245[_0x45a777(0xe6)],'diff':_0x3b2245[_0x45a777(0x16a)]});}return{'journeyFiles':_0x3343ac,'foldersToCreate':_0x2956e1};}export function calculateActivationActions(_0x1e2e27,_0x5dd7bb,_0xc35b91,_0x57e4fe){const _0x183227=a159_0x1187c8,_0x41fd99=[],_0x5fc8fd=new Map();for(const _0x8d9493 of _0x5dd7bb){_0x5fc8fd['set'](_0x8d9493[_0x183227(0xa5)],_0x8d9493);}const _0xbb6318=new Map();for(const _0x44efda of _0x1e2e27){_0xbb6318[_0x183227(0xcc)](_0x44efda['name'],_0x44efda);}for(const _0x1f260e of _0x1e2e27){const _0x470771=_0x5fc8fd['get'](_0x1f260e[_0x183227(0xa5)]);if(!_0x470771)_0x41fd99[_0x183227(0x97)]({'type':_0x183227(0x151),'name':_0x1f260e[_0x183227(0xa5)],'yamlActivation':_0x1f260e});else{const _0x62216c=activationResponseToDef(_0x470771,_0xc35b91,_0x57e4fe),_0x583695=a159_0x674282['stringify'](_0x62216c),_0x484767=a159_0x674282['stringify'](_0x1f260e);_0x583695!==_0x484767&&_0x41fd99[_0x183227(0x97)]({'type':_0x183227(0x94),'name':_0x1f260e[_0x183227(0xa5)],'yamlActivation':_0x1f260e,'existingActivation':_0x470771});}}for(const _0x2ad389 of _0x5dd7bb){!_0xbb6318[_0x183227(0xf9)](_0x2ad389[_0x183227(0xa5)])&&_0x41fd99[_0x183227(0x97)]({'type':_0x183227(0xc6),'name':_0x2ad389[_0x183227(0xa5)],'existingActivation':_0x2ad389});}return _0x41fd99;}function calculateYamlDiff(_0x443c0e,_0x2d2287){if(_0x2d2287){const _0x60e1ff=generateDiff(_0x2d2287,_0x443c0e),_0x14ded0=hasChanges(_0x60e1ff);return{'isNew':![],'hasChanges':_0x14ded0,'diff':_0x14ded0?formatDiffWithColors(_0x60e1ff):undefined};}const _0x4253db=generateDiff('',_0x443c0e);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4253db)};}export function calculateSegmentDiff(_0x5a4936,_0x386275,_0x56f61c,_0x36cb1d,_0x182226){const _0x356ed3=segmentToYamlString(_0x5a4936),_0x1d8208=_0x386275?segmentToYamlString(segmentWithActivationsToYaml(_0x386275,_0x56f61c,undefined,_0x36cb1d,_0x182226)):undefined;return calculateYamlDiff(_0x356ed3,_0x1d8208);}export function calculateJourneyDiff(_0x4603b4,_0x941e53){const _0x208c0b=normalizeJourneyDef(_0x4603b4,_0x4603b4),_0x2b25b9=a159_0x164755(_0x208c0b),_0x41c716=_0x941e53?a159_0x164755(normalizeJourneyDef(_0x941e53,_0x4603b4)):undefined;return calculateYamlDiff(_0x2b25b9,_0x41c716);}export function findSegmentsToDelete(_0x22a59f,_0x51ed0e,_0x35fb64,_0x657404,_0x15e511){const _0x5c6601=new Set();for(const {yamlConfig:_0x5eaf18,folderPath:_0x77dd9b}of _0x51ed0e){_0x5c6601['add'](_0x77dd9b+':'+_0x5eaf18['name']);}return _0x22a59f['filter'](_0x46b33a=>{const _0x164ebd=a159_0x35a2,_0x5b564b=_0x46b33a['segmentFolderId']?_0x35fb64[_0x164ebd(0x16e)](_0x46b33a[_0x164ebd(0xbc)][_0x164ebd(0x13b)]())||'':'',_0x243458=_0x5b564b+':'+_0x46b33a['name'];if(_0x5c6601[_0x164ebd(0xf9)](_0x243458))return![];if(_0x15e511)return _0x5b564b===_0x657404||_0x5b564b[_0x164ebd(0x107)](_0x657404+'/');return!![];});}export function findJourneysToDelete(_0x27fd1e,_0x3bf093,_0x133b0e,_0x5cb1ca,_0x1bb1e4){const _0xb8dbd1=a159_0x1187c8,_0x262f8a=new Set();for(const {yamlConfig:_0x5a5cd2,folderPath:_0x14e82c}of _0x3bf093){_0x262f8a['add'](_0x14e82c+':'+_0x5a5cd2[_0xb8dbd1(0xa5)]);}return _0x27fd1e[_0xb8dbd1(0x158)](_0x156e07=>{const _0x29d8eb=_0xb8dbd1,_0x3ac938=_0x156e07[_0x29d8eb(0x8f)]?_0x133b0e['get'](_0x156e07[_0x29d8eb(0x8f)])||'':'',_0x1acb71=_0x3ac938+':'+_0x156e07[_0x29d8eb(0x16d)];if(_0x262f8a[_0x29d8eb(0xf9)](_0x1acb71))return![];if(_0x1bb1e4)return _0x3ac938===_0x5cb1ca||_0x3ac938['startsWith'](_0x5cb1ca+'/');return!![];});}export function buildSegmentLookupMap(_0x2017a8,_0x27d0ae){const _0x138fab=a159_0x1187c8,_0xc6db72=new Map();for(const _0x1bdbcc of _0x2017a8){const _0xc250a1=_0x1bdbcc['segmentFolderId']?_0x27d0ae[_0x138fab(0x16e)](_0x1bdbcc[_0x138fab(0xbc)][_0x138fab(0x13b)]())||'':'',_0x562fd6=_0xc250a1+':'+_0x1bdbcc[_0x138fab(0xa5)];_0xc6db72[_0x138fab(0xcc)](_0x562fd6,_0x1bdbcc);}return _0xc6db72;}export function buildSegmentNameToIdMap(_0x5b6840){const _0x3f0e8c=a159_0x1187c8,_0x1191a5=new Map();for(const _0x29cbbe of _0x5b6840){_0x1191a5[_0x3f0e8c(0xcc)](_0x29cbbe[_0x3f0e8c(0xa5)],_0x29cbbe['id']);}return _0x1191a5;}export function buildJourneyBundleLookupMap(_0x1103c2,_0x456359){const _0x78a794=a159_0x1187c8,_0x2fe3dd=new Map();for(const _0x3095ac of _0x1103c2){const _0x11c35c=_0x3095ac[_0x78a794(0x8f)]?_0x456359[_0x78a794(0x16e)](_0x3095ac[_0x78a794(0x8f)])||'':'',_0x2358a5=_0x11c35c+':'+_0x3095ac[_0x78a794(0x16d)];!_0x2fe3dd[_0x78a794(0xf9)](_0x2358a5)&&_0x2fe3dd[_0x78a794(0xcc)](_0x2358a5,[]),_0x2fe3dd[_0x78a794(0x16e)](_0x2358a5)[_0x78a794(0x97)](_0x3095ac);}for(const _0x37fc98 of _0x2fe3dd[_0x78a794(0x181)]()){_0x37fc98['sort']((_0x866cfc,_0x50afae)=>(_0x866cfc[_0x78a794(0xe2)]||0x0)-(_0x50afae['versionNumber']||0x0));}return _0x2fe3dd;}export function collectFoldersToCreate(_0x239552,_0x1d7a00){const _0x2301ee=a159_0x1187c8,_0xdf1478=new Set();for(const _0x19621a of _0x239552){if(!_0x19621a)continue;if(_0x1d7a00[_0x2301ee(0xf9)](_0x19621a))continue;const _0x37f99c=_0x19621a[_0x2301ee(0x160)]('/');let _0xc3729e='';for(const _0x5effd8 of _0x37f99c){_0xc3729e=_0xc3729e?_0xc3729e+'/'+_0x5effd8:_0x5effd8,!_0x1d7a00['has'](_0xc3729e)&&_0xdf1478[_0x2301ee(0xfb)](_0xc3729e);}}return _0xdf1478;}export function parseAndClassifyYamlFiles(_0x223fa7,_0x1715e9,_0x4d243a){const _0x2883ed=a159_0x1187c8,_0x17cc21=[],_0x2313d9=[];for(const _0x154db0 of _0x223fa7){const _0x5142b7=a159_0x4ef545[_0x2883ed(0x139)](_0x1715e9,a159_0x4ef545[_0x2883ed(0xe5)](_0x154db0)),_0x31383b=_0x5142b7==='.'?'':_0x5142b7['replace'](/\\/g,'/'),_0x10ee54=readFileSync(_0x154db0,_0x2883ed(0x17b)),_0xd39954=a159_0x674282[_0x2883ed(0xbf)](_0x10ee54);if(isJourneyDef(_0xd39954,_0x154db0)){const _0x23eeae=a159_0x29057a(_0x10ee54);_0x2313d9[_0x2883ed(0x97)]({'yamlConfig':_0x23eeae,'folderPath':_0x31383b,'sourcePath':_0x154db0});}else{if(!_0x4d243a?.[_0x2883ed(0xd9)]){const _0x31536a=parseSegmentYamlFile(_0x10ee54),_0x376121=normalizeChildSegmentYaml(_0x31536a);_0x17cc21[_0x2883ed(0x97)]({'yamlConfig':_0x376121,'folderPath':_0x31383b,'sourcePath':_0x154db0});}}}return{'segments':_0x17cc21,'journeys':_0x2313d9};}export function validateParsedFiles(_0x2b9c26,_0x53a7be){const _0x3aef1f=a159_0x1187c8,_0x2e3c81=[];for(const {yamlConfig:_0xf7fa24,sourcePath:_0x9b2c2}of _0x2b9c26[_0x3aef1f(0xe4)]){const _0x14a4e2=readFileSync(_0x9b2c2,_0x3aef1f(0x17b)),_0x4cad8e=a159_0x674282[_0x3aef1f(0x9e)](_0x14a4e2),_0x18b850=validateSegmentDef(_0xf7fa24,{'source':_0x14a4e2,'document':_0x4cad8e},{'skipSchema':!![]});if(!_0x18b850[_0x3aef1f(0x184)]){const _0x4cf512=a159_0x4ef545['relative'](_0x53a7be,_0x9b2c2);_0x2e3c81['push']({'filePath':_0x4cf512,'source':_0x14a4e2,'result':_0x18b850,'isJourney':![]});}}for(const {yamlConfig:_0x2937c7,sourcePath:_0x4f0f0f}of _0x2b9c26[_0x3aef1f(0x8a)]){const _0x2039d2=readFileSync(_0x4f0f0f,_0x3aef1f(0x17b)),_0x4c086b=a159_0x674282[_0x3aef1f(0x9e)](_0x2039d2),_0x398179=validateJourneyDef(_0x2937c7,{'source':_0x2039d2,'document':_0x4c086b},{'skipSchema':!![]});if(!_0x398179[_0x3aef1f(0x184)]){const _0x3324d7=a159_0x4ef545[_0x3aef1f(0x139)](_0x53a7be,_0x4f0f0f);_0x2e3c81[_0x3aef1f(0x97)]({'filePath':_0x3324d7,'source':_0x2039d2,'result':_0x398179,'isJourney':!![]});}}return _0x2e3c81;}export function formatValidationErrors(_0x354abb){const _0x3aece7=a159_0x1187c8,_0x4cb135=[];for(const {filePath:_0x4635b0,source:_0x318076,result:_0x46cbcf,isJourney:_0x547a68}of _0x354abb){const _0x5b640b=_0x547a68?_0x3aece7(0x98):_0x3aece7(0x120);_0x4cb135[_0x3aece7(0x97)]('\x0a'+_0x4635b0+'\x20('+_0x5b640b+_0x3aece7(0x93)+_0x46cbcf[_0x3aece7(0x178)][_0x3aece7(0x136)]+_0x3aece7(0x90)),_0x4cb135[_0x3aece7(0x97)](formatValidationResult(_0x46cbcf,_0x318076,_0x4635b0));}return _0x4cb135['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x239e41){const _0x120bcb=a159_0x1187c8,_0x423bc4=new Set(),_0x5a1c0e=new Map(),_0x3d3188=collectSegmentUsageCounts(_0x239e41);if(_0x239e41[_0x120bcb(0xe4)])for(const [_0x4df432,_0x2eb52a]of Object[_0x120bcb(0x163)](_0x239e41[_0x120bcb(0xe4)])){_0x423bc4[_0x120bcb(0xfb)](_0x4df432);if(_0x2eb52a['rule']){const _0x1af29a=yamlRuleToApi(_0x2eb52a[_0x120bcb(0x12e)]),_0x304f6e=apiRuleToYaml(_0x1af29a);_0x5a1c0e['set'](_0x4df432,_0x304f6e);}}const _0x202afa=new Map();let _0x5c479b=0x0;for(const [_0x30e7bb,_0x3b097b]of _0x5a1c0e){const _0x5b0ee7=serializeExpandedRule(_0x3b097b,_0x5a1c0e),_0x145f9a=_0x202afa[_0x120bcb(0x16e)](_0x5b0ee7)||[];_0x145f9a[_0x120bcb(0x97)]({'name':_0x30e7bb,'index':_0x5c479b}),_0x202afa[_0x120bcb(0xcc)](_0x5b0ee7,_0x145f9a),_0x5c479b++;}const _0x511099=new Map();for(const [_0xbf041a,_0x4aa4c6]of _0x202afa){const _0x4ebfe8=_0x4aa4c6[_0x120bcb(0x17d)]()[_0x120bcb(0x15f)]((_0x5d47f5,_0x99d892)=>{const _0x5d4dee=_0x120bcb,_0x3253f5=_0x3d3188[_0x5d4dee(0x16e)](_0x5d47f5[_0x5d4dee(0xa5)])||0x0,_0x2d4e71=_0x3d3188[_0x5d4dee(0x16e)](_0x99d892[_0x5d4dee(0xa5)])||0x0;if(_0x3253f5!==_0x2d4e71)return _0x2d4e71-_0x3253f5;return _0x5d47f5[_0x5d4dee(0x14c)]-_0x99d892['index'];})[_0x120bcb(0xbd)](_0x422173=>_0x422173[_0x120bcb(0xa5)]),_0x5cc507=[];for(const _0x92147b of _0x4ebfe8){const _0x55de0a=_0x3d3188['get'](_0x92147b)||0x0,_0x265bc8=Math['max'](_0x55de0a,0x1);for(let _0x9bf64a=0x0;_0x9bf64a<_0x265bc8;_0x9bf64a++){_0x5cc507['push'](_0x92147b);}}_0x511099['set'](_0xbf041a,_0x5cc507);}return{'existingLocalSegmentNames':_0x423bc4,'localSegmentRules':_0x5a1c0e,'localExpandedRuleToNames':_0x511099};}export function createSegmentIdResolver(_0x4d8d0a,_0x3cfe38){return async _0x928968=>{const _0x378665=a159_0x35a2,_0x1198b8=_0x4d8d0a['get'](_0x928968);if(!_0x1198b8)throw new SDKError(ErrorCode[_0x378665(0xd6)],_0x378665(0x13a)+_0x928968+_0x378665(0xb3)+_0x3cfe38+'\x27)');return _0x1198b8;};}export function extractRootFolderId(_0x1fded9){const _0x1b8bca=a159_0x1187c8;return _0x1fded9[_0x1b8bca(0xfa)]?.[_0x1b8bca(0x14e)]?.['data']?.['id']||_0x1fded9[_0x1b8bca(0xfa)]?.[_0x1b8bca(0xb2)]?.['data']?.['id'];}export function buildConnectionMaps(_0x236501){const _0x8f3a5d=a159_0x1187c8,_0x12767b=new Map(),_0x454bd2=new Map(),_0x254303=new Map();for(const _0x14ecce of _0x236501){_0x12767b[_0x8f3a5d(0xcc)](_0x14ecce[_0x8f3a5d(0xa5)],parseInt(_0x14ecce['id'],0xa)),_0x454bd2[_0x8f3a5d(0xcc)](_0x14ecce['id'],_0x14ecce[_0x8f3a5d(0xa5)]),_0x254303[_0x8f3a5d(0xcc)](_0x14ecce[_0x8f3a5d(0xa5)],_0x14ecce[_0x8f3a5d(0xd0)]);}return{'nameToId':_0x12767b,'idToName':_0x454bd2,'nameToType':_0x254303};}export function calculatePushStats(_0x45ad1e,_0x5b971f,_0x2d015e,_0x3d14df,_0x3426e3,_0x561f62,_0x2ee43c){const _0x13526b=a159_0x1187c8,_0x14fdb8=_0x45ad1e['filter'](_0x2985d6=>_0x2985d6[_0x13526b(0x91)]),_0x3c6b38=_0x45ad1e[_0x13526b(0x158)](_0x3d14ea=>!_0x3d14ea[_0x13526b(0x91)]&&_0x3d14ea['hasChanges']),_0xf42d9=_0x45ad1e[_0x13526b(0x158)](_0x28e225=>!_0x28e225[_0x13526b(0x91)]&&!_0x28e225[_0x13526b(0xe6)]),_0x5b746c=_0x561f62?_0x3d14df:[],_0x67572e=_0x5b971f[_0x13526b(0x158)](_0x1b4317=>_0x1b4317[_0x13526b(0x91)]),_0x31cb11=_0x5b971f[_0x13526b(0x158)](_0x2bf11c=>!_0x2bf11c[_0x13526b(0x91)]&&_0x2bf11c[_0x13526b(0xe6)]),_0x541d7c=_0x5b971f[_0x13526b(0x158)](_0x4ae164=>!_0x4ae164['isNew']&&!_0x4ae164[_0x13526b(0xe6)]),_0x4309b1=_0x561f62?_0x3426e3:[],_0x11734c=_0x45ad1e['flatMap'](_0x2adf6b=>_0x2adf6b[_0x13526b(0x16c)]),_0x1ae157=_0x11734c[_0x13526b(0x158)](_0x35babd=>_0x35babd[_0x13526b(0xd0)]==='create'),_0x2454ee=_0x11734c['filter'](_0x3b9392=>_0x3b9392[_0x13526b(0xd0)]==='update'),_0x4bc860=_0x11734c[_0x13526b(0x158)](_0x4e786d=>_0x4e786d[_0x13526b(0xd0)]===_0x13526b(0xc6)),_0x18eb0d=Array[_0x13526b(0xe8)](_0x2d015e)[_0x13526b(0x15f)](),_0x2fe995=_0x2ee43c?![]:_0x14fdb8['length']>0x0||_0x3c6b38[_0x13526b(0x136)]>0x0||_0x5b746c[_0x13526b(0x136)]>0x0,_0x25514f=_0x67572e[_0x13526b(0x136)]>0x0||_0x31cb11[_0x13526b(0x136)]>0x0||_0x4309b1['length']>0x0,_0x5c8cda=_0x2ee43c?![]:_0x11734c[_0x13526b(0x136)]>0x0,_0x5c07dc=_0x18eb0d[_0x13526b(0x136)]>0x0;return{'segments':{'new':_0x14fdb8,'changed':_0x3c6b38,'unchanged':_0xf42d9,'toDelete':_0x5b746c},'journeys':{'new':_0x67572e,'changed':_0x31cb11,'unchanged':_0x541d7c,'toDelete':_0x4309b1},'activations':{'all':_0x11734c,'toCreate':_0x1ae157,'toUpdate':_0x2454ee,'toDelete':_0x4bc860},'folders':{'toCreate':_0x18eb0d},'counts':{'segments':{'new':_0x14fdb8[_0x13526b(0x136)],'changed':_0x3c6b38['length'],'unchanged':_0xf42d9[_0x13526b(0x136)],'toDelete':_0x5b746c[_0x13526b(0x136)]},'journeys':{'new':_0x67572e[_0x13526b(0x136)],'changed':_0x31cb11[_0x13526b(0x136)],'unchanged':_0x541d7c['length'],'toDelete':_0x4309b1[_0x13526b(0x136)]},'activations':{'create':_0x1ae157[_0x13526b(0x136)],'update':_0x2454ee[_0x13526b(0x136)],'delete':_0x4bc860['length']},'folders':_0x18eb0d[_0x13526b(0x136)]},'hasChanges':_0x2fe995||_0x25514f||_0x5c8cda||_0x5c07dc};}export async function buildPushExecutionContext(_0x32f74a,_0xea0719,_0x305552,_0x30ecc7,_0x2e5d45,_0x1cb9df){const _0x61a025=a159_0x1187c8,_0x4b5886=extractRootFolderId(_0x305552),{pathToId:_0xb40653,idToPath:_0x445f5e}=buildFolderMaps(_0x2e5d45),_0x22b67f=buildSegmentNameToIdMap(_0x30ecc7),_0x2d0104=new Map(),{batchAsync:_0xb9693d}=await import(_0x61a025(0xea)),[_0x12c5f1,_0x5c7504]=await Promise[_0x61a025(0xa7)]([_0x32f74a[_0x61a025(0x17a)]['buildUserMaps'](),_0x32f74a[_0x61a025(0xa3)][_0x61a025(0x100)](),((async()=>{const _0x648262=_0x61a025;!_0x1cb9df&&_0x30ecc7[_0x648262(0x136)]>0x0&&await _0xb9693d(_0x30ecc7,async _0x2a61d4=>{const _0x1d4483=_0x648262,_0x4cbc3b=await _0x32f74a[_0x1d4483(0x120)][_0x1d4483(0x11b)](_0xea0719,_0x2a61d4['id']);_0x2d0104['set'](_0x2a61d4['id'],_0x4cbc3b);});})())]),{emailToId:_0x6a6692,idToEmail:_0xade433}=_0x12c5f1,_0xbfca31=buildConnectionMaps(_0x5c7504);return{'rootFolderId':_0x4b5886,'folderPathToId':_0xb40653,'folderIdToPath':_0x445f5e,'segmentNameToId':_0x22b67f,'activationsBySegmentId':_0x2d0104,'emailToIdMap':_0x6a6692,'idToEmailMap':_0xade433,'connectionNameToIdMap':_0xbfca31['nameToId'],'connectionIdToNameMap':_0xbfca31[_0x61a025(0x15a)],'connectionNameToTypeMap':_0xbfca31[_0x61a025(0xc2)]};}export function createPushYamlContextForBundle(_0x512579,_0x4a5cc3,_0x4be111,_0x143f9d,_0x7de4d4,_0x5a69e1,_0x5f5618,_0x40bdae){const {existingLocalSegmentNames:_0x24e176,localExpandedRuleToNames:_0x51e872}=_0x143f9d,_0x12f82c=new Set(),_0x23236a=new Map(),_0x4775bd=new Map(),_0x209a5f=new Map(),_0x513339=createJumpTargetCache(),_0x200fdb=new Map(),_0x184094=new Map(),_0x4d0e21=new Set();let _0x339b67;const _0x371aa7=_0x189d00=>{const _0x3d9e89={'resolveSegment':async _0x15df92=>{const _0x3c15e7=a159_0x35a2,_0x2b6b1a=_0x209a5f[_0x3c15e7(0x16e)](_0x15df92);if(_0x2b6b1a!==undefined)return{'name':_0x2b6b1a,'isJourneyLocal':!![]};try{const _0x97c5cd=await fetchSegment(_0x512579,_0x4a5cc3,_0x15df92,_0x4be111);if(!_0x97c5cd)throw new Error(_0x3c15e7(0x167));const _0x591a9e=generateJourneyLocalName(_0x97c5cd[_0x3c15e7(0xa5)]),_0x2c6bb1=_0x97c5cd['kind']===SEGMENT_KIND_JOURNEY&&_0x591a9e!==undefined;let _0x4af9b0=_0x97c5cd[_0x3c15e7(0xa5)],_0x3822eb;if(_0x2c6bb1&&_0x97c5cd['rule']){const _0x4cd0b6=apiRuleToYaml(_0x97c5cd[_0x3c15e7(0x12e)]);_0x184094[_0x3c15e7(0xcc)](_0x15df92,_0x4cd0b6);const _0x288d15=async _0x46e98b=>{const _0x2fbbb0=_0x3c15e7,_0x36c583=collectSegmentRefsFromRule(_0x46e98b);for(const _0x42fec5 of _0x36c583){if(!_0x184094[_0x2fbbb0(0xf9)](_0x42fec5))try{const _0x4fae76=await fetchSegment(_0x512579,_0x4a5cc3,_0x42fec5,_0x4be111);if(_0x4fae76?.['rule']){const _0x54148b=apiRuleToYaml(_0x4fae76[_0x2fbbb0(0x12e)]);_0x184094['set'](_0x42fec5,_0x54148b),await _0x288d15(_0x54148b);}}catch(_0x2193a4){logger[_0x2fbbb0(0x14f)](_0x2fbbb0(0xdf)+_0x42fec5+':\x20'+_0x2193a4);}}};await _0x288d15(_0x4cd0b6);const _0x5ef622=serializeExpandedRule(_0x4cd0b6,_0x184094),_0x406f6d=_0x51e872[_0x3c15e7(0x16e)](_0x5ef622);if(_0x406f6d&&_0x406f6d[_0x3c15e7(0x136)]>0x0){const _0x5cb85e=_0x23236a['get'](_0x5ef622)||0x0,_0x2aa241=_0x406f6d[_0x5cb85e]||_0x406f6d[_0x406f6d[_0x3c15e7(0x136)]-0x1];_0x23236a['set'](_0x5ef622,_0x5cb85e+0x1),_0x4af9b0=_0x2aa241,_0x12f82c['add'](_0x4af9b0),_0x209a5f['set'](_0x15df92,_0x4af9b0);const _0x597626=await resolveRuleSegmentRefs(_0x4cd0b6,async _0x5e2d26=>{const _0x3eaac5=_0x3c15e7,_0x58d075=_0x209a5f[_0x3eaac5(0x16e)](_0x5e2d26);if(_0x58d075)return _0x58d075;const _0xffcc69=await _0x339b67[_0x3eaac5(0x11a)](_0x5e2d26);return _0xffcc69[_0x3eaac5(0xa5)];});_0x3822eb={'description':_0x97c5cd[_0x3c15e7(0x186)],'rule':_0x597626};}else{const _0x22ef7f=_0x200fdb[_0x3c15e7(0x16e)](_0x5ef622);if(_0x22ef7f)_0x4af9b0=_0x22ef7f,_0x209a5f[_0x3c15e7(0xcc)](_0x15df92,_0x4af9b0);else{if(_0x591a9e){let _0x55c8fd=_0x591a9e,_0xc9a13a=0x2;while(_0x12f82c['has'](_0x55c8fd)||_0x24e176[_0x3c15e7(0xf9)](_0x55c8fd)){_0x55c8fd=_0x591a9e+'_'+_0xc9a13a,_0xc9a13a++;}_0x12f82c[_0x3c15e7(0xfb)](_0x55c8fd),_0x4af9b0=_0x55c8fd;}_0x209a5f[_0x3c15e7(0xcc)](_0x15df92,_0x4af9b0),_0x200fdb['set'](_0x5ef622,_0x4af9b0);const _0xd3f93f=await resolveRuleSegmentRefs(_0x4cd0b6,async _0x4eda8c=>{const _0x4211f6=_0x3c15e7,_0x142f0d=_0x209a5f[_0x4211f6(0x16e)](_0x4eda8c);if(_0x142f0d)return _0x142f0d;const _0x1a135d=await _0x339b67[_0x4211f6(0x11a)](_0x4eda8c);return _0x1a135d['name'];});_0x3822eb={'description':_0x97c5cd[_0x3c15e7(0x186)],'rule':_0xd3f93f};}}}return{'name':_0x4af9b0,'isJourneyLocal':_0x2c6bb1,'definition':_0x3822eb};}catch(_0x59fd99){return logger['debug'](_0x3c15e7(0xf7)+_0x15df92+':\x20'+_0x59fd99),{'name':_0x15df92,'isJourneyLocal':![]};}},'resolveActivation':async _0x147da2=>{const _0x4b06cf=a159_0x35a2,_0x3abb90=_0x4775bd[_0x4b06cf(0x16e)](_0x147da2);if(_0x3abb90!==undefined)return{'name':_0x3abb90,'isJourneyLocal':!![]};try{let _0x827553=_0x5f5618?.['get'](_0x147da2);!_0x827553&&(_0x827553=await _0x512579['journey'][_0x4b06cf(0x9d)](_0x189d00,_0x147da2));const _0x4fc910=_0x827553[_0x4b06cf(0x18a)][_0x4b06cf(0x12d)][_0x4b06cf(0xa5)]||_0x147da2,_0x20d0b5=sanitizeYamlKey(_0x4fc910)||_0x4b06cf(0xc1)+_0x147da2,_0x1878a3=_0x20d0b5;_0x4775bd[_0x4b06cf(0xcc)](_0x147da2,_0x1878a3);const _0x5095a8=journeyActivationStepToYaml(_0x827553,_0x7de4d4,_0x5a69e1);return{'name':_0x1878a3,'isJourneyLocal':!![],'definition':_0x5095a8};}catch(_0x2d3104){return logger[_0x4b06cf(0x14f)](_0x4b06cf(0x10f)+_0x147da2+':\x20'+_0x2d3104),{'name':_0x147da2,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x39b45b,_0x265be2)=>resolveJumpTarget(_0x39b45b,_0x265be2,_0x513339,async _0x324810=>{const _0x48a432=a159_0x35a2,_0x5dffb0=_0x40bdae?.[_0x48a432(0x16e)](_0x324810);if(_0x5dffb0)return _0x5dffb0;return _0x512579[_0x48a432(0x98)]['getJourney'](_0x324810);})};return _0x339b67=_0x3d9e89,_0x3d9e89;},_0xea0e0f=async _0x33329e=>{const _0x41a76f=a159_0x35a2,{collectSegmentIdsFromJourneyApi:_0x47ec0b}=await import(_0x41a76f(0x110)),{batchAsync:_0x152ab2}=await import(_0x41a76f(0xea)),_0x1c2db4=new Set();for(const _0x253ace of _0x33329e){let _0xbb4bbd=_0x40bdae?.['get'](_0x253ace);!_0xbb4bbd&&(_0xbb4bbd=await _0x512579[_0x41a76f(0x98)][_0x41a76f(0x15c)](_0x253ace));const _0x16d175=_0x47ec0b(_0xbb4bbd);for(const _0x240604 of _0x16d175){_0x1c2db4[_0x41a76f(0xfb)](_0x240604);}}let _0xee3313=Array['from'](_0x1c2db4);while(_0xee3313['length']>0x0){const _0x1c8e4b=_0xee3313[_0x41a76f(0x158)](_0x8369fb=>!_0x4d0e21['has'](_0x8369fb));if(_0x1c8e4b['length']===0x0)break;const _0x2c9a8e=await _0x152ab2(_0x1c8e4b,async _0x5abe87=>{const _0x1f8f6d=_0x41a76f;_0x4d0e21[_0x1f8f6d(0xfb)](_0x5abe87);const _0x5e7e5b=await fetchSegment(_0x512579,_0x4a5cc3,_0x5abe87,_0x4be111);if(!_0x5e7e5b)return null;return{'segmentId':_0x5abe87,'segment':_0x5e7e5b};},0xa),_0xd5f95=new Set();for(const _0x40e758 of _0x2c9a8e){if(!_0x40e758?.[_0x41a76f(0x120)]?.[_0x41a76f(0x12e)])continue;const _0x592977=apiRuleToYaml(_0x40e758[_0x41a76f(0x120)][_0x41a76f(0x12e)]);_0x184094[_0x41a76f(0xcc)](_0x40e758['segmentId'],_0x592977);const _0x1cb76e=collectSegmentRefsFromRule(_0x592977);for(const _0x237fe4 of _0x1cb76e){!_0x4d0e21[_0x41a76f(0xf9)](_0x237fe4)&&_0xd5f95[_0x41a76f(0xfb)](_0x237fe4);}}_0xee3313=Array[_0x41a76f(0xe8)](_0xd5f95);}};return{'createYamlContext':_0x371aa7,'prefetchJourneySegments':_0xea0e0f};}export async function executePushSegments(_0x50cdfb,_0x37a596,_0x10d9f4,_0x3782a4,_0x124880){const _0x581b51=a159_0x1187c8,{segmentDefToCreateRequest:_0x226f00,segmentDefToUpdateRequest:_0x2d5e34}=await import('./child-segment-yaml.js'),_0x25650=_0x10d9f4[_0x581b51(0xb5)],_0x18bfb5=0x5,_0x548df4=async _0x41bc14=>{const _0x5d3923=_0x581b51,_0x398746=_0x41bc14[_0x5d3923(0xeb)]?_0x25650[_0x5d3923(0x16e)](_0x41bc14['folderPath']):undefined;let _0x46aa22;const _0x5d2eee={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x250060=_0x41bc14['yamlConfig'];if(_0x41bc14['yamlConfig'][_0x5d3923(0x12e)]){const _0x1d7bda=createSegmentIdResolver(_0x10d9f4['segmentNameToId'],_0x41bc14[_0x5d3923(0xf2)]['name']),_0x26a87c=await resolveRuleSegmentIds(_0x41bc14[_0x5d3923(0xf2)]['rule'],_0x1d7bda);_0x250060={..._0x41bc14[_0x5d3923(0xf2)],'rule':_0x26a87c};}try{if(_0x41bc14['isNew']){_0x124880[_0x5d3923(0xec)]?.({'type':_0x5d3923(0x129),'name':_0x41bc14[_0x5d3923(0xf2)]['name']});const _0x5e6f57=_0x226f00(_0x250060,_0x398746),_0x37efcb=await _0x124880[_0x5d3923(0x118)](_0x5d3923(0x170)+_0x41bc14[_0x5d3923(0xf2)]['name']+'\x27...',()=>_0x50cdfb['segment']['createSegment'](_0x3782a4[_0x5d3923(0xdc)],_0x5e6f57));_0x46aa22=_0x37efcb[_0x5d3923(0xd2)]['id'],_0x10d9f4[_0x5d3923(0x115)][_0x5d3923(0xcc)](_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)],_0x46aa22),_0x5d2eee[_0x5d3923(0x154)]={'name':_0x41bc14['yamlConfig'][_0x5d3923(0xa5)],'id':_0x46aa22},_0x124880[_0x5d3923(0xec)]?.({'type':_0x5d3923(0xe9),'name':_0x41bc14['yamlConfig'][_0x5d3923(0xa5)],'segmentId':_0x46aa22}),_0x124880[_0x5d3923(0x12a)]?.(_0x5d3923(0xb7)+_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]+'\x27'),_0x5d2eee[_0x5d3923(0xae)]=0x1;}else{if(_0x41bc14['hasChanges']){_0x124880['onProgress']?.({'type':'segment_updating','name':_0x41bc14['yamlConfig'][_0x5d3923(0xa5)]});const _0x19fe79=_0x2d5e34(_0x250060);_0x398746!==_0x41bc14[_0x5d3923(0x123)]?.[_0x5d3923(0xbc)]&&(_0x19fe79[_0x5d3923(0xbc)]=_0x398746?parseInt(_0x398746,0xa):undefined),await _0x124880[_0x5d3923(0x118)](_0x5d3923(0xda)+_0x41bc14['yamlConfig'][_0x5d3923(0xa5)]+_0x5d3923(0x150),()=>_0x50cdfb['segment'][_0x5d3923(0x155)](_0x3782a4[_0x5d3923(0xdc)],_0x41bc14[_0x5d3923(0x123)]['id'],_0x19fe79)),_0x46aa22=_0x41bc14[_0x5d3923(0x123)]['id'],_0x124880[_0x5d3923(0xec)]?.({'type':_0x5d3923(0x131),'name':_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]}),_0x124880[_0x5d3923(0x12a)]?.('Updated\x20segment\x20\x27'+_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]+'\x27'),_0x5d2eee[_0x5d3923(0xcb)]=0x1;}else _0x46aa22=_0x41bc14[_0x5d3923(0x123)]['id'];}}catch(_0x15c9b9){const _0x5bd40a=isHttp400Error(_0x15c9b9),_0x5bcc93=_0x5bd40a?ErrorCode[_0x5d3923(0x121)]:ErrorCode[_0x5d3923(0x11f)],_0x337073=getErrorMessage(_0x15c9b9);throw new SDKError(_0x5bcc93,'Failed\x20to\x20'+(_0x41bc14[_0x5d3923(0x91)]?_0x5d3923(0x151):_0x5d3923(0x94))+_0x5d3923(0xc4)+_0x41bc14['absolutePath']+_0x5d3923(0x96)+_0x337073,_0x15c9b9);}try{const _0x4e7a1f=await syncActivationsForSegment(_0x50cdfb,_0x3782a4['parentId'],_0x46aa22,_0x41bc14[_0x5d3923(0xf2)]['name'],_0x41bc14[_0x5d3923(0x16c)],_0x124880,_0x41bc14[_0x5d3923(0x166)]);_0x5d2eee[_0x5d3923(0xc5)]=_0x4e7a1f;}catch(_0xfd0f76){if(_0xfd0f76 instanceof SDKError)throw _0xfd0f76;throw new SDKError(ErrorCode[_0x5d3923(0x16f)],_0x5d3923(0x126)+_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]+_0x5d3923(0x182)+_0x41bc14['absolutePath']+_0x5d3923(0x96)+getErrorMessage(_0xfd0f76),_0xfd0f76);}return _0x5d2eee;},_0x426811=await batchAsync(_0x37a596,_0x548df4,_0x18bfb5),_0x4143a2={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x478f0c of _0x426811){_0x4143a2[_0x581b51(0xae)]+=_0x478f0c['created'],_0x4143a2[_0x581b51(0xcb)]+=_0x478f0c['updated'],_0x478f0c[_0x581b51(0x154)]&&_0x4143a2[_0x581b51(0x179)][_0x581b51(0xcc)](_0x478f0c[_0x581b51(0x154)][_0x581b51(0xa5)],_0x478f0c['createdSegmentId']['id']),_0x4143a2[_0x581b51(0xc5)][_0x581b51(0xae)]+=_0x478f0c[_0x581b51(0xc5)][_0x581b51(0xae)],_0x4143a2[_0x581b51(0xc5)][_0x581b51(0xcb)]+=_0x478f0c[_0x581b51(0xc5)][_0x581b51(0xcb)],_0x4143a2['activations'][_0x581b51(0xf1)]+=_0x478f0c[_0x581b51(0xc5)][_0x581b51(0xf1)];}return _0x4143a2;}async function syncActivationsForSegment(_0x529ba4,_0x23ed1c,_0xb7e409,_0x164d29,_0x3c371d,_0x33588d,_0x38d908){const _0x56d4de=a159_0x1187c8,_0x4ec326={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x419dc2 of _0x3c371d){try{if(_0x419dc2[_0x56d4de(0xd0)]==='create'&&_0x419dc2['validatedRequest'])_0x33588d['onProgress']?.({'type':'activation_creating','segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),await _0x33588d[_0x56d4de(0x118)](_0x56d4de(0xe7)+_0x419dc2[_0x56d4de(0xa5)]+'\x27...',()=>_0x529ba4[_0x56d4de(0x120)][_0x56d4de(0xc0)](_0x23ed1c,_0xb7e409,_0x419dc2[_0x56d4de(0xad)])),_0x33588d[_0x56d4de(0xec)]?.({'type':'activation_created','segmentName':_0x164d29,'activationName':_0x419dc2['name']}),_0x33588d[_0x56d4de(0x12a)]?.(_0x56d4de(0xc7)+_0x419dc2[_0x56d4de(0xa5)]+'\x27'),_0x4ec326[_0x56d4de(0xae)]++;else{if(_0x419dc2[_0x56d4de(0xd0)]==='update'&&_0x419dc2[_0x56d4de(0xad)]&&_0x419dc2[_0x56d4de(0xc3)])_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x122),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),await _0x33588d[_0x56d4de(0x118)](_0x56d4de(0x89)+_0x419dc2['name']+_0x56d4de(0x150),()=>_0x529ba4[_0x56d4de(0x120)]['updateActivation'](_0x23ed1c,_0xb7e409,_0x419dc2[_0x56d4de(0xc3)]['id'],_0x419dc2[_0x56d4de(0xad)])),_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x148),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),_0x33588d[_0x56d4de(0x12a)]?.(_0x56d4de(0x137)+_0x419dc2[_0x56d4de(0xa5)]+'\x27'),_0x4ec326[_0x56d4de(0xcb)]++;else _0x419dc2[_0x56d4de(0xd0)]===_0x56d4de(0xc6)&&_0x419dc2[_0x56d4de(0xc3)]&&(_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x117),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),await _0x33588d[_0x56d4de(0x118)](_0x56d4de(0x133)+_0x419dc2[_0x56d4de(0xa5)]+_0x56d4de(0x150),()=>_0x529ba4['segment'][_0x56d4de(0x143)](_0x23ed1c,_0xb7e409,_0x419dc2['existingActivation']['id'])),_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x9c),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),_0x33588d['logDeleted']?.(_0x56d4de(0x8c)+_0x419dc2['name']+'\x27'),_0x4ec326[_0x56d4de(0xf1)]++);}}catch(_0x266c5a){const _0x4852d6=isHttp400Error(_0x266c5a),_0x272084=_0x4852d6?ErrorCode[_0x56d4de(0x109)]:ErrorCode[_0x56d4de(0x16f)],_0x57852a=getErrorMessage(_0x266c5a);throw new SDKError(_0x272084,_0x56d4de(0xbe)+_0x419dc2[_0x56d4de(0xd0)]+'\x20activation\x20\x27'+_0x419dc2[_0x56d4de(0xa5)]+_0x56d4de(0x182)+_0x38d908+_0x56d4de(0x96)+_0x57852a,_0x266c5a);}}return _0x4ec326;}export async function executePushFolders(_0x107331,_0x5adc8f,_0x53cb3e,_0x313cfd,_0xb960e4){const _0x32bd63=a159_0x1187c8,_0x35162d=new Map(_0x53cb3e),_0x2e92ca=sortFoldersByDepth(_0x5adc8f);for(const _0x1b15c9 of _0x2e92ca){const _0x1c71ed=_0x1b15c9[_0x32bd63(0x160)]('/'),_0x2c043a=_0x1c71ed[_0x1c71ed[_0x32bd63(0x136)]-0x1],_0x215bed=_0x1c71ed[_0x32bd63(0x17d)](0x0,-0x1)[_0x32bd63(0x187)]('/'),_0x3b697e=_0x35162d[_0x32bd63(0x16e)](_0x215bed);_0xb960e4[_0x32bd63(0xec)]?.({'type':_0x32bd63(0xc9),'folder':_0x1b15c9});const _0x1f20c7={'name':_0x2c043a,'parentFolderId':_0x3b697e},_0x3e2d23=await _0xb960e4['withProgress'](_0x32bd63(0x162)+_0x1b15c9+_0x32bd63(0x150),()=>_0x107331[_0x32bd63(0x120)][_0x32bd63(0xc8)](_0x313cfd[_0x32bd63(0xdc)],_0x1f20c7));_0x35162d[_0x32bd63(0xcc)](_0x1b15c9,_0x3e2d23[_0x32bd63(0xd2)]['id']),_0xb960e4[_0x32bd63(0xec)]?.({'type':_0x32bd63(0xdd),'folder':_0x1b15c9,'folderId':_0x3e2d23[_0x32bd63(0xd2)]['id']}),_0xb960e4[_0x32bd63(0x15d)]?.(_0x32bd63(0x144)+_0x1b15c9+'\x27');}return _0x35162d;}export async function executePushSegmentDeletions(_0x5046a5,_0x74ff11,_0x9a1de){const _0x28401f=a159_0x1187c8;if(_0x74ff11['length']===0x0)return 0x0;const {batchAsync:_0x1b491d}=await import(_0x28401f(0xea)),_0x526903=0x5,_0x38483b=await _0x1b491d(_0x74ff11,async _0x3dde6e=>{const _0x203a96=_0x28401f;return _0x9a1de['onProgress']?.({'type':_0x203a96(0xb1),'name':_0x3dde6e[_0x203a96(0xa5)]}),await _0x5046a5[_0x203a96(0x120)][_0x203a96(0xf3)](_0x3dde6e['id']),_0x9a1de[_0x203a96(0xec)]?.({'type':_0x203a96(0x101),'name':_0x3dde6e['name']}),_0x9a1de[_0x203a96(0x8e)]?.('Deleted\x20segment\x20\x27'+_0x3dde6e[_0x203a96(0xa5)]+'\x27'),0x1;},_0x526903);return _0x38483b['reduce']((_0x1380a8,_0x544e80)=>_0x1380a8+_0x544e80,0x0);}export async function executePushJourneys(_0xb684e8,_0x1e49b5,_0x431465,_0x4120ef,_0x3ef027){const _0x4c1dc6=a159_0x1187c8,{journeyDefToRequest:_0x42daf2}=await import(_0x4c1dc6(0x110)),{activationDefToCreateRequest:_0xe45a22,yamlRuleToApi:_0x1e6ede,validateSegmentRule:_0x12ca30}=await import(_0x4c1dc6(0x12b)),_0x57d274={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2400c1=new Map(_0x431465[_0x4c1dc6(0x115)]),_0x5d61e7=0x5;for(let _0x28e73b=0x0;_0x28e73b<_0x1e49b5[_0x4c1dc6(0x136)];_0x28e73b+=_0x5d61e7){const _0x300719=_0x1e49b5[_0x4c1dc6(0x17d)](_0x28e73b,_0x28e73b+_0x5d61e7),_0x2bde2b=await Promise[_0x4c1dc6(0xa7)](_0x300719[_0x4c1dc6(0xbd)](async _0x169678=>{const _0x408477=_0x4c1dc6;if(!_0x169678[_0x408477(0x91)]&&!_0x169678[_0x408477(0xe6)])return{'action':_0x408477(0x176),'name':_0x169678[_0x408477(0xf2)][_0x408477(0xa5)],'journeyId':_0x169678[_0x408477(0x111)]?.['id']};const _0x9a3a4d=_0x169678[_0x408477(0xeb)]?_0x431465[_0x408477(0xb5)][_0x408477(0x16e)](_0x169678[_0x408477(0xeb)]):undefined;_0x3ef027[_0x408477(0xec)]?.({'type':_0x169678[_0x408477(0x91)]?_0x408477(0x145):_0x408477(0x159),'name':_0x169678[_0x408477(0xf2)][_0x408477(0xa5)]});try{const _0x3f71b8=await executeSingleJourneyPush(_0xb684e8,_0x169678,{..._0x431465,'segmentNameToId':_0x2400c1},{'parentId':_0x4120ef[_0x408477(0xdc)],'rootFolderId':_0x4120ef['rootFolderId'],'folderId':_0x9a3a4d,'verbose':_0x4120ef['verbose']},_0x3ef027,{'journeyDefToRequest':_0x42daf2,'activationDefToCreateRequest':_0xe45a22,'yamlRuleToApi':_0x1e6ede,'validateSegmentRule':_0x12ca30});for(const [_0xbf57e0,_0x4884a1]of _0x3f71b8[_0x408477(0xa0)]){_0x2400c1[_0x408477(0xcc)](_0xbf57e0,_0x4884a1),_0x57d274['embeddedSegmentNameToId'][_0x408477(0xcc)](_0xbf57e0,_0x4884a1);}if(_0x3f71b8[_0x408477(0xcf)]===_0x408477(0xae))_0x3ef027['onProgress']?.({'type':_0x408477(0x183),'name':_0x169678['yamlConfig'][_0x408477(0xa5)],'journeyId':_0x3f71b8['journeyId']}),_0x3ef027[_0x408477(0x12a)]?.(_0x408477(0x153)+_0x169678[_0x408477(0xf2)][_0x408477(0xa5)]+'\x27'),_0x57d274[_0x408477(0xae)]++;else _0x3f71b8['action']==='updated'&&(_0x3ef027[_0x408477(0xec)]?.({'type':_0x408477(0x14d),'name':_0x169678[_0x408477(0xf2)]['name']}),_0x3ef027[_0x408477(0x12a)]?.('Updated\x20journey\x20\x27'+_0x169678[_0x408477(0xf2)]['name']+'\x27'),_0x57d274[_0x408477(0xcb)]++);return{'action':_0x3f71b8[_0x408477(0xcf)],'name':_0x169678[_0x408477(0xf2)][_0x408477(0xa5)],'journeyId':_0x3f71b8[_0x408477(0x10e)]};}catch(_0x1eeec6){const _0x174b44=isHttp400Error(_0x1eeec6),_0x30f811=_0x174b44?ErrorCode[_0x408477(0x119)]:ErrorCode[_0x408477(0x169)],_0x443667=getErrorMessage(_0x1eeec6);throw new SDKError(_0x30f811,_0x408477(0xbe)+(_0x169678['isNew']?_0x408477(0x151):_0x408477(0x94))+_0x408477(0xd3)+_0x169678[_0x408477(0x166)]+_0x408477(0x96)+_0x443667,_0x1eeec6);}}));_0x57d274[_0x4c1dc6(0xef)][_0x4c1dc6(0x97)](..._0x2bde2b);}return _0x57d274;}async function matchExistingJourneySegments(_0x700232,_0x756ce0,_0x3f1d07,_0xca83e8,_0x10f72e){const _0x465ec1=a159_0x1187c8;if(!_0x756ce0['existingJourney']||!_0x756ce0['yamlConfig'][_0x465ec1(0xe4)])return;const _0x4251c2=new Map(),_0x2c15b0=new Set();for(const _0x401dc9 of Object['keys'](_0x756ce0['yamlConfig'][_0x465ec1(0xe4)])){const _0x2253d7=generateDeterministicJourneySegmentName(_0x756ce0[_0x465ec1(0xf2)][_0x465ec1(0xa5)],_0x401dc9);_0x4251c2[_0x465ec1(0xcc)](_0x2253d7,_0x401dc9),_0x2c15b0[_0x465ec1(0xfb)](_0x401dc9);}const _0x18a894=[],_0x29a1f5=collectSegmentIdsFromJourneyApi(_0x756ce0[_0x465ec1(0x111)]);for(const _0x39747f of _0x29a1f5){const _0xd78770=await fetchSegment(_0x700232,_0x3f1d07,_0x39747f,_0xca83e8);if(!_0xd78770?.['name'])continue;const _0x481e33=_0x4251c2[_0x465ec1(0x16e)](_0xd78770['name']);_0x481e33?(_0x10f72e[_0x465ec1(0xcc)](_0x481e33,_0x39747f),_0x2c15b0['delete'](_0x481e33)):_0x18a894['push']({'id':_0x39747f,'seg':_0xd78770});}if(_0x2c15b0[_0x465ec1(0x10c)]>0x0&&_0x18a894['length']>0x0){const {localExpandedRuleToNames:_0x3059f7}=buildLocalExpandedRuleMappings(_0x756ce0[_0x465ec1(0xf2)]),_0x4ade81=new Map();for(const {id:_0x2bdf50,seg:_0x4ad4fe}of _0x18a894){if(_0x4ad4fe[_0x465ec1(0x12e)]){const _0x3e33ee=apiRuleToYaml(_0x4ad4fe['rule']);_0x4ade81[_0x465ec1(0xcc)](_0x2bdf50,_0x3e33ee);}}for(const {id:_0x15d37b,seg:_0x2e5a77}of _0x18a894){if(!_0x2e5a77[_0x465ec1(0x12e)])continue;const _0x75f6e0=_0x4ade81[_0x465ec1(0x16e)](_0x15d37b);if(!_0x75f6e0)continue;const _0x1e1a13=serializeExpandedRule(_0x75f6e0,_0x4ade81),_0x19e5e8=_0x3059f7['get'](_0x1e1a13);if(_0x19e5e8){const _0x1b85cd=_0x19e5e8[_0x465ec1(0x127)](_0x2a3f51=>_0x2c15b0[_0x465ec1(0xf9)](_0x2a3f51));_0x1b85cd&&(_0x10f72e['set'](_0x1b85cd,_0x15d37b),_0x2c15b0[_0x465ec1(0xc6)](_0x1b85cd),logger[_0x465ec1(0x14f)](_0x465ec1(0x164)+_0x2e5a77[_0x465ec1(0xa5)]+_0x465ec1(0xe0)+_0x1b85cd+_0x465ec1(0xf8)));}}}}async function executeSingleJourneyPush(_0x56578d,_0x6235eb,_0x435b90,_0x28a080,_0x8e1f1,_0x4f4b4c){const _0x122bb1=a159_0x1187c8,{journeyDefToRequest:_0x115d8b,activationDefToCreateRequest:_0x32815e,yamlRuleToApi:_0x4bef11,validateSegmentRule:_0x447b7a}=_0x4f4b4c,_0x5a2fb6=new Map(),_0x46acc4=new Map();recoverSegmentIdsFromPushRecovery(_0x6235eb,_0x5a2fb6,_0x435b90[_0x122bb1(0x115)]);const _0x4a1d70=new Map(),_0x13a7d1=new Map(),_0x55f169=new Map();let _0x88e575;const _0x5ce401=async()=>{const _0x30bf08=_0x122bb1;if(_0x88e575)return;_0x88e575=new Map();if(!_0x6235eb[_0x30bf08(0x111)])return;const _0x3d7381=await _0x56578d['journey'][_0x30bf08(0x11b)](_0x6235eb[_0x30bf08(0x111)]['id']);for(const _0x12b73b of _0x3d7381){const _0x425097=journeyActivationStepToYaml(_0x12b73b,_0x435b90[_0x30bf08(0xcd)],_0x435b90['connectionIdToNameMap']),_0x247b5f=activationSignature(_0x425097);!_0x88e575[_0x30bf08(0xf9)](_0x247b5f)&&_0x88e575[_0x30bf08(0xcc)](_0x247b5f,_0x12b73b['id']),_0x425097[_0x30bf08(0xa5)]&&_0x46acc4['set'](_0x425097['name'],_0x12b73b['id']);}};await matchExistingJourneySegments(_0x56578d,_0x6235eb,_0x28a080['parentId'],_0x435b90[_0x122bb1(0x105)],_0x435b90[_0x122bb1(0x115)]);const _0x3c97dc={'resolveSegmentId':async _0x1971b3=>{const _0x5f0c8b=_0x122bb1,_0x5a3588=_0x435b90[_0x5f0c8b(0x115)][_0x5f0c8b(0x16e)](_0x1971b3);if(!_0x5a3588)throw new SDKError(ErrorCode[_0x5f0c8b(0xd6)],_0x5f0c8b(0x13a)+_0x1971b3+_0x5f0c8b(0x142)+_0x6235eb[_0x5f0c8b(0xf2)][_0x5f0c8b(0xa5)]+')');return _0x5a3588;},'resolveEmbeddedSegmentId':async(_0x4cb3ab,_0x7b15df)=>{const _0x5b3902=_0x122bb1,_0x5d4d91=_0x435b90[_0x5b3902(0x115)][_0x5b3902(0x16e)](_0x4cb3ab);if(_0x5d4d91)return _0x5d4d91;const _0x3a2213=_0x435b90[_0x5b3902(0x105)][_0x5b3902(0x127)](_0x551492=>_0x551492[_0x5b3902(0xa5)]===_0x4cb3ab);if(_0x3a2213)return _0x435b90[_0x5b3902(0x115)][_0x5b3902(0xcc)](_0x4cb3ab,_0x3a2213['id']),_0x3a2213['id'];if(_0x6235eb['isNew']){const {stageName:_0x195ed7,criteriaName:_0x3f89d2}=findSegmentCriteriaLocation(_0x6235eb[_0x5b3902(0xf2)],_0x4cb3ab);return _0x447b7a(_0x4cb3ab,_0x7b15df[_0x5b3902(0x12e)]),_0x13a7d1[_0x5b3902(0xcc)](_0x4cb3ab,{'definition':_0x7b15df,'stageName':_0x195ed7,'criteriaName':_0x3f89d2}),createPendingSegmentId(_0x4cb3ab);}const _0x3bcb7f=_0x6235eb[_0x5b3902(0x111)]?.['id'];if(!_0x3bcb7f)throw new SDKError(ErrorCode[_0x5b3902(0x113)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x43baad=_0x4a1d70[_0x5b3902(0x16e)](_0x4cb3ab);if(_0x43baad)return _0x43baad;const _0x203bc8=((async()=>{const _0x4573f1=_0x5b3902;_0x447b7a(_0x4cb3ab,_0x7b15df['rule']);const _0x347a10=generateDeterministicJourneySegmentName(_0x6235eb[_0x4573f1(0xf2)][_0x4573f1(0xa5)],_0x4cb3ab),_0x41f948=_0x435b90[_0x4573f1(0x105)]['find'](_0x12576d=>_0x12576d[_0x4573f1(0xa5)]===_0x347a10),_0x4bfa4c=createSegmentIdResolver(_0x435b90[_0x4573f1(0x115)],_0x4cb3ab),_0x716371=await resolveRuleSegmentIds(_0x7b15df[_0x4573f1(0x12e)],_0x4bfa4c);let _0x3dbf5c;return _0x41f948?(await _0x56578d[_0x4573f1(0x120)][_0x4573f1(0x155)](_0x28a080[_0x4573f1(0xdc)],_0x41f948['id'],{'description':_0x7b15df['description']||'Entry\x20criteria:\x20'+_0x4cb3ab,'rule':_0x4bef11(_0x716371),'countPopulation':!![]}),_0x3dbf5c=_0x41f948['id'],saveSegmentToPushRecovery(_0x6235eb[_0x4573f1(0x166)],_0x6235eb[_0x4573f1(0xf2)]['name'],_0x4cb3ab,{'segmentId':_0x3dbf5c,'uniqueServerName':_0x347a10,'createdAt':new Date()['toISOString']()})):_0x3dbf5c=await createOrRecoverEmbeddedSegment(_0x56578d,_0x6235eb,{'localName':_0x4cb3ab,'uniqueSegmentName':_0x347a10,'description':_0x7b15df[_0x4573f1(0x186)]||_0x4573f1(0x114)+_0x4cb3ab,'journeyId':_0x3bcb7f,'resolvedRule':_0x716371,'parentId':_0x28a080[_0x4573f1(0xdc)],'folderId':_0x28a080[_0x4573f1(0x12f)]||''},_0x4bef11),_0x435b90['segmentNameToId'][_0x4573f1(0xcc)](_0x4cb3ab,_0x3dbf5c),_0x5a2fb6[_0x4573f1(0xcc)](_0x4cb3ab,_0x3dbf5c),_0x3dbf5c;})());_0x4a1d70['set'](_0x4cb3ab,_0x203bc8);try{return await _0x203bc8;}finally{_0x4a1d70[_0x5b3902(0xc6)](_0x4cb3ab);}},'resolveActivationId':async _0x19d8f=>{const _0x4d6cdd=_0x122bb1,_0x2c9d3c=_0x46acc4[_0x4d6cdd(0x16e)](_0x19d8f);if(_0x2c9d3c)return _0x2c9d3c;if(_0x6235eb[_0x4d6cdd(0x111)]){await _0x5ce401();const _0x6e2061=_0x46acc4[_0x4d6cdd(0x16e)](_0x19d8f);if(_0x6e2061)return _0x6e2061;}throw new SDKError(ErrorCode[_0x4d6cdd(0xa8)],_0x4d6cdd(0xb8)+_0x19d8f+_0x4d6cdd(0x142)+_0x6235eb[_0x4d6cdd(0xf2)][_0x4d6cdd(0xa5)]+_0x4d6cdd(0x102)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x560d60,_0x3cfd76)=>{const _0x3538c9=_0x122bb1,_0x8ce214=_0x46acc4['get'](_0x560d60);if(_0x8ce214)return _0x8ce214;if(_0x6235eb[_0x3538c9(0x91)])return _0x55f169[_0x3538c9(0xcc)](_0x560d60,_0x3cfd76),createPendingActivationId(_0x560d60);if(_0x6235eb[_0x3538c9(0x111)]){await _0x5ce401();const _0x5aa26a=_0x46acc4[_0x3538c9(0x16e)](_0x3cfd76[_0x3538c9(0xa5)]);if(_0x5aa26a)return _0x46acc4[_0x3538c9(0xcc)](_0x560d60,_0x5aa26a),_0x5aa26a;const _0x44d50d=activationSignature(_0x3cfd76),_0x19c758=_0x88e575?.[_0x3538c9(0x16e)](_0x44d50d);if(_0x19c758)return _0x46acc4[_0x3538c9(0xcc)](_0x560d60,_0x19c758),_0x19c758;const _0x232796=await _0x32815e(_0x3cfd76,_0x435b90['activationContext']),_0x44ca58={..._0x232796,..._0x3cfd76[_0x3538c9(0x13d)]!==undefined&&{'runAfterJourneyRefresh':_0x3cfd76['run_after_journey_refresh']}},_0x5cb340=await _0x56578d[_0x3538c9(0x98)][_0x3538c9(0xc0)](_0x6235eb['existingJourney']['id'],_0x44ca58);return _0x46acc4[_0x3538c9(0xcc)](_0x560d60,_0x5cb340['id']),_0x5cb340['id'];}throw new SDKError(ErrorCode[_0x3538c9(0x113)],_0x3538c9(0x134));},'resolveJourneyId':async _0x48b6b9=>{const _0x37a4b6=_0x122bb1;try{return await _0x56578d['journey'][_0x37a4b6(0x149)](_0x28a080[_0x37a4b6(0xdc)],_0x48b6b9);}catch(_0x118cff){throw new SDKError(ErrorCode[_0x37a4b6(0xa8)],_0x37a4b6(0xd5)+_0x48b6b9+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x6235eb[_0x37a4b6(0xf2)][_0x37a4b6(0xa5)]+'\x27)',_0x118cff);}},'resolveStageId':async(_0x1d49d7,_0x1c6bf5)=>{const _0x55ca22=_0x122bb1,_0x2318d6=await _0x56578d['journey'][_0x55ca22(0x15c)](_0x1d49d7),_0x1591d9=_0x2318d6[_0x55ca22(0x18a)][_0x55ca22(0xe3)][_0x55ca22(0x127)](_0xbeebf1=>_0xbeebf1['name']['toLowerCase']()===_0x1c6bf5[_0x55ca22(0x128)]());if(!_0x1591d9?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x55ca22(0xee)+_0x1c6bf5+_0x55ca22(0xb9)+(_0x2318d6[_0x55ca22(0x18a)]['journeyBundleName']||_0x2318d6[_0x55ca22(0x18a)][_0x55ca22(0xa5)])+'\x27');return _0x1591d9['id'];}},_0x2d8df4=await _0x115d8b(_0x6235eb[_0x122bb1(0xf2)],_0x28a080[_0x122bb1(0xdc)],_0x3c97dc),_0x2ee6f7=_0x28a080['folderId']||_0x28a080[_0x122bb1(0x12f)];_0x2ee6f7&&(_0x2d8df4['relationships']={'parentFolder':{'data':{'id':_0x2ee6f7,'type':_0x122bb1(0x14a)}}});if(_0x6235eb[_0x122bb1(0x91)]){if(_0x13a7d1[_0x122bb1(0x10c)]>0x0||_0x55f169['size']>0x0)return await executeThreeStepJourneyCreate(_0x56578d,_0x6235eb,_0x2d8df4,{'pendingEmbeddedSegments':_0x13a7d1,'pendingEmbeddedActivations':_0x55f169,'embeddedSegmentNameToId':_0x5a2fb6,'journeyActivationNameToId':_0x46acc4},{..._0x28a080,'effectiveFolderId':_0x2ee6f7},_0x435b90,_0x8e1f1,_0x4f4b4c);else{ensureJourneyDefaults(_0x2d8df4['attributes']);const _0x33238b=await _0x56578d[_0x122bb1(0x98)][_0x122bb1(0x151)](_0x2d8df4);return deletePushRecovery(_0x6235eb[_0x122bb1(0x166)]),{'action':_0x122bb1(0xae),'journeyId':_0x33238b['id'],'embeddedSegmentNameToId':_0x5a2fb6};}}else{if(_0x6235eb['hasChanges']&&_0x6235eb[_0x122bb1(0x111)]){_0x2d8df4['id']=_0x6235eb[_0x122bb1(0x111)]['id'];const _0x3b678e=_0x2d8df4[_0x122bb1(0x18a)];_0x6235eb[_0x122bb1(0x111)][_0x122bb1(0x18a)]?.[_0x122bb1(0x16d)]&&(_0x3b678e[_0x122bb1(0x16d)]=_0x6235eb[_0x122bb1(0x111)]['attributes'][_0x122bb1(0x16d)]);const _0x30015c=_0x6235eb['existingJourney'][_0x122bb1(0x18a)]?.['journeyStages'];return _0x30015c&&_0x2d8df4[_0x122bb1(0x18a)][_0x122bb1(0xe3)]&&injectExistingStageIds(_0x2d8df4['attributes'][_0x122bb1(0xe3)],_0x30015c),ensureJourneyDefaults(_0x3b678e),await _0x56578d[_0x122bb1(0x98)][_0x122bb1(0x94)](_0x6235eb[_0x122bb1(0x111)]['id'],_0x2d8df4),deletePushRecovery(_0x6235eb[_0x122bb1(0x166)]),{'action':_0x122bb1(0xcb),'journeyId':_0x6235eb[_0x122bb1(0x111)]['id'],'embeddedSegmentNameToId':_0x5a2fb6};}}return deletePushRecovery(_0x6235eb[_0x122bb1(0x166)]),{'action':_0x122bb1(0x176),'journeyId':_0x6235eb[_0x122bb1(0x111)]?.['id'],'embeddedSegmentNameToId':_0x5a2fb6};}function findSegmentCriteriaLocation(_0x39f41c,_0x203334){const _0x409f22=a159_0x1187c8,_0x38511a=_0x39f41c[_0x409f22(0x161)]||_0x39f41c['journeys']?.[0x0]?.['stages']||[];let _0x3205df=_0x409f22(0x103),_0x5cf218=_0x203334;const _0x5c6f5e=_0x39f41c[_0x409f22(0xa4)]||_0x39f41c[_0x409f22(0x8a)]?.[0x0]?.[_0x409f22(0xa4)];if(_0x5c6f5e?.[_0x409f22(0x120)]===_0x203334)return{'stageName':_0x409f22(0xa4),'criteriaName':_0x5c6f5e[_0x409f22(0xa5)]||_0x203334};_0xfe6050:for(const _0x3ddb07 of _0x38511a){if(_0x3ddb07[_0x409f22(0x9f)]?.[_0x409f22(0x120)]===_0x203334){_0x3205df=_0x3ddb07['name'],_0x5cf218=_0x3ddb07[_0x409f22(0x9f)]['name']||_0x203334;break;}if(_0x3ddb07[_0x409f22(0xd4)])for(const _0x27c1c0 of _0x3ddb07[_0x409f22(0xd4)]){if(_0x27c1c0[_0x409f22(0xd0)]==='decision_point'&&_0x27c1c0['with']?.[_0x409f22(0x146)])for(const _0x455ce5 of _0x27c1c0['with'][_0x409f22(0x146)]){if(_0x455ce5[_0x409f22(0x120)]===_0x203334){_0x3205df=_0x3ddb07['name'],_0x5cf218=_0x455ce5[_0x409f22(0xa5)]||_0x203334;break _0xfe6050;}}}}return{'stageName':_0x3205df,'criteriaName':_0x5cf218};}async function executeThreeStepJourneyCreate(_0x98e15a,_0x2b561b,_0x5989f4,_0x50740c,_0x11bc67,_0x318488,_0x3a0e1a,_0x356d97){const _0x1c6c42=a159_0x1187c8,{activationDefToCreateRequest:_0x49198a,yamlRuleToApi:_0x170bd0}=_0x356d97,{pendingEmbeddedSegments:_0x2d907b,pendingEmbeddedActivations:_0x273b4f,embeddedSegmentNameToId:_0x10b85b}=_0x50740c,_0x517a1b=JSON[_0x1c6c42(0xbf)](JSON[_0x1c6c42(0x175)](_0x5989f4));ensureJourneyDefaults(_0x517a1b[_0x1c6c42(0x18a)]),stripPendingIds(_0x517a1b);const _0x333856=await _0x98e15a[_0x1c6c42(0x98)]['create'](_0x517a1b),_0x1f32c3=_0x333856['id'],_0x34755f=new Map();for(const _0xb95bb5 of _0x333856[_0x1c6c42(0x18a)][_0x1c6c42(0xe3)]){_0x34755f['set'](_0xb95bb5['name'][_0x1c6c42(0x128)](),_0xb95bb5['id']);}recoverSegmentIdsFromPushRecovery(_0x2b561b,_0x10b85b,_0x318488['segmentNameToId']);for(const [_0x10abcb,{definition:_0x3d50cc}]of _0x2d907b){if(_0x10b85b[_0x1c6c42(0xf9)](_0x10abcb)){_0x3a0e1a[_0x1c6c42(0xec)]?.({'type':'embedded_segment_created','journeyName':_0x2b561b[_0x1c6c42(0xf2)]['name'],'segmentName':_0x10abcb});continue;}const _0x5cb7d1=generateDeterministicJourneySegmentName(_0x2b561b[_0x1c6c42(0xf2)][_0x1c6c42(0xa5)],_0x10abcb);_0x3a0e1a[_0x1c6c42(0xec)]?.({'type':_0x1c6c42(0x104),'journeyName':_0x2b561b['yamlConfig'][_0x1c6c42(0xa5)],'segmentName':_0x10abcb});const _0x4a61c5=createSegmentIdResolver(_0x318488[_0x1c6c42(0x115)],_0x10abcb),_0x48a531=await resolveRuleSegmentIds(_0x3d50cc['rule'],_0x4a61c5),_0x5e8144=await createOrRecoverEmbeddedSegment(_0x98e15a,_0x2b561b,{'localName':_0x10abcb,'uniqueSegmentName':_0x5cb7d1,'description':_0x3d50cc[_0x1c6c42(0x186)]||_0x1c6c42(0x114)+_0x10abcb,'journeyId':_0x1f32c3,'resolvedRule':_0x48a531,'parentId':_0x11bc67[_0x1c6c42(0xdc)],'folderId':_0x11bc67['effectiveFolderId']||''},_0x170bd0);_0x10b85b[_0x1c6c42(0xcc)](_0x10abcb,_0x5e8144),_0x318488[_0x1c6c42(0x115)][_0x1c6c42(0xcc)](_0x10abcb,_0x5e8144),_0x3a0e1a['onProgress']?.({'type':_0x1c6c42(0x168),'journeyName':_0x2b561b['yamlConfig'][_0x1c6c42(0xa5)],'segmentName':_0x10abcb});}const _0x375806=new Map();for(const [_0x48bf4a,_0x15f4b6]of _0x273b4f){_0x3a0e1a[_0x1c6c42(0xec)]?.({'type':_0x1c6c42(0xa1),'journeyName':_0x2b561b[_0x1c6c42(0xf2)][_0x1c6c42(0xa5)],'activationName':_0x48bf4a});const _0x439f94=await _0x49198a(_0x15f4b6,_0x318488[_0x1c6c42(0x171)]),_0x25a2ec={..._0x439f94,..._0x15f4b6['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x15f4b6[_0x1c6c42(0x13d)]}},_0x13a432=await _0x98e15a[_0x1c6c42(0x98)][_0x1c6c42(0xc0)](_0x1f32c3,_0x25a2ec);_0x375806['set'](_0x48bf4a,_0x13a432['id']),_0x50740c['journeyActivationNameToId'][_0x1c6c42(0xcc)](_0x48bf4a,_0x13a432['id']),_0x3a0e1a['onProgress']?.({'type':_0x1c6c42(0xa9),'journeyName':_0x2b561b[_0x1c6c42(0xf2)][_0x1c6c42(0xa5)],'activationName':_0x48bf4a});}const _0x2b9265=JSON['parse'](JSON['stringify'](_0x5989f4));return _0x2b9265['id']=_0x1f32c3,ensureJourneyDefaults(_0x2b9265[_0x1c6c42(0x18a)]),resolvePendingIdsInRequest(_0x2b9265,_0x5989f4,_0x34755f,_0x10b85b,_0x375806,_0x3a0e1a),await _0x98e15a[_0x1c6c42(0x98)][_0x1c6c42(0x94)](_0x1f32c3,_0x2b9265),deletePushRecovery(_0x2b561b['absolutePath']),{'action':_0x1c6c42(0xae),'journeyId':_0x1f32c3,'embeddedSegmentNameToId':_0x10b85b};}export function stripWaitStepPendingIds(_0x1dda7c){const _0x2e3118=a159_0x1187c8,_0x32ab2d=_0x1dda7c[_0x2e3118(0xa2)]&&isPendingSegmentId(_0x1dda7c[_0x2e3118(0xa2)]),_0x6f4776=_0x1dda7c['conditions']?.['some'](_0x1d9e74=>_0x1d9e74['segmentId']&&isPendingSegmentId(_0x1d9e74[_0x2e3118(0x185)]));(_0x32ab2d||_0x6f4776)&&(_0x1dda7c['waitStepType']=_0x2e3118(0x108),_0x1dda7c['waitStep']=0x1,_0x1dda7c[_0x2e3118(0x12c)]=_0x2e3118(0xf0),delete _0x1dda7c[_0x2e3118(0xa2)],delete _0x1dda7c[_0x2e3118(0xd8)],delete _0x1dda7c[_0x2e3118(0x138)],delete _0x1dda7c['conditions']);}export function resolveWaitStepPendingIds(_0x174a6b,_0x144261,_0x124e24,_0x44e434){const _0x55e270=a159_0x1187c8;if(_0x144261[_0x55e270(0xa2)]&&isPendingSegmentId(_0x144261['conditionSegmentId'])){const _0xc6395=_0x124e24(_0x144261[_0x55e270(0xa2)],_0x55e270(0x125)+_0x44e434+_0x55e270(0xe1));_0xc6395&&(_0x174a6b[_0x55e270(0xaa)]=_0x55e270(0x135),_0x174a6b['conditionSegmentId']=_0xc6395,delete _0x174a6b[_0x55e270(0x174)],delete _0x174a6b[_0x55e270(0x12c)],_0x144261[_0x55e270(0xd8)]!==undefined&&(_0x174a6b['conditionTimeoutDuration']=_0x144261[_0x55e270(0xd8)]),_0x144261[_0x55e270(0x138)]&&(_0x174a6b[_0x55e270(0x138)]=_0x144261['conditionTimeoutUnit']));}if(_0x144261['conditions']){const _0x4f3370=_0x144261[_0x55e270(0x16b)]['some'](_0x2bfcc3=>_0x2bfcc3[_0x55e270(0x185)]&&isPendingSegmentId(_0x2bfcc3['segmentId']));if(_0x4f3370){const _0x4b5541=_0x144261[_0x55e270(0x16b)][_0x55e270(0xbd)](_0x2e1b8f=>{const _0x449811=_0x55e270;if(_0x2e1b8f['segmentId']&&isPendingSegmentId(_0x2e1b8f[_0x449811(0x185)])){const _0x5755f7=_0x124e24(_0x2e1b8f[_0x449811(0x185)],_0x449811(0x125)+_0x44e434+_0x449811(0xe1));return{..._0x2e1b8f,'segmentId':_0x5755f7||_0x2e1b8f[_0x449811(0x185)]};}return{..._0x2e1b8f};});_0x174a6b[_0x55e270(0xaa)]=_0x55e270(0x135),_0x174a6b[_0x55e270(0x16b)]=_0x4b5541,delete _0x174a6b[_0x55e270(0x174)],delete _0x174a6b[_0x55e270(0x12c)],delete _0x174a6b['conditionSegmentId'],delete _0x174a6b[_0x55e270(0xd8)],delete _0x174a6b['conditionTimeoutUnit'];}}}function stripPendingIds(_0xc284bc){const _0x217e79=a159_0x1187c8;_0xc284bc[_0x217e79(0x18a)][_0x217e79(0xa4)]?.['segmentId']&&isPendingSegmentId(_0xc284bc[_0x217e79(0x18a)][_0x217e79(0xa4)][_0x217e79(0x185)])&&delete _0xc284bc[_0x217e79(0x18a)]['goal'];for(const _0x4a57d0 of _0xc284bc[_0x217e79(0x18a)][_0x217e79(0xe3)]||[]){_0x4a57d0[_0x217e79(0x88)]?.['segmentId']&&isPendingSegmentId(_0x4a57d0['entryCriteria'][_0x217e79(0x185)])&&delete _0x4a57d0['entryCriteria'];_0x4a57d0['milestone']?.['segmentId']&&isPendingSegmentId(_0x4a57d0[_0x217e79(0xce)][_0x217e79(0x185)])&&delete _0x4a57d0[_0x217e79(0xce)];_0x4a57d0[_0x217e79(0x152)]&&(_0x4a57d0[_0x217e79(0x152)]=_0x4a57d0['exitCriterias']['filter'](_0x1a0025=>!_0x1a0025[_0x217e79(0x185)]||!isPendingSegmentId(_0x1a0025[_0x217e79(0x185)])));if(_0x4a57d0[_0x217e79(0xd4)])for(const _0x302bf2 of Object[_0x217e79(0x188)](_0x4a57d0[_0x217e79(0xd4)])){const _0x5c4c6d=_0x4a57d0[_0x217e79(0xd4)][_0x302bf2];_0x5c4c6d['type']===_0x217e79(0x9a)&&_0x5c4c6d[_0x217e79(0x11c)]&&isPendingActivationId(_0x5c4c6d[_0x217e79(0x11c)])&&(_0x5c4c6d[_0x217e79(0x11c)]='');if(_0x5c4c6d[_0x217e79(0xd0)]===_0x217e79(0xff)&&_0x5c4c6d[_0x217e79(0x146)])for(const _0xc51ea0 of _0x5c4c6d[_0x217e79(0x146)]){_0xc51ea0[_0x217e79(0x185)]&&isPendingSegmentId(_0xc51ea0['segmentId'])&&(_0xc51ea0[_0x217e79(0x185)]='');}_0x5c4c6d[_0x217e79(0xd0)]===_0x217e79(0xac)&&stripWaitStepPendingIds(_0x5c4c6d);}}}function resolvePendingIdsInRequest(_0x503a49,_0x4c87dd,_0x386c54,_0x5d6aa1,_0x4fb358,_0x55fe93){const _0x586dc9=a159_0x1187c8,_0x4bb3b5=(_0x296105,_0x5afac7)=>{if(!isPendingSegmentId(_0x296105))return _0x296105;const _0x3d8e49=extractPendingSegmentName(_0x296105),_0xe89225=_0x5d6aa1['get'](_0x3d8e49);return!_0xe89225&&_0x55fe93['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x3d8e49+'\x27\x20for\x20'+_0x5afac7),_0xe89225;};if(_0x503a49['attributes'][_0x586dc9(0xa4)]?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x503a49['attributes'][_0x586dc9(0xa4)][_0x586dc9(0x185)])){const _0x4add7f=_0x4bb3b5(_0x503a49['attributes']['goal'][_0x586dc9(0x185)],_0x586dc9(0xf4));_0x4add7f&&(_0x503a49[_0x586dc9(0x18a)][_0x586dc9(0xa4)][_0x586dc9(0x185)]=_0x4add7f);}for(const _0x271be2 of _0x503a49['attributes'][_0x586dc9(0xe3)]||[]){const _0x22b28d=_0x386c54[_0x586dc9(0x16e)](_0x271be2['name'][_0x586dc9(0x128)]());_0x22b28d&&(_0x271be2['id']=_0x22b28d);if(_0x271be2[_0x586dc9(0x88)]?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x271be2[_0x586dc9(0x88)][_0x586dc9(0x185)])){const _0x9de45a=_0x4bb3b5(_0x271be2[_0x586dc9(0x88)][_0x586dc9(0x185)],_0x586dc9(0x125)+_0x271be2[_0x586dc9(0xa5)]+_0x586dc9(0xde));_0x9de45a&&(_0x271be2[_0x586dc9(0x88)]['segmentId']=_0x9de45a);}if(_0x271be2[_0x586dc9(0x152)])for(const _0x10c9e3 of _0x271be2[_0x586dc9(0x152)]){if(_0x10c9e3[_0x586dc9(0x185)]&&isPendingSegmentId(_0x10c9e3[_0x586dc9(0x185)])){const _0xacf616=_0x4bb3b5(_0x10c9e3[_0x586dc9(0x185)],_0x586dc9(0x125)+_0x271be2[_0x586dc9(0xa5)]+'\x27\x20exit\x20criteria');_0xacf616&&(_0x10c9e3[_0x586dc9(0x185)]=_0xacf616);}}if(_0x271be2[_0x586dc9(0xce)]?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x271be2[_0x586dc9(0xce)][_0x586dc9(0x185)])){const _0x2124d3=_0x4bb3b5(_0x271be2['milestone'][_0x586dc9(0x185)],_0x586dc9(0x125)+_0x271be2[_0x586dc9(0xa5)]+'\x27\x20milestone');_0x2124d3&&(_0x271be2[_0x586dc9(0xce)][_0x586dc9(0x185)]=_0x2124d3);}if(_0x271be2['steps']){const _0x4ff22a=_0xbab69d=>_0x4c87dd[_0x586dc9(0x18a)][_0x586dc9(0xe3)]?.[_0x586dc9(0x127)](_0x5ce862=>_0x5ce862[_0x586dc9(0xa5)][_0x586dc9(0x128)]()===_0x271be2[_0x586dc9(0xa5)][_0x586dc9(0x128)]())?.[_0x586dc9(0xd4)]?.[_0xbab69d];for(const _0x2f4cca of Object[_0x586dc9(0x188)](_0x271be2[_0x586dc9(0xd4)])){const _0xf0afae=_0x271be2[_0x586dc9(0xd4)][_0x2f4cca],_0x5635cf=_0x4ff22a(_0x2f4cca);if(_0xf0afae[_0x586dc9(0xd0)]===_0x586dc9(0x9a)&&_0xf0afae[_0x586dc9(0x11c)]&&(isPendingActivationId(_0xf0afae[_0x586dc9(0x11c)])||_0xf0afae[_0x586dc9(0x11c)]==='')){if(_0x5635cf?.[_0x586dc9(0x11c)]&&isPendingActivationId(_0x5635cf[_0x586dc9(0x11c)])){const _0x8167a8=extractPendingActivationName(_0x5635cf[_0x586dc9(0x11c)]),_0xd04b72=_0x4fb358['get'](_0x8167a8);_0xd04b72&&(_0xf0afae[_0x586dc9(0x11c)]=_0xd04b72);}}if(_0xf0afae['type']===_0x586dc9(0xff)&&_0xf0afae[_0x586dc9(0x146)]&&_0x5635cf?.[_0x586dc9(0x146)])for(let _0x42a5e6=0x0;_0x42a5e6<_0xf0afae['branches'][_0x586dc9(0x136)];_0x42a5e6++){const _0x25ad93=_0xf0afae[_0x586dc9(0x146)][_0x42a5e6],_0x53c96b=_0x5635cf[_0x586dc9(0x146)][_0x42a5e6];if(_0x53c96b?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x53c96b[_0x586dc9(0x185)])){const _0x53712c=_0x4bb3b5(_0x53c96b[_0x586dc9(0x185)],'stage\x20\x27'+_0x271be2[_0x586dc9(0xa5)]+_0x586dc9(0x13f)+(_0x25ad93['name']||_0x42a5e6)+'\x27');_0x53712c&&(_0x25ad93[_0x586dc9(0x185)]=_0x53712c);}}_0xf0afae[_0x586dc9(0xd0)]==='WaitStep'&&_0x5635cf?.['type']==='WaitStep'&&resolveWaitStepPendingIds(_0xf0afae,_0x5635cf,_0x4bb3b5,_0x271be2[_0x586dc9(0xa5)]);}}}}
@@ -1 +1 @@
1
- (function(_0x476b18,_0x254377){const _0x436db4=a160_0x1430,_0x46991c=_0x476b18();while(!![]){try{const _0x536f3c=parseInt(_0x436db4(0x154))/0x1*(parseInt(_0x436db4(0x14d))/0x2)+parseInt(_0x436db4(0x150))/0x3*(parseInt(_0x436db4(0x156))/0x4)+-parseInt(_0x436db4(0x14b))/0x5*(parseInt(_0x436db4(0x151))/0x6)+-parseInt(_0x436db4(0x14f))/0x7+-parseInt(_0x436db4(0x157))/0x8+parseInt(_0x436db4(0x152))/0x9+parseInt(_0x436db4(0x14c))/0xa;if(_0x536f3c===_0x254377)break;else _0x46991c['push'](_0x46991c['shift']());}catch(_0x9f0c73){_0x46991c['push'](_0x46991c['shift']());}}}(a160_0x3689,0x72ff8));export function buildFolderIdToPathMap(_0x46273f){const _0x21169c=a160_0x1430,_0x11c30d=new Map(),_0xbf8d0f=new Map();for(const _0x432d53 of _0x46273f){_0xbf8d0f[_0x21169c(0x158)](_0x432d53['id'],_0x432d53);}const _0x2f1082=new Set();for(const _0x13b53f of _0x46273f){!_0x13b53f['parentFolderId']&&_0x2f1082[_0x21169c(0x14e)](_0x13b53f['id']);}function _0x50ab51(_0x2dc663){const _0x3da10e=_0x21169c;if(_0x11c30d[_0x3da10e(0x15a)](_0x2dc663['id']))return _0x11c30d[_0x3da10e(0x155)](_0x2dc663['id']);if(_0x2f1082[_0x3da10e(0x15a)](_0x2dc663['id']))return _0x11c30d[_0x3da10e(0x158)](_0x2dc663['id'],''),'';if(_0x2dc663['parentFolderId']){const _0x5c7b5d=_0xbf8d0f[_0x3da10e(0x155)](_0x2dc663[_0x3da10e(0x153)]);if(_0x5c7b5d){const _0x4f3fce=_0x50ab51(_0x5c7b5d),_0x4a82ce=_0x4f3fce?_0x4f3fce+'/'+_0x2dc663[_0x3da10e(0x159)]:_0x2dc663[_0x3da10e(0x159)];return _0x11c30d['set'](_0x2dc663['id'],_0x4a82ce),_0x4a82ce;}}const _0x2d352a=_0x2dc663[_0x3da10e(0x159)];return _0x11c30d[_0x3da10e(0x158)](_0x2dc663['id'],_0x2d352a),_0x2d352a;}for(const _0xca82d2 of _0x46273f){_0x50ab51(_0xca82d2);}return _0x11c30d;}export function buildFolderPathToIdMap(_0x4ea946){const _0x151e77=a160_0x1430,_0x1b1f0a=new Map(),_0x2ced9e=new Map();for(const _0x7bc200 of _0x4ea946){_0x2ced9e[_0x151e77(0x158)](_0x7bc200['id'],_0x7bc200);}const _0x340683=new Set();for(const _0xce403e of _0x4ea946){!_0xce403e[_0x151e77(0x153)]&&_0x340683['add'](_0xce403e['id']);}function _0x553e72(_0x41e272){const _0x4d610a=_0x151e77;if(_0x340683[_0x4d610a(0x15a)](_0x41e272['id']))return'';if(_0x41e272[_0x4d610a(0x153)]){const _0x521ed8=_0x2ced9e[_0x4d610a(0x155)](_0x41e272[_0x4d610a(0x153)]);if(_0x521ed8){const _0x2d0650=_0x553e72(_0x521ed8);return _0x2d0650?_0x2d0650+'/'+_0x41e272['name']:_0x41e272[_0x4d610a(0x159)];}}return _0x41e272['name'];}for(const _0x9cbf4b of _0x4ea946){const _0x5c9382=_0x553e72(_0x9cbf4b);_0x1b1f0a[_0x151e77(0x158)](_0x5c9382,_0x9cbf4b['id']);}return _0x1b1f0a;}function a160_0x3689(){const _0x24aa09=['420pHWIQg','5773688cbqIzl','set','name','has','5MsVNNf','9287940HANyOB','673310EHoPsT','add','2442643mrVZHD','4074hKuMSt','4565838GSOWVW','8051634YUVloU','parentFolderId','1upUmcK','get'];a160_0x3689=function(){return _0x24aa09;};return a160_0x3689();}function a160_0x1430(_0x37e8db,_0x1e3b11){_0x37e8db=_0x37e8db-0x14b;const _0x36891a=a160_0x3689();let _0x143077=_0x36891a[_0x37e8db];return _0x143077;}export function buildFolderMaps(_0x302cea){const _0x3f60b8=a160_0x1430,_0x2967da=buildFolderIdToPathMap(_0x302cea),_0x2963dd=new Map();for(const [_0x240eac,_0x5d39da]of _0x2967da){_0x2963dd[_0x3f60b8(0x158)](_0x5d39da,_0x240eac);}return{'idToPath':_0x2967da,'pathToId':_0x2963dd};}export function getFolderPath(_0x223298,_0x211049){const _0xd432c6=a160_0x1430;if(!_0x223298)return'';return _0x211049[_0xd432c6(0x155)](_0x223298)??'';}
1
+ (function(_0x2de753,_0x869beb){const _0xcaa993=a160_0x3ca4,_0x18def3=_0x2de753();while(!![]){try{const _0x235971=-parseInt(_0xcaa993(0xf4))/0x1*(parseInt(_0xcaa993(0xfd))/0x2)+-parseInt(_0xcaa993(0xf5))/0x3+-parseInt(_0xcaa993(0xf7))/0x4*(-parseInt(_0xcaa993(0xfe))/0x5)+parseInt(_0xcaa993(0xf9))/0x6*(parseInt(_0xcaa993(0x103))/0x7)+-parseInt(_0xcaa993(0xff))/0x8*(parseInt(_0xcaa993(0xfc))/0x9)+-parseInt(_0xcaa993(0x105))/0xa*(parseInt(_0xcaa993(0xf8))/0xb)+parseInt(_0xcaa993(0xfa))/0xc*(parseInt(_0xcaa993(0xf3))/0xd);if(_0x235971===_0x869beb)break;else _0x18def3['push'](_0x18def3['shift']());}catch(_0x272e6a){_0x18def3['push'](_0x18def3['shift']());}}}(a160_0x48c1,0x3f201));function a160_0x3ca4(_0x3fedd4,_0x2bdf93){_0x3fedd4=_0x3fedd4-0xf3;const _0x48c15f=a160_0x48c1();let _0x3ca4fe=_0x48c15f[_0x3fedd4];return _0x3ca4fe;}export function buildFolderIdToPathMap(_0x1dda40){const _0x71d7=a160_0x3ca4,_0x4c258a=new Map(),_0x32efe4=new Map();for(const _0x56b1b7 of _0x1dda40){_0x32efe4[_0x71d7(0x101)](_0x56b1b7['id'],_0x56b1b7);}const _0x44c871=new Set();for(const _0x494750 of _0x1dda40){!_0x494750[_0x71d7(0xf6)]&&_0x44c871[_0x71d7(0x100)](_0x494750['id']);}function _0x57fecf(_0x506209){const _0x4b2e9e=_0x71d7;if(_0x4c258a[_0x4b2e9e(0x102)](_0x506209['id']))return _0x4c258a[_0x4b2e9e(0x104)](_0x506209['id']);if(_0x44c871['has'](_0x506209['id']))return _0x4c258a['set'](_0x506209['id'],''),'';if(_0x506209['parentFolderId']){const _0x3d4277=_0x32efe4['get'](_0x506209['parentFolderId']);if(_0x3d4277){const _0x522bd2=_0x57fecf(_0x3d4277),_0x5e9371=_0x522bd2?_0x522bd2+'/'+_0x506209[_0x4b2e9e(0xfb)]:_0x506209[_0x4b2e9e(0xfb)];return _0x4c258a['set'](_0x506209['id'],_0x5e9371),_0x5e9371;}}const _0x18637d=_0x506209[_0x4b2e9e(0xfb)];return _0x4c258a['set'](_0x506209['id'],_0x18637d),_0x18637d;}for(const _0x4a2b14 of _0x1dda40){_0x57fecf(_0x4a2b14);}return _0x4c258a;}export function buildFolderPathToIdMap(_0x322d9b){const _0x3c1fb6=a160_0x3ca4,_0x372c8a=new Map(),_0x39469a=new Map();for(const _0x1896c2 of _0x322d9b){_0x39469a[_0x3c1fb6(0x101)](_0x1896c2['id'],_0x1896c2);}const _0x5b1e24=new Set();for(const _0x4af6e8 of _0x322d9b){!_0x4af6e8[_0x3c1fb6(0xf6)]&&_0x5b1e24['add'](_0x4af6e8['id']);}function _0x425b63(_0x3687b8){const _0x149de9=_0x3c1fb6;if(_0x5b1e24[_0x149de9(0x102)](_0x3687b8['id']))return'';if(_0x3687b8['parentFolderId']){const _0x18ae74=_0x39469a['get'](_0x3687b8[_0x149de9(0xf6)]);if(_0x18ae74){const _0x24e7e5=_0x425b63(_0x18ae74);return _0x24e7e5?_0x24e7e5+'/'+_0x3687b8[_0x149de9(0xfb)]:_0x3687b8[_0x149de9(0xfb)];}}return _0x3687b8[_0x149de9(0xfb)];}for(const _0x356917 of _0x322d9b){const _0x3d89ed=_0x425b63(_0x356917);_0x372c8a[_0x3c1fb6(0x101)](_0x3d89ed,_0x356917['id']);}return _0x372c8a;}export function buildFolderMaps(_0x469ef0){const _0x3620d9=a160_0x3ca4,_0x4c6c94=buildFolderIdToPathMap(_0x469ef0),_0x15ff52=new Map();for(const [_0x59bddc,_0xa80c01]of _0x4c6c94){_0x15ff52[_0x3620d9(0x101)](_0xa80c01,_0x59bddc);}return{'idToPath':_0x4c6c94,'pathToId':_0x15ff52};}function a160_0x48c1(){const _0x2c789f=['3201DzyRDP','54ZPtmej','11108328rWrmKl','name','129321rMHgwj','33316Hcbzbj','47615hKMOYJ','8HcJQfF','add','set','has','57162fkdsIi','get','6980tPBIkm','13NHDTlb','22jnJPZQ','927096MawbfP','parentFolderId','64AKmcnV'];a160_0x48c1=function(){return _0x2c789f;};return a160_0x48c1();}export function getFolderPath(_0x36e5c9,_0x3daa80){const _0x203b87=a160_0x3ca4;if(!_0x36e5c9)return'';return _0x3daa80[_0x203b87(0x104)](_0x36e5c9)??'';}
@@ -1 +1 @@
1
- function a161_0x617e(){const _0x3baab4=['push','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Path\x20segment\x20cannot\x20be\x20empty','tdx.json','endsWith','357819rKtFiA','substring','length','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','name','1455436UMVkJM','.yaml','pop','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','replace','14oRjhkq','dirname','1085357wUZZzX','startsWith','join','.yml','Path\x20cannot\x20be\x20empty','slice','split','13190656akhlQh','readFile','parse','resolve','raw','exists','702102qumbMn','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','File\x20not\x20found:\x20','trim','relative','Cannot\x20navigate\x20above\x20root','3257260WBpuDw','Path\x20attempts\x20to\x20navigate\x20above\x20root','2876612DsFdcJ','segments','test','isAbsolute','segment'];a161_0x617e=function(){return _0x3baab4;};return a161_0x617e();}(function(_0x555ad9,_0x2abe8f){const _0x216288=a161_0x3329,_0xebfb8b=_0x555ad9();while(!![]){try{const _0x342df7=parseInt(_0x216288(0x159))/0x1+parseInt(_0x216288(0x152))/0x2+parseInt(_0x216288(0x14c))/0x3+parseInt(_0x216288(0x142))/0x4+-parseInt(_0x216288(0x140))/0x5+parseInt(_0x216288(0x166))/0x6*(parseInt(_0x216288(0x157))/0x7)+-parseInt(_0x216288(0x160))/0x8;if(_0x342df7===_0x2abe8f)break;else _0xebfb8b['push'](_0xebfb8b['shift']());}catch(_0x317ee7){_0xebfb8b['push'](_0xebfb8b['shift']());}}}(a161_0x617e,0x8ee23));import a161_0x22ddb9 from'path';import{parse as a161_0x70994}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';function a161_0x3329(_0x2cc0bb,_0x8ac9b){_0x2cc0bb=_0x2cc0bb-0x13e;const _0x617e12=a161_0x617e();let _0x33298b=_0x617e12[_0x2cc0bb];return _0x33298b;}import{isJourneyDef}from'./journey-yaml.js';export function parsePath(_0xbafc7a){const _0x3dd4cb=a161_0x3329;if(!_0xbafc7a||_0xbafc7a['trim']()==='')throw new Error(_0x3dd4cb(0x15d));const _0x31545a=_0xbafc7a[_0x3dd4cb(0x169)]();if(_0x31545a==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xbafc7a};const _0x41d798=_0x31545a[_0x3dd4cb(0x15a)]('/')?_0x31545a[_0x3dd4cb(0x14d)](0x1):_0x31545a,_0x210320=_0x41d798[_0x3dd4cb(0x15f)]('/')['filter'](_0x3fb5e3=>_0x3fb5e3!=='');if(_0x210320[_0x3dd4cb(0x14e)]===0x0)throw new Error(_0x3dd4cb(0x155));const _0x2d9412=_0x31545a[_0x3dd4cb(0x15a)]('/')||!isRelativePathSegment(_0x210320[0x0]);for(const _0x3abe1a of _0x210320){validatePathSegment(_0x3abe1a);}return{'segments':_0x210320,'isAbsolute':_0x2d9412,'raw':_0xbafc7a};}function isRelativePathSegment(_0x29a05a){return _0x29a05a==='.'||_0x29a05a==='..';}function validatePathSegment(_0x4d40c5){const _0x495976=a161_0x3329;if(_0x4d40c5==='')throw new Error(_0x495976(0x149));if(_0x4d40c5==='.'||_0x4d40c5==='..')return;if(/[\x00-\x1F\x7F]/[_0x495976(0x144)](_0x4d40c5))throw new Error(_0x495976(0x14f)+_0x4d40c5);if(_0x4d40c5!==_0x4d40c5[_0x495976(0x169)]()){}}export function validatePath(_0x20d05b){const _0x31bb47=a161_0x3329;if(_0x20d05b[_0x31bb47(0x143)][_0x31bb47(0x14e)]===0x0&&!_0x20d05b[_0x31bb47(0x145)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x20d05b[_0x31bb47(0x145)]){if(_0x20d05b[_0x31bb47(0x143)][0x0]==='..')throw new Error(_0x31bb47(0x167));let _0x4328e0=0x0;for(const _0x54fec6 of _0x20d05b['segments']){if(_0x54fec6==='..'){if(_0x4328e0===0x0)throw new Error(_0x31bb47(0x141));_0x4328e0--;}else _0x54fec6!=='.'&&_0x4328e0++;}}}export function joinPaths(_0x2742a8,_0x508a0e){const _0x3ec67a=a161_0x3329;if(!_0x2742a8||_0x2742a8==='/')return _0x508a0e;if(!_0x508a0e||_0x508a0e==='.')return _0x2742a8;if(_0x508a0e[_0x3ec67a(0x15a)]('/'))return _0x508a0e;const _0x5b6f64=parsePath(_0x2742a8),_0x74dce7=parsePath(_0x508a0e),_0x3c326d=[..._0x5b6f64[_0x3ec67a(0x143)]];for(const _0x514074 of _0x74dce7[_0x3ec67a(0x143)]){if(_0x514074==='.')continue;else{if(_0x514074==='..'){if(_0x3c326d[_0x3ec67a(0x14e)]===0x0)throw new Error(_0x3ec67a(0x13f));_0x3c326d[_0x3ec67a(0x154)]();}else _0x3c326d['push'](_0x514074);}}const _0x198d9a=_0x3c326d[_0x3ec67a(0x15b)]('/');return _0x5b6f64[_0x3ec67a(0x164)]['startsWith']('/')?'/'+_0x198d9a:_0x198d9a;}export function normalizePath(_0x5e8438){const _0x105cca=a161_0x3329,_0x2c0ac7=parsePath(_0x5e8438),_0x2342b5=[];for(const _0x1f851a of _0x2c0ac7[_0x105cca(0x143)]){if(_0x1f851a==='.')continue;else{if(_0x1f851a==='..'){if(_0x2342b5[_0x105cca(0x14e)]===0x0){if(_0x2c0ac7[_0x105cca(0x145)])throw new Error(_0x105cca(0x13f));_0x2342b5[_0x105cca(0x147)]('..');}else _0x2342b5[_0x2342b5[_0x105cca(0x14e)]-0x1]==='..'?_0x2342b5[_0x105cca(0x147)]('..'):_0x2342b5[_0x105cca(0x154)]();}else _0x2342b5[_0x105cca(0x147)](_0x1f851a);}}if(_0x2342b5['length']===0x0)return _0x2c0ac7['isAbsolute']?'/':'.';const _0x114775=_0x2342b5[_0x105cca(0x15b)]('/');return _0x2c0ac7[_0x105cca(0x164)]['startsWith']('/')?'/'+_0x114775:_0x114775;}export function getParentPath(_0x383b77){const _0x3f9dee=a161_0x3329,_0x5869ef=parsePath(_0x383b77);if(_0x5869ef[_0x3f9dee(0x143)][_0x3f9dee(0x14e)]<=0x1)return'/';const _0x42e003=_0x5869ef[_0x3f9dee(0x143)][_0x3f9dee(0x15e)](0x0,-0x1)[_0x3f9dee(0x15b)]('/');return _0x5869ef[_0x3f9dee(0x164)]['startsWith']('/')?'/'+_0x42e003:_0x42e003;}export function getBaseName(_0x350d26){const _0x39eeea=a161_0x3329,_0x2f735d=parsePath(_0x350d26);return _0x2f735d[_0x39eeea(0x143)][_0x2f735d['segments']['length']-0x1]||'';}export function isChildPath(_0x5b61fa,_0x37872b){const _0x81f28f=a161_0x3329,_0x2bc171=parsePath(_0x5b61fa),_0x5814c7=parsePath(_0x37872b);if(_0x2bc171[_0x81f28f(0x143)][_0x81f28f(0x14e)]<=_0x5814c7[_0x81f28f(0x143)][_0x81f28f(0x14e)])return![];for(let _0x55c8ea=0x0;_0x55c8ea<_0x5814c7['segments']['length'];_0x55c8ea++){if(_0x2bc171[_0x81f28f(0x143)][_0x55c8ea]!==_0x5814c7[_0x81f28f(0x143)][_0x55c8ea])return![];}return!![];}export function splitPath(_0x148cfb){const _0x3f0ca2=a161_0x3329,_0x41fea1=parsePath(_0x148cfb);if(_0x41fea1['segments'][_0x3f0ca2(0x14e)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x41fea1[_0x3f0ca2(0x143)][_0x3f0ca2(0x14e)]===0x1)return{'parent':_0x41fea1['segments'][0x0]};return{'parent':_0x41fea1[_0x3f0ca2(0x143)][0x0],'child':_0x41fea1['segments'][_0x3f0ca2(0x15e)](0x1)[_0x3f0ca2(0x15b)]('/')};}export function isYamlFilePath(_0x4fbaf8){const _0x463271=a161_0x3329;return _0x4fbaf8['endsWith'](_0x463271(0x15c))||_0x4fbaf8[_0x463271(0x14b)](_0x463271(0x153));}export async function resolveYamlFilePath(_0x42d4a6,_0x5c1e15=nodeFileSystem){const _0x19b5ff=a161_0x3329,_0x153edf=a161_0x22ddb9[_0x19b5ff(0x163)](_0x42d4a6);if(!await _0x5c1e15[_0x19b5ff(0x165)](_0x153edf))throw new Error(_0x19b5ff(0x168)+_0x42d4a6);let _0xf6bc87=a161_0x22ddb9[_0x19b5ff(0x158)](_0x153edf),_0x2a1d75=null,_0x3fc810=null;const _0x9913e=a161_0x22ddb9[_0x19b5ff(0x162)](_0xf6bc87)['root'];while(_0xf6bc87!==_0x9913e){const _0x1a981d=a161_0x22ddb9[_0x19b5ff(0x15b)](_0xf6bc87,_0x19b5ff(0x14a));if(await _0x5c1e15[_0x19b5ff(0x165)](_0x1a981d)){_0x2a1d75=_0x1a981d,_0x3fc810=_0xf6bc87;break;}_0xf6bc87=a161_0x22ddb9[_0x19b5ff(0x158)](_0xf6bc87);}if(!_0x2a1d75||!_0x3fc810)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x42d4a6+'\x0a'+_0x19b5ff(0x150));const _0x4df895=await _0x5c1e15[_0x19b5ff(0x161)](_0x2a1d75),_0x3bf21f=JSON[_0x19b5ff(0x162)](_0x4df895),_0x2ec7d7=_0x3bf21f['parent_segment'];if(!_0x2ec7d7)throw new Error(_0x19b5ff(0x148));const _0xf6dd60=await _0x5c1e15[_0x19b5ff(0x161)](_0x153edf),_0x1dee44=a161_0x70994(_0xf6dd60),_0x3f4b4e=_0x1dee44[_0x19b5ff(0x151)];if(!_0x3f4b4e)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x42d4a6);const _0x10d29a=isJourneyDef(_0x1dee44,_0x153edf)?'journey':_0x19b5ff(0x146),_0xf6c417=a161_0x22ddb9[_0x19b5ff(0x13e)](_0x3fc810,_0x153edf),_0x2263af=a161_0x22ddb9[_0x19b5ff(0x158)](_0xf6c417),_0x3effe7=_0x2263af==='.'?'':_0x2263af[_0x19b5ff(0x156)](/\\/g,'/'),_0x28851f=_0x3effe7?_0x2ec7d7+'/'+_0x3effe7+'/'+_0x3f4b4e:_0x2ec7d7+'/'+_0x3f4b4e;return{'parentSegment':_0x2ec7d7,'segmentName':_0x3f4b4e,'folderPath':_0x3effe7,'fullPath':_0x28851f,'resourceType':_0x10d29a,'content':_0xf6dd60};}
1
+ (function(_0x3c0d88,_0x4a8ab2){const _0x5e46fc=a161_0x2519,_0x9ee83e=_0x3c0d88();while(!![]){try{const _0x2e15ae=parseInt(_0x5e46fc(0x14e))/0x1+-parseInt(_0x5e46fc(0x152))/0x2+parseInt(_0x5e46fc(0x171))/0x3+parseInt(_0x5e46fc(0x156))/0x4*(-parseInt(_0x5e46fc(0x16b))/0x5)+-parseInt(_0x5e46fc(0x177))/0x6+parseInt(_0x5e46fc(0x176))/0x7*(-parseInt(_0x5e46fc(0x153))/0x8)+parseInt(_0x5e46fc(0x16c))/0x9*(parseInt(_0x5e46fc(0x16d))/0xa);if(_0x2e15ae===_0x4a8ab2)break;else _0x9ee83e['push'](_0x9ee83e['shift']());}catch(_0x416491){_0x9ee83e['push'](_0x9ee83e['shift']());}}}(a161_0xc3fc,0xe3263));import a161_0x383b8f from'path';import{parse as a161_0x3b2299}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';import{isJourneyDef}from'./journey-yaml.js';export function parsePath(_0x9c9baa){const _0x2fa068=a161_0x2519;if(!_0x9c9baa||_0x9c9baa[_0x2fa068(0x162)]()==='')throw new Error(_0x2fa068(0x179));const _0x49cdd8=_0x9c9baa[_0x2fa068(0x162)]();if(_0x49cdd8==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x9c9baa};const _0x86e074=_0x49cdd8[_0x2fa068(0x15e)]('/')?_0x49cdd8[_0x2fa068(0x14f)](0x1):_0x49cdd8,_0x52ede4=_0x86e074[_0x2fa068(0x157)]('/')[_0x2fa068(0x160)](_0x355ce3=>_0x355ce3!=='');if(_0x52ede4['length']===0x0)throw new Error(_0x2fa068(0x169));const _0x3e4bef=_0x49cdd8['startsWith']('/')||!isRelativePathSegment(_0x52ede4[0x0]);for(const _0x28ed1f of _0x52ede4){validatePathSegment(_0x28ed1f);}return{'segments':_0x52ede4,'isAbsolute':_0x3e4bef,'raw':_0x9c9baa};}function isRelativePathSegment(_0x3f8371){return _0x3f8371==='.'||_0x3f8371==='..';}function a161_0x2519(_0x34775a,_0x511323){_0x34775a=_0x34775a-0x14c;const _0xc3fceb=a161_0xc3fc();let _0x251997=_0xc3fceb[_0x34775a];return _0x251997;}function a161_0xc3fc(){const _0x5332ff=['length','startsWith','resolve','filter','parse','trim','readFile','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Path\x20segment\x20cannot\x20be\x20empty','.yaml','slice','isAbsolute','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','tdx.json','36665jHCvvF','18576135IxuOmL','10xInYFP','push','root','Cannot\x20split\x20empty\x20path','4702794kEMoMb','segments','join','pop','File\x20not\x20found:\x20','22463QaevBV','4274388eLsUNy','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20cannot\x20be\x20empty','segment','Cannot\x20navigate\x20above\x20root','endsWith','1220022tiEoLH','substring','dirname','journey','2949528UCyelp','2696LrIMmF','raw','test','356RVYSUR','split','exists','.yml','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','parent_segment','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22'];a161_0xc3fc=function(){return _0x5332ff;};return a161_0xc3fc();}function validatePathSegment(_0x5c32f1){const _0x89ecce=a161_0x2519;if(_0x5c32f1==='')throw new Error(_0x89ecce(0x165));if(_0x5c32f1==='.'||_0x5c32f1==='..')return;if(/[\x00-\x1F\x7F]/[_0x89ecce(0x155)](_0x5c32f1))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x5c32f1);if(_0x5c32f1!==_0x5c32f1['trim']()){}}export function validatePath(_0x4a34b8){const _0x2c9ef2=a161_0x2519;if(_0x4a34b8[_0x2c9ef2(0x172)]['length']===0x0&&!_0x4a34b8[_0x2c9ef2(0x168)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x4a34b8[_0x2c9ef2(0x168)]){if(_0x4a34b8['segments'][0x0]==='..')throw new Error(_0x2c9ef2(0x15c));let _0x1b47de=0x0;for(const _0x2127f3 of _0x4a34b8['segments']){if(_0x2127f3==='..'){if(_0x1b47de===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x1b47de--;}else _0x2127f3!=='.'&&_0x1b47de++;}}}export function joinPaths(_0x911b8e,_0x40a1db){const _0x580445=a161_0x2519;if(!_0x911b8e||_0x911b8e==='/')return _0x40a1db;if(!_0x40a1db||_0x40a1db==='.')return _0x911b8e;if(_0x40a1db['startsWith']('/'))return _0x40a1db;const _0x294a04=parsePath(_0x911b8e),_0xec1623=parsePath(_0x40a1db),_0x359c1c=[..._0x294a04[_0x580445(0x172)]];for(const _0x4cdd3d of _0xec1623[_0x580445(0x172)]){if(_0x4cdd3d==='.')continue;else{if(_0x4cdd3d==='..'){if(_0x359c1c['length']===0x0)throw new Error(_0x580445(0x14c));_0x359c1c[_0x580445(0x174)]();}else _0x359c1c[_0x580445(0x16e)](_0x4cdd3d);}}const _0x41636c=_0x359c1c['join']('/');return _0x294a04[_0x580445(0x154)]['startsWith']('/')?'/'+_0x41636c:_0x41636c;}export function normalizePath(_0x590cb6){const _0xc4b9a4=a161_0x2519,_0x103216=parsePath(_0x590cb6),_0x20a4af=[];for(const _0x286933 of _0x103216[_0xc4b9a4(0x172)]){if(_0x286933==='.')continue;else{if(_0x286933==='..'){if(_0x20a4af[_0xc4b9a4(0x15d)]===0x0){if(_0x103216[_0xc4b9a4(0x168)])throw new Error(_0xc4b9a4(0x14c));_0x20a4af[_0xc4b9a4(0x16e)]('..');}else _0x20a4af[_0x20a4af[_0xc4b9a4(0x15d)]-0x1]==='..'?_0x20a4af['push']('..'):_0x20a4af[_0xc4b9a4(0x174)]();}else _0x20a4af[_0xc4b9a4(0x16e)](_0x286933);}}if(_0x20a4af[_0xc4b9a4(0x15d)]===0x0)return _0x103216[_0xc4b9a4(0x168)]?'/':'.';const _0x2cfaca=_0x20a4af['join']('/');return _0x103216['raw']['startsWith']('/')?'/'+_0x2cfaca:_0x2cfaca;}export function getParentPath(_0x37379a){const _0x495310=a161_0x2519,_0x221738=parsePath(_0x37379a);if(_0x221738[_0x495310(0x172)][_0x495310(0x15d)]<=0x1)return'/';const _0x5915f2=_0x221738[_0x495310(0x172)][_0x495310(0x167)](0x0,-0x1)['join']('/');return _0x221738[_0x495310(0x154)][_0x495310(0x15e)]('/')?'/'+_0x5915f2:_0x5915f2;}export function getBaseName(_0x5054a9){const _0x4b313c=a161_0x2519,_0x213d9c=parsePath(_0x5054a9);return _0x213d9c[_0x4b313c(0x172)][_0x213d9c[_0x4b313c(0x172)][_0x4b313c(0x15d)]-0x1]||'';}export function isChildPath(_0x4ac0c5,_0x3b8518){const _0x4771e6=a161_0x2519,_0x4c3d9b=parsePath(_0x4ac0c5),_0x161b8b=parsePath(_0x3b8518);if(_0x4c3d9b[_0x4771e6(0x172)][_0x4771e6(0x15d)]<=_0x161b8b[_0x4771e6(0x172)][_0x4771e6(0x15d)])return![];for(let _0xe52704=0x0;_0xe52704<_0x161b8b['segments']['length'];_0xe52704++){if(_0x4c3d9b['segments'][_0xe52704]!==_0x161b8b[_0x4771e6(0x172)][_0xe52704])return![];}return!![];}export function splitPath(_0x30e3a7){const _0x3defff=a161_0x2519,_0x1566e0=parsePath(_0x30e3a7);if(_0x1566e0[_0x3defff(0x172)]['length']===0x0)throw new Error(_0x3defff(0x170));if(_0x1566e0[_0x3defff(0x172)][_0x3defff(0x15d)]===0x1)return{'parent':_0x1566e0['segments'][0x0]};return{'parent':_0x1566e0[_0x3defff(0x172)][0x0],'child':_0x1566e0['segments'][_0x3defff(0x167)](0x1)[_0x3defff(0x173)]('/')};}export function isYamlFilePath(_0x272fdc){const _0x5a11ca=a161_0x2519;return _0x272fdc[_0x5a11ca(0x14d)](_0x5a11ca(0x159))||_0x272fdc[_0x5a11ca(0x14d)](_0x5a11ca(0x166));}export async function resolveYamlFilePath(_0x1b5c45,_0x580818=nodeFileSystem){const _0x19eb86=a161_0x2519,_0x3cdb6d=a161_0x383b8f[_0x19eb86(0x15f)](_0x1b5c45);if(!await _0x580818[_0x19eb86(0x158)](_0x3cdb6d))throw new Error(_0x19eb86(0x175)+_0x1b5c45);let _0x495f1f=a161_0x383b8f[_0x19eb86(0x150)](_0x3cdb6d),_0x12fb09=null,_0x1c55eb=null;const _0x43a979=a161_0x383b8f[_0x19eb86(0x161)](_0x495f1f)[_0x19eb86(0x16f)];while(_0x495f1f!==_0x43a979){const _0x4d97aa=a161_0x383b8f[_0x19eb86(0x173)](_0x495f1f,_0x19eb86(0x16a));if(await _0x580818['exists'](_0x4d97aa)){_0x12fb09=_0x4d97aa,_0x1c55eb=_0x495f1f;break;}_0x495f1f=a161_0x383b8f[_0x19eb86(0x150)](_0x495f1f);}if(!_0x12fb09||!_0x1c55eb)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x1b5c45+'\x0a'+_0x19eb86(0x178));const _0x3e0bcc=await _0x580818[_0x19eb86(0x163)](_0x12fb09),_0x29b4da=JSON[_0x19eb86(0x161)](_0x3e0bcc),_0x57e3aa=_0x29b4da[_0x19eb86(0x15b)];if(!_0x57e3aa)throw new Error(_0x19eb86(0x15a));const _0x5c8eef=await _0x580818[_0x19eb86(0x163)](_0x3cdb6d),_0x3210a3=a161_0x3b2299(_0x5c8eef),_0x2580ef=_0x3210a3['name'];if(!_0x2580ef)throw new Error(_0x19eb86(0x164)+_0x1b5c45);const _0x152b9b=isJourneyDef(_0x3210a3,_0x3cdb6d)?_0x19eb86(0x151):_0x19eb86(0x17a),_0x42c4af=a161_0x383b8f['relative'](_0x1c55eb,_0x3cdb6d),_0x46f396=a161_0x383b8f['dirname'](_0x42c4af),_0x4b0203=_0x46f396==='.'?'':_0x46f396['replace'](/\\/g,'/'),_0x533df7=_0x4b0203?_0x57e3aa+'/'+_0x4b0203+'/'+_0x2580ef:_0x57e3aa+'/'+_0x2580ef;return{'parentSegment':_0x57e3aa,'segmentName':_0x2580ef,'folderPath':_0x4b0203,'fullPath':_0x533df7,'resourceType':_0x152b9b,'content':_0x5c8eef};}
@@ -1 +1 @@
1
- (function(_0x343880,_0x4148ad){const _0x4edb48=a162_0x559f,_0x58b1cc=_0x343880();while(!![]){try{const _0x3e07b4=-parseInt(_0x4edb48(0xbf))/0x1*(parseInt(_0x4edb48(0xc5))/0x2)+parseInt(_0x4edb48(0xcd))/0x3*(parseInt(_0x4edb48(0xc7))/0x4)+parseInt(_0x4edb48(0xc8))/0x5*(parseInt(_0x4edb48(0xcb))/0x6)+-parseInt(_0x4edb48(0xcc))/0x7+-parseInt(_0x4edb48(0xc1))/0x8+-parseInt(_0x4edb48(0xc6))/0x9*(-parseInt(_0x4edb48(0xc3))/0xa)+-parseInt(_0x4edb48(0xc9))/0xb*(parseInt(_0x4edb48(0xca))/0xc);if(_0x3e07b4===_0x4148ad)break;else _0x58b1cc['push'](_0x58b1cc['shift']());}catch(_0x20cf18){_0x58b1cc['push'](_0x58b1cc['shift']());}}}(a162_0x4809,0x88c31));function a162_0x4809(){const _0x383854=['3oldkwQ','substring','2208968tCpUdD','.\x20Parent\x20name\x20cannot\x20be\x20empty','5690710JUwhRX','indexOf','128874tznadc','9eiVszZ','156076ysHwJC','466885VvwioI','4433WyQWVM','17052HiGPyY','30tQvowf','679049wFUuui','51xKcjkx','Invalid\x20segment\x20reference\x20format:\x20'];a162_0x4809=function(){return _0x383854;};return a162_0x4809();}function a162_0x559f(_0x5b57dc,_0x2f0848){_0x5b57dc=_0x5b57dc-0xbf;const _0x4809e4=a162_0x4809();let _0x559f81=_0x4809e4[_0x5b57dc];return _0x559f81;}export function parseSegmentRef(_0x1cf13c){const _0x2d7e8c=a162_0x559f,_0x112845=_0x1cf13c[_0x2d7e8c(0xc4)]('/');if(_0x112845===-0x1)return{'parentId':_0x1cf13c};if(_0x112845===0x0)throw new Error(_0x2d7e8c(0xce)+_0x1cf13c+_0x2d7e8c(0xc2));const _0x5812c2=_0x1cf13c[_0x2d7e8c(0xc0)](0x0,_0x112845),_0x4d202c=_0x1cf13c[_0x2d7e8c(0xc0)](_0x112845+0x1);if(_0x4d202c==='')throw new Error(_0x2d7e8c(0xce)+_0x1cf13c+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x5812c2,'childId':_0x4d202c};}
1
+ function a162_0x8f7a(_0x2a2059,_0x27875a){_0x2a2059=_0x2a2059-0xee;const _0x3308b9=a162_0x3308();let _0x8f7ae=_0x3308b9[_0x2a2059];return _0x8f7ae;}function a162_0x3308(){const _0x2c30c2=['4338wwRSDn','indexOf','1576luDstu','Invalid\x20segment\x20reference\x20format:\x20','66879wsukfS','.\x20Parent\x20name\x20cannot\x20be\x20empty','6786500cHNpBT','36CFitbJ','.\x20Child\x20name\x20cannot\x20be\x20empty','2249604ZKMGBf','4770SeoPyk','17577abYGwR','2548294nXkptf','1312048WChPfS'];a162_0x3308=function(){return _0x2c30c2;};return a162_0x3308();}(function(_0x4379e5,_0x5d7a4a){const _0xd5f037=a162_0x8f7a,_0x151811=_0x4379e5();while(!![]){try{const _0x2f788c=parseInt(_0xd5f037(0xf0))/0x1+parseInt(_0xd5f037(0xef))/0x2+-parseInt(_0xd5f037(0xee))/0x3*(parseInt(_0xd5f037(0xf8))/0x4)+-parseInt(_0xd5f037(0xfb))/0x5*(-parseInt(_0xd5f037(0xf1))/0x6)+-parseInt(_0xd5f037(0xfa))/0x7+parseInt(_0xd5f037(0xf3))/0x8*(-parseInt(_0xd5f037(0xf5))/0x9)+-parseInt(_0xd5f037(0xf7))/0xa;if(_0x2f788c===_0x5d7a4a)break;else _0x151811['push'](_0x151811['shift']());}catch(_0x14a4e5){_0x151811['push'](_0x151811['shift']());}}}(a162_0x3308,0xb95ed));export function parseSegmentRef(_0x44fb82){const _0x4d2b25=a162_0x8f7a,_0x33b5dc=_0x44fb82[_0x4d2b25(0xf2)]('/');if(_0x33b5dc===-0x1)return{'parentId':_0x44fb82};if(_0x33b5dc===0x0)throw new Error(_0x4d2b25(0xf4)+_0x44fb82+_0x4d2b25(0xf6));const _0x55c3d8=_0x44fb82['substring'](0x0,_0x33b5dc),_0x263570=_0x44fb82['substring'](_0x33b5dc+0x1);if(_0x263570==='')throw new Error(_0x4d2b25(0xf4)+_0x44fb82+_0x4d2b25(0xf9));return{'parentId':_0x55c3d8,'childId':_0x263570};}
@@ -1 +1 @@
1
- (function(_0x4c054f,_0x181f15){const _0x31596c=a163_0x4672,_0x323c89=_0x4c054f();while(!![]){try{const _0x4fba3f=-parseInt(_0x31596c(0xe8))/0x1+parseInt(_0x31596c(0xd8))/0x2+-parseInt(_0x31596c(0xef))/0x3*(-parseInt(_0x31596c(0x110))/0x4)+parseInt(_0x31596c(0xd0))/0x5*(-parseInt(_0x31596c(0xf0))/0x6)+-parseInt(_0x31596c(0x11b))/0x7+parseInt(_0x31596c(0xdf))/0x8+parseInt(_0x31596c(0xe0))/0x9*(-parseInt(_0x31596c(0xdc))/0xa);if(_0x4fba3f===_0x181f15)break;else _0x323c89['push'](_0x323c89['shift']());}catch(_0x2b3378){_0x323c89['push'](_0x323c89['shift']());}}}(a163_0x3900,0xab3fe));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x130c44,_0x35213a={},_0x2d824e={}){const _0x506ff2=a163_0x4672;if(_0x2d824e[_0x506ff2(0x109)])return runSemanticChecks(_0x130c44,_0x35213a);const _0x24afbd=SegmentDefSchema[_0x506ff2(0xd6)](_0x130c44);if(_0x24afbd[_0x506ff2(0xe6)])return runSemanticChecks(_0x24afbd['data'],_0x35213a);return zodErrorsToValidationResult(_0x24afbd[_0x506ff2(0xe2)],_0x35213a);}export function validateRuleDef(_0x91558a,_0x5f1ed3,_0x573663){const _0x31a365=a163_0x4672;if(!_0x91558a)return[];const _0x2d558a=RuleDefSchema[_0x31a365(0xd6)](_0x91558a);if(_0x2d558a[_0x31a365(0xe6)])return checkRule(_0x2d558a[_0x31a365(0x106)],_0x5f1ed3,_0x573663);const _0x5e8426=flattenZodIssues(_0x2d558a['error'][_0x31a365(0xe3)]);return _0x5e8426[_0x31a365(0xd7)](_0x57bbd1=>{const _0x2ae324=_0x31a365,_0x25e844=formatZodPath(_0x57bbd1['path']),_0x5d3aed=_0x25e844?_0x5f1ed3+'.'+_0x25e844:_0x5f1ed3,_0x1788f7=mapZodIssueToCode(_0x57bbd1,_0x25e844),_0x31dd0d=getLocationFromPath(_0x573663['document'],_0x573663[_0x2ae324(0x10f)],pathToArray(_0x5d3aed));return{'level':_0x2ae324(0xe2),'path':_0x5d3aed,'code':_0x1788f7,'message':_0x57bbd1['message'],..._0x31dd0d&&{'location':_0x31dd0d}};});}function zodErrorsToValidationResult(_0x916150,_0x44f16d){const _0x507e21=a163_0x4672,_0x3abb86=flattenZodIssues(_0x916150[_0x507e21(0xe3)]),_0x7b32db=_0x3abb86[_0x507e21(0xd7)](_0x43c6ee=>{const _0x321585=_0x507e21,_0x16e736=formatZodPath(_0x43c6ee[_0x321585(0xd2)]),_0xce3f98=mapZodIssueToCode(_0x43c6ee,_0x16e736),_0x4f28b6=getLocationFromPath(_0x44f16d[_0x321585(0x10a)],_0x44f16d[_0x321585(0x10f)],_0x43c6ee['path'][_0x321585(0xd7)](_0x3bd07e=>typeof _0x3bd07e===_0x321585(0xd4)?String(_0x3bd07e):_0x3bd07e));return{'level':_0x321585(0xe2),'path':_0x16e736,'code':_0xce3f98,'message':_0x43c6ee['message'],..._0x4f28b6&&{'location':_0x4f28b6}};});return{'valid':![],'errors':_0x7b32db,'warnings':[]};}function mapZodIssueToCode(_0x530588,_0x7c3c10){const _0x330d5d=a163_0x4672,_0x1b33b2=_0x530588[_0x330d5d(0x10d)]===_0x330d5d(0xf1)?_0x530588[_0x330d5d(0x113)]:undefined;if(_0x7c3c10==='name')return _0x330d5d(0xf6);if(_0x7c3c10===_0x330d5d(0xe7)||_0x7c3c10[_0x330d5d(0xf7)](_0x330d5d(0xd9))){if(_0x530588['code']===_0x330d5d(0x10e)){if(_0x7c3c10==='rule.type'||_0x7c3c10['match'](/\.conditions\[\d+\]\.type$/))return _0x330d5d(0x108);}}if(_0x7c3c10['endsWith'](_0x330d5d(0x107)))return _0x330d5d(0xed);if(_0x7c3c10[_0x330d5d(0xf7)]('.operator.value'))return _0x330d5d(0xdd);if(_0x1b33b2?.[_0x330d5d(0x111)]==='MISSING_BETWEEN_BOUNDS')return _0x330d5d(0xda);if(_0x1b33b2?.[_0x330d5d(0x111)]===_0x330d5d(0x112))return'MISSING_TIME_UNIT';if(_0x7c3c10[_0x330d5d(0xf7)](_0x330d5d(0xfa))||_0x7c3c10==='conditions')return _0x330d5d(0x11c);if(_0x7c3c10[_0x330d5d(0xcb)](_0x330d5d(0xde)))return _0x330d5d(0xf4);if(_0x7c3c10[_0x330d5d(0xf7)]('.segment'))return _0x330d5d(0xf5);return _0x330d5d(0x105);}function runSemanticChecks(_0x243b2c,_0x320d75){const _0x2855af=a163_0x4672,_0x383bb6=[];_0x243b2c[_0x2855af(0x104)]&&_0x383bb6[_0x2855af(0x11d)](...checkRule(_0x243b2c[_0x2855af(0x104)],_0x2855af(0x104),_0x320d75));const _0x35e2ce=_0x383bb6[_0x2855af(0xf8)](_0xb5457c=>_0xb5457c[_0x2855af(0xf9)]===_0x2855af(0xe2)),_0x1cd6a3=_0x383bb6['filter'](_0x20448e=>_0x20448e[_0x2855af(0xf9)]===_0x2855af(0xfb));return{'valid':_0x35e2ce[_0x2855af(0x117)]===0x0,'errors':_0x35e2ce,'warnings':_0x1cd6a3};}function checkRule(_0x501195,_0x31a3c0,_0x1a42d2){const _0x1cb588=a163_0x4672,_0x207aa6=[];if(_0x501195['conditions'][_0x1cb588(0x117)]===0x0)return _0x207aa6[_0x1cb588(0x11d)]({'level':_0x1cb588(0xe2),'path':_0x31a3c0+_0x1cb588(0xfa),'code':_0x1cb588(0x101),'message':_0x1cb588(0xf3),'location':getLocationFromPath(_0x1a42d2[_0x1cb588(0x10a)],_0x1a42d2[_0x1cb588(0x10f)],pathToArray(_0x31a3c0+'.conditions'))}),_0x207aa6;return _0x207aa6['push'](...checkConditions(_0x501195[_0x1cb588(0xca)],_0x31a3c0,_0x1a42d2)),_0x207aa6;}function checkConditions(_0x261e10,_0x5c50ff,_0x14a835){const _0x29d92b=a163_0x4672,_0x4ae793=[];for(let _0x4a114e=0x0;_0x4a114e<_0x261e10[_0x29d92b(0x117)];_0x4a114e++){const _0x5c9f9c=_0x261e10[_0x4a114e],_0x2bf72a=_0x5c50ff+_0x29d92b(0xec)+_0x4a114e+']';_0x4ae793[_0x29d92b(0x11d)](...checkCondition(_0x5c9f9c,_0x2bf72a,_0x14a835));}return _0x4ae793;}function checkCondition(_0x3bd55c,_0x4762ba,_0x5e2f2f){const _0x2f5684=a163_0x4672,_0x4c51c6=[];if(_0x3bd55c[_0x2f5684(0xe9)]===_0x2f5684(0xfe)||_0x3bd55c[_0x2f5684(0xe9)]==='Or'||_0x3bd55c[_0x2f5684(0xe9)]===_0x2f5684(0x115)){if(_0x3bd55c['conditions'][_0x2f5684(0x117)]===0x0)_0x4c51c6[_0x2f5684(0x11d)]({'level':_0x2f5684(0xe2),'path':_0x4762ba+'.conditions','code':_0x2f5684(0x101),'message':_0x3bd55c[_0x2f5684(0xe9)]+_0x2f5684(0xfc),'location':getLocationFromPath(_0x5e2f2f[_0x2f5684(0x10a)],_0x5e2f2f[_0x2f5684(0x10f)],pathToArray(_0x4762ba+'.conditions'))});else{const _0x37c00d=_0x3bd55c['description']!==undefined,_0x264a68=_0x3bd55c[_0x2f5684(0xe9)]==='Composite';!_0x37c00d&&!_0x264a68&&_0x4c51c6[_0x2f5684(0x11d)]({'level':_0x2f5684(0xfb),'path':_0x4762ba,'code':_0x2f5684(0xd5),'message':_0x3bd55c[_0x2f5684(0xe9)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x2f5684(0x10c)+_0x2f5684(0xcc),'location':getLocationFromPath(_0x5e2f2f[_0x2f5684(0x10a)],_0x5e2f2f[_0x2f5684(0x10f)],pathToArray(_0x4762ba))}),_0x4c51c6[_0x2f5684(0x11d)](...checkConditions(_0x3bd55c[_0x2f5684(0xca)],_0x4762ba,_0x5e2f2f));}return _0x4c51c6;}if(_0x3bd55c[_0x2f5684(0xe9)]===_0x2f5684(0x11a)||_0x3bd55c[_0x2f5684(0xe9)]===_0x2f5684(0xee)){const _0x4905e2=_0x3bd55c,_0x3f8261=_0x4905e2[_0x2f5684(0x10f)],_0x3f79c4=_0x4905e2[_0x2f5684(0xd3)],_0x5cdc41=_0x3f8261||_0x3f79c4,_0x4d06e5=_0x4905e2[_0x2f5684(0xd1)]?.[_0x2f5684(0xe9)];if((_0x4d06e5===_0x2f5684(0xfd)||_0x4d06e5===_0x2f5684(0x116))&&_0x4905e2['operator']?.[_0x2f5684(0x114)]!==undefined){const _0x4a9ea1=_0x4905e2[_0x2f5684(0xd1)][_0x2f5684(0x114)]===!![];_0x4c51c6[_0x2f5684(0x11d)]({'level':_0x4a9ea1?_0x2f5684(0xe2):_0x2f5684(0xfb),'path':_0x4762ba+_0x2f5684(0xcf),'code':_0x2f5684(0xdb),'message':_0x4a9ea1?_0x2f5684(0xeb)+_0x4d06e5+'\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'+_0x2f5684(0x119)+'Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.':_0x2f5684(0xeb)+_0x4d06e5+_0x2f5684(0x102)+'Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','location':getLocationFromPath(_0x5e2f2f[_0x2f5684(0x10a)],_0x5e2f2f[_0x2f5684(0x10f)],pathToArray(_0x4762ba+_0x2f5684(0xcf)))});}(!_0x4905e2['attribute']||_0x4905e2[_0x2f5684(0xff)]==='')&&(!_0x5cdc41&&_0x4c51c6[_0x2f5684(0x11d)]({'level':_0x2f5684(0xe2),'path':_0x4762ba+'.attribute','code':'EMPTY_ATTRIBUTE','message':'Attribute\x20name\x20cannot\x20be\x20empty','location':getLocationFromPath(_0x5e2f2f[_0x2f5684(0x10a)],_0x5e2f2f[_0x2f5684(0x10f)],pathToArray(_0x4762ba+'.attribute'))}));_0x4905e2['filter']&&_0x4c51c6['push'](...checkRule(_0x4905e2[_0x2f5684(0xf8)],_0x4762ba+_0x2f5684(0x100),_0x5e2f2f));if(_0x4905e2[_0x2f5684(0x10f)]){const _0x19d675=_0x4905e2[_0x2f5684(0xff)]&&_0x4905e2[_0x2f5684(0xff)]!=='';_0x19d675&&!_0x4905e2['filter']&&_0x4c51c6[_0x2f5684(0x11d)]({'level':_0x2f5684(0xe2),'path':_0x4762ba+'.source','code':_0x2f5684(0xe1),'message':_0x2f5684(0x103)+_0x4905e2[_0x2f5684(0x10f)]+'\x27\x20with\x20attribute\x20\x27'+_0x4905e2[_0x2f5684(0xff)]+'\x27\x20'+_0x2f5684(0xe5)+_0x2f5684(0xcd)+_0x2f5684(0xce),'location':getLocationFromPath(_0x5e2f2f[_0x2f5684(0x10a)],_0x5e2f2f[_0x2f5684(0x10f)],pathToArray(_0x4762ba+_0x2f5684(0xea)))}),_0x19d675&&_0x4905e2[_0x2f5684(0xf8)]&&_0x4c51c6[_0x2f5684(0x11d)]({'level':_0x2f5684(0xfb),'path':_0x4762ba+_0x2f5684(0xe4),'code':_0x2f5684(0xf2),'message':_0x2f5684(0x10b)+_0x4905e2[_0x2f5684(0xff)]+_0x2f5684(0x118)+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x5e2f2f[_0x2f5684(0x10a)],_0x5e2f2f[_0x2f5684(0x10f)],pathToArray(_0x4762ba+_0x2f5684(0xe4)))});}}return _0x4c51c6;}function a163_0x4672(_0x5e5134,_0x3c530e){_0x5e5134=_0x5e5134-0xca;const _0x3900d4=a163_0x3900();let _0x46722e=_0x3900d4[_0x5e5134];return _0x46722e;}function a163_0x3900(){const _0x4b07c1=['MISSING_OPERATOR_VALUE','arrayMatching','9813424bCzfZb','885699xlvAYJ','BEHAVIOR_SOURCE_MISSING_FILTER','error','issues','.attribute','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','success','rule.type','139234KuJPGr','type','.source','Operator\x20\x27','.conditions[','INVALID_OPERATOR_TYPE','Behavior','3563559kTyuIg','714mVJUJZ','custom','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','INVALID_ARRAY_MATCHING','MISSING_SEGMENT_REFERENCE','MISSING_NAME','endsWith','filter','level','.conditions','warning','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','TimeWithinPast','And','attribute','.filter','EMPTY_CONDITIONS','\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20','Behavior\x20source\x20\x27','rule','SEGMENT_SCHEMA_ERROR','data','.operator.type','INVALID_RULE_TYPE','skipSchema','document','Attribute\x20\x27','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','code','invalid_value','source','4wsKNwk','validationCode','MISSING_TIME_UNIT','params','not','Composite','TimeWithinNext','length','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','Value','1635641eLDknS','MISSING_CONDITIONS','push','conditions','includes','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','.operator.not','19615dNmJJE','operator','path','aggregation','symbol','NESTED_CONDITION_GROUP','safeParse','map','1992900XmwnOF','.type','MISSING_BETWEEN_BOUNDS','TEMPORAL_NEGATION_UNSUPPORTED','190WtNFEH'];a163_0x3900=function(){return _0x4b07c1;};return a163_0x3900();}
1
+ (function(_0x5d37c7,_0x4e80d1){const _0x2ad768=a163_0x43ff,_0x558c03=_0x5d37c7();while(!![]){try{const _0x523442=parseInt(_0x2ad768(0x129))/0x1*(-parseInt(_0x2ad768(0x137))/0x2)+parseInt(_0x2ad768(0x131))/0x3*(parseInt(_0x2ad768(0x136))/0x4)+-parseInt(_0x2ad768(0x115))/0x5*(parseInt(_0x2ad768(0x123))/0x6)+parseInt(_0x2ad768(0x13f))/0x7+-parseInt(_0x2ad768(0x125))/0x8+-parseInt(_0x2ad768(0x140))/0x9+parseInt(_0x2ad768(0x121))/0xa;if(_0x523442===_0x4e80d1)break;else _0x558c03['push'](_0x558c03['shift']());}catch(_0x44dbfb){_0x558c03['push'](_0x558c03['shift']());}}}(a163_0x3d63,0x3affa));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x587bf1,_0x19562f={},_0x5356e6={}){const _0x66a55b=a163_0x43ff;if(_0x5356e6[_0x66a55b(0x11d)])return runSemanticChecks(_0x587bf1,_0x19562f);const _0x10dbb6=SegmentDefSchema[_0x66a55b(0x124)](_0x587bf1);if(_0x10dbb6[_0x66a55b(0x10f)])return runSemanticChecks(_0x10dbb6[_0x66a55b(0x116)],_0x19562f);return zodErrorsToValidationResult(_0x10dbb6[_0x66a55b(0x108)],_0x19562f);}export function validateRuleDef(_0x410b83,_0x4a8802,_0x1bae27){const _0x33694d=a163_0x43ff;if(!_0x410b83)return[];const _0x37f6f1=RuleDefSchema[_0x33694d(0x124)](_0x410b83);if(_0x37f6f1[_0x33694d(0x10f)])return checkRule(_0x37f6f1[_0x33694d(0x116)],_0x4a8802,_0x1bae27);const _0x1a4d66=flattenZodIssues(_0x37f6f1['error'][_0x33694d(0x14b)]);return _0x1a4d66[_0x33694d(0x14f)](_0x1a0cf6=>{const _0x92edf=_0x33694d,_0x1616cf=formatZodPath(_0x1a0cf6['path']),_0x23cfef=_0x1616cf?_0x4a8802+'.'+_0x1616cf:_0x4a8802,_0xcb99e=mapZodIssueToCode(_0x1a0cf6,_0x1616cf),_0x4988a6=getLocationFromPath(_0x1bae27[_0x92edf(0x145)],_0x1bae27[_0x92edf(0x142)],pathToArray(_0x23cfef));return{'level':_0x92edf(0x108),'path':_0x23cfef,'code':_0xcb99e,'message':_0x1a0cf6['message'],..._0x4988a6&&{'location':_0x4988a6}};});}function zodErrorsToValidationResult(_0x3931a8,_0x29b68b){const _0x552dd9=a163_0x43ff,_0x1976d6=flattenZodIssues(_0x3931a8[_0x552dd9(0x14b)]),_0x381677=_0x1976d6[_0x552dd9(0x14f)](_0x314e16=>{const _0x9f57d0=_0x552dd9,_0x52d80c=formatZodPath(_0x314e16[_0x9f57d0(0x102)]),_0x3ef2aa=mapZodIssueToCode(_0x314e16,_0x52d80c),_0x268c7a=getLocationFromPath(_0x29b68b['document'],_0x29b68b[_0x9f57d0(0x142)],_0x314e16[_0x9f57d0(0x102)][_0x9f57d0(0x14f)](_0x34ca9e=>typeof _0x34ca9e===_0x9f57d0(0x149)?String(_0x34ca9e):_0x34ca9e));return{'level':_0x9f57d0(0x108),'path':_0x52d80c,'code':_0x3ef2aa,'message':_0x314e16[_0x9f57d0(0x11a)],..._0x268c7a&&{'location':_0x268c7a}};});return{'valid':![],'errors':_0x381677,'warnings':[]};}function mapZodIssueToCode(_0x395180,_0x3387fc){const _0x20a106=a163_0x43ff,_0x2f27e0=_0x395180[_0x20a106(0x135)]==='custom'?_0x395180[_0x20a106(0x10a)]:undefined;if(_0x3387fc==='name')return'MISSING_NAME';if(_0x3387fc===_0x20a106(0x12f)||_0x3387fc[_0x20a106(0x133)]('.type')){if(_0x395180[_0x20a106(0x135)]===_0x20a106(0x13d)){if(_0x3387fc===_0x20a106(0x12f)||_0x3387fc[_0x20a106(0x153)](/\.conditions\[\d+\]\.type$/))return _0x20a106(0x141);}}if(_0x3387fc['endsWith'](_0x20a106(0x128)))return _0x20a106(0x132);if(_0x3387fc[_0x20a106(0x133)](_0x20a106(0x146)))return'MISSING_OPERATOR_VALUE';if(_0x2f27e0?.[_0x20a106(0x11b)]===_0x20a106(0x12a))return _0x20a106(0x12a);if(_0x2f27e0?.[_0x20a106(0x11b)]===_0x20a106(0x11f))return _0x20a106(0x11f);if(_0x3387fc['endsWith'](_0x20a106(0x12b))||_0x3387fc===_0x20a106(0x12e))return'MISSING_CONDITIONS';if(_0x3387fc[_0x20a106(0x112)](_0x20a106(0x147)))return _0x20a106(0x10e);if(_0x3387fc[_0x20a106(0x133)](_0x20a106(0x138)))return'MISSING_SEGMENT_REFERENCE';return _0x20a106(0x152);}function runSemanticChecks(_0x53a342,_0x2e266f){const _0xa20db9=a163_0x43ff,_0x1fbd0e=[];_0x53a342['rule']&&_0x1fbd0e[_0xa20db9(0x151)](...checkRule(_0x53a342[_0xa20db9(0x143)],_0xa20db9(0x143),_0x2e266f));const _0x18ad3e=_0x1fbd0e[_0xa20db9(0x148)](_0x118101=>_0x118101['level']==='error'),_0x560a81=_0x1fbd0e[_0xa20db9(0x148)](_0xf1dfe2=>_0xf1dfe2[_0xa20db9(0x13e)]===_0xa20db9(0x134));return{'valid':_0x18ad3e[_0xa20db9(0x150)]===0x0,'errors':_0x18ad3e,'warnings':_0x560a81};}function a163_0x3d63(){const _0x52c5ed=['safeParse','2752488PNGScv','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','EMPTY_ATTRIBUTE','.operator.type','7037UoBdsY','MISSING_BETWEEN_BOUNDS','.conditions','description','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','conditions','rule.type','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','15mrXyOh','INVALID_OPERATOR_TYPE','endsWith','warning','code','197552bOpSHP','100DgTEQH','.segment','BEHAVIOR_SOURCE_MISSING_FILTER','Behavior\x20source\x20\x27','Value','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','invalid_value','level','2647379ntFCzO','3922578dDppUM','INVALID_RULE_TYPE','source','rule','Operator\x20\x27','document','.operator.value','arrayMatching','filter','symbol','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','issues','.operator.not','Attribute\x20name\x20cannot\x20be\x20empty','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','map','length','push','SEGMENT_SCHEMA_ERROR','match','.attribute','And','path','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','\x27\x20with\x20attribute\x20\x27','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20','error','TimeWithinPast','params','EMPTY_CONDITIONS','attribute','NESTED_CONDITION_GROUP','INVALID_ARRAY_MATCHING','success','Attribute\x20\x27','aggregation','includes','.filter','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20','5rrqOUp','data','Behavior','Composite','type','message','validationCode','.source','skipSchema','not','MISSING_TIME_UNIT','operator','7971210ZRZOka','TimeWithinNext','293082AzbXLL'];a163_0x3d63=function(){return _0x52c5ed;};return a163_0x3d63();}function checkRule(_0x990a3c,_0x1ba970,_0x26314e){const _0x4c8903=a163_0x43ff,_0x54283c=[];if(_0x990a3c['conditions'][_0x4c8903(0x150)]===0x0)return _0x54283c[_0x4c8903(0x151)]({'level':_0x4c8903(0x108),'path':_0x1ba970+'.conditions','code':_0x4c8903(0x10b),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x26314e[_0x4c8903(0x145)],_0x26314e[_0x4c8903(0x142)],pathToArray(_0x1ba970+_0x4c8903(0x12b)))}),_0x54283c;return _0x54283c[_0x4c8903(0x151)](...checkConditions(_0x990a3c[_0x4c8903(0x12e)],_0x1ba970,_0x26314e)),_0x54283c;}function a163_0x43ff(_0x1dcdf8,_0x2663a0){_0x1dcdf8=_0x1dcdf8-0x102;const _0x3d6371=a163_0x3d63();let _0x43ffd7=_0x3d6371[_0x1dcdf8];return _0x43ffd7;}function checkConditions(_0x551414,_0x4b76cc,_0x4e1fd0){const _0x3ff9ef=a163_0x43ff,_0x309118=[];for(let _0x309bb4=0x0;_0x309bb4<_0x551414['length'];_0x309bb4++){const _0x2204ee=_0x551414[_0x309bb4],_0x54e596=_0x4b76cc+'.conditions['+_0x309bb4+']';_0x309118[_0x3ff9ef(0x151)](...checkCondition(_0x2204ee,_0x54e596,_0x4e1fd0));}return _0x309118;}function checkCondition(_0x1b0588,_0x2b55c4,_0x5d5afa){const _0x3c2242=a163_0x43ff,_0x10b47c=[];if(_0x1b0588[_0x3c2242(0x119)]===_0x3c2242(0x155)||_0x1b0588[_0x3c2242(0x119)]==='Or'||_0x1b0588[_0x3c2242(0x119)]===_0x3c2242(0x118)){if(_0x1b0588[_0x3c2242(0x12e)][_0x3c2242(0x150)]===0x0)_0x10b47c[_0x3c2242(0x151)]({'level':_0x3c2242(0x108),'path':_0x2b55c4+_0x3c2242(0x12b),'code':'EMPTY_CONDITIONS','message':_0x1b0588[_0x3c2242(0x119)]+_0x3c2242(0x130),'location':getLocationFromPath(_0x5d5afa['document'],_0x5d5afa['source'],pathToArray(_0x2b55c4+'.conditions'))});else{const _0x10cd1e=_0x1b0588[_0x3c2242(0x12c)]!==undefined,_0x4cf3f3=_0x1b0588[_0x3c2242(0x119)]===_0x3c2242(0x118);!_0x10cd1e&&!_0x4cf3f3&&_0x10b47c[_0x3c2242(0x151)]({'level':_0x3c2242(0x134),'path':_0x2b55c4,'code':_0x3c2242(0x10d),'message':_0x1b0588[_0x3c2242(0x119)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x3c2242(0x104)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x5d5afa[_0x3c2242(0x145)],_0x5d5afa[_0x3c2242(0x142)],pathToArray(_0x2b55c4))}),_0x10b47c[_0x3c2242(0x151)](...checkConditions(_0x1b0588[_0x3c2242(0x12e)],_0x2b55c4,_0x5d5afa));}return _0x10b47c;}if(_0x1b0588[_0x3c2242(0x119)]===_0x3c2242(0x13b)||_0x1b0588[_0x3c2242(0x119)]===_0x3c2242(0x117)){const _0x4a6ff1=_0x1b0588,_0x545d67=_0x4a6ff1[_0x3c2242(0x142)],_0x3317f4=_0x4a6ff1[_0x3c2242(0x111)],_0x4a911f=_0x545d67||_0x3317f4,_0x49def4=_0x4a6ff1['operator']?.[_0x3c2242(0x119)];if((_0x49def4===_0x3c2242(0x109)||_0x49def4===_0x3c2242(0x122))&&_0x4a6ff1['operator']?.[_0x3c2242(0x11e)]!==undefined){const _0x4ce110=_0x4a6ff1[_0x3c2242(0x120)]['not']===!![];_0x10b47c['push']({'level':_0x4ce110?'error':_0x3c2242(0x134),'path':_0x2b55c4+'.operator.not','code':'TEMPORAL_NEGATION_UNSUPPORTED','message':_0x4ce110?'Operator\x20\x27'+_0x49def4+_0x3c2242(0x114)+_0x3c2242(0x14a)+_0x3c2242(0x126):_0x3c2242(0x144)+_0x49def4+_0x3c2242(0x107)+_0x3c2242(0x12d),'location':getLocationFromPath(_0x5d5afa[_0x3c2242(0x145)],_0x5d5afa[_0x3c2242(0x142)],pathToArray(_0x2b55c4+_0x3c2242(0x14c)))});}(!_0x4a6ff1[_0x3c2242(0x10c)]||_0x4a6ff1[_0x3c2242(0x10c)]==='')&&(!_0x4a911f&&_0x10b47c[_0x3c2242(0x151)]({'level':_0x3c2242(0x108),'path':_0x2b55c4+'.attribute','code':_0x3c2242(0x127),'message':_0x3c2242(0x14d),'location':getLocationFromPath(_0x5d5afa[_0x3c2242(0x145)],_0x5d5afa[_0x3c2242(0x142)],pathToArray(_0x2b55c4+_0x3c2242(0x154)))}));_0x4a6ff1['filter']&&_0x10b47c[_0x3c2242(0x151)](...checkRule(_0x4a6ff1[_0x3c2242(0x148)],_0x2b55c4+_0x3c2242(0x113),_0x5d5afa));if(_0x4a6ff1[_0x3c2242(0x142)]){const _0x284ef9=_0x4a6ff1[_0x3c2242(0x10c)]&&_0x4a6ff1[_0x3c2242(0x10c)]!=='';_0x284ef9&&!_0x4a6ff1[_0x3c2242(0x148)]&&_0x10b47c[_0x3c2242(0x151)]({'level':_0x3c2242(0x108),'path':_0x2b55c4+_0x3c2242(0x11c),'code':_0x3c2242(0x139),'message':_0x3c2242(0x13a)+_0x4a6ff1[_0x3c2242(0x142)]+_0x3c2242(0x105)+_0x4a6ff1[_0x3c2242(0x10c)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x3c2242(0x13c),'location':getLocationFromPath(_0x5d5afa[_0x3c2242(0x145)],_0x5d5afa[_0x3c2242(0x142)],pathToArray(_0x2b55c4+_0x3c2242(0x11c)))}),_0x284ef9&&_0x4a6ff1['filter']&&_0x10b47c[_0x3c2242(0x151)]({'level':'warning','path':_0x2b55c4+_0x3c2242(0x154),'code':_0x3c2242(0x106),'message':_0x3c2242(0x110)+_0x4a6ff1[_0x3c2242(0x10c)]+_0x3c2242(0x103)+_0x3c2242(0x14e),'location':getLocationFromPath(_0x5d5afa[_0x3c2242(0x145)],_0x5d5afa['source'],pathToArray(_0x2b55c4+_0x3c2242(0x154)))});}}return _0x10b47c;}