@treasuredata/tdx 0.28.0 → 0.28.1

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 (182) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/agent/tool-target-registry.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/delivery-api-client.js +1 -1
  83. package/dist/sdk/client/endpoints.js +1 -1
  84. package/dist/sdk/client/engage-api-client.js +1 -1
  85. package/dist/sdk/client/http-client.js +1 -1
  86. package/dist/sdk/client/llm-api-client.js +1 -1
  87. package/dist/sdk/client/rate-limiter.js +1 -1
  88. package/dist/sdk/client/td-api-client.js +1 -1
  89. package/dist/sdk/client/trino-api-client.js +1 -1
  90. package/dist/sdk/client/workflow-client.js +1 -1
  91. package/dist/sdk/connection-validator.js +1 -1
  92. package/dist/sdk/connection.js +1 -1
  93. package/dist/sdk/delivery.js +1 -1
  94. package/dist/sdk/engage/campaign-pull.js +1 -1
  95. package/dist/sdk/engage/campaign-push.js +1 -1
  96. package/dist/sdk/engage/campaign-validator.js +1 -1
  97. package/dist/sdk/engage/campaign-yaml.js +1 -1
  98. package/dist/sdk/engage/types/campaign-def.js +1 -1
  99. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-factors.d.ts +6 -0
  111. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  112. package/dist/sdk/llm/model-factors.js +1 -1
  113. package/dist/sdk/llm/model-factors.js.map +1 -1
  114. package/dist/sdk/personalization.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/realtime.js +1 -1
  118. package/dist/sdk/schedule.js +1 -1
  119. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  120. package/dist/sdk/segment/fields-display.js +1 -1
  121. package/dist/sdk/segment/file-discovery.js +1 -1
  122. package/dist/sdk/segment/journey-utils.js +1 -1
  123. package/dist/sdk/segment/journey-validator.js +1 -1
  124. package/dist/sdk/segment/journey-yaml.js +1 -1
  125. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  126. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  127. package/dist/sdk/segment/pull-workflow.js +1 -1
  128. package/dist/sdk/segment/push-recovery.js +1 -1
  129. package/dist/sdk/segment/push-workflow.js +1 -1
  130. package/dist/sdk/segment/resolution-context.js +1 -1
  131. package/dist/sdk/segment/segment-path-parser.js +1 -1
  132. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  133. package/dist/sdk/segment/target-resolution.js +1 -1
  134. package/dist/sdk/segment/tdx-config.js +1 -1
  135. package/dist/sdk/segment/validate-files.js +1 -1
  136. package/dist/sdk/segment/yaml-validator.js +1 -1
  137. package/dist/sdk/segment.js +1 -1
  138. package/dist/sdk/types/index.js +1 -1
  139. package/dist/sdk/types/progress.js +1 -1
  140. package/dist/sdk/user.js +1 -1
  141. package/dist/sdk/util/format-detector.js +1 -1
  142. package/dist/sdk/util/formatters.js +1 -1
  143. package/dist/sdk/util/index.js +1 -1
  144. package/dist/sdk/util/tree-formatter.js +1 -1
  145. package/dist/sdk/workflow/archive-validation.js +1 -1
  146. package/dist/sdk/workflow/clone-workflow.js +1 -1
  147. package/dist/sdk/workflow/index.js +1 -1
  148. package/dist/sdk/workflow/pull-workflow.js +1 -1
  149. package/dist/sdk/workflow/push-workflow.js +1 -1
  150. package/dist/sdk/workflow/tdx-config.js +1 -1
  151. package/dist/sdk/workflow/workflow-utils.js +1 -1
  152. package/dist/test-utils/command-runner.js +1 -1
  153. package/dist/test-utils/factories.js +1 -1
  154. package/dist/test-utils/fixtures.js +1 -1
  155. package/dist/test-utils/http-mock.js +1 -1
  156. package/dist/test-utils/index.js +1 -1
  157. package/dist/utils/async.js +1 -1
  158. package/dist/utils/colors.js +1 -1
  159. package/dist/utils/diff.js +1 -1
  160. package/dist/utils/file-permissions.js +1 -1
  161. package/dist/utils/global-cache.js +1 -1
  162. package/dist/utils/json-loader.js +1 -1
  163. package/dist/utils/local-cache.js +1 -1
  164. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  165. package/dist/utils/logger/formatters/index.js +1 -1
  166. package/dist/utils/logger/handlers/console-handler.js +1 -1
  167. package/dist/utils/logger/handlers/file-handler.js +1 -1
  168. package/dist/utils/logger/handlers/index.js +1 -1
  169. package/dist/utils/logger/handlers/null-handler.js +1 -1
  170. package/dist/utils/logger/index.js +1 -1
  171. package/dist/utils/logger/logger.js +1 -1
  172. package/dist/utils/logger/types.js +1 -1
  173. package/dist/utils/option-validation.js +1 -1
  174. package/dist/utils/process.js +1 -1
  175. package/dist/utils/prompt.js +1 -1
  176. package/dist/utils/spinner.js +1 -1
  177. package/dist/utils/sse-parser.js +1 -1
  178. package/dist/utils/string-utils.js +1 -1
  179. package/dist/utils/table-ref-parser.js +1 -1
  180. package/dist/utils/tdx-logger.js +1 -1
  181. package/dist/utils/version-check.js +1 -1
  182. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(_0x2a918e,_0x7b81cc){const _0x40ce57=a125_0x5b77,_0x3bd37e=_0x2a918e();while(!![]){try{const _0x53733b=parseInt(_0x40ce57(0x104))/0x1*(parseInt(_0x40ce57(0xfd))/0x2)+parseInt(_0x40ce57(0xee))/0x3+parseInt(_0x40ce57(0xff))/0x4*(parseInt(_0x40ce57(0xea))/0x5)+parseInt(_0x40ce57(0xd2))/0x6+parseInt(_0x40ce57(0xd1))/0x7+-parseInt(_0x40ce57(0xfa))/0x8*(-parseInt(_0x40ce57(0xc9))/0x9)+parseInt(_0x40ce57(0xd6))/0xa*(-parseInt(_0x40ce57(0x10a))/0xb);if(_0x53733b===_0x7b81cc)break;else _0x3bd37e['push'](_0x3bd37e['shift']());}catch(_0x3061c4){_0x3bd37e['push'](_0x3bd37e['shift']());}}}(a125_0x4f74,0x42316));import a125_0x2fe83d from'path';import{existsSync,readFileSync}from'fs';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{sanitizeFileName}from'../../utils/string-utils.js';function a125_0x4f74(){const _0x386a85=['values','map','Fetching\x20parent\x20segment\x20info','getSegment','8684225sRGOET','listActivations','sort','.yml','relationships','buildIdToNameMap','Fetching\x20users\x20and\x20connections','segments/','add','join','reduce','segment','has','119412qMePqW','updatedAt','journey','targetResourceName','connection','utf-8','rule','set','313061ZMCkAN','2963580SQezuQ','from','versionNumber','hasChanges','10YmNxPE','Processing\x20journeys','getJourney','paused','getParent','journeyBundleId','tdx.json','clear','journeyBundleName','Processing\x20segments','relative','resolveParentId','Warning:\x20Journey\x20','Fetching\x20activations','segmentFolderId','audienceId','folderId','getActivation','createdAt','length','96770EzMkqV','user','update','Resolving\x20parent\x20segment','169311UInQLf','all','listFolders','parentFolder','slice','attributes','description','listSegments','filter','toLowerCase','isNew','push','8DqanZi','kind','state','43518daZMxQ','size','44YFEVQT','listJourneysWithDetailsFromParentSegment','data','buildIdToEmailMap','get','11ARfHdQ','name'];a125_0x4f74=function(){return _0x386a85;};return a125_0x4f74();}import{batchAsync}from'../../utils/async.js';import{buildFolderIdToPathMap}from'./resolution-context.js';import{segmentWithActivationsToYaml,segmentToYamlString,segmentResponseToDef,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{journeyResponseToDef,toYamlString as a125_0x1c1472,normalizeJourneyDef,parseYamlString as a125_0x1cf3f9}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,createJumpTargetCache,resolveJumpTarget}from'./journey-utils.js';function a125_0x5b77(_0x4cfe6c,_0x3763a7){_0x4cfe6c=_0x4cfe6c-0xc5;const _0x4f744a=a125_0x4f74();let _0x5b7748=_0x4f744a[_0x4cfe6c];return _0x5b7748;}import{createTdxConfigContent}from'./tdx-config.js';function prepareFile(_0x2673c0,_0x2cda4e,_0x2d5442){const _0x29e5f2=a125_0x5b77,_0x5397df=a125_0x2fe83d[_0x29e5f2(0xe0)](_0x2d5442,_0x2673c0);if(existsSync(_0x2673c0)){const _0x4c1984=readFileSync(_0x2673c0,'utf-8'),_0x2860a3=generateDiff(_0x4c1984,_0x2cda4e),_0x2d4d13=hasChanges(_0x2860a3);return{'relativePath':_0x5397df,'absolutePath':_0x2673c0,'content':_0x2cda4e,'isNew':![],'hasChanges':_0x2d4d13,'diff':_0x2d4d13?formatDiffWithColors(_0x2860a3):undefined};}return{'relativePath':_0x5397df,'absolutePath':_0x2673c0,'content':_0x2cda4e,'isNew':!![],'hasChanges':![]};}function getUniqueFileName(_0x1407b7,_0x18fea5,_0x5a1e89){const _0x4ecf66=a125_0x5b77,_0x447273=_0x1407b7+':'+_0x18fea5,_0x5be621=_0x5a1e89[_0x4ecf66(0x103)](_0x447273)||0x0;_0x5a1e89[_0x4ecf66(0xd0)](_0x447273,_0x5be621+0x1);if(_0x5be621===0x0)return _0x18fea5;return _0x18fea5+'_'+(_0x5be621+0x1);}export async function pullSegments(_0x3298f9,_0x361f07,_0x7f5a0f={}){const _0x10ee79=a125_0x5b77,{targetDir:_0x2cc21d,progress:_0x122a48}=_0x7f5a0f;_0x122a48?.[_0x10ee79(0xec)](_0x10ee79(0xed));const _0x56ec3e=await _0x3298f9[_0x10ee79(0xc7)][_0x10ee79(0xe1)](_0x361f07);_0x122a48?.['update'](_0x10ee79(0x108));const _0x5a9d14=await _0x3298f9[_0x10ee79(0xc7)][_0x10ee79(0xda)](_0x56ec3e),_0x33ef32=_0x5a9d14['attributes']['name'];_0x122a48?.[_0x10ee79(0xec)]('Fetching\x20segments,\x20folders,\x20and\x20journeys');const [_0x2ed6c1,_0x366ada,_0x4226b9]=await Promise[_0x10ee79(0xef)]([_0x3298f9[_0x10ee79(0xc7)][_0x10ee79(0xf5)](_0x56ec3e),_0x3298f9[_0x10ee79(0xc7)][_0x10ee79(0xf0)](_0x56ec3e),_0x3298f9[_0x10ee79(0xcb)][_0x10ee79(0x100)](_0x56ec3e,{'includeAllVersions':!![]})]),{journeys:_0x583e87,activationStepsById:_0x695607}=_0x4226b9,_0x397be0=new Map();for(const _0x1f74b8 of _0x583e87){_0x397be0[_0x10ee79(0xd0)](_0x1f74b8['id'],_0x1f74b8);}const _0x279b3a=_0x583e87[_0x10ee79(0x107)](_0x57a954=>({'id':_0x57a954['id'],'name':_0x57a954[_0x10ee79(0xf3)][_0x10ee79(0x105)],'journeyBundleName':_0x57a954[_0x10ee79(0xf3)][_0x10ee79(0xde)]||'','journeyBundleId':_0x57a954[_0x10ee79(0xf3)]['journeyBundleId']||'','versionNumber':_0x57a954['attributes']['versionNumber'],'description':_0x57a954[_0x10ee79(0xf3)][_0x10ee79(0xf4)],'state':_0x57a954[_0x10ee79(0xf3)][_0x10ee79(0xfc)],'paused':_0x57a954['attributes'][_0x10ee79(0xd9)],'audienceId':_0x57a954[_0x10ee79(0xf3)]['audienceId'],'folderId':_0x57a954[_0x10ee79(0x10e)]?.[_0x10ee79(0xf1)]?.[_0x10ee79(0x101)]?.['id'],'createdAt':_0x57a954[_0x10ee79(0xf3)][_0x10ee79(0xe8)],'updatedAt':_0x57a954['attributes'][_0x10ee79(0xca)]})),_0xfbdffb=buildFolderIdToPathMap(_0x366ada),_0x29aef6=_0x2cc21d||_0x10ee79(0x111)+sanitizeFileName(_0x33ef32);_0x122a48?.['update'](_0x10ee79(0xe3));const _0x443ed2=new Map();await batchAsync(_0x2ed6c1,async _0x1ba3fe=>{const _0x1830c8=_0x10ee79,_0x491041=await _0x3298f9[_0x1830c8(0xc7)][_0x1830c8(0x10b)](_0x56ec3e,_0x1ba3fe['id']);_0x443ed2[_0x1830c8(0xd0)](_0x1ba3fe['id'],_0x491041);}),_0x122a48?.['update'](_0x10ee79(0x110));const [_0x203a21,_0x3a8823]=await Promise[_0x10ee79(0xef)]([_0x3298f9[_0x10ee79(0xeb)][_0x10ee79(0x102)](),_0x3298f9[_0x10ee79(0xcd)][_0x10ee79(0x10f)]()]),_0x2b1ecc=[],_0x4cc872=new Map(),_0x3ecbda=a125_0x2fe83d[_0x10ee79(0xc5)](_0x29aef6,_0x10ee79(0xdc)),_0x380434=createTdxConfigContent(_0x33ef32);_0x2b1ecc['push'](prepareFile(_0x3ecbda,_0x380434,_0x29aef6));const _0x29199b=new Map();for(const _0xa02f78 of _0x2ed6c1){_0x29199b[_0x10ee79(0xd0)](_0xa02f78['id'],_0xa02f78);}let _0xa1ab46=_0x2ed6c1;if(_0x7f5a0f[_0x10ee79(0xcc)]){const _0x2e30ae=_0x2ed6c1[_0x10ee79(0xf6)](_0x384e11=>_0x384e11[_0x10ee79(0x105)]['toLowerCase']()===_0x7f5a0f['targetResourceName']['toLowerCase']());_0x2e30ae[_0x10ee79(0xe9)]>0x0&&(_0xa1ab46=_0x2e30ae);}_0x122a48?.[_0x10ee79(0xec)](_0x10ee79(0xdf));for(const _0x8edd61 of _0xa1ab46){if(_0x8edd61[_0x10ee79(0xfb)]===SEGMENT_KIND_JOURNEY)continue;const _0x51954e=_0x8edd61[_0x10ee79(0xe4)]?_0xfbdffb[_0x10ee79(0x103)](_0x8edd61['segmentFolderId'])||'':'',_0x18a213=_0x443ed2[_0x10ee79(0x103)](_0x8edd61['id'])||[],_0x455083=segmentWithActivationsToYaml(_0x8edd61,_0x18a213,undefined,_0x203a21,_0x3a8823),_0x17d513=_0x51954e?a125_0x2fe83d[_0x10ee79(0xc5)](_0x29aef6,_0x51954e):_0x29aef6,_0x1b7282=sanitizeFileName(_0x8edd61['name']),_0xb2b051=getUniqueFileName(_0x17d513,_0x1b7282,_0x4cc872),_0x1395c2=a125_0x2fe83d['join'](_0x17d513,_0xb2b051+_0x10ee79(0x10d)),_0x238d0e=segmentToYamlString(_0x455083);_0x2b1ecc[_0x10ee79(0xf9)](prepareFile(_0x1395c2,_0x238d0e,_0x29aef6));}const _0x40c5d6=new Map();for(const _0x5a1fbb of _0x279b3a){const _0x3f6903=_0x5a1fbb[_0x10ee79(0xdb)];!_0x40c5d6[_0x10ee79(0xc8)](_0x3f6903)&&_0x40c5d6[_0x10ee79(0xd0)](_0x3f6903,[]),_0x40c5d6[_0x10ee79(0x103)](_0x3f6903)[_0x10ee79(0xf9)](_0x5a1fbb);}for(const _0x4cc8c3 of _0x40c5d6[_0x10ee79(0x106)]()){_0x4cc8c3[_0x10ee79(0x10c)]((_0xf0c155,_0x19b288)=>(_0xf0c155[_0x10ee79(0xd4)]||0x0)-(_0x19b288[_0x10ee79(0xd4)]||0x0));}if(_0x7f5a0f[_0x10ee79(0xcc)]){const _0x5939e7=new Map();for(const [_0x3e52ff,_0x2d99a5]of _0x40c5d6){const _0x130320=_0x2d99a5[0x0][_0x10ee79(0xde)];if(_0x130320['toLowerCase']()===_0x7f5a0f[_0x10ee79(0xcc)][_0x10ee79(0xf7)]()){_0x5939e7[_0x10ee79(0xd0)](_0x3e52ff,_0x2d99a5);break;}}_0x40c5d6[_0x10ee79(0xdd)]();for(const [_0x509220,_0x536d55]of _0x5939e7){_0x40c5d6[_0x10ee79(0xd0)](_0x509220,_0x536d55);}}if(_0x40c5d6[_0x10ee79(0xfe)]>0x0){_0x122a48?.[_0x10ee79(0xec)](_0x10ee79(0xd7));const _0x166212=Array['from'](_0x40c5d6[_0x10ee79(0x106)]()),_0x19f402=0x5,{createYamlContext:_0x369920}=createYamlContextForBundle(_0x3298f9,_0x29199b,_0x203a21,_0x3a8823,_0x695607,_0x397be0);for(let _0x5f4d05=0x0;_0x5f4d05<_0x166212['length'];_0x5f4d05+=_0x19f402){const _0x5b8c3b=_0x166212[_0x10ee79(0xf2)](_0x5f4d05,_0x5f4d05+_0x19f402),_0x3093b8=await Promise[_0x10ee79(0xef)](_0x5b8c3b[_0x10ee79(0x107)](async _0x14d9ea=>{const _0xd3dc6c=_0x10ee79,_0x5cd901=_0x14d9ea[0x0],_0x3b0be0=_0x5cd901[_0xd3dc6c(0xde)];_0x122a48?.[_0xd3dc6c(0xec)]('Processing\x20journey:\x20'+_0x3b0be0);const _0x139bdb=_0x5cd901[_0xd3dc6c(0xe6)]?_0xfbdffb[_0xd3dc6c(0x103)](_0x5cd901[_0xd3dc6c(0xe6)])||'':'',_0xec96e7=_0x139bdb?a125_0x2fe83d[_0xd3dc6c(0xc5)](_0x29aef6,_0x139bdb):_0x29aef6,_0x19baa4=sanitizeFileName(_0x3b0be0),_0x3a95bd=a125_0x2fe83d[_0xd3dc6c(0xc5)](_0xec96e7,_0x19baa4+_0xd3dc6c(0x10d));let _0x6af8d2;if(existsSync(_0x3a95bd))try{const _0x27db04=readFileSync(_0x3a95bd,_0xd3dc6c(0xce)),_0x5822e4=a125_0x1cf3f9(_0x27db04);_0x6af8d2=buildLocalRuleToNameMappingFromJourney(_0x5822e4);}catch{}const _0x28b19a=[];for(const _0x11bae7 of _0x14d9ea){const _0xcaab9=_0x397be0[_0xd3dc6c(0x103)](_0x11bae7['id']);if(!_0xcaab9){_0x122a48?.[_0xd3dc6c(0xec)](_0xd3dc6c(0xe2)+_0x11bae7['id']+'\x20not\x20found\x20in\x20pre-fetched\x20data,\x20skipping');continue;}const _0x1cf1ba=_0xcaab9[_0xd3dc6c(0xf3)]?.[_0xd3dc6c(0xe5)],_0x4eff6f=_0x369920(_0x11bae7['id'],_0x1cf1ba),_0x4f70ea=await journeyResponseToDef(_0xcaab9,_0x4eff6f);_0x28b19a[_0xd3dc6c(0xf9)]({'item':_0x11bae7,'yaml':_0x4f70ea});}const _0x4f318d=buildMergedJourneyDef(_0x28b19a,_0x6af8d2);return{'bundleName':_0x3b0be0,'folderPath':_0x139bdb,'finalYaml':_0x4f318d};}));for(const {bundleName:_0xfe56db,folderPath:_0x4996a4,finalYaml:_0x57b54c}of _0x3093b8){const _0x4bdefa=normalizeJourneyDef(_0x57b54c),_0x5d00ec=a125_0x1c1472(_0x4bdefa),_0x9a2a4f=_0x4996a4?a125_0x2fe83d['join'](_0x29aef6,_0x4996a4):_0x29aef6,_0x2b1da0=sanitizeFileName(_0xfe56db),_0x15b8eb=getUniqueFileName(_0x9a2a4f,_0x2b1da0,_0x4cc872),_0x248de2=a125_0x2fe83d[_0x10ee79(0xc5)](_0x9a2a4f,_0x15b8eb+_0x10ee79(0x10d));_0x2b1ecc['push'](prepareFile(_0x248de2,_0x5d00ec,_0x29aef6));}}}const _0x67b941=Array[_0x10ee79(0xd3)](_0x443ed2[_0x10ee79(0x106)]())[_0x10ee79(0xc6)]((_0x24da16,_0x49cf27)=>_0x24da16+_0x49cf27[_0x10ee79(0xe9)],0x0),_0x43aed4=_0xa1ab46[_0x10ee79(0xf6)](_0x3061b9=>_0x3061b9['kind']!==SEGMENT_KIND_JOURNEY),_0x4bfb39=_0x2b1ecc[_0x10ee79(0xf6)](_0x27972f=>_0x27972f['isNew'])[_0x10ee79(0xe9)],_0x3e994f=_0x2b1ecc[_0x10ee79(0xf6)](_0x568d85=>!_0x568d85['isNew']&&_0x568d85[_0x10ee79(0xd5)])['length'],_0xf7f60a=_0x2b1ecc[_0x10ee79(0xf6)](_0xc4bd0a=>!_0xc4bd0a[_0x10ee79(0xf8)]&&!_0xc4bd0a[_0x10ee79(0xd5)])[_0x10ee79(0xe9)],_0x5367ce=Array[_0x10ee79(0xd3)](_0x40c5d6[_0x10ee79(0x106)]())[_0x10ee79(0xc6)]((_0x4834fc,_0x16f413)=>_0x4834fc+_0x16f413[_0x10ee79(0xe9)],0x0);return{'parentName':_0x33ef32,'parentId':_0x56ec3e,'targetDir':_0x29aef6,'files':_0x2b1ecc,'counts':{'segments':_0x43aed4[_0x10ee79(0xe9)],'journeys':_0x40c5d6['size'],'journeyVersions':_0x5367ce,'activations':_0x67b941},'newFiles':_0x4bfb39,'changedFiles':_0x3e994f,'unchangedFiles':_0xf7f60a};}function createYamlContextForBundle(_0x42c228,_0x236d74,_0x434aca,_0x3004e0,_0x57ec8b,_0x4dd384){const _0x277878=new Set(),_0x250d69=new Map(),_0x22cef7=new Map(),_0xadb7cd=createJumpTargetCache(),_0x2da62a=async(_0x2548b0,_0x177f5b)=>{const _0x3360b3=a125_0x5b77,_0x1ba966=_0x250d69[_0x3360b3(0x103)](_0x2548b0);if(_0x1ba966!==undefined)return _0x1ba966;if(!_0x177f5b)return _0x2548b0;try{let _0x321885=_0x236d74['get'](_0x2548b0);!_0x321885&&(_0x321885=await _0x42c228[_0x3360b3(0xc7)]['getSegment'](_0x177f5b,_0x2548b0),_0x236d74[_0x3360b3(0xd0)](_0x2548b0,_0x321885));const _0x4c7219=generateJourneyLocalName(_0x321885[_0x3360b3(0x105)]),_0xe92d1d=_0x321885[_0x3360b3(0xfb)]===SEGMENT_KIND_JOURNEY&&_0x4c7219!==undefined;if(_0xe92d1d&&_0x4c7219){let _0x24cfd6=_0x4c7219,_0xed27e4=0x2;while(_0x277878[_0x3360b3(0xc8)](_0x24cfd6)){_0x24cfd6=_0x4c7219+'_'+_0xed27e4,_0xed27e4++;}return _0x277878[_0x3360b3(0x112)](_0x24cfd6),_0x250d69[_0x3360b3(0xd0)](_0x2548b0,_0x24cfd6),_0x24cfd6;}return _0x321885['name'];}catch{return _0x2548b0;}},_0x294dd4=(_0x53e5f2,_0x200c17)=>({'resolveSegment':async _0x1869d1=>{const _0xf3249b=a125_0x5b77,_0x3ff382=_0x250d69['get'](_0x1869d1);if(_0x3ff382!==undefined)return{'name':_0x3ff382,'isJourneyLocal':!![]};if(!_0x200c17)return{'name':_0x1869d1,'isJourneyLocal':![]};try{let _0xb2a4f0=_0x236d74[_0xf3249b(0x103)](_0x1869d1);!_0xb2a4f0&&(_0xb2a4f0=await _0x42c228[_0xf3249b(0xc7)][_0xf3249b(0x109)](_0x200c17,_0x1869d1),_0x236d74['set'](_0x1869d1,_0xb2a4f0));const _0xf0bc74=generateJourneyLocalName(_0xb2a4f0['name']),_0x59e328=_0xb2a4f0[_0xf3249b(0xfb)]===SEGMENT_KIND_JOURNEY&&_0xf0bc74!==undefined;if(_0x59e328&&!_0xb2a4f0[_0xf3249b(0xcf)]&&_0x200c17)try{const _0x1f7b5f=await _0x42c228[_0xf3249b(0xc7)][_0xf3249b(0x109)](_0x200c17,_0x1869d1);_0x236d74['set'](_0x1869d1,_0x1f7b5f),_0xb2a4f0=_0x1f7b5f;}catch{}const _0x45204d=await _0x2da62a(_0x1869d1,_0x200c17);let _0x3fa220;if(_0x59e328&&_0xb2a4f0['rule']){const _0x15e1ea=await segmentResponseToDef(_0xb2a4f0,{'resolveSegmentName':_0x3cd5c6=>_0x2da62a(_0x3cd5c6,_0x200c17)});_0x3fa220={'description':_0xb2a4f0['description'],'rule':_0x15e1ea[_0xf3249b(0xcf)]};}return{'name':_0x45204d,'isJourneyLocal':_0x59e328,'definition':_0x3fa220};}catch{return{'name':_0x1869d1,'isJourneyLocal':![]};}},'resolveActivation':async _0x845f30=>{const _0xf05459=a125_0x5b77,_0x29c600=_0x22cef7['get'](_0x845f30);if(_0x29c600!==undefined)return{'name':_0x29c600,'isJourneyLocal':!![]};try{let _0x41c9db=_0x57ec8b[_0xf05459(0x103)](_0x845f30);!_0x41c9db&&(_0x41c9db=await _0x42c228['journey'][_0xf05459(0xe7)](_0x53e5f2,_0x845f30));const _0x425d1f=_0x41c9db[_0xf05459(0xf3)]['activationParams']['name']||_0x845f30,_0x458e0e=sanitizeYamlKey(_0x425d1f)||'activation_'+_0x845f30,_0x3bb932=_0x458e0e;_0x22cef7['set'](_0x845f30,_0x3bb932);const _0x18ed6a=journeyActivationStepToYaml(_0x41c9db,_0x434aca,_0x3004e0);return{'name':_0x3bb932,'isJourneyLocal':!![],'definition':_0x18ed6a};}catch{return{'name':_0x845f30,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3bbb29,_0x4591b6)=>resolveJumpTarget(_0x3bbb29,_0x4591b6,_0xadb7cd,async _0x1483f3=>{const _0x64a64b=a125_0x5b77,_0x38a50f=_0x4dd384['get'](_0x1483f3);if(_0x38a50f)return _0x38a50f;return _0x42c228[_0x64a64b(0xcb)][_0x64a64b(0xd8)](_0x1483f3);})});return{'createYamlContext':_0x294dd4};}
1
+ (function(_0xd00c83,_0x26a925){const _0xd1da5d=a125_0x25dc,_0x32e5e5=_0xd00c83();while(!![]){try{const _0x36176e=-parseInt(_0xd1da5d(0x119))/0x1*(parseInt(_0xd1da5d(0xfc))/0x2)+-parseInt(_0xd1da5d(0x133))/0x3+parseInt(_0xd1da5d(0x102))/0x4*(parseInt(_0xd1da5d(0x12b))/0x5)+-parseInt(_0xd1da5d(0x113))/0x6+parseInt(_0xd1da5d(0x117))/0x7*(parseInt(_0xd1da5d(0x131))/0x8)+-parseInt(_0xd1da5d(0xfd))/0x9+parseInt(_0xd1da5d(0x110))/0xa;if(_0x36176e===_0x26a925)break;else _0x32e5e5['push'](_0x32e5e5['shift']());}catch(_0xfc8fba){_0x32e5e5['push'](_0x32e5e5['shift']());}}}(a125_0x5c4e,0x8eb37));import a125_0x265599 from'path';function a125_0x5c4e(){const _0x432de9=['Fetching\x20activations','size','1155330XATJQD','getSegment','from','3071022wmmpag','has','getParent','reduce','7xvpMtm','Resolving\x20parent\x20segment','1zzfUxo','\x20not\x20found\x20in\x20pre-fetched\x20data,\x20skipping','journey','Processing\x20journey:\x20','resolveParentId','listJourneysWithDetailsFromParentSegment','getActivation','map','targetResourceName','createdAt','connection','add','attributes','updatedAt','filter','journeyBundleId','description','audienceId','2659695KTSMCO','slice','isNew','relationships','kind','get','6732496FwhaDO','relative','62565nOsDMT','activationParams','name','hasChanges','segment','user','.yml','data','buildIdToEmailMap','getJourney','journeyBundleName','listActivations','Fetching\x20parent\x20segment\x20info','utf-8','paused','values','push','join','clear','set','folderId','697534GYEKXc','207648TygxeB','Warning:\x20Journey\x20','rule','buildIdToNameMap','segmentFolderId','4umTwHQ','Processing\x20segments','listFolders','update','state','Processing\x20journeys','versionNumber','segments/','length','sort','toLowerCase','all'];a125_0x5c4e=function(){return _0x432de9;};return a125_0x5c4e();}import{existsSync,readFileSync}from'fs';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{sanitizeFileName}from'../../utils/string-utils.js';import{batchAsync}from'../../utils/async.js';import{buildFolderIdToPathMap}from'./resolution-context.js';import{segmentWithActivationsToYaml,segmentToYamlString,segmentResponseToDef,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{journeyResponseToDef,toYamlString as a125_0x1cdc02,normalizeJourneyDef,parseYamlString as a125_0xf1dc4b}from'./journey-yaml.js';function a125_0x25dc(_0x5c49ac,_0xe98f6f){_0x5c49ac=_0x5c49ac-0xf6;const _0x5c4ecd=a125_0x5c4e();let _0x25dc81=_0x5c4ecd[_0x5c49ac];return _0x25dc81;}import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,createJumpTargetCache,resolveJumpTarget}from'./journey-utils.js';import{createTdxConfigContent}from'./tdx-config.js';function prepareFile(_0x187fba,_0xcfa24a,_0x3ec42a){const _0x12bdce=a125_0x25dc,_0x35559d=a125_0x265599[_0x12bdce(0x132)](_0x3ec42a,_0x187fba);if(existsSync(_0x187fba)){const _0x204aa8=readFileSync(_0x187fba,_0x12bdce(0x140)),_0x4624c0=generateDiff(_0x204aa8,_0xcfa24a),_0x231263=hasChanges(_0x4624c0);return{'relativePath':_0x35559d,'absolutePath':_0x187fba,'content':_0xcfa24a,'isNew':![],'hasChanges':_0x231263,'diff':_0x231263?formatDiffWithColors(_0x4624c0):undefined};}return{'relativePath':_0x35559d,'absolutePath':_0x187fba,'content':_0xcfa24a,'isNew':!![],'hasChanges':![]};}function getUniqueFileName(_0x24001e,_0x7c0a7e,_0x556499){const _0x2c3430=a125_0x25dc,_0x2e73d5=_0x24001e+':'+_0x7c0a7e,_0x27dae6=_0x556499[_0x2c3430(0x130)](_0x2e73d5)||0x0;_0x556499['set'](_0x2e73d5,_0x27dae6+0x1);if(_0x27dae6===0x0)return _0x7c0a7e;return _0x7c0a7e+'_'+(_0x27dae6+0x1);}export async function pullSegments(_0xdf339f,_0x20d250,_0x45ac72={}){const _0x30a357=a125_0x25dc,{targetDir:_0x5ab29d,progress:_0x303ccc}=_0x45ac72;_0x303ccc?.[_0x30a357(0x105)](_0x30a357(0x118));const _0x2cb0b2=await _0xdf339f[_0x30a357(0x137)][_0x30a357(0x11d)](_0x20d250);_0x303ccc?.[_0x30a357(0x105)](_0x30a357(0x13f));const _0x1d1f92=await _0xdf339f[_0x30a357(0x137)][_0x30a357(0x115)](_0x2cb0b2),_0x3a14a1=_0x1d1f92['attributes'][_0x30a357(0x135)];_0x303ccc?.[_0x30a357(0x105)]('Fetching\x20segments,\x20folders,\x20and\x20journeys');const [_0x45ade8,_0x32b633,_0x46816e]=await Promise[_0x30a357(0x10d)]([_0xdf339f[_0x30a357(0x137)]['listSegments'](_0x2cb0b2),_0xdf339f[_0x30a357(0x137)][_0x30a357(0x104)](_0x2cb0b2),_0xdf339f[_0x30a357(0x11b)][_0x30a357(0x11e)](_0x2cb0b2,{'includeAllVersions':!![]})]),{journeys:_0x123f15,activationStepsById:_0x444667}=_0x46816e,_0x21e3c3=new Map();for(const _0x5a98a2 of _0x123f15){_0x21e3c3[_0x30a357(0xfa)](_0x5a98a2['id'],_0x5a98a2);}const _0xbb7200=_0x123f15[_0x30a357(0x120)](_0x24bd50=>({'id':_0x24bd50['id'],'name':_0x24bd50['attributes'][_0x30a357(0x135)],'journeyBundleName':_0x24bd50[_0x30a357(0x125)][_0x30a357(0x13d)]||'','journeyBundleId':_0x24bd50[_0x30a357(0x125)][_0x30a357(0x128)]||'','versionNumber':_0x24bd50[_0x30a357(0x125)]['versionNumber'],'description':_0x24bd50[_0x30a357(0x125)][_0x30a357(0x129)],'state':_0x24bd50[_0x30a357(0x125)][_0x30a357(0x106)],'paused':_0x24bd50[_0x30a357(0x125)][_0x30a357(0x141)],'audienceId':_0x24bd50['attributes']['audienceId'],'folderId':_0x24bd50[_0x30a357(0x12e)]?.['parentFolder']?.[_0x30a357(0x13a)]?.['id'],'createdAt':_0x24bd50[_0x30a357(0x125)][_0x30a357(0x122)],'updatedAt':_0x24bd50['attributes'][_0x30a357(0x126)]})),_0x6ed39b=buildFolderIdToPathMap(_0x32b633),_0x13fd42=_0x5ab29d||_0x30a357(0x109)+sanitizeFileName(_0x3a14a1);_0x303ccc?.[_0x30a357(0x105)](_0x30a357(0x10e));const _0x898687=new Map();await batchAsync(_0x45ade8,async _0x2e671e=>{const _0xd5e0e1=_0x30a357,_0x1eaf33=await _0xdf339f[_0xd5e0e1(0x137)][_0xd5e0e1(0x13e)](_0x2cb0b2,_0x2e671e['id']);_0x898687[_0xd5e0e1(0xfa)](_0x2e671e['id'],_0x1eaf33);}),_0x303ccc?.['update']('Fetching\x20users\x20and\x20connections');const [_0x555f26,_0x3a8b2e]=await Promise[_0x30a357(0x10d)]([_0xdf339f[_0x30a357(0x138)][_0x30a357(0x13b)](),_0xdf339f[_0x30a357(0x123)][_0x30a357(0x100)]()]),_0x5f3cee=[],_0xbb1f75=new Map(),_0x22757d=a125_0x265599['join'](_0x13fd42,'tdx.json'),_0x7399e9=createTdxConfigContent(_0x3a14a1);_0x5f3cee[_0x30a357(0xf7)](prepareFile(_0x22757d,_0x7399e9,_0x13fd42));const _0x4798ea=new Map();for(const _0x1faa87 of _0x45ade8){_0x4798ea[_0x30a357(0xfa)](_0x1faa87['id'],_0x1faa87);}let _0xbbb75b=_0x45ade8;if(_0x45ac72[_0x30a357(0x121)]){const _0x3af071=_0x45ade8[_0x30a357(0x127)](_0x5287d4=>_0x5287d4['name'][_0x30a357(0x10c)]()===_0x45ac72[_0x30a357(0x121)][_0x30a357(0x10c)]());_0x3af071['length']>0x0&&(_0xbbb75b=_0x3af071);}_0x303ccc?.['update'](_0x30a357(0x103));for(const _0x3ea212 of _0xbbb75b){if(_0x3ea212[_0x30a357(0x12f)]===SEGMENT_KIND_JOURNEY)continue;const _0x397380=_0x3ea212['segmentFolderId']?_0x6ed39b[_0x30a357(0x130)](_0x3ea212[_0x30a357(0x101)])||'':'',_0x5238f7=_0x898687[_0x30a357(0x130)](_0x3ea212['id'])||[],_0x3ae460=segmentWithActivationsToYaml(_0x3ea212,_0x5238f7,undefined,_0x555f26,_0x3a8b2e),_0x339dfe=_0x397380?a125_0x265599[_0x30a357(0xf8)](_0x13fd42,_0x397380):_0x13fd42,_0x174223=sanitizeFileName(_0x3ea212['name']),_0x320d1a=getUniqueFileName(_0x339dfe,_0x174223,_0xbb1f75),_0x4af3e8=a125_0x265599[_0x30a357(0xf8)](_0x339dfe,_0x320d1a+_0x30a357(0x139)),_0x50d1cb=segmentToYamlString(_0x3ae460);_0x5f3cee['push'](prepareFile(_0x4af3e8,_0x50d1cb,_0x13fd42));}const _0x4676db=new Map();for(const _0x4be9c6 of _0xbb7200){const _0x2167d1=_0x4be9c6[_0x30a357(0x128)];!_0x4676db[_0x30a357(0x114)](_0x2167d1)&&_0x4676db[_0x30a357(0xfa)](_0x2167d1,[]),_0x4676db[_0x30a357(0x130)](_0x2167d1)[_0x30a357(0xf7)](_0x4be9c6);}for(const _0xfb6410 of _0x4676db[_0x30a357(0xf6)]()){_0xfb6410[_0x30a357(0x10b)]((_0x28ae2e,_0x42b7e2)=>(_0x28ae2e[_0x30a357(0x108)]||0x0)-(_0x42b7e2['versionNumber']||0x0));}if(_0x45ac72[_0x30a357(0x121)]){const _0xb429e2=new Map();for(const [_0x5273fa,_0x330497]of _0x4676db){const _0x43ef07=_0x330497[0x0][_0x30a357(0x13d)];if(_0x43ef07[_0x30a357(0x10c)]()===_0x45ac72[_0x30a357(0x121)][_0x30a357(0x10c)]()){_0xb429e2[_0x30a357(0xfa)](_0x5273fa,_0x330497);break;}}_0x4676db[_0x30a357(0xf9)]();for(const [_0x3d9743,_0x560885]of _0xb429e2){_0x4676db[_0x30a357(0xfa)](_0x3d9743,_0x560885);}}if(_0x4676db[_0x30a357(0x10f)]>0x0){_0x303ccc?.[_0x30a357(0x105)](_0x30a357(0x107));const _0x225ce4=Array['from'](_0x4676db[_0x30a357(0xf6)]()),_0x3e8a33=0x5,{createYamlContext:_0x3a18c8}=createYamlContextForBundle(_0xdf339f,_0x4798ea,_0x555f26,_0x3a8b2e,_0x444667,_0x21e3c3);for(let _0x1d8c67=0x0;_0x1d8c67<_0x225ce4[_0x30a357(0x10a)];_0x1d8c67+=_0x3e8a33){const _0x4c3d8e=_0x225ce4[_0x30a357(0x12c)](_0x1d8c67,_0x1d8c67+_0x3e8a33),_0x1713a3=await Promise['all'](_0x4c3d8e[_0x30a357(0x120)](async _0x1d2add=>{const _0x4255c1=_0x30a357,_0x2117b6=_0x1d2add[0x0],_0x461189=_0x2117b6[_0x4255c1(0x13d)];_0x303ccc?.[_0x4255c1(0x105)](_0x4255c1(0x11c)+_0x461189);const _0x34768f=_0x2117b6[_0x4255c1(0xfb)]?_0x6ed39b[_0x4255c1(0x130)](_0x2117b6[_0x4255c1(0xfb)])||'':'',_0x5c6496=_0x34768f?a125_0x265599['join'](_0x13fd42,_0x34768f):_0x13fd42,_0x520693=sanitizeFileName(_0x461189),_0x509a25=a125_0x265599[_0x4255c1(0xf8)](_0x5c6496,_0x520693+_0x4255c1(0x139));let _0x7bb91d;if(existsSync(_0x509a25))try{const _0x4f8ac0=readFileSync(_0x509a25,_0x4255c1(0x140)),_0x413899=a125_0xf1dc4b(_0x4f8ac0);_0x7bb91d=buildLocalRuleToNameMappingFromJourney(_0x413899);}catch{}const _0x495184=[];for(const _0x164fde of _0x1d2add){const _0x4aadb0=_0x21e3c3[_0x4255c1(0x130)](_0x164fde['id']);if(!_0x4aadb0){_0x303ccc?.[_0x4255c1(0x105)](_0x4255c1(0xfe)+_0x164fde['id']+_0x4255c1(0x11a));continue;}const _0x35db30=_0x4aadb0[_0x4255c1(0x125)]?.[_0x4255c1(0x12a)],_0x51d0f6=_0x3a18c8(_0x164fde['id'],_0x35db30),_0x1c621c=await journeyResponseToDef(_0x4aadb0,_0x51d0f6);_0x495184[_0x4255c1(0xf7)]({'item':_0x164fde,'yaml':_0x1c621c});}const _0x2eb38c=buildMergedJourneyDef(_0x495184,_0x7bb91d);return{'bundleName':_0x461189,'folderPath':_0x34768f,'finalYaml':_0x2eb38c};}));for(const {bundleName:_0x1852bc,folderPath:_0x151786,finalYaml:_0x253bd8}of _0x1713a3){const _0x2c478c=normalizeJourneyDef(_0x253bd8),_0x30c42d=a125_0x1cdc02(_0x2c478c),_0xf3a2df=_0x151786?a125_0x265599['join'](_0x13fd42,_0x151786):_0x13fd42,_0x51990b=sanitizeFileName(_0x1852bc),_0x54dda1=getUniqueFileName(_0xf3a2df,_0x51990b,_0xbb1f75),_0x18bd94=a125_0x265599['join'](_0xf3a2df,_0x54dda1+_0x30a357(0x139));_0x5f3cee[_0x30a357(0xf7)](prepareFile(_0x18bd94,_0x30c42d,_0x13fd42));}}}const _0x32be58=Array[_0x30a357(0x112)](_0x898687[_0x30a357(0xf6)]())[_0x30a357(0x116)]((_0x8cb5d5,_0x2aad4d)=>_0x8cb5d5+_0x2aad4d['length'],0x0),_0x53a8fa=_0xbbb75b[_0x30a357(0x127)](_0x490742=>_0x490742[_0x30a357(0x12f)]!==SEGMENT_KIND_JOURNEY),_0x5d7105=_0x5f3cee[_0x30a357(0x127)](_0x31f741=>_0x31f741['isNew'])[_0x30a357(0x10a)],_0x1c6a10=_0x5f3cee[_0x30a357(0x127)](_0x28684e=>!_0x28684e[_0x30a357(0x12d)]&&_0x28684e['hasChanges'])['length'],_0x3e84b6=_0x5f3cee[_0x30a357(0x127)](_0x3da2de=>!_0x3da2de[_0x30a357(0x12d)]&&!_0x3da2de[_0x30a357(0x136)])[_0x30a357(0x10a)],_0x472d2d=Array[_0x30a357(0x112)](_0x4676db['values']())[_0x30a357(0x116)]((_0x4c1e67,_0x5748ff)=>_0x4c1e67+_0x5748ff['length'],0x0);return{'parentName':_0x3a14a1,'parentId':_0x2cb0b2,'targetDir':_0x13fd42,'files':_0x5f3cee,'counts':{'segments':_0x53a8fa[_0x30a357(0x10a)],'journeys':_0x4676db[_0x30a357(0x10f)],'journeyVersions':_0x472d2d,'activations':_0x32be58},'newFiles':_0x5d7105,'changedFiles':_0x1c6a10,'unchangedFiles':_0x3e84b6};}function createYamlContextForBundle(_0x5205d3,_0x304ffb,_0x2b63bd,_0x189b4e,_0x1ebbdc,_0x2dd170){const _0x1c4bbb=new Set(),_0x57f01c=new Map(),_0x991c1f=new Map(),_0x3e1aaa=createJumpTargetCache(),_0x58a882=async(_0x5b15a3,_0x5a47a3)=>{const _0x4a0d2d=a125_0x25dc,_0x2d2f30=_0x57f01c[_0x4a0d2d(0x130)](_0x5b15a3);if(_0x2d2f30!==undefined)return _0x2d2f30;if(!_0x5a47a3)return _0x5b15a3;try{let _0x4c413b=_0x304ffb[_0x4a0d2d(0x130)](_0x5b15a3);!_0x4c413b&&(_0x4c413b=await _0x5205d3['segment']['getSegment'](_0x5a47a3,_0x5b15a3),_0x304ffb['set'](_0x5b15a3,_0x4c413b));const _0x7350a4=generateJourneyLocalName(_0x4c413b[_0x4a0d2d(0x135)]),_0x4de6f5=_0x4c413b[_0x4a0d2d(0x12f)]===SEGMENT_KIND_JOURNEY&&_0x7350a4!==undefined;if(_0x4de6f5&&_0x7350a4){let _0x4aebc9=_0x7350a4,_0x41f02a=0x2;while(_0x1c4bbb['has'](_0x4aebc9)){_0x4aebc9=_0x7350a4+'_'+_0x41f02a,_0x41f02a++;}return _0x1c4bbb[_0x4a0d2d(0x124)](_0x4aebc9),_0x57f01c[_0x4a0d2d(0xfa)](_0x5b15a3,_0x4aebc9),_0x4aebc9;}return _0x4c413b[_0x4a0d2d(0x135)];}catch{return _0x5b15a3;}},_0x4efe9d=(_0x2bf4b4,_0x3ca4b5)=>({'resolveSegment':async _0x19e5cb=>{const _0x108b12=a125_0x25dc,_0xe8ee93=_0x57f01c[_0x108b12(0x130)](_0x19e5cb);if(_0xe8ee93!==undefined)return{'name':_0xe8ee93,'isJourneyLocal':!![]};if(!_0x3ca4b5)return{'name':_0x19e5cb,'isJourneyLocal':![]};try{let _0x21a8b4=_0x304ffb[_0x108b12(0x130)](_0x19e5cb);!_0x21a8b4&&(_0x21a8b4=await _0x5205d3[_0x108b12(0x137)][_0x108b12(0x111)](_0x3ca4b5,_0x19e5cb),_0x304ffb[_0x108b12(0xfa)](_0x19e5cb,_0x21a8b4));const _0x1767e4=generateJourneyLocalName(_0x21a8b4['name']),_0x2bf765=_0x21a8b4[_0x108b12(0x12f)]===SEGMENT_KIND_JOURNEY&&_0x1767e4!==undefined;if(_0x2bf765&&!_0x21a8b4[_0x108b12(0xff)]&&_0x3ca4b5)try{const _0x4839c3=await _0x5205d3[_0x108b12(0x137)][_0x108b12(0x111)](_0x3ca4b5,_0x19e5cb);_0x304ffb[_0x108b12(0xfa)](_0x19e5cb,_0x4839c3),_0x21a8b4=_0x4839c3;}catch{}const _0x558170=await _0x58a882(_0x19e5cb,_0x3ca4b5);let _0x34dca4;if(_0x2bf765&&_0x21a8b4[_0x108b12(0xff)]){const _0x1050fb=await segmentResponseToDef(_0x21a8b4,{'resolveSegmentName':_0x1c46f3=>_0x58a882(_0x1c46f3,_0x3ca4b5)});_0x34dca4={'description':_0x21a8b4['description'],'rule':_0x1050fb[_0x108b12(0xff)]};}return{'name':_0x558170,'isJourneyLocal':_0x2bf765,'definition':_0x34dca4};}catch{return{'name':_0x19e5cb,'isJourneyLocal':![]};}},'resolveActivation':async _0x47744f=>{const _0x4f3eec=a125_0x25dc,_0x381577=_0x991c1f[_0x4f3eec(0x130)](_0x47744f);if(_0x381577!==undefined)return{'name':_0x381577,'isJourneyLocal':!![]};try{let _0xf53325=_0x1ebbdc['get'](_0x47744f);!_0xf53325&&(_0xf53325=await _0x5205d3[_0x4f3eec(0x11b)][_0x4f3eec(0x11f)](_0x2bf4b4,_0x47744f));const _0x3112c5=_0xf53325[_0x4f3eec(0x125)][_0x4f3eec(0x134)][_0x4f3eec(0x135)]||_0x47744f,_0x554c4e=sanitizeYamlKey(_0x3112c5)||'activation_'+_0x47744f,_0x4a75d6=_0x554c4e;_0x991c1f['set'](_0x47744f,_0x4a75d6);const _0x2e5bba=journeyActivationStepToYaml(_0xf53325,_0x2b63bd,_0x189b4e);return{'name':_0x4a75d6,'isJourneyLocal':!![],'definition':_0x2e5bba};}catch{return{'name':_0x47744f,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x33bbe9,_0x3de417)=>resolveJumpTarget(_0x33bbe9,_0x3de417,_0x3e1aaa,async _0x19d3b2=>{const _0x13cb16=a125_0x25dc,_0x2aba74=_0x2dd170['get'](_0x19d3b2);if(_0x2aba74)return _0x2aba74;return _0x5205d3['journey'][_0x13cb16(0x13c)](_0x19d3b2);})});return{'createYamlContext':_0x4efe9d};}
@@ -1 +1 @@
1
- function a126_0x2dc7(){const _0x25f0b7=['8748936LXVhvP','version','396670QaCOSA','segments','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','code','40290JWOasB','.tmp','.push-recovery.json','6nghogU','9ovcFag','join','21790zNwJHt','utf-8','debug','602538SRRFzt','28rPSEsf','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','string','568qhLeFd','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','toISOString','3867152dXmpCE','957ssbTHa','stringify','13oWXhNB','warn','162798euQOYg'];a126_0x2dc7=function(){return _0x25f0b7;};return a126_0x2dc7();}(function(_0x11bc9b,_0x2f1c73){const _0x2c740d=a126_0x568a,_0x47bbd9=_0x11bc9b();while(!![]){try{const _0x5085a5=parseInt(_0x2c740d(0x1f2))/0x1+parseInt(_0x2c740d(0x1ef))/0x2*(parseInt(_0x2c740d(0x1f9))/0x3)+parseInt(_0x2c740d(0x203))/0x4*(-parseInt(_0x2c740d(0x1fc))/0x5)+parseInt(_0x2c740d(0x1ff))/0x6*(-parseInt(_0x2c740d(0x200))/0x7)+parseInt(_0x2c740d(0x1ea))/0x8*(parseInt(_0x2c740d(0x1fa))/0x9)+-parseInt(_0x2c740d(0x1f6))/0xa*(parseInt(_0x2c740d(0x1eb))/0xb)+parseInt(_0x2c740d(0x1f0))/0xc*(parseInt(_0x2c740d(0x1ed))/0xd);if(_0x5085a5===_0x2f1c73)break;else _0x47bbd9['push'](_0x47bbd9['shift']());}catch(_0x5997ec){_0x47bbd9['push'](_0x47bbd9['shift']());}}}(a126_0x2dc7,0x61df9));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a126_0x314be2 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-recovery');export function getPushRecoveryPath(_0x500f2c){const _0x207405=a126_0x568a,_0xb09be2=a126_0x314be2['dirname'](_0x500f2c),_0x1e53ff=a126_0x314be2['basename'](_0x500f2c);return a126_0x314be2[_0x207405(0x1fb)](_0xb09be2,'.'+_0x1e53ff+_0x207405(0x1f8));}export function readPushRecovery(_0x30caee){const _0x83af31=a126_0x568a,_0x241d7d=getPushRecoveryPath(_0x30caee);if(!existsSync(_0x241d7d))return undefined;try{const _0x56173b=readFileSync(_0x241d7d,'utf-8'),_0x2c37c2=JSON['parse'](_0x56173b);if(_0x2c37c2?.[_0x83af31(0x1f1)]!==0x1||typeof _0x2c37c2['journeyName']!==_0x83af31(0x202))return undefined;return _0x2c37c2;}catch(_0x2ae8d4){return _0x2ae8d4 instanceof SyntaxError?logger['debug'](_0x83af31(0x204)+_0x2ae8d4):logger[_0x83af31(0x1ee)](_0x83af31(0x1f4)+_0x2ae8d4),undefined;}}export function writePushRecovery(_0x59685c,_0x5ea09e){const _0x58dd4a=a126_0x568a,_0xfc733=getPushRecoveryPath(_0x59685c),_0x1b266e=_0xfc733+_0x58dd4a(0x1f7);writeFileSync(_0x1b266e,JSON[_0x58dd4a(0x1ec)](_0x5ea09e,null,0x2)+'\x0a',_0x58dd4a(0x1fd)),renameSync(_0x1b266e,_0xfc733);}export function deletePushRecovery(_0x5c1c1e){const _0x5fd685=a126_0x568a,_0x48630b=getPushRecoveryPath(_0x5c1c1e);try{unlinkSync(_0x48630b);}catch(_0x232d2c){_0x232d2c[_0x5fd685(0x1f5)]!=='ENOENT'&&logger[_0x5fd685(0x1fe)](_0x5fd685(0x201)+_0x232d2c);}}function a126_0x568a(_0x11d7a7,_0x232644){_0x11d7a7=_0x11d7a7-0x1e9;const _0x2dc7f2=a126_0x2dc7();let _0x568a87=_0x2dc7f2[_0x11d7a7];return _0x568a87;}export function saveSegmentToPushRecovery(_0x41f129,_0xba065d,_0x2c0ddb,_0x1b403a){const _0xfdbab=a126_0x568a,_0x2c83ad=readPushRecovery(_0x41f129),_0x8c8475=_0x2c83ad?.['journeyName']===_0xba065d?{..._0x2c83ad,'updatedAt':new Date()[_0xfdbab(0x1e9)]()}:{'version':0x1,'journeyName':_0xba065d,'updatedAt':new Date()['toISOString'](),'segments':{}};_0x8c8475[_0xfdbab(0x1f3)][_0x2c0ddb]=_0x1b403a,writePushRecovery(_0x41f129,_0x8c8475);}
1
+ const a126_0x4558dc=a126_0x35b0;(function(_0x5a317f,_0x24f075){const _0x1cb1fd=a126_0x35b0,_0x243ddd=_0x5a317f();while(!![]){try{const _0x251968=parseInt(_0x1cb1fd(0x1d0))/0x1*(-parseInt(_0x1cb1fd(0x1dc))/0x2)+-parseInt(_0x1cb1fd(0x1de))/0x3*(-parseInt(_0x1cb1fd(0x1d4))/0x4)+parseInt(_0x1cb1fd(0x1e0))/0x5*(-parseInt(_0x1cb1fd(0x1d9))/0x6)+parseInt(_0x1cb1fd(0x1c4))/0x7*(parseInt(_0x1cb1fd(0x1cd))/0x8)+parseInt(_0x1cb1fd(0x1dd))/0x9+-parseInt(_0x1cb1fd(0x1d8))/0xa*(parseInt(_0x1cb1fd(0x1d3))/0xb)+-parseInt(_0x1cb1fd(0x1db))/0xc*(-parseInt(_0x1cb1fd(0x1c8))/0xd);if(_0x251968===_0x24f075)break;else _0x243ddd['push'](_0x243ddd['shift']());}catch(_0x151a84){_0x243ddd['push'](_0x243ddd['shift']());}}}(a126_0x3c9d,0xbf6a2));function a126_0x3c9d(){const _0x1341bb=['toISOString','segments','stringify','13RJrFKo','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','.push-recovery.json','.tmp','136ICAYwa','string','join','5rGKVmI','journeyName','code','55axTcge','407084AOlNcx','dirname','tdx.sdk.push-recovery','version','2473130Qfkvul','13290wNsDOd','debug','15689616DQXHfR','426670hHNbbm','13937670NxLFXg','3KeVUCX','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','1325XIOguZ','294980eNGvFj'];a126_0x3c9d=function(){return _0x1341bb;};return a126_0x3c9d();}import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a126_0x35b0(_0x1eb315,_0x5a4429){_0x1eb315=_0x1eb315-0x1c4;const _0x3c9d7e=a126_0x3c9d();let _0x35b0c2=_0x3c9d7e[_0x1eb315];return _0x35b0c2;}import a126_0x2ab610 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a126_0x4558dc(0x1d6));export function getPushRecoveryPath(_0x57179e){const _0x3b8886=a126_0x4558dc,_0x54efed=a126_0x2ab610[_0x3b8886(0x1d5)](_0x57179e),_0x186548=a126_0x2ab610['basename'](_0x57179e);return a126_0x2ab610[_0x3b8886(0x1cf)](_0x54efed,'.'+_0x186548+_0x3b8886(0x1cb));}export function readPushRecovery(_0x3af5a3){const _0x5815ab=a126_0x4558dc,_0x23e37e=getPushRecoveryPath(_0x3af5a3);if(!existsSync(_0x23e37e))return undefined;try{const _0x2e64cb=readFileSync(_0x23e37e,'utf-8'),_0x58db80=JSON['parse'](_0x2e64cb);if(_0x58db80?.[_0x5815ab(0x1d7)]!==0x1||typeof _0x58db80[_0x5815ab(0x1d1)]!==_0x5815ab(0x1ce))return undefined;return _0x58db80;}catch(_0x417150){return _0x417150 instanceof SyntaxError?logger[_0x5815ab(0x1da)](_0x5815ab(0x1ca)+_0x417150):logger['warn'](_0x5815ab(0x1c9)+_0x417150),undefined;}}export function writePushRecovery(_0x30f7b4,_0x4aec5){const _0x4687c5=a126_0x4558dc,_0x3b23e6=getPushRecoveryPath(_0x30f7b4),_0x238f6a=_0x3b23e6+_0x4687c5(0x1cc);writeFileSync(_0x238f6a,JSON[_0x4687c5(0x1c7)](_0x4aec5,null,0x2)+'\x0a','utf-8'),renameSync(_0x238f6a,_0x3b23e6);}export function deletePushRecovery(_0x3132ed){const _0x4152cf=a126_0x4558dc,_0x505a50=getPushRecoveryPath(_0x3132ed);try{unlinkSync(_0x505a50);}catch(_0x39f4b7){_0x39f4b7[_0x4152cf(0x1d2)]!=='ENOENT'&&logger[_0x4152cf(0x1da)](_0x4152cf(0x1df)+_0x39f4b7);}}export function saveSegmentToPushRecovery(_0x469e0f,_0x3bc0c6,_0x255415,_0x43ad3f){const _0x167554=a126_0x4558dc,_0x49de3a=readPushRecovery(_0x469e0f),_0x34c01f=_0x49de3a?.['journeyName']===_0x3bc0c6?{..._0x49de3a,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0x3bc0c6,'updatedAt':new Date()[_0x167554(0x1c5)](),'segments':{}};_0x34c01f[_0x167554(0x1c6)][_0x255415]=_0x43ad3f,writePushRecovery(_0x469e0f,_0x34c01f);}
@@ -1 +1 @@
1
- const a127_0x489499=a127_0x3f67;(function(_0xc693ca,_0x516556){const _0x2947a2=a127_0x3f67,_0xad3d40=_0xc693ca();while(!![]){try{const _0x54f142=-parseInt(_0x2947a2(0x122))/0x1+-parseInt(_0x2947a2(0xd8))/0x2+-parseInt(_0x2947a2(0x19b))/0x3*(-parseInt(_0x2947a2(0x15f))/0x4)+parseInt(_0x2947a2(0x168))/0x5*(parseInt(_0x2947a2(0x11a))/0x6)+-parseInt(_0x2947a2(0x141))/0x7+-parseInt(_0x2947a2(0x175))/0x8+parseInt(_0x2947a2(0x197))/0x9*(parseInt(_0x2947a2(0x191))/0xa);if(_0x54f142===_0x516556)break;else _0xad3d40['push'](_0xad3d40['shift']());}catch(_0x5a339a){_0xad3d40['push'](_0xad3d40['shift']());}}}(a127_0x3b7a,0x7ce67));function a127_0x3b7a(){const _0x2fa5d5=['Journey\x20\x27','Creating\x20segment\x20\x27','notification','journeyBundleName','Deleted\x20activation\x20\x27','../../utils/async.js','Activation','entries','create','relationships','deleteSegment','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Entry\x20criteria:\x20','tdx.sdk.push-workflow','getSegmentEntity\x20also\x20failed\x20for\x20','effectiveFolderId','milestone','parseDocument','sha1','SEGMENT_UPDATE_ERROR','journeyName','activationActions','activationsBySegmentId','Updating\x20segment\x20\x27','6358408eIUvPu','Failed\x20to\x20','__pending_','progress','nameToId','all_columns','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','add','relative','fetchJourney','onProgress','type','max','idToName','index','data','journeyActivationNameToId','filter','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','has','journeyBundlesByFolderAndName','match','journeyActivationStepId','map','logWarning','includes','\x27\x20decision\x20point\x20branch\x20\x27','segment_updating','digest','segment','2668TeVHEE','ACTIVATION_UPDATE_ERROR','Updating\x20activation\x20\x27','logDeleted','utf-8','logSuccess','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','values','activationParams','100uqwtYO','hasChanges','Creating\x20folder\x20\x27','.$1.push-recovery.json','\x20activation\x20\x27','parentId','connector_config','getSegment','toLowerCase','existingSegments','nameToType','length','columns','6658304KMOfiz','\x20(referenced\x20in\x20journey\x20','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getJourney','some','errors','SEGMENT_NOT_FOUND','null','Created\x20segment\x20\x27','existingJourney','deleteActivation','JOURNEY_UPDATE_ERROR','diff','idToEmailMap','\x27\x20milestone','existingSegment','push','segment_deleted','stage\x20\x27','reduce','activationContext','conditions','verbose','steps','embeddedSegmentNameToId','folder_creating','parentSegmentFolder','isNew','144740oOfyuj','./journey-yaml.js','run_after_journey_refresh','decision_point','all','activation_created','1161usnVYh','slice','withProgress','absolutePath','1308vrkUcd','deleted','set','embedded_segment_creating','schedule','createJourneySegment','journeyId','activation_deleted','folder_created','JOURNEY_SYNTAX_ERROR','embedded_segment_created','flatMap','debug','segmentFolderId','\x27\x20for\x20','journey_creating','replace','activation_','attributes','kind','journeyById','updateSegmentById','stringify','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Condition','NOT_FOUND','Segment\x20not\x20found:\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','with','\x27\x20wait\x20condition','branches','startsWith','entry_criteria','connection','folderId','folderPathToId','existingActivation','item','journey_entry_criteria_','exitCriterias','createdSegmentId','Fetching\x20','versionNumber','segment_creating','):\x20','journey','SEGMENT_SYNTAX_ERROR','action','state','entry','Created\x20journey\x20\x27','delete','activation_creating','activations','Updated\x20activation\x20\x27','222824aVIvCF','Creating\x20activation\x20\x27','\x27\x20entry\x20criteria','segment_created','hex','connectionIdToNameMap','validatedRequest','conditionSegmentId','draft','toISOString','day','uniqueServerName','segmentNameToId','waitStepUnit','parse','journey_updating','activation_template_id','rootFolderId','journey_created','getSegment\x20failed\x20for\x20','toString','unchanged','resolveJourneyId','yamlActivation','get','waitStep','\x27\x20from\x20file:\x20','entryCriteria','message','user','INTERNAL','segments','split','size','keys','created','find','DecisionPoint','segmentId','yamlConfig','sort','uniqueSegmentName','isArray','createSegment','embedded_activation_creating','localName','activationStepsById',').\x20','deps','from','createActivation','rule','\x0a\x20\x20','resolveSegment','conditionTimeoutUnit','waitStepType','listActivations','\x20error(s)','updated','journeys','goal','resolvedRule','segmentByFolderAndName','conditionTimeoutDuration','createdSegmentIds','name','69714WvxyBF','description','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','goal\x20criteria','Duration','\x27...','segment_updated','./child-segment-yaml.js','26703ZbSicj','update','stages','join','Embedded\x20segment\x20\x27','journeyStages','WaitStep'];a127_0x3b7a=function(){return _0x2fa5d5;};return a127_0x3b7a();}import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';function a127_0x3f67(_0x39cb58,_0x68c5fd){_0x39cb58=_0x39cb58-0xc4;const _0x3b7add=a127_0x3b7a();let _0x3f67e6=_0x3b7add[_0x39cb58];return _0x3f67e6;}const logger=Logger['of'](a127_0x489499(0x136));export const PENDING_SEGMENT_PREFIX=a127_0x489499(0x143);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x526c92){return''+PENDING_SEGMENT_PREFIX+_0x526c92+'__';}export function isPendingSegmentId(_0x4d59c0){const _0x2a70de=a127_0x489499;return _0x4d59c0[_0x2a70de(0x1ba)](PENDING_SEGMENT_PREFIX)&&!_0x4d59c0['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x28be3a){return _0x28be3a['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x28e039){return''+PENDING_ACTIVATION_PREFIX+_0x28e039+'__';}export function isPendingActivationId(_0x4d0ad7){const _0x57a89=a127_0x489499;return _0x4d0ad7[_0x57a89(0x1ba)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x141cf9){const _0x40ffad=a127_0x489499;return _0x141cf9[_0x40ffad(0x1ab)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x704fc6,_0x1095ef){const _0x18a784=a127_0x489499,_0x492617=_0x704fc6+'::'+(_0x1095ef['trim']()||'segment'),_0x51bf3c=createHash(_0x18a784(0x13b))['update'](_0x492617)[_0x18a784(0x15d)](_0x18a784(0xdc))[_0x18a784(0x198)](0x0,0xc);return _0x18a784(0xc7)+_0x51bf3c;}export function ensureJourneyDefaults(_0x442375){const _0x46e4e1=a127_0x489499;!_0x442375[_0x46e4e1(0x11b)]&&(_0x442375['description']=''),!_0x442375[_0x46e4e1(0xd1)]&&(_0x442375[_0x46e4e1(0xd1)]=_0x46e4e1(0xe0));}export function injectExistingStageIds(_0x5e25fe,_0x19126e){const _0x373c20=a127_0x489499,_0x595139=new Map(_0x19126e[_0x373c20(0x158)](_0x43dcc3=>[_0x43dcc3[_0x373c20(0x119)],_0x43dcc3['id']]));for(const _0x54958b of _0x5e25fe){if(!_0x54958b['id']){const _0x4f94b=_0x595139[_0x373c20(0xf0)](_0x54958b[_0x373c20(0x119)]);_0x4f94b&&(_0x54958b['id']=_0x4f94b);}}}export function resolveTDFolderPath(_0x2bb596,_0x5334ed,_0x1bac3e){const _0x5539be=a127_0x489499;if(!_0x5334ed)return _0x2bb596;if(_0x2bb596===_0x1bac3e||_0x2bb596[_0x5539be(0x1ba)](_0x1bac3e+'/'))return _0x2bb596;return _0x2bb596?_0x1bac3e+'/'+_0x2bb596:_0x1bac3e;}export function addFoldersToCreate(_0x28bd39,_0x21d107,_0x5d6d97){const _0x426334=a127_0x489499;if(!_0x28bd39)return;if(_0x21d107[_0x426334(0x154)](_0x28bd39))return;const _0x4621d7=_0x28bd39[_0x426334(0xf8)]('/');let _0x5d848f='';for(const _0x456cce of _0x4621d7){_0x5d848f=_0x5d848f?_0x5d848f+'/'+_0x456cce:_0x456cce,!_0x21d107[_0x426334(0x154)](_0x5d848f)&&_0x5d6d97[_0x426334(0x148)](_0x5d848f);}}export function sortFoldersByDepth(_0x593993){const _0x5f2b5f=a127_0x489499;return[..._0x593993][_0x5f2b5f(0x100)]((_0x376d37,_0x582d62)=>{const _0x42e158=_0x5f2b5f,_0x5d2344=(_0x376d37[_0x42e158(0x156)](/\//g)||[])[_0x42e158(0x173)],_0x53bba4=(_0x582d62[_0x42e158(0x156)](/\//g)||[])[_0x42e158(0x173)];return _0x5d2344-_0x53bba4;});}import*as a127_0x1c2ffd from'yaml';import{readFileSync}from'fs';import a127_0x2d5ff4 from'path';import{isJourneyDef,parseYamlString as a127_0x1cfff2,toYamlString as a127_0x5a6f05,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(_0x5649c2){const _0x4b3d68=a127_0x489499;if(Array[_0x4b3d68(0x102)](_0x5649c2))return'['+_0x5649c2['map'](_0x4c78b1=>stableStringify(_0x4c78b1))[_0x4b3d68(0x125)](',')+']';if(_0x5649c2&&typeof _0x5649c2==='object'){const _0x112862=_0x5649c2,_0x85253b=Object['keys'](_0x112862)[_0x4b3d68(0x100)](),_0x2f750d=_0x85253b['map'](_0x4729e3=>'\x22'+_0x4729e3+'\x22:'+stableStringify(_0x112862[_0x4729e3]));return'{'+_0x2f750d[_0x4b3d68(0x125)](',')+'}';}const _0x5806c4=JSON[_0x4b3d68(0x1b1)](_0x5649c2);return _0x5806c4===undefined?_0x4b3d68(0x17c):_0x5806c4;}function activationSignature(_0x3e9d96){const _0x6ec040=a127_0x489499,_0xf3dc07={'connection':_0x3e9d96['connection'],..._0x3e9d96[_0x6ec040(0x146)]!==undefined&&{'all_columns':_0x3e9d96[_0x6ec040(0x146)]},..._0x3e9d96[_0x6ec040(0x174)]!==undefined&&{'columns':_0x3e9d96[_0x6ec040(0x174)]},..._0x3e9d96['behavior']!==undefined&&{'behavior':_0x3e9d96['behavior']},..._0x3e9d96[_0x6ec040(0x19f)]!==undefined&&{'schedule':_0x3e9d96[_0x6ec040(0x19f)]},..._0x3e9d96[_0x6ec040(0x12b)]!==undefined&&{'notification':_0x3e9d96[_0x6ec040(0x12b)]},..._0x3e9d96[_0x6ec040(0x16e)]!==undefined&&{'connector_config':_0x3e9d96[_0x6ec040(0x16e)]},..._0x3e9d96[_0x6ec040(0xe8)]!==undefined&&{'activation_template_id':_0x3e9d96['activation_template_id']}};return stableStringify(_0xf3dc07);}async function fetchSegment(_0x26a274,_0x5ae74a,_0x7a7db3,_0x22cf27){const _0x55b435=a127_0x489499,_0x413470=_0x22cf27?.[_0x55b435(0xfc)](_0x313bb8=>_0x313bb8['id']===_0x7a7db3);if(_0x413470)return _0x413470;try{return await _0x26a274[_0x55b435(0x15e)][_0x55b435(0x16f)](_0x5ae74a,_0x7a7db3);}catch(_0x36767a){logger[_0x55b435(0x1a7)](_0x55b435(0xeb)+_0x7a7db3+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x36767a);try{return await _0x26a274[_0x55b435(0x15e)]['getSegmentEntity'](_0x7a7db3);}catch(_0x5a9890){return logger[_0x55b435(0x1a7)](_0x55b435(0x137)+_0x7a7db3+':\x20'+_0x5a9890),null;}}}function recoverSegmentIdsFromPushRecovery(_0x9decb8,_0x6e45e8,_0x520c33){const _0x4f9bd8=a127_0x489499,_0x572034=readPushRecovery(_0x9decb8[_0x4f9bd8(0x19a)]);if(_0x572034?.[_0x4f9bd8(0x13d)]===_0x9decb8['yamlConfig'][_0x4f9bd8(0x119)])for(const [_0x969885,_0xc449e6]of Object[_0x4f9bd8(0x130)](_0x572034['segments'])){const _0x20d9df=generateDeterministicJourneySegmentName(_0x9decb8[_0x4f9bd8(0xff)]['name'],_0x969885);_0xc449e6[_0x4f9bd8(0xe3)]===_0x20d9df&&(_0x6e45e8[_0x4f9bd8(0x19d)](_0x969885,_0xc449e6['segmentId']),_0x520c33['set'](_0x969885,_0xc449e6[_0x4f9bd8(0xfe)]));}}async function createOrRecoverEmbeddedSegment(_0x44c7cf,_0xd0de67,_0x2938c8,_0x2bda47){const _0x188486=a127_0x489499;let _0x2fe8a9;try{_0x2fe8a9=await _0x44c7cf[_0x188486(0x15e)][_0x188486(0x1a0)]({'name':_0x2938c8[_0x188486(0x101)],'description':_0x2938c8[_0x188486(0x11b)],'journeyId':_0x2938c8[_0x188486(0x1a1)],'rule':_0x2bda47(_0x2938c8[_0x188486(0x115)],!![]),'countPopulation':!![],'parentFolderId':_0x2938c8[_0x188486(0x1bd)],'audienceId':_0x2938c8['parentId']});}catch(_0x138d49){const _0x195703=_0x138d49 instanceof Error&&_0x138d49[_0x188486(0xf4)][_0x188486(0x15a)]('Name\x20has\x20already\x20been\x20taken');if(_0x195703){const _0xaba2d2=readPushRecovery(_0xd0de67[_0x188486(0x19a)]),_0x103875=_0xaba2d2?.[_0x188486(0x13d)]===_0xd0de67['yamlConfig'][_0x188486(0x119)]?_0xaba2d2[_0x188486(0xf7)][_0x2938c8[_0x188486(0x105)]]:undefined;if(_0x103875?.[_0x188486(0xe3)]===_0x2938c8['uniqueSegmentName'])await _0x44c7cf[_0x188486(0x15e)][_0x188486(0x1b0)](_0x2938c8[_0x188486(0x16d)],_0x103875[_0x188486(0xfe)],{'description':_0x2938c8[_0x188486(0x11b)],'rule':_0x2bda47(_0x2938c8[_0x188486(0x115)],!![]),'countPopulation':!![]}),_0x2fe8a9=_0x103875[_0x188486(0xfe)];else throw new SDKError(ErrorCode[_0x188486(0x13c)],_0x188486(0x126)+_0x2938c8['localName']+_0x188486(0x147)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0xd0de67[_0x188486(0x19a)][_0x188486(0x1ab)](/([^/]+)$/,_0x188486(0x16b))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x138d49);}else throw _0x138d49;}return saveSegmentToPushRecovery(_0xd0de67['absolutePath'],_0xd0de67[_0x188486(0xff)][_0x188486(0x119)],_0x2938c8[_0x188486(0x105)],{'segmentId':_0x2fe8a9,'uniqueServerName':_0x2938c8[_0x188486(0x101)],'createdAt':new Date()['toISOString']()}),_0x2fe8a9;}export async function prepareSegmentFiles(_0x10c0ad,_0x5bec3f,_0x40d2f3,_0x1c046e,_0x5654b8){const _0x5bc6cd=a127_0x489499,{activationDefToCreateRequest:_0xde46c0}=await import(_0x5bc6cd(0x121)),_0x29545d=[],_0x2c849c=new Set();for(const {yamlConfig:_0x5c6edd,folderPath:_0x3c5ba3,sourcePath:_0xd7a02d}of _0x10c0ad){const _0xa18ca9=resolveTDFolderPath(_0x3c5ba3,_0x1c046e,_0x5654b8),_0x46eff9=_0xa18ca9+':'+_0x5c6edd[_0x5bc6cd(0x119)],_0x42f93c=_0x5bec3f[_0x5bc6cd(0x116)]['get'](_0x46eff9),_0x4d709a=_0x42f93c?_0x5bec3f[_0x5bc6cd(0x13f)]['get'](_0x42f93c['id'])||[]:[];addFoldersToCreate(_0xa18ca9,_0x5bec3f[_0x5bc6cd(0xc4)],_0x2c849c);const _0x10e8c9=calculateActivationActions(_0x5c6edd['activations']||[],_0x4d709a,_0x5bec3f[_0x5bc6cd(0x182)],_0x5bec3f['connectionIdToNameMap']);for(const _0x13105b of _0x10e8c9){(_0x13105b['type']===_0x5bc6cd(0x131)||_0x13105b[_0x5bc6cd(0x14c)]===_0x5bc6cd(0x123))&&_0x13105b[_0x5bc6cd(0xef)]&&(_0x13105b[_0x5bc6cd(0xde)]=await _0xde46c0(_0x13105b[_0x5bc6cd(0xef)],_0x40d2f3));}const _0x49e7a1=calculateSegmentDiff(_0x5c6edd,_0x42f93c,_0x4d709a,_0x5bec3f[_0x5bc6cd(0x182)],_0x5bec3f[_0x5bc6cd(0xdd)]);_0x29545d[_0x5bc6cd(0x185)]({'relativePath':_0x5c6edd[_0x5bc6cd(0x119)],'absolutePath':_0xd7a02d,'yamlConfig':_0x5c6edd,'folderPath':_0xa18ca9,'existingSegment':_0x42f93c,'existingActivations':_0x4d709a,'isNew':_0x49e7a1[_0x5bc6cd(0x190)],'hasChanges':_0x49e7a1[_0x5bc6cd(0x169)],'diff':_0x49e7a1[_0x5bc6cd(0x181)],'activationActions':_0x10e8c9});}return{'segmentFiles':_0x29545d,'foldersToCreate':_0x2c849c};}export async function prepareJourneyFiles(_0x2709ba,_0x21ae3e,_0x3047b3,_0x32499b){const _0x51a6b7=a127_0x489499,_0x5383c3=[],_0x3082fd=new Set();for(const {yamlConfig:_0x151eb4,folderPath:_0xeb8057,sourcePath:_0x3e4b31}of _0x2709ba){const _0x32965d=resolveTDFolderPath(_0xeb8057,_0x3047b3,_0x32499b),_0x1a96ab=_0x32965d+':'+_0x151eb4[_0x51a6b7(0x119)],_0xd315f0=_0x21ae3e[_0x51a6b7(0x155)]['get'](_0x1a96ab);let _0x20b040,_0x33e8ac;if(_0xd315f0&&_0xd315f0[_0x51a6b7(0x173)]>0x0){const _0x2d628d=buildLocalExpandedRuleMappings(_0x151eb4),{createYamlContext:_0x563f47,prefetchJourneySegments:_0xd9338f}=createPushYamlContextForBundle(_0x21ae3e[_0x51a6b7(0x108)],_0x21ae3e[_0x51a6b7(0x16d)],_0x21ae3e[_0x51a6b7(0x171)],_0x2d628d,_0x21ae3e[_0x51a6b7(0x182)],_0x21ae3e[_0x51a6b7(0xdd)],_0x21ae3e[_0x51a6b7(0x106)],_0x21ae3e[_0x51a6b7(0x1af)]);await _0xd9338f(_0xd315f0[_0x51a6b7(0x158)](_0x50c58b=>_0x50c58b['id']));const _0x1b0be0=hasMultipleVersions(_0x151eb4),_0x2c1ab9=async _0x3f5730=>{const _0x290345=_0x51a6b7,_0x3978ca=_0x21ae3e[_0x290345(0x1af)]?.['get'](_0x3f5730);if(_0x3978ca)return _0x3978ca;return _0x21ae3e[_0x290345(0x14a)]({'journeyId':_0x3f5730,'journeyName':_0x151eb4[_0x290345(0x119)],'isMultiVersion':_0xd315f0[_0x290345(0x173)]>0x1});};if(_0x1b0be0&&_0xd315f0['length']>0x1){const _0xfe4da6=[];for(const _0x42fc89 of _0xd315f0){const _0x19b8b8=_0x42fc89[_0x51a6b7(0xcb)]||0x1;_0x21ae3e['progress']?.[_0x51a6b7(0x123)]('Fetching\x20'+_0x151eb4['name']+'\x20v'+_0x19b8b8);const _0x426d25=await _0x2c1ab9(_0x42fc89['id']),_0x530604=_0x563f47(_0x42fc89['id']),_0x1941cc=await journeyResponseToDef(_0x426d25,_0x530604);_0xfe4da6['push']({'item':_0x42fc89,'yaml':_0x1941cc});}const _0x378875=buildLocalRuleToNameMappingFromJourney(_0x151eb4);_0x33e8ac=buildMergedJourneyDef(_0xfe4da6,_0x378875);const _0x45c049=Math[_0x51a6b7(0x14d)](..._0xfe4da6[_0x51a6b7(0x158)](_0x227491=>_0x227491[_0x51a6b7(0xc6)][_0x51a6b7(0xcb)]||0x0)),_0x57cc5c=_0xd315f0['find'](_0x2ec30f=>(_0x2ec30f[_0x51a6b7(0xcb)]||0x0)===_0x45c049);_0x57cc5c&&(_0x21ae3e[_0x51a6b7(0x144)]?.['update'](_0x51a6b7(0xca)+_0x151eb4[_0x51a6b7(0x119)]+'\x20v'+_0x45c049),_0x20b040=await _0x2c1ab9(_0x57cc5c['id']));}else{const _0x40083e=_0xd315f0[_0xd315f0[_0x51a6b7(0x173)]-0x1];_0x21ae3e[_0x51a6b7(0x144)]?.[_0x51a6b7(0x123)]('Fetching\x20'+_0x151eb4[_0x51a6b7(0x119)]),_0x20b040=await _0x2c1ab9(_0x40083e['id']);const _0x354450=_0x563f47(_0x40083e['id']),_0x3e63eb=await journeyResponseToDef(_0x20b040,_0x354450),_0x8d31be=buildLocalRuleToNameMappingFromJourney(_0x151eb4);_0x33e8ac=buildMergedJourneyDef([{'item':_0x40083e,'yaml':_0x3e63eb}],_0x8d31be);}}addFoldersToCreate(_0x32965d,_0x21ae3e['folderPathToId'],_0x3082fd);const _0x1fe4f7=calculateJourneyDiff(_0x151eb4,_0x33e8ac);_0x5383c3[_0x51a6b7(0x185)]({'relativePath':_0x151eb4[_0x51a6b7(0x119)],'absolutePath':_0x3e4b31,'yamlConfig':_0x151eb4,'folderPath':_0x32965d,'existingJourney':_0x20b040,'isNew':_0x1fe4f7[_0x51a6b7(0x190)],'hasChanges':_0x1fe4f7['hasChanges'],'diff':_0x1fe4f7['diff']});}return{'journeyFiles':_0x5383c3,'foldersToCreate':_0x3082fd};}export function calculateActivationActions(_0x3cf091,_0x46ea9d,_0x4fba78,_0x39aedc){const _0x88a94a=a127_0x489499,_0x1bd8b6=[],_0x667d18=new Map();for(const _0x29f15d of _0x46ea9d){_0x667d18[_0x88a94a(0x19d)](_0x29f15d[_0x88a94a(0x119)],_0x29f15d);}const _0x4b8bee=new Map();for(const _0x5c064a of _0x3cf091){_0x4b8bee[_0x88a94a(0x19d)](_0x5c064a[_0x88a94a(0x119)],_0x5c064a);}for(const _0x543a59 of _0x3cf091){const _0x28de2b=_0x667d18['get'](_0x543a59[_0x88a94a(0x119)]);if(!_0x28de2b)_0x1bd8b6[_0x88a94a(0x185)]({'type':'create','name':_0x543a59[_0x88a94a(0x119)],'yamlActivation':_0x543a59});else{const _0x25a1b0=activationResponseToDef(_0x28de2b,_0x4fba78,_0x39aedc),_0x9ad4e6=a127_0x1c2ffd[_0x88a94a(0x1b1)](_0x25a1b0),_0x15c275=a127_0x1c2ffd['stringify'](_0x543a59);_0x9ad4e6!==_0x15c275&&_0x1bd8b6['push']({'type':_0x88a94a(0x123),'name':_0x543a59[_0x88a94a(0x119)],'yamlActivation':_0x543a59,'existingActivation':_0x28de2b});}}for(const _0x1ca63d of _0x46ea9d){!_0x4b8bee[_0x88a94a(0x154)](_0x1ca63d[_0x88a94a(0x119)])&&_0x1bd8b6[_0x88a94a(0x185)]({'type':_0x88a94a(0xd4),'name':_0x1ca63d['name'],'existingActivation':_0x1ca63d});}return _0x1bd8b6;}function calculateYamlDiff(_0x35fc1a,_0x1d9e5c){if(_0x1d9e5c){const _0xfeb31d=generateDiff(_0x1d9e5c,_0x35fc1a),_0x11d085=hasChanges(_0xfeb31d);return{'isNew':![],'hasChanges':_0x11d085,'diff':_0x11d085?formatDiffWithColors(_0xfeb31d):undefined};}const _0x4091cf=generateDiff('',_0x35fc1a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4091cf)};}export function calculateSegmentDiff(_0x1434a7,_0x77293f,_0x33913a,_0x47c14c,_0xe2cf05){const _0x9d0f0=segmentToYamlString(_0x1434a7),_0x2c4339=_0x77293f?segmentToYamlString(segmentWithActivationsToYaml(_0x77293f,_0x33913a,undefined,_0x47c14c,_0xe2cf05)):undefined;return calculateYamlDiff(_0x9d0f0,_0x2c4339);}export function calculateJourneyDiff(_0x32dac7,_0x3ceec2){const _0xbf1fb1=normalizeJourneyDef(_0x32dac7,_0x32dac7),_0x4aec2a=a127_0x5a6f05(_0xbf1fb1),_0x32bb81=_0x3ceec2?a127_0x5a6f05(normalizeJourneyDef(_0x3ceec2,_0x32dac7)):undefined;return calculateYamlDiff(_0x4aec2a,_0x32bb81);}export function findSegmentsToDelete(_0x4cbb52,_0x2fa8b8,_0x3587dc,_0x477226,_0x482c55){const _0x12dd5b=a127_0x489499,_0x30354f=new Set();for(const {yamlConfig:_0x2462b1,folderPath:_0x387730}of _0x2fa8b8){_0x30354f[_0x12dd5b(0x148)](_0x387730+':'+_0x2462b1['name']);}return _0x4cbb52[_0x12dd5b(0x152)](_0x350942=>{const _0x5cbd65=_0x12dd5b,_0x3f2f8d=_0x350942[_0x5cbd65(0x1a8)]?_0x3587dc[_0x5cbd65(0xf0)](_0x350942[_0x5cbd65(0x1a8)][_0x5cbd65(0xec)]())||'':'',_0x248e30=_0x3f2f8d+':'+_0x350942[_0x5cbd65(0x119)];if(_0x30354f[_0x5cbd65(0x154)](_0x248e30))return![];if(_0x482c55)return _0x3f2f8d===_0x477226||_0x3f2f8d[_0x5cbd65(0x1ba)](_0x477226+'/');return!![];});}export function findJourneysToDelete(_0x1e02b5,_0x57f2e5,_0x145aba,_0x5230f1,_0x579b1f){const _0x3e6ba3=a127_0x489499,_0x59b92a=new Set();for(const {yamlConfig:_0x4ef208,folderPath:_0x2f4f4d}of _0x57f2e5){_0x59b92a[_0x3e6ba3(0x148)](_0x2f4f4d+':'+_0x4ef208['name']);}return _0x1e02b5[_0x3e6ba3(0x152)](_0x491113=>{const _0x3ce61f=_0x3e6ba3,_0x229a9f=_0x491113['folderId']?_0x145aba[_0x3ce61f(0xf0)](_0x491113[_0x3ce61f(0x1bd)])||'':'',_0x4a26b7=_0x229a9f+':'+_0x491113['journeyBundleName'];if(_0x59b92a[_0x3ce61f(0x154)](_0x4a26b7))return![];if(_0x579b1f)return _0x229a9f===_0x5230f1||_0x229a9f['startsWith'](_0x5230f1+'/');return!![];});}export function buildSegmentLookupMap(_0x290f97,_0x25def2){const _0x34d566=a127_0x489499,_0xd6f060=new Map();for(const _0x26c13b of _0x290f97){const _0x6854d3=_0x26c13b[_0x34d566(0x1a8)]?_0x25def2[_0x34d566(0xf0)](_0x26c13b['segmentFolderId'][_0x34d566(0xec)]())||'':'',_0x39581d=_0x6854d3+':'+_0x26c13b[_0x34d566(0x119)];_0xd6f060['set'](_0x39581d,_0x26c13b);}return _0xd6f060;}export function buildSegmentNameToIdMap(_0x2d16f3){const _0x45b632=new Map();for(const _0x170389 of _0x2d16f3){_0x45b632['set'](_0x170389['name'],_0x170389['id']);}return _0x45b632;}export function buildJourneyBundleLookupMap(_0x157f45,_0xada763){const _0x8d79fa=a127_0x489499,_0x24e441=new Map();for(const _0x5e7c9b of _0x157f45){const _0x91f02b=_0x5e7c9b[_0x8d79fa(0x1bd)]?_0xada763['get'](_0x5e7c9b[_0x8d79fa(0x1bd)])||'':'',_0x1d01cf=_0x91f02b+':'+_0x5e7c9b[_0x8d79fa(0x12c)];!_0x24e441['has'](_0x1d01cf)&&_0x24e441[_0x8d79fa(0x19d)](_0x1d01cf,[]),_0x24e441[_0x8d79fa(0xf0)](_0x1d01cf)[_0x8d79fa(0x185)](_0x5e7c9b);}for(const _0x50751e of _0x24e441[_0x8d79fa(0x166)]()){_0x50751e['sort']((_0x5ade5a,_0x4ea42b)=>(_0x5ade5a['versionNumber']||0x0)-(_0x4ea42b[_0x8d79fa(0xcb)]||0x0));}return _0x24e441;}export function collectFoldersToCreate(_0x5d42d1,_0x492c0b){const _0x4fbfcb=a127_0x489499,_0x10cdd2=new Set();for(const _0x4bba26 of _0x5d42d1){if(!_0x4bba26)continue;if(_0x492c0b[_0x4fbfcb(0x154)](_0x4bba26))continue;const _0x2ea6b2=_0x4bba26[_0x4fbfcb(0xf8)]('/');let _0x2b7fd5='';for(const _0x1fcab0 of _0x2ea6b2){_0x2b7fd5=_0x2b7fd5?_0x2b7fd5+'/'+_0x1fcab0:_0x1fcab0,!_0x492c0b[_0x4fbfcb(0x154)](_0x2b7fd5)&&_0x10cdd2['add'](_0x2b7fd5);}}return _0x10cdd2;}export function parseAndClassifyYamlFiles(_0x208385,_0x1ff580,_0x35437b){const _0x163540=a127_0x489499,_0xc1fbf=[],_0x42b91d=[];for(const _0x24ab0b of _0x208385){const _0x5cc20c=a127_0x2d5ff4[_0x163540(0x149)](_0x1ff580,a127_0x2d5ff4['dirname'](_0x24ab0b)),_0xe32678=_0x5cc20c==='.'?'':_0x5cc20c,_0x1fa932=readFileSync(_0x24ab0b,_0x163540(0x163)),_0x33ab78=a127_0x1c2ffd['parse'](_0x1fa932);if(isJourneyDef(_0x33ab78)){const _0x1bb3b4=a127_0x1cfff2(_0x1fa932);_0x42b91d[_0x163540(0x185)]({'yamlConfig':_0x1bb3b4,'folderPath':_0xe32678,'sourcePath':_0x24ab0b});}else{if(!_0x35437b?.['skipSegments']){const _0x2317c7=parseSegmentYamlFile(_0x1fa932),_0x269f6b=normalizeChildSegmentYaml(_0x2317c7);_0xc1fbf[_0x163540(0x185)]({'yamlConfig':_0x269f6b,'folderPath':_0xe32678,'sourcePath':_0x24ab0b});}}}return{'segments':_0xc1fbf,'journeys':_0x42b91d};}export function validateParsedFiles(_0x1da8c4,_0x1c73d1){const _0x33b6ea=a127_0x489499,_0x3f14df=[];for(const {yamlConfig:_0x3f43bb,sourcePath:_0x418645}of _0x1da8c4[_0x33b6ea(0xf7)]){const _0x5c2b58=readFileSync(_0x418645,_0x33b6ea(0x163)),_0x301061=a127_0x1c2ffd[_0x33b6ea(0x13a)](_0x5c2b58),_0x465ad6=validateSegmentDef(_0x3f43bb,{'source':_0x5c2b58,'document':_0x301061});if(!_0x465ad6['valid']){const _0x355442=a127_0x2d5ff4['relative'](_0x1c73d1,_0x418645);_0x3f14df[_0x33b6ea(0x185)]({'filePath':_0x355442,'source':_0x5c2b58,'result':_0x465ad6,'isJourney':![]});}}for(const {yamlConfig:_0x344379,sourcePath:_0x2afc41}of _0x1da8c4[_0x33b6ea(0x113)]){const _0x4609ac=readFileSync(_0x2afc41,_0x33b6ea(0x163)),_0x86997f=a127_0x1c2ffd['parseDocument'](_0x4609ac),_0x5c2918=validateJourneyDef(_0x344379,{'source':_0x4609ac,'document':_0x86997f});if(!_0x5c2918['valid']){const _0x3e1786=a127_0x2d5ff4[_0x33b6ea(0x149)](_0x1c73d1,_0x2afc41);_0x3f14df[_0x33b6ea(0x185)]({'filePath':_0x3e1786,'source':_0x4609ac,'result':_0x5c2918,'isJourney':!![]});}}return _0x3f14df;}export function formatValidationErrors(_0x21e792){const _0x8d2299=a127_0x489499,_0x1bf4b5=[];for(const {filePath:_0x1772b8,source:_0x2c6b3a,result:_0x3dbe6b,isJourney:_0x234302}of _0x21e792){const _0x4f9755=_0x234302?_0x8d2299(0xce):'segment';_0x1bf4b5[_0x8d2299(0x185)]('\x0a'+_0x1772b8+'\x20('+_0x4f9755+_0x8d2299(0xcd)+_0x3dbe6b[_0x8d2299(0x17a)][_0x8d2299(0x173)]+_0x8d2299(0x111)),_0x1bf4b5[_0x8d2299(0x185)](formatValidationResult(_0x3dbe6b,_0x2c6b3a,_0x1772b8));}return _0x1bf4b5['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x54e063){const _0x43adb8=a127_0x489499,_0x481208=new Set(),_0x2f9d2b=new Map(),_0x492ddc=collectSegmentUsageCounts(_0x54e063);if(_0x54e063['segments'])for(const [_0x5041eb,_0x276349]of Object['entries'](_0x54e063['segments'])){_0x481208[_0x43adb8(0x148)](_0x5041eb);if(_0x276349[_0x43adb8(0x10b)]){const _0x4a568f=yamlRuleToApi(_0x276349['rule']),_0x13aae0=apiRuleToYaml(_0x4a568f);_0x2f9d2b[_0x43adb8(0x19d)](_0x5041eb,_0x13aae0);}}const _0x5a63b1=new Map();let _0x43ff92=0x0;for(const [_0x949131,_0x4fa67c]of _0x2f9d2b){const _0x3db61a=serializeExpandedRule(_0x4fa67c,_0x2f9d2b),_0x55d089=_0x5a63b1['get'](_0x3db61a)||[];_0x55d089[_0x43adb8(0x185)]({'name':_0x949131,'index':_0x43ff92}),_0x5a63b1['set'](_0x3db61a,_0x55d089),_0x43ff92++;}const _0x46ae20=new Map();for(const [_0x441cca,_0x3ccd7e]of _0x5a63b1){const _0x37eed4=_0x3ccd7e[_0x43adb8(0x198)]()[_0x43adb8(0x100)]((_0xbbdfd3,_0x3c118e)=>{const _0x4f58f8=_0x43adb8,_0x4c93be=_0x492ddc[_0x4f58f8(0xf0)](_0xbbdfd3[_0x4f58f8(0x119)])||0x0,_0x52aeb4=_0x492ddc[_0x4f58f8(0xf0)](_0x3c118e['name'])||0x0;if(_0x4c93be!==_0x52aeb4)return _0x52aeb4-_0x4c93be;return _0xbbdfd3[_0x4f58f8(0x14f)]-_0x3c118e['index'];})[_0x43adb8(0x158)](_0x586c86=>_0x586c86[_0x43adb8(0x119)]),_0x1d1a1e=[];for(const _0x252ce5 of _0x37eed4){const _0x3e7ce1=_0x492ddc[_0x43adb8(0xf0)](_0x252ce5)||0x0,_0x215c18=Math[_0x43adb8(0x14d)](_0x3e7ce1,0x1);for(let _0x352387=0x0;_0x352387<_0x215c18;_0x352387++){_0x1d1a1e[_0x43adb8(0x185)](_0x252ce5);}}_0x46ae20[_0x43adb8(0x19d)](_0x441cca,_0x1d1a1e);}return{'existingLocalSegmentNames':_0x481208,'localSegmentRules':_0x2f9d2b,'localExpandedRuleToNames':_0x46ae20};}export function createSegmentIdResolver(_0x17e33f,_0x2bcc63){return async _0x6dca22=>{const _0x2ae897=a127_0x3f67,_0x1120b8=_0x17e33f[_0x2ae897(0xf0)](_0x6dca22);if(!_0x1120b8)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2ae897(0x1b5)+_0x6dca22+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x2bcc63+'\x27)');return _0x1120b8;};}export function extractRootFolderId(_0x4fd5de){const _0x541518=a127_0x489499;return _0x4fd5de['relationships']?.[_0x541518(0x18f)]?.[_0x541518(0x150)]?.['id']||_0x4fd5de[_0x541518(0x132)]?.['parentFolder']?.['data']?.['id'];}export function buildConnectionMaps(_0x36c9d5){const _0x5a7671=a127_0x489499,_0x51080d=new Map(),_0x2fc45d=new Map(),_0x1eb02b=new Map();for(const _0x3274b2 of _0x36c9d5){_0x51080d[_0x5a7671(0x19d)](_0x3274b2[_0x5a7671(0x119)],parseInt(_0x3274b2['id'],0xa)),_0x2fc45d[_0x5a7671(0x19d)](_0x3274b2['id'],_0x3274b2[_0x5a7671(0x119)]),_0x1eb02b['set'](_0x3274b2[_0x5a7671(0x119)],_0x3274b2['type']);}return{'nameToId':_0x51080d,'idToName':_0x2fc45d,'nameToType':_0x1eb02b};}export function calculatePushStats(_0x1d6a5c,_0x5eca63,_0x181788,_0x33e81e,_0x39528b,_0x5445b5,_0x4a7c56){const _0x5231e3=a127_0x489499,_0x3d0b5a=_0x1d6a5c[_0x5231e3(0x152)](_0x4f8fcb=>_0x4f8fcb[_0x5231e3(0x190)]),_0x11dc6d=_0x1d6a5c['filter'](_0x2ea3c5=>!_0x2ea3c5[_0x5231e3(0x190)]&&_0x2ea3c5[_0x5231e3(0x169)]),_0x17b93a=_0x1d6a5c[_0x5231e3(0x152)](_0x52cef6=>!_0x52cef6[_0x5231e3(0x190)]&&!_0x52cef6[_0x5231e3(0x169)]),_0x1e0f9a=_0x5445b5?_0x33e81e:[],_0x272c5b=_0x5eca63['filter'](_0x309668=>_0x309668[_0x5231e3(0x190)]),_0x156c7b=_0x5eca63['filter'](_0x54fe53=>!_0x54fe53['isNew']&&_0x54fe53[_0x5231e3(0x169)]),_0x111540=_0x5eca63[_0x5231e3(0x152)](_0xdfe8f4=>!_0xdfe8f4[_0x5231e3(0x190)]&&!_0xdfe8f4['hasChanges']),_0xbc2e02=_0x5445b5?_0x39528b:[],_0xd57823=_0x1d6a5c[_0x5231e3(0x1a6)](_0x209965=>_0x209965[_0x5231e3(0x13e)]),_0x2fc7e4=_0xd57823[_0x5231e3(0x152)](_0x28e303=>_0x28e303[_0x5231e3(0x14c)]==='create'),_0x414a9a=_0xd57823[_0x5231e3(0x152)](_0xf7d237=>_0xf7d237[_0x5231e3(0x14c)]===_0x5231e3(0x123)),_0x50198f=_0xd57823[_0x5231e3(0x152)](_0x3b96cb=>_0x3b96cb[_0x5231e3(0x14c)]===_0x5231e3(0xd4)),_0x153302=Array['from'](_0x181788)[_0x5231e3(0x100)](),_0xac3c97=_0x4a7c56?![]:_0x3d0b5a['length']>0x0||_0x11dc6d[_0x5231e3(0x173)]>0x0||_0x1e0f9a[_0x5231e3(0x173)]>0x0,_0x13e859=_0x272c5b[_0x5231e3(0x173)]>0x0||_0x156c7b['length']>0x0||_0xbc2e02[_0x5231e3(0x173)]>0x0,_0x59c4e4=_0x4a7c56?![]:_0xd57823[_0x5231e3(0x173)]>0x0,_0x1846e3=_0x153302[_0x5231e3(0x173)]>0x0;return{'segments':{'new':_0x3d0b5a,'changed':_0x11dc6d,'unchanged':_0x17b93a,'toDelete':_0x1e0f9a},'journeys':{'new':_0x272c5b,'changed':_0x156c7b,'unchanged':_0x111540,'toDelete':_0xbc2e02},'activations':{'all':_0xd57823,'toCreate':_0x2fc7e4,'toUpdate':_0x414a9a,'toDelete':_0x50198f},'folders':{'toCreate':_0x153302},'counts':{'segments':{'new':_0x3d0b5a[_0x5231e3(0x173)],'changed':_0x11dc6d[_0x5231e3(0x173)],'unchanged':_0x17b93a['length'],'toDelete':_0x1e0f9a[_0x5231e3(0x173)]},'journeys':{'new':_0x272c5b[_0x5231e3(0x173)],'changed':_0x156c7b['length'],'unchanged':_0x111540[_0x5231e3(0x173)],'toDelete':_0xbc2e02[_0x5231e3(0x173)]},'activations':{'create':_0x2fc7e4[_0x5231e3(0x173)],'update':_0x414a9a[_0x5231e3(0x173)],'delete':_0x50198f[_0x5231e3(0x173)]},'folders':_0x153302[_0x5231e3(0x173)]},'hasChanges':_0xac3c97||_0x13e859||_0x59c4e4||_0x1846e3};}export async function buildPushExecutionContext(_0x24e28a,_0x56b528,_0x16dfad,_0x164bf3,_0x1c47ec,_0x5963fb){const _0x881741=a127_0x489499,_0x504426=extractRootFolderId(_0x16dfad),{pathToId:_0x167802,idToPath:_0x3bbf2c}=buildFolderMaps(_0x1c47ec),_0x536cda=buildSegmentNameToIdMap(_0x164bf3),_0xd8b567=new Map(),{batchAsync:_0x25ef21}=await import('../../utils/async.js'),[_0x4f2329,_0x2ae6f3]=await Promise[_0x881741(0x195)]([_0x24e28a[_0x881741(0xf5)]['buildUserMaps'](),_0x24e28a[_0x881741(0x1bc)]['list'](),((async()=>{const _0x4eb7a9=_0x881741;!_0x5963fb&&_0x164bf3[_0x4eb7a9(0x173)]>0x0&&await _0x25ef21(_0x164bf3,async _0x1e898e=>{const _0x7500c2=_0x4eb7a9,_0x526602=await _0x24e28a[_0x7500c2(0x15e)][_0x7500c2(0x110)](_0x56b528,_0x1e898e['id']);_0xd8b567[_0x7500c2(0x19d)](_0x1e898e['id'],_0x526602);});})())]),{emailToId:_0x15f1d1,idToEmail:_0x544140}=_0x4f2329,_0x4756f2=buildConnectionMaps(_0x2ae6f3);return{'rootFolderId':_0x504426,'folderPathToId':_0x167802,'folderIdToPath':_0x3bbf2c,'segmentNameToId':_0x536cda,'activationsBySegmentId':_0xd8b567,'emailToIdMap':_0x15f1d1,'idToEmailMap':_0x544140,'connectionNameToIdMap':_0x4756f2[_0x881741(0x145)],'connectionIdToNameMap':_0x4756f2[_0x881741(0x14e)],'connectionNameToTypeMap':_0x4756f2[_0x881741(0x172)]};}export function createPushYamlContextForBundle(_0xa81fc2,_0x16d865,_0x56b339,_0x49b5c2,_0xdc44c0,_0x15758c,_0x58a340,_0x2955bb){const {existingLocalSegmentNames:_0x496be0,localExpandedRuleToNames:_0x42c6d8}=_0x49b5c2,_0x36397d=new Set(),_0x453aab=new Map(),_0x1b57f0=new Map(),_0x3fff0d=new Map(),_0x4729f1=createJumpTargetCache(),_0x2f9cad=new Map(),_0x594c55=new Map(),_0x3d56d0=new Set();let _0xa32f07;const _0x5ade76=_0x17ab2f=>{const _0x4ad904={'resolveSegment':async _0x2d0f4c=>{const _0x22775f=a127_0x3f67,_0xcf4572=_0x3fff0d['get'](_0x2d0f4c);if(_0xcf4572!==undefined)return{'name':_0xcf4572,'isJourneyLocal':!![]};try{const _0x1db2e4=await fetchSegment(_0xa81fc2,_0x16d865,_0x2d0f4c,_0x56b339);if(!_0x1db2e4)throw new Error('Segment\x20not\x20found');const _0x307467=generateJourneyLocalName(_0x1db2e4[_0x22775f(0x119)]),_0xbd9d35=_0x1db2e4[_0x22775f(0x1ae)]===SEGMENT_KIND_JOURNEY&&_0x307467!==undefined;let _0xa2229f=_0x1db2e4[_0x22775f(0x119)],_0x49f765;if(_0xbd9d35&&_0x1db2e4[_0x22775f(0x10b)]){const _0x593c14=apiRuleToYaml(_0x1db2e4[_0x22775f(0x10b)]);_0x594c55[_0x22775f(0x19d)](_0x2d0f4c,_0x593c14);const _0x4539c2=async _0x4916c5=>{const _0x367c9f=_0x22775f,_0x57ea61=collectSegmentRefsFromRule(_0x4916c5);for(const _0x25786c of _0x57ea61){if(!_0x594c55['has'](_0x25786c))try{const _0x3a903e=await fetchSegment(_0xa81fc2,_0x16d865,_0x25786c,_0x56b339);if(_0x3a903e?.['rule']){const _0x35afd6=apiRuleToYaml(_0x3a903e['rule']);_0x594c55[_0x367c9f(0x19d)](_0x25786c,_0x35afd6),await _0x4539c2(_0x35afd6);}}catch(_0x5b5f22){logger[_0x367c9f(0x1a7)](_0x367c9f(0x177)+_0x25786c+':\x20'+_0x5b5f22);}}};await _0x4539c2(_0x593c14);const _0x31bdde=serializeExpandedRule(_0x593c14,_0x594c55),_0x20aa31=_0x42c6d8[_0x22775f(0xf0)](_0x31bdde);if(_0x20aa31&&_0x20aa31[_0x22775f(0x173)]>0x0){const _0x506939=_0x453aab[_0x22775f(0xf0)](_0x31bdde)||0x0,_0x385331=_0x20aa31[_0x506939]||_0x20aa31[_0x20aa31[_0x22775f(0x173)]-0x1];_0x453aab[_0x22775f(0x19d)](_0x31bdde,_0x506939+0x1),_0xa2229f=_0x385331,_0x36397d[_0x22775f(0x148)](_0xa2229f),_0x3fff0d[_0x22775f(0x19d)](_0x2d0f4c,_0xa2229f);const _0x45c2fa=await resolveRuleSegmentRefs(_0x593c14,async _0x39f1a3=>{const _0xbdbb51=_0x22775f,_0x16f0f4=_0x3fff0d[_0xbdbb51(0xf0)](_0x39f1a3);if(_0x16f0f4)return _0x16f0f4;const _0x4d6356=await _0xa32f07[_0xbdbb51(0x10d)](_0x39f1a3);return _0x4d6356[_0xbdbb51(0x119)];});_0x49f765={'description':_0x1db2e4[_0x22775f(0x11b)],'rule':_0x45c2fa};}else{const _0x44eb31=_0x2f9cad[_0x22775f(0xf0)](_0x31bdde);if(_0x44eb31)_0xa2229f=_0x44eb31,_0x3fff0d[_0x22775f(0x19d)](_0x2d0f4c,_0xa2229f);else{if(_0x307467){let _0x5727ee=_0x307467,_0x3d3a85=0x2;while(_0x36397d[_0x22775f(0x154)](_0x5727ee)||_0x496be0[_0x22775f(0x154)](_0x5727ee)){_0x5727ee=_0x307467+'_'+_0x3d3a85,_0x3d3a85++;}_0x36397d[_0x22775f(0x148)](_0x5727ee),_0xa2229f=_0x5727ee;}_0x3fff0d[_0x22775f(0x19d)](_0x2d0f4c,_0xa2229f),_0x2f9cad[_0x22775f(0x19d)](_0x31bdde,_0xa2229f);const _0x3260b5=await resolveRuleSegmentRefs(_0x593c14,async _0x171716=>{const _0x1f8e82=_0x22775f,_0x12e00e=_0x3fff0d['get'](_0x171716);if(_0x12e00e)return _0x12e00e;const _0xf4e86d=await _0xa32f07[_0x1f8e82(0x10d)](_0x171716);return _0xf4e86d['name'];});_0x49f765={'description':_0x1db2e4[_0x22775f(0x11b)],'rule':_0x3260b5};}}}return{'name':_0xa2229f,'isJourneyLocal':_0xbd9d35,'definition':_0x49f765};}catch(_0x484588){return logger[_0x22775f(0x1a7)]('Failed\x20to\x20resolve\x20segment\x20'+_0x2d0f4c+':\x20'+_0x484588),{'name':_0x2d0f4c,'isJourneyLocal':![]};}},'resolveActivation':async _0x38e4ba=>{const _0xf1fa67=a127_0x3f67,_0x47d446=_0x1b57f0[_0xf1fa67(0xf0)](_0x38e4ba);if(_0x47d446!==undefined)return{'name':_0x47d446,'isJourneyLocal':!![]};try{let _0xb19899=_0x58a340?.[_0xf1fa67(0xf0)](_0x38e4ba);!_0xb19899&&(_0xb19899=await _0xa81fc2[_0xf1fa67(0xce)]['getActivation'](_0x17ab2f,_0x38e4ba));const _0x7f5710=_0xb19899['attributes'][_0xf1fa67(0x167)][_0xf1fa67(0x119)]||_0x38e4ba,_0x43c9a1=sanitizeYamlKey(_0x7f5710)||_0xf1fa67(0x1ac)+_0x38e4ba,_0x50266b=_0x43c9a1;_0x1b57f0[_0xf1fa67(0x19d)](_0x38e4ba,_0x50266b);const _0x390f90=journeyActivationStepToYaml(_0xb19899,_0xdc44c0,_0x15758c);return{'name':_0x50266b,'isJourneyLocal':!![],'definition':_0x390f90};}catch(_0x34ea48){return logger[_0xf1fa67(0x1a7)]('Failed\x20to\x20resolve\x20activation\x20'+_0x38e4ba+':\x20'+_0x34ea48),{'name':_0x38e4ba,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x455ea0,_0x4e5abc)=>resolveJumpTarget(_0x455ea0,_0x4e5abc,_0x4729f1,async _0x1fac99=>{const _0x46268f=a127_0x3f67,_0x36f5aa=_0x2955bb?.['get'](_0x1fac99);if(_0x36f5aa)return _0x36f5aa;return _0xa81fc2[_0x46268f(0xce)]['getJourney'](_0x1fac99);})};return _0xa32f07=_0x4ad904,_0x4ad904;},_0x5709dc=async _0x492bb6=>{const _0x496f9f=a127_0x3f67,{collectSegmentIdsFromJourneyApi:_0x212eed}=await import(_0x496f9f(0x192)),{batchAsync:_0x289d2e}=await import(_0x496f9f(0x12e)),_0x164b55=new Set();for(const _0x3e0a06 of _0x492bb6){let _0x55e41d=_0x2955bb?.['get'](_0x3e0a06);!_0x55e41d&&(_0x55e41d=await _0xa81fc2[_0x496f9f(0xce)][_0x496f9f(0x178)](_0x3e0a06));const _0x3c5a9d=_0x212eed(_0x55e41d);for(const _0x56fb94 of _0x3c5a9d){_0x164b55[_0x496f9f(0x148)](_0x56fb94);}}let _0x6ddde2=Array['from'](_0x164b55);while(_0x6ddde2[_0x496f9f(0x173)]>0x0){const _0x59b797=_0x6ddde2['filter'](_0x9c1cb5=>!_0x3d56d0[_0x496f9f(0x154)](_0x9c1cb5));if(_0x59b797['length']===0x0)break;const _0x2db036=await _0x289d2e(_0x59b797,async _0x45aebf=>{const _0x210b1f=_0x496f9f;_0x3d56d0[_0x210b1f(0x148)](_0x45aebf);const _0x412aae=await fetchSegment(_0xa81fc2,_0x16d865,_0x45aebf,_0x56b339);if(!_0x412aae)return null;return{'segmentId':_0x45aebf,'segment':_0x412aae};},0xa),_0x57036f=new Set();for(const _0x578222 of _0x2db036){if(!_0x578222?.[_0x496f9f(0x15e)]?.[_0x496f9f(0x10b)])continue;const _0x2278e2=apiRuleToYaml(_0x578222[_0x496f9f(0x15e)]['rule']);_0x594c55[_0x496f9f(0x19d)](_0x578222[_0x496f9f(0xfe)],_0x2278e2);const _0x131bbd=collectSegmentRefsFromRule(_0x2278e2);for(const _0x289bdf of _0x131bbd){!_0x3d56d0['has'](_0x289bdf)&&_0x57036f[_0x496f9f(0x148)](_0x289bdf);}}_0x6ddde2=Array[_0x496f9f(0x109)](_0x57036f);}};return{'createYamlContext':_0x5ade76,'prefetchJourneySegments':_0x5709dc};}export async function executePushSegments(_0x321904,_0x24f26c,_0x470b40,_0x247e01,_0x76249c){const _0x20000d=a127_0x489499,{segmentDefToCreateRequest:_0x187c2f,segmentDefToUpdateRequest:_0x2c5c73}=await import('./child-segment-yaml.js'),_0x56193e=_0x470b40[_0x20000d(0xc4)],_0x519414=0x5,_0x4b1559=async _0x411961=>{const _0x16e584=_0x20000d,_0x25429f=_0x411961['folderPath']?_0x56193e[_0x16e584(0xf0)](_0x411961['folderPath']):undefined;let _0x4be931;const _0x5a6397={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x411961['isNew']){_0x76249c[_0x16e584(0x14b)]?.({'type':_0x16e584(0xcc),'name':_0x411961[_0x16e584(0xff)][_0x16e584(0x119)]});const _0x2664ba=_0x187c2f(_0x411961[_0x16e584(0xff)],_0x25429f),_0x4af123=await _0x76249c[_0x16e584(0x199)](_0x16e584(0x12a)+_0x411961[_0x16e584(0xff)][_0x16e584(0x119)]+_0x16e584(0x11f),()=>_0x321904[_0x16e584(0x15e)][_0x16e584(0x103)](_0x247e01[_0x16e584(0x16d)],_0x2664ba));_0x4be931=_0x4af123[_0x16e584(0x150)]['id'],_0x5a6397[_0x16e584(0xc9)]={'name':_0x411961[_0x16e584(0xff)][_0x16e584(0x119)],'id':_0x4be931},_0x76249c[_0x16e584(0x14b)]?.({'type':_0x16e584(0xdb),'name':_0x411961[_0x16e584(0xff)][_0x16e584(0x119)],'segmentId':_0x4be931}),_0x76249c[_0x16e584(0x164)]?.(_0x16e584(0x17d)+_0x411961[_0x16e584(0xff)][_0x16e584(0x119)]+'\x27'),_0x5a6397[_0x16e584(0xfb)]=0x1;}else{if(_0x411961['hasChanges']){_0x76249c['onProgress']?.({'type':_0x16e584(0x15c),'name':_0x411961['yamlConfig'][_0x16e584(0x119)]});const _0x1f9d96=_0x2c5c73(_0x411961[_0x16e584(0xff)]);_0x25429f!==_0x411961[_0x16e584(0x184)]?.[_0x16e584(0x1a8)]&&(_0x1f9d96[_0x16e584(0x1a8)]=_0x25429f?parseInt(_0x25429f,0xa):undefined),await _0x76249c[_0x16e584(0x199)](_0x16e584(0x140)+_0x411961[_0x16e584(0xff)][_0x16e584(0x119)]+_0x16e584(0x11f),()=>_0x321904[_0x16e584(0x15e)]['updateSegmentById'](_0x247e01['parentId'],_0x411961['existingSegment']['id'],_0x1f9d96)),_0x4be931=_0x411961['existingSegment']['id'],_0x76249c[_0x16e584(0x14b)]?.({'type':_0x16e584(0x120),'name':_0x411961[_0x16e584(0xff)]['name']}),_0x76249c[_0x16e584(0x164)]?.('Updated\x20segment\x20\x27'+_0x411961['yamlConfig'][_0x16e584(0x119)]+'\x27'),_0x5a6397['updated']=0x1;}else _0x4be931=_0x411961[_0x16e584(0x184)]['id'];}}catch(_0x457364){const _0x3129a5=isHttp400Error(_0x457364),_0x2ce290=_0x3129a5?ErrorCode[_0x16e584(0xcf)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x5049d0=getErrorMessage(_0x457364);throw new SDKError(_0x2ce290,_0x16e584(0x142)+(_0x411961[_0x16e584(0x190)]?'create':_0x16e584(0x123))+'\x20segment\x20from\x20file:\x20'+_0x411961[_0x16e584(0x19a)]+'\x0a\x20\x20'+_0x5049d0,_0x457364);}try{const _0xb88176=await syncActivationsForSegment(_0x321904,_0x247e01[_0x16e584(0x16d)],_0x4be931,_0x411961[_0x16e584(0xff)][_0x16e584(0x119)],_0x411961['activationActions'],_0x76249c,_0x411961[_0x16e584(0x19a)]);_0x5a6397[_0x16e584(0xd6)]=_0xb88176;}catch(_0x49d64d){if(_0x49d64d instanceof SDKError)throw _0x49d64d;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x411961[_0x16e584(0xff)][_0x16e584(0x119)]+_0x16e584(0xf2)+_0x411961['absolutePath']+_0x16e584(0x10c)+getErrorMessage(_0x49d64d),_0x49d64d);}return _0x5a6397;},_0x5281d1=await batchAsync(_0x24f26c,_0x4b1559,_0x519414),_0x3147d8={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x325246 of _0x5281d1){_0x3147d8[_0x20000d(0xfb)]+=_0x325246[_0x20000d(0xfb)],_0x3147d8[_0x20000d(0x112)]+=_0x325246['updated'],_0x325246[_0x20000d(0xc9)]&&_0x3147d8[_0x20000d(0x118)][_0x20000d(0x19d)](_0x325246[_0x20000d(0xc9)]['name'],_0x325246['createdSegmentId']['id']),_0x3147d8[_0x20000d(0xd6)]['created']+=_0x325246[_0x20000d(0xd6)][_0x20000d(0xfb)],_0x3147d8[_0x20000d(0xd6)][_0x20000d(0x112)]+=_0x325246[_0x20000d(0xd6)]['updated'],_0x3147d8[_0x20000d(0xd6)]['deleted']+=_0x325246[_0x20000d(0xd6)][_0x20000d(0x19c)];}return _0x3147d8;}async function syncActivationsForSegment(_0x38c1e3,_0x4cbfb8,_0x204bf4,_0x47147a,_0x511612,_0x373cef,_0x2047b3){const _0x6a8aa5=a127_0x489499,_0x3c52ab={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4d9408 of _0x511612){try{if(_0x4d9408[_0x6a8aa5(0x14c)]===_0x6a8aa5(0x131)&&_0x4d9408['validatedRequest'])_0x373cef[_0x6a8aa5(0x14b)]?.({'type':_0x6a8aa5(0xd5),'segmentName':_0x47147a,'activationName':_0x4d9408['name']}),await _0x373cef['withProgress'](_0x6a8aa5(0xd9)+_0x4d9408[_0x6a8aa5(0x119)]+_0x6a8aa5(0x11f),()=>_0x38c1e3[_0x6a8aa5(0x15e)]['createActivation'](_0x4cbfb8,_0x204bf4,_0x4d9408[_0x6a8aa5(0xde)])),_0x373cef[_0x6a8aa5(0x14b)]?.({'type':_0x6a8aa5(0x196),'segmentName':_0x47147a,'activationName':_0x4d9408[_0x6a8aa5(0x119)]}),_0x373cef[_0x6a8aa5(0x164)]?.('Created\x20activation\x20\x27'+_0x4d9408[_0x6a8aa5(0x119)]+'\x27'),_0x3c52ab['created']++;else{if(_0x4d9408[_0x6a8aa5(0x14c)]===_0x6a8aa5(0x123)&&_0x4d9408[_0x6a8aa5(0xde)]&&_0x4d9408[_0x6a8aa5(0xc5)])_0x373cef[_0x6a8aa5(0x14b)]?.({'type':'activation_updating','segmentName':_0x47147a,'activationName':_0x4d9408[_0x6a8aa5(0x119)]}),await _0x373cef[_0x6a8aa5(0x199)](_0x6a8aa5(0x161)+_0x4d9408[_0x6a8aa5(0x119)]+_0x6a8aa5(0x11f),()=>_0x38c1e3['segment']['updateActivation'](_0x4cbfb8,_0x204bf4,_0x4d9408['existingActivation']['id'],_0x4d9408[_0x6a8aa5(0xde)])),_0x373cef[_0x6a8aa5(0x14b)]?.({'type':'activation_updated','segmentName':_0x47147a,'activationName':_0x4d9408[_0x6a8aa5(0x119)]}),_0x373cef[_0x6a8aa5(0x164)]?.(_0x6a8aa5(0xd7)+_0x4d9408['name']+'\x27'),_0x3c52ab['updated']++;else _0x4d9408[_0x6a8aa5(0x14c)]==='delete'&&_0x4d9408[_0x6a8aa5(0xc5)]&&(_0x373cef['onProgress']?.({'type':'activation_deleting','segmentName':_0x47147a,'activationName':_0x4d9408[_0x6a8aa5(0x119)]}),await _0x373cef['withProgress']('Deleting\x20activation\x20\x27'+_0x4d9408[_0x6a8aa5(0x119)]+_0x6a8aa5(0x11f),()=>_0x38c1e3[_0x6a8aa5(0x15e)][_0x6a8aa5(0x17f)](_0x4cbfb8,_0x204bf4,_0x4d9408[_0x6a8aa5(0xc5)]['id'])),_0x373cef[_0x6a8aa5(0x14b)]?.({'type':_0x6a8aa5(0x1a2),'segmentName':_0x47147a,'activationName':_0x4d9408[_0x6a8aa5(0x119)]}),_0x373cef['logDeleted']?.(_0x6a8aa5(0x12d)+_0x4d9408[_0x6a8aa5(0x119)]+'\x27'),_0x3c52ab[_0x6a8aa5(0x19c)]++);}}catch(_0x13ff23){const _0x36b847=isHttp400Error(_0x13ff23),_0x3fa0a2=_0x36b847?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x6a8aa5(0x160)],_0x24cc83=getErrorMessage(_0x13ff23);throw new SDKError(_0x3fa0a2,_0x6a8aa5(0x142)+_0x4d9408[_0x6a8aa5(0x14c)]+_0x6a8aa5(0x16c)+_0x4d9408[_0x6a8aa5(0x119)]+_0x6a8aa5(0xf2)+_0x2047b3+_0x6a8aa5(0x10c)+_0x24cc83,_0x13ff23);}}return _0x3c52ab;}export async function executePushFolders(_0x2d55fa,_0x26c099,_0xd9ef87,_0x5070e6,_0x582908){const _0x187efd=a127_0x489499,_0x2e800c=new Map(_0xd9ef87),_0x47e9d3=sortFoldersByDepth(_0x26c099);for(const _0x3211b0 of _0x47e9d3){const _0x3be137=_0x3211b0[_0x187efd(0xf8)]('/'),_0x4e181b=_0x3be137[_0x3be137[_0x187efd(0x173)]-0x1],_0x49e109=_0x3be137[_0x187efd(0x198)](0x0,-0x1)[_0x187efd(0x125)]('/'),_0x19a93f=_0x2e800c[_0x187efd(0xf0)](_0x49e109);_0x582908[_0x187efd(0x14b)]?.({'type':_0x187efd(0x18e),'folder':_0x3211b0});const _0x3497ad={'name':_0x4e181b,'parentFolderId':_0x19a93f},_0x3d9081=await _0x582908[_0x187efd(0x199)](_0x187efd(0x16a)+_0x3211b0+_0x187efd(0x11f),()=>_0x2d55fa[_0x187efd(0x15e)]['createFolder'](_0x5070e6[_0x187efd(0x16d)],_0x3497ad));_0x2e800c[_0x187efd(0x19d)](_0x3211b0,_0x3d9081[_0x187efd(0x150)]['id']),_0x582908[_0x187efd(0x14b)]?.({'type':_0x187efd(0x1a3),'folder':_0x3211b0,'folderId':_0x3d9081[_0x187efd(0x150)]['id']}),_0x582908['logInfo']?.('Created\x20folder\x20\x27'+_0x3211b0+'\x27');}return _0x2e800c;}export async function executePushSegmentDeletions(_0x1d8fd5,_0x243db1,_0x5e5b25){const _0x4e5a23=a127_0x489499;if(_0x243db1[_0x4e5a23(0x173)]===0x0)return 0x0;const {batchAsync:_0x24dfce}=await import(_0x4e5a23(0x12e)),_0xd648e5=0x5,_0x497ae1=await _0x24dfce(_0x243db1,async _0x4a4cfa=>{const _0xdcc3ab=_0x4e5a23;return _0x5e5b25[_0xdcc3ab(0x14b)]?.({'type':'segment_deleting','name':_0x4a4cfa[_0xdcc3ab(0x119)]}),await _0x1d8fd5[_0xdcc3ab(0x15e)][_0xdcc3ab(0x133)](_0x4a4cfa['id']),_0x5e5b25[_0xdcc3ab(0x14b)]?.({'type':_0xdcc3ab(0x186),'name':_0x4a4cfa[_0xdcc3ab(0x119)]}),_0x5e5b25[_0xdcc3ab(0x162)]?.('Deleted\x20segment\x20\x27'+_0x4a4cfa['name']+'\x27'),0x1;},_0xd648e5);return _0x497ae1[_0x4e5a23(0x188)]((_0x545f10,_0x330761)=>_0x545f10+_0x330761,0x0);}export async function executePushJourneys(_0x416e5a,_0x267fd6,_0x5beef6,_0x17ba71,_0x3f2307){const _0x4b05ee=a127_0x489499,{journeyDefToRequest:_0x48e2a9}=await import(_0x4b05ee(0x192)),{activationDefToCreateRequest:_0xa51483,yamlRuleToApi:_0x569d64,validateSegmentRule:_0x14fa96}=await import('./child-segment-yaml.js'),_0x3118f2={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x138164=new Map(_0x5beef6[_0x4b05ee(0xe4)]),_0xe9a1ef=0x5;for(let _0x1437d0=0x0;_0x1437d0<_0x267fd6[_0x4b05ee(0x173)];_0x1437d0+=_0xe9a1ef){const _0x236d93=_0x267fd6['slice'](_0x1437d0,_0x1437d0+_0xe9a1ef),_0x353237=await Promise[_0x4b05ee(0x195)](_0x236d93[_0x4b05ee(0x158)](async _0x510dd1=>{const _0x548870=_0x4b05ee;if(!_0x510dd1[_0x548870(0x190)]&&!_0x510dd1[_0x548870(0x169)])return{'action':_0x548870(0xed),'name':_0x510dd1[_0x548870(0xff)][_0x548870(0x119)],'journeyId':_0x510dd1['existingJourney']?.['id']};const _0x40a7e0=_0x510dd1['folderPath']?_0x5beef6[_0x548870(0xc4)][_0x548870(0xf0)](_0x510dd1['folderPath']):undefined;_0x3f2307[_0x548870(0x14b)]?.({'type':_0x510dd1['isNew']?_0x548870(0x1aa):_0x548870(0xe7),'name':_0x510dd1[_0x548870(0xff)][_0x548870(0x119)]});try{const _0x80deba=await executeSingleJourneyPush(_0x416e5a,_0x510dd1,{..._0x5beef6,'segmentNameToId':_0x138164},{'parentId':_0x17ba71['parentId'],'rootFolderId':_0x17ba71[_0x548870(0xe9)],'folderId':_0x40a7e0,'verbose':_0x17ba71[_0x548870(0x18b)]},_0x3f2307,{'journeyDefToRequest':_0x48e2a9,'activationDefToCreateRequest':_0xa51483,'yamlRuleToApi':_0x569d64,'validateSegmentRule':_0x14fa96});for(const [_0x1d1c5c,_0x2958b9]of _0x80deba[_0x548870(0x18d)]){_0x138164[_0x548870(0x19d)](_0x1d1c5c,_0x2958b9),_0x3118f2[_0x548870(0x18d)]['set'](_0x1d1c5c,_0x2958b9);}if(_0x80deba['action']===_0x548870(0xfb))_0x3f2307[_0x548870(0x14b)]?.({'type':_0x548870(0xea),'name':_0x510dd1[_0x548870(0xff)][_0x548870(0x119)],'journeyId':_0x80deba['journeyId']}),_0x3f2307[_0x548870(0x164)]?.(_0x548870(0xd3)+_0x510dd1['yamlConfig'][_0x548870(0x119)]+'\x27'),_0x3118f2[_0x548870(0xfb)]++;else _0x80deba['action']===_0x548870(0x112)&&(_0x3f2307[_0x548870(0x14b)]?.({'type':'journey_updated','name':_0x510dd1[_0x548870(0xff)][_0x548870(0x119)]}),_0x3f2307['logSuccess']?.('Updated\x20journey\x20\x27'+_0x510dd1[_0x548870(0xff)][_0x548870(0x119)]+'\x27'),_0x3118f2[_0x548870(0x112)]++);return{'action':_0x80deba[_0x548870(0xd0)],'name':_0x510dd1[_0x548870(0xff)][_0x548870(0x119)],'journeyId':_0x80deba['journeyId']};}catch(_0x2a10da){const _0x5a99c1=isHttp400Error(_0x2a10da),_0x7ea110=_0x5a99c1?ErrorCode[_0x548870(0x1a4)]:ErrorCode[_0x548870(0x180)],_0x563e53=getErrorMessage(_0x2a10da);throw new SDKError(_0x7ea110,_0x548870(0x142)+(_0x510dd1['isNew']?_0x548870(0x131):_0x548870(0x123))+'\x20journey\x20from\x20file:\x20'+_0x510dd1[_0x548870(0x19a)]+_0x548870(0x10c)+_0x563e53,_0x2a10da);}}));_0x3118f2['results'][_0x4b05ee(0x185)](..._0x353237);}return _0x3118f2;}async function matchExistingJourneySegments(_0x50d82e,_0x111e4d,_0x473a1b,_0x40027d,_0x254cbf){const _0x430f76=a127_0x489499;if(!_0x111e4d[_0x430f76(0x17e)]||!_0x111e4d[_0x430f76(0xff)]['segments'])return;const _0x55d924=new Map(),_0x3fbfb8=new Set();for(const _0x2b1f88 of Object[_0x430f76(0xfa)](_0x111e4d[_0x430f76(0xff)]['segments'])){const _0x177074=generateDeterministicJourneySegmentName(_0x111e4d[_0x430f76(0xff)][_0x430f76(0x119)],_0x2b1f88);_0x55d924['set'](_0x177074,_0x2b1f88),_0x3fbfb8[_0x430f76(0x148)](_0x2b1f88);}const _0x35ef69=[],_0x395ff5=collectSegmentIdsFromJourneyApi(_0x111e4d[_0x430f76(0x17e)]);for(const _0x17bb49 of _0x395ff5){const _0x19216e=await fetchSegment(_0x50d82e,_0x473a1b,_0x17bb49,_0x40027d);if(!_0x19216e?.[_0x430f76(0x119)])continue;const _0x1a470e=_0x55d924[_0x430f76(0xf0)](_0x19216e['name']);_0x1a470e?(_0x254cbf[_0x430f76(0x19d)](_0x1a470e,_0x17bb49),_0x3fbfb8[_0x430f76(0xd4)](_0x1a470e)):_0x35ef69[_0x430f76(0x185)]({'id':_0x17bb49,'seg':_0x19216e});}if(_0x3fbfb8[_0x430f76(0xf9)]>0x0&&_0x35ef69[_0x430f76(0x173)]>0x0){const {localExpandedRuleToNames:_0x24c55c}=buildLocalExpandedRuleMappings(_0x111e4d[_0x430f76(0xff)]),_0x437c2e=new Map();for(const {id:_0x5c5427,seg:_0x23b93e}of _0x35ef69){if(_0x23b93e[_0x430f76(0x10b)]){const _0xa74868=apiRuleToYaml(_0x23b93e['rule']);_0x437c2e[_0x430f76(0x19d)](_0x5c5427,_0xa74868);}}for(const {id:_0x1198b3,seg:_0x2942fc}of _0x35ef69){if(!_0x2942fc[_0x430f76(0x10b)])continue;const _0x1f39f0=_0x437c2e[_0x430f76(0xf0)](_0x1198b3);if(!_0x1f39f0)continue;const _0x532b9e=serializeExpandedRule(_0x1f39f0,_0x437c2e),_0x2215ae=_0x24c55c[_0x430f76(0xf0)](_0x532b9e);if(_0x2215ae){const _0xbdaeb7=_0x2215ae[_0x430f76(0xfc)](_0x4e2e4b=>_0x3fbfb8['has'](_0x4e2e4b));_0xbdaeb7&&(_0x254cbf[_0x430f76(0x19d)](_0xbdaeb7,_0x1198b3),_0x3fbfb8[_0x430f76(0xd4)](_0xbdaeb7),logger[_0x430f76(0x1a7)]('Matched\x20server\x20segment\x20\x27'+_0x2942fc[_0x430f76(0x119)]+'\x27\x20to\x20local\x20\x27'+_0xbdaeb7+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x2bebac,_0x2abfd5,_0x10874f,_0x52ab72,_0x521821,_0x55006d){const _0xea4637=a127_0x489499,{journeyDefToRequest:_0x1661f4,activationDefToCreateRequest:_0x331483,yamlRuleToApi:_0x58186e,validateSegmentRule:_0x73586c}=_0x55006d,_0x12c313=new Map(),_0x201e7d=new Map();recoverSegmentIdsFromPushRecovery(_0x2abfd5,_0x12c313,_0x10874f['segmentNameToId']);const _0x31fc65=new Map(),_0x34f7cd=new Map(),_0x544950=new Map();let _0x245ffc;const _0x3d8d5d=async()=>{const _0x5318fd=a127_0x3f67;if(_0x245ffc)return;_0x245ffc=new Map();if(!_0x2abfd5[_0x5318fd(0x17e)])return;const _0x29fd35=await _0x2bebac[_0x5318fd(0xce)]['listActivations'](_0x2abfd5[_0x5318fd(0x17e)]['id']);for(const _0x198364 of _0x29fd35){const _0x4d5494=journeyActivationStepToYaml(_0x198364,_0x10874f['idToEmailMap'],_0x10874f[_0x5318fd(0xdd)]),_0x3f15af=activationSignature(_0x4d5494);!_0x245ffc[_0x5318fd(0x154)](_0x3f15af)&&_0x245ffc['set'](_0x3f15af,_0x198364['id']),_0x4d5494[_0x5318fd(0x119)]&&_0x201e7d[_0x5318fd(0x19d)](_0x4d5494['name'],_0x198364['id']);}};await matchExistingJourneySegments(_0x2bebac,_0x2abfd5,_0x52ab72[_0xea4637(0x16d)],_0x10874f[_0xea4637(0x171)],_0x10874f[_0xea4637(0xe4)]);const _0x1e06f8={'resolveSegmentId':async _0x3bc19f=>{const _0x389310=_0xea4637,_0xc9d8ef=_0x10874f[_0x389310(0xe4)]['get'](_0x3bc19f);if(!_0xc9d8ef)throw new SDKError(ErrorCode[_0x389310(0x17b)],_0x389310(0x1b5)+_0x3bc19f+_0x389310(0x176)+_0x2abfd5['yamlConfig'][_0x389310(0x119)]+')');return _0xc9d8ef;},'resolveEmbeddedSegmentId':async(_0x3ed9cf,_0x59c695)=>{const _0x59d071=_0xea4637,_0x7acb8c=_0x10874f[_0x59d071(0xe4)][_0x59d071(0xf0)](_0x3ed9cf);if(_0x7acb8c)return _0x7acb8c;const _0x3ef8b6=_0x10874f[_0x59d071(0x171)][_0x59d071(0xfc)](_0x2f7676=>_0x2f7676['name']===_0x3ed9cf);if(_0x3ef8b6)return _0x10874f[_0x59d071(0xe4)][_0x59d071(0x19d)](_0x3ed9cf,_0x3ef8b6['id']),_0x3ef8b6['id'];if(_0x2abfd5['isNew']){const {stageName:_0x30df44,criteriaName:_0x1992b5}=findSegmentCriteriaLocation(_0x2abfd5[_0x59d071(0xff)],_0x3ed9cf);return _0x73586c(_0x3ed9cf,_0x59c695[_0x59d071(0x10b)]),_0x34f7cd[_0x59d071(0x19d)](_0x3ed9cf,{'definition':_0x59c695,'stageName':_0x30df44,'criteriaName':_0x1992b5}),createPendingSegmentId(_0x3ed9cf);}const _0x4fd179=_0x2abfd5[_0x59d071(0x17e)]?.['id'];if(!_0x4fd179)throw new SDKError(ErrorCode[_0x59d071(0xf6)],_0x59d071(0x1b2));const _0x5ce079=_0x31fc65['get'](_0x3ed9cf);if(_0x5ce079)return _0x5ce079;const _0x2efe6f=((async()=>{const _0x69f9f1=_0x59d071;_0x73586c(_0x3ed9cf,_0x59c695[_0x69f9f1(0x10b)]);const _0x2ca484=generateDeterministicJourneySegmentName(_0x2abfd5[_0x69f9f1(0xff)][_0x69f9f1(0x119)],_0x3ed9cf),_0x6f1146=_0x10874f[_0x69f9f1(0x171)][_0x69f9f1(0xfc)](_0x9b420c=>_0x9b420c[_0x69f9f1(0x119)]===_0x2ca484),_0x3b6cb6=createSegmentIdResolver(_0x10874f[_0x69f9f1(0xe4)],_0x3ed9cf),_0x24db0f=await resolveRuleSegmentIds(_0x59c695[_0x69f9f1(0x10b)],_0x3b6cb6);let _0x4ca124;return _0x6f1146?(await _0x2bebac['segment'][_0x69f9f1(0x1b0)](_0x52ab72[_0x69f9f1(0x16d)],_0x6f1146['id'],{'description':_0x59c695[_0x69f9f1(0x11b)]||_0x69f9f1(0x135)+_0x3ed9cf,'rule':_0x58186e(_0x24db0f,!![]),'countPopulation':!![]}),_0x4ca124=_0x6f1146['id'],saveSegmentToPushRecovery(_0x2abfd5[_0x69f9f1(0x19a)],_0x2abfd5['yamlConfig'][_0x69f9f1(0x119)],_0x3ed9cf,{'segmentId':_0x4ca124,'uniqueServerName':_0x2ca484,'createdAt':new Date()[_0x69f9f1(0xe1)]()})):_0x4ca124=await createOrRecoverEmbeddedSegment(_0x2bebac,_0x2abfd5,{'localName':_0x3ed9cf,'uniqueSegmentName':_0x2ca484,'description':_0x59c695[_0x69f9f1(0x11b)]||_0x69f9f1(0x135)+_0x3ed9cf,'journeyId':_0x4fd179,'resolvedRule':_0x24db0f,'parentId':_0x52ab72['parentId'],'folderId':_0x52ab72['rootFolderId']||''},_0x58186e),_0x10874f[_0x69f9f1(0xe4)][_0x69f9f1(0x19d)](_0x3ed9cf,_0x4ca124),_0x12c313['set'](_0x3ed9cf,_0x4ca124),_0x4ca124;})());_0x31fc65[_0x59d071(0x19d)](_0x3ed9cf,_0x2efe6f);try{return await _0x2efe6f;}finally{_0x31fc65[_0x59d071(0xd4)](_0x3ed9cf);}},'resolveActivationId':async _0x2bd9ca=>{const _0x2b7e6b=_0xea4637,_0x37e29a=_0x201e7d[_0x2b7e6b(0xf0)](_0x2bd9ca);if(_0x37e29a)return _0x37e29a;if(_0x2abfd5[_0x2b7e6b(0x17e)]){await _0x3d8d5d();const _0x5dca34=_0x201e7d[_0x2b7e6b(0xf0)](_0x2bd9ca);if(_0x5dca34)return _0x5dca34;}throw new SDKError(ErrorCode[_0x2b7e6b(0x1b4)],'Activation\x20not\x20found:\x20'+_0x2bd9ca+_0x2b7e6b(0x176)+_0x2abfd5[_0x2b7e6b(0xff)][_0x2b7e6b(0x119)]+_0x2b7e6b(0x107)+_0x2b7e6b(0x165));},'resolveEmbeddedActivationId':async(_0x54eeac,_0x3f1c79)=>{const _0xa3d870=_0xea4637,_0x3eb4b6=_0x201e7d[_0xa3d870(0xf0)](_0x54eeac);if(_0x3eb4b6)return _0x3eb4b6;if(_0x2abfd5[_0xa3d870(0x190)])return _0x544950[_0xa3d870(0x19d)](_0x54eeac,_0x3f1c79),createPendingActivationId(_0x54eeac);if(_0x2abfd5['existingJourney']){await _0x3d8d5d();const _0xe7b066=_0x201e7d[_0xa3d870(0xf0)](_0x3f1c79[_0xa3d870(0x119)]);if(_0xe7b066)return _0x201e7d[_0xa3d870(0x19d)](_0x54eeac,_0xe7b066),_0xe7b066;const _0x253c79=activationSignature(_0x3f1c79),_0x26c8c7=_0x245ffc?.[_0xa3d870(0xf0)](_0x253c79);if(_0x26c8c7)return _0x201e7d[_0xa3d870(0x19d)](_0x54eeac,_0x26c8c7),_0x26c8c7;const _0x480f7e=await _0x331483(_0x3f1c79,_0x10874f[_0xa3d870(0x189)]),_0x599db6={..._0x480f7e,..._0x3f1c79[_0xa3d870(0x193)]!==undefined&&{'runAfterJourneyRefresh':_0x3f1c79['run_after_journey_refresh']}},_0x33dd86=await _0x2bebac[_0xa3d870(0xce)][_0xa3d870(0x10a)](_0x2abfd5[_0xa3d870(0x17e)]['id'],_0x599db6);return _0x201e7d[_0xa3d870(0x19d)](_0x54eeac,_0x33dd86['id']),_0x33dd86['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0xa3d870(0x153));},'resolveJourneyId':async _0x176433=>{const _0x2e4dd4=_0xea4637;try{return await _0x2bebac['journey'][_0x2e4dd4(0xee)](_0x52ab72[_0x2e4dd4(0x16d)],_0x176433);}catch(_0x3cd32c){throw new SDKError(ErrorCode[_0x2e4dd4(0x1b4)],_0x2e4dd4(0x129)+_0x176433+_0x2e4dd4(0x134)+_0x2abfd5['yamlConfig'][_0x2e4dd4(0x119)]+'\x27)',_0x3cd32c);}},'resolveStageId':async(_0x180d66,_0x480bbb)=>{const _0x2d5af1=_0xea4637,_0x20d60a=await _0x2bebac[_0x2d5af1(0xce)][_0x2d5af1(0x178)](_0x180d66),_0x2aec05=_0x20d60a[_0x2d5af1(0x1ad)][_0x2d5af1(0x127)]['find'](_0x4e8070=>_0x4e8070['name'][_0x2d5af1(0x170)]()===_0x480bbb[_0x2d5af1(0x170)]());if(!_0x2aec05?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x480bbb+_0x2d5af1(0x1b6)+(_0x20d60a[_0x2d5af1(0x1ad)][_0x2d5af1(0x12c)]||_0x20d60a[_0x2d5af1(0x1ad)][_0x2d5af1(0x119)])+'\x27');return _0x2aec05['id'];}},_0x5dd501=await _0x1661f4(_0x2abfd5['yamlConfig'],_0x52ab72[_0xea4637(0x16d)],_0x1e06f8),_0x4c4abe=_0x52ab72[_0xea4637(0x1bd)]||_0x52ab72[_0xea4637(0xe9)];_0x4c4abe&&(_0x5dd501[_0xea4637(0x132)]={'parentFolder':{'data':{'id':_0x4c4abe,'type':'folder'}}});if(_0x2abfd5[_0xea4637(0x190)]){if(_0x34f7cd[_0xea4637(0xf9)]>0x0||_0x544950['size']>0x0)return await executeThreeStepJourneyCreate(_0x2bebac,_0x2abfd5,_0x5dd501,{'pendingEmbeddedSegments':_0x34f7cd,'pendingEmbeddedActivations':_0x544950,'embeddedSegmentNameToId':_0x12c313,'journeyActivationNameToId':_0x201e7d},{..._0x52ab72,'effectiveFolderId':_0x4c4abe},_0x10874f,_0x521821,_0x55006d);else{ensureJourneyDefaults(_0x5dd501['attributes']);const _0x1a1ebd=await _0x2bebac[_0xea4637(0xce)][_0xea4637(0x131)](_0x5dd501);return deletePushRecovery(_0x2abfd5[_0xea4637(0x19a)]),{'action':_0xea4637(0xfb),'journeyId':_0x1a1ebd['id'],'embeddedSegmentNameToId':_0x12c313};}}else{if(_0x2abfd5[_0xea4637(0x169)]&&_0x2abfd5['existingJourney']){_0x5dd501['id']=_0x2abfd5[_0xea4637(0x17e)]['id'];const _0x59fe1a=_0x5dd501[_0xea4637(0x1ad)];_0x2abfd5['existingJourney'][_0xea4637(0x1ad)]?.[_0xea4637(0x12c)]&&(_0x59fe1a['journeyBundleName']=_0x2abfd5[_0xea4637(0x17e)][_0xea4637(0x1ad)]['journeyBundleName']);const _0x1decd6=_0x2abfd5[_0xea4637(0x17e)][_0xea4637(0x1ad)]?.[_0xea4637(0x127)];return _0x1decd6&&_0x5dd501[_0xea4637(0x1ad)][_0xea4637(0x127)]&&injectExistingStageIds(_0x5dd501[_0xea4637(0x1ad)][_0xea4637(0x127)],_0x1decd6),ensureJourneyDefaults(_0x59fe1a),await _0x2bebac[_0xea4637(0xce)][_0xea4637(0x123)](_0x2abfd5[_0xea4637(0x17e)]['id'],_0x5dd501),deletePushRecovery(_0x2abfd5[_0xea4637(0x19a)]),{'action':_0xea4637(0x112),'journeyId':_0x2abfd5[_0xea4637(0x17e)]['id'],'embeddedSegmentNameToId':_0x12c313};}}return deletePushRecovery(_0x2abfd5[_0xea4637(0x19a)]),{'action':_0xea4637(0xed),'journeyId':_0x2abfd5['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x12c313};}function findSegmentCriteriaLocation(_0x1af976,_0x29ec95){const _0x33d529=a127_0x489499,_0x5da2a3=_0x1af976[_0x33d529(0x124)]||_0x1af976[_0x33d529(0x113)]?.[0x0]?.[_0x33d529(0x124)]||[];let _0x57836e=_0x33d529(0xd2),_0x1e3f86=_0x29ec95;const _0x4fb025=_0x1af976[_0x33d529(0x114)]||_0x1af976[_0x33d529(0x113)]?.[0x0]?.[_0x33d529(0x114)];if(_0x4fb025?.[_0x33d529(0x15e)]===_0x29ec95)return{'stageName':'goal','criteriaName':_0x4fb025[_0x33d529(0x119)]||_0x29ec95};_0x2f2340:for(const _0x1585bb of _0x5da2a3){if(_0x1585bb[_0x33d529(0x1bb)]?.['segment']===_0x29ec95){_0x57836e=_0x1585bb[_0x33d529(0x119)],_0x1e3f86=_0x1585bb[_0x33d529(0x1bb)][_0x33d529(0x119)]||_0x29ec95;break;}if(_0x1585bb[_0x33d529(0x18c)])for(const _0xcb7612 of _0x1585bb[_0x33d529(0x18c)]){if(_0xcb7612[_0x33d529(0x14c)]===_0x33d529(0x194)&&_0xcb7612['with']?.[_0x33d529(0x1b9)])for(const _0x456369 of _0xcb7612[_0x33d529(0x1b7)][_0x33d529(0x1b9)]){if(_0x456369[_0x33d529(0x15e)]===_0x29ec95){_0x57836e=_0x1585bb[_0x33d529(0x119)],_0x1e3f86=_0x456369[_0x33d529(0x119)]||_0x29ec95;break _0x2f2340;}}}}return{'stageName':_0x57836e,'criteriaName':_0x1e3f86};}async function executeThreeStepJourneyCreate(_0x45e4b9,_0x129a5f,_0x58674f,_0x7cc8d7,_0x361cfa,_0x51a685,_0x2037f0,_0x4a82ba){const _0x355c87=a127_0x489499,{activationDefToCreateRequest:_0x43db33,yamlRuleToApi:_0xee69e8}=_0x4a82ba,{pendingEmbeddedSegments:_0xb77445,pendingEmbeddedActivations:_0x9daeb7,embeddedSegmentNameToId:_0x134647}=_0x7cc8d7,_0x16fa91=JSON[_0x355c87(0xe6)](JSON[_0x355c87(0x1b1)](_0x58674f));ensureJourneyDefaults(_0x16fa91[_0x355c87(0x1ad)]),stripPendingIds(_0x16fa91);const _0x55bbf8=await _0x45e4b9[_0x355c87(0xce)]['create'](_0x16fa91),_0x3407ec=_0x55bbf8['id'],_0x49ff44=new Map();for(const _0x3f58e0 of _0x55bbf8['attributes']['journeyStages']){_0x49ff44[_0x355c87(0x19d)](_0x3f58e0[_0x355c87(0x119)][_0x355c87(0x170)](),_0x3f58e0['id']);}recoverSegmentIdsFromPushRecovery(_0x129a5f,_0x134647,_0x51a685[_0x355c87(0xe4)]);for(const [_0x2a7329,{definition:_0x12ea40}]of _0xb77445){if(_0x134647[_0x355c87(0x154)](_0x2a7329)){_0x2037f0[_0x355c87(0x14b)]?.({'type':_0x355c87(0x1a5),'journeyName':_0x129a5f['yamlConfig'][_0x355c87(0x119)],'segmentName':_0x2a7329});continue;}const _0x40c2f9=generateDeterministicJourneySegmentName(_0x129a5f['yamlConfig'][_0x355c87(0x119)],_0x2a7329);_0x2037f0[_0x355c87(0x14b)]?.({'type':_0x355c87(0x19e),'journeyName':_0x129a5f[_0x355c87(0xff)][_0x355c87(0x119)],'segmentName':_0x2a7329});const _0x3a8511=createSegmentIdResolver(_0x51a685[_0x355c87(0xe4)],_0x2a7329),_0x129900=await resolveRuleSegmentIds(_0x12ea40['rule'],_0x3a8511),_0x399dcf=await createOrRecoverEmbeddedSegment(_0x45e4b9,_0x129a5f,{'localName':_0x2a7329,'uniqueSegmentName':_0x40c2f9,'description':_0x12ea40['description']||'Entry\x20criteria:\x20'+_0x2a7329,'journeyId':_0x3407ec,'resolvedRule':_0x129900,'parentId':_0x361cfa[_0x355c87(0x16d)],'folderId':_0x361cfa[_0x355c87(0x138)]||''},_0xee69e8);_0x134647[_0x355c87(0x19d)](_0x2a7329,_0x399dcf),_0x51a685[_0x355c87(0xe4)]['set'](_0x2a7329,_0x399dcf),_0x2037f0[_0x355c87(0x14b)]?.({'type':_0x355c87(0x1a5),'journeyName':_0x129a5f[_0x355c87(0xff)][_0x355c87(0x119)],'segmentName':_0x2a7329});}const _0x1fa11c=new Map();for(const [_0x5d140e,_0x49f4ce]of _0x9daeb7){_0x2037f0['onProgress']?.({'type':_0x355c87(0x104),'journeyName':_0x129a5f[_0x355c87(0xff)]['name'],'activationName':_0x5d140e});const _0x19a7bc=await _0x43db33(_0x49f4ce,_0x51a685['activationContext']),_0x420ab2={..._0x19a7bc,..._0x49f4ce[_0x355c87(0x193)]!==undefined&&{'runAfterJourneyRefresh':_0x49f4ce[_0x355c87(0x193)]}},_0x26e223=await _0x45e4b9['journey']['createActivation'](_0x3407ec,_0x420ab2);_0x1fa11c[_0x355c87(0x19d)](_0x5d140e,_0x26e223['id']),_0x7cc8d7[_0x355c87(0x151)][_0x355c87(0x19d)](_0x5d140e,_0x26e223['id']),_0x2037f0[_0x355c87(0x14b)]?.({'type':'embedded_activation_created','journeyName':_0x129a5f[_0x355c87(0xff)]['name'],'activationName':_0x5d140e});}const _0x3747cc=JSON[_0x355c87(0xe6)](JSON['stringify'](_0x58674f));return _0x3747cc['id']=_0x3407ec,ensureJourneyDefaults(_0x3747cc['attributes']),resolvePendingIdsInRequest(_0x3747cc,_0x58674f,_0x49ff44,_0x134647,_0x1fa11c,_0x2037f0),await _0x45e4b9[_0x355c87(0xce)][_0x355c87(0x123)](_0x3407ec,_0x3747cc),deletePushRecovery(_0x129a5f[_0x355c87(0x19a)]),{'action':'created','journeyId':_0x3407ec,'embeddedSegmentNameToId':_0x134647};}export function stripWaitStepPendingIds(_0x573def){const _0xf5cdd9=a127_0x489499,_0x318ad8=_0x573def[_0xf5cdd9(0xdf)]&&isPendingSegmentId(_0x573def[_0xf5cdd9(0xdf)]),_0x645fb7=_0x573def[_0xf5cdd9(0x18a)]?.[_0xf5cdd9(0x179)](_0x366905=>_0x366905[_0xf5cdd9(0xfe)]&&isPendingSegmentId(_0x366905[_0xf5cdd9(0xfe)]));(_0x318ad8||_0x645fb7)&&(_0x573def[_0xf5cdd9(0x10f)]=_0xf5cdd9(0x11e),_0x573def[_0xf5cdd9(0xf1)]=0x1,_0x573def['waitStepUnit']=_0xf5cdd9(0xe2),delete _0x573def[_0xf5cdd9(0xdf)],delete _0x573def[_0xf5cdd9(0x117)],delete _0x573def[_0xf5cdd9(0x10e)],delete _0x573def[_0xf5cdd9(0x18a)]);}export function resolveWaitStepPendingIds(_0x5b8466,_0x20bfb4,_0x32a5c3,_0xab900){const _0x58f518=a127_0x489499;if(_0x20bfb4[_0x58f518(0xdf)]&&isPendingSegmentId(_0x20bfb4[_0x58f518(0xdf)])){const _0x48b328=_0x32a5c3(_0x20bfb4['conditionSegmentId'],_0x58f518(0x187)+_0xab900+_0x58f518(0x1b8));_0x48b328&&(_0x5b8466[_0x58f518(0x10f)]=_0x58f518(0x1b3),_0x5b8466[_0x58f518(0xdf)]=_0x48b328,delete _0x5b8466[_0x58f518(0xf1)],delete _0x5b8466[_0x58f518(0xe5)],_0x20bfb4[_0x58f518(0x117)]!==undefined&&(_0x5b8466[_0x58f518(0x117)]=_0x20bfb4[_0x58f518(0x117)]),_0x20bfb4['conditionTimeoutUnit']&&(_0x5b8466[_0x58f518(0x10e)]=_0x20bfb4[_0x58f518(0x10e)]));}if(_0x20bfb4[_0x58f518(0x18a)]){const _0x4ab159=_0x20bfb4[_0x58f518(0x18a)][_0x58f518(0x179)](_0x99f2c9=>_0x99f2c9[_0x58f518(0xfe)]&&isPendingSegmentId(_0x99f2c9[_0x58f518(0xfe)]));if(_0x4ab159){const _0xc2abee=_0x20bfb4['conditions'][_0x58f518(0x158)](_0x1596ac=>{const _0x3a270a=_0x58f518;if(_0x1596ac['segmentId']&&isPendingSegmentId(_0x1596ac['segmentId'])){const _0x5a5a98=_0x32a5c3(_0x1596ac[_0x3a270a(0xfe)],_0x3a270a(0x187)+_0xab900+_0x3a270a(0x1b8));return{..._0x1596ac,'segmentId':_0x5a5a98||_0x1596ac[_0x3a270a(0xfe)]};}return{..._0x1596ac};});_0x5b8466[_0x58f518(0x10f)]=_0x58f518(0x1b3),_0x5b8466['conditions']=_0xc2abee,delete _0x5b8466[_0x58f518(0xf1)],delete _0x5b8466[_0x58f518(0xe5)],delete _0x5b8466['conditionSegmentId'],delete _0x5b8466[_0x58f518(0x117)],delete _0x5b8466['conditionTimeoutUnit'];}}}function stripPendingIds(_0x5ca362){const _0x3262be=a127_0x489499;_0x5ca362['attributes'][_0x3262be(0x114)]?.[_0x3262be(0xfe)]&&isPendingSegmentId(_0x5ca362[_0x3262be(0x1ad)][_0x3262be(0x114)]['segmentId'])&&delete _0x5ca362['attributes']['goal'];for(const _0x503b50 of _0x5ca362[_0x3262be(0x1ad)][_0x3262be(0x127)]||[]){_0x503b50['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x503b50['entryCriteria'][_0x3262be(0xfe)])&&delete _0x503b50[_0x3262be(0xf3)];_0x503b50[_0x3262be(0x139)]?.[_0x3262be(0xfe)]&&isPendingSegmentId(_0x503b50[_0x3262be(0x139)][_0x3262be(0xfe)])&&delete _0x503b50[_0x3262be(0x139)];_0x503b50[_0x3262be(0xc8)]&&(_0x503b50[_0x3262be(0xc8)]=_0x503b50['exitCriterias'][_0x3262be(0x152)](_0x237ed3=>!_0x237ed3[_0x3262be(0xfe)]||!isPendingSegmentId(_0x237ed3['segmentId'])));if(_0x503b50[_0x3262be(0x18c)])for(const _0x43e540 of Object[_0x3262be(0xfa)](_0x503b50[_0x3262be(0x18c)])){const _0xf420fa=_0x503b50[_0x3262be(0x18c)][_0x43e540];_0xf420fa[_0x3262be(0x14c)]==='Activation'&&_0xf420fa[_0x3262be(0x157)]&&isPendingActivationId(_0xf420fa['journeyActivationStepId'])&&(_0xf420fa['journeyActivationStepId']='');if(_0xf420fa[_0x3262be(0x14c)]===_0x3262be(0xfd)&&_0xf420fa[_0x3262be(0x1b9)])for(const _0x4972bb of _0xf420fa['branches']){_0x4972bb['segmentId']&&isPendingSegmentId(_0x4972bb[_0x3262be(0xfe)])&&(_0x4972bb[_0x3262be(0xfe)]='');}_0xf420fa['type']===_0x3262be(0x128)&&stripWaitStepPendingIds(_0xf420fa);}}}function resolvePendingIdsInRequest(_0x499e06,_0x3176c4,_0x519f19,_0x2ea2f5,_0x4dfbe3,_0x181657){const _0x39cd8d=a127_0x489499,_0x510dc5=(_0xd3c0cf,_0x2e75a6)=>{const _0x338dd9=a127_0x3f67;if(!isPendingSegmentId(_0xd3c0cf))return _0xd3c0cf;const _0x1eb301=extractPendingSegmentName(_0xd3c0cf),_0x3f0189=_0x2ea2f5[_0x338dd9(0xf0)](_0x1eb301);return!_0x3f0189&&_0x181657[_0x338dd9(0x159)]?.(_0x338dd9(0x11c)+_0x1eb301+_0x338dd9(0x1a9)+_0x2e75a6),_0x3f0189;};if(_0x499e06[_0x39cd8d(0x1ad)]['goal']?.['segmentId']&&isPendingSegmentId(_0x499e06[_0x39cd8d(0x1ad)][_0x39cd8d(0x114)][_0x39cd8d(0xfe)])){const _0x20b437=_0x510dc5(_0x499e06['attributes'][_0x39cd8d(0x114)][_0x39cd8d(0xfe)],_0x39cd8d(0x11d));_0x20b437&&(_0x499e06[_0x39cd8d(0x1ad)]['goal'][_0x39cd8d(0xfe)]=_0x20b437);}for(const _0x4f731c of _0x499e06[_0x39cd8d(0x1ad)]['journeyStages']||[]){const _0x144d9f=_0x519f19[_0x39cd8d(0xf0)](_0x4f731c[_0x39cd8d(0x119)][_0x39cd8d(0x170)]());_0x144d9f&&(_0x4f731c['id']=_0x144d9f);if(_0x4f731c[_0x39cd8d(0xf3)]?.[_0x39cd8d(0xfe)]&&isPendingSegmentId(_0x4f731c[_0x39cd8d(0xf3)][_0x39cd8d(0xfe)])){const _0x113ccd=_0x510dc5(_0x4f731c['entryCriteria'][_0x39cd8d(0xfe)],'stage\x20\x27'+_0x4f731c[_0x39cd8d(0x119)]+_0x39cd8d(0xda));_0x113ccd&&(_0x4f731c[_0x39cd8d(0xf3)][_0x39cd8d(0xfe)]=_0x113ccd);}if(_0x4f731c['exitCriterias'])for(const _0x5573b7 of _0x4f731c[_0x39cd8d(0xc8)]){if(_0x5573b7[_0x39cd8d(0xfe)]&&isPendingSegmentId(_0x5573b7[_0x39cd8d(0xfe)])){const _0x2df5a8=_0x510dc5(_0x5573b7[_0x39cd8d(0xfe)],_0x39cd8d(0x187)+_0x4f731c[_0x39cd8d(0x119)]+'\x27\x20exit\x20criteria');_0x2df5a8&&(_0x5573b7[_0x39cd8d(0xfe)]=_0x2df5a8);}}if(_0x4f731c[_0x39cd8d(0x139)]?.[_0x39cd8d(0xfe)]&&isPendingSegmentId(_0x4f731c['milestone'][_0x39cd8d(0xfe)])){const _0x21b46c=_0x510dc5(_0x4f731c['milestone']['segmentId'],_0x39cd8d(0x187)+_0x4f731c[_0x39cd8d(0x119)]+_0x39cd8d(0x183));_0x21b46c&&(_0x4f731c[_0x39cd8d(0x139)]['segmentId']=_0x21b46c);}if(_0x4f731c[_0x39cd8d(0x18c)]){const _0x1f6222=_0x39ccf5=>_0x3176c4['attributes'][_0x39cd8d(0x127)]?.['find'](_0x25052e=>_0x25052e['name'][_0x39cd8d(0x170)]()===_0x4f731c['name'][_0x39cd8d(0x170)]())?.['steps']?.[_0x39ccf5];for(const _0x56977c of Object[_0x39cd8d(0xfa)](_0x4f731c[_0x39cd8d(0x18c)])){const _0x5b8f77=_0x4f731c[_0x39cd8d(0x18c)][_0x56977c],_0x2ef5fd=_0x1f6222(_0x56977c);if(_0x5b8f77[_0x39cd8d(0x14c)]===_0x39cd8d(0x12f)&&_0x5b8f77[_0x39cd8d(0x157)]&&(isPendingActivationId(_0x5b8f77[_0x39cd8d(0x157)])||_0x5b8f77[_0x39cd8d(0x157)]==='')){if(_0x2ef5fd?.[_0x39cd8d(0x157)]&&isPendingActivationId(_0x2ef5fd[_0x39cd8d(0x157)])){const _0x1bb958=extractPendingActivationName(_0x2ef5fd['journeyActivationStepId']),_0x16a412=_0x4dfbe3[_0x39cd8d(0xf0)](_0x1bb958);_0x16a412&&(_0x5b8f77[_0x39cd8d(0x157)]=_0x16a412);}}if(_0x5b8f77[_0x39cd8d(0x14c)]===_0x39cd8d(0xfd)&&_0x5b8f77[_0x39cd8d(0x1b9)]&&_0x2ef5fd?.[_0x39cd8d(0x1b9)])for(let _0x36f9f5=0x0;_0x36f9f5<_0x5b8f77[_0x39cd8d(0x1b9)][_0x39cd8d(0x173)];_0x36f9f5++){const _0x2ffc2e=_0x5b8f77[_0x39cd8d(0x1b9)][_0x36f9f5],_0x252a4e=_0x2ef5fd['branches'][_0x36f9f5];if(_0x252a4e?.[_0x39cd8d(0xfe)]&&isPendingSegmentId(_0x252a4e[_0x39cd8d(0xfe)])){const _0x10d846=_0x510dc5(_0x252a4e[_0x39cd8d(0xfe)],_0x39cd8d(0x187)+_0x4f731c['name']+_0x39cd8d(0x15b)+(_0x2ffc2e[_0x39cd8d(0x119)]||_0x36f9f5)+'\x27');_0x10d846&&(_0x2ffc2e['segmentId']=_0x10d846);}}_0x5b8f77['type']===_0x39cd8d(0x128)&&_0x2ef5fd?.[_0x39cd8d(0x14c)]===_0x39cd8d(0x128)&&resolveWaitStepPendingIds(_0x5b8f77,_0x2ef5fd,_0x510dc5,_0x4f731c[_0x39cd8d(0x119)]);}}}}
1
+ const a127_0x30a7e2=a127_0x39cb;(function(_0x48a4be,_0x89ec74){const _0x116790=a127_0x39cb,_0x5e01c6=_0x48a4be();while(!![]){try{const _0x4e0708=parseInt(_0x116790(0x1c1))/0x1*(-parseInt(_0x116790(0x1ff))/0x2)+parseInt(_0x116790(0x215))/0x3+-parseInt(_0x116790(0x223))/0x4*(-parseInt(_0x116790(0x22e))/0x5)+-parseInt(_0x116790(0x209))/0x6*(-parseInt(_0x116790(0x1d9))/0x7)+-parseInt(_0x116790(0x1db))/0x8+parseInt(_0x116790(0x246))/0x9+-parseInt(_0x116790(0x250))/0xa*(parseInt(_0x116790(0x26d))/0xb);if(_0x4e0708===_0x89ec74)break;else _0x5e01c6['push'](_0x5e01c6['shift']());}catch(_0x1f2fae){_0x5e01c6['push'](_0x5e01c6['shift']());}}}(a127_0x3221,0xd8965));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a127_0x30a7e2(0x204));export const PENDING_SEGMENT_PREFIX=a127_0x30a7e2(0x1a1);export const PENDING_ACTIVATION_PREFIX=a127_0x30a7e2(0x226);export function createPendingSegmentId(_0x2cec1c){return''+PENDING_SEGMENT_PREFIX+_0x2cec1c+'__';}export function isPendingSegmentId(_0x1d2b83){const _0x1874b4=a127_0x30a7e2;return _0x1d2b83[_0x1874b4(0x1e5)](PENDING_SEGMENT_PREFIX)&&!_0x1d2b83[_0x1874b4(0x1e5)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3019b3){return _0x3019b3['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x47a590){return''+PENDING_ACTIVATION_PREFIX+_0x47a590+'__';}export function isPendingActivationId(_0x5a735c){return _0x5a735c['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x592ac3){return _0x592ac3['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4a5d3e,_0x2d2796){const _0x5d4a56=a127_0x30a7e2,_0x3a6d85=_0x4a5d3e+'::'+(_0x2d2796[_0x5d4a56(0x264)]()||_0x5d4a56(0x21a)),_0x53288d=createHash(_0x5d4a56(0x262))['update'](_0x3a6d85)['digest'](_0x5d4a56(0x1a6))[_0x5d4a56(0x203)](0x0,0xc);return _0x5d4a56(0x213)+_0x53288d;}export function ensureJourneyDefaults(_0x14a073){const _0x4ca2bd=a127_0x30a7e2;!_0x14a073['description']&&(_0x14a073[_0x4ca2bd(0x269)]=''),!_0x14a073[_0x4ca2bd(0x1fb)]&&(_0x14a073['state']=_0x4ca2bd(0x197));}export function injectExistingStageIds(_0x4166a3,_0x52e4b5){const _0x22e20c=a127_0x30a7e2,_0x1ca36c=new Map(_0x52e4b5[_0x22e20c(0x1b5)](_0x586efc=>[_0x586efc['name'],_0x586efc['id']]));for(const _0x16d45b of _0x4166a3){if(!_0x16d45b['id']){const _0x296bd7=_0x1ca36c[_0x22e20c(0x22f)](_0x16d45b[_0x22e20c(0x1f4)]);_0x296bd7&&(_0x16d45b['id']=_0x296bd7);}}}export function resolveTDFolderPath(_0x290afe,_0x891d3d,_0x2062ff){if(!_0x891d3d)return _0x290afe;if(_0x290afe===_0x2062ff||_0x290afe['startsWith'](_0x2062ff+'/'))return _0x290afe;return _0x290afe?_0x2062ff+'/'+_0x290afe:_0x2062ff;}export function addFoldersToCreate(_0x1153d3,_0x191e03,_0x1d6f86){const _0x28b39f=a127_0x30a7e2;if(!_0x1153d3)return;if(_0x191e03[_0x28b39f(0x1ed)](_0x1153d3))return;const _0x13faa5=_0x1153d3[_0x28b39f(0x1cd)]('/');let _0x47ce89='';for(const _0x1fab88 of _0x13faa5){_0x47ce89=_0x47ce89?_0x47ce89+'/'+_0x1fab88:_0x1fab88,!_0x191e03[_0x28b39f(0x1ed)](_0x47ce89)&&_0x1d6f86[_0x28b39f(0x17b)](_0x47ce89);}}export function sortFoldersByDepth(_0xfe182){return[..._0xfe182]['sort']((_0x257e6a,_0x515e87)=>{const _0x59281b=a127_0x39cb,_0x2e7e82=(_0x257e6a[_0x59281b(0x1f0)](/\//g)||[])[_0x59281b(0x21e)],_0x4f2dbe=(_0x515e87[_0x59281b(0x1f0)](/\//g)||[])['length'];return _0x2e7e82-_0x4f2dbe;});}import*as a127_0x548b31 from'yaml';function a127_0x3221(){const _0x320dc8=['from','trim','stages','localName','SEGMENT_UPDATE_ERROR','run_after_journey_refresh','description','segmentNameToId','getActivation','\x20activation\x20\x27','11251757LPHQcP','uniqueSegmentName','data','WaitStep','schedule','Updating\x20segment\x20\x27','entry_criteria','./child-segment-yaml.js','):\x20','includes','Updating\x20activation\x20\x27','waitStepUnit','idToName','ACTIVATION_UPDATE_ERROR','Fetching\x20','resolveJourneyId','toString','activationParams','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','createSegment','logWarning','validatedRequest','goal\x20criteria','add','conditions','push','Deleted\x20segment\x20\x27','max','rootFolderId','Delete\x20the\x20push\x20recovery\x20file\x20(','embeddedSegmentNameToId','.$1.push-recovery.json','Entry\x20criteria:\x20','diff','verbose','some','and\x20the\x20server\x20segment,\x20then\x20retry.','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','\x27...','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createdSegmentId','absolutePath','all','sort','activations','size','Deleted\x20activation\x20\x27','yamlConfig','folder','hasChanges','\x0a\x20\x20','draft','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','toLowerCase','uniqueServerName','progress','Matched\x20server\x20segment\x20\x27','journeyActivationNameToId','withProgress','Condition','goal','__pending_','versionNumber','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x27\x20by\x20rule\x20content','Updated\x20journey\x20\x27','hex','relative','journey_creating','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','Updated\x20segment\x20\x27','segmentFolderId','update','all_columns',').\x20','parentId','DecisionPoint','folderPath','Activation\x20not\x20found:\x20','getSegment','createActivation','map','join','\x20journey\x20from\x20file:\x20','Creating\x20folder\x20\x27','message','\x27\x20from\x20file:\x20','dirname','\x27\x20wait\x20condition','deleteActivation','\x20segment\x20from\x20file:\x20','yamlActivation','folderPathToId','9rDgtYP','replace','Creating\x20segment\x20\x27','folderId','activation_creating','Duration','segment_created','attributes','branches','activation_template_id','getSegmentEntity','Deleting\x20activation\x20\x27','split','steps','embedded_segment_created','Failed\x20to\x20','\x20(referenced\x20in\x20journey\x20','object','journey_updating','waitStep','list','null','listActivations','type','142562EVJGrT','buildUserMaps','13730472rGkAxh','onProgress','SEGMENT_NOT_FOUND','index','conditionSegmentId','INTERNAL','rule','journeyBundleName','filter','activation_created','startsWith','folder_creating','ACTIVATION_SYNTAX_ERROR','createFolder','Failed\x20to\x20resolve\x20segment\x20','\x27\x20entry\x20criteria','Failed\x20to\x20fetch\x20referenced\x20segment\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','has','segments','\x20error(s)','match','conditionTimeoutUnit','activationsBySegmentId','conditionTimeoutDuration','name','connectionIdToNameMap','embedded_activation_creating','createdSegmentIds','parentSegmentFolder','set','Stage\x20\x27','state','segment_creating','debug','Segment\x20not\x20found:\x20','42962NAmIPR','\x27\x20milestone','existingJourney','entryCriteria','slice','tdx.sdk.push-workflow','journeyActivationStepId','connection','valid','skipSegments','390Moavul','decision_point','stage\x20\x27','deps','Created\x20folder\x20\x27','embedded_activation_created','segment_deleted','parse','Updated\x20activation\x20\x27','idToEmailMap','journey_entry_criteria_','flatMap','1990275isasGr','exitCriterias','JOURNEY_SYNTAX_ERROR','isNew','activationActions','segment','existingActivation','notification','kind','length','JOURNEY_UPDATE_ERROR','action','activation_deleted','toISOString','2142164hWHNJG','journey_updated','delete','__pending_act_','columns','stringify','journeyStages','activation_updated','embedded_segment_creating','unchanged','NOT_FOUND','5rIIaOz','get','Created\x20segment\x20\x27','create','activation_updating','existingSegments','find','waitStepType','logSuccess','keys','parseDocument','relationships','entries','milestone','logInfo','resolveSegment','\x27\x20exit\x20criteria','user','segmentId','journeys','segment_deleting','getJourney','activationContext','nameToType','11672190OzrHJO','logDeleted','Activation','journeyBundlesByFolderAndName','journey','updateSegmentById','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','getSegmentEntity\x20also\x20failed\x20for\x20','createJourneySegment','behavior','10BLyGqI',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','deleted','Creating\x20activation\x20\x27','resolvedRule','journeyId','activation_deleting','values','getSegment\x20failed\x20for\x20','journeyName','reduce','\x27\x20to\x20local\x20\x27','created','connector_config','updated','existingSegment','utf-8','journey_created','sha1'];a127_0x3221=function(){return _0x320dc8;};return a127_0x3221();}import{readFileSync}from'fs';import a127_0x4631af from'path';import{isJourneyDef,parseYamlString as a127_0x4f7de1,toYamlString as a127_0x359c72,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';function a127_0x39cb(_0x33a217,_0x317e10){_0x33a217=_0x33a217-0x172;const _0x322129=a127_0x3221();let _0x39cb3c=_0x322129[_0x33a217];return _0x39cb3c;}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(_0x2ccda1){const _0x46a4be=a127_0x30a7e2;if(Array['isArray'](_0x2ccda1))return'['+_0x2ccda1['map'](_0x1f5b8e=>stableStringify(_0x1f5b8e))['join'](',')+']';if(_0x2ccda1&&typeof _0x2ccda1===_0x46a4be(0x1d2)){const _0x16ec7f=_0x2ccda1,_0x18c493=Object['keys'](_0x16ec7f)[_0x46a4be(0x18f)](),_0x34393a=_0x18c493['map'](_0x5ce848=>'\x22'+_0x5ce848+'\x22:'+stableStringify(_0x16ec7f[_0x5ce848]));return'{'+_0x34393a[_0x46a4be(0x1b6)](',')+'}';}const _0x32b152=JSON[_0x46a4be(0x228)](_0x2ccda1);return _0x32b152===undefined?_0x46a4be(0x1d6):_0x32b152;}function activationSignature(_0x3a847e){const _0x3f6045=a127_0x30a7e2,_0x375235={'connection':_0x3a847e[_0x3f6045(0x206)],..._0x3a847e[_0x3f6045(0x1ad)]!==undefined&&{'all_columns':_0x3a847e[_0x3f6045(0x1ad)]},..._0x3a847e[_0x3f6045(0x227)]!==undefined&&{'columns':_0x3a847e[_0x3f6045(0x227)]},..._0x3a847e[_0x3f6045(0x24f)]!==undefined&&{'behavior':_0x3a847e[_0x3f6045(0x24f)]},..._0x3a847e[_0x3f6045(0x271)]!==undefined&&{'schedule':_0x3a847e[_0x3f6045(0x271)]},..._0x3a847e['notification']!==undefined&&{'notification':_0x3a847e[_0x3f6045(0x21c)]},..._0x3a847e[_0x3f6045(0x25d)]!==undefined&&{'connector_config':_0x3a847e['connector_config']},..._0x3a847e[_0x3f6045(0x1ca)]!==undefined&&{'activation_template_id':_0x3a847e[_0x3f6045(0x1ca)]}};return stableStringify(_0x375235);}async function fetchSegment(_0x36311e,_0x2ee6e1,_0x4562b1,_0x3012f9){const _0x220084=a127_0x30a7e2,_0x4215f1=_0x3012f9?.[_0x220084(0x234)](_0x1e42be=>_0x1e42be['id']===_0x4562b1);if(_0x4215f1)return _0x4215f1;try{return await _0x36311e['segment'][_0x220084(0x1b3)](_0x2ee6e1,_0x4562b1);}catch(_0x464cd5){logger['debug'](_0x220084(0x258)+_0x4562b1+_0x220084(0x251)+_0x464cd5);try{return await _0x36311e[_0x220084(0x21a)][_0x220084(0x1cb)](_0x4562b1);}catch(_0x16dd6d){return logger['debug'](_0x220084(0x24d)+_0x4562b1+':\x20'+_0x16dd6d),null;}}}function recoverSegmentIdsFromPushRecovery(_0x361fa0,_0x8e9a5d,_0x2b82dc){const _0x9c950f=a127_0x30a7e2,_0x4550fe=readPushRecovery(_0x361fa0['absolutePath']);if(_0x4550fe?.[_0x9c950f(0x259)]===_0x361fa0[_0x9c950f(0x193)][_0x9c950f(0x1f4)])for(const [_0x55678b,_0x70aee0]of Object[_0x9c950f(0x23a)](_0x4550fe[_0x9c950f(0x1ee)])){const _0x522e40=generateDeterministicJourneySegmentName(_0x361fa0[_0x9c950f(0x193)][_0x9c950f(0x1f4)],_0x55678b);_0x70aee0[_0x9c950f(0x19a)]===_0x522e40&&(_0x8e9a5d[_0x9c950f(0x1f9)](_0x55678b,_0x70aee0[_0x9c950f(0x240)]),_0x2b82dc[_0x9c950f(0x1f9)](_0x55678b,_0x70aee0[_0x9c950f(0x240)]));}}async function createOrRecoverEmbeddedSegment(_0x1e4bc9,_0x297dfa,_0x466243,_0x293a23){const _0x4812ff=a127_0x30a7e2;let _0xe17550;try{_0xe17550=await _0x1e4bc9['segment'][_0x4812ff(0x24e)]({'name':_0x466243[_0x4812ff(0x26e)],'description':_0x466243['description'],'journeyId':_0x466243[_0x4812ff(0x255)],'rule':_0x293a23(_0x466243[_0x4812ff(0x254)],!![]),'countPopulation':!![],'parentFolderId':_0x466243['folderId'],'audienceId':_0x466243[_0x4812ff(0x1af)]});}catch(_0xb9ba05){const _0x3f5f59=_0xb9ba05 instanceof Error&&_0xb9ba05[_0x4812ff(0x1b9)][_0x4812ff(0x276)]('Name\x20has\x20already\x20been\x20taken');if(_0x3f5f59){const _0x27b5b5=readPushRecovery(_0x297dfa[_0x4812ff(0x18d)]),_0x430326=_0x27b5b5?.[_0x4812ff(0x259)]===_0x297dfa['yamlConfig'][_0x4812ff(0x1f4)]?_0x27b5b5['segments'][_0x466243[_0x4812ff(0x266)]]:undefined;if(_0x430326?.[_0x4812ff(0x19a)]===_0x466243[_0x4812ff(0x26e)])await _0x1e4bc9['segment'][_0x4812ff(0x24b)](_0x466243['parentId'],_0x430326['segmentId'],{'description':_0x466243[_0x4812ff(0x269)],'rule':_0x293a23(_0x466243[_0x4812ff(0x254)],!![]),'countPopulation':!![]}),_0xe17550=_0x430326[_0x4812ff(0x240)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x466243[_0x4812ff(0x266)]+_0x4812ff(0x176)+(_0x4812ff(0x181)+_0x297dfa['absolutePath'][_0x4812ff(0x1c2)](/([^/]+)$/,_0x4812ff(0x183))+')\x20')+_0x4812ff(0x188),_0xb9ba05);}else throw _0xb9ba05;}return saveSegmentToPushRecovery(_0x297dfa['absolutePath'],_0x297dfa[_0x4812ff(0x193)][_0x4812ff(0x1f4)],_0x466243[_0x4812ff(0x266)],{'segmentId':_0xe17550,'uniqueServerName':_0x466243[_0x4812ff(0x26e)],'createdAt':new Date()[_0x4812ff(0x222)]()}),_0xe17550;}export async function prepareSegmentFiles(_0x3b2ced,_0x17ba43,_0x1de68a,_0x319b56,_0x292deb){const _0x11f974=a127_0x30a7e2,{activationDefToCreateRequest:_0x50cafd}=await import(_0x11f974(0x274)),_0xf1f06e=[],_0x4d5c88=new Set();for(const {yamlConfig:_0x394d7c,folderPath:_0x4216a0,sourcePath:_0x3e5c99}of _0x3b2ced){const _0x47c853=resolveTDFolderPath(_0x4216a0,_0x319b56,_0x292deb),_0x36b8d4=_0x47c853+':'+_0x394d7c['name'],_0x50a83f=_0x17ba43['segmentByFolderAndName'][_0x11f974(0x22f)](_0x36b8d4),_0xb82068=_0x50a83f?_0x17ba43[_0x11f974(0x1f2)][_0x11f974(0x22f)](_0x50a83f['id'])||[]:[];addFoldersToCreate(_0x47c853,_0x17ba43[_0x11f974(0x1c0)],_0x4d5c88);const _0x5d1c96=calculateActivationActions(_0x394d7c[_0x11f974(0x190)]||[],_0xb82068,_0x17ba43[_0x11f974(0x212)],_0x17ba43['connectionIdToNameMap']);for(const _0x1aa446 of _0x5d1c96){(_0x1aa446[_0x11f974(0x1d8)]==='create'||_0x1aa446[_0x11f974(0x1d8)]==='update')&&_0x1aa446[_0x11f974(0x1bf)]&&(_0x1aa446[_0x11f974(0x179)]=await _0x50cafd(_0x1aa446[_0x11f974(0x1bf)],_0x1de68a));}const _0x49e409=calculateSegmentDiff(_0x394d7c,_0x50a83f,_0xb82068,_0x17ba43[_0x11f974(0x212)],_0x17ba43[_0x11f974(0x1f5)]);_0xf1f06e['push']({'relativePath':_0x394d7c[_0x11f974(0x1f4)],'absolutePath':_0x3e5c99,'yamlConfig':_0x394d7c,'folderPath':_0x47c853,'existingSegment':_0x50a83f,'existingActivations':_0xb82068,'isNew':_0x49e409[_0x11f974(0x218)],'hasChanges':_0x49e409[_0x11f974(0x195)],'diff':_0x49e409[_0x11f974(0x185)],'activationActions':_0x5d1c96});}return{'segmentFiles':_0xf1f06e,'foldersToCreate':_0x4d5c88};}export async function prepareJourneyFiles(_0x246712,_0x54bf64,_0x24d2bb,_0x3175ce){const _0x12d0a2=a127_0x30a7e2,_0x50d29d=[],_0x4bd780=new Set();for(const {yamlConfig:_0x51d242,folderPath:_0x11be00,sourcePath:_0x32f376}of _0x246712){const _0x1be942=resolveTDFolderPath(_0x11be00,_0x24d2bb,_0x3175ce),_0x327590=_0x1be942+':'+_0x51d242[_0x12d0a2(0x1f4)],_0x1b76c8=_0x54bf64[_0x12d0a2(0x249)]['get'](_0x327590);let _0x1093f7,_0x307006;if(_0x1b76c8&&_0x1b76c8[_0x12d0a2(0x21e)]>0x0){const _0x48f773=buildLocalExpandedRuleMappings(_0x51d242),{createYamlContext:_0x25eaf0,prefetchJourneySegments:_0x1e5e0f}=createPushYamlContextForBundle(_0x54bf64[_0x12d0a2(0x20c)],_0x54bf64[_0x12d0a2(0x1af)],_0x54bf64[_0x12d0a2(0x233)],_0x48f773,_0x54bf64[_0x12d0a2(0x212)],_0x54bf64['connectionIdToNameMap'],_0x54bf64['activationStepsById'],_0x54bf64['journeyById']);await _0x1e5e0f(_0x1b76c8['map'](_0xaa7a1b=>_0xaa7a1b['id']));const _0x1e483d=hasMultipleVersions(_0x51d242),_0x784f9=async _0x2be7f8=>{const _0x52333a=_0x12d0a2,_0x299851=_0x54bf64['journeyById']?.[_0x52333a(0x22f)](_0x2be7f8);if(_0x299851)return _0x299851;return _0x54bf64['fetchJourney']({'journeyId':_0x2be7f8,'journeyName':_0x51d242[_0x52333a(0x1f4)],'isMultiVersion':_0x1b76c8['length']>0x1});};if(_0x1e483d&&_0x1b76c8['length']>0x1){const _0x22dfee=[];for(const _0x1da302 of _0x1b76c8){const _0x198a29=_0x1da302[_0x12d0a2(0x1a2)]||0x1;_0x54bf64[_0x12d0a2(0x19b)]?.[_0x12d0a2(0x1ac)](_0x12d0a2(0x172)+_0x51d242['name']+'\x20v'+_0x198a29);const _0x29f360=await _0x784f9(_0x1da302['id']),_0x421eb0=_0x25eaf0(_0x1da302['id']),_0x3a43dd=await journeyResponseToDef(_0x29f360,_0x421eb0);_0x22dfee['push']({'item':_0x1da302,'yaml':_0x3a43dd});}const _0x275a90=buildLocalRuleToNameMappingFromJourney(_0x51d242);_0x307006=buildMergedJourneyDef(_0x22dfee,_0x275a90);const _0x34aa8c=Math[_0x12d0a2(0x17f)](..._0x22dfee['map'](_0x29880c=>_0x29880c['item'][_0x12d0a2(0x1a2)]||0x0)),_0x308294=_0x1b76c8[_0x12d0a2(0x234)](_0x251f4a=>(_0x251f4a[_0x12d0a2(0x1a2)]||0x0)===_0x34aa8c);_0x308294&&(_0x54bf64[_0x12d0a2(0x19b)]?.[_0x12d0a2(0x1ac)](_0x12d0a2(0x172)+_0x51d242['name']+'\x20v'+_0x34aa8c),_0x1093f7=await _0x784f9(_0x308294['id']));}else{const _0x4de4df=_0x1b76c8[_0x1b76c8[_0x12d0a2(0x21e)]-0x1];_0x54bf64['progress']?.[_0x12d0a2(0x1ac)]('Fetching\x20'+_0x51d242[_0x12d0a2(0x1f4)]),_0x1093f7=await _0x784f9(_0x4de4df['id']);const _0x29153b=_0x25eaf0(_0x4de4df['id']),_0x27347a=await journeyResponseToDef(_0x1093f7,_0x29153b),_0x144d9b=buildLocalRuleToNameMappingFromJourney(_0x51d242);_0x307006=buildMergedJourneyDef([{'item':_0x4de4df,'yaml':_0x27347a}],_0x144d9b);}}addFoldersToCreate(_0x1be942,_0x54bf64[_0x12d0a2(0x1c0)],_0x4bd780);const _0x2c4c29=calculateJourneyDiff(_0x51d242,_0x307006);_0x50d29d['push']({'relativePath':_0x51d242[_0x12d0a2(0x1f4)],'absolutePath':_0x32f376,'yamlConfig':_0x51d242,'folderPath':_0x1be942,'existingJourney':_0x1093f7,'isNew':_0x2c4c29[_0x12d0a2(0x218)],'hasChanges':_0x2c4c29[_0x12d0a2(0x195)],'diff':_0x2c4c29[_0x12d0a2(0x185)]});}return{'journeyFiles':_0x50d29d,'foldersToCreate':_0x4bd780};}export function calculateActivationActions(_0x31b594,_0x4b5f05,_0x1f560c,_0x3b42b8){const _0x73cdec=a127_0x30a7e2,_0x947e3f=[],_0x417026=new Map();for(const _0x3f0613 of _0x4b5f05){_0x417026[_0x73cdec(0x1f9)](_0x3f0613[_0x73cdec(0x1f4)],_0x3f0613);}const _0x1657d3=new Map();for(const _0x392c00 of _0x31b594){_0x1657d3[_0x73cdec(0x1f9)](_0x392c00['name'],_0x392c00);}for(const _0x30f5cf of _0x31b594){const _0x2f72f5=_0x417026['get'](_0x30f5cf[_0x73cdec(0x1f4)]);if(!_0x2f72f5)_0x947e3f[_0x73cdec(0x17d)]({'type':'create','name':_0x30f5cf['name'],'yamlActivation':_0x30f5cf});else{const _0x5eadba=activationResponseToDef(_0x2f72f5,_0x1f560c,_0x3b42b8),_0x560933=a127_0x548b31[_0x73cdec(0x228)](_0x5eadba),_0x213dc9=a127_0x548b31[_0x73cdec(0x228)](_0x30f5cf);_0x560933!==_0x213dc9&&_0x947e3f[_0x73cdec(0x17d)]({'type':_0x73cdec(0x1ac),'name':_0x30f5cf[_0x73cdec(0x1f4)],'yamlActivation':_0x30f5cf,'existingActivation':_0x2f72f5});}}for(const _0x4937a8 of _0x4b5f05){!_0x1657d3[_0x73cdec(0x1ed)](_0x4937a8[_0x73cdec(0x1f4)])&&_0x947e3f[_0x73cdec(0x17d)]({'type':'delete','name':_0x4937a8[_0x73cdec(0x1f4)],'existingActivation':_0x4937a8});}return _0x947e3f;}function calculateYamlDiff(_0x319fce,_0x54fdfd){if(_0x54fdfd){const _0x236569=generateDiff(_0x54fdfd,_0x319fce),_0x24c63e=hasChanges(_0x236569);return{'isNew':![],'hasChanges':_0x24c63e,'diff':_0x24c63e?formatDiffWithColors(_0x236569):undefined};}const _0x1e8df5=generateDiff('',_0x319fce);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1e8df5)};}export function calculateSegmentDiff(_0xc41a9f,_0x4172a7,_0x31129c,_0x3087f8,_0x6af8a1){const _0x2b78ee=segmentToYamlString(_0xc41a9f),_0x5e69cf=_0x4172a7?segmentToYamlString(segmentWithActivationsToYaml(_0x4172a7,_0x31129c,undefined,_0x3087f8,_0x6af8a1)):undefined;return calculateYamlDiff(_0x2b78ee,_0x5e69cf);}export function calculateJourneyDiff(_0xa664e7,_0x4f31d8){const _0x171f9c=normalizeJourneyDef(_0xa664e7,_0xa664e7),_0x159e7b=a127_0x359c72(_0x171f9c),_0x3b5c53=_0x4f31d8?a127_0x359c72(normalizeJourneyDef(_0x4f31d8,_0xa664e7)):undefined;return calculateYamlDiff(_0x159e7b,_0x3b5c53);}export function findSegmentsToDelete(_0x25b3ea,_0x4e0816,_0x3d4511,_0xa7bfb4,_0x3c96c4){const _0x2bc2a9=a127_0x30a7e2,_0x2cc4bf=new Set();for(const {yamlConfig:_0x57b7f6,folderPath:_0x30d05d}of _0x4e0816){_0x2cc4bf['add'](_0x30d05d+':'+_0x57b7f6[_0x2bc2a9(0x1f4)]);}return _0x25b3ea[_0x2bc2a9(0x1e3)](_0xdcba08=>{const _0x111e57=_0x2bc2a9,_0x556bb1=_0xdcba08[_0x111e57(0x1ab)]?_0x3d4511[_0x111e57(0x22f)](_0xdcba08[_0x111e57(0x1ab)][_0x111e57(0x174)]())||'':'',_0x35cd06=_0x556bb1+':'+_0xdcba08[_0x111e57(0x1f4)];if(_0x2cc4bf[_0x111e57(0x1ed)](_0x35cd06))return![];if(_0x3c96c4)return _0x556bb1===_0xa7bfb4||_0x556bb1[_0x111e57(0x1e5)](_0xa7bfb4+'/');return!![];});}export function findJourneysToDelete(_0x1d0777,_0x40022b,_0x21758f,_0x21602e,_0x221709){const _0x2cceb8=a127_0x30a7e2,_0x38f2a8=new Set();for(const {yamlConfig:_0x55c335,folderPath:_0x10f694}of _0x40022b){_0x38f2a8[_0x2cceb8(0x17b)](_0x10f694+':'+_0x55c335[_0x2cceb8(0x1f4)]);}return _0x1d0777['filter'](_0x50af8e=>{const _0x3594e0=_0x2cceb8,_0x634ed0=_0x50af8e['folderId']?_0x21758f[_0x3594e0(0x22f)](_0x50af8e['folderId'])||'':'',_0x5914ab=_0x634ed0+':'+_0x50af8e['journeyBundleName'];if(_0x38f2a8['has'](_0x5914ab))return![];if(_0x221709)return _0x634ed0===_0x21602e||_0x634ed0[_0x3594e0(0x1e5)](_0x21602e+'/');return!![];});}export function buildSegmentLookupMap(_0x583cd8,_0x56bdfd){const _0x330129=a127_0x30a7e2,_0x31d102=new Map();for(const _0x57efbb of _0x583cd8){const _0x223d11=_0x57efbb[_0x330129(0x1ab)]?_0x56bdfd[_0x330129(0x22f)](_0x57efbb[_0x330129(0x1ab)][_0x330129(0x174)]())||'':'',_0x561368=_0x223d11+':'+_0x57efbb[_0x330129(0x1f4)];_0x31d102[_0x330129(0x1f9)](_0x561368,_0x57efbb);}return _0x31d102;}export function buildSegmentNameToIdMap(_0x5e08db){const _0x17478c=a127_0x30a7e2,_0x19bf0f=new Map();for(const _0x2d18fb of _0x5e08db){_0x19bf0f[_0x17478c(0x1f9)](_0x2d18fb['name'],_0x2d18fb['id']);}return _0x19bf0f;}export function buildJourneyBundleLookupMap(_0x1d13e7,_0x6243ee){const _0x1852f3=a127_0x30a7e2,_0x471940=new Map();for(const _0x2df2d7 of _0x1d13e7){const _0x15ed50=_0x2df2d7['folderId']?_0x6243ee[_0x1852f3(0x22f)](_0x2df2d7['folderId'])||'':'',_0x11c740=_0x15ed50+':'+_0x2df2d7['journeyBundleName'];!_0x471940[_0x1852f3(0x1ed)](_0x11c740)&&_0x471940[_0x1852f3(0x1f9)](_0x11c740,[]),_0x471940[_0x1852f3(0x22f)](_0x11c740)[_0x1852f3(0x17d)](_0x2df2d7);}for(const _0xc279b8 of _0x471940[_0x1852f3(0x257)]()){_0xc279b8[_0x1852f3(0x18f)]((_0x5446e2,_0x40635b)=>(_0x5446e2[_0x1852f3(0x1a2)]||0x0)-(_0x40635b['versionNumber']||0x0));}return _0x471940;}export function collectFoldersToCreate(_0xd3d4f0,_0x2135ea){const _0x51e06d=a127_0x30a7e2,_0x28672=new Set();for(const _0x3c4fb2 of _0xd3d4f0){if(!_0x3c4fb2)continue;if(_0x2135ea['has'](_0x3c4fb2))continue;const _0x51d0fe=_0x3c4fb2[_0x51e06d(0x1cd)]('/');let _0x4202dd='';for(const _0x4466ad of _0x51d0fe){_0x4202dd=_0x4202dd?_0x4202dd+'/'+_0x4466ad:_0x4466ad,!_0x2135ea[_0x51e06d(0x1ed)](_0x4202dd)&&_0x28672['add'](_0x4202dd);}}return _0x28672;}export function parseAndClassifyYamlFiles(_0x52693f,_0x49abc1,_0x5a47b8){const _0x500220=a127_0x30a7e2,_0x1e869e=[],_0x397f89=[];for(const _0x22cda7 of _0x52693f){const _0x38cc50=a127_0x4631af[_0x500220(0x1a7)](_0x49abc1,a127_0x4631af[_0x500220(0x1bb)](_0x22cda7)),_0x3b293d=_0x38cc50==='.'?'':_0x38cc50,_0x50a3f4=readFileSync(_0x22cda7,_0x500220(0x260)),_0x5ed537=a127_0x548b31['parse'](_0x50a3f4);if(isJourneyDef(_0x5ed537)){const _0x26f467=a127_0x4f7de1(_0x50a3f4);_0x397f89[_0x500220(0x17d)]({'yamlConfig':_0x26f467,'folderPath':_0x3b293d,'sourcePath':_0x22cda7});}else{if(!_0x5a47b8?.[_0x500220(0x208)]){const _0x53117b=parseSegmentYamlFile(_0x50a3f4),_0x3f01da=normalizeChildSegmentYaml(_0x53117b);_0x1e869e['push']({'yamlConfig':_0x3f01da,'folderPath':_0x3b293d,'sourcePath':_0x22cda7});}}}return{'segments':_0x1e869e,'journeys':_0x397f89};}export function validateParsedFiles(_0x2d7c18,_0x4015b0){const _0x364f81=a127_0x30a7e2,_0x41c06d=[];for(const {yamlConfig:_0x485044,sourcePath:_0x4b040a}of _0x2d7c18[_0x364f81(0x1ee)]){const _0x1b0aa0=readFileSync(_0x4b040a,_0x364f81(0x260)),_0x5b179b=a127_0x548b31[_0x364f81(0x238)](_0x1b0aa0),_0xf22832=validateSegmentDef(_0x485044,{'source':_0x1b0aa0,'document':_0x5b179b});if(!_0xf22832[_0x364f81(0x207)]){const _0x8aae6=a127_0x4631af[_0x364f81(0x1a7)](_0x4015b0,_0x4b040a);_0x41c06d[_0x364f81(0x17d)]({'filePath':_0x8aae6,'source':_0x1b0aa0,'result':_0xf22832,'isJourney':![]});}}for(const {yamlConfig:_0x19e7d0,sourcePath:_0x5edd86}of _0x2d7c18[_0x364f81(0x241)]){const _0x338098=readFileSync(_0x5edd86,_0x364f81(0x260)),_0x3f9bb8=a127_0x548b31[_0x364f81(0x238)](_0x338098),_0x5563c5=validateJourneyDef(_0x19e7d0,{'source':_0x338098,'document':_0x3f9bb8});if(!_0x5563c5[_0x364f81(0x207)]){const _0xdb3a2a=a127_0x4631af[_0x364f81(0x1a7)](_0x4015b0,_0x5edd86);_0x41c06d[_0x364f81(0x17d)]({'filePath':_0xdb3a2a,'source':_0x338098,'result':_0x5563c5,'isJourney':!![]});}}return _0x41c06d;}export function formatValidationErrors(_0x3a1e7e){const _0xe5743f=a127_0x30a7e2,_0x49000f=[];for(const {filePath:_0x4e79f8,source:_0x11858d,result:_0x25cc32,isJourney:_0x1768bf}of _0x3a1e7e){const _0x2d1e17=_0x1768bf?_0xe5743f(0x24a):_0xe5743f(0x21a);_0x49000f[_0xe5743f(0x17d)]('\x0a'+_0x4e79f8+'\x20('+_0x2d1e17+_0xe5743f(0x275)+_0x25cc32['errors'][_0xe5743f(0x21e)]+_0xe5743f(0x1ef)),_0x49000f[_0xe5743f(0x17d)](formatValidationResult(_0x25cc32,_0x11858d,_0x4e79f8));}return _0x49000f[_0xe5743f(0x1b6)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x1ee056){const _0x24f9c1=a127_0x30a7e2,_0x2ac762=new Set(),_0x27990f=new Map(),_0x9da5a3=collectSegmentUsageCounts(_0x1ee056);if(_0x1ee056[_0x24f9c1(0x1ee)])for(const [_0x5ce829,_0x3ee3e7]of Object[_0x24f9c1(0x23a)](_0x1ee056[_0x24f9c1(0x1ee)])){_0x2ac762[_0x24f9c1(0x17b)](_0x5ce829);if(_0x3ee3e7['rule']){const _0xfdf465=yamlRuleToApi(_0x3ee3e7['rule']),_0xa8c1ac=apiRuleToYaml(_0xfdf465);_0x27990f[_0x24f9c1(0x1f9)](_0x5ce829,_0xa8c1ac);}}const _0x4fc8a4=new Map();let _0x35cf59=0x0;for(const [_0x3049bb,_0x195f36]of _0x27990f){const _0x2a72b1=serializeExpandedRule(_0x195f36,_0x27990f),_0x268410=_0x4fc8a4[_0x24f9c1(0x22f)](_0x2a72b1)||[];_0x268410[_0x24f9c1(0x17d)]({'name':_0x3049bb,'index':_0x35cf59}),_0x4fc8a4['set'](_0x2a72b1,_0x268410),_0x35cf59++;}const _0x9d36c2=new Map();for(const [_0x473be4,_0x306411]of _0x4fc8a4){const _0x4d89e2=_0x306411[_0x24f9c1(0x203)]()[_0x24f9c1(0x18f)]((_0x167d8d,_0x5ad929)=>{const _0x3ffd68=_0x24f9c1,_0x54f782=_0x9da5a3[_0x3ffd68(0x22f)](_0x167d8d[_0x3ffd68(0x1f4)])||0x0,_0x248bd4=_0x9da5a3[_0x3ffd68(0x22f)](_0x5ad929[_0x3ffd68(0x1f4)])||0x0;if(_0x54f782!==_0x248bd4)return _0x248bd4-_0x54f782;return _0x167d8d[_0x3ffd68(0x1de)]-_0x5ad929['index'];})[_0x24f9c1(0x1b5)](_0x33c1a0=>_0x33c1a0[_0x24f9c1(0x1f4)]),_0x1943e2=[];for(const _0x6bf783 of _0x4d89e2){const _0x45c5fb=_0x9da5a3['get'](_0x6bf783)||0x0,_0xcac2ad=Math[_0x24f9c1(0x17f)](_0x45c5fb,0x1);for(let _0x525f33=0x0;_0x525f33<_0xcac2ad;_0x525f33++){_0x1943e2[_0x24f9c1(0x17d)](_0x6bf783);}}_0x9d36c2[_0x24f9c1(0x1f9)](_0x473be4,_0x1943e2);}return{'existingLocalSegmentNames':_0x2ac762,'localSegmentRules':_0x27990f,'localExpandedRuleToNames':_0x9d36c2};}export function createSegmentIdResolver(_0x2d1d32,_0x8aae89){return async _0x4c81de=>{const _0x1c08d7=a127_0x39cb,_0x25cf72=_0x2d1d32[_0x1c08d7(0x22f)](_0x4c81de);if(!_0x25cf72)throw new SDKError(ErrorCode[_0x1c08d7(0x1dd)],'Segment\x20not\x20found:\x20'+_0x4c81de+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x8aae89+'\x27)');return _0x25cf72;};}export function extractRootFolderId(_0x125135){const _0x24ab56=a127_0x30a7e2;return _0x125135[_0x24ab56(0x239)]?.[_0x24ab56(0x1f8)]?.[_0x24ab56(0x26f)]?.['id']||_0x125135[_0x24ab56(0x239)]?.['parentFolder']?.[_0x24ab56(0x26f)]?.['id'];}export function buildConnectionMaps(_0xd05076){const _0xb21320=a127_0x30a7e2,_0xd1af19=new Map(),_0x1e6aa1=new Map(),_0x3fa953=new Map();for(const _0x512642 of _0xd05076){_0xd1af19['set'](_0x512642[_0xb21320(0x1f4)],parseInt(_0x512642['id'],0xa)),_0x1e6aa1['set'](_0x512642['id'],_0x512642[_0xb21320(0x1f4)]),_0x3fa953[_0xb21320(0x1f9)](_0x512642['name'],_0x512642[_0xb21320(0x1d8)]);}return{'nameToId':_0xd1af19,'idToName':_0x1e6aa1,'nameToType':_0x3fa953};}export function calculatePushStats(_0x194b44,_0x3723c1,_0x4d322b,_0x32b478,_0x546318,_0x4c4bf9,_0x222cde){const _0x599363=a127_0x30a7e2,_0x6948df=_0x194b44[_0x599363(0x1e3)](_0x56de9d=>_0x56de9d[_0x599363(0x218)]),_0x3a25ef=_0x194b44[_0x599363(0x1e3)](_0x2dff29=>!_0x2dff29[_0x599363(0x218)]&&_0x2dff29[_0x599363(0x195)]),_0x58b8fd=_0x194b44['filter'](_0x3a063c=>!_0x3a063c[_0x599363(0x218)]&&!_0x3a063c[_0x599363(0x195)]),_0x4788ba=_0x4c4bf9?_0x32b478:[],_0x3ad3d2=_0x3723c1[_0x599363(0x1e3)](_0x590f1b=>_0x590f1b[_0x599363(0x218)]),_0x106025=_0x3723c1[_0x599363(0x1e3)](_0x130e5b=>!_0x130e5b['isNew']&&_0x130e5b[_0x599363(0x195)]),_0x49ac23=_0x3723c1[_0x599363(0x1e3)](_0x47c460=>!_0x47c460[_0x599363(0x218)]&&!_0x47c460['hasChanges']),_0x4a7feb=_0x4c4bf9?_0x546318:[],_0x43ecbd=_0x194b44[_0x599363(0x214)](_0x1b54fa=>_0x1b54fa[_0x599363(0x219)]),_0x3724b5=_0x43ecbd[_0x599363(0x1e3)](_0x2d0e76=>_0x2d0e76['type']===_0x599363(0x231)),_0x357602=_0x43ecbd[_0x599363(0x1e3)](_0x428406=>_0x428406[_0x599363(0x1d8)]==='update'),_0x43e619=_0x43ecbd[_0x599363(0x1e3)](_0x154fc9=>_0x154fc9[_0x599363(0x1d8)]===_0x599363(0x225)),_0x38c957=Array[_0x599363(0x263)](_0x4d322b)[_0x599363(0x18f)](),_0x11179d=_0x222cde?![]:_0x6948df[_0x599363(0x21e)]>0x0||_0x3a25ef[_0x599363(0x21e)]>0x0||_0x4788ba[_0x599363(0x21e)]>0x0,_0x109523=_0x3ad3d2[_0x599363(0x21e)]>0x0||_0x106025[_0x599363(0x21e)]>0x0||_0x4a7feb[_0x599363(0x21e)]>0x0,_0x221fcc=_0x222cde?![]:_0x43ecbd[_0x599363(0x21e)]>0x0,_0x5d30ce=_0x38c957[_0x599363(0x21e)]>0x0;return{'segments':{'new':_0x6948df,'changed':_0x3a25ef,'unchanged':_0x58b8fd,'toDelete':_0x4788ba},'journeys':{'new':_0x3ad3d2,'changed':_0x106025,'unchanged':_0x49ac23,'toDelete':_0x4a7feb},'activations':{'all':_0x43ecbd,'toCreate':_0x3724b5,'toUpdate':_0x357602,'toDelete':_0x43e619},'folders':{'toCreate':_0x38c957},'counts':{'segments':{'new':_0x6948df[_0x599363(0x21e)],'changed':_0x3a25ef[_0x599363(0x21e)],'unchanged':_0x58b8fd[_0x599363(0x21e)],'toDelete':_0x4788ba[_0x599363(0x21e)]},'journeys':{'new':_0x3ad3d2['length'],'changed':_0x106025['length'],'unchanged':_0x49ac23[_0x599363(0x21e)],'toDelete':_0x4a7feb['length']},'activations':{'create':_0x3724b5[_0x599363(0x21e)],'update':_0x357602[_0x599363(0x21e)],'delete':_0x43e619[_0x599363(0x21e)]},'folders':_0x38c957[_0x599363(0x21e)]},'hasChanges':_0x11179d||_0x109523||_0x221fcc||_0x5d30ce};}export async function buildPushExecutionContext(_0x1309fb,_0x231ed4,_0x122fb7,_0x3ffef9,_0x4a9c3c,_0x292d47){const _0x12af8a=a127_0x30a7e2,_0x4f8be9=extractRootFolderId(_0x122fb7),{pathToId:_0x23f113,idToPath:_0x3f8163}=buildFolderMaps(_0x4a9c3c),_0x234bd4=buildSegmentNameToIdMap(_0x3ffef9),_0x53e7b0=new Map(),{batchAsync:_0x41f29f}=await import('../../utils/async.js'),[_0x53b93a,_0x5e66ee]=await Promise[_0x12af8a(0x18e)]([_0x1309fb[_0x12af8a(0x23f)][_0x12af8a(0x1da)](),_0x1309fb[_0x12af8a(0x206)][_0x12af8a(0x1d5)](),((async()=>{const _0x35f387=_0x12af8a;!_0x292d47&&_0x3ffef9[_0x35f387(0x21e)]>0x0&&await _0x41f29f(_0x3ffef9,async _0x2849a2=>{const _0x74db0c=_0x35f387,_0x267591=await _0x1309fb['segment'][_0x74db0c(0x1d7)](_0x231ed4,_0x2849a2['id']);_0x53e7b0[_0x74db0c(0x1f9)](_0x2849a2['id'],_0x267591);});})())]),{emailToId:_0x1c1247,idToEmail:_0x4a0ca8}=_0x53b93a,_0x2996cd=buildConnectionMaps(_0x5e66ee);return{'rootFolderId':_0x4f8be9,'folderPathToId':_0x23f113,'folderIdToPath':_0x3f8163,'segmentNameToId':_0x234bd4,'activationsBySegmentId':_0x53e7b0,'emailToIdMap':_0x1c1247,'idToEmailMap':_0x4a0ca8,'connectionNameToIdMap':_0x2996cd['nameToId'],'connectionIdToNameMap':_0x2996cd[_0x12af8a(0x279)],'connectionNameToTypeMap':_0x2996cd[_0x12af8a(0x245)]};}export function createPushYamlContextForBundle(_0x3bf278,_0x471b2c,_0x59a817,_0xbed145,_0x3bc58f,_0x4b2f80,_0xc49d1,_0x34d490){const {existingLocalSegmentNames:_0x28ead1,localExpandedRuleToNames:_0x29efb5}=_0xbed145,_0x263641=new Set(),_0xcab9f4=new Map(),_0xd022cb=new Map(),_0x363f48=new Map(),_0x3d1af5=createJumpTargetCache(),_0xc34aa7=new Map(),_0x2ce973=new Map(),_0x5f110a=new Set();let _0xdac857;const _0x4a1408=_0x2584e5=>{const _0x38f1df={'resolveSegment':async _0x548e96=>{const _0x483693=a127_0x39cb,_0x284d52=_0x363f48[_0x483693(0x22f)](_0x548e96);if(_0x284d52!==undefined)return{'name':_0x284d52,'isJourneyLocal':!![]};try{const _0x5d4a26=await fetchSegment(_0x3bf278,_0x471b2c,_0x548e96,_0x59a817);if(!_0x5d4a26)throw new Error('Segment\x20not\x20found');const _0x3cdb84=generateJourneyLocalName(_0x5d4a26['name']),_0x39bbc7=_0x5d4a26[_0x483693(0x21d)]===SEGMENT_KIND_JOURNEY&&_0x3cdb84!==undefined;let _0x4fe7a3=_0x5d4a26[_0x483693(0x1f4)],_0x116b7b;if(_0x39bbc7&&_0x5d4a26[_0x483693(0x1e1)]){const _0x4e0f83=apiRuleToYaml(_0x5d4a26[_0x483693(0x1e1)]);_0x2ce973[_0x483693(0x1f9)](_0x548e96,_0x4e0f83);const _0x2e5d06=async _0x3e010d=>{const _0x18dd57=_0x483693,_0x1cd57b=collectSegmentRefsFromRule(_0x3e010d);for(const _0x1aa7bd of _0x1cd57b){if(!_0x2ce973[_0x18dd57(0x1ed)](_0x1aa7bd))try{const _0x14bd01=await fetchSegment(_0x3bf278,_0x471b2c,_0x1aa7bd,_0x59a817);if(_0x14bd01?.['rule']){const _0x2eb7d7=apiRuleToYaml(_0x14bd01['rule']);_0x2ce973[_0x18dd57(0x1f9)](_0x1aa7bd,_0x2eb7d7),await _0x2e5d06(_0x2eb7d7);}}catch(_0xbc004c){logger[_0x18dd57(0x1fd)](_0x18dd57(0x1eb)+_0x1aa7bd+':\x20'+_0xbc004c);}}};await _0x2e5d06(_0x4e0f83);const _0x5761e4=serializeExpandedRule(_0x4e0f83,_0x2ce973),_0x35f3d3=_0x29efb5[_0x483693(0x22f)](_0x5761e4);if(_0x35f3d3&&_0x35f3d3['length']>0x0){const _0x4d51e2=_0xcab9f4[_0x483693(0x22f)](_0x5761e4)||0x0,_0x58c3b9=_0x35f3d3[_0x4d51e2]||_0x35f3d3[_0x35f3d3[_0x483693(0x21e)]-0x1];_0xcab9f4['set'](_0x5761e4,_0x4d51e2+0x1),_0x4fe7a3=_0x58c3b9,_0x263641[_0x483693(0x17b)](_0x4fe7a3),_0x363f48['set'](_0x548e96,_0x4fe7a3);const _0x57ec10=await resolveRuleSegmentRefs(_0x4e0f83,async _0x16c63c=>{const _0x4770bb=_0x483693,_0x6c59b1=_0x363f48[_0x4770bb(0x22f)](_0x16c63c);if(_0x6c59b1)return _0x6c59b1;const _0x4bd4f7=await _0xdac857[_0x4770bb(0x23d)](_0x16c63c);return _0x4bd4f7[_0x4770bb(0x1f4)];});_0x116b7b={'description':_0x5d4a26[_0x483693(0x269)],'rule':_0x57ec10};}else{const _0x3bc083=_0xc34aa7[_0x483693(0x22f)](_0x5761e4);if(_0x3bc083)_0x4fe7a3=_0x3bc083,_0x363f48['set'](_0x548e96,_0x4fe7a3);else{if(_0x3cdb84){let _0x578682=_0x3cdb84,_0x5e9965=0x2;while(_0x263641[_0x483693(0x1ed)](_0x578682)||_0x28ead1[_0x483693(0x1ed)](_0x578682)){_0x578682=_0x3cdb84+'_'+_0x5e9965,_0x5e9965++;}_0x263641[_0x483693(0x17b)](_0x578682),_0x4fe7a3=_0x578682;}_0x363f48[_0x483693(0x1f9)](_0x548e96,_0x4fe7a3),_0xc34aa7[_0x483693(0x1f9)](_0x5761e4,_0x4fe7a3);const _0x4228ea=await resolveRuleSegmentRefs(_0x4e0f83,async _0x4cef4c=>{const _0x3378e8=_0x483693,_0x28fa6e=_0x363f48[_0x3378e8(0x22f)](_0x4cef4c);if(_0x28fa6e)return _0x28fa6e;const _0x35e8dc=await _0xdac857[_0x3378e8(0x23d)](_0x4cef4c);return _0x35e8dc[_0x3378e8(0x1f4)];});_0x116b7b={'description':_0x5d4a26['description'],'rule':_0x4228ea};}}}return{'name':_0x4fe7a3,'isJourneyLocal':_0x39bbc7,'definition':_0x116b7b};}catch(_0x112fe1){return logger[_0x483693(0x1fd)](_0x483693(0x1e9)+_0x548e96+':\x20'+_0x112fe1),{'name':_0x548e96,'isJourneyLocal':![]};}},'resolveActivation':async _0x475055=>{const _0x7fb108=a127_0x39cb,_0x10157f=_0xd022cb[_0x7fb108(0x22f)](_0x475055);if(_0x10157f!==undefined)return{'name':_0x10157f,'isJourneyLocal':!![]};try{let _0x2bf004=_0xc49d1?.['get'](_0x475055);!_0x2bf004&&(_0x2bf004=await _0x3bf278[_0x7fb108(0x24a)][_0x7fb108(0x26b)](_0x2584e5,_0x475055));const _0x57899a=_0x2bf004[_0x7fb108(0x1c8)][_0x7fb108(0x175)][_0x7fb108(0x1f4)]||_0x475055,_0x25f704=sanitizeYamlKey(_0x57899a)||'activation_'+_0x475055,_0x51a52a=_0x25f704;_0xd022cb['set'](_0x475055,_0x51a52a);const _0x1112d9=journeyActivationStepToYaml(_0x2bf004,_0x3bc58f,_0x4b2f80);return{'name':_0x51a52a,'isJourneyLocal':!![],'definition':_0x1112d9};}catch(_0x4a2891){return logger[_0x7fb108(0x1fd)]('Failed\x20to\x20resolve\x20activation\x20'+_0x475055+':\x20'+_0x4a2891),{'name':_0x475055,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x57ff63,_0x1907ba)=>resolveJumpTarget(_0x57ff63,_0x1907ba,_0x3d1af5,async _0x581269=>{const _0x4d6e70=a127_0x39cb,_0x743fdb=_0x34d490?.['get'](_0x581269);if(_0x743fdb)return _0x743fdb;return _0x3bf278[_0x4d6e70(0x24a)][_0x4d6e70(0x243)](_0x581269);})};return _0xdac857=_0x38f1df,_0x38f1df;},_0x2b1443=async _0x4ecba8=>{const _0x1efcab=a127_0x39cb,{collectSegmentIdsFromJourneyApi:_0xd7cf56}=await import('./journey-yaml.js'),{batchAsync:_0x33e2a6}=await import('../../utils/async.js'),_0x116be3=new Set();for(const _0x2b727a of _0x4ecba8){let _0x59ccf2=_0x34d490?.[_0x1efcab(0x22f)](_0x2b727a);!_0x59ccf2&&(_0x59ccf2=await _0x3bf278[_0x1efcab(0x24a)][_0x1efcab(0x243)](_0x2b727a));const _0x20eae9=_0xd7cf56(_0x59ccf2);for(const _0x5058e4 of _0x20eae9){_0x116be3[_0x1efcab(0x17b)](_0x5058e4);}}let _0x1d2260=Array[_0x1efcab(0x263)](_0x116be3);while(_0x1d2260['length']>0x0){const _0x1bf6c7=_0x1d2260[_0x1efcab(0x1e3)](_0x191abb=>!_0x5f110a[_0x1efcab(0x1ed)](_0x191abb));if(_0x1bf6c7[_0x1efcab(0x21e)]===0x0)break;const _0x5133e3=await _0x33e2a6(_0x1bf6c7,async _0x35c8b2=>{_0x5f110a['add'](_0x35c8b2);const _0x23bbf9=await fetchSegment(_0x3bf278,_0x471b2c,_0x35c8b2,_0x59a817);if(!_0x23bbf9)return null;return{'segmentId':_0x35c8b2,'segment':_0x23bbf9};},0xa),_0x114d45=new Set();for(const _0x5acc3f of _0x5133e3){if(!_0x5acc3f?.[_0x1efcab(0x21a)]?.['rule'])continue;const _0x504953=apiRuleToYaml(_0x5acc3f[_0x1efcab(0x21a)][_0x1efcab(0x1e1)]);_0x2ce973[_0x1efcab(0x1f9)](_0x5acc3f[_0x1efcab(0x240)],_0x504953);const _0x95a946=collectSegmentRefsFromRule(_0x504953);for(const _0x1ac3c5 of _0x95a946){!_0x5f110a['has'](_0x1ac3c5)&&_0x114d45['add'](_0x1ac3c5);}}_0x1d2260=Array[_0x1efcab(0x263)](_0x114d45);}};return{'createYamlContext':_0x4a1408,'prefetchJourneySegments':_0x2b1443};}export async function executePushSegments(_0x5b9e18,_0x196a93,_0x3a401e,_0x13de06,_0x53ad96){const _0x338eac=a127_0x30a7e2,{segmentDefToCreateRequest:_0x328f5b,segmentDefToUpdateRequest:_0xefae4c}=await import(_0x338eac(0x274)),_0x34fd94=_0x3a401e['folderPathToId'],_0x498519=0x5,_0x42b663=async _0x26551e=>{const _0x49085a=_0x338eac,_0x4dd5b9=_0x26551e[_0x49085a(0x1b1)]?_0x34fd94['get'](_0x26551e[_0x49085a(0x1b1)]):undefined;let _0x206d77;const _0x19f20d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x26551e[_0x49085a(0x218)]){_0x53ad96['onProgress']?.({'type':_0x49085a(0x1fc),'name':_0x26551e['yamlConfig'][_0x49085a(0x1f4)]});const _0x2ff0a5=_0x328f5b(_0x26551e[_0x49085a(0x193)],_0x4dd5b9),_0x306bb6=await _0x53ad96['withProgress'](_0x49085a(0x1c3)+_0x26551e[_0x49085a(0x193)]['name']+_0x49085a(0x18a),()=>_0x5b9e18[_0x49085a(0x21a)][_0x49085a(0x177)](_0x13de06[_0x49085a(0x1af)],_0x2ff0a5));_0x206d77=_0x306bb6['data']['id'],_0x19f20d[_0x49085a(0x18c)]={'name':_0x26551e['yamlConfig'][_0x49085a(0x1f4)],'id':_0x206d77},_0x53ad96[_0x49085a(0x1dc)]?.({'type':_0x49085a(0x1c7),'name':_0x26551e[_0x49085a(0x193)][_0x49085a(0x1f4)],'segmentId':_0x206d77}),_0x53ad96[_0x49085a(0x236)]?.(_0x49085a(0x230)+_0x26551e[_0x49085a(0x193)]['name']+'\x27'),_0x19f20d[_0x49085a(0x25c)]=0x1;}else{if(_0x26551e[_0x49085a(0x195)]){_0x53ad96['onProgress']?.({'type':'segment_updating','name':_0x26551e[_0x49085a(0x193)][_0x49085a(0x1f4)]});const _0x2dd3a5=_0xefae4c(_0x26551e['yamlConfig']);_0x4dd5b9!==_0x26551e[_0x49085a(0x25f)]?.['segmentFolderId']&&(_0x2dd3a5['segmentFolderId']=_0x4dd5b9?parseInt(_0x4dd5b9,0xa):undefined),await _0x53ad96[_0x49085a(0x19e)](_0x49085a(0x272)+_0x26551e[_0x49085a(0x193)][_0x49085a(0x1f4)]+_0x49085a(0x18a),()=>_0x5b9e18[_0x49085a(0x21a)][_0x49085a(0x24b)](_0x13de06[_0x49085a(0x1af)],_0x26551e[_0x49085a(0x25f)]['id'],_0x2dd3a5)),_0x206d77=_0x26551e[_0x49085a(0x25f)]['id'],_0x53ad96['onProgress']?.({'type':'segment_updated','name':_0x26551e['yamlConfig'][_0x49085a(0x1f4)]}),_0x53ad96[_0x49085a(0x236)]?.(_0x49085a(0x1aa)+_0x26551e[_0x49085a(0x193)][_0x49085a(0x1f4)]+'\x27'),_0x19f20d[_0x49085a(0x25e)]=0x1;}else _0x206d77=_0x26551e['existingSegment']['id'];}}catch(_0x325a00){const _0x4266e8=isHttp400Error(_0x325a00),_0x51b39e=_0x4266e8?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x49085a(0x267)],_0x21b206=getErrorMessage(_0x325a00);throw new SDKError(_0x51b39e,_0x49085a(0x1d0)+(_0x26551e['isNew']?_0x49085a(0x231):_0x49085a(0x1ac))+_0x49085a(0x1be)+_0x26551e[_0x49085a(0x18d)]+_0x49085a(0x196)+_0x21b206,_0x325a00);}try{const _0xd55673=await syncActivationsForSegment(_0x5b9e18,_0x13de06[_0x49085a(0x1af)],_0x206d77,_0x26551e[_0x49085a(0x193)]['name'],_0x26551e[_0x49085a(0x219)],_0x53ad96,_0x26551e[_0x49085a(0x18d)]);_0x19f20d[_0x49085a(0x190)]=_0xd55673;}catch(_0x43a928){if(_0x43a928 instanceof SDKError)throw _0x43a928;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x49085a(0x198)+_0x26551e[_0x49085a(0x193)][_0x49085a(0x1f4)]+_0x49085a(0x1ba)+_0x26551e[_0x49085a(0x18d)]+'\x0a\x20\x20'+getErrorMessage(_0x43a928),_0x43a928);}return _0x19f20d;},_0x322482=await batchAsync(_0x196a93,_0x42b663,_0x498519),_0x4b3044={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4c78fb of _0x322482){_0x4b3044['created']+=_0x4c78fb['created'],_0x4b3044[_0x338eac(0x25e)]+=_0x4c78fb[_0x338eac(0x25e)],_0x4c78fb[_0x338eac(0x18c)]&&_0x4b3044[_0x338eac(0x1f7)][_0x338eac(0x1f9)](_0x4c78fb[_0x338eac(0x18c)]['name'],_0x4c78fb[_0x338eac(0x18c)]['id']),_0x4b3044['activations']['created']+=_0x4c78fb[_0x338eac(0x190)][_0x338eac(0x25c)],_0x4b3044[_0x338eac(0x190)][_0x338eac(0x25e)]+=_0x4c78fb[_0x338eac(0x190)][_0x338eac(0x25e)],_0x4b3044[_0x338eac(0x190)]['deleted']+=_0x4c78fb[_0x338eac(0x190)][_0x338eac(0x252)];}return _0x4b3044;}async function syncActivationsForSegment(_0xb32b7c,_0x38a165,_0x1eee75,_0x1ea8a7,_0x51f336,_0x8d4bea,_0x4e89a8){const _0x3382d8=a127_0x30a7e2,_0x1a73b9={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4334b3 of _0x51f336){try{if(_0x4334b3['type']===_0x3382d8(0x231)&&_0x4334b3[_0x3382d8(0x179)])_0x8d4bea['onProgress']?.({'type':_0x3382d8(0x1c5),'segmentName':_0x1ea8a7,'activationName':_0x4334b3[_0x3382d8(0x1f4)]}),await _0x8d4bea[_0x3382d8(0x19e)](_0x3382d8(0x253)+_0x4334b3[_0x3382d8(0x1f4)]+_0x3382d8(0x18a),()=>_0xb32b7c[_0x3382d8(0x21a)][_0x3382d8(0x1b4)](_0x38a165,_0x1eee75,_0x4334b3[_0x3382d8(0x179)])),_0x8d4bea['onProgress']?.({'type':_0x3382d8(0x1e4),'segmentName':_0x1ea8a7,'activationName':_0x4334b3[_0x3382d8(0x1f4)]}),_0x8d4bea[_0x3382d8(0x236)]?.('Created\x20activation\x20\x27'+_0x4334b3['name']+'\x27'),_0x1a73b9[_0x3382d8(0x25c)]++;else{if(_0x4334b3[_0x3382d8(0x1d8)]===_0x3382d8(0x1ac)&&_0x4334b3[_0x3382d8(0x179)]&&_0x4334b3[_0x3382d8(0x21b)])_0x8d4bea[_0x3382d8(0x1dc)]?.({'type':_0x3382d8(0x232),'segmentName':_0x1ea8a7,'activationName':_0x4334b3[_0x3382d8(0x1f4)]}),await _0x8d4bea['withProgress'](_0x3382d8(0x277)+_0x4334b3[_0x3382d8(0x1f4)]+'\x27...',()=>_0xb32b7c[_0x3382d8(0x21a)]['updateActivation'](_0x38a165,_0x1eee75,_0x4334b3[_0x3382d8(0x21b)]['id'],_0x4334b3[_0x3382d8(0x179)])),_0x8d4bea[_0x3382d8(0x1dc)]?.({'type':_0x3382d8(0x22a),'segmentName':_0x1ea8a7,'activationName':_0x4334b3['name']}),_0x8d4bea[_0x3382d8(0x236)]?.(_0x3382d8(0x211)+_0x4334b3[_0x3382d8(0x1f4)]+'\x27'),_0x1a73b9[_0x3382d8(0x25e)]++;else _0x4334b3[_0x3382d8(0x1d8)]==='delete'&&_0x4334b3[_0x3382d8(0x21b)]&&(_0x8d4bea[_0x3382d8(0x1dc)]?.({'type':_0x3382d8(0x256),'segmentName':_0x1ea8a7,'activationName':_0x4334b3[_0x3382d8(0x1f4)]}),await _0x8d4bea['withProgress'](_0x3382d8(0x1cc)+_0x4334b3[_0x3382d8(0x1f4)]+_0x3382d8(0x18a),()=>_0xb32b7c[_0x3382d8(0x21a)][_0x3382d8(0x1bd)](_0x38a165,_0x1eee75,_0x4334b3[_0x3382d8(0x21b)]['id'])),_0x8d4bea[_0x3382d8(0x1dc)]?.({'type':_0x3382d8(0x221),'segmentName':_0x1ea8a7,'activationName':_0x4334b3['name']}),_0x8d4bea[_0x3382d8(0x247)]?.(_0x3382d8(0x192)+_0x4334b3[_0x3382d8(0x1f4)]+'\x27'),_0x1a73b9[_0x3382d8(0x252)]++);}}catch(_0x1a5365){const _0xcb5217=isHttp400Error(_0x1a5365),_0x3f13d9=_0xcb5217?ErrorCode[_0x3382d8(0x1e7)]:ErrorCode[_0x3382d8(0x27a)],_0x23173e=getErrorMessage(_0x1a5365);throw new SDKError(_0x3f13d9,_0x3382d8(0x1d0)+_0x4334b3[_0x3382d8(0x1d8)]+_0x3382d8(0x26c)+_0x4334b3[_0x3382d8(0x1f4)]+_0x3382d8(0x1ba)+_0x4e89a8+_0x3382d8(0x196)+_0x23173e,_0x1a5365);}}return _0x1a73b9;}export async function executePushFolders(_0x4be611,_0xe1ae1c,_0x39e003,_0x113d58,_0x18f6bb){const _0x47e30d=a127_0x30a7e2,_0x464c0f=new Map(_0x39e003),_0x31dce5=sortFoldersByDepth(_0xe1ae1c);for(const _0xfed449 of _0x31dce5){const _0xfcc725=_0xfed449['split']('/'),_0x35daf6=_0xfcc725[_0xfcc725[_0x47e30d(0x21e)]-0x1],_0x573989=_0xfcc725['slice'](0x0,-0x1)['join']('/'),_0x3b20e2=_0x464c0f[_0x47e30d(0x22f)](_0x573989);_0x18f6bb[_0x47e30d(0x1dc)]?.({'type':_0x47e30d(0x1e6),'folder':_0xfed449});const _0x45152c={'name':_0x35daf6,'parentFolderId':_0x3b20e2},_0x29c878=await _0x18f6bb[_0x47e30d(0x19e)](_0x47e30d(0x1b8)+_0xfed449+_0x47e30d(0x18a),()=>_0x4be611['segment'][_0x47e30d(0x1e8)](_0x113d58[_0x47e30d(0x1af)],_0x45152c));_0x464c0f[_0x47e30d(0x1f9)](_0xfed449,_0x29c878[_0x47e30d(0x26f)]['id']),_0x18f6bb[_0x47e30d(0x1dc)]?.({'type':'folder_created','folder':_0xfed449,'folderId':_0x29c878[_0x47e30d(0x26f)]['id']}),_0x18f6bb[_0x47e30d(0x23c)]?.(_0x47e30d(0x20d)+_0xfed449+'\x27');}return _0x464c0f;}export async function executePushSegmentDeletions(_0x415c93,_0x208719,_0x58d651){const _0x1c263b=a127_0x30a7e2;if(_0x208719['length']===0x0)return 0x0;const {batchAsync:_0xa82600}=await import('../../utils/async.js'),_0x372eac=0x5,_0x30d727=await _0xa82600(_0x208719,async _0x58c427=>{const _0x294f7f=a127_0x39cb;return _0x58d651[_0x294f7f(0x1dc)]?.({'type':_0x294f7f(0x242),'name':_0x58c427['name']}),await _0x415c93[_0x294f7f(0x21a)]['deleteSegment'](_0x58c427['id']),_0x58d651[_0x294f7f(0x1dc)]?.({'type':_0x294f7f(0x20f),'name':_0x58c427[_0x294f7f(0x1f4)]}),_0x58d651[_0x294f7f(0x247)]?.(_0x294f7f(0x17e)+_0x58c427[_0x294f7f(0x1f4)]+'\x27'),0x1;},_0x372eac);return _0x30d727[_0x1c263b(0x25a)]((_0xacef85,_0x1e7ee6)=>_0xacef85+_0x1e7ee6,0x0);}export async function executePushJourneys(_0x3e63f8,_0x28ca4b,_0x4c896d,_0x1d7279,_0x542996){const _0x1f9325=a127_0x30a7e2,{journeyDefToRequest:_0xa421d6}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x3b02d3,yamlRuleToApi:_0xbafa28,validateSegmentRule:_0x329066}=await import('./child-segment-yaml.js'),_0x59499c={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x3d60e5=new Map(_0x4c896d[_0x1f9325(0x26a)]),_0x114919=0x5;for(let _0x1b72ec=0x0;_0x1b72ec<_0x28ca4b[_0x1f9325(0x21e)];_0x1b72ec+=_0x114919){const _0x35790b=_0x28ca4b[_0x1f9325(0x203)](_0x1b72ec,_0x1b72ec+_0x114919),_0x469211=await Promise[_0x1f9325(0x18e)](_0x35790b['map'](async _0x82641c=>{const _0x23c784=_0x1f9325;if(!_0x82641c[_0x23c784(0x218)]&&!_0x82641c[_0x23c784(0x195)])return{'action':_0x23c784(0x22c),'name':_0x82641c[_0x23c784(0x193)][_0x23c784(0x1f4)],'journeyId':_0x82641c['existingJourney']?.['id']};const _0x246cc8=_0x82641c['folderPath']?_0x4c896d[_0x23c784(0x1c0)][_0x23c784(0x22f)](_0x82641c[_0x23c784(0x1b1)]):undefined;_0x542996['onProgress']?.({'type':_0x82641c[_0x23c784(0x218)]?_0x23c784(0x1a8):_0x23c784(0x1d3),'name':_0x82641c[_0x23c784(0x193)][_0x23c784(0x1f4)]});try{const _0x84b0a5=await executeSingleJourneyPush(_0x3e63f8,_0x82641c,{..._0x4c896d,'segmentNameToId':_0x3d60e5},{'parentId':_0x1d7279[_0x23c784(0x1af)],'rootFolderId':_0x1d7279['rootFolderId'],'folderId':_0x246cc8,'verbose':_0x1d7279[_0x23c784(0x186)]},_0x542996,{'journeyDefToRequest':_0xa421d6,'activationDefToCreateRequest':_0x3b02d3,'yamlRuleToApi':_0xbafa28,'validateSegmentRule':_0x329066});for(const [_0x1719f3,_0x454d89]of _0x84b0a5[_0x23c784(0x182)]){_0x3d60e5['set'](_0x1719f3,_0x454d89),_0x59499c[_0x23c784(0x182)][_0x23c784(0x1f9)](_0x1719f3,_0x454d89);}if(_0x84b0a5[_0x23c784(0x220)]===_0x23c784(0x25c))_0x542996[_0x23c784(0x1dc)]?.({'type':_0x23c784(0x261),'name':_0x82641c['yamlConfig']['name'],'journeyId':_0x84b0a5['journeyId']}),_0x542996[_0x23c784(0x236)]?.('Created\x20journey\x20\x27'+_0x82641c[_0x23c784(0x193)]['name']+'\x27'),_0x59499c['created']++;else _0x84b0a5[_0x23c784(0x220)]==='updated'&&(_0x542996[_0x23c784(0x1dc)]?.({'type':_0x23c784(0x224),'name':_0x82641c['yamlConfig'][_0x23c784(0x1f4)]}),_0x542996[_0x23c784(0x236)]?.(_0x23c784(0x1a5)+_0x82641c[_0x23c784(0x193)][_0x23c784(0x1f4)]+'\x27'),_0x59499c['updated']++);return{'action':_0x84b0a5['action'],'name':_0x82641c[_0x23c784(0x193)][_0x23c784(0x1f4)],'journeyId':_0x84b0a5['journeyId']};}catch(_0x1833e6){const _0x205dfd=isHttp400Error(_0x1833e6),_0x29ea25=_0x205dfd?ErrorCode[_0x23c784(0x217)]:ErrorCode[_0x23c784(0x21f)],_0x8930f7=getErrorMessage(_0x1833e6);throw new SDKError(_0x29ea25,_0x23c784(0x1d0)+(_0x82641c[_0x23c784(0x218)]?_0x23c784(0x231):_0x23c784(0x1ac))+_0x23c784(0x1b7)+_0x82641c['absolutePath']+'\x0a\x20\x20'+_0x8930f7,_0x1833e6);}}));_0x59499c['results']['push'](..._0x469211);}return _0x59499c;}async function matchExistingJourneySegments(_0x3d6409,_0x458079,_0x26cb39,_0x4c0c9a,_0x1729a9){const _0x1f8fed=a127_0x30a7e2;if(!_0x458079[_0x1f8fed(0x201)]||!_0x458079['yamlConfig'][_0x1f8fed(0x1ee)])return;const _0x355bb1=new Map(),_0x56f436=new Set();for(const _0x244108 of Object[_0x1f8fed(0x237)](_0x458079['yamlConfig']['segments'])){const _0x56f2cb=generateDeterministicJourneySegmentName(_0x458079[_0x1f8fed(0x193)]['name'],_0x244108);_0x355bb1[_0x1f8fed(0x1f9)](_0x56f2cb,_0x244108),_0x56f436[_0x1f8fed(0x17b)](_0x244108);}const _0x22852e=[],_0x20424b=collectSegmentIdsFromJourneyApi(_0x458079[_0x1f8fed(0x201)]);for(const _0x128c79 of _0x20424b){const _0xa1b05f=await fetchSegment(_0x3d6409,_0x26cb39,_0x128c79,_0x4c0c9a);if(!_0xa1b05f?.['name'])continue;const _0x4b6262=_0x355bb1[_0x1f8fed(0x22f)](_0xa1b05f[_0x1f8fed(0x1f4)]);_0x4b6262?(_0x1729a9[_0x1f8fed(0x1f9)](_0x4b6262,_0x128c79),_0x56f436['delete'](_0x4b6262)):_0x22852e[_0x1f8fed(0x17d)]({'id':_0x128c79,'seg':_0xa1b05f});}if(_0x56f436['size']>0x0&&_0x22852e[_0x1f8fed(0x21e)]>0x0){const {localExpandedRuleToNames:_0x140fab}=buildLocalExpandedRuleMappings(_0x458079[_0x1f8fed(0x193)]),_0x48cb97=new Map();for(const {id:_0x1aa002,seg:_0x351cd2}of _0x22852e){if(_0x351cd2['rule']){const _0x25a797=apiRuleToYaml(_0x351cd2[_0x1f8fed(0x1e1)]);_0x48cb97[_0x1f8fed(0x1f9)](_0x1aa002,_0x25a797);}}for(const {id:_0x5c8e48,seg:_0x5070fe}of _0x22852e){if(!_0x5070fe[_0x1f8fed(0x1e1)])continue;const _0x5b1759=_0x48cb97['get'](_0x5c8e48);if(!_0x5b1759)continue;const _0x251cfc=serializeExpandedRule(_0x5b1759,_0x48cb97),_0x13c5ee=_0x140fab[_0x1f8fed(0x22f)](_0x251cfc);if(_0x13c5ee){const _0x1a7873=_0x13c5ee['find'](_0x178bb5=>_0x56f436[_0x1f8fed(0x1ed)](_0x178bb5));_0x1a7873&&(_0x1729a9[_0x1f8fed(0x1f9)](_0x1a7873,_0x5c8e48),_0x56f436[_0x1f8fed(0x225)](_0x1a7873),logger[_0x1f8fed(0x1fd)](_0x1f8fed(0x19c)+_0x5070fe[_0x1f8fed(0x1f4)]+_0x1f8fed(0x25b)+_0x1a7873+_0x1f8fed(0x1a4)));}}}}async function executeSingleJourneyPush(_0x229021,_0x198429,_0x1c81f5,_0x19b30d,_0x305e78,_0x358fdb){const _0x4c86f7=a127_0x30a7e2,{journeyDefToRequest:_0x3615af,activationDefToCreateRequest:_0x14d33f,yamlRuleToApi:_0x8c149c,validateSegmentRule:_0x280572}=_0x358fdb,_0x4daec0=new Map(),_0x929ddc=new Map();recoverSegmentIdsFromPushRecovery(_0x198429,_0x4daec0,_0x1c81f5[_0x4c86f7(0x26a)]);const _0x2b5826=new Map(),_0x19a50e=new Map(),_0x51877a=new Map();let _0x16523d;const _0x1a1fc7=async()=>{const _0xaa469e=_0x4c86f7;if(_0x16523d)return;_0x16523d=new Map();if(!_0x198429[_0xaa469e(0x201)])return;const _0x2b2e2f=await _0x229021['journey'][_0xaa469e(0x1d7)](_0x198429[_0xaa469e(0x201)]['id']);for(const _0x1b4c93 of _0x2b2e2f){const _0x115a31=journeyActivationStepToYaml(_0x1b4c93,_0x1c81f5[_0xaa469e(0x212)],_0x1c81f5['connectionIdToNameMap']),_0x307a7c=activationSignature(_0x115a31);!_0x16523d['has'](_0x307a7c)&&_0x16523d['set'](_0x307a7c,_0x1b4c93['id']),_0x115a31['name']&&_0x929ddc[_0xaa469e(0x1f9)](_0x115a31[_0xaa469e(0x1f4)],_0x1b4c93['id']);}};await matchExistingJourneySegments(_0x229021,_0x198429,_0x19b30d['parentId'],_0x1c81f5['existingSegments'],_0x1c81f5[_0x4c86f7(0x26a)]);const _0x105112={'resolveSegmentId':async _0x143f3d=>{const _0x7567ab=_0x4c86f7,_0x45c870=_0x1c81f5[_0x7567ab(0x26a)][_0x7567ab(0x22f)](_0x143f3d);if(!_0x45c870)throw new SDKError(ErrorCode[_0x7567ab(0x1dd)],_0x7567ab(0x1fe)+_0x143f3d+_0x7567ab(0x1d1)+_0x198429[_0x7567ab(0x193)]['name']+')');return _0x45c870;},'resolveEmbeddedSegmentId':async(_0x3c3768,_0x39cd13)=>{const _0x536233=_0x4c86f7,_0x3686e5=_0x1c81f5[_0x536233(0x26a)][_0x536233(0x22f)](_0x3c3768);if(_0x3686e5)return _0x3686e5;const _0x128dba=_0x1c81f5[_0x536233(0x233)][_0x536233(0x234)](_0x27271c=>_0x27271c['name']===_0x3c3768);if(_0x128dba)return _0x1c81f5[_0x536233(0x26a)]['set'](_0x3c3768,_0x128dba['id']),_0x128dba['id'];if(_0x198429[_0x536233(0x218)]){const {stageName:_0x504137,criteriaName:_0x300a79}=findSegmentCriteriaLocation(_0x198429[_0x536233(0x193)],_0x3c3768);return _0x280572(_0x3c3768,_0x39cd13[_0x536233(0x1e1)]),_0x19a50e[_0x536233(0x1f9)](_0x3c3768,{'definition':_0x39cd13,'stageName':_0x504137,'criteriaName':_0x300a79}),createPendingSegmentId(_0x3c3768);}const _0x40ff59=_0x198429[_0x536233(0x201)]?.['id'];if(!_0x40ff59)throw new SDKError(ErrorCode['INTERNAL'],_0x536233(0x24c));const _0xe795bd=_0x2b5826[_0x536233(0x22f)](_0x3c3768);if(_0xe795bd)return _0xe795bd;const _0x298845=((async()=>{const _0xe15412=_0x536233;_0x280572(_0x3c3768,_0x39cd13[_0xe15412(0x1e1)]);const _0x1cc27e=generateDeterministicJourneySegmentName(_0x198429[_0xe15412(0x193)][_0xe15412(0x1f4)],_0x3c3768),_0x3079fb=_0x1c81f5[_0xe15412(0x233)][_0xe15412(0x234)](_0x45d6e5=>_0x45d6e5[_0xe15412(0x1f4)]===_0x1cc27e),_0x35a136=createSegmentIdResolver(_0x1c81f5['segmentNameToId'],_0x3c3768),_0x171def=await resolveRuleSegmentIds(_0x39cd13[_0xe15412(0x1e1)],_0x35a136);let _0x490126;return _0x3079fb?(await _0x229021['segment']['updateSegmentById'](_0x19b30d[_0xe15412(0x1af)],_0x3079fb['id'],{'description':_0x39cd13['description']||'Entry\x20criteria:\x20'+_0x3c3768,'rule':_0x8c149c(_0x171def,!![]),'countPopulation':!![]}),_0x490126=_0x3079fb['id'],saveSegmentToPushRecovery(_0x198429['absolutePath'],_0x198429[_0xe15412(0x193)][_0xe15412(0x1f4)],_0x3c3768,{'segmentId':_0x490126,'uniqueServerName':_0x1cc27e,'createdAt':new Date()[_0xe15412(0x222)]()})):_0x490126=await createOrRecoverEmbeddedSegment(_0x229021,_0x198429,{'localName':_0x3c3768,'uniqueSegmentName':_0x1cc27e,'description':_0x39cd13[_0xe15412(0x269)]||_0xe15412(0x184)+_0x3c3768,'journeyId':_0x40ff59,'resolvedRule':_0x171def,'parentId':_0x19b30d[_0xe15412(0x1af)],'folderId':_0x19b30d[_0xe15412(0x180)]||''},_0x8c149c),_0x1c81f5[_0xe15412(0x26a)][_0xe15412(0x1f9)](_0x3c3768,_0x490126),_0x4daec0[_0xe15412(0x1f9)](_0x3c3768,_0x490126),_0x490126;})());_0x2b5826[_0x536233(0x1f9)](_0x3c3768,_0x298845);try{return await _0x298845;}finally{_0x2b5826[_0x536233(0x225)](_0x3c3768);}},'resolveActivationId':async _0x30888a=>{const _0x49001c=_0x4c86f7,_0x4e1eda=_0x929ddc['get'](_0x30888a);if(_0x4e1eda)return _0x4e1eda;if(_0x198429[_0x49001c(0x201)]){await _0x1a1fc7();const _0x48badf=_0x929ddc[_0x49001c(0x22f)](_0x30888a);if(_0x48badf)return _0x48badf;}throw new SDKError(ErrorCode[_0x49001c(0x22d)],_0x49001c(0x1b2)+_0x30888a+'\x20(referenced\x20in\x20journey\x20'+_0x198429[_0x49001c(0x193)][_0x49001c(0x1f4)]+_0x49001c(0x1ae)+_0x49001c(0x1a3));},'resolveEmbeddedActivationId':async(_0x50d0fc,_0x4d1891)=>{const _0x5134e9=_0x4c86f7,_0x481a1c=_0x929ddc[_0x5134e9(0x22f)](_0x50d0fc);if(_0x481a1c)return _0x481a1c;if(_0x198429[_0x5134e9(0x218)])return _0x51877a[_0x5134e9(0x1f9)](_0x50d0fc,_0x4d1891),createPendingActivationId(_0x50d0fc);if(_0x198429['existingJourney']){await _0x1a1fc7();const _0x1baf18=_0x929ddc[_0x5134e9(0x22f)](_0x4d1891[_0x5134e9(0x1f4)]);if(_0x1baf18)return _0x929ddc['set'](_0x50d0fc,_0x1baf18),_0x1baf18;const _0x50de59=activationSignature(_0x4d1891),_0x45b4fd=_0x16523d?.[_0x5134e9(0x22f)](_0x50de59);if(_0x45b4fd)return _0x929ddc[_0x5134e9(0x1f9)](_0x50d0fc,_0x45b4fd),_0x45b4fd;const _0x499835=await _0x14d33f(_0x4d1891,_0x1c81f5[_0x5134e9(0x244)]),_0xdcb3ca={..._0x499835,..._0x4d1891[_0x5134e9(0x268)]!==undefined&&{'runAfterJourneyRefresh':_0x4d1891[_0x5134e9(0x268)]}},_0x4a9b4c=await _0x229021['journey'][_0x5134e9(0x1b4)](_0x198429['existingJourney']['id'],_0xdcb3ca);return _0x929ddc[_0x5134e9(0x1f9)](_0x50d0fc,_0x4a9b4c['id']),_0x4a9b4c['id'];}throw new SDKError(ErrorCode[_0x5134e9(0x1e0)],_0x5134e9(0x18b));},'resolveJourneyId':async _0x24e9ef=>{const _0x57b04b=_0x4c86f7;try{return await _0x229021['journey'][_0x57b04b(0x173)](_0x19b30d[_0x57b04b(0x1af)],_0x24e9ef);}catch(_0x35c984){throw new SDKError(ErrorCode[_0x57b04b(0x22d)],'Journey\x20\x27'+_0x24e9ef+_0x57b04b(0x189)+_0x198429[_0x57b04b(0x193)]['name']+'\x27)',_0x35c984);}},'resolveStageId':async(_0x3ca143,_0x5f0f25)=>{const _0x41d7ec=_0x4c86f7,_0x5375c8=await _0x229021['journey'][_0x41d7ec(0x243)](_0x3ca143),_0x1bbd5c=_0x5375c8['attributes']['journeyStages'][_0x41d7ec(0x234)](_0x208e45=>_0x208e45['name'][_0x41d7ec(0x199)]()===_0x5f0f25['toLowerCase']());if(!_0x1bbd5c?.['id'])throw new SDKError(ErrorCode[_0x41d7ec(0x22d)],_0x41d7ec(0x1fa)+_0x5f0f25+_0x41d7ec(0x1ec)+(_0x5375c8[_0x41d7ec(0x1c8)][_0x41d7ec(0x1e2)]||_0x5375c8['attributes'][_0x41d7ec(0x1f4)])+'\x27');return _0x1bbd5c['id'];}},_0x572da1=await _0x3615af(_0x198429[_0x4c86f7(0x193)],_0x19b30d['parentId'],_0x105112),_0x25fe95=_0x19b30d[_0x4c86f7(0x1c4)]||_0x19b30d[_0x4c86f7(0x180)];_0x25fe95&&(_0x572da1[_0x4c86f7(0x239)]={'parentFolder':{'data':{'id':_0x25fe95,'type':_0x4c86f7(0x194)}}});if(_0x198429[_0x4c86f7(0x218)]){if(_0x19a50e['size']>0x0||_0x51877a[_0x4c86f7(0x191)]>0x0)return await executeThreeStepJourneyCreate(_0x229021,_0x198429,_0x572da1,{'pendingEmbeddedSegments':_0x19a50e,'pendingEmbeddedActivations':_0x51877a,'embeddedSegmentNameToId':_0x4daec0,'journeyActivationNameToId':_0x929ddc},{..._0x19b30d,'effectiveFolderId':_0x25fe95},_0x1c81f5,_0x305e78,_0x358fdb);else{ensureJourneyDefaults(_0x572da1[_0x4c86f7(0x1c8)]);const _0x2b577d=await _0x229021[_0x4c86f7(0x24a)]['create'](_0x572da1);return deletePushRecovery(_0x198429['absolutePath']),{'action':_0x4c86f7(0x25c),'journeyId':_0x2b577d['id'],'embeddedSegmentNameToId':_0x4daec0};}}else{if(_0x198429[_0x4c86f7(0x195)]&&_0x198429[_0x4c86f7(0x201)]){_0x572da1['id']=_0x198429['existingJourney']['id'];const _0x21af90=_0x572da1[_0x4c86f7(0x1c8)];_0x198429[_0x4c86f7(0x201)][_0x4c86f7(0x1c8)]?.['journeyBundleName']&&(_0x21af90[_0x4c86f7(0x1e2)]=_0x198429[_0x4c86f7(0x201)]['attributes'][_0x4c86f7(0x1e2)]);const _0x3be1fa=_0x198429[_0x4c86f7(0x201)]['attributes']?.[_0x4c86f7(0x229)];return _0x3be1fa&&_0x572da1['attributes'][_0x4c86f7(0x229)]&&injectExistingStageIds(_0x572da1[_0x4c86f7(0x1c8)]['journeyStages'],_0x3be1fa),ensureJourneyDefaults(_0x21af90),await _0x229021[_0x4c86f7(0x24a)][_0x4c86f7(0x1ac)](_0x198429[_0x4c86f7(0x201)]['id'],_0x572da1),deletePushRecovery(_0x198429['absolutePath']),{'action':_0x4c86f7(0x25e),'journeyId':_0x198429[_0x4c86f7(0x201)]['id'],'embeddedSegmentNameToId':_0x4daec0};}}return deletePushRecovery(_0x198429[_0x4c86f7(0x18d)]),{'action':_0x4c86f7(0x22c),'journeyId':_0x198429['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x4daec0};}function findSegmentCriteriaLocation(_0x1f6b24,_0x229706){const _0x33c555=a127_0x30a7e2,_0x12dc73=_0x1f6b24[_0x33c555(0x265)]||_0x1f6b24[_0x33c555(0x241)]?.[0x0]?.[_0x33c555(0x265)]||[];let _0x43fbaf='entry',_0x17890b=_0x229706;const _0x4a44a0=_0x1f6b24[_0x33c555(0x1a0)]||_0x1f6b24[_0x33c555(0x241)]?.[0x0]?.[_0x33c555(0x1a0)];if(_0x4a44a0?.['segment']===_0x229706)return{'stageName':'goal','criteriaName':_0x4a44a0[_0x33c555(0x1f4)]||_0x229706};_0x123f59:for(const _0x2c5571 of _0x12dc73){if(_0x2c5571[_0x33c555(0x273)]?.[_0x33c555(0x21a)]===_0x229706){_0x43fbaf=_0x2c5571[_0x33c555(0x1f4)],_0x17890b=_0x2c5571[_0x33c555(0x273)][_0x33c555(0x1f4)]||_0x229706;break;}if(_0x2c5571[_0x33c555(0x1ce)])for(const _0x8b6e8d of _0x2c5571[_0x33c555(0x1ce)]){if(_0x8b6e8d[_0x33c555(0x1d8)]===_0x33c555(0x20a)&&_0x8b6e8d['with']?.['branches'])for(const _0x539ec9 of _0x8b6e8d['with'][_0x33c555(0x1c9)]){if(_0x539ec9['segment']===_0x229706){_0x43fbaf=_0x2c5571['name'],_0x17890b=_0x539ec9['name']||_0x229706;break _0x123f59;}}}}return{'stageName':_0x43fbaf,'criteriaName':_0x17890b};}async function executeThreeStepJourneyCreate(_0x4dc17b,_0x4257e8,_0xba8f1e,_0x43f30d,_0x1b0623,_0x46c64e,_0x273646,_0x275c21){const _0x5d0e4b=a127_0x30a7e2,{activationDefToCreateRequest:_0x100138,yamlRuleToApi:_0x58417f}=_0x275c21,{pendingEmbeddedSegments:_0x10e00c,pendingEmbeddedActivations:_0xf6c198,embeddedSegmentNameToId:_0x293f22}=_0x43f30d,_0x2eb45c=JSON[_0x5d0e4b(0x210)](JSON[_0x5d0e4b(0x228)](_0xba8f1e));ensureJourneyDefaults(_0x2eb45c[_0x5d0e4b(0x1c8)]),stripPendingIds(_0x2eb45c);const _0x206e58=await _0x4dc17b['journey']['create'](_0x2eb45c),_0x2a3b4b=_0x206e58['id'],_0x6dd930=new Map();for(const _0x115b6b of _0x206e58[_0x5d0e4b(0x1c8)][_0x5d0e4b(0x229)]){_0x6dd930[_0x5d0e4b(0x1f9)](_0x115b6b[_0x5d0e4b(0x1f4)][_0x5d0e4b(0x199)](),_0x115b6b['id']);}recoverSegmentIdsFromPushRecovery(_0x4257e8,_0x293f22,_0x46c64e['segmentNameToId']);for(const [_0x252a2f,{definition:_0xf3fac8}]of _0x10e00c){if(_0x293f22[_0x5d0e4b(0x1ed)](_0x252a2f)){_0x273646[_0x5d0e4b(0x1dc)]?.({'type':_0x5d0e4b(0x1cf),'journeyName':_0x4257e8['yamlConfig'][_0x5d0e4b(0x1f4)],'segmentName':_0x252a2f});continue;}const _0xa43b2b=generateDeterministicJourneySegmentName(_0x4257e8['yamlConfig'][_0x5d0e4b(0x1f4)],_0x252a2f);_0x273646[_0x5d0e4b(0x1dc)]?.({'type':_0x5d0e4b(0x22b),'journeyName':_0x4257e8['yamlConfig'][_0x5d0e4b(0x1f4)],'segmentName':_0x252a2f});const _0x5e8083=createSegmentIdResolver(_0x46c64e[_0x5d0e4b(0x26a)],_0x252a2f),_0x3390df=await resolveRuleSegmentIds(_0xf3fac8[_0x5d0e4b(0x1e1)],_0x5e8083),_0x5516cd=await createOrRecoverEmbeddedSegment(_0x4dc17b,_0x4257e8,{'localName':_0x252a2f,'uniqueSegmentName':_0xa43b2b,'description':_0xf3fac8[_0x5d0e4b(0x269)]||_0x5d0e4b(0x184)+_0x252a2f,'journeyId':_0x2a3b4b,'resolvedRule':_0x3390df,'parentId':_0x1b0623[_0x5d0e4b(0x1af)],'folderId':_0x1b0623['effectiveFolderId']||''},_0x58417f);_0x293f22['set'](_0x252a2f,_0x5516cd),_0x46c64e[_0x5d0e4b(0x26a)][_0x5d0e4b(0x1f9)](_0x252a2f,_0x5516cd),_0x273646['onProgress']?.({'type':_0x5d0e4b(0x1cf),'journeyName':_0x4257e8[_0x5d0e4b(0x193)][_0x5d0e4b(0x1f4)],'segmentName':_0x252a2f});}const _0x56d398=new Map();for(const [_0x40e753,_0x23e777]of _0xf6c198){_0x273646['onProgress']?.({'type':_0x5d0e4b(0x1f6),'journeyName':_0x4257e8[_0x5d0e4b(0x193)]['name'],'activationName':_0x40e753});const _0x4f8c4b=await _0x100138(_0x23e777,_0x46c64e[_0x5d0e4b(0x244)]),_0x2c220e={..._0x4f8c4b,..._0x23e777[_0x5d0e4b(0x268)]!==undefined&&{'runAfterJourneyRefresh':_0x23e777[_0x5d0e4b(0x268)]}},_0x2a3ca5=await _0x4dc17b['journey'][_0x5d0e4b(0x1b4)](_0x2a3b4b,_0x2c220e);_0x56d398['set'](_0x40e753,_0x2a3ca5['id']),_0x43f30d[_0x5d0e4b(0x19d)]['set'](_0x40e753,_0x2a3ca5['id']),_0x273646[_0x5d0e4b(0x1dc)]?.({'type':_0x5d0e4b(0x20e),'journeyName':_0x4257e8[_0x5d0e4b(0x193)][_0x5d0e4b(0x1f4)],'activationName':_0x40e753});}const _0x147699=JSON[_0x5d0e4b(0x210)](JSON[_0x5d0e4b(0x228)](_0xba8f1e));return _0x147699['id']=_0x2a3b4b,ensureJourneyDefaults(_0x147699[_0x5d0e4b(0x1c8)]),resolvePendingIdsInRequest(_0x147699,_0xba8f1e,_0x6dd930,_0x293f22,_0x56d398,_0x273646),await _0x4dc17b[_0x5d0e4b(0x24a)]['update'](_0x2a3b4b,_0x147699),deletePushRecovery(_0x4257e8[_0x5d0e4b(0x18d)]),{'action':_0x5d0e4b(0x25c),'journeyId':_0x2a3b4b,'embeddedSegmentNameToId':_0x293f22};}export function stripWaitStepPendingIds(_0x427b2a){const _0x3f458c=a127_0x30a7e2,_0x403abd=_0x427b2a['conditionSegmentId']&&isPendingSegmentId(_0x427b2a['conditionSegmentId']),_0x19ed68=_0x427b2a['conditions']?.[_0x3f458c(0x187)](_0x256bfb=>_0x256bfb[_0x3f458c(0x240)]&&isPendingSegmentId(_0x256bfb[_0x3f458c(0x240)]));(_0x403abd||_0x19ed68)&&(_0x427b2a[_0x3f458c(0x235)]=_0x3f458c(0x1c6),_0x427b2a[_0x3f458c(0x1d4)]=0x1,_0x427b2a[_0x3f458c(0x278)]='day',delete _0x427b2a['conditionSegmentId'],delete _0x427b2a[_0x3f458c(0x1f3)],delete _0x427b2a['conditionTimeoutUnit'],delete _0x427b2a[_0x3f458c(0x17c)]);}export function resolveWaitStepPendingIds(_0x5ab0bb,_0x51dc23,_0x3d3682,_0x140e10){const _0x2e4635=a127_0x30a7e2;if(_0x51dc23[_0x2e4635(0x1df)]&&isPendingSegmentId(_0x51dc23[_0x2e4635(0x1df)])){const _0x22ef29=_0x3d3682(_0x51dc23[_0x2e4635(0x1df)],_0x2e4635(0x20b)+_0x140e10+_0x2e4635(0x1bc));_0x22ef29&&(_0x5ab0bb['waitStepType']=_0x2e4635(0x19f),_0x5ab0bb['conditionSegmentId']=_0x22ef29,delete _0x5ab0bb[_0x2e4635(0x1d4)],delete _0x5ab0bb[_0x2e4635(0x278)],_0x51dc23[_0x2e4635(0x1f3)]!==undefined&&(_0x5ab0bb['conditionTimeoutDuration']=_0x51dc23[_0x2e4635(0x1f3)]),_0x51dc23[_0x2e4635(0x1f1)]&&(_0x5ab0bb[_0x2e4635(0x1f1)]=_0x51dc23[_0x2e4635(0x1f1)]));}if(_0x51dc23[_0x2e4635(0x17c)]){const _0x4c195e=_0x51dc23[_0x2e4635(0x17c)][_0x2e4635(0x187)](_0x47d90d=>_0x47d90d[_0x2e4635(0x240)]&&isPendingSegmentId(_0x47d90d[_0x2e4635(0x240)]));if(_0x4c195e){const _0xbb0186=_0x51dc23[_0x2e4635(0x17c)][_0x2e4635(0x1b5)](_0x3fe76c=>{const _0x4e7fc7=_0x2e4635;if(_0x3fe76c[_0x4e7fc7(0x240)]&&isPendingSegmentId(_0x3fe76c[_0x4e7fc7(0x240)])){const _0x2670bc=_0x3d3682(_0x3fe76c['segmentId'],'stage\x20\x27'+_0x140e10+_0x4e7fc7(0x1bc));return{..._0x3fe76c,'segmentId':_0x2670bc||_0x3fe76c['segmentId']};}return{..._0x3fe76c};});_0x5ab0bb['waitStepType']=_0x2e4635(0x19f),_0x5ab0bb[_0x2e4635(0x17c)]=_0xbb0186,delete _0x5ab0bb['waitStep'],delete _0x5ab0bb[_0x2e4635(0x278)],delete _0x5ab0bb[_0x2e4635(0x1df)],delete _0x5ab0bb['conditionTimeoutDuration'],delete _0x5ab0bb[_0x2e4635(0x1f1)];}}}function stripPendingIds(_0x2b7f2c){const _0x5ba669=a127_0x30a7e2;_0x2b7f2c['attributes'][_0x5ba669(0x1a0)]?.[_0x5ba669(0x240)]&&isPendingSegmentId(_0x2b7f2c[_0x5ba669(0x1c8)]['goal'][_0x5ba669(0x240)])&&delete _0x2b7f2c[_0x5ba669(0x1c8)][_0x5ba669(0x1a0)];for(const _0x3f8472 of _0x2b7f2c['attributes'][_0x5ba669(0x229)]||[]){_0x3f8472[_0x5ba669(0x202)]?.[_0x5ba669(0x240)]&&isPendingSegmentId(_0x3f8472[_0x5ba669(0x202)][_0x5ba669(0x240)])&&delete _0x3f8472[_0x5ba669(0x202)];_0x3f8472['milestone']?.[_0x5ba669(0x240)]&&isPendingSegmentId(_0x3f8472[_0x5ba669(0x23b)][_0x5ba669(0x240)])&&delete _0x3f8472['milestone'];_0x3f8472[_0x5ba669(0x216)]&&(_0x3f8472[_0x5ba669(0x216)]=_0x3f8472[_0x5ba669(0x216)]['filter'](_0x12d919=>!_0x12d919[_0x5ba669(0x240)]||!isPendingSegmentId(_0x12d919[_0x5ba669(0x240)])));if(_0x3f8472[_0x5ba669(0x1ce)])for(const _0xd29dc7 of Object[_0x5ba669(0x237)](_0x3f8472['steps'])){const _0x5ed3b9=_0x3f8472[_0x5ba669(0x1ce)][_0xd29dc7];_0x5ed3b9[_0x5ba669(0x1d8)]===_0x5ba669(0x248)&&_0x5ed3b9['journeyActivationStepId']&&isPendingActivationId(_0x5ed3b9['journeyActivationStepId'])&&(_0x5ed3b9['journeyActivationStepId']='');if(_0x5ed3b9['type']===_0x5ba669(0x1b0)&&_0x5ed3b9[_0x5ba669(0x1c9)])for(const _0x1befbe of _0x5ed3b9[_0x5ba669(0x1c9)]){_0x1befbe[_0x5ba669(0x240)]&&isPendingSegmentId(_0x1befbe[_0x5ba669(0x240)])&&(_0x1befbe['segmentId']='');}_0x5ed3b9[_0x5ba669(0x1d8)]===_0x5ba669(0x270)&&stripWaitStepPendingIds(_0x5ed3b9);}}}function resolvePendingIdsInRequest(_0x225a5,_0x2801f6,_0x47ff78,_0x59b6d3,_0x521fe3,_0x50b9d3){const _0x325071=a127_0x30a7e2,_0x483d1e=(_0x38b947,_0x333859)=>{const _0x133d37=a127_0x39cb;if(!isPendingSegmentId(_0x38b947))return _0x38b947;const _0x484509=extractPendingSegmentName(_0x38b947),_0x15777a=_0x59b6d3[_0x133d37(0x22f)](_0x484509);return!_0x15777a&&_0x50b9d3[_0x133d37(0x178)]?.(_0x133d37(0x1a9)+_0x484509+'\x27\x20for\x20'+_0x333859),_0x15777a;};if(_0x225a5[_0x325071(0x1c8)][_0x325071(0x1a0)]?.[_0x325071(0x240)]&&isPendingSegmentId(_0x225a5[_0x325071(0x1c8)]['goal'][_0x325071(0x240)])){const _0x336b41=_0x483d1e(_0x225a5[_0x325071(0x1c8)][_0x325071(0x1a0)][_0x325071(0x240)],_0x325071(0x17a));_0x336b41&&(_0x225a5[_0x325071(0x1c8)][_0x325071(0x1a0)][_0x325071(0x240)]=_0x336b41);}for(const _0x512da7 of _0x225a5['attributes']['journeyStages']||[]){const _0x3caf40=_0x47ff78[_0x325071(0x22f)](_0x512da7['name'][_0x325071(0x199)]());_0x3caf40&&(_0x512da7['id']=_0x3caf40);if(_0x512da7[_0x325071(0x202)]?.['segmentId']&&isPendingSegmentId(_0x512da7[_0x325071(0x202)]['segmentId'])){const _0x10aad2=_0x483d1e(_0x512da7[_0x325071(0x202)]['segmentId'],_0x325071(0x20b)+_0x512da7['name']+_0x325071(0x1ea));_0x10aad2&&(_0x512da7[_0x325071(0x202)][_0x325071(0x240)]=_0x10aad2);}if(_0x512da7[_0x325071(0x216)])for(const _0x4bb305 of _0x512da7[_0x325071(0x216)]){if(_0x4bb305[_0x325071(0x240)]&&isPendingSegmentId(_0x4bb305[_0x325071(0x240)])){const _0x12434d=_0x483d1e(_0x4bb305['segmentId'],_0x325071(0x20b)+_0x512da7[_0x325071(0x1f4)]+_0x325071(0x23e));_0x12434d&&(_0x4bb305[_0x325071(0x240)]=_0x12434d);}}if(_0x512da7[_0x325071(0x23b)]?.['segmentId']&&isPendingSegmentId(_0x512da7[_0x325071(0x23b)][_0x325071(0x240)])){const _0x4fddb9=_0x483d1e(_0x512da7[_0x325071(0x23b)][_0x325071(0x240)],_0x325071(0x20b)+_0x512da7['name']+_0x325071(0x200));_0x4fddb9&&(_0x512da7[_0x325071(0x23b)][_0x325071(0x240)]=_0x4fddb9);}if(_0x512da7['steps']){const _0x23ee1a=_0x117aa8=>_0x2801f6[_0x325071(0x1c8)][_0x325071(0x229)]?.['find'](_0x885c61=>_0x885c61['name'][_0x325071(0x199)]()===_0x512da7['name'][_0x325071(0x199)]())?.[_0x325071(0x1ce)]?.[_0x117aa8];for(const _0x970ddb of Object[_0x325071(0x237)](_0x512da7[_0x325071(0x1ce)])){const _0x5bd0fc=_0x512da7[_0x325071(0x1ce)][_0x970ddb],_0x5a697d=_0x23ee1a(_0x970ddb);if(_0x5bd0fc[_0x325071(0x1d8)]===_0x325071(0x248)&&_0x5bd0fc[_0x325071(0x205)]&&(isPendingActivationId(_0x5bd0fc['journeyActivationStepId'])||_0x5bd0fc[_0x325071(0x205)]==='')){if(_0x5a697d?.[_0x325071(0x205)]&&isPendingActivationId(_0x5a697d[_0x325071(0x205)])){const _0x53cfd9=extractPendingActivationName(_0x5a697d[_0x325071(0x205)]),_0x3781ac=_0x521fe3[_0x325071(0x22f)](_0x53cfd9);_0x3781ac&&(_0x5bd0fc[_0x325071(0x205)]=_0x3781ac);}}if(_0x5bd0fc['type']==='DecisionPoint'&&_0x5bd0fc['branches']&&_0x5a697d?.[_0x325071(0x1c9)])for(let _0x39aaf9=0x0;_0x39aaf9<_0x5bd0fc[_0x325071(0x1c9)][_0x325071(0x21e)];_0x39aaf9++){const _0x24f4ce=_0x5bd0fc[_0x325071(0x1c9)][_0x39aaf9],_0x136545=_0x5a697d[_0x325071(0x1c9)][_0x39aaf9];if(_0x136545?.[_0x325071(0x240)]&&isPendingSegmentId(_0x136545[_0x325071(0x240)])){const _0x40b85f=_0x483d1e(_0x136545[_0x325071(0x240)],'stage\x20\x27'+_0x512da7[_0x325071(0x1f4)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x24f4ce[_0x325071(0x1f4)]||_0x39aaf9)+'\x27');_0x40b85f&&(_0x24f4ce[_0x325071(0x240)]=_0x40b85f);}}_0x5bd0fc[_0x325071(0x1d8)]===_0x325071(0x270)&&_0x5a697d?.[_0x325071(0x1d8)]==='WaitStep'&&resolveWaitStepPendingIds(_0x5bd0fc,_0x5a697d,_0x483d1e,_0x512da7[_0x325071(0x1f4)]);}}}}
@@ -1 +1 @@
1
- (function(_0x4fcd29,_0x5b915d){const _0x2ad822=a128_0x23ac,_0x375163=_0x4fcd29();while(!![]){try{const _0x4da831=-parseInt(_0x2ad822(0x83))/0x1*(parseInt(_0x2ad822(0x80))/0x2)+parseInt(_0x2ad822(0x86))/0x3+-parseInt(_0x2ad822(0x82))/0x4*(-parseInt(_0x2ad822(0x84))/0x5)+-parseInt(_0x2ad822(0x7c))/0x6*(parseInt(_0x2ad822(0x81))/0x7)+-parseInt(_0x2ad822(0x7e))/0x8+parseInt(_0x2ad822(0x88))/0x9+parseInt(_0x2ad822(0x8b))/0xa;if(_0x4da831===_0x5b915d)break;else _0x375163['push'](_0x375163['shift']());}catch(_0x12f7e1){_0x375163['push'](_0x375163['shift']());}}}(a128_0x119e,0x2c19a));function a128_0x119e(){const _0x214c08=['63AfPQeH','129668ihJMKC','8920CgRTbm','15BhrqDM','set','620169FoRFZP','name','104508ZPYTQX','get','has','7906470Nynpzw','160794JtMcuZ','add','2834944jJMeUc','parentFolderId','74LUcaqF'];a128_0x119e=function(){return _0x214c08;};return a128_0x119e();}export function buildFolderIdToPathMap(_0xed10c8){const _0xd65ee7=a128_0x23ac,_0x427690=new Map(),_0x17e972=new Map();for(const _0x327558 of _0xed10c8){_0x17e972['set'](_0x327558['id'],_0x327558);}const _0x456dc5=new Set();for(const _0x3232be of _0xed10c8){!_0x3232be[_0xd65ee7(0x7f)]&&_0x456dc5[_0xd65ee7(0x7d)](_0x3232be['id']);}function _0x1785ac(_0x5675dc){const _0x4a38ac=_0xd65ee7;if(_0x427690[_0x4a38ac(0x8a)](_0x5675dc['id']))return _0x427690[_0x4a38ac(0x89)](_0x5675dc['id']);if(_0x456dc5[_0x4a38ac(0x8a)](_0x5675dc['id']))return _0x427690['set'](_0x5675dc['id'],''),'';if(_0x5675dc[_0x4a38ac(0x7f)]){const _0x344917=_0x17e972[_0x4a38ac(0x89)](_0x5675dc[_0x4a38ac(0x7f)]);if(_0x344917){const _0x3a3955=_0x1785ac(_0x344917),_0x31c5b9=_0x3a3955?_0x3a3955+'/'+_0x5675dc[_0x4a38ac(0x87)]:_0x5675dc[_0x4a38ac(0x87)];return _0x427690[_0x4a38ac(0x85)](_0x5675dc['id'],_0x31c5b9),_0x31c5b9;}}const _0x15c829=_0x5675dc['name'];return _0x427690[_0x4a38ac(0x85)](_0x5675dc['id'],_0x15c829),_0x15c829;}for(const _0x2c960b of _0xed10c8){_0x1785ac(_0x2c960b);}return _0x427690;}export function buildFolderPathToIdMap(_0x36a617){const _0x3fbef1=a128_0x23ac,_0x4282ee=new Map(),_0x11dec3=new Map();for(const _0xf6a543 of _0x36a617){_0x11dec3['set'](_0xf6a543['id'],_0xf6a543);}const _0x518e38=new Set();for(const _0x5de929 of _0x36a617){!_0x5de929[_0x3fbef1(0x7f)]&&_0x518e38[_0x3fbef1(0x7d)](_0x5de929['id']);}function _0x431683(_0x3f1454){const _0x354fd4=_0x3fbef1;if(_0x518e38[_0x354fd4(0x8a)](_0x3f1454['id']))return'';if(_0x3f1454[_0x354fd4(0x7f)]){const _0xcf3e24=_0x11dec3[_0x354fd4(0x89)](_0x3f1454[_0x354fd4(0x7f)]);if(_0xcf3e24){const _0x4befa9=_0x431683(_0xcf3e24);return _0x4befa9?_0x4befa9+'/'+_0x3f1454[_0x354fd4(0x87)]:_0x3f1454['name'];}}return _0x3f1454[_0x354fd4(0x87)];}for(const _0x27f4eb of _0x36a617){const _0x8c0c18=_0x431683(_0x27f4eb);_0x4282ee['set'](_0x8c0c18,_0x27f4eb['id']);}return _0x4282ee;}function a128_0x23ac(_0x2903f9,_0x277e1d){_0x2903f9=_0x2903f9-0x7c;const _0x119e81=a128_0x119e();let _0x23ac1a=_0x119e81[_0x2903f9];return _0x23ac1a;}export function buildFolderMaps(_0x241023){const _0x3b92ff=a128_0x23ac,_0x809453=buildFolderIdToPathMap(_0x241023),_0x510c9e=new Map();for(const [_0x10a70c,_0x15462d]of _0x809453){_0x510c9e[_0x3b92ff(0x85)](_0x15462d,_0x10a70c);}return{'idToPath':_0x809453,'pathToId':_0x510c9e};}export function getFolderPath(_0x5ca2af,_0x51f164){const _0x1c61d8=a128_0x23ac;if(!_0x5ca2af)return'';return _0x51f164[_0x1c61d8(0x89)](_0x5ca2af)??'';}
1
+ function a128_0x20a1(_0x4b86b8,_0xb5c7a8){_0x4b86b8=_0x4b86b8-0x1ef;const _0x2dbbf6=a128_0x2dbb();let _0x20a174=_0x2dbbf6[_0x4b86b8];return _0x20a174;}(function(_0x1998d2,_0x169509){const _0x3bf4ba=a128_0x20a1,_0xa0a2e6=_0x1998d2();while(!![]){try{const _0x3da8c2=parseInt(_0x3bf4ba(0x1f7))/0x1*(parseInt(_0x3bf4ba(0x1ef))/0x2)+-parseInt(_0x3bf4ba(0x1fd))/0x3+-parseInt(_0x3bf4ba(0x1fb))/0x4*(parseInt(_0x3bf4ba(0x1f9))/0x5)+parseInt(_0x3bf4ba(0x1f8))/0x6+-parseInt(_0x3bf4ba(0x1f0))/0x7*(-parseInt(_0x3bf4ba(0x200))/0x8)+-parseInt(_0x3bf4ba(0x1f2))/0x9*(parseInt(_0x3bf4ba(0x1f1))/0xa)+parseInt(_0x3bf4ba(0x1fc))/0xb*(parseInt(_0x3bf4ba(0x1fe))/0xc);if(_0x3da8c2===_0x169509)break;else _0xa0a2e6['push'](_0xa0a2e6['shift']());}catch(_0x1eed39){_0xa0a2e6['push'](_0xa0a2e6['shift']());}}}(a128_0x2dbb,0x5e3eb));export function buildFolderIdToPathMap(_0xdba31e){const _0x5e0673=a128_0x20a1,_0xa99890=new Map(),_0x20721c=new Map();for(const _0xf8fa71 of _0xdba31e){_0x20721c[_0x5e0673(0x1fa)](_0xf8fa71['id'],_0xf8fa71);}const _0x55861b=new Set();for(const _0x7f0605 of _0xdba31e){!_0x7f0605[_0x5e0673(0x1ff)]&&_0x55861b[_0x5e0673(0x1f4)](_0x7f0605['id']);}function _0x4fb6c3(_0xc1b6c7){const _0x5dddef=_0x5e0673;if(_0xa99890[_0x5dddef(0x1f6)](_0xc1b6c7['id']))return _0xa99890[_0x5dddef(0x1f5)](_0xc1b6c7['id']);if(_0x55861b[_0x5dddef(0x1f6)](_0xc1b6c7['id']))return _0xa99890[_0x5dddef(0x1fa)](_0xc1b6c7['id'],''),'';if(_0xc1b6c7[_0x5dddef(0x1ff)]){const _0x5818be=_0x20721c[_0x5dddef(0x1f5)](_0xc1b6c7[_0x5dddef(0x1ff)]);if(_0x5818be){const _0x22d0eb=_0x4fb6c3(_0x5818be),_0x1bcc6a=_0x22d0eb?_0x22d0eb+'/'+_0xc1b6c7[_0x5dddef(0x1f3)]:_0xc1b6c7[_0x5dddef(0x1f3)];return _0xa99890[_0x5dddef(0x1fa)](_0xc1b6c7['id'],_0x1bcc6a),_0x1bcc6a;}}const _0x14a3f=_0xc1b6c7[_0x5dddef(0x1f3)];return _0xa99890[_0x5dddef(0x1fa)](_0xc1b6c7['id'],_0x14a3f),_0x14a3f;}for(const _0x2669d7 of _0xdba31e){_0x4fb6c3(_0x2669d7);}return _0xa99890;}function a128_0x2dbb(){const _0x21a42e=['has','2LGHtdA','1460106Dkeqrr','15ANrjqS','set','950924UOBYsU','4008785XLiSrI','1328514WfkkTS','36dcSWnv','parentFolderId','564712kiKSvD','640954wcJQLT','21qGmhGP','6473190vgyaAL','9jOsBjw','name','add','get'];a128_0x2dbb=function(){return _0x21a42e;};return a128_0x2dbb();}export function buildFolderPathToIdMap(_0x28b19e){const _0x2f9aa7=a128_0x20a1,_0x451678=new Map(),_0x5ecd1d=new Map();for(const _0x1b66ad of _0x28b19e){_0x5ecd1d['set'](_0x1b66ad['id'],_0x1b66ad);}const _0x20f80f=new Set();for(const _0x1512c3 of _0x28b19e){!_0x1512c3[_0x2f9aa7(0x1ff)]&&_0x20f80f[_0x2f9aa7(0x1f4)](_0x1512c3['id']);}function _0x4e5694(_0x1ee9eb){const _0x9fe01e=_0x2f9aa7;if(_0x20f80f[_0x9fe01e(0x1f6)](_0x1ee9eb['id']))return'';if(_0x1ee9eb[_0x9fe01e(0x1ff)]){const _0x3d58da=_0x5ecd1d[_0x9fe01e(0x1f5)](_0x1ee9eb[_0x9fe01e(0x1ff)]);if(_0x3d58da){const _0x1b4741=_0x4e5694(_0x3d58da);return _0x1b4741?_0x1b4741+'/'+_0x1ee9eb[_0x9fe01e(0x1f3)]:_0x1ee9eb[_0x9fe01e(0x1f3)];}}return _0x1ee9eb['name'];}for(const _0x1012b0 of _0x28b19e){const _0x3e7994=_0x4e5694(_0x1012b0);_0x451678['set'](_0x3e7994,_0x1012b0['id']);}return _0x451678;}export function buildFolderMaps(_0x13ffbb){const _0x5f01bf=buildFolderIdToPathMap(_0x13ffbb),_0x51f6cc=new Map();for(const [_0x339c60,_0x3f0c44]of _0x5f01bf){_0x51f6cc['set'](_0x3f0c44,_0x339c60);}return{'idToPath':_0x5f01bf,'pathToId':_0x51f6cc};}export function getFolderPath(_0x2f97af,_0x1bee87){const _0x5f17d7=a128_0x20a1;if(!_0x2f97af)return'';return _0x1bee87[_0x5f17d7(0x1f5)](_0x2f97af)??'';}