@treasuredata/tdx 2026.4.9 → 2026.4.11

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 (228) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.js +1 -1
  94. package/dist/sdk/cas/cas-api-client.js +1 -1
  95. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  96. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  97. package/dist/sdk/cas/index.js +1 -1
  98. package/dist/sdk/cas/pull-workflow.js +1 -1
  99. package/dist/sdk/cas/push-workflow.js +1 -1
  100. package/dist/sdk/client/cdp-api-client.js +1 -1
  101. package/dist/sdk/client/delivery-api-client.js +1 -1
  102. package/dist/sdk/client/endpoints.js +1 -1
  103. package/dist/sdk/client/engage-api-client.js +1 -1
  104. package/dist/sdk/client/http-client.js +1 -1
  105. package/dist/sdk/client/llm-api-client.js +1 -1
  106. package/dist/sdk/client/oauth-refresh.js +1 -1
  107. package/dist/sdk/client/rate-limiter.js +1 -1
  108. package/dist/sdk/client/td-api-client.js +1 -1
  109. package/dist/sdk/client/trino-api-client.js +1 -1
  110. package/dist/sdk/client/workflow-client.js +1 -1
  111. package/dist/sdk/connection-validator.js +1 -1
  112. package/dist/sdk/connection.js +1 -1
  113. package/dist/sdk/delivery.js +1 -1
  114. package/dist/sdk/engage/campaign-pull.js +1 -1
  115. package/dist/sdk/engage/campaign-push.js +1 -1
  116. package/dist/sdk/engage/campaign-validator.js +1 -1
  117. package/dist/sdk/engage/campaign-yaml.js +1 -1
  118. package/dist/sdk/engage/template-pull.js +1 -1
  119. package/dist/sdk/engage/template-push.js +1 -1
  120. package/dist/sdk/engage/template-validator.js +1 -1
  121. package/dist/sdk/engage/template-yaml.js +1 -1
  122. package/dist/sdk/engage/types/campaign-def.js +1 -1
  123. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  124. package/dist/sdk/engage/types/template-schema.js +1 -1
  125. package/dist/sdk/engage.js +1 -1
  126. package/dist/sdk/errors.js +1 -1
  127. package/dist/sdk/index.js +1 -1
  128. package/dist/sdk/io/index.js +1 -1
  129. package/dist/sdk/io/node-filesystem.js +1 -1
  130. package/dist/sdk/job.js +1 -1
  131. package/dist/sdk/journey.js +1 -1
  132. package/dist/sdk/llm/chat-cache.js +1 -1
  133. package/dist/sdk/llm/index.js +1 -1
  134. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  135. package/dist/sdk/llm/model-factors.js +1 -1
  136. package/dist/sdk/personalization.js +1 -1
  137. package/dist/sdk/policy.js +1 -1
  138. package/dist/sdk/query/index.js +1 -1
  139. package/dist/sdk/query/sql-parser.js +1 -1
  140. package/dist/sdk/realtime.js +1 -1
  141. package/dist/sdk/schedule.js +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/fields-display.js +1 -1
  144. package/dist/sdk/segment/file-discovery.js +1 -1
  145. package/dist/sdk/segment/journey-utils.js +1 -1
  146. package/dist/sdk/segment/journey-validator.js +1 -1
  147. package/dist/sdk/segment/journey-yaml.js +1 -1
  148. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  149. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/pull-workflow.js +1 -1
  151. package/dist/sdk/segment/push-recovery.js +1 -1
  152. package/dist/sdk/segment/push-workflow.js +1 -1
  153. package/dist/sdk/segment/resolution-context.js +1 -1
  154. package/dist/sdk/segment/segment-path-parser.js +1 -1
  155. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  156. package/dist/sdk/segment/segment-validator.js +1 -1
  157. package/dist/sdk/segment/target-resolution.js +1 -1
  158. package/dist/sdk/segment/tdx-config.js +1 -1
  159. package/dist/sdk/segment/types/activation-schema.js +1 -1
  160. package/dist/sdk/segment/types/journey-def.js +1 -1
  161. package/dist/sdk/segment/types/journey-schema.js +1 -1
  162. package/dist/sdk/segment/types/segment-def.js +1 -1
  163. package/dist/sdk/segment/types/segment-schema.js +1 -1
  164. package/dist/sdk/segment/validate-files.js +1 -1
  165. package/dist/sdk/segment/yaml-validator.js +1 -1
  166. package/dist/sdk/segment.js +1 -1
  167. package/dist/sdk/types/index.js +1 -1
  168. package/dist/sdk/types/progress.js +1 -1
  169. package/dist/sdk/types/workspace.js +1 -1
  170. package/dist/sdk/user.js +1 -1
  171. package/dist/sdk/util/format-detector.js +1 -1
  172. package/dist/sdk/util/formatters.js +1 -1
  173. package/dist/sdk/util/index.js +1 -1
  174. package/dist/sdk/util/paginate.js +1 -1
  175. package/dist/sdk/util/tree-formatter.js +1 -1
  176. package/dist/sdk/workflow/archive-validation.js +1 -1
  177. package/dist/sdk/workflow/clone-workflow.js +1 -1
  178. package/dist/sdk/workflow/index.js +1 -1
  179. package/dist/sdk/workflow/pull-workflow.js +1 -1
  180. package/dist/sdk/workflow/push-workflow.js +1 -1
  181. package/dist/sdk/workflow/tdx-config.js +1 -1
  182. package/dist/sdk/workflow/workflow-utils.js +1 -1
  183. package/dist/sdk/workspace/access-tracker.js +1 -1
  184. package/dist/sdk/workspace/frontmatter.js +1 -1
  185. package/dist/sdk/workspace/git.d.ts +52 -0
  186. package/dist/sdk/workspace/git.d.ts.map +1 -1
  187. package/dist/sdk/workspace/git.js +1 -1
  188. package/dist/sdk/workspace/git.js.map +1 -1
  189. package/dist/sdk/workspace/index.d.ts +14 -0
  190. package/dist/sdk/workspace/index.d.ts.map +1 -1
  191. package/dist/sdk/workspace/index.js +1 -1
  192. package/dist/sdk/workspace/index.js.map +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.js +1 -1
  196. package/dist/test-utils/command-runner.js +1 -1
  197. package/dist/test-utils/factories.js +1 -1
  198. package/dist/test-utils/fixtures.js +1 -1
  199. package/dist/test-utils/http-mock.js +1 -1
  200. package/dist/test-utils/index.js +1 -1
  201. package/dist/utils/async.js +1 -1
  202. package/dist/utils/colors.js +1 -1
  203. package/dist/utils/diff.js +1 -1
  204. package/dist/utils/file-permissions.js +1 -1
  205. package/dist/utils/file-reader.js +1 -1
  206. package/dist/utils/github-releases.js +1 -1
  207. package/dist/utils/global-cache.js +1 -1
  208. package/dist/utils/json-loader.js +1 -1
  209. package/dist/utils/local-cache.js +1 -1
  210. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  211. package/dist/utils/logger/formatters/index.js +1 -1
  212. package/dist/utils/logger/handlers/console-handler.js +1 -1
  213. package/dist/utils/logger/handlers/file-handler.js +1 -1
  214. package/dist/utils/logger/handlers/index.js +1 -1
  215. package/dist/utils/logger/handlers/null-handler.js +1 -1
  216. package/dist/utils/logger/index.js +1 -1
  217. package/dist/utils/logger/logger.js +1 -1
  218. package/dist/utils/logger/types.js +1 -1
  219. package/dist/utils/option-validation.js +1 -1
  220. package/dist/utils/process.js +1 -1
  221. package/dist/utils/prompt.js +1 -1
  222. package/dist/utils/spinner.js +1 -1
  223. package/dist/utils/sse-parser.js +1 -1
  224. package/dist/utils/string-utils.js +1 -1
  225. package/dist/utils/table-ref-parser.js +1 -1
  226. package/dist/utils/tdx-logger.js +1 -1
  227. package/dist/utils/version-check.js +1 -1
  228. package/package.json +2 -1
@@ -1 +1 @@
1
- const a152_0x3c2d73=a152_0x2923;(function(_0x372da1,_0x41c27a){const _0x29c55b=a152_0x2923,_0x3eb0df=_0x372da1();while(!![]){try{const _0x2c834d=parseInt(_0x29c55b(0x104))/0x1*(parseInt(_0x29c55b(0x146))/0x2)+-parseInt(_0x29c55b(0xf9))/0x3*(parseInt(_0x29c55b(0x16c))/0x4)+-parseInt(_0x29c55b(0x8b))/0x5+-parseInt(_0x29c55b(0x11b))/0x6+-parseInt(_0x29c55b(0x80))/0x7*(parseInt(_0x29c55b(0xa4))/0x8)+parseInt(_0x29c55b(0x92))/0x9*(parseInt(_0x29c55b(0x105))/0xa)+parseInt(_0x29c55b(0x17e))/0xb;if(_0x2c834d===_0x41c27a)break;else _0x3eb0df['push'](_0x3eb0df['shift']());}catch(_0x1df784){_0x3eb0df['push'](_0x3eb0df['shift']());}}}(a152_0x423d,0xab930));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x3c2d73(0xd6));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a152_0x3c2d73(0xf1);export function createPendingSegmentId(_0x517953){return''+PENDING_SEGMENT_PREFIX+_0x517953+'__';}export function isPendingSegmentId(_0x5d6581){const _0x16d0cf=a152_0x3c2d73;return _0x5d6581[_0x16d0cf(0xbf)](PENDING_SEGMENT_PREFIX)&&!_0x5d6581[_0x16d0cf(0xbf)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3fb9c1){const _0x1b4992=a152_0x3c2d73;return _0x3fb9c1[_0x1b4992(0xa0)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x131e07){return''+PENDING_ACTIVATION_PREFIX+_0x131e07+'__';}export function isPendingActivationId(_0x23353c){const _0x3ddf7f=a152_0x3c2d73;return _0x23353c[_0x3ddf7f(0xbf)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x12017f){return _0x12017f['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x39c960,_0x1f259a){const _0x2a3cfe=a152_0x3c2d73,_0x4f35ee=_0x39c960+'::'+(_0x1f259a['trim']()||_0x2a3cfe(0xe7)),_0x3af9ce=createHash('sha1')[_0x2a3cfe(0x16d)](_0x4f35ee)['digest'](_0x2a3cfe(0xa8))[_0x2a3cfe(0xa2)](0x0,0xc);return _0x2a3cfe(0x113)+_0x3af9ce;}export function ensureJourneyDefaults(_0xb16eb4){const _0x171b5f=a152_0x3c2d73;!_0xb16eb4['description']&&(_0xb16eb4[_0x171b5f(0xb0)]=''),!_0xb16eb4[_0x171b5f(0xed)]&&(_0xb16eb4['state']=_0x171b5f(0x16e));}export function injectExistingStageIds(_0x27785f,_0x49b23e){const _0x4ca25b=a152_0x3c2d73,_0x4d4fc0=new Map(_0x49b23e[_0x4ca25b(0x107)](_0x5544c9=>[_0x5544c9[_0x4ca25b(0x15c)],_0x5544c9['id']]));for(const _0x166ca5 of _0x27785f){if(!_0x166ca5['id']){const _0x2148ad=_0x4d4fc0[_0x4ca25b(0xec)](_0x166ca5[_0x4ca25b(0x15c)]);_0x2148ad&&(_0x166ca5['id']=_0x2148ad);}}}function a152_0x2923(_0x46c626,_0x24fc88){_0x46c626=_0x46c626-0x79;const _0x423d71=a152_0x423d();let _0x292346=_0x423d71[_0x46c626];return _0x292346;}export function resolveTDFolderPath(_0x12179d,_0x26d825,_0x1d7968){const _0x353b47=a152_0x3c2d73;if(!_0x26d825)return _0x12179d;if(_0x12179d===_0x1d7968||_0x12179d[_0x353b47(0xbf)](_0x1d7968+'/'))return _0x12179d;return _0x12179d?_0x1d7968+'/'+_0x12179d:_0x1d7968;}export function addFoldersToCreate(_0x28fe29,_0x16fded,_0x8e4902){const _0x412c96=a152_0x3c2d73;if(!_0x28fe29)return;if(_0x16fded['has'](_0x28fe29))return;const _0x7b87f2=_0x28fe29['split']('/');let _0x403a33='';for(const _0x358210 of _0x7b87f2){_0x403a33=_0x403a33?_0x403a33+'/'+_0x358210:_0x358210,!_0x16fded[_0x412c96(0x139)](_0x403a33)&&_0x8e4902[_0x412c96(0xda)](_0x403a33);}}export function sortFoldersByDepth(_0x1c7203){const _0x3663b0=a152_0x3c2d73;return[..._0x1c7203][_0x3663b0(0xe2)]((_0x27cc67,_0x5cbff1)=>{const _0x4e48e7=_0x3663b0,_0x3d3a9b=(_0x27cc67[_0x4e48e7(0x9d)](/\//g)||[])[_0x4e48e7(0x165)],_0x736596=(_0x5cbff1[_0x4e48e7(0x9d)](/\//g)||[])[_0x4e48e7(0x165)];return _0x3d3a9b-_0x736596;});}import*as a152_0x5d3d39 from'yaml';import{readFileSync}from'fs';import a152_0x23f524 from'path';import{isJourneyDef,parseYamlString as a152_0x40757c,toYamlString as a152_0x54ed04,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(_0x570194){const _0x365ccd=a152_0x3c2d73;if(Array['isArray'](_0x570194))return'['+_0x570194['map'](_0x161d31=>stableStringify(_0x161d31))[_0x365ccd(0x17a)](',')+']';if(_0x570194&&typeof _0x570194===_0x365ccd(0x160)){const _0x4b97a7=_0x570194,_0x56acb5=Object[_0x365ccd(0x117)](_0x4b97a7)[_0x365ccd(0xe2)](),_0x37b82e=_0x56acb5[_0x365ccd(0x107)](_0x4165de=>'\x22'+_0x4165de+'\x22:'+stableStringify(_0x4b97a7[_0x4165de]));return'{'+_0x37b82e[_0x365ccd(0x17a)](',')+'}';}const _0x215d16=JSON['stringify'](_0x570194);return _0x215d16===undefined?_0x365ccd(0x91):_0x215d16;}function activationSignature(_0x1a7e08){const _0x3c155c=a152_0x3c2d73,_0x1e26cc={'connection':_0x1a7e08['connection'],..._0x1a7e08[_0x3c155c(0xb8)]!==undefined&&{'all_columns':_0x1a7e08['all_columns']},..._0x1a7e08[_0x3c155c(0xfd)]!==undefined&&{'columns':_0x1a7e08[_0x3c155c(0xfd)]},..._0x1a7e08['behavior']!==undefined&&{'behavior':_0x1a7e08[_0x3c155c(0x94)]},..._0x1a7e08[_0x3c155c(0xaa)]!==undefined&&{'schedule':_0x1a7e08[_0x3c155c(0xaa)]},..._0x1a7e08[_0x3c155c(0x133)]!==undefined&&{'notification':_0x1a7e08['notification']},..._0x1a7e08[_0x3c155c(0xdf)]!==undefined&&{'connector_config':_0x1a7e08[_0x3c155c(0xdf)]},..._0x1a7e08['activation_template_id']!==undefined&&{'activation_template_id':_0x1a7e08[_0x3c155c(0x13a)]}};return stableStringify(_0x1e26cc);}async function fetchSegment(_0x466b09,_0x52e88d,_0x1d2515,_0x2f42e3){const _0x81eee5=a152_0x3c2d73,_0x2da1b1=_0x2f42e3?.[_0x81eee5(0x127)](_0x2e04f0=>_0x2e04f0['id']===_0x1d2515);if(_0x2da1b1)return _0x2da1b1;try{return await _0x466b09[_0x81eee5(0xe7)][_0x81eee5(0xc7)](_0x52e88d,_0x1d2515);}catch(_0x41c737){logger[_0x81eee5(0xcb)](_0x81eee5(0x137)+_0x1d2515+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x41c737);try{return await _0x466b09[_0x81eee5(0xe7)][_0x81eee5(0xc3)](_0x1d2515);}catch(_0x1d5e7b){return logger[_0x81eee5(0xcb)](_0x81eee5(0xb1)+_0x1d2515+':\x20'+_0x1d5e7b),null;}}}function recoverSegmentIdsFromPushRecovery(_0x329904,_0x3732c0,_0xf36e7a){const _0x1079d2=a152_0x3c2d73,_0x2fa44a=readPushRecovery(_0x329904[_0x1079d2(0x166)]);if(_0x2fa44a?.['journeyName']===_0x329904[_0x1079d2(0x79)][_0x1079d2(0x15c)])for(const [_0x350d72,_0x912f32]of Object['entries'](_0x2fa44a[_0x1079d2(0xb5)])){const _0x2b21d5=generateDeterministicJourneySegmentName(_0x329904['yamlConfig'][_0x1079d2(0x15c)],_0x350d72);_0x912f32[_0x1079d2(0x181)]===_0x2b21d5&&(_0x3732c0[_0x1079d2(0x11a)](_0x350d72,_0x912f32[_0x1079d2(0x14d)]),_0xf36e7a['set'](_0x350d72,_0x912f32['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x430873,_0x28fd70,_0x3730cd,_0x31f1cb){const _0x3e07da=a152_0x3c2d73;let _0x4556c9;try{_0x4556c9=await _0x430873['segment'][_0x3e07da(0xb3)]({'name':_0x3730cd[_0x3e07da(0xd1)],'description':_0x3730cd[_0x3e07da(0xb0)],'journeyId':_0x3730cd['journeyId'],'rule':_0x31f1cb(_0x3730cd[_0x3e07da(0xa6)],!![]),'countPopulation':!![],'parentFolderId':_0x3730cd[_0x3e07da(0x14c)],'audienceId':_0x3730cd[_0x3e07da(0x119)]});}catch(_0x33701a){const _0xbf35cd=_0x33701a instanceof Error&&_0x33701a[_0x3e07da(0x15f)]['includes']('Name\x20has\x20already\x20been\x20taken');if(_0xbf35cd){const _0x113791=readPushRecovery(_0x28fd70[_0x3e07da(0x166)]),_0x938136=_0x113791?.[_0x3e07da(0x145)]===_0x28fd70[_0x3e07da(0x79)][_0x3e07da(0x15c)]?_0x113791['segments'][_0x3730cd[_0x3e07da(0x114)]]:undefined;if(_0x938136?.[_0x3e07da(0x181)]===_0x3730cd[_0x3e07da(0xd1)])await _0x430873[_0x3e07da(0xe7)][_0x3e07da(0xd9)](_0x3730cd[_0x3e07da(0x119)],_0x938136[_0x3e07da(0x14d)],{'description':_0x3730cd['description'],'rule':_0x31f1cb(_0x3730cd[_0x3e07da(0xa6)],!![]),'countPopulation':!![]}),_0x4556c9=_0x938136[_0x3e07da(0x14d)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x3730cd[_0x3e07da(0x114)]+_0x3e07da(0xe5)+(_0x3e07da(0xd4)+_0x28fd70[_0x3e07da(0x166)][_0x3e07da(0xa0)](/([^/]+)$/,_0x3e07da(0x17f))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x33701a);}else throw _0x33701a;}return saveSegmentToPushRecovery(_0x28fd70[_0x3e07da(0x166)],_0x28fd70[_0x3e07da(0x79)][_0x3e07da(0x15c)],_0x3730cd['localName'],{'segmentId':_0x4556c9,'uniqueServerName':_0x3730cd['uniqueSegmentName'],'createdAt':new Date()[_0x3e07da(0xa1)]()}),_0x4556c9;}export async function prepareSegmentFiles(_0x1bfca7,_0x4bd16c,_0x113493,_0x418bb1,_0x4fef21){const _0x433f83=a152_0x3c2d73,{activationDefToCreateRequest:_0x47c235}=await import(_0x433f83(0x126)),_0x7e14d5=[],_0x1ad7f3=new Set();for(const {yamlConfig:_0x15a19c,folderPath:_0x1c43f9,sourcePath:_0x1e84f3}of _0x1bfca7){const _0x2cf24f=resolveTDFolderPath(_0x1c43f9,_0x418bb1,_0x4fef21),_0x2a36b4=_0x2cf24f+':'+_0x15a19c[_0x433f83(0x15c)],_0x1a5c89=_0x4bd16c[_0x433f83(0x140)][_0x433f83(0xec)](_0x2a36b4),_0x36dc4e=_0x1a5c89?_0x4bd16c[_0x433f83(0x7e)][_0x433f83(0xec)](_0x1a5c89['id'])||[]:[];addFoldersToCreate(_0x2cf24f,_0x4bd16c[_0x433f83(0x13d)],_0x1ad7f3);const _0x42c99d=calculateActivationActions(_0x15a19c[_0x433f83(0xf2)]||[],_0x36dc4e,_0x4bd16c[_0x433f83(0xa3)],_0x4bd16c[_0x433f83(0x11f)]);for(const _0x270b87 of _0x42c99d){(_0x270b87[_0x433f83(0xc6)]==='create'||_0x270b87['type']===_0x433f83(0x16d))&&_0x270b87[_0x433f83(0xe0)]&&(_0x270b87[_0x433f83(0xd3)]=await _0x47c235(_0x270b87[_0x433f83(0xe0)],_0x113493));}const _0x4ce4d0=calculateSegmentDiff(_0x15a19c,_0x1a5c89,_0x36dc4e,_0x4bd16c[_0x433f83(0xa3)],_0x4bd16c[_0x433f83(0x11f)]);_0x7e14d5[_0x433f83(0xfe)]({'relativePath':_0x15a19c['name'],'absolutePath':_0x1e84f3,'yamlConfig':_0x15a19c,'folderPath':_0x2cf24f,'existingSegment':_0x1a5c89,'existingActivations':_0x36dc4e,'isNew':_0x4ce4d0['isNew'],'hasChanges':_0x4ce4d0[_0x433f83(0x93)],'diff':_0x4ce4d0[_0x433f83(0x153)],'activationActions':_0x42c99d});}return{'segmentFiles':_0x7e14d5,'foldersToCreate':_0x1ad7f3};}export async function prepareJourneyFiles(_0x2382e9,_0x37171a,_0x1bcc97,_0x29abb4){const _0x5f5b1a=a152_0x3c2d73,_0x3e2f8d=[],_0x2a1db0=new Set();for(const {yamlConfig:_0x1fca30,folderPath:_0x42d771,sourcePath:_0x397f67}of _0x2382e9){const _0xd7d87e=resolveTDFolderPath(_0x42d771,_0x1bcc97,_0x29abb4),_0x432b09=_0xd7d87e+':'+_0x1fca30[_0x5f5b1a(0x15c)],_0x3289fe=_0x37171a[_0x5f5b1a(0x129)]['get'](_0x432b09);let _0xcade70,_0x4c805f;if(_0x3289fe&&_0x3289fe[_0x5f5b1a(0x165)]>0x0){const _0x3cd26e=buildLocalExpandedRuleMappings(_0x1fca30),{createYamlContext:_0x4a14ac,prefetchJourneySegments:_0x38ab4a}=createPushYamlContextForBundle(_0x37171a[_0x5f5b1a(0x143)],_0x37171a['parentId'],_0x37171a[_0x5f5b1a(0xdd)],_0x3cd26e,_0x37171a['idToEmailMap'],_0x37171a[_0x5f5b1a(0x11f)],_0x37171a[_0x5f5b1a(0x116)],_0x37171a['journeyById']);await _0x38ab4a(_0x3289fe[_0x5f5b1a(0x107)](_0x18e020=>_0x18e020['id']));const _0x4a896f=await _0x37171a[_0x5f5b1a(0x143)][_0x5f5b1a(0xf8)][_0x5f5b1a(0x156)](_0x3289fe[0x0][_0x5f5b1a(0x122)]),_0x3873aa=hasMultipleVersions(_0x1fca30),_0x1d07b4=async _0x44618c=>{const _0xcf57b5=_0x5f5b1a,_0xb99896=_0x37171a[_0xcf57b5(0xc1)]?.[_0xcf57b5(0xec)](_0x44618c);if(_0xb99896)return _0xb99896;return _0x37171a[_0xcf57b5(0xe3)]({'journeyId':_0x44618c,'journeyName':_0x1fca30[_0xcf57b5(0x15c)],'isMultiVersion':_0x3289fe['length']>0x1});};if(_0x3873aa&&_0x3289fe[_0x5f5b1a(0x165)]>0x1){const _0x3d6b68=[];for(const _0x4c10c4 of _0x3289fe){const _0x30ebc1=_0x4c10c4[_0x5f5b1a(0x136)]||0x1;_0x37171a[_0x5f5b1a(0x13e)]?.[_0x5f5b1a(0x16d)](_0x5f5b1a(0xcf)+_0x1fca30[_0x5f5b1a(0x15c)]+'\x20v'+_0x30ebc1);const _0x1dfe0b=await _0x1d07b4(_0x4c10c4['id']),_0x50db79=_0x4a14ac(_0x4c10c4['id']),_0x60141a=await journeyResponseToDef(_0x1dfe0b,_0x50db79);_0x3d6b68[_0x5f5b1a(0xfe)]({'item':_0x4c10c4,'yaml':_0x60141a});}const _0x1013ab=buildLocalRuleToNameMappingFromJourney(_0x1fca30);_0x4c805f=buildMergedJourneyDef(_0x3d6b68,_0x1013ab,_0x4a896f);const _0x2d3723=Math['max'](..._0x3d6b68[_0x5f5b1a(0x107)](_0x4eb071=>_0x4eb071['item']['versionNumber']||0x0)),_0x4d3b22=_0x3289fe['find'](_0x1b787b=>(_0x1b787b[_0x5f5b1a(0x136)]||0x0)===_0x2d3723);_0x4d3b22&&(_0x37171a['progress']?.[_0x5f5b1a(0x16d)](_0x5f5b1a(0xcf)+_0x1fca30['name']+'\x20v'+_0x2d3723),_0xcade70=await _0x1d07b4(_0x4d3b22['id']));}else{const _0x1fbc45=_0x3289fe[_0x3289fe['length']-0x1];_0x37171a[_0x5f5b1a(0x13e)]?.[_0x5f5b1a(0x16d)](_0x5f5b1a(0xcf)+_0x1fca30[_0x5f5b1a(0x15c)]),_0xcade70=await _0x1d07b4(_0x1fbc45['id']);const _0x1320b3=_0x4a14ac(_0x1fbc45['id']),_0x4e8e24=await journeyResponseToDef(_0xcade70,_0x1320b3),_0x15e48=buildLocalRuleToNameMappingFromJourney(_0x1fca30);_0x4c805f=buildMergedJourneyDef([{'item':_0x1fbc45,'yaml':_0x4e8e24}],_0x15e48,_0x4a896f);}}addFoldersToCreate(_0xd7d87e,_0x37171a[_0x5f5b1a(0x13d)],_0x2a1db0);const _0x2dc75b=calculateJourneyDiff(_0x1fca30,_0x4c805f);_0x3e2f8d['push']({'relativePath':_0x1fca30[_0x5f5b1a(0x15c)],'absolutePath':_0x397f67,'yamlConfig':_0x1fca30,'folderPath':_0xd7d87e,'existingJourney':_0xcade70,'isNew':_0x2dc75b['isNew'],'hasChanges':_0x2dc75b['hasChanges'],'diff':_0x2dc75b[_0x5f5b1a(0x153)]});}return{'journeyFiles':_0x3e2f8d,'foldersToCreate':_0x2a1db0};}export function calculateActivationActions(_0x5cce3c,_0x3c1143,_0x42093c,_0x5c922f){const _0xf2ea37=a152_0x3c2d73,_0x36d653=[],_0x1cf2c4=new Map();for(const _0x59d0fd of _0x3c1143){_0x1cf2c4[_0xf2ea37(0x11a)](_0x59d0fd[_0xf2ea37(0x15c)],_0x59d0fd);}const _0x994a64=new Map();for(const _0x1a164c of _0x5cce3c){_0x994a64['set'](_0x1a164c[_0xf2ea37(0x15c)],_0x1a164c);}for(const _0x307a9b of _0x5cce3c){const _0xd13d90=_0x1cf2c4[_0xf2ea37(0xec)](_0x307a9b[_0xf2ea37(0x15c)]);if(!_0xd13d90)_0x36d653[_0xf2ea37(0xfe)]({'type':_0xf2ea37(0x124),'name':_0x307a9b['name'],'yamlActivation':_0x307a9b});else{const _0xbfca6c=activationResponseToDef(_0xd13d90,_0x42093c,_0x5c922f),_0x4021da=a152_0x5d3d39[_0xf2ea37(0xf3)](_0xbfca6c),_0x599ade=a152_0x5d3d39['stringify'](_0x307a9b);_0x4021da!==_0x599ade&&_0x36d653[_0xf2ea37(0xfe)]({'type':_0xf2ea37(0x16d),'name':_0x307a9b['name'],'yamlActivation':_0x307a9b,'existingActivation':_0xd13d90});}}for(const _0x5f5c8b of _0x3c1143){!_0x994a64['has'](_0x5f5c8b['name'])&&_0x36d653[_0xf2ea37(0xfe)]({'type':_0xf2ea37(0xfb),'name':_0x5f5c8b[_0xf2ea37(0x15c)],'existingActivation':_0x5f5c8b});}return _0x36d653;}function calculateYamlDiff(_0x332acf,_0x25aa62){if(_0x25aa62){const _0x4be4af=generateDiff(_0x25aa62,_0x332acf),_0x370f8f=hasChanges(_0x4be4af);return{'isNew':![],'hasChanges':_0x370f8f,'diff':_0x370f8f?formatDiffWithColors(_0x4be4af):undefined};}const _0x317e12=generateDiff('',_0x332acf);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x317e12)};}export function calculateSegmentDiff(_0x2be30b,_0x132e4b,_0x2c8745,_0x54d9f1,_0x31e564){const _0x53f0a1=segmentToYamlString(_0x2be30b),_0x1c42b3=_0x132e4b?segmentToYamlString(segmentWithActivationsToYaml(_0x132e4b,_0x2c8745,undefined,_0x54d9f1,_0x31e564)):undefined;return calculateYamlDiff(_0x53f0a1,_0x1c42b3);}export function calculateJourneyDiff(_0xa502bc,_0x5ed897){const _0x10538a=normalizeJourneyDef(_0xa502bc,_0xa502bc),_0x4a27f7=a152_0x54ed04(_0x10538a),_0x1ea6ec=_0x5ed897?a152_0x54ed04(normalizeJourneyDef(_0x5ed897,_0xa502bc)):undefined;return calculateYamlDiff(_0x4a27f7,_0x1ea6ec);}export function findSegmentsToDelete(_0x3f1fa4,_0x108f4f,_0x574b2e,_0x114b9b,_0x358ec4){const _0x406f6b=a152_0x3c2d73,_0x4134e7=new Set();for(const {yamlConfig:_0x461f15,folderPath:_0x2b8e6d}of _0x108f4f){_0x4134e7[_0x406f6b(0xda)](_0x2b8e6d+':'+_0x461f15[_0x406f6b(0x15c)]);}return _0x3f1fa4[_0x406f6b(0xdc)](_0x48ce79=>{const _0x23d3f4=_0x406f6b,_0x4a00e0=_0x48ce79[_0x23d3f4(0x16a)]?_0x574b2e['get'](_0x48ce79[_0x23d3f4(0x16a)][_0x23d3f4(0x7f)]())||'':'',_0x578990=_0x4a00e0+':'+_0x48ce79[_0x23d3f4(0x15c)];if(_0x4134e7[_0x23d3f4(0x139)](_0x578990))return![];if(_0x358ec4)return _0x4a00e0===_0x114b9b||_0x4a00e0[_0x23d3f4(0xbf)](_0x114b9b+'/');return!![];});}export function findJourneysToDelete(_0x5940a3,_0x483f9b,_0x3b1aa2,_0x5dc16a,_0x87ed70){const _0x10ef1d=a152_0x3c2d73,_0x3f0171=new Set();for(const {yamlConfig:_0x5601f6,folderPath:_0x1fe0df}of _0x483f9b){_0x3f0171[_0x10ef1d(0xda)](_0x1fe0df+':'+_0x5601f6[_0x10ef1d(0x15c)]);}return _0x5940a3[_0x10ef1d(0xdc)](_0x5a2c78=>{const _0x5c400f=_0x10ef1d,_0x481d6f=_0x5a2c78[_0x5c400f(0x14c)]?_0x3b1aa2[_0x5c400f(0xec)](_0x5a2c78[_0x5c400f(0x14c)])||'':'',_0x243117=_0x481d6f+':'+_0x5a2c78[_0x5c400f(0x169)];if(_0x3f0171[_0x5c400f(0x139)](_0x243117))return![];if(_0x87ed70)return _0x481d6f===_0x5dc16a||_0x481d6f[_0x5c400f(0xbf)](_0x5dc16a+'/');return!![];});}export function buildSegmentLookupMap(_0x3a8f8f,_0x11b528){const _0x4d240e=a152_0x3c2d73,_0x4c1047=new Map();for(const _0x22700d of _0x3a8f8f){const _0x187aae=_0x22700d[_0x4d240e(0x16a)]?_0x11b528[_0x4d240e(0xec)](_0x22700d['segmentFolderId'][_0x4d240e(0x7f)]())||'':'',_0x568de0=_0x187aae+':'+_0x22700d['name'];_0x4c1047[_0x4d240e(0x11a)](_0x568de0,_0x22700d);}return _0x4c1047;}export function buildSegmentNameToIdMap(_0x6bd8f){const _0x713271=a152_0x3c2d73,_0x17c0fb=new Map();for(const _0x18e82c of _0x6bd8f){_0x17c0fb[_0x713271(0x11a)](_0x18e82c[_0x713271(0x15c)],_0x18e82c['id']);}return _0x17c0fb;}export function buildJourneyBundleLookupMap(_0x381104,_0x504117){const _0x5a2bbe=a152_0x3c2d73,_0x162d9a=new Map();for(const _0x50e66f of _0x381104){const _0x29fdc5=_0x50e66f[_0x5a2bbe(0x14c)]?_0x504117[_0x5a2bbe(0xec)](_0x50e66f[_0x5a2bbe(0x14c)])||'':'',_0x2a2060=_0x29fdc5+':'+_0x50e66f[_0x5a2bbe(0x169)];!_0x162d9a[_0x5a2bbe(0x139)](_0x2a2060)&&_0x162d9a[_0x5a2bbe(0x11a)](_0x2a2060,[]),_0x162d9a[_0x5a2bbe(0xec)](_0x2a2060)[_0x5a2bbe(0xfe)](_0x50e66f);}for(const _0x2f7a41 of _0x162d9a[_0x5a2bbe(0xe8)]()){_0x2f7a41['sort']((_0x8c066c,_0x2a04f3)=>(_0x8c066c['versionNumber']||0x0)-(_0x2a04f3[_0x5a2bbe(0x136)]||0x0));}return _0x162d9a;}function a152_0x423d(){const _0x56fe6a=['find','branches','journeyBundlesByFolderAndName','conditionTimeoutDuration','waitStep','\x20error(s)','\x27\x20wait\x20condition','stage\x20\x27','relationships','Segment\x20not\x20found:\x20','./journey-yaml.js','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','notification','logDeleted','idToName','versionNumber','getSegment\x20failed\x20for\x20','Activation\x20not\x20found:\x20','has','activation_template_id','journeyStages','segment_deleted','folderPathToId','progress','run_after_journey_refresh','segmentByFolderAndName','journeys','with','deps','connection','journeyName','252292OwiYUt','reduce','data','rule','getJourney','goal','folderId','segmentId','size','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','Stage\x20\x27','day','diff','existingJourney','activation_created','getLatestJourneyId','toLowerCase','logSuccess','journey_updating','decision_point','onProgress','name','index','NOT_FOUND','message','object','verbose','\x27\x20milestone','activation_deleting','Creating\x20folder\x20\x27','length','absolutePath',').\x20','all','journeyBundleName','segmentFolderId','createdSegmentId','4PoPVYJ','update','draft','existingSegment','conditionSegmentId','parseDocument','activation_deleted','embedded_activation_creating','attributes','Updating\x20segment\x20\x27','\x27\x20entry\x20criteria','flatMap','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Deleted\x20activation\x20\x27','join','existingActivation','SEGMENT_NOT_FOUND','activationContext','16504851bMSlzi','.$1.push-recovery.json','folder_creating','uniqueServerName','yamlConfig','parse','folder_created','logInfo','\x27\x20to\x20local\x20\x27','activationsBySegmentId','toString','7IYyKSb','steps','some','errors','activationParams','listActivations','resolveJourneyId','conditionTimeoutUnit','journey_creating','utf-8','WaitStep','1696755NEvOgO','embeddedSegmentNameToId','waitStepType','../../utils/async.js','effectiveFolderId','parentSegmentFolder','null','9CiZgfi','hasChanges','behavior','stages','nameToId','max','nameToType','createFolder','JOURNEY_UPDATE_ERROR','Updated\x20journey\x20\x27','buildUserMaps','match','Entry\x20criteria:\x20','journeyId','replace','toISOString','slice','idToEmailMap','5269136bwdyOa','created','resolvedRule','Deleted\x20segment\x20\x27','hex','createActivation','schedule','INTERNAL','segment_created','\x0a\x20\x20','relative','Activation','description','getSegmentEntity\x20also\x20failed\x20for\x20','SEGMENT_UPDATE_ERROR','createJourneySegment','\x20(referenced\x20in\x20journey\x20','segments','Failed\x20to\x20resolve\x20segment\x20','from','all_columns','user','\x27\x20by\x20rule\x20content','deleted','entries','isNew','Segment\x20not\x20found','startsWith','valid','journeyById','segment_updated','getSegmentEntity','createSegment','unchanged','type','getSegment','entryCriteria','segmentNameToId','Failed\x20to\x20','debug','embedded_segment_created','rootFolderId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Fetching\x20','activationActions','uniqueSegmentName','embedded_segment_creating','validatedRequest','Delete\x20the\x20push\x20recovery\x20file\x20(','folder','tdx.sdk.push-workflow','Condition','):\x20','updateSegmentById','add','journey_updated','filter','existingSegments','\x27\x20from\x20file:\x20','connector_config','yamlActivation','action','sort','fetchJourney','segment_creating','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','deleteActivation','segment','values','Updated\x20segment\x20\x27','dirname','results','get','state','embedded_activation_created','goal\x20criteria','conditions','__pending_act_','activations','stringify','exitCriterias','ACTIVATION_SYNTAX_ERROR','Journey\x20\x27','journeyActivationNameToId','journey','633549tPyCOI','\x27...','delete','DecisionPoint','columns','push','folderPath','skipSegments','split','updated','Created\x20segment\x20\x27','4qdDDtV','6803070fTgGOp','activation_updated','map','ACTIVATION_UPDATE_ERROR','Created\x20journey\x20\x27','getActivation','milestone','activation_updating','Updated\x20activation\x20\x27','journeyActivationStepId','Failed\x20to\x20fetch\x20referenced\x20segment\x20','activation_creating','entry','withProgress','journey_entry_criteria_','localName','resolveSegment','activationStepsById','keys','\x27\x20exit\x20criteria','parentId','set','4640328lsCxMW','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','waitStepUnit','JOURNEY_SYNTAX_ERROR','connectionIdToNameMap','logWarning','\x27\x20for\x20','journeyBundleId','list','create','journey_created','./child-segment-yaml.js'];a152_0x423d=function(){return _0x56fe6a;};return a152_0x423d();}export function collectFoldersToCreate(_0x4431b8,_0xda4b11){const _0x1999d9=a152_0x3c2d73,_0x4e302d=new Set();for(const _0x41703d of _0x4431b8){if(!_0x41703d)continue;if(_0xda4b11['has'](_0x41703d))continue;const _0x460678=_0x41703d['split']('/');let _0x340877='';for(const _0x1df18d of _0x460678){_0x340877=_0x340877?_0x340877+'/'+_0x1df18d:_0x1df18d,!_0xda4b11[_0x1999d9(0x139)](_0x340877)&&_0x4e302d[_0x1999d9(0xda)](_0x340877);}}return _0x4e302d;}export function parseAndClassifyYamlFiles(_0x95c4c6,_0x1ece8e,_0xab7d32){const _0x20c74d=a152_0x3c2d73,_0x311715=[],_0x215fc1=[];for(const _0xd7a3e6 of _0x95c4c6){const _0x13f4d4=a152_0x23f524[_0x20c74d(0xae)](_0x1ece8e,a152_0x23f524[_0x20c74d(0xea)](_0xd7a3e6)),_0x7159d8=_0x13f4d4==='.'?'':_0x13f4d4[_0x20c74d(0xa0)](/\\/g,'/'),_0x10b42f=readFileSync(_0xd7a3e6,_0x20c74d(0x89)),_0x509283=a152_0x5d3d39[_0x20c74d(0x7a)](_0x10b42f);if(isJourneyDef(_0x509283)){const _0x5197cd=a152_0x40757c(_0x10b42f);_0x215fc1[_0x20c74d(0xfe)]({'yamlConfig':_0x5197cd,'folderPath':_0x7159d8,'sourcePath':_0xd7a3e6});}else{if(!_0xab7d32?.[_0x20c74d(0x100)]){const _0x37031b=parseSegmentYamlFile(_0x10b42f),_0x8c9713=normalizeChildSegmentYaml(_0x37031b);_0x311715[_0x20c74d(0xfe)]({'yamlConfig':_0x8c9713,'folderPath':_0x7159d8,'sourcePath':_0xd7a3e6});}}}return{'segments':_0x311715,'journeys':_0x215fc1};}export function validateParsedFiles(_0x41f06c,_0x422c0b){const _0x3a7d09=a152_0x3c2d73,_0x68d31d=[];for(const {yamlConfig:_0x391d78,sourcePath:_0x1cd536}of _0x41f06c['segments']){const _0x340591=readFileSync(_0x1cd536,'utf-8'),_0x144a0e=a152_0x5d3d39[_0x3a7d09(0x171)](_0x340591),_0x236a0a=validateSegmentDef(_0x391d78,{'source':_0x340591,'document':_0x144a0e},{'skipSchema':!![]});if(!_0x236a0a[_0x3a7d09(0xc0)]){const _0x17e1c9=a152_0x23f524[_0x3a7d09(0xae)](_0x422c0b,_0x1cd536);_0x68d31d[_0x3a7d09(0xfe)]({'filePath':_0x17e1c9,'source':_0x340591,'result':_0x236a0a,'isJourney':![]});}}for(const {yamlConfig:_0x506aa2,sourcePath:_0x50e363}of _0x41f06c[_0x3a7d09(0x141)]){const _0x11fbd8=readFileSync(_0x50e363,_0x3a7d09(0x89)),_0x597280=a152_0x5d3d39[_0x3a7d09(0x171)](_0x11fbd8),_0xe54b45=validateJourneyDef(_0x506aa2,{'source':_0x11fbd8,'document':_0x597280},{'skipSchema':!![]});if(!_0xe54b45['valid']){const _0x533e4b=a152_0x23f524[_0x3a7d09(0xae)](_0x422c0b,_0x50e363);_0x68d31d[_0x3a7d09(0xfe)]({'filePath':_0x533e4b,'source':_0x11fbd8,'result':_0xe54b45,'isJourney':!![]});}}return _0x68d31d;}export function formatValidationErrors(_0x280d9a){const _0x140402=a152_0x3c2d73,_0x56af3b=[];for(const {filePath:_0x1727f5,source:_0x52b974,result:_0x44582c,isJourney:_0x3012e9}of _0x280d9a){const _0x15763f=_0x3012e9?'journey':_0x140402(0xe7);_0x56af3b[_0x140402(0xfe)]('\x0a'+_0x1727f5+'\x20('+_0x15763f+_0x140402(0xd8)+_0x44582c[_0x140402(0x83)][_0x140402(0x165)]+_0x140402(0x12c)),_0x56af3b[_0x140402(0xfe)](formatValidationResult(_0x44582c,_0x52b974,_0x1727f5));}return _0x56af3b[_0x140402(0x17a)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x109d0c){const _0x5c84a4=a152_0x3c2d73,_0x5f571d=new Set(),_0x40cfaf=new Map(),_0x7d3ff3=collectSegmentUsageCounts(_0x109d0c);if(_0x109d0c[_0x5c84a4(0xb5)])for(const [_0x58a6a3,_0x3265a8]of Object[_0x5c84a4(0xbc)](_0x109d0c[_0x5c84a4(0xb5)])){_0x5f571d['add'](_0x58a6a3);if(_0x3265a8[_0x5c84a4(0x149)]){const _0x2c5ff9=yamlRuleToApi(_0x3265a8['rule']),_0x51f418=apiRuleToYaml(_0x2c5ff9);_0x40cfaf[_0x5c84a4(0x11a)](_0x58a6a3,_0x51f418);}}const _0x31d650=new Map();let _0x1464a5=0x0;for(const [_0x4a4fda,_0x244b3f]of _0x40cfaf){const _0x31ca2d=serializeExpandedRule(_0x244b3f,_0x40cfaf),_0x4b81df=_0x31d650[_0x5c84a4(0xec)](_0x31ca2d)||[];_0x4b81df[_0x5c84a4(0xfe)]({'name':_0x4a4fda,'index':_0x1464a5}),_0x31d650[_0x5c84a4(0x11a)](_0x31ca2d,_0x4b81df),_0x1464a5++;}const _0x4fbaaa=new Map();for(const [_0xa10fea,_0x2a47f7]of _0x31d650){const _0x2014b4=_0x2a47f7[_0x5c84a4(0xa2)]()[_0x5c84a4(0xe2)]((_0x2db9ce,_0x34238d)=>{const _0x324fb8=_0x5c84a4,_0x11b33c=_0x7d3ff3[_0x324fb8(0xec)](_0x2db9ce[_0x324fb8(0x15c)])||0x0,_0x3d2545=_0x7d3ff3[_0x324fb8(0xec)](_0x34238d[_0x324fb8(0x15c)])||0x0;if(_0x11b33c!==_0x3d2545)return _0x3d2545-_0x11b33c;return _0x2db9ce[_0x324fb8(0x15d)]-_0x34238d[_0x324fb8(0x15d)];})[_0x5c84a4(0x107)](_0x3e005c=>_0x3e005c[_0x5c84a4(0x15c)]),_0x286e54=[];for(const _0x538390 of _0x2014b4){const _0x978e2e=_0x7d3ff3[_0x5c84a4(0xec)](_0x538390)||0x0,_0x5965e7=Math[_0x5c84a4(0x97)](_0x978e2e,0x1);for(let _0x2fc4f0=0x0;_0x2fc4f0<_0x5965e7;_0x2fc4f0++){_0x286e54[_0x5c84a4(0xfe)](_0x538390);}}_0x4fbaaa[_0x5c84a4(0x11a)](_0xa10fea,_0x286e54);}return{'existingLocalSegmentNames':_0x5f571d,'localSegmentRules':_0x40cfaf,'localExpandedRuleToNames':_0x4fbaaa};}export function createSegmentIdResolver(_0xb06e6,_0x131aa2){return async _0x3b112c=>{const _0x57a761=a152_0x2923,_0x4c706d=_0xb06e6['get'](_0x3b112c);if(!_0x4c706d)throw new SDKError(ErrorCode[_0x57a761(0x17c)],'Segment\x20not\x20found:\x20'+_0x3b112c+_0x57a761(0x178)+_0x131aa2+'\x27)');return _0x4c706d;};}export function extractRootFolderId(_0x4a09fb){const _0x358ab6=a152_0x3c2d73;return _0x4a09fb[_0x358ab6(0x12f)]?.[_0x358ab6(0x90)]?.['data']?.['id']||_0x4a09fb[_0x358ab6(0x12f)]?.['parentFolder']?.[_0x358ab6(0x148)]?.['id'];}export function buildConnectionMaps(_0x2e3d8f){const _0x391c8d=a152_0x3c2d73,_0x31396f=new Map(),_0x266e86=new Map(),_0x482550=new Map();for(const _0x2f6266 of _0x2e3d8f){_0x31396f['set'](_0x2f6266[_0x391c8d(0x15c)],parseInt(_0x2f6266['id'],0xa)),_0x266e86[_0x391c8d(0x11a)](_0x2f6266['id'],_0x2f6266[_0x391c8d(0x15c)]),_0x482550['set'](_0x2f6266[_0x391c8d(0x15c)],_0x2f6266[_0x391c8d(0xc6)]);}return{'nameToId':_0x31396f,'idToName':_0x266e86,'nameToType':_0x482550};}export function calculatePushStats(_0x54f13e,_0x549ead,_0x59c5d8,_0x2123d6,_0x29b391,_0x5c33b9,_0x279f87){const _0x2cb842=a152_0x3c2d73,_0xe5a48f=_0x54f13e[_0x2cb842(0xdc)](_0x9371b1=>_0x9371b1['isNew']),_0x99d7cb=_0x54f13e[_0x2cb842(0xdc)](_0x732c2f=>!_0x732c2f[_0x2cb842(0xbd)]&&_0x732c2f[_0x2cb842(0x93)]),_0x34db52=_0x54f13e[_0x2cb842(0xdc)](_0x19d3d7=>!_0x19d3d7[_0x2cb842(0xbd)]&&!_0x19d3d7[_0x2cb842(0x93)]),_0x39a05e=_0x5c33b9?_0x2123d6:[],_0x23c7e8=_0x549ead[_0x2cb842(0xdc)](_0x44aa2e=>_0x44aa2e[_0x2cb842(0xbd)]),_0x49f5d0=_0x549ead[_0x2cb842(0xdc)](_0x258e93=>!_0x258e93[_0x2cb842(0xbd)]&&_0x258e93['hasChanges']),_0x4c7c45=_0x549ead[_0x2cb842(0xdc)](_0x35c79d=>!_0x35c79d[_0x2cb842(0xbd)]&&!_0x35c79d[_0x2cb842(0x93)]),_0xf080e0=_0x5c33b9?_0x29b391:[],_0x2d54bf=_0x54f13e[_0x2cb842(0x177)](_0x5976cc=>_0x5976cc[_0x2cb842(0xd0)]),_0x17b682=_0x2d54bf[_0x2cb842(0xdc)](_0x3fcbbb=>_0x3fcbbb[_0x2cb842(0xc6)]===_0x2cb842(0x124)),_0x4d5e33=_0x2d54bf[_0x2cb842(0xdc)](_0x15332e=>_0x15332e[_0x2cb842(0xc6)]==='update'),_0x2c62b8=_0x2d54bf[_0x2cb842(0xdc)](_0x5e9fa9=>_0x5e9fa9[_0x2cb842(0xc6)]==='delete'),_0x1d2631=Array[_0x2cb842(0xb7)](_0x59c5d8)['sort'](),_0xe855a8=_0x279f87?![]:_0xe5a48f['length']>0x0||_0x99d7cb['length']>0x0||_0x39a05e[_0x2cb842(0x165)]>0x0,_0x45def2=_0x23c7e8[_0x2cb842(0x165)]>0x0||_0x49f5d0[_0x2cb842(0x165)]>0x0||_0xf080e0[_0x2cb842(0x165)]>0x0,_0x16da27=_0x279f87?![]:_0x2d54bf[_0x2cb842(0x165)]>0x0,_0x39329d=_0x1d2631['length']>0x0;return{'segments':{'new':_0xe5a48f,'changed':_0x99d7cb,'unchanged':_0x34db52,'toDelete':_0x39a05e},'journeys':{'new':_0x23c7e8,'changed':_0x49f5d0,'unchanged':_0x4c7c45,'toDelete':_0xf080e0},'activations':{'all':_0x2d54bf,'toCreate':_0x17b682,'toUpdate':_0x4d5e33,'toDelete':_0x2c62b8},'folders':{'toCreate':_0x1d2631},'counts':{'segments':{'new':_0xe5a48f[_0x2cb842(0x165)],'changed':_0x99d7cb[_0x2cb842(0x165)],'unchanged':_0x34db52[_0x2cb842(0x165)],'toDelete':_0x39a05e[_0x2cb842(0x165)]},'journeys':{'new':_0x23c7e8[_0x2cb842(0x165)],'changed':_0x49f5d0[_0x2cb842(0x165)],'unchanged':_0x4c7c45['length'],'toDelete':_0xf080e0[_0x2cb842(0x165)]},'activations':{'create':_0x17b682[_0x2cb842(0x165)],'update':_0x4d5e33['length'],'delete':_0x2c62b8[_0x2cb842(0x165)]},'folders':_0x1d2631[_0x2cb842(0x165)]},'hasChanges':_0xe855a8||_0x45def2||_0x16da27||_0x39329d};}export async function buildPushExecutionContext(_0x5f2cb4,_0x5235cb,_0x33b376,_0x54ba83,_0x38811a,_0xd54054){const _0x43e2be=a152_0x3c2d73,_0x1b5138=extractRootFolderId(_0x33b376),{pathToId:_0x299a7b,idToPath:_0x465295}=buildFolderMaps(_0x38811a),_0x165b36=buildSegmentNameToIdMap(_0x54ba83),_0x3d59f3=new Map(),{batchAsync:_0x5e2c85}=await import(_0x43e2be(0x8e)),[_0xa84ea7,_0x23bed0]=await Promise[_0x43e2be(0x168)]([_0x5f2cb4[_0x43e2be(0xb9)][_0x43e2be(0x9c)](),_0x5f2cb4[_0x43e2be(0x144)][_0x43e2be(0x123)](),((async()=>{const _0x5b9988=_0x43e2be;!_0xd54054&&_0x54ba83[_0x5b9988(0x165)]>0x0&&await _0x5e2c85(_0x54ba83,async _0x260766=>{const _0x10f49c=_0x5b9988,_0x3517ec=await _0x5f2cb4[_0x10f49c(0xe7)][_0x10f49c(0x85)](_0x5235cb,_0x260766['id']);_0x3d59f3[_0x10f49c(0x11a)](_0x260766['id'],_0x3517ec);});})())]),{emailToId:_0x38b34d,idToEmail:_0x22a191}=_0xa84ea7,_0x226b7a=buildConnectionMaps(_0x23bed0);return{'rootFolderId':_0x1b5138,'folderPathToId':_0x299a7b,'folderIdToPath':_0x465295,'segmentNameToId':_0x165b36,'activationsBySegmentId':_0x3d59f3,'emailToIdMap':_0x38b34d,'idToEmailMap':_0x22a191,'connectionNameToIdMap':_0x226b7a[_0x43e2be(0x96)],'connectionIdToNameMap':_0x226b7a[_0x43e2be(0x135)],'connectionNameToTypeMap':_0x226b7a[_0x43e2be(0x98)]};}export function createPushYamlContextForBundle(_0x5ea4c1,_0x101107,_0x16ccd8,_0x2fb303,_0xbcab42,_0x257f31,_0x463b6f,_0x5d5f08){const {existingLocalSegmentNames:_0xc5c0d3,localExpandedRuleToNames:_0x1650f3}=_0x2fb303,_0x152087=new Set(),_0x178ebf=new Map(),_0x455e69=new Map(),_0x52987f=new Map(),_0x321e7f=createJumpTargetCache(),_0x5d0cc=new Map(),_0x831565=new Map(),_0x29a141=new Set();let _0xb94c37;const _0x2b4cd0=_0x17b4eb=>{const _0x20b664={'resolveSegment':async _0x13d9da=>{const _0x5ac1f6=a152_0x2923,_0x230548=_0x52987f[_0x5ac1f6(0xec)](_0x13d9da);if(_0x230548!==undefined)return{'name':_0x230548,'isJourneyLocal':!![]};try{const _0xa4dfa7=await fetchSegment(_0x5ea4c1,_0x101107,_0x13d9da,_0x16ccd8);if(!_0xa4dfa7)throw new Error(_0x5ac1f6(0xbe));const _0x1339fd=generateJourneyLocalName(_0xa4dfa7[_0x5ac1f6(0x15c)]),_0x500798=_0xa4dfa7['kind']===SEGMENT_KIND_JOURNEY&&_0x1339fd!==undefined;let _0x434e1b=_0xa4dfa7[_0x5ac1f6(0x15c)],_0x3a6c12;if(_0x500798&&_0xa4dfa7[_0x5ac1f6(0x149)]){const _0x38f99c=apiRuleToYaml(_0xa4dfa7[_0x5ac1f6(0x149)]);_0x831565[_0x5ac1f6(0x11a)](_0x13d9da,_0x38f99c);const _0x38805e=async _0x323518=>{const _0x1d03f3=_0x5ac1f6,_0x2624cc=collectSegmentRefsFromRule(_0x323518);for(const _0x40be39 of _0x2624cc){if(!_0x831565[_0x1d03f3(0x139)](_0x40be39))try{const _0xe21801=await fetchSegment(_0x5ea4c1,_0x101107,_0x40be39,_0x16ccd8);if(_0xe21801?.['rule']){const _0x1f2230=apiRuleToYaml(_0xe21801['rule']);_0x831565[_0x1d03f3(0x11a)](_0x40be39,_0x1f2230),await _0x38805e(_0x1f2230);}}catch(_0x1f3e84){logger[_0x1d03f3(0xcb)](_0x1d03f3(0x10f)+_0x40be39+':\x20'+_0x1f3e84);}}};await _0x38805e(_0x38f99c);const _0x4cd296=serializeExpandedRule(_0x38f99c,_0x831565),_0x52d6ec=_0x1650f3[_0x5ac1f6(0xec)](_0x4cd296);if(_0x52d6ec&&_0x52d6ec['length']>0x0){const _0x1de193=_0x178ebf[_0x5ac1f6(0xec)](_0x4cd296)||0x0,_0xc9f792=_0x52d6ec[_0x1de193]||_0x52d6ec[_0x52d6ec[_0x5ac1f6(0x165)]-0x1];_0x178ebf[_0x5ac1f6(0x11a)](_0x4cd296,_0x1de193+0x1),_0x434e1b=_0xc9f792,_0x152087[_0x5ac1f6(0xda)](_0x434e1b),_0x52987f['set'](_0x13d9da,_0x434e1b);const _0x51ab80=await resolveRuleSegmentRefs(_0x38f99c,async _0x3ce9c8=>{const _0x9d3e3c=_0x5ac1f6,_0x248117=_0x52987f[_0x9d3e3c(0xec)](_0x3ce9c8);if(_0x248117)return _0x248117;const _0x323a3d=await _0xb94c37['resolveSegment'](_0x3ce9c8);return _0x323a3d[_0x9d3e3c(0x15c)];});_0x3a6c12={'description':_0xa4dfa7[_0x5ac1f6(0xb0)],'rule':_0x51ab80};}else{const _0xb361b5=_0x5d0cc[_0x5ac1f6(0xec)](_0x4cd296);if(_0xb361b5)_0x434e1b=_0xb361b5,_0x52987f[_0x5ac1f6(0x11a)](_0x13d9da,_0x434e1b);else{if(_0x1339fd){let _0x37e0da=_0x1339fd,_0x1d92bf=0x2;while(_0x152087[_0x5ac1f6(0x139)](_0x37e0da)||_0xc5c0d3[_0x5ac1f6(0x139)](_0x37e0da)){_0x37e0da=_0x1339fd+'_'+_0x1d92bf,_0x1d92bf++;}_0x152087[_0x5ac1f6(0xda)](_0x37e0da),_0x434e1b=_0x37e0da;}_0x52987f[_0x5ac1f6(0x11a)](_0x13d9da,_0x434e1b),_0x5d0cc[_0x5ac1f6(0x11a)](_0x4cd296,_0x434e1b);const _0x402461=await resolveRuleSegmentRefs(_0x38f99c,async _0x2b69a9=>{const _0x2af433=_0x5ac1f6,_0x4dbbde=_0x52987f[_0x2af433(0xec)](_0x2b69a9);if(_0x4dbbde)return _0x4dbbde;const _0x321735=await _0xb94c37[_0x2af433(0x115)](_0x2b69a9);return _0x321735['name'];});_0x3a6c12={'description':_0xa4dfa7[_0x5ac1f6(0xb0)],'rule':_0x402461};}}}return{'name':_0x434e1b,'isJourneyLocal':_0x500798,'definition':_0x3a6c12};}catch(_0x8c98b){return logger[_0x5ac1f6(0xcb)](_0x5ac1f6(0xb6)+_0x13d9da+':\x20'+_0x8c98b),{'name':_0x13d9da,'isJourneyLocal':![]};}},'resolveActivation':async _0x25ca03=>{const _0x40b7db=a152_0x2923,_0x3fef10=_0x455e69[_0x40b7db(0xec)](_0x25ca03);if(_0x3fef10!==undefined)return{'name':_0x3fef10,'isJourneyLocal':!![]};try{let _0x5c8160=_0x463b6f?.[_0x40b7db(0xec)](_0x25ca03);!_0x5c8160&&(_0x5c8160=await _0x5ea4c1[_0x40b7db(0xf8)][_0x40b7db(0x10a)](_0x17b4eb,_0x25ca03));const _0xac68ff=_0x5c8160[_0x40b7db(0x174)][_0x40b7db(0x84)]['name']||_0x25ca03,_0x5a39c6=sanitizeYamlKey(_0xac68ff)||'activation_'+_0x25ca03,_0x2ef9ad=_0x5a39c6;_0x455e69['set'](_0x25ca03,_0x2ef9ad);const _0x1c6c78=journeyActivationStepToYaml(_0x5c8160,_0xbcab42,_0x257f31);return{'name':_0x2ef9ad,'isJourneyLocal':!![],'definition':_0x1c6c78};}catch(_0x453219){return logger[_0x40b7db(0xcb)]('Failed\x20to\x20resolve\x20activation\x20'+_0x25ca03+':\x20'+_0x453219),{'name':_0x25ca03,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x51258b,_0x390c8d)=>resolveJumpTarget(_0x51258b,_0x390c8d,_0x321e7f,async _0x7593ad=>{const _0x4a1999=a152_0x2923,_0x2f50b4=_0x5d5f08?.[_0x4a1999(0xec)](_0x7593ad);if(_0x2f50b4)return _0x2f50b4;return _0x5ea4c1[_0x4a1999(0xf8)][_0x4a1999(0x14a)](_0x7593ad);})};return _0xb94c37=_0x20b664,_0x20b664;},_0x23ce01=async _0x42a539=>{const _0x5de658=a152_0x2923,{collectSegmentIdsFromJourneyApi:_0x5e91a6}=await import(_0x5de658(0x131)),{batchAsync:_0x14f503}=await import('../../utils/async.js'),_0x29bb9a=new Set();for(const _0x4b3458 of _0x42a539){let _0x5c43a0=_0x5d5f08?.[_0x5de658(0xec)](_0x4b3458);!_0x5c43a0&&(_0x5c43a0=await _0x5ea4c1[_0x5de658(0xf8)]['getJourney'](_0x4b3458));const _0x3f8735=_0x5e91a6(_0x5c43a0);for(const _0x423bf5 of _0x3f8735){_0x29bb9a[_0x5de658(0xda)](_0x423bf5);}}let _0x21b2c6=Array['from'](_0x29bb9a);while(_0x21b2c6[_0x5de658(0x165)]>0x0){const _0x496f9e=_0x21b2c6['filter'](_0x681778=>!_0x29a141['has'](_0x681778));if(_0x496f9e[_0x5de658(0x165)]===0x0)break;const _0x3089b5=await _0x14f503(_0x496f9e,async _0x2957ca=>{const _0x16eb66=_0x5de658;_0x29a141[_0x16eb66(0xda)](_0x2957ca);const _0x1ea84a=await fetchSegment(_0x5ea4c1,_0x101107,_0x2957ca,_0x16ccd8);if(!_0x1ea84a)return null;return{'segmentId':_0x2957ca,'segment':_0x1ea84a};},0xa),_0x2ce2fd=new Set();for(const _0x1a451d of _0x3089b5){if(!_0x1a451d?.[_0x5de658(0xe7)]?.['rule'])continue;const _0x3e3cce=apiRuleToYaml(_0x1a451d[_0x5de658(0xe7)][_0x5de658(0x149)]);_0x831565[_0x5de658(0x11a)](_0x1a451d['segmentId'],_0x3e3cce);const _0x888af9=collectSegmentRefsFromRule(_0x3e3cce);for(const _0x5117d8 of _0x888af9){!_0x29a141[_0x5de658(0x139)](_0x5117d8)&&_0x2ce2fd[_0x5de658(0xda)](_0x5117d8);}}_0x21b2c6=Array[_0x5de658(0xb7)](_0x2ce2fd);}};return{'createYamlContext':_0x2b4cd0,'prefetchJourneySegments':_0x23ce01};}export async function executePushSegments(_0x453187,_0x3e4d07,_0x26fc13,_0x55a682,_0x31e4a5){const _0x34f7e2=a152_0x3c2d73,{segmentDefToCreateRequest:_0x1a1113,segmentDefToUpdateRequest:_0x83d9e3}=await import(_0x34f7e2(0x126)),_0x247e8b=_0x26fc13[_0x34f7e2(0x13d)],_0x1c3ea6=0x5,_0x176688=async _0x2e85eb=>{const _0x37a506=_0x34f7e2,_0x43d7f3=_0x2e85eb[_0x37a506(0xff)]?_0x247e8b['get'](_0x2e85eb[_0x37a506(0xff)]):undefined;let _0x2772ad;const _0x3ea03b={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0xa9b7ba=_0x2e85eb[_0x37a506(0x79)];if(_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x149)]){const _0x1591ac=createSegmentIdResolver(_0x26fc13[_0x37a506(0xc9)],_0x2e85eb['yamlConfig'][_0x37a506(0x15c)]),_0x3179f5=await resolveRuleSegmentIds(_0x2e85eb['yamlConfig']['rule'],_0x1591ac);_0xa9b7ba={..._0x2e85eb['yamlConfig'],'rule':_0x3179f5};}try{if(_0x2e85eb[_0x37a506(0xbd)]){_0x31e4a5[_0x37a506(0x15b)]?.({'type':_0x37a506(0xe4),'name':_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)]});const _0x59ef5d=_0x1a1113(_0xa9b7ba,_0x43d7f3),_0x2e1fa8=await _0x31e4a5['withProgress']('Creating\x20segment\x20\x27'+_0x2e85eb['yamlConfig'][_0x37a506(0x15c)]+'\x27...',()=>_0x453187['segment'][_0x37a506(0xc4)](_0x55a682['parentId'],_0x59ef5d));_0x2772ad=_0x2e1fa8[_0x37a506(0x148)]['id'],_0x26fc13[_0x37a506(0xc9)]['set'](_0x2e85eb['yamlConfig'][_0x37a506(0x15c)],_0x2772ad),_0x3ea03b[_0x37a506(0x16b)]={'name':_0x2e85eb['yamlConfig']['name'],'id':_0x2772ad},_0x31e4a5[_0x37a506(0x15b)]?.({'type':_0x37a506(0xac),'name':_0x2e85eb['yamlConfig'][_0x37a506(0x15c)],'segmentId':_0x2772ad}),_0x31e4a5[_0x37a506(0x158)]?.(_0x37a506(0x103)+_0x2e85eb['yamlConfig']['name']+'\x27'),_0x3ea03b['created']=0x1;}else{if(_0x2e85eb[_0x37a506(0x93)]){_0x31e4a5[_0x37a506(0x15b)]?.({'type':'segment_updating','name':_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)]});const _0x4c4d7f=_0x83d9e3(_0xa9b7ba);_0x43d7f3!==_0x2e85eb['existingSegment']?.['segmentFolderId']&&(_0x4c4d7f[_0x37a506(0x16a)]=_0x43d7f3?parseInt(_0x43d7f3,0xa):undefined),await _0x31e4a5[_0x37a506(0x112)](_0x37a506(0x175)+_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)]+_0x37a506(0xfa),()=>_0x453187[_0x37a506(0xe7)][_0x37a506(0xd9)](_0x55a682[_0x37a506(0x119)],_0x2e85eb[_0x37a506(0x16f)]['id'],_0x4c4d7f)),_0x2772ad=_0x2e85eb['existingSegment']['id'],_0x31e4a5[_0x37a506(0x15b)]?.({'type':_0x37a506(0xc2),'name':_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)]}),_0x31e4a5[_0x37a506(0x158)]?.(_0x37a506(0xe9)+_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)]+'\x27'),_0x3ea03b['updated']=0x1;}else _0x2772ad=_0x2e85eb[_0x37a506(0x16f)]['id'];}}catch(_0x2d7003){const _0x35e833=isHttp400Error(_0x2d7003),_0x5209a3=_0x35e833?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x37a506(0xb2)],_0x1f9441=getErrorMessage(_0x2d7003);throw new SDKError(_0x5209a3,_0x37a506(0xca)+(_0x2e85eb['isNew']?_0x37a506(0x124):_0x37a506(0x16d))+'\x20segment\x20from\x20file:\x20'+_0x2e85eb['absolutePath']+_0x37a506(0xad)+_0x1f9441,_0x2d7003);}try{const _0x136d4e=await syncActivationsForSegment(_0x453187,_0x55a682[_0x37a506(0x119)],_0x2772ad,_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)],_0x2e85eb[_0x37a506(0xd0)],_0x31e4a5,_0x2e85eb[_0x37a506(0x166)]);_0x3ea03b[_0x37a506(0xf2)]=_0x136d4e;}catch(_0x40db21){if(_0x40db21 instanceof SDKError)throw _0x40db21;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x37a506(0x14f)+_0x2e85eb[_0x37a506(0x79)][_0x37a506(0x15c)]+_0x37a506(0xde)+_0x2e85eb[_0x37a506(0x166)]+_0x37a506(0xad)+getErrorMessage(_0x40db21),_0x40db21);}return _0x3ea03b;},_0xc02f56=await batchAsync(_0x3e4d07,_0x176688,_0x1c3ea6),_0x1d0f85={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2c135a of _0xc02f56){_0x1d0f85[_0x34f7e2(0xa5)]+=_0x2c135a[_0x34f7e2(0xa5)],_0x1d0f85[_0x34f7e2(0x102)]+=_0x2c135a['updated'],_0x2c135a['createdSegmentId']&&_0x1d0f85['createdSegmentIds'][_0x34f7e2(0x11a)](_0x2c135a['createdSegmentId']['name'],_0x2c135a[_0x34f7e2(0x16b)]['id']),_0x1d0f85[_0x34f7e2(0xf2)][_0x34f7e2(0xa5)]+=_0x2c135a[_0x34f7e2(0xf2)][_0x34f7e2(0xa5)],_0x1d0f85['activations'][_0x34f7e2(0x102)]+=_0x2c135a['activations'][_0x34f7e2(0x102)],_0x1d0f85[_0x34f7e2(0xf2)]['deleted']+=_0x2c135a['activations'][_0x34f7e2(0xbb)];}return _0x1d0f85;}async function syncActivationsForSegment(_0x4aad5e,_0x482728,_0x890337,_0x250b25,_0x5e4a5e,_0x3a3642,_0x368116){const _0x155de9=a152_0x3c2d73,_0x5e6194={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x316464 of _0x5e4a5e){try{if(_0x316464[_0x155de9(0xc6)]===_0x155de9(0x124)&&_0x316464[_0x155de9(0xd3)])_0x3a3642['onProgress']?.({'type':_0x155de9(0x110),'segmentName':_0x250b25,'activationName':_0x316464[_0x155de9(0x15c)]}),await _0x3a3642[_0x155de9(0x112)]('Creating\x20activation\x20\x27'+_0x316464[_0x155de9(0x15c)]+_0x155de9(0xfa),()=>_0x4aad5e[_0x155de9(0xe7)][_0x155de9(0xa9)](_0x482728,_0x890337,_0x316464['validatedRequest'])),_0x3a3642['onProgress']?.({'type':_0x155de9(0x155),'segmentName':_0x250b25,'activationName':_0x316464[_0x155de9(0x15c)]}),_0x3a3642[_0x155de9(0x158)]?.('Created\x20activation\x20\x27'+_0x316464[_0x155de9(0x15c)]+'\x27'),_0x5e6194[_0x155de9(0xa5)]++;else{if(_0x316464[_0x155de9(0xc6)]===_0x155de9(0x16d)&&_0x316464[_0x155de9(0xd3)]&&_0x316464[_0x155de9(0x17b)])_0x3a3642['onProgress']?.({'type':_0x155de9(0x10c),'segmentName':_0x250b25,'activationName':_0x316464[_0x155de9(0x15c)]}),await _0x3a3642[_0x155de9(0x112)]('Updating\x20activation\x20\x27'+_0x316464['name']+_0x155de9(0xfa),()=>_0x4aad5e['segment']['updateActivation'](_0x482728,_0x890337,_0x316464[_0x155de9(0x17b)]['id'],_0x316464[_0x155de9(0xd3)])),_0x3a3642[_0x155de9(0x15b)]?.({'type':_0x155de9(0x106),'segmentName':_0x250b25,'activationName':_0x316464[_0x155de9(0x15c)]}),_0x3a3642[_0x155de9(0x158)]?.(_0x155de9(0x10d)+_0x316464[_0x155de9(0x15c)]+'\x27'),_0x5e6194['updated']++;else _0x316464[_0x155de9(0xc6)]===_0x155de9(0xfb)&&_0x316464[_0x155de9(0x17b)]&&(_0x3a3642['onProgress']?.({'type':_0x155de9(0x163),'segmentName':_0x250b25,'activationName':_0x316464[_0x155de9(0x15c)]}),await _0x3a3642['withProgress']('Deleting\x20activation\x20\x27'+_0x316464[_0x155de9(0x15c)]+'\x27...',()=>_0x4aad5e[_0x155de9(0xe7)][_0x155de9(0xe6)](_0x482728,_0x890337,_0x316464[_0x155de9(0x17b)]['id'])),_0x3a3642[_0x155de9(0x15b)]?.({'type':_0x155de9(0x172),'segmentName':_0x250b25,'activationName':_0x316464[_0x155de9(0x15c)]}),_0x3a3642[_0x155de9(0x134)]?.(_0x155de9(0x179)+_0x316464[_0x155de9(0x15c)]+'\x27'),_0x5e6194[_0x155de9(0xbb)]++);}}catch(_0x13ea24){const _0x361b10=isHttp400Error(_0x13ea24),_0x16c2b1=_0x361b10?ErrorCode[_0x155de9(0xf5)]:ErrorCode[_0x155de9(0x108)],_0x59b77e=getErrorMessage(_0x13ea24);throw new SDKError(_0x16c2b1,_0x155de9(0xca)+_0x316464['type']+'\x20activation\x20\x27'+_0x316464['name']+'\x27\x20from\x20file:\x20'+_0x368116+'\x0a\x20\x20'+_0x59b77e,_0x13ea24);}}return _0x5e6194;}export async function executePushFolders(_0x733898,_0x3a2a20,_0x190e32,_0x26152b,_0x1242ea){const _0x6ccfdc=a152_0x3c2d73,_0x215b5b=new Map(_0x190e32),_0x54a7e3=sortFoldersByDepth(_0x3a2a20);for(const _0x27cc4b of _0x54a7e3){const _0x346f88=_0x27cc4b[_0x6ccfdc(0x101)]('/'),_0x335305=_0x346f88[_0x346f88[_0x6ccfdc(0x165)]-0x1],_0x57a2dc=_0x346f88[_0x6ccfdc(0xa2)](0x0,-0x1)[_0x6ccfdc(0x17a)]('/'),_0x714f53=_0x215b5b['get'](_0x57a2dc);_0x1242ea[_0x6ccfdc(0x15b)]?.({'type':_0x6ccfdc(0x180),'folder':_0x27cc4b});const _0x5c9a24={'name':_0x335305,'parentFolderId':_0x714f53},_0x2eb635=await _0x1242ea['withProgress'](_0x6ccfdc(0x164)+_0x27cc4b+'\x27...',()=>_0x733898['segment'][_0x6ccfdc(0x99)](_0x26152b['parentId'],_0x5c9a24));_0x215b5b['set'](_0x27cc4b,_0x2eb635['data']['id']),_0x1242ea[_0x6ccfdc(0x15b)]?.({'type':_0x6ccfdc(0x7b),'folder':_0x27cc4b,'folderId':_0x2eb635[_0x6ccfdc(0x148)]['id']}),_0x1242ea[_0x6ccfdc(0x7c)]?.('Created\x20folder\x20\x27'+_0x27cc4b+'\x27');}return _0x215b5b;}export async function executePushSegmentDeletions(_0x2ee670,_0x1a401d,_0x5e3d52){const _0x9ef0a0=a152_0x3c2d73;if(_0x1a401d[_0x9ef0a0(0x165)]===0x0)return 0x0;const {batchAsync:_0x1bfd81}=await import('../../utils/async.js'),_0x447770=0x5,_0x20502d=await _0x1bfd81(_0x1a401d,async _0x15cff8=>{const _0x3faa13=_0x9ef0a0;return _0x5e3d52[_0x3faa13(0x15b)]?.({'type':'segment_deleting','name':_0x15cff8['name']}),await _0x2ee670[_0x3faa13(0xe7)]['deleteSegment'](_0x15cff8['id']),_0x5e3d52[_0x3faa13(0x15b)]?.({'type':_0x3faa13(0x13c),'name':_0x15cff8[_0x3faa13(0x15c)]}),_0x5e3d52[_0x3faa13(0x134)]?.(_0x3faa13(0xa7)+_0x15cff8[_0x3faa13(0x15c)]+'\x27'),0x1;},_0x447770);return _0x20502d[_0x9ef0a0(0x147)]((_0x2e12a6,_0x2c513c)=>_0x2e12a6+_0x2c513c,0x0);}export async function executePushJourneys(_0x2d4553,_0x3acd7b,_0x23dfa8,_0x4d4d1f,_0x2656b6){const _0x5889da=a152_0x3c2d73,{journeyDefToRequest:_0x1bb692}=await import(_0x5889da(0x131)),{activationDefToCreateRequest:_0xc18bab,yamlRuleToApi:_0x1b84fd,validateSegmentRule:_0x5f9147}=await import(_0x5889da(0x126)),_0x1d5ce4={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x249f55=new Map(_0x23dfa8[_0x5889da(0xc9)]),_0x4f3960=0x5;for(let _0xdc5b25=0x0;_0xdc5b25<_0x3acd7b[_0x5889da(0x165)];_0xdc5b25+=_0x4f3960){const _0x257ad5=_0x3acd7b[_0x5889da(0xa2)](_0xdc5b25,_0xdc5b25+_0x4f3960),_0x511f5a=await Promise[_0x5889da(0x168)](_0x257ad5['map'](async _0x5398ad=>{const _0xeb77bf=_0x5889da;if(!_0x5398ad[_0xeb77bf(0xbd)]&&!_0x5398ad['hasChanges'])return{'action':_0xeb77bf(0xc5),'name':_0x5398ad[_0xeb77bf(0x79)][_0xeb77bf(0x15c)],'journeyId':_0x5398ad['existingJourney']?.['id']};const _0x299a6f=_0x5398ad['folderPath']?_0x23dfa8['folderPathToId'][_0xeb77bf(0xec)](_0x5398ad[_0xeb77bf(0xff)]):undefined;_0x2656b6[_0xeb77bf(0x15b)]?.({'type':_0x5398ad[_0xeb77bf(0xbd)]?_0xeb77bf(0x88):_0xeb77bf(0x159),'name':_0x5398ad[_0xeb77bf(0x79)][_0xeb77bf(0x15c)]});try{const _0x29fa78=await executeSingleJourneyPush(_0x2d4553,_0x5398ad,{..._0x23dfa8,'segmentNameToId':_0x249f55},{'parentId':_0x4d4d1f['parentId'],'rootFolderId':_0x4d4d1f[_0xeb77bf(0xcd)],'folderId':_0x299a6f,'verbose':_0x4d4d1f[_0xeb77bf(0x161)]},_0x2656b6,{'journeyDefToRequest':_0x1bb692,'activationDefToCreateRequest':_0xc18bab,'yamlRuleToApi':_0x1b84fd,'validateSegmentRule':_0x5f9147});for(const [_0x2dc909,_0x21b8e2]of _0x29fa78['embeddedSegmentNameToId']){_0x249f55[_0xeb77bf(0x11a)](_0x2dc909,_0x21b8e2),_0x1d5ce4[_0xeb77bf(0x8c)][_0xeb77bf(0x11a)](_0x2dc909,_0x21b8e2);}if(_0x29fa78['action']===_0xeb77bf(0xa5))_0x2656b6[_0xeb77bf(0x15b)]?.({'type':_0xeb77bf(0x125),'name':_0x5398ad['yamlConfig'][_0xeb77bf(0x15c)],'journeyId':_0x29fa78[_0xeb77bf(0x9f)]}),_0x2656b6[_0xeb77bf(0x158)]?.(_0xeb77bf(0x109)+_0x5398ad['yamlConfig']['name']+'\x27'),_0x1d5ce4[_0xeb77bf(0xa5)]++;else _0x29fa78['action']===_0xeb77bf(0x102)&&(_0x2656b6[_0xeb77bf(0x15b)]?.({'type':_0xeb77bf(0xdb),'name':_0x5398ad[_0xeb77bf(0x79)][_0xeb77bf(0x15c)]}),_0x2656b6[_0xeb77bf(0x158)]?.(_0xeb77bf(0x9b)+_0x5398ad[_0xeb77bf(0x79)][_0xeb77bf(0x15c)]+'\x27'),_0x1d5ce4['updated']++);return{'action':_0x29fa78[_0xeb77bf(0xe1)],'name':_0x5398ad[_0xeb77bf(0x79)][_0xeb77bf(0x15c)],'journeyId':_0x29fa78[_0xeb77bf(0x9f)]};}catch(_0x2b0f05){const _0x3dfce9=isHttp400Error(_0x2b0f05),_0x51eec9=_0x3dfce9?ErrorCode[_0xeb77bf(0x11e)]:ErrorCode[_0xeb77bf(0x9a)],_0x540efd=getErrorMessage(_0x2b0f05);throw new SDKError(_0x51eec9,_0xeb77bf(0xca)+(_0x5398ad['isNew']?_0xeb77bf(0x124):_0xeb77bf(0x16d))+'\x20journey\x20from\x20file:\x20'+_0x5398ad[_0xeb77bf(0x166)]+_0xeb77bf(0xad)+_0x540efd,_0x2b0f05);}}));_0x1d5ce4[_0x5889da(0xeb)][_0x5889da(0xfe)](..._0x511f5a);}return _0x1d5ce4;}async function matchExistingJourneySegments(_0x14b642,_0x13b050,_0x4e7f63,_0x27fabd,_0x250936){const _0x2f1790=a152_0x3c2d73;if(!_0x13b050['existingJourney']||!_0x13b050[_0x2f1790(0x79)][_0x2f1790(0xb5)])return;const _0x2a1ba0=new Map(),_0x475799=new Set();for(const _0x10c821 of Object[_0x2f1790(0x117)](_0x13b050[_0x2f1790(0x79)]['segments'])){const _0x101819=generateDeterministicJourneySegmentName(_0x13b050[_0x2f1790(0x79)][_0x2f1790(0x15c)],_0x10c821);_0x2a1ba0[_0x2f1790(0x11a)](_0x101819,_0x10c821),_0x475799[_0x2f1790(0xda)](_0x10c821);}const _0x2aaa71=[],_0x5a5e0f=collectSegmentIdsFromJourneyApi(_0x13b050['existingJourney']);for(const _0x4b74f8 of _0x5a5e0f){const _0x48e564=await fetchSegment(_0x14b642,_0x4e7f63,_0x4b74f8,_0x27fabd);if(!_0x48e564?.['name'])continue;const _0x5e89ad=_0x2a1ba0[_0x2f1790(0xec)](_0x48e564['name']);_0x5e89ad?(_0x250936[_0x2f1790(0x11a)](_0x5e89ad,_0x4b74f8),_0x475799[_0x2f1790(0xfb)](_0x5e89ad)):_0x2aaa71[_0x2f1790(0xfe)]({'id':_0x4b74f8,'seg':_0x48e564});}if(_0x475799[_0x2f1790(0x14e)]>0x0&&_0x2aaa71[_0x2f1790(0x165)]>0x0){const {localExpandedRuleToNames:_0x1586e4}=buildLocalExpandedRuleMappings(_0x13b050[_0x2f1790(0x79)]),_0x142c8b=new Map();for(const {id:_0x529ec1,seg:_0xd34a8f}of _0x2aaa71){if(_0xd34a8f[_0x2f1790(0x149)]){const _0x354f24=apiRuleToYaml(_0xd34a8f[_0x2f1790(0x149)]);_0x142c8b[_0x2f1790(0x11a)](_0x529ec1,_0x354f24);}}for(const {id:_0x124357,seg:_0x9174ab}of _0x2aaa71){if(!_0x9174ab['rule'])continue;const _0x19d00c=_0x142c8b['get'](_0x124357);if(!_0x19d00c)continue;const _0x2f1d5d=serializeExpandedRule(_0x19d00c,_0x142c8b),_0x502e18=_0x1586e4[_0x2f1790(0xec)](_0x2f1d5d);if(_0x502e18){const _0x5b3a3f=_0x502e18[_0x2f1790(0x127)](_0x49cdfc=>_0x475799[_0x2f1790(0x139)](_0x49cdfc));_0x5b3a3f&&(_0x250936['set'](_0x5b3a3f,_0x124357),_0x475799['delete'](_0x5b3a3f),logger[_0x2f1790(0xcb)]('Matched\x20server\x20segment\x20\x27'+_0x9174ab['name']+_0x2f1790(0x7d)+_0x5b3a3f+_0x2f1790(0xba)));}}}}async function executeSingleJourneyPush(_0x1b16aa,_0x2539b7,_0x1d6c6c,_0x3e8d03,_0x1734ac,_0x2a9979){const _0x40ed40=a152_0x3c2d73,{journeyDefToRequest:_0x34358b,activationDefToCreateRequest:_0x32f842,yamlRuleToApi:_0x27f158,validateSegmentRule:_0x44fb9b}=_0x2a9979,_0x541444=new Map(),_0xd18102=new Map();recoverSegmentIdsFromPushRecovery(_0x2539b7,_0x541444,_0x1d6c6c[_0x40ed40(0xc9)]);const _0x42de82=new Map(),_0x41a938=new Map(),_0x4ea643=new Map();let _0x41fb79;const _0x500a08=async()=>{const _0x2f1eef=_0x40ed40;if(_0x41fb79)return;_0x41fb79=new Map();if(!_0x2539b7[_0x2f1eef(0x154)])return;const _0x5ea11b=await _0x1b16aa[_0x2f1eef(0xf8)][_0x2f1eef(0x85)](_0x2539b7[_0x2f1eef(0x154)]['id']);for(const _0xb5e8b1 of _0x5ea11b){const _0x327c5f=journeyActivationStepToYaml(_0xb5e8b1,_0x1d6c6c[_0x2f1eef(0xa3)],_0x1d6c6c['connectionIdToNameMap']),_0x4884ea=activationSignature(_0x327c5f);!_0x41fb79[_0x2f1eef(0x139)](_0x4884ea)&&_0x41fb79[_0x2f1eef(0x11a)](_0x4884ea,_0xb5e8b1['id']),_0x327c5f[_0x2f1eef(0x15c)]&&_0xd18102[_0x2f1eef(0x11a)](_0x327c5f[_0x2f1eef(0x15c)],_0xb5e8b1['id']);}};await matchExistingJourneySegments(_0x1b16aa,_0x2539b7,_0x3e8d03['parentId'],_0x1d6c6c[_0x40ed40(0xdd)],_0x1d6c6c[_0x40ed40(0xc9)]);const _0x2ee662={'resolveSegmentId':async _0x28436a=>{const _0x4c4d1c=_0x40ed40,_0x321aec=_0x1d6c6c[_0x4c4d1c(0xc9)][_0x4c4d1c(0xec)](_0x28436a);if(!_0x321aec)throw new SDKError(ErrorCode[_0x4c4d1c(0x17c)],_0x4c4d1c(0x130)+_0x28436a+_0x4c4d1c(0xb4)+_0x2539b7['yamlConfig']['name']+')');return _0x321aec;},'resolveEmbeddedSegmentId':async(_0x35bf35,_0x3e1b09)=>{const _0x2d927f=_0x40ed40,_0x1da186=_0x1d6c6c['segmentNameToId']['get'](_0x35bf35);if(_0x1da186)return _0x1da186;const _0x2e2169=_0x1d6c6c[_0x2d927f(0xdd)][_0x2d927f(0x127)](_0x2c4954=>_0x2c4954[_0x2d927f(0x15c)]===_0x35bf35);if(_0x2e2169)return _0x1d6c6c['segmentNameToId'][_0x2d927f(0x11a)](_0x35bf35,_0x2e2169['id']),_0x2e2169['id'];if(_0x2539b7[_0x2d927f(0xbd)]){const {stageName:_0x157e13,criteriaName:_0x4d1520}=findSegmentCriteriaLocation(_0x2539b7[_0x2d927f(0x79)],_0x35bf35);return _0x44fb9b(_0x35bf35,_0x3e1b09[_0x2d927f(0x149)]),_0x41a938['set'](_0x35bf35,{'definition':_0x3e1b09,'stageName':_0x157e13,'criteriaName':_0x4d1520}),createPendingSegmentId(_0x35bf35);}const _0x5a9792=_0x2539b7[_0x2d927f(0x154)]?.['id'];if(!_0x5a9792)throw new SDKError(ErrorCode[_0x2d927f(0xab)],_0x2d927f(0x132));const _0x504648=_0x42de82['get'](_0x35bf35);if(_0x504648)return _0x504648;const _0x21a341=((async()=>{const _0x4fd09a=_0x2d927f;_0x44fb9b(_0x35bf35,_0x3e1b09[_0x4fd09a(0x149)]);const _0x573f63=generateDeterministicJourneySegmentName(_0x2539b7[_0x4fd09a(0x79)][_0x4fd09a(0x15c)],_0x35bf35),_0xfb5c34=_0x1d6c6c[_0x4fd09a(0xdd)]['find'](_0x4873a2=>_0x4873a2[_0x4fd09a(0x15c)]===_0x573f63),_0xe5b203=createSegmentIdResolver(_0x1d6c6c[_0x4fd09a(0xc9)],_0x35bf35),_0x235b3a=await resolveRuleSegmentIds(_0x3e1b09['rule'],_0xe5b203);let _0x8d6bde;return _0xfb5c34?(await _0x1b16aa['segment'][_0x4fd09a(0xd9)](_0x3e8d03[_0x4fd09a(0x119)],_0xfb5c34['id'],{'description':_0x3e1b09[_0x4fd09a(0xb0)]||_0x4fd09a(0x9e)+_0x35bf35,'rule':_0x27f158(_0x235b3a),'countPopulation':!![]}),_0x8d6bde=_0xfb5c34['id'],saveSegmentToPushRecovery(_0x2539b7[_0x4fd09a(0x166)],_0x2539b7['yamlConfig'][_0x4fd09a(0x15c)],_0x35bf35,{'segmentId':_0x8d6bde,'uniqueServerName':_0x573f63,'createdAt':new Date()[_0x4fd09a(0xa1)]()})):_0x8d6bde=await createOrRecoverEmbeddedSegment(_0x1b16aa,_0x2539b7,{'localName':_0x35bf35,'uniqueSegmentName':_0x573f63,'description':_0x3e1b09[_0x4fd09a(0xb0)]||_0x4fd09a(0x9e)+_0x35bf35,'journeyId':_0x5a9792,'resolvedRule':_0x235b3a,'parentId':_0x3e8d03[_0x4fd09a(0x119)],'folderId':_0x3e8d03['rootFolderId']||''},_0x27f158),_0x1d6c6c[_0x4fd09a(0xc9)][_0x4fd09a(0x11a)](_0x35bf35,_0x8d6bde),_0x541444[_0x4fd09a(0x11a)](_0x35bf35,_0x8d6bde),_0x8d6bde;})());_0x42de82['set'](_0x35bf35,_0x21a341);try{return await _0x21a341;}finally{_0x42de82['delete'](_0x35bf35);}},'resolveActivationId':async _0x3bd6af=>{const _0x1634aa=_0x40ed40,_0x53d198=_0xd18102[_0x1634aa(0xec)](_0x3bd6af);if(_0x53d198)return _0x53d198;if(_0x2539b7[_0x1634aa(0x154)]){await _0x500a08();const _0x32416a=_0xd18102[_0x1634aa(0xec)](_0x3bd6af);if(_0x32416a)return _0x32416a;}throw new SDKError(ErrorCode[_0x1634aa(0x15e)],_0x1634aa(0x138)+_0x3bd6af+_0x1634aa(0xb4)+_0x2539b7[_0x1634aa(0x79)][_0x1634aa(0x15c)]+_0x1634aa(0x167)+_0x1634aa(0xce));},'resolveEmbeddedActivationId':async(_0x36c930,_0x339ca9)=>{const _0x506e9e=_0x40ed40,_0x2cfab5=_0xd18102[_0x506e9e(0xec)](_0x36c930);if(_0x2cfab5)return _0x2cfab5;if(_0x2539b7[_0x506e9e(0xbd)])return _0x4ea643[_0x506e9e(0x11a)](_0x36c930,_0x339ca9),createPendingActivationId(_0x36c930);if(_0x2539b7[_0x506e9e(0x154)]){await _0x500a08();const _0x3183dd=_0xd18102['get'](_0x339ca9[_0x506e9e(0x15c)]);if(_0x3183dd)return _0xd18102['set'](_0x36c930,_0x3183dd),_0x3183dd;const _0x3df0cd=activationSignature(_0x339ca9),_0xf2aa03=_0x41fb79?.[_0x506e9e(0xec)](_0x3df0cd);if(_0xf2aa03)return _0xd18102[_0x506e9e(0x11a)](_0x36c930,_0xf2aa03),_0xf2aa03;const _0x3ea964=await _0x32f842(_0x339ca9,_0x1d6c6c[_0x506e9e(0x17d)]),_0x5f3667={..._0x3ea964,..._0x339ca9[_0x506e9e(0x13f)]!==undefined&&{'runAfterJourneyRefresh':_0x339ca9[_0x506e9e(0x13f)]}},_0x398684=await _0x1b16aa[_0x506e9e(0xf8)]['createActivation'](_0x2539b7['existingJourney']['id'],_0x5f3667);return _0xd18102[_0x506e9e(0x11a)](_0x36c930,_0x398684['id']),_0x398684['id'];}throw new SDKError(ErrorCode[_0x506e9e(0xab)],_0x506e9e(0x11c));},'resolveJourneyId':async _0x54ed8b=>{const _0x49129d=_0x40ed40;try{return await _0x1b16aa['journey'][_0x49129d(0x86)](_0x3e8d03[_0x49129d(0x119)],_0x54ed8b);}catch(_0x37f44e){throw new SDKError(ErrorCode[_0x49129d(0x15e)],_0x49129d(0xf6)+_0x54ed8b+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x2539b7[_0x49129d(0x79)]['name']+'\x27)',_0x37f44e);}},'resolveStageId':async(_0xbcdcd4,_0x306f84)=>{const _0x501edf=_0x40ed40,_0x2f6279=await _0x1b16aa[_0x501edf(0xf8)][_0x501edf(0x14a)](_0xbcdcd4),_0x1f7e6c=_0x2f6279[_0x501edf(0x174)][_0x501edf(0x13b)]['find'](_0x54708f=>_0x54708f['name']['toLowerCase']()===_0x306f84[_0x501edf(0x157)]());if(!_0x1f7e6c?.['id'])throw new SDKError(ErrorCode[_0x501edf(0x15e)],_0x501edf(0x151)+_0x306f84+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x2f6279[_0x501edf(0x174)][_0x501edf(0x169)]||_0x2f6279[_0x501edf(0x174)][_0x501edf(0x15c)])+'\x27');return _0x1f7e6c['id'];}},_0x4eae7c=await _0x34358b(_0x2539b7['yamlConfig'],_0x3e8d03[_0x40ed40(0x119)],_0x2ee662),_0x34ce0a=_0x3e8d03[_0x40ed40(0x14c)]||_0x3e8d03[_0x40ed40(0xcd)];_0x34ce0a&&(_0x4eae7c[_0x40ed40(0x12f)]={'parentFolder':{'data':{'id':_0x34ce0a,'type':_0x40ed40(0xd5)}}});if(_0x2539b7[_0x40ed40(0xbd)]){if(_0x41a938[_0x40ed40(0x14e)]>0x0||_0x4ea643[_0x40ed40(0x14e)]>0x0)return await executeThreeStepJourneyCreate(_0x1b16aa,_0x2539b7,_0x4eae7c,{'pendingEmbeddedSegments':_0x41a938,'pendingEmbeddedActivations':_0x4ea643,'embeddedSegmentNameToId':_0x541444,'journeyActivationNameToId':_0xd18102},{..._0x3e8d03,'effectiveFolderId':_0x34ce0a},_0x1d6c6c,_0x1734ac,_0x2a9979);else{ensureJourneyDefaults(_0x4eae7c[_0x40ed40(0x174)]);const _0x277e41=await _0x1b16aa[_0x40ed40(0xf8)]['create'](_0x4eae7c);return deletePushRecovery(_0x2539b7[_0x40ed40(0x166)]),{'action':_0x40ed40(0xa5),'journeyId':_0x277e41['id'],'embeddedSegmentNameToId':_0x541444};}}else{if(_0x2539b7[_0x40ed40(0x93)]&&_0x2539b7[_0x40ed40(0x154)]){_0x4eae7c['id']=_0x2539b7[_0x40ed40(0x154)]['id'];const _0x4aa9bd=_0x4eae7c['attributes'];_0x2539b7['existingJourney'][_0x40ed40(0x174)]?.[_0x40ed40(0x169)]&&(_0x4aa9bd[_0x40ed40(0x169)]=_0x2539b7['existingJourney'][_0x40ed40(0x174)][_0x40ed40(0x169)]);const _0xdbcc0c=_0x2539b7[_0x40ed40(0x154)][_0x40ed40(0x174)]?.[_0x40ed40(0x13b)];return _0xdbcc0c&&_0x4eae7c['attributes'][_0x40ed40(0x13b)]&&injectExistingStageIds(_0x4eae7c['attributes'][_0x40ed40(0x13b)],_0xdbcc0c),ensureJourneyDefaults(_0x4aa9bd),await _0x1b16aa['journey'][_0x40ed40(0x16d)](_0x2539b7['existingJourney']['id'],_0x4eae7c),deletePushRecovery(_0x2539b7[_0x40ed40(0x166)]),{'action':_0x40ed40(0x102),'journeyId':_0x2539b7[_0x40ed40(0x154)]['id'],'embeddedSegmentNameToId':_0x541444};}}return deletePushRecovery(_0x2539b7[_0x40ed40(0x166)]),{'action':_0x40ed40(0xc5),'journeyId':_0x2539b7[_0x40ed40(0x154)]?.['id'],'embeddedSegmentNameToId':_0x541444};}function findSegmentCriteriaLocation(_0xd49138,_0x33e61d){const _0x530a20=a152_0x3c2d73,_0x9df47d=_0xd49138[_0x530a20(0x95)]||_0xd49138[_0x530a20(0x141)]?.[0x0]?.[_0x530a20(0x95)]||[];let _0xa99cac=_0x530a20(0x111),_0x675c48=_0x33e61d;const _0x194688=_0xd49138['goal']||_0xd49138[_0x530a20(0x141)]?.[0x0]?.[_0x530a20(0x14b)];if(_0x194688?.[_0x530a20(0xe7)]===_0x33e61d)return{'stageName':_0x530a20(0x14b),'criteriaName':_0x194688[_0x530a20(0x15c)]||_0x33e61d};_0xdccd04:for(const _0x5d3296 of _0x9df47d){if(_0x5d3296['entry_criteria']?.['segment']===_0x33e61d){_0xa99cac=_0x5d3296[_0x530a20(0x15c)],_0x675c48=_0x5d3296['entry_criteria']['name']||_0x33e61d;break;}if(_0x5d3296[_0x530a20(0x81)])for(const _0x3fb8a1 of _0x5d3296[_0x530a20(0x81)]){if(_0x3fb8a1[_0x530a20(0xc6)]===_0x530a20(0x15a)&&_0x3fb8a1[_0x530a20(0x142)]?.[_0x530a20(0x128)])for(const _0x19b1e6 of _0x3fb8a1[_0x530a20(0x142)]['branches']){if(_0x19b1e6['segment']===_0x33e61d){_0xa99cac=_0x5d3296[_0x530a20(0x15c)],_0x675c48=_0x19b1e6[_0x530a20(0x15c)]||_0x33e61d;break _0xdccd04;}}}}return{'stageName':_0xa99cac,'criteriaName':_0x675c48};}async function executeThreeStepJourneyCreate(_0x44dbf0,_0x3f74c0,_0xa11a1e,_0x173608,_0x2beb23,_0x389ffc,_0x4042ca,_0x292738){const _0x566b52=a152_0x3c2d73,{activationDefToCreateRequest:_0x4dfc35,yamlRuleToApi:_0x4a62fe}=_0x292738,{pendingEmbeddedSegments:_0x43291b,pendingEmbeddedActivations:_0x4c735f,embeddedSegmentNameToId:_0x41e3f2}=_0x173608,_0x560bd8=JSON[_0x566b52(0x7a)](JSON[_0x566b52(0xf3)](_0xa11a1e));ensureJourneyDefaults(_0x560bd8[_0x566b52(0x174)]),stripPendingIds(_0x560bd8);const _0x43d504=await _0x44dbf0[_0x566b52(0xf8)]['create'](_0x560bd8),_0x314c25=_0x43d504['id'],_0x87245b=new Map();for(const _0x19296e of _0x43d504[_0x566b52(0x174)][_0x566b52(0x13b)]){_0x87245b[_0x566b52(0x11a)](_0x19296e[_0x566b52(0x15c)][_0x566b52(0x157)](),_0x19296e['id']);}recoverSegmentIdsFromPushRecovery(_0x3f74c0,_0x41e3f2,_0x389ffc[_0x566b52(0xc9)]);for(const [_0x208bd3,{definition:_0x5e7593}]of _0x43291b){if(_0x41e3f2[_0x566b52(0x139)](_0x208bd3)){_0x4042ca[_0x566b52(0x15b)]?.({'type':_0x566b52(0xcc),'journeyName':_0x3f74c0[_0x566b52(0x79)][_0x566b52(0x15c)],'segmentName':_0x208bd3});continue;}const _0x3d8828=generateDeterministicJourneySegmentName(_0x3f74c0['yamlConfig'][_0x566b52(0x15c)],_0x208bd3);_0x4042ca[_0x566b52(0x15b)]?.({'type':_0x566b52(0xd2),'journeyName':_0x3f74c0[_0x566b52(0x79)]['name'],'segmentName':_0x208bd3});const _0x48e581=createSegmentIdResolver(_0x389ffc[_0x566b52(0xc9)],_0x208bd3),_0x70d24a=await resolveRuleSegmentIds(_0x5e7593[_0x566b52(0x149)],_0x48e581),_0x370268=await createOrRecoverEmbeddedSegment(_0x44dbf0,_0x3f74c0,{'localName':_0x208bd3,'uniqueSegmentName':_0x3d8828,'description':_0x5e7593['description']||_0x566b52(0x9e)+_0x208bd3,'journeyId':_0x314c25,'resolvedRule':_0x70d24a,'parentId':_0x2beb23[_0x566b52(0x119)],'folderId':_0x2beb23[_0x566b52(0x8f)]||''},_0x4a62fe);_0x41e3f2['set'](_0x208bd3,_0x370268),_0x389ffc[_0x566b52(0xc9)][_0x566b52(0x11a)](_0x208bd3,_0x370268),_0x4042ca['onProgress']?.({'type':_0x566b52(0xcc),'journeyName':_0x3f74c0[_0x566b52(0x79)][_0x566b52(0x15c)],'segmentName':_0x208bd3});}const _0x49497b=new Map();for(const [_0x4b966d,_0x23d365]of _0x4c735f){_0x4042ca[_0x566b52(0x15b)]?.({'type':_0x566b52(0x173),'journeyName':_0x3f74c0[_0x566b52(0x79)][_0x566b52(0x15c)],'activationName':_0x4b966d});const _0x13a91c=await _0x4dfc35(_0x23d365,_0x389ffc[_0x566b52(0x17d)]),_0x414457={..._0x13a91c,..._0x23d365[_0x566b52(0x13f)]!==undefined&&{'runAfterJourneyRefresh':_0x23d365[_0x566b52(0x13f)]}},_0x13b81b=await _0x44dbf0[_0x566b52(0xf8)][_0x566b52(0xa9)](_0x314c25,_0x414457);_0x49497b[_0x566b52(0x11a)](_0x4b966d,_0x13b81b['id']),_0x173608[_0x566b52(0xf7)][_0x566b52(0x11a)](_0x4b966d,_0x13b81b['id']),_0x4042ca['onProgress']?.({'type':_0x566b52(0xee),'journeyName':_0x3f74c0[_0x566b52(0x79)][_0x566b52(0x15c)],'activationName':_0x4b966d});}const _0x3b747e=JSON['parse'](JSON[_0x566b52(0xf3)](_0xa11a1e));return _0x3b747e['id']=_0x314c25,ensureJourneyDefaults(_0x3b747e[_0x566b52(0x174)]),resolvePendingIdsInRequest(_0x3b747e,_0xa11a1e,_0x87245b,_0x41e3f2,_0x49497b,_0x4042ca),await _0x44dbf0['journey']['update'](_0x314c25,_0x3b747e),deletePushRecovery(_0x3f74c0['absolutePath']),{'action':_0x566b52(0xa5),'journeyId':_0x314c25,'embeddedSegmentNameToId':_0x41e3f2};}export function stripWaitStepPendingIds(_0x30aa45){const _0x40535e=a152_0x3c2d73,_0x199bcf=_0x30aa45[_0x40535e(0x170)]&&isPendingSegmentId(_0x30aa45[_0x40535e(0x170)]),_0x4913b0=_0x30aa45[_0x40535e(0xf0)]?.['some'](_0x11bd7b=>_0x11bd7b[_0x40535e(0x14d)]&&isPendingSegmentId(_0x11bd7b[_0x40535e(0x14d)]));(_0x199bcf||_0x4913b0)&&(_0x30aa45[_0x40535e(0x8d)]='Duration',_0x30aa45[_0x40535e(0x12b)]=0x1,_0x30aa45[_0x40535e(0x11d)]=_0x40535e(0x152),delete _0x30aa45['conditionSegmentId'],delete _0x30aa45[_0x40535e(0x12a)],delete _0x30aa45[_0x40535e(0x87)],delete _0x30aa45[_0x40535e(0xf0)]);}export function resolveWaitStepPendingIds(_0x2a8712,_0x35877b,_0x33963a,_0x118c89){const _0x5023e8=a152_0x3c2d73;if(_0x35877b[_0x5023e8(0x170)]&&isPendingSegmentId(_0x35877b['conditionSegmentId'])){const _0x4fe67b=_0x33963a(_0x35877b[_0x5023e8(0x170)],'stage\x20\x27'+_0x118c89+_0x5023e8(0x12d));_0x4fe67b&&(_0x2a8712[_0x5023e8(0x8d)]=_0x5023e8(0xd7),_0x2a8712[_0x5023e8(0x170)]=_0x4fe67b,delete _0x2a8712[_0x5023e8(0x12b)],delete _0x2a8712[_0x5023e8(0x11d)],_0x35877b[_0x5023e8(0x12a)]!==undefined&&(_0x2a8712['conditionTimeoutDuration']=_0x35877b[_0x5023e8(0x12a)]),_0x35877b[_0x5023e8(0x87)]&&(_0x2a8712[_0x5023e8(0x87)]=_0x35877b[_0x5023e8(0x87)]));}if(_0x35877b['conditions']){const _0x2abe23=_0x35877b[_0x5023e8(0xf0)][_0x5023e8(0x82)](_0x51927b=>_0x51927b[_0x5023e8(0x14d)]&&isPendingSegmentId(_0x51927b['segmentId']));if(_0x2abe23){const _0x62dd14=_0x35877b[_0x5023e8(0xf0)]['map'](_0x46fdc2=>{const _0x53cde4=_0x5023e8;if(_0x46fdc2['segmentId']&&isPendingSegmentId(_0x46fdc2['segmentId'])){const _0x3ae30f=_0x33963a(_0x46fdc2[_0x53cde4(0x14d)],_0x53cde4(0x12e)+_0x118c89+_0x53cde4(0x12d));return{..._0x46fdc2,'segmentId':_0x3ae30f||_0x46fdc2[_0x53cde4(0x14d)]};}return{..._0x46fdc2};});_0x2a8712[_0x5023e8(0x8d)]='Condition',_0x2a8712[_0x5023e8(0xf0)]=_0x62dd14,delete _0x2a8712[_0x5023e8(0x12b)],delete _0x2a8712[_0x5023e8(0x11d)],delete _0x2a8712['conditionSegmentId'],delete _0x2a8712[_0x5023e8(0x12a)],delete _0x2a8712[_0x5023e8(0x87)];}}}function stripPendingIds(_0x2b5eb0){const _0x6e3c72=a152_0x3c2d73;_0x2b5eb0[_0x6e3c72(0x174)][_0x6e3c72(0x14b)]?.['segmentId']&&isPendingSegmentId(_0x2b5eb0[_0x6e3c72(0x174)][_0x6e3c72(0x14b)]['segmentId'])&&delete _0x2b5eb0['attributes'][_0x6e3c72(0x14b)];for(const _0x36cef4 of _0x2b5eb0[_0x6e3c72(0x174)][_0x6e3c72(0x13b)]||[]){_0x36cef4[_0x6e3c72(0xc8)]?.['segmentId']&&isPendingSegmentId(_0x36cef4[_0x6e3c72(0xc8)]['segmentId'])&&delete _0x36cef4[_0x6e3c72(0xc8)];_0x36cef4[_0x6e3c72(0x10b)]?.['segmentId']&&isPendingSegmentId(_0x36cef4[_0x6e3c72(0x10b)][_0x6e3c72(0x14d)])&&delete _0x36cef4['milestone'];_0x36cef4[_0x6e3c72(0xf4)]&&(_0x36cef4['exitCriterias']=_0x36cef4['exitCriterias']['filter'](_0x3abe36=>!_0x3abe36[_0x6e3c72(0x14d)]||!isPendingSegmentId(_0x3abe36[_0x6e3c72(0x14d)])));if(_0x36cef4['steps'])for(const _0x1d5bb8 of Object[_0x6e3c72(0x117)](_0x36cef4[_0x6e3c72(0x81)])){const _0xdd2fe4=_0x36cef4[_0x6e3c72(0x81)][_0x1d5bb8];_0xdd2fe4['type']===_0x6e3c72(0xaf)&&_0xdd2fe4[_0x6e3c72(0x10e)]&&isPendingActivationId(_0xdd2fe4[_0x6e3c72(0x10e)])&&(_0xdd2fe4[_0x6e3c72(0x10e)]='');if(_0xdd2fe4[_0x6e3c72(0xc6)]===_0x6e3c72(0xfc)&&_0xdd2fe4['branches'])for(const _0x54406f of _0xdd2fe4[_0x6e3c72(0x128)]){_0x54406f[_0x6e3c72(0x14d)]&&isPendingSegmentId(_0x54406f[_0x6e3c72(0x14d)])&&(_0x54406f[_0x6e3c72(0x14d)]='');}_0xdd2fe4[_0x6e3c72(0xc6)]===_0x6e3c72(0x8a)&&stripWaitStepPendingIds(_0xdd2fe4);}}}function resolvePendingIdsInRequest(_0x2c6b0d,_0x15c6e5,_0x5612f0,_0x2bed99,_0xfb9be,_0x1b8001){const _0x27df6d=a152_0x3c2d73,_0x5b680f=(_0x5620c0,_0x43c8ed)=>{const _0x25362d=a152_0x2923;if(!isPendingSegmentId(_0x5620c0))return _0x5620c0;const _0x1e4e99=extractPendingSegmentName(_0x5620c0),_0xbbdd0=_0x2bed99['get'](_0x1e4e99);return!_0xbbdd0&&_0x1b8001[_0x25362d(0x120)]?.(_0x25362d(0x150)+_0x1e4e99+_0x25362d(0x121)+_0x43c8ed),_0xbbdd0;};if(_0x2c6b0d[_0x27df6d(0x174)][_0x27df6d(0x14b)]?.['segmentId']&&isPendingSegmentId(_0x2c6b0d[_0x27df6d(0x174)][_0x27df6d(0x14b)][_0x27df6d(0x14d)])){const _0x3dcb9d=_0x5b680f(_0x2c6b0d[_0x27df6d(0x174)][_0x27df6d(0x14b)]['segmentId'],_0x27df6d(0xef));_0x3dcb9d&&(_0x2c6b0d[_0x27df6d(0x174)]['goal'][_0x27df6d(0x14d)]=_0x3dcb9d);}for(const _0x21fd90 of _0x2c6b0d[_0x27df6d(0x174)][_0x27df6d(0x13b)]||[]){const _0x51467b=_0x5612f0[_0x27df6d(0xec)](_0x21fd90[_0x27df6d(0x15c)][_0x27df6d(0x157)]());_0x51467b&&(_0x21fd90['id']=_0x51467b);if(_0x21fd90[_0x27df6d(0xc8)]?.[_0x27df6d(0x14d)]&&isPendingSegmentId(_0x21fd90['entryCriteria']['segmentId'])){const _0x2ebcd0=_0x5b680f(_0x21fd90[_0x27df6d(0xc8)][_0x27df6d(0x14d)],'stage\x20\x27'+_0x21fd90[_0x27df6d(0x15c)]+_0x27df6d(0x176));_0x2ebcd0&&(_0x21fd90[_0x27df6d(0xc8)][_0x27df6d(0x14d)]=_0x2ebcd0);}if(_0x21fd90[_0x27df6d(0xf4)])for(const _0x43ad94 of _0x21fd90[_0x27df6d(0xf4)]){if(_0x43ad94[_0x27df6d(0x14d)]&&isPendingSegmentId(_0x43ad94[_0x27df6d(0x14d)])){const _0x1d5434=_0x5b680f(_0x43ad94[_0x27df6d(0x14d)],_0x27df6d(0x12e)+_0x21fd90[_0x27df6d(0x15c)]+_0x27df6d(0x118));_0x1d5434&&(_0x43ad94['segmentId']=_0x1d5434);}}if(_0x21fd90[_0x27df6d(0x10b)]?.[_0x27df6d(0x14d)]&&isPendingSegmentId(_0x21fd90[_0x27df6d(0x10b)]['segmentId'])){const _0x51a977=_0x5b680f(_0x21fd90['milestone'][_0x27df6d(0x14d)],_0x27df6d(0x12e)+_0x21fd90[_0x27df6d(0x15c)]+_0x27df6d(0x162));_0x51a977&&(_0x21fd90[_0x27df6d(0x10b)]['segmentId']=_0x51a977);}if(_0x21fd90[_0x27df6d(0x81)]){const _0x330e0a=_0x28ed43=>_0x15c6e5['attributes'][_0x27df6d(0x13b)]?.[_0x27df6d(0x127)](_0x111c6a=>_0x111c6a[_0x27df6d(0x15c)][_0x27df6d(0x157)]()===_0x21fd90['name'][_0x27df6d(0x157)]())?.[_0x27df6d(0x81)]?.[_0x28ed43];for(const _0x5bca9f of Object['keys'](_0x21fd90[_0x27df6d(0x81)])){const _0x1281f0=_0x21fd90[_0x27df6d(0x81)][_0x5bca9f],_0x2e7ca8=_0x330e0a(_0x5bca9f);if(_0x1281f0[_0x27df6d(0xc6)]==='Activation'&&_0x1281f0['journeyActivationStepId']&&(isPendingActivationId(_0x1281f0[_0x27df6d(0x10e)])||_0x1281f0[_0x27df6d(0x10e)]==='')){if(_0x2e7ca8?.[_0x27df6d(0x10e)]&&isPendingActivationId(_0x2e7ca8[_0x27df6d(0x10e)])){const _0x2d3cde=extractPendingActivationName(_0x2e7ca8[_0x27df6d(0x10e)]),_0x4fd773=_0xfb9be[_0x27df6d(0xec)](_0x2d3cde);_0x4fd773&&(_0x1281f0[_0x27df6d(0x10e)]=_0x4fd773);}}if(_0x1281f0['type']===_0x27df6d(0xfc)&&_0x1281f0[_0x27df6d(0x128)]&&_0x2e7ca8?.[_0x27df6d(0x128)])for(let _0x4d2bb0=0x0;_0x4d2bb0<_0x1281f0['branches'][_0x27df6d(0x165)];_0x4d2bb0++){const _0xdfac00=_0x1281f0[_0x27df6d(0x128)][_0x4d2bb0],_0x433f5a=_0x2e7ca8[_0x27df6d(0x128)][_0x4d2bb0];if(_0x433f5a?.[_0x27df6d(0x14d)]&&isPendingSegmentId(_0x433f5a[_0x27df6d(0x14d)])){const _0x477dda=_0x5b680f(_0x433f5a[_0x27df6d(0x14d)],_0x27df6d(0x12e)+_0x21fd90[_0x27df6d(0x15c)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0xdfac00[_0x27df6d(0x15c)]||_0x4d2bb0)+'\x27');_0x477dda&&(_0xdfac00['segmentId']=_0x477dda);}}_0x1281f0[_0x27df6d(0xc6)]===_0x27df6d(0x8a)&&_0x2e7ca8?.['type']==='WaitStep'&&resolveWaitStepPendingIds(_0x1281f0,_0x2e7ca8,_0x5b680f,_0x21fd90[_0x27df6d(0x15c)]);}}}}
1
+ function a152_0x22ad(){const _0x15a29b=['Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','activation_updating','Created\x20activation\x20\x27','Embedded\x20segment\x20\x27','folderId','logInfo','updateSegmentById','update','max','add','Created\x20journey\x20\x27','columns','Deleted\x20segment\x20\x27','set','valid','Fetching\x20','slice','journey_updated','Segment\x20not\x20found:\x20','null','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','unchanged','Creating\x20folder\x20\x27','18tScjrf','journeyActivationNameToId','__pending_act_','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Stage\x20\x27','./child-segment-yaml.js','segmentFolderId','1207194fJAXAn','\x27\x20exit\x20criteria','resolvedRule','SEGMENT_UPDATE_ERROR','getSegment','Deleting\x20activation\x20\x27','yamlConfig','Deleted\x20activation\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','notification','activations','relative','.$1.push-recovery.json','values','sha1','connector_config','embedded_activation_created','digest','onProgress','from','Failed\x20to\x20','diff','getSegmentEntity\x20also\x20failed\x20for\x20','find','isArray','\x27\x20by\x20rule\x20content','absolutePath','createFolder','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','state','get','rootFolderId','embeddedSegmentNameToId','\x20segment\x20from\x20file:\x20','progress','nameToId','WaitStep','2946oeHEOj','deps','validatedRequest','length','day','\x27\x20entry\x20criteria','resolveSegment','Failed\x20to\x20fetch\x20referenced\x20segment\x20','stringify','segments','Created\x20segment\x20\x27','startsWith','\x0a\x20\x20','\x27\x20for\x20','folder','\x20error(s)','NOT_FOUND','and\x20the\x20server\x20segment,\x20then\x20retry.','Updated\x20segment\x20\x27','existingJourney','../../utils/async.js','Delete\x20the\x20push\x20recovery\x20file\x20(','segment_created','debug','uniqueSegmentName','segmentId','toString','folderPath','description','resolveJourneyId','waitStepUnit','activation_template_id','getJourney','match','delete','run_after_journey_refresh','results','updated','replace','stage\x20\x27','data','index','split','segment_updated','create','draft','Updated\x20activation\x20\x27','created','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Segment\x20not\x20found','journey_entry_criteria_','existingSegments','Duration','journey_updating','createSegment','milestone','waitStepType','filter','embedded_segment_created','ACTIVATION_UPDATE_ERROR','Created\x20folder\x20\x27','exitCriterias','fetchJourney','Failed\x20to\x20resolve\x20segment\x20','\x27\x20to\x20local\x20\x27','segment_creating','includes','\x20(referenced\x20in\x20journey\x20','verbose','logSuccess','):\x20','all_columns','activation_deleting','rule','size','dirname','buildUserMaps','6682iYwDSU','\x20activation\x20\x27','getActivation','activation_','embedded_segment_creating','journeyBundleId','Creating\x20activation\x20\x27','segment_deleted','segment_deleting','2430976gpXivg','entry_criteria','message','goal','Matched\x20server\x20segment\x20\x27','journeyStages','idToEmailMap','entryCriteria','connection','list','stages',').\x20','journey_creating','134140Szpimt','folderPathToId','branches','attributes','has','join','nameToType','waitStep','hasChanges','getLatestJourneyId','journey','entry','reduce','conditionTimeoutDuration','journeyId','conditions','activationParams','hex','\x27...','\x27\x20decision\x20point\x20branch\x20\x27','existingSegment','action','ACTIVATION_SYNTAX_ERROR','activationContext','connectionIdToNameMap','utf-8','./journey-yaml.js','32680PXNOHl','isNew','item','keys','Updated\x20journey\x20\x27','existingActivation','parentFolder','segmentByFolderAndName','sort','activationsBySegmentId','journeyBundleName','versionNumber','createActivation','type','logDeleted','Creating\x20segment\x20\x27','createdSegmentId','entries','142NUjWHf','decision_point','map','DecisionPoint','journeyById','name','journeyName','conditionTimeoutUnit','logWarning','276616FUNDnv','638JZHvcU','INTERNAL','activationActions','schedule','deleted','with','tdx.sdk.push-workflow','\x27\x20from\x20file:\x20','localName','parentId','errors','relationships','activation_updated','goal\x20criteria','activation_creating','some','Condition','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','steps','segmentNameToId','SEGMENT_NOT_FOUND','toLowerCase','folder_creating','journeys','getSegmentEntity','parse','parseDocument','conditionSegmentId','kind','withProgress','parentSegmentFolder',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','2611EZShxT','Failed\x20to\x20resolve\x20activation\x20','updateActivation','Activation','idToName','all','push','JOURNEY_UPDATE_ERROR','JOURNEY_SYNTAX_ERROR','journeyActivationStepId','segment'];a152_0x22ad=function(){return _0x15a29b;};return a152_0x22ad();}const a152_0x525fdb=a152_0x400d;(function(_0x1acbe5,_0x4f3b3b){const _0x2df4d4=a152_0x400d,_0x30883c=_0x1acbe5();while(!![]){try{const _0x4d5ec2=-parseInt(_0x2df4d4(0x18b))/0x1*(-parseInt(_0x2df4d4(0x148))/0x2)+parseInt(_0x2df4d4(0xd6))/0x3+-parseInt(_0x2df4d4(0x194))/0x4+-parseInt(_0x2df4d4(0x179))/0x5+parseInt(_0x2df4d4(0xfb))/0x6*(-parseInt(_0x2df4d4(0xad))/0x7)+-parseInt(_0x2df4d4(0x151))/0x8*(parseInt(_0x2df4d4(0xcf))/0x9)+parseInt(_0x2df4d4(0x15e))/0xa*(parseInt(_0x2df4d4(0x195))/0xb);if(_0x4d5ec2===_0x4f3b3b)break;else _0x30883c['push'](_0x30883c['shift']());}catch(_0x4b60fc){_0x30883c['push'](_0x30883c['shift']());}}}(a152_0x22ad,0xc071f));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x525fdb(0x19b));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a152_0x525fdb(0xd1);export function createPendingSegmentId(_0x50fc5b){return''+PENDING_SEGMENT_PREFIX+_0x50fc5b+'__';}export function isPendingSegmentId(_0x1878b1){const _0xdc9f55=a152_0x525fdb;return _0x1878b1[_0xdc9f55(0x106)](PENDING_SEGMENT_PREFIX)&&!_0x1878b1['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x4b572d){const _0x3219b1=a152_0x525fdb;return _0x4b572d[_0x3219b1(0x121)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x18b3f6){return''+PENDING_ACTIVATION_PREFIX+_0x18b3f6+'__';}export function isPendingActivationId(_0x3b8ea8){const _0x3bda69=a152_0x525fdb;return _0x3b8ea8[_0x3bda69(0x106)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x2d814d){const _0xfcea45=a152_0x525fdb;return _0x2d814d[_0xfcea45(0x121)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4e6956,_0x21e17f){const _0x27d88d=a152_0x525fdb,_0x1304c4=_0x4e6956+'::'+(_0x21e17f['trim']()||_0x27d88d(0xb7)),_0x3cbcfe=createHash(_0x27d88d(0xe4))['update'](_0x1304c4)[_0x27d88d(0xe7)](_0x27d88d(0x16f))[_0x27d88d(0xc8)](0x0,0xc);return _0x27d88d(0x12d)+_0x3cbcfe;}export function ensureJourneyDefaults(_0x3e5be5){const _0x44bd92=a152_0x525fdb;!_0x3e5be5[_0x44bd92(0x117)]&&(_0x3e5be5[_0x44bd92(0x117)]=''),!_0x3e5be5[_0x44bd92(0xf3)]&&(_0x3e5be5['state']=_0x44bd92(0x128));}export function injectExistingStageIds(_0x4e8c7c,_0x3d2e3c){const _0x223ac8=a152_0x525fdb,_0x16485f=new Map(_0x3d2e3c[_0x223ac8(0x18d)](_0x1efc69=>[_0x1efc69[_0x223ac8(0x190)],_0x1efc69['id']]));for(const _0x455e6a of _0x4e8c7c){if(!_0x455e6a['id']){const _0x25c437=_0x16485f[_0x223ac8(0xf4)](_0x455e6a[_0x223ac8(0x190)]);_0x25c437&&(_0x455e6a['id']=_0x25c437);}}}export function resolveTDFolderPath(_0x3925a1,_0x5068ea,_0x33f121){if(!_0x5068ea)return _0x3925a1;if(_0x3925a1===_0x33f121||_0x3925a1['startsWith'](_0x33f121+'/'))return _0x3925a1;return _0x3925a1?_0x33f121+'/'+_0x3925a1:_0x33f121;}export function addFoldersToCreate(_0x528e4f,_0x4941f4,_0x5d292d){const _0x395a91=a152_0x525fdb;if(!_0x528e4f)return;if(_0x4941f4['has'](_0x528e4f))return;const _0x51a659=_0x528e4f[_0x395a91(0x125)]('/');let _0x769215='';for(const _0x2cf4ac of _0x51a659){_0x769215=_0x769215?_0x769215+'/'+_0x2cf4ac:_0x2cf4ac,!_0x4941f4[_0x395a91(0x162)](_0x769215)&&_0x5d292d[_0x395a91(0xc1)](_0x769215);}}export function sortFoldersByDepth(_0x477e57){const _0x11564c=a152_0x525fdb;return[..._0x477e57][_0x11564c(0x181)]((_0x3b8317,_0x531d6f)=>{const _0x3a6e67=_0x11564c,_0x17d962=(_0x3b8317[_0x3a6e67(0x11c)](/\//g)||[])[_0x3a6e67(0xfe)],_0x254768=(_0x531d6f[_0x3a6e67(0x11c)](/\//g)||[])['length'];return _0x17d962-_0x254768;});}import*as a152_0x1a922d from'yaml';import{readFileSync}from'fs';import a152_0x2423ed from'path';import{isJourneyDef,parseYamlString as a152_0xd896e,toYamlString as a152_0x859add,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(_0xaa0b7c){const _0x13b07a=a152_0x525fdb;if(Array[_0x13b07a(0xee)](_0xaa0b7c))return'['+_0xaa0b7c[_0x13b07a(0x18d)](_0xd02b49=>stableStringify(_0xd02b49))[_0x13b07a(0x163)](',')+']';if(_0xaa0b7c&&typeof _0xaa0b7c==='object'){const _0xcef41f=_0xaa0b7c,_0x4e980a=Object['keys'](_0xcef41f)[_0x13b07a(0x181)](),_0x1abde5=_0x4e980a[_0x13b07a(0x18d)](_0x4e83de=>'\x22'+_0x4e83de+'\x22:'+stableStringify(_0xcef41f[_0x4e83de]));return'{'+_0x1abde5['join'](',')+'}';}const _0x57718c=JSON[_0x13b07a(0x103)](_0xaa0b7c);return _0x57718c===undefined?_0x13b07a(0xcb):_0x57718c;}function activationSignature(_0x3addc9){const _0x49b1f4=a152_0x525fdb,_0x5528ad={'connection':_0x3addc9['connection'],..._0x3addc9['all_columns']!==undefined&&{'all_columns':_0x3addc9[_0x49b1f4(0x142)]},..._0x3addc9[_0x49b1f4(0xc3)]!==undefined&&{'columns':_0x3addc9[_0x49b1f4(0xc3)]},..._0x3addc9['behavior']!==undefined&&{'behavior':_0x3addc9['behavior']},..._0x3addc9['schedule']!==undefined&&{'schedule':_0x3addc9[_0x49b1f4(0x198)]},..._0x3addc9['notification']!==undefined&&{'notification':_0x3addc9[_0x49b1f4(0xdf)]},..._0x3addc9[_0x49b1f4(0xe5)]!==undefined&&{'connector_config':_0x3addc9[_0x49b1f4(0xe5)]},..._0x3addc9[_0x49b1f4(0x11a)]!==undefined&&{'activation_template_id':_0x3addc9['activation_template_id']}};return stableStringify(_0x5528ad);}async function fetchSegment(_0x1cc173,_0x30a5b8,_0x1c036b,_0x305f74){const _0x29737c=a152_0x525fdb,_0xafa256=_0x305f74?.[_0x29737c(0xed)](_0x18b682=>_0x18b682['id']===_0x1c036b);if(_0xafa256)return _0xafa256;try{return await _0x1cc173[_0x29737c(0xb7)][_0x29737c(0xda)](_0x30a5b8,_0x1c036b);}catch(_0x5289f4){logger[_0x29737c(0x112)]('getSegment\x20failed\x20for\x20'+_0x1c036b+_0x29737c(0xac)+_0x5289f4);try{return await _0x1cc173['segment'][_0x29737c(0xa5)](_0x1c036b);}catch(_0x2d508d){return logger['debug'](_0x29737c(0xec)+_0x1c036b+':\x20'+_0x2d508d),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4e456d,_0x59b0ac,_0x2573b9){const _0x5a3132=a152_0x525fdb,_0x1ad69d=readPushRecovery(_0x4e456d[_0x5a3132(0xf0)]);if(_0x1ad69d?.[_0x5a3132(0x191)]===_0x4e456d[_0x5a3132(0xdc)]['name'])for(const [_0x339bf3,_0x24b12e]of Object[_0x5a3132(0x18a)](_0x1ad69d[_0x5a3132(0x104)])){const _0x37dfa7=generateDeterministicJourneySegmentName(_0x4e456d['yamlConfig']['name'],_0x339bf3);_0x24b12e['uniqueServerName']===_0x37dfa7&&(_0x59b0ac[_0x5a3132(0xc5)](_0x339bf3,_0x24b12e[_0x5a3132(0x114)]),_0x2573b9[_0x5a3132(0xc5)](_0x339bf3,_0x24b12e['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x165395,_0x24e802,_0x771181,_0x3e6d60){const _0x4b794e=a152_0x525fdb;let _0x11c1c8;try{_0x11c1c8=await _0x165395[_0x4b794e(0xb7)]['createJourneySegment']({'name':_0x771181[_0x4b794e(0x113)],'description':_0x771181[_0x4b794e(0x117)],'journeyId':_0x771181[_0x4b794e(0x16c)],'rule':_0x3e6d60(_0x771181['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x771181[_0x4b794e(0xbc)],'audienceId':_0x771181[_0x4b794e(0x19e)]});}catch(_0x58bfc8){const _0xd0f74=_0x58bfc8 instanceof Error&&_0x58bfc8[_0x4b794e(0x153)][_0x4b794e(0x13d)]('Name\x20has\x20already\x20been\x20taken');if(_0xd0f74){const _0x91a5b=readPushRecovery(_0x24e802[_0x4b794e(0xf0)]),_0x5dc728=_0x91a5b?.[_0x4b794e(0x191)]===_0x24e802['yamlConfig']['name']?_0x91a5b[_0x4b794e(0x104)][_0x771181[_0x4b794e(0x19d)]]:undefined;if(_0x5dc728?.['uniqueServerName']===_0x771181[_0x4b794e(0x113)])await _0x165395[_0x4b794e(0xb7)][_0x4b794e(0xbe)](_0x771181['parentId'],_0x5dc728[_0x4b794e(0x114)],{'description':_0x771181['description'],'rule':_0x3e6d60(_0x771181[_0x4b794e(0xd8)],!![]),'countPopulation':!![]}),_0x11c1c8=_0x5dc728[_0x4b794e(0x114)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x4b794e(0xbb)+_0x771181[_0x4b794e(0x19d)]+_0x4b794e(0xf2)+(_0x4b794e(0x110)+_0x24e802[_0x4b794e(0xf0)][_0x4b794e(0x121)](/([^/]+)$/,_0x4b794e(0xe2))+')\x20')+_0x4b794e(0x10c),_0x58bfc8);}else throw _0x58bfc8;}return saveSegmentToPushRecovery(_0x24e802['absolutePath'],_0x24e802[_0x4b794e(0xdc)]['name'],_0x771181[_0x4b794e(0x19d)],{'segmentId':_0x11c1c8,'uniqueServerName':_0x771181[_0x4b794e(0x113)],'createdAt':new Date()['toISOString']()}),_0x11c1c8;}export async function prepareSegmentFiles(_0x54938f,_0x2e8352,_0x1fb0ad,_0x240cbb,_0x122080){const _0x118cb6=a152_0x525fdb,{activationDefToCreateRequest:_0x51118b}=await import(_0x118cb6(0xd4)),_0x1cce3e=[],_0x1a9b4c=new Set();for(const {yamlConfig:_0x36dfb3,folderPath:_0x5f2c93,sourcePath:_0x168ae4}of _0x54938f){const _0x2bace5=resolveTDFolderPath(_0x5f2c93,_0x240cbb,_0x122080),_0x353595=_0x2bace5+':'+_0x36dfb3[_0x118cb6(0x190)],_0x52ade8=_0x2e8352[_0x118cb6(0x180)][_0x118cb6(0xf4)](_0x353595),_0xbaa474=_0x52ade8?_0x2e8352[_0x118cb6(0x182)][_0x118cb6(0xf4)](_0x52ade8['id'])||[]:[];addFoldersToCreate(_0x2bace5,_0x2e8352[_0x118cb6(0x15f)],_0x1a9b4c);const _0x22408a=calculateActivationActions(_0x36dfb3['activations']||[],_0xbaa474,_0x2e8352[_0x118cb6(0x157)],_0x2e8352[_0x118cb6(0x176)]);for(const _0x5a7b6c of _0x22408a){(_0x5a7b6c['type']==='create'||_0x5a7b6c[_0x118cb6(0x186)]===_0x118cb6(0xbf))&&_0x5a7b6c['yamlActivation']&&(_0x5a7b6c['validatedRequest']=await _0x51118b(_0x5a7b6c['yamlActivation'],_0x1fb0ad));}const _0x501ede=calculateSegmentDiff(_0x36dfb3,_0x52ade8,_0xbaa474,_0x2e8352[_0x118cb6(0x157)],_0x2e8352[_0x118cb6(0x176)]);_0x1cce3e[_0x118cb6(0xb3)]({'relativePath':_0x36dfb3[_0x118cb6(0x190)],'absolutePath':_0x168ae4,'yamlConfig':_0x36dfb3,'folderPath':_0x2bace5,'existingSegment':_0x52ade8,'existingActivations':_0xbaa474,'isNew':_0x501ede[_0x118cb6(0x17a)],'hasChanges':_0x501ede[_0x118cb6(0x166)],'diff':_0x501ede[_0x118cb6(0xeb)],'activationActions':_0x22408a});}return{'segmentFiles':_0x1cce3e,'foldersToCreate':_0x1a9b4c};}export async function prepareJourneyFiles(_0x29601c,_0x5cbbca,_0x20a66c,_0x4b8249){const _0x361aff=a152_0x525fdb,_0x26c5ca=[],_0x5d2901=new Set();for(const {yamlConfig:_0x1c31df,folderPath:_0x478868,sourcePath:_0x4d32b9}of _0x29601c){const _0x501d72=resolveTDFolderPath(_0x478868,_0x20a66c,_0x4b8249),_0x31ac80=_0x501d72+':'+_0x1c31df[_0x361aff(0x190)],_0x499761=_0x5cbbca['journeyBundlesByFolderAndName'][_0x361aff(0xf4)](_0x31ac80);let _0x117b51,_0x4993fb;if(_0x499761&&_0x499761[_0x361aff(0xfe)]>0x0){const _0x490a48=buildLocalExpandedRuleMappings(_0x1c31df),{createYamlContext:_0x75fdb8,prefetchJourneySegments:_0x36c726}=createPushYamlContextForBundle(_0x5cbbca[_0x361aff(0xfc)],_0x5cbbca['parentId'],_0x5cbbca[_0x361aff(0x12e)],_0x490a48,_0x5cbbca[_0x361aff(0x157)],_0x5cbbca[_0x361aff(0x176)],_0x5cbbca['activationStepsById'],_0x5cbbca[_0x361aff(0x18f)]);await _0x36c726(_0x499761[_0x361aff(0x18d)](_0x3d4386=>_0x3d4386['id']));const _0x364e74=await _0x5cbbca['deps'][_0x361aff(0x168)][_0x361aff(0x167)](_0x499761[0x0][_0x361aff(0x14d)]),_0x1086fc=hasMultipleVersions(_0x1c31df),_0x16dedd=async _0x2de905=>{const _0xf16127=_0x361aff,_0x412a8c=_0x5cbbca[_0xf16127(0x18f)]?.[_0xf16127(0xf4)](_0x2de905);if(_0x412a8c)return _0x412a8c;return _0x5cbbca[_0xf16127(0x139)]({'journeyId':_0x2de905,'journeyName':_0x1c31df[_0xf16127(0x190)],'isMultiVersion':_0x499761[_0xf16127(0xfe)]>0x1});};if(_0x1086fc&&_0x499761[_0x361aff(0xfe)]>0x1){const _0x2f18a5=[];for(const _0x8058a1 of _0x499761){const _0x8ace65=_0x8058a1[_0x361aff(0x184)]||0x1;_0x5cbbca[_0x361aff(0xf8)]?.['update'](_0x361aff(0xc7)+_0x1c31df[_0x361aff(0x190)]+'\x20v'+_0x8ace65);const _0x39e842=await _0x16dedd(_0x8058a1['id']),_0x3736fd=_0x75fdb8(_0x8058a1['id']),_0x29cf15=await journeyResponseToDef(_0x39e842,_0x3736fd);_0x2f18a5[_0x361aff(0xb3)]({'item':_0x8058a1,'yaml':_0x29cf15});}const _0x2e8cb6=buildLocalRuleToNameMappingFromJourney(_0x1c31df);_0x4993fb=buildMergedJourneyDef(_0x2f18a5,_0x2e8cb6,_0x364e74);const _0x303195=Math[_0x361aff(0xc0)](..._0x2f18a5[_0x361aff(0x18d)](_0x20bc5e=>_0x20bc5e[_0x361aff(0x17b)][_0x361aff(0x184)]||0x0)),_0xef1f88=_0x499761[_0x361aff(0xed)](_0x3181d2=>(_0x3181d2[_0x361aff(0x184)]||0x0)===_0x303195);_0xef1f88&&(_0x5cbbca[_0x361aff(0xf8)]?.[_0x361aff(0xbf)]('Fetching\x20'+_0x1c31df[_0x361aff(0x190)]+'\x20v'+_0x303195),_0x117b51=await _0x16dedd(_0xef1f88['id']));}else{const _0x3a1645=_0x499761[_0x499761[_0x361aff(0xfe)]-0x1];_0x5cbbca[_0x361aff(0xf8)]?.[_0x361aff(0xbf)](_0x361aff(0xc7)+_0x1c31df[_0x361aff(0x190)]),_0x117b51=await _0x16dedd(_0x3a1645['id']);const _0x47e27f=_0x75fdb8(_0x3a1645['id']),_0x5a0bd5=await journeyResponseToDef(_0x117b51,_0x47e27f),_0x5bdd8c=buildLocalRuleToNameMappingFromJourney(_0x1c31df);_0x4993fb=buildMergedJourneyDef([{'item':_0x3a1645,'yaml':_0x5a0bd5}],_0x5bdd8c,_0x364e74);}}addFoldersToCreate(_0x501d72,_0x5cbbca[_0x361aff(0x15f)],_0x5d2901);const _0x2ca8d3=calculateJourneyDiff(_0x1c31df,_0x4993fb);_0x26c5ca[_0x361aff(0xb3)]({'relativePath':_0x1c31df['name'],'absolutePath':_0x4d32b9,'yamlConfig':_0x1c31df,'folderPath':_0x501d72,'existingJourney':_0x117b51,'isNew':_0x2ca8d3[_0x361aff(0x17a)],'hasChanges':_0x2ca8d3[_0x361aff(0x166)],'diff':_0x2ca8d3[_0x361aff(0xeb)]});}return{'journeyFiles':_0x26c5ca,'foldersToCreate':_0x5d2901};}export function calculateActivationActions(_0x1cd19d,_0x4f7321,_0x21c556,_0x13860a){const _0x56b536=a152_0x525fdb,_0x102873=[],_0x4c8bdc=new Map();for(const _0x125958 of _0x4f7321){_0x4c8bdc[_0x56b536(0xc5)](_0x125958['name'],_0x125958);}const _0x5e93d6=new Map();for(const _0xcba4af of _0x1cd19d){_0x5e93d6[_0x56b536(0xc5)](_0xcba4af['name'],_0xcba4af);}for(const _0x5948ac of _0x1cd19d){const _0x2e0253=_0x4c8bdc[_0x56b536(0xf4)](_0x5948ac[_0x56b536(0x190)]);if(!_0x2e0253)_0x102873[_0x56b536(0xb3)]({'type':_0x56b536(0x127),'name':_0x5948ac[_0x56b536(0x190)],'yamlActivation':_0x5948ac});else{const _0x399581=activationResponseToDef(_0x2e0253,_0x21c556,_0x13860a),_0x5b31f3=a152_0x1a922d[_0x56b536(0x103)](_0x399581),_0x56a427=a152_0x1a922d['stringify'](_0x5948ac);_0x5b31f3!==_0x56a427&&_0x102873[_0x56b536(0xb3)]({'type':_0x56b536(0xbf),'name':_0x5948ac[_0x56b536(0x190)],'yamlActivation':_0x5948ac,'existingActivation':_0x2e0253});}}for(const _0x119e7d of _0x4f7321){!_0x5e93d6['has'](_0x119e7d[_0x56b536(0x190)])&&_0x102873[_0x56b536(0xb3)]({'type':'delete','name':_0x119e7d[_0x56b536(0x190)],'existingActivation':_0x119e7d});}return _0x102873;}function a152_0x400d(_0x467411,_0x114365){_0x467411=_0x467411-0xa5;const _0x22ad27=a152_0x22ad();let _0x400ddc=_0x22ad27[_0x467411];return _0x400ddc;}function calculateYamlDiff(_0x523cf0,_0x576195){if(_0x576195){const _0x1774f2=generateDiff(_0x576195,_0x523cf0),_0x4981b6=hasChanges(_0x1774f2);return{'isNew':![],'hasChanges':_0x4981b6,'diff':_0x4981b6?formatDiffWithColors(_0x1774f2):undefined};}const _0x3c1f31=generateDiff('',_0x523cf0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x3c1f31)};}export function calculateSegmentDiff(_0x424c36,_0x39dee2,_0xe304f6,_0xeb5033,_0xea2589){const _0x52e832=segmentToYamlString(_0x424c36),_0x247ce9=_0x39dee2?segmentToYamlString(segmentWithActivationsToYaml(_0x39dee2,_0xe304f6,undefined,_0xeb5033,_0xea2589)):undefined;return calculateYamlDiff(_0x52e832,_0x247ce9);}export function calculateJourneyDiff(_0x43e42f,_0x2f7e1c){const _0x1262b4=normalizeJourneyDef(_0x43e42f,_0x43e42f),_0x3dd0f7=a152_0x859add(_0x1262b4),_0x158e51=_0x2f7e1c?a152_0x859add(normalizeJourneyDef(_0x2f7e1c,_0x43e42f)):undefined;return calculateYamlDiff(_0x3dd0f7,_0x158e51);}export function findSegmentsToDelete(_0x3621da,_0x3084bc,_0x5ce1ba,_0x3ed292,_0x179dea){const _0x384cd1=a152_0x525fdb,_0x15d545=new Set();for(const {yamlConfig:_0x326d36,folderPath:_0x4a91e6}of _0x3084bc){_0x15d545[_0x384cd1(0xc1)](_0x4a91e6+':'+_0x326d36['name']);}return _0x3621da[_0x384cd1(0x134)](_0x2f793f=>{const _0x140a73=_0x384cd1,_0x391584=_0x2f793f[_0x140a73(0xd5)]?_0x5ce1ba[_0x140a73(0xf4)](_0x2f793f['segmentFolderId'][_0x140a73(0x115)]())||'':'',_0x3eb8d1=_0x391584+':'+_0x2f793f['name'];if(_0x15d545['has'](_0x3eb8d1))return![];if(_0x179dea)return _0x391584===_0x3ed292||_0x391584['startsWith'](_0x3ed292+'/');return!![];});}export function findJourneysToDelete(_0x485d92,_0x3630dd,_0x597cb0,_0x4272ee,_0xe76f7){const _0x3b9b4b=a152_0x525fdb,_0xa4320b=new Set();for(const {yamlConfig:_0x14c529,folderPath:_0x15c346}of _0x3630dd){_0xa4320b[_0x3b9b4b(0xc1)](_0x15c346+':'+_0x14c529[_0x3b9b4b(0x190)]);}return _0x485d92['filter'](_0x5a4ea9=>{const _0x37af42=_0x3b9b4b,_0x49beb0=_0x5a4ea9[_0x37af42(0xbc)]?_0x597cb0[_0x37af42(0xf4)](_0x5a4ea9[_0x37af42(0xbc)])||'':'',_0x4c5d11=_0x49beb0+':'+_0x5a4ea9['journeyBundleName'];if(_0xa4320b[_0x37af42(0x162)](_0x4c5d11))return![];if(_0xe76f7)return _0x49beb0===_0x4272ee||_0x49beb0[_0x37af42(0x106)](_0x4272ee+'/');return!![];});}export function buildSegmentLookupMap(_0x5410c7,_0x3b7cae){const _0xf3356e=a152_0x525fdb,_0x51eb58=new Map();for(const _0x3ba01c of _0x5410c7){const _0x5de639=_0x3ba01c[_0xf3356e(0xd5)]?_0x3b7cae['get'](_0x3ba01c['segmentFolderId']['toString']())||'':'',_0x4fd985=_0x5de639+':'+_0x3ba01c[_0xf3356e(0x190)];_0x51eb58[_0xf3356e(0xc5)](_0x4fd985,_0x3ba01c);}return _0x51eb58;}export function buildSegmentNameToIdMap(_0x160c3f){const _0x16475b=a152_0x525fdb,_0xc8e3b3=new Map();for(const _0x34f233 of _0x160c3f){_0xc8e3b3[_0x16475b(0xc5)](_0x34f233[_0x16475b(0x190)],_0x34f233['id']);}return _0xc8e3b3;}export function buildJourneyBundleLookupMap(_0x4f0b9e,_0x3a0e9f){const _0x122dec=a152_0x525fdb,_0x67b88a=new Map();for(const _0x2d29af of _0x4f0b9e){const _0x1335bd=_0x2d29af[_0x122dec(0xbc)]?_0x3a0e9f[_0x122dec(0xf4)](_0x2d29af['folderId'])||'':'',_0x125a94=_0x1335bd+':'+_0x2d29af[_0x122dec(0x183)];!_0x67b88a['has'](_0x125a94)&&_0x67b88a['set'](_0x125a94,[]),_0x67b88a[_0x122dec(0xf4)](_0x125a94)[_0x122dec(0xb3)](_0x2d29af);}for(const _0x34250e of _0x67b88a[_0x122dec(0xe3)]()){_0x34250e[_0x122dec(0x181)]((_0xd2c941,_0x223725)=>(_0xd2c941[_0x122dec(0x184)]||0x0)-(_0x223725['versionNumber']||0x0));}return _0x67b88a;}export function collectFoldersToCreate(_0x59ccf1,_0x29bfbc){const _0xb5d0ca=a152_0x525fdb,_0x4fb658=new Set();for(const _0x97c7 of _0x59ccf1){if(!_0x97c7)continue;if(_0x29bfbc[_0xb5d0ca(0x162)](_0x97c7))continue;const _0x26c16e=_0x97c7['split']('/');let _0x3fd2f3='';for(const _0x428cbc of _0x26c16e){_0x3fd2f3=_0x3fd2f3?_0x3fd2f3+'/'+_0x428cbc:_0x428cbc,!_0x29bfbc[_0xb5d0ca(0x162)](_0x3fd2f3)&&_0x4fb658[_0xb5d0ca(0xc1)](_0x3fd2f3);}}return _0x4fb658;}export function parseAndClassifyYamlFiles(_0x1d7a78,_0x50469e,_0x5822cf){const _0x2eed87=a152_0x525fdb,_0x3dc6b4=[],_0x2d60cd=[];for(const _0x430701 of _0x1d7a78){const _0x141ffd=a152_0x2423ed[_0x2eed87(0xe1)](_0x50469e,a152_0x2423ed[_0x2eed87(0x146)](_0x430701)),_0x2136d3=_0x141ffd==='.'?'':_0x141ffd[_0x2eed87(0x121)](/\\/g,'/'),_0x1522d2=readFileSync(_0x430701,_0x2eed87(0x177)),_0x516878=a152_0x1a922d[_0x2eed87(0xa6)](_0x1522d2);if(isJourneyDef(_0x516878)){const _0x21a502=a152_0xd896e(_0x1522d2);_0x2d60cd[_0x2eed87(0xb3)]({'yamlConfig':_0x21a502,'folderPath':_0x2136d3,'sourcePath':_0x430701});}else{if(!_0x5822cf?.['skipSegments']){const _0x576db5=parseSegmentYamlFile(_0x1522d2),_0x249750=normalizeChildSegmentYaml(_0x576db5);_0x3dc6b4[_0x2eed87(0xb3)]({'yamlConfig':_0x249750,'folderPath':_0x2136d3,'sourcePath':_0x430701});}}}return{'segments':_0x3dc6b4,'journeys':_0x2d60cd};}export function validateParsedFiles(_0x3f74d3,_0x43fcf5){const _0x2a118d=a152_0x525fdb,_0x28cedb=[];for(const {yamlConfig:_0x3dd09e,sourcePath:_0x366d93}of _0x3f74d3[_0x2a118d(0x104)]){const _0x27738=readFileSync(_0x366d93,'utf-8'),_0x26b9db=a152_0x1a922d[_0x2a118d(0xa7)](_0x27738),_0x192048=validateSegmentDef(_0x3dd09e,{'source':_0x27738,'document':_0x26b9db},{'skipSchema':!![]});if(!_0x192048[_0x2a118d(0xc6)]){const _0x3b25e8=a152_0x2423ed[_0x2a118d(0xe1)](_0x43fcf5,_0x366d93);_0x28cedb[_0x2a118d(0xb3)]({'filePath':_0x3b25e8,'source':_0x27738,'result':_0x192048,'isJourney':![]});}}for(const {yamlConfig:_0x199753,sourcePath:_0x322b06}of _0x3f74d3['journeys']){const _0x2bf669=readFileSync(_0x322b06,_0x2a118d(0x177)),_0x895aa2=a152_0x1a922d[_0x2a118d(0xa7)](_0x2bf669),_0x470d97=validateJourneyDef(_0x199753,{'source':_0x2bf669,'document':_0x895aa2},{'skipSchema':!![]});if(!_0x470d97[_0x2a118d(0xc6)]){const _0x11954d=a152_0x2423ed[_0x2a118d(0xe1)](_0x43fcf5,_0x322b06);_0x28cedb[_0x2a118d(0xb3)]({'filePath':_0x11954d,'source':_0x2bf669,'result':_0x470d97,'isJourney':!![]});}}return _0x28cedb;}export function formatValidationErrors(_0x258295){const _0x360c35=a152_0x525fdb,_0x49e406=[];for(const {filePath:_0x27cf28,source:_0x3c9312,result:_0x140401,isJourney:_0x43b86c}of _0x258295){const _0x5ade46=_0x43b86c?_0x360c35(0x168):'segment';_0x49e406['push']('\x0a'+_0x27cf28+'\x20('+_0x5ade46+_0x360c35(0x141)+_0x140401[_0x360c35(0x19f)][_0x360c35(0xfe)]+_0x360c35(0x10a)),_0x49e406[_0x360c35(0xb3)](formatValidationResult(_0x140401,_0x3c9312,_0x27cf28));}return _0x49e406['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x407f6f){const _0x31bee7=a152_0x525fdb,_0xdf358=new Set(),_0x390b14=new Map(),_0x5e6950=collectSegmentUsageCounts(_0x407f6f);if(_0x407f6f[_0x31bee7(0x104)])for(const [_0x156b6e,_0x3c3d6b]of Object[_0x31bee7(0x18a)](_0x407f6f[_0x31bee7(0x104)])){_0xdf358['add'](_0x156b6e);if(_0x3c3d6b[_0x31bee7(0x144)]){const _0x220d4e=yamlRuleToApi(_0x3c3d6b['rule']),_0x530897=apiRuleToYaml(_0x220d4e);_0x390b14[_0x31bee7(0xc5)](_0x156b6e,_0x530897);}}const _0x688f58=new Map();let _0x145f73=0x0;for(const [_0x4577fa,_0x35e16d]of _0x390b14){const _0x36a379=serializeExpandedRule(_0x35e16d,_0x390b14),_0x369148=_0x688f58['get'](_0x36a379)||[];_0x369148['push']({'name':_0x4577fa,'index':_0x145f73}),_0x688f58['set'](_0x36a379,_0x369148),_0x145f73++;}const _0x1c4e2b=new Map();for(const [_0x42039,_0x488a20]of _0x688f58){const _0x2587cc=_0x488a20[_0x31bee7(0xc8)]()[_0x31bee7(0x181)]((_0x5e6ae5,_0x196739)=>{const _0x27dec1=_0x31bee7,_0x5bb555=_0x5e6950['get'](_0x5e6ae5[_0x27dec1(0x190)])||0x0,_0x5723ae=_0x5e6950[_0x27dec1(0xf4)](_0x196739['name'])||0x0;if(_0x5bb555!==_0x5723ae)return _0x5723ae-_0x5bb555;return _0x5e6ae5[_0x27dec1(0x124)]-_0x196739[_0x27dec1(0x124)];})[_0x31bee7(0x18d)](_0xcab2ec=>_0xcab2ec[_0x31bee7(0x190)]),_0x51979d=[];for(const _0x4b1cfc of _0x2587cc){const _0x7cc8d4=_0x5e6950[_0x31bee7(0xf4)](_0x4b1cfc)||0x0,_0x957b6e=Math[_0x31bee7(0xc0)](_0x7cc8d4,0x1);for(let _0x3f26dc=0x0;_0x3f26dc<_0x957b6e;_0x3f26dc++){_0x51979d[_0x31bee7(0xb3)](_0x4b1cfc);}}_0x1c4e2b[_0x31bee7(0xc5)](_0x42039,_0x51979d);}return{'existingLocalSegmentNames':_0xdf358,'localSegmentRules':_0x390b14,'localExpandedRuleToNames':_0x1c4e2b};}export function createSegmentIdResolver(_0x580c6a,_0x80d369){return async _0x5cb84c=>{const _0x56a299=a152_0x400d,_0x2d0e4d=_0x580c6a[_0x56a299(0xf4)](_0x5cb84c);if(!_0x2d0e4d)throw new SDKError(ErrorCode[_0x56a299(0x1aa)],_0x56a299(0xca)+_0x5cb84c+_0x56a299(0x12b)+_0x80d369+'\x27)');return _0x2d0e4d;};}export function extractRootFolderId(_0x13206e){const _0x104507=a152_0x525fdb;return _0x13206e[_0x104507(0x1a0)]?.[_0x104507(0xab)]?.[_0x104507(0x123)]?.['id']||_0x13206e[_0x104507(0x1a0)]?.[_0x104507(0x17f)]?.[_0x104507(0x123)]?.['id'];}export function buildConnectionMaps(_0x587d19){const _0x15e2e7=a152_0x525fdb,_0x7d4204=new Map(),_0x4a3112=new Map(),_0x53c709=new Map();for(const _0x34fbae of _0x587d19){_0x7d4204['set'](_0x34fbae[_0x15e2e7(0x190)],parseInt(_0x34fbae['id'],0xa)),_0x4a3112[_0x15e2e7(0xc5)](_0x34fbae['id'],_0x34fbae[_0x15e2e7(0x190)]),_0x53c709[_0x15e2e7(0xc5)](_0x34fbae['name'],_0x34fbae[_0x15e2e7(0x186)]);}return{'nameToId':_0x7d4204,'idToName':_0x4a3112,'nameToType':_0x53c709};}export function calculatePushStats(_0x208823,_0x5b7a25,_0x45d0b8,_0x56da48,_0x2dbc19,_0x1e2ada,_0x38de2b){const _0x2205ac=a152_0x525fdb,_0x29d299=_0x208823[_0x2205ac(0x134)](_0x3a15db=>_0x3a15db[_0x2205ac(0x17a)]),_0x119ec5=_0x208823['filter'](_0x273519=>!_0x273519['isNew']&&_0x273519['hasChanges']),_0xc5d414=_0x208823[_0x2205ac(0x134)](_0x447138=>!_0x447138[_0x2205ac(0x17a)]&&!_0x447138[_0x2205ac(0x166)]),_0x14bb5a=_0x1e2ada?_0x56da48:[],_0x41667b=_0x5b7a25[_0x2205ac(0x134)](_0x1bbec3=>_0x1bbec3[_0x2205ac(0x17a)]),_0x3adf61=_0x5b7a25['filter'](_0x15bf36=>!_0x15bf36[_0x2205ac(0x17a)]&&_0x15bf36[_0x2205ac(0x166)]),_0x3f6810=_0x5b7a25[_0x2205ac(0x134)](_0x723ad=>!_0x723ad[_0x2205ac(0x17a)]&&!_0x723ad[_0x2205ac(0x166)]),_0x2e017d=_0x1e2ada?_0x2dbc19:[],_0x35e39b=_0x208823['flatMap'](_0x4cd8ca=>_0x4cd8ca[_0x2205ac(0x197)]),_0x56179d=_0x35e39b[_0x2205ac(0x134)](_0x5c7035=>_0x5c7035[_0x2205ac(0x186)]===_0x2205ac(0x127)),_0x2ec5ec=_0x35e39b[_0x2205ac(0x134)](_0x2a3414=>_0x2a3414[_0x2205ac(0x186)]===_0x2205ac(0xbf)),_0x52bed5=_0x35e39b[_0x2205ac(0x134)](_0x4040f4=>_0x4040f4[_0x2205ac(0x186)]==='delete'),_0x3effc5=Array[_0x2205ac(0xe9)](_0x45d0b8)['sort'](),_0x449d28=_0x38de2b?![]:_0x29d299[_0x2205ac(0xfe)]>0x0||_0x119ec5[_0x2205ac(0xfe)]>0x0||_0x14bb5a[_0x2205ac(0xfe)]>0x0,_0x1bc684=_0x41667b[_0x2205ac(0xfe)]>0x0||_0x3adf61['length']>0x0||_0x2e017d[_0x2205ac(0xfe)]>0x0,_0x473b3b=_0x38de2b?![]:_0x35e39b[_0x2205ac(0xfe)]>0x0,_0xc74a09=_0x3effc5[_0x2205ac(0xfe)]>0x0;return{'segments':{'new':_0x29d299,'changed':_0x119ec5,'unchanged':_0xc5d414,'toDelete':_0x14bb5a},'journeys':{'new':_0x41667b,'changed':_0x3adf61,'unchanged':_0x3f6810,'toDelete':_0x2e017d},'activations':{'all':_0x35e39b,'toCreate':_0x56179d,'toUpdate':_0x2ec5ec,'toDelete':_0x52bed5},'folders':{'toCreate':_0x3effc5},'counts':{'segments':{'new':_0x29d299['length'],'changed':_0x119ec5[_0x2205ac(0xfe)],'unchanged':_0xc5d414[_0x2205ac(0xfe)],'toDelete':_0x14bb5a[_0x2205ac(0xfe)]},'journeys':{'new':_0x41667b[_0x2205ac(0xfe)],'changed':_0x3adf61['length'],'unchanged':_0x3f6810[_0x2205ac(0xfe)],'toDelete':_0x2e017d[_0x2205ac(0xfe)]},'activations':{'create':_0x56179d[_0x2205ac(0xfe)],'update':_0x2ec5ec['length'],'delete':_0x52bed5[_0x2205ac(0xfe)]},'folders':_0x3effc5['length']},'hasChanges':_0x449d28||_0x1bc684||_0x473b3b||_0xc74a09};}export async function buildPushExecutionContext(_0x5754d9,_0x6a51b4,_0x135868,_0x3a53f3,_0x155920,_0x4d53fa){const _0x1f7bb5=a152_0x525fdb,_0x49efa3=extractRootFolderId(_0x135868),{pathToId:_0x3e9e6d,idToPath:_0x152699}=buildFolderMaps(_0x155920),_0x51909c=buildSegmentNameToIdMap(_0x3a53f3),_0x4ffa4=new Map(),{batchAsync:_0x5b17b2}=await import('../../utils/async.js'),[_0x3c572b,_0x5db74c]=await Promise[_0x1f7bb5(0xb2)]([_0x5754d9['user'][_0x1f7bb5(0x147)](),_0x5754d9[_0x1f7bb5(0x159)][_0x1f7bb5(0x15a)](),((async()=>{const _0x148165=_0x1f7bb5;!_0x4d53fa&&_0x3a53f3[_0x148165(0xfe)]>0x0&&await _0x5b17b2(_0x3a53f3,async _0x38d285=>{const _0x2ef60d=await _0x5754d9['segment']['listActivations'](_0x6a51b4,_0x38d285['id']);_0x4ffa4['set'](_0x38d285['id'],_0x2ef60d);});})())]),{emailToId:_0x2f285f,idToEmail:_0x428482}=_0x3c572b,_0x428dda=buildConnectionMaps(_0x5db74c);return{'rootFolderId':_0x49efa3,'folderPathToId':_0x3e9e6d,'folderIdToPath':_0x152699,'segmentNameToId':_0x51909c,'activationsBySegmentId':_0x4ffa4,'emailToIdMap':_0x2f285f,'idToEmailMap':_0x428482,'connectionNameToIdMap':_0x428dda[_0x1f7bb5(0xf9)],'connectionIdToNameMap':_0x428dda[_0x1f7bb5(0xb1)],'connectionNameToTypeMap':_0x428dda[_0x1f7bb5(0x164)]};}export function createPushYamlContextForBundle(_0x34ce8d,_0x4f51f3,_0x2915d7,_0x48265,_0x5541d3,_0x485aeb,_0x3a4005,_0x5b7221){const {existingLocalSegmentNames:_0x4c3a40,localExpandedRuleToNames:_0x34c2c2}=_0x48265,_0x2e3872=new Set(),_0x1a7215=new Map(),_0x230f42=new Map(),_0x3bf967=new Map(),_0x469ba3=createJumpTargetCache(),_0x4f4d9b=new Map(),_0x20d7a0=new Map(),_0x7123cd=new Set();let _0x562047;const _0x379173=_0x3c1c8d=>{const _0x3b039e={'resolveSegment':async _0x359413=>{const _0xa15f82=a152_0x400d,_0x5932ba=_0x3bf967[_0xa15f82(0xf4)](_0x359413);if(_0x5932ba!==undefined)return{'name':_0x5932ba,'isJourneyLocal':!![]};try{const _0x5d80fa=await fetchSegment(_0x34ce8d,_0x4f51f3,_0x359413,_0x2915d7);if(!_0x5d80fa)throw new Error(_0xa15f82(0x12c));const _0x362b19=generateJourneyLocalName(_0x5d80fa[_0xa15f82(0x190)]),_0x2140d9=_0x5d80fa[_0xa15f82(0xa9)]===SEGMENT_KIND_JOURNEY&&_0x362b19!==undefined;let _0x51309f=_0x5d80fa[_0xa15f82(0x190)],_0x42a583;if(_0x2140d9&&_0x5d80fa['rule']){const _0x1c95c1=apiRuleToYaml(_0x5d80fa[_0xa15f82(0x144)]);_0x20d7a0['set'](_0x359413,_0x1c95c1);const _0x287467=async _0x16c5db=>{const _0x23951c=_0xa15f82,_0x5e7b3d=collectSegmentRefsFromRule(_0x16c5db);for(const _0x49443b of _0x5e7b3d){if(!_0x20d7a0[_0x23951c(0x162)](_0x49443b))try{const _0x206d4b=await fetchSegment(_0x34ce8d,_0x4f51f3,_0x49443b,_0x2915d7);if(_0x206d4b?.[_0x23951c(0x144)]){const _0x587430=apiRuleToYaml(_0x206d4b[_0x23951c(0x144)]);_0x20d7a0[_0x23951c(0xc5)](_0x49443b,_0x587430),await _0x287467(_0x587430);}}catch(_0x5bd314){logger['debug'](_0x23951c(0x102)+_0x49443b+':\x20'+_0x5bd314);}}};await _0x287467(_0x1c95c1);const _0x96ceb4=serializeExpandedRule(_0x1c95c1,_0x20d7a0),_0x47a7db=_0x34c2c2[_0xa15f82(0xf4)](_0x96ceb4);if(_0x47a7db&&_0x47a7db['length']>0x0){const _0x3d39e4=_0x1a7215[_0xa15f82(0xf4)](_0x96ceb4)||0x0,_0x333eb6=_0x47a7db[_0x3d39e4]||_0x47a7db[_0x47a7db[_0xa15f82(0xfe)]-0x1];_0x1a7215['set'](_0x96ceb4,_0x3d39e4+0x1),_0x51309f=_0x333eb6,_0x2e3872[_0xa15f82(0xc1)](_0x51309f),_0x3bf967[_0xa15f82(0xc5)](_0x359413,_0x51309f);const _0x1540fc=await resolveRuleSegmentRefs(_0x1c95c1,async _0x55d3aa=>{const _0x1034bb=_0xa15f82,_0x344921=_0x3bf967[_0x1034bb(0xf4)](_0x55d3aa);if(_0x344921)return _0x344921;const _0x29a495=await _0x562047['resolveSegment'](_0x55d3aa);return _0x29a495[_0x1034bb(0x190)];});_0x42a583={'description':_0x5d80fa['description'],'rule':_0x1540fc};}else{const _0x3974fb=_0x4f4d9b['get'](_0x96ceb4);if(_0x3974fb)_0x51309f=_0x3974fb,_0x3bf967[_0xa15f82(0xc5)](_0x359413,_0x51309f);else{if(_0x362b19){let _0x4a4405=_0x362b19,_0x22a3ee=0x2;while(_0x2e3872[_0xa15f82(0x162)](_0x4a4405)||_0x4c3a40[_0xa15f82(0x162)](_0x4a4405)){_0x4a4405=_0x362b19+'_'+_0x22a3ee,_0x22a3ee++;}_0x2e3872[_0xa15f82(0xc1)](_0x4a4405),_0x51309f=_0x4a4405;}_0x3bf967[_0xa15f82(0xc5)](_0x359413,_0x51309f),_0x4f4d9b[_0xa15f82(0xc5)](_0x96ceb4,_0x51309f);const _0x55cb2b=await resolveRuleSegmentRefs(_0x1c95c1,async _0x6bc220=>{const _0x1b0216=_0xa15f82,_0x3709a9=_0x3bf967['get'](_0x6bc220);if(_0x3709a9)return _0x3709a9;const _0x2015a8=await _0x562047[_0x1b0216(0x101)](_0x6bc220);return _0x2015a8[_0x1b0216(0x190)];});_0x42a583={'description':_0x5d80fa[_0xa15f82(0x117)],'rule':_0x55cb2b};}}}return{'name':_0x51309f,'isJourneyLocal':_0x2140d9,'definition':_0x42a583};}catch(_0x3cb70e){return logger['debug'](_0xa15f82(0x13a)+_0x359413+':\x20'+_0x3cb70e),{'name':_0x359413,'isJourneyLocal':![]};}},'resolveActivation':async _0x5a3bcd=>{const _0x31806c=a152_0x400d,_0x1eac16=_0x230f42['get'](_0x5a3bcd);if(_0x1eac16!==undefined)return{'name':_0x1eac16,'isJourneyLocal':!![]};try{let _0x45c97b=_0x3a4005?.[_0x31806c(0xf4)](_0x5a3bcd);!_0x45c97b&&(_0x45c97b=await _0x34ce8d['journey'][_0x31806c(0x14a)](_0x3c1c8d,_0x5a3bcd));const _0x5e5d38=_0x45c97b['attributes'][_0x31806c(0x16e)][_0x31806c(0x190)]||_0x5a3bcd,_0x3dd496=sanitizeYamlKey(_0x5e5d38)||_0x31806c(0x14b)+_0x5a3bcd,_0x34d565=_0x3dd496;_0x230f42[_0x31806c(0xc5)](_0x5a3bcd,_0x34d565);const _0x14dd1e=journeyActivationStepToYaml(_0x45c97b,_0x5541d3,_0x485aeb);return{'name':_0x34d565,'isJourneyLocal':!![],'definition':_0x14dd1e};}catch(_0x22ce73){return logger[_0x31806c(0x112)](_0x31806c(0xae)+_0x5a3bcd+':\x20'+_0x22ce73),{'name':_0x5a3bcd,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xf6db73,_0x2659f9)=>resolveJumpTarget(_0xf6db73,_0x2659f9,_0x469ba3,async _0x534cd3=>{const _0x3beb3d=a152_0x400d,_0x55562e=_0x5b7221?.['get'](_0x534cd3);if(_0x55562e)return _0x55562e;return _0x34ce8d[_0x3beb3d(0x168)]['getJourney'](_0x534cd3);})};return _0x562047=_0x3b039e,_0x3b039e;},_0x4f47ff=async _0x57c2cc=>{const _0x468db4=a152_0x400d,{collectSegmentIdsFromJourneyApi:_0x4507b0}=await import(_0x468db4(0x178)),{batchAsync:_0x29652f}=await import(_0x468db4(0x10f)),_0x38faab=new Set();for(const _0x331d07 of _0x57c2cc){let _0x5b8adf=_0x5b7221?.[_0x468db4(0xf4)](_0x331d07);!_0x5b8adf&&(_0x5b8adf=await _0x34ce8d[_0x468db4(0x168)][_0x468db4(0x11b)](_0x331d07));const _0x1147e5=_0x4507b0(_0x5b8adf);for(const _0x310ff2 of _0x1147e5){_0x38faab[_0x468db4(0xc1)](_0x310ff2);}}let _0x48f5ef=Array[_0x468db4(0xe9)](_0x38faab);while(_0x48f5ef[_0x468db4(0xfe)]>0x0){const _0xf0d1fd=_0x48f5ef[_0x468db4(0x134)](_0xe86eb6=>!_0x7123cd[_0x468db4(0x162)](_0xe86eb6));if(_0xf0d1fd[_0x468db4(0xfe)]===0x0)break;const _0x4cc079=await _0x29652f(_0xf0d1fd,async _0xd5e87=>{const _0x57edf4=_0x468db4;_0x7123cd[_0x57edf4(0xc1)](_0xd5e87);const _0x4fadd8=await fetchSegment(_0x34ce8d,_0x4f51f3,_0xd5e87,_0x2915d7);if(!_0x4fadd8)return null;return{'segmentId':_0xd5e87,'segment':_0x4fadd8};},0xa),_0x4b34c7=new Set();for(const _0x540399 of _0x4cc079){if(!_0x540399?.[_0x468db4(0xb7)]?.['rule'])continue;const _0x2153f8=apiRuleToYaml(_0x540399['segment'][_0x468db4(0x144)]);_0x20d7a0[_0x468db4(0xc5)](_0x540399[_0x468db4(0x114)],_0x2153f8);const _0xf67c73=collectSegmentRefsFromRule(_0x2153f8);for(const _0x1e3fda of _0xf67c73){!_0x7123cd[_0x468db4(0x162)](_0x1e3fda)&&_0x4b34c7['add'](_0x1e3fda);}}_0x48f5ef=Array['from'](_0x4b34c7);}};return{'createYamlContext':_0x379173,'prefetchJourneySegments':_0x4f47ff};}export async function executePushSegments(_0x1c83c0,_0x292277,_0x5b3246,_0x1d6cd7,_0x113c80){const _0x2cfc76=a152_0x525fdb,{segmentDefToCreateRequest:_0x356fa7,segmentDefToUpdateRequest:_0x3a8411}=await import(_0x2cfc76(0xd4)),_0x59ce29=_0x5b3246[_0x2cfc76(0x15f)],_0xd62f96=0x5,_0x580374=async _0x1359c9=>{const _0x1328c1=_0x2cfc76,_0x15d8c2=_0x1359c9['folderPath']?_0x59ce29['get'](_0x1359c9[_0x1328c1(0x116)]):undefined;let _0x80843f;const _0x20aa1={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x30ff27=_0x1359c9[_0x1328c1(0xdc)];if(_0x1359c9['yamlConfig']['rule']){const _0x45726f=createSegmentIdResolver(_0x5b3246['segmentNameToId'],_0x1359c9[_0x1328c1(0xdc)]['name']),_0x1bbacc=await resolveRuleSegmentIds(_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x144)],_0x45726f);_0x30ff27={..._0x1359c9[_0x1328c1(0xdc)],'rule':_0x1bbacc};}try{if(_0x1359c9[_0x1328c1(0x17a)]){_0x113c80[_0x1328c1(0xe8)]?.({'type':_0x1328c1(0x13c),'name':_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)]});const _0x25eced=_0x356fa7(_0x30ff27,_0x15d8c2),_0x34e67f=await _0x113c80[_0x1328c1(0xaa)](_0x1328c1(0x188)+_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)]+'\x27...',()=>_0x1c83c0[_0x1328c1(0xb7)][_0x1328c1(0x131)](_0x1d6cd7[_0x1328c1(0x19e)],_0x25eced));_0x80843f=_0x34e67f[_0x1328c1(0x123)]['id'],_0x5b3246[_0x1328c1(0x1a9)][_0x1328c1(0xc5)](_0x1359c9['yamlConfig'][_0x1328c1(0x190)],_0x80843f),_0x20aa1['createdSegmentId']={'name':_0x1359c9['yamlConfig']['name'],'id':_0x80843f},_0x113c80[_0x1328c1(0xe8)]?.({'type':_0x1328c1(0x111),'name':_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)],'segmentId':_0x80843f}),_0x113c80['logSuccess']?.(_0x1328c1(0x105)+_0x1359c9['yamlConfig'][_0x1328c1(0x190)]+'\x27'),_0x20aa1['created']=0x1;}else{if(_0x1359c9['hasChanges']){_0x113c80[_0x1328c1(0xe8)]?.({'type':'segment_updating','name':_0x1359c9['yamlConfig']['name']});const _0x1b1e1=_0x3a8411(_0x30ff27);_0x15d8c2!==_0x1359c9[_0x1328c1(0x172)]?.['segmentFolderId']&&(_0x1b1e1['segmentFolderId']=_0x15d8c2?parseInt(_0x15d8c2,0xa):undefined),await _0x113c80['withProgress']('Updating\x20segment\x20\x27'+_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)]+_0x1328c1(0x170),()=>_0x1c83c0[_0x1328c1(0xb7)]['updateSegmentById'](_0x1d6cd7[_0x1328c1(0x19e)],_0x1359c9[_0x1328c1(0x172)]['id'],_0x1b1e1)),_0x80843f=_0x1359c9[_0x1328c1(0x172)]['id'],_0x113c80[_0x1328c1(0xe8)]?.({'type':_0x1328c1(0x126),'name':_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)]}),_0x113c80[_0x1328c1(0x140)]?.(_0x1328c1(0x10d)+_0x1359c9[_0x1328c1(0xdc)]['name']+'\x27'),_0x20aa1[_0x1328c1(0x120)]=0x1;}else _0x80843f=_0x1359c9[_0x1328c1(0x172)]['id'];}}catch(_0x4723da){const _0x13eeaa=isHttp400Error(_0x4723da),_0x556daa=_0x13eeaa?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x1328c1(0xd9)],_0x3a30e5=getErrorMessage(_0x4723da);throw new SDKError(_0x556daa,_0x1328c1(0xea)+(_0x1359c9['isNew']?_0x1328c1(0x127):_0x1328c1(0xbf))+_0x1328c1(0xf7)+_0x1359c9[_0x1328c1(0xf0)]+_0x1328c1(0x107)+_0x3a30e5,_0x4723da);}try{const _0x50012d=await syncActivationsForSegment(_0x1c83c0,_0x1d6cd7[_0x1328c1(0x19e)],_0x80843f,_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)],_0x1359c9[_0x1328c1(0x197)],_0x113c80,_0x1359c9[_0x1328c1(0xf0)]);_0x20aa1[_0x1328c1(0xe0)]=_0x50012d;}catch(_0x5a01d7){if(_0x5a01d7 instanceof SDKError)throw _0x5a01d7;throw new SDKError(ErrorCode[_0x1328c1(0x136)],_0x1328c1(0x1a7)+_0x1359c9[_0x1328c1(0xdc)][_0x1328c1(0x190)]+'\x27\x20from\x20file:\x20'+_0x1359c9[_0x1328c1(0xf0)]+_0x1328c1(0x107)+getErrorMessage(_0x5a01d7),_0x5a01d7);}return _0x20aa1;},_0x44e9df=await batchAsync(_0x292277,_0x580374,_0xd62f96),_0x3f9a77={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4e2e42 of _0x44e9df){_0x3f9a77[_0x2cfc76(0x12a)]+=_0x4e2e42[_0x2cfc76(0x12a)],_0x3f9a77['updated']+=_0x4e2e42[_0x2cfc76(0x120)],_0x4e2e42[_0x2cfc76(0x189)]&&_0x3f9a77['createdSegmentIds'][_0x2cfc76(0xc5)](_0x4e2e42['createdSegmentId'][_0x2cfc76(0x190)],_0x4e2e42['createdSegmentId']['id']),_0x3f9a77['activations'][_0x2cfc76(0x12a)]+=_0x4e2e42['activations'][_0x2cfc76(0x12a)],_0x3f9a77[_0x2cfc76(0xe0)][_0x2cfc76(0x120)]+=_0x4e2e42['activations'][_0x2cfc76(0x120)],_0x3f9a77[_0x2cfc76(0xe0)][_0x2cfc76(0x199)]+=_0x4e2e42['activations'][_0x2cfc76(0x199)];}return _0x3f9a77;}async function syncActivationsForSegment(_0x35150e,_0x288232,_0x36e2d9,_0x1faeec,_0xcd0890,_0x2623a7,_0x239b57){const _0x419b2b=a152_0x525fdb,_0x209e44={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x55e76c of _0xcd0890){try{if(_0x55e76c[_0x419b2b(0x186)]===_0x419b2b(0x127)&&_0x55e76c[_0x419b2b(0xfd)])_0x2623a7[_0x419b2b(0xe8)]?.({'type':_0x419b2b(0x1a3),'segmentName':_0x1faeec,'activationName':_0x55e76c[_0x419b2b(0x190)]}),await _0x2623a7[_0x419b2b(0xaa)](_0x419b2b(0x14e)+_0x55e76c[_0x419b2b(0x190)]+'\x27...',()=>_0x35150e['segment'][_0x419b2b(0x185)](_0x288232,_0x36e2d9,_0x55e76c['validatedRequest'])),_0x2623a7[_0x419b2b(0xe8)]?.({'type':'activation_created','segmentName':_0x1faeec,'activationName':_0x55e76c[_0x419b2b(0x190)]}),_0x2623a7['logSuccess']?.(_0x419b2b(0xba)+_0x55e76c[_0x419b2b(0x190)]+'\x27'),_0x209e44[_0x419b2b(0x12a)]++;else{if(_0x55e76c[_0x419b2b(0x186)]===_0x419b2b(0xbf)&&_0x55e76c[_0x419b2b(0xfd)]&&_0x55e76c['existingActivation'])_0x2623a7['onProgress']?.({'type':_0x419b2b(0xb9),'segmentName':_0x1faeec,'activationName':_0x55e76c[_0x419b2b(0x190)]}),await _0x2623a7[_0x419b2b(0xaa)]('Updating\x20activation\x20\x27'+_0x55e76c[_0x419b2b(0x190)]+'\x27...',()=>_0x35150e[_0x419b2b(0xb7)][_0x419b2b(0xaf)](_0x288232,_0x36e2d9,_0x55e76c[_0x419b2b(0x17e)]['id'],_0x55e76c['validatedRequest'])),_0x2623a7['onProgress']?.({'type':_0x419b2b(0x1a1),'segmentName':_0x1faeec,'activationName':_0x55e76c[_0x419b2b(0x190)]}),_0x2623a7[_0x419b2b(0x140)]?.(_0x419b2b(0x129)+_0x55e76c[_0x419b2b(0x190)]+'\x27'),_0x209e44['updated']++;else _0x55e76c['type']==='delete'&&_0x55e76c[_0x419b2b(0x17e)]&&(_0x2623a7[_0x419b2b(0xe8)]?.({'type':_0x419b2b(0x143),'segmentName':_0x1faeec,'activationName':_0x55e76c[_0x419b2b(0x190)]}),await _0x2623a7['withProgress'](_0x419b2b(0xdb)+_0x55e76c['name']+_0x419b2b(0x170),()=>_0x35150e[_0x419b2b(0xb7)]['deleteActivation'](_0x288232,_0x36e2d9,_0x55e76c['existingActivation']['id'])),_0x2623a7[_0x419b2b(0xe8)]?.({'type':'activation_deleted','segmentName':_0x1faeec,'activationName':_0x55e76c[_0x419b2b(0x190)]}),_0x2623a7[_0x419b2b(0x187)]?.(_0x419b2b(0xdd)+_0x55e76c['name']+'\x27'),_0x209e44['deleted']++);}}catch(_0x1bd3b3){const _0x52cb67=isHttp400Error(_0x1bd3b3),_0x2eaf6c=_0x52cb67?ErrorCode[_0x419b2b(0x174)]:ErrorCode[_0x419b2b(0x136)],_0x402ecb=getErrorMessage(_0x1bd3b3);throw new SDKError(_0x2eaf6c,_0x419b2b(0xea)+_0x55e76c[_0x419b2b(0x186)]+_0x419b2b(0x149)+_0x55e76c[_0x419b2b(0x190)]+_0x419b2b(0x19c)+_0x239b57+_0x419b2b(0x107)+_0x402ecb,_0x1bd3b3);}}return _0x209e44;}export async function executePushFolders(_0x1b028a,_0x496341,_0xb73fb7,_0x24f296,_0x50884e){const _0x4ef1de=a152_0x525fdb,_0x3c9611=new Map(_0xb73fb7),_0x4cc7bf=sortFoldersByDepth(_0x496341);for(const _0x5864f9 of _0x4cc7bf){const _0x1047db=_0x5864f9[_0x4ef1de(0x125)]('/'),_0x4c88bb=_0x1047db[_0x1047db[_0x4ef1de(0xfe)]-0x1],_0x386b32=_0x1047db[_0x4ef1de(0xc8)](0x0,-0x1)['join']('/'),_0x5862c7=_0x3c9611[_0x4ef1de(0xf4)](_0x386b32);_0x50884e[_0x4ef1de(0xe8)]?.({'type':_0x4ef1de(0x1ac),'folder':_0x5864f9});const _0x2920e9={'name':_0x4c88bb,'parentFolderId':_0x5862c7},_0x1ac0f1=await _0x50884e[_0x4ef1de(0xaa)](_0x4ef1de(0xce)+_0x5864f9+_0x4ef1de(0x170),()=>_0x1b028a[_0x4ef1de(0xb7)][_0x4ef1de(0xf1)](_0x24f296[_0x4ef1de(0x19e)],_0x2920e9));_0x3c9611[_0x4ef1de(0xc5)](_0x5864f9,_0x1ac0f1[_0x4ef1de(0x123)]['id']),_0x50884e[_0x4ef1de(0xe8)]?.({'type':'folder_created','folder':_0x5864f9,'folderId':_0x1ac0f1[_0x4ef1de(0x123)]['id']}),_0x50884e[_0x4ef1de(0xbd)]?.(_0x4ef1de(0x137)+_0x5864f9+'\x27');}return _0x3c9611;}export async function executePushSegmentDeletions(_0x53ca3b,_0x73dcd1,_0x4c2f8e){const _0x1ba601=a152_0x525fdb;if(_0x73dcd1[_0x1ba601(0xfe)]===0x0)return 0x0;const {batchAsync:_0x1b6296}=await import(_0x1ba601(0x10f)),_0x43c4cf=0x5,_0x829ec5=await _0x1b6296(_0x73dcd1,async _0x15f059=>{const _0x3368c9=_0x1ba601;return _0x4c2f8e[_0x3368c9(0xe8)]?.({'type':_0x3368c9(0x150),'name':_0x15f059[_0x3368c9(0x190)]}),await _0x53ca3b[_0x3368c9(0xb7)]['deleteSegment'](_0x15f059['id']),_0x4c2f8e[_0x3368c9(0xe8)]?.({'type':_0x3368c9(0x14f),'name':_0x15f059[_0x3368c9(0x190)]}),_0x4c2f8e[_0x3368c9(0x187)]?.(_0x3368c9(0xc4)+_0x15f059['name']+'\x27'),0x1;},_0x43c4cf);return _0x829ec5[_0x1ba601(0x16a)]((_0x65f2a9,_0x4cb31b)=>_0x65f2a9+_0x4cb31b,0x0);}export async function executePushJourneys(_0xf118f8,_0x16e824,_0x2a5858,_0x5ba602,_0x123ad5){const _0x242e6b=a152_0x525fdb,{journeyDefToRequest:_0x2730d9}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x15ac92,yamlRuleToApi:_0x3efd62,validateSegmentRule:_0x5e827c}=await import(_0x242e6b(0xd4)),_0xba8deb={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x3e6119=new Map(_0x2a5858[_0x242e6b(0x1a9)]),_0x1a8c17=0x5;for(let _0x1a6530=0x0;_0x1a6530<_0x16e824[_0x242e6b(0xfe)];_0x1a6530+=_0x1a8c17){const _0x3b6e4f=_0x16e824[_0x242e6b(0xc8)](_0x1a6530,_0x1a6530+_0x1a8c17),_0x175c68=await Promise[_0x242e6b(0xb2)](_0x3b6e4f[_0x242e6b(0x18d)](async _0x1aff24=>{const _0x4bb4cb=_0x242e6b;if(!_0x1aff24[_0x4bb4cb(0x17a)]&&!_0x1aff24[_0x4bb4cb(0x166)])return{'action':_0x4bb4cb(0xcd),'name':_0x1aff24[_0x4bb4cb(0xdc)][_0x4bb4cb(0x190)],'journeyId':_0x1aff24[_0x4bb4cb(0x10e)]?.['id']};const _0x1169c0=_0x1aff24[_0x4bb4cb(0x116)]?_0x2a5858[_0x4bb4cb(0x15f)][_0x4bb4cb(0xf4)](_0x1aff24[_0x4bb4cb(0x116)]):undefined;_0x123ad5[_0x4bb4cb(0xe8)]?.({'type':_0x1aff24[_0x4bb4cb(0x17a)]?_0x4bb4cb(0x15d):_0x4bb4cb(0x130),'name':_0x1aff24[_0x4bb4cb(0xdc)][_0x4bb4cb(0x190)]});try{const _0x288b12=await executeSingleJourneyPush(_0xf118f8,_0x1aff24,{..._0x2a5858,'segmentNameToId':_0x3e6119},{'parentId':_0x5ba602['parentId'],'rootFolderId':_0x5ba602[_0x4bb4cb(0xf5)],'folderId':_0x1169c0,'verbose':_0x5ba602[_0x4bb4cb(0x13f)]},_0x123ad5,{'journeyDefToRequest':_0x2730d9,'activationDefToCreateRequest':_0x15ac92,'yamlRuleToApi':_0x3efd62,'validateSegmentRule':_0x5e827c});for(const [_0x47293a,_0xa96ec6]of _0x288b12[_0x4bb4cb(0xf6)]){_0x3e6119[_0x4bb4cb(0xc5)](_0x47293a,_0xa96ec6),_0xba8deb['embeddedSegmentNameToId'][_0x4bb4cb(0xc5)](_0x47293a,_0xa96ec6);}if(_0x288b12[_0x4bb4cb(0x173)]==='created')_0x123ad5[_0x4bb4cb(0xe8)]?.({'type':'journey_created','name':_0x1aff24[_0x4bb4cb(0xdc)][_0x4bb4cb(0x190)],'journeyId':_0x288b12[_0x4bb4cb(0x16c)]}),_0x123ad5[_0x4bb4cb(0x140)]?.(_0x4bb4cb(0xc2)+_0x1aff24[_0x4bb4cb(0xdc)][_0x4bb4cb(0x190)]+'\x27'),_0xba8deb[_0x4bb4cb(0x12a)]++;else _0x288b12['action']===_0x4bb4cb(0x120)&&(_0x123ad5[_0x4bb4cb(0xe8)]?.({'type':_0x4bb4cb(0xc9),'name':_0x1aff24[_0x4bb4cb(0xdc)]['name']}),_0x123ad5['logSuccess']?.(_0x4bb4cb(0x17d)+_0x1aff24[_0x4bb4cb(0xdc)][_0x4bb4cb(0x190)]+'\x27'),_0xba8deb[_0x4bb4cb(0x120)]++);return{'action':_0x288b12[_0x4bb4cb(0x173)],'name':_0x1aff24[_0x4bb4cb(0xdc)][_0x4bb4cb(0x190)],'journeyId':_0x288b12[_0x4bb4cb(0x16c)]};}catch(_0xea3a5e){const _0x4e810c=isHttp400Error(_0xea3a5e),_0x4efee9=_0x4e810c?ErrorCode[_0x4bb4cb(0xb5)]:ErrorCode[_0x4bb4cb(0xb4)],_0x3fcbfb=getErrorMessage(_0xea3a5e);throw new SDKError(_0x4efee9,_0x4bb4cb(0xea)+(_0x1aff24[_0x4bb4cb(0x17a)]?'create':'update')+'\x20journey\x20from\x20file:\x20'+_0x1aff24[_0x4bb4cb(0xf0)]+_0x4bb4cb(0x107)+_0x3fcbfb,_0xea3a5e);}}));_0xba8deb[_0x242e6b(0x11f)][_0x242e6b(0xb3)](..._0x175c68);}return _0xba8deb;}async function matchExistingJourneySegments(_0x3a876f,_0x4c4b81,_0x75f9a4,_0x1c2298,_0x15c054){const _0x71de6e=a152_0x525fdb;if(!_0x4c4b81[_0x71de6e(0x10e)]||!_0x4c4b81[_0x71de6e(0xdc)][_0x71de6e(0x104)])return;const _0x5c489b=new Map(),_0x51e8d8=new Set();for(const _0x48f1c0 of Object[_0x71de6e(0x17c)](_0x4c4b81[_0x71de6e(0xdc)]['segments'])){const _0x3620b1=generateDeterministicJourneySegmentName(_0x4c4b81['yamlConfig'][_0x71de6e(0x190)],_0x48f1c0);_0x5c489b['set'](_0x3620b1,_0x48f1c0),_0x51e8d8[_0x71de6e(0xc1)](_0x48f1c0);}const _0x5a8d8d=[],_0x2d564f=collectSegmentIdsFromJourneyApi(_0x4c4b81['existingJourney']);for(const _0x120d08 of _0x2d564f){const _0xf27583=await fetchSegment(_0x3a876f,_0x75f9a4,_0x120d08,_0x1c2298);if(!_0xf27583?.[_0x71de6e(0x190)])continue;const _0x49a4be=_0x5c489b[_0x71de6e(0xf4)](_0xf27583[_0x71de6e(0x190)]);_0x49a4be?(_0x15c054[_0x71de6e(0xc5)](_0x49a4be,_0x120d08),_0x51e8d8[_0x71de6e(0x11d)](_0x49a4be)):_0x5a8d8d[_0x71de6e(0xb3)]({'id':_0x120d08,'seg':_0xf27583});}if(_0x51e8d8['size']>0x0&&_0x5a8d8d['length']>0x0){const {localExpandedRuleToNames:_0x4a2724}=buildLocalExpandedRuleMappings(_0x4c4b81[_0x71de6e(0xdc)]),_0x11f5f6=new Map();for(const {id:_0x56cb3a,seg:_0x24bde3}of _0x5a8d8d){if(_0x24bde3[_0x71de6e(0x144)]){const _0x30989c=apiRuleToYaml(_0x24bde3[_0x71de6e(0x144)]);_0x11f5f6[_0x71de6e(0xc5)](_0x56cb3a,_0x30989c);}}for(const {id:_0x29dda4,seg:_0x568598}of _0x5a8d8d){if(!_0x568598['rule'])continue;const _0x9cde08=_0x11f5f6[_0x71de6e(0xf4)](_0x29dda4);if(!_0x9cde08)continue;const _0xe0a51b=serializeExpandedRule(_0x9cde08,_0x11f5f6),_0x4675a9=_0x4a2724['get'](_0xe0a51b);if(_0x4675a9){const _0x1c55ab=_0x4675a9[_0x71de6e(0xed)](_0x3faae8=>_0x51e8d8[_0x71de6e(0x162)](_0x3faae8));_0x1c55ab&&(_0x15c054[_0x71de6e(0xc5)](_0x1c55ab,_0x29dda4),_0x51e8d8[_0x71de6e(0x11d)](_0x1c55ab),logger[_0x71de6e(0x112)](_0x71de6e(0x155)+_0x568598['name']+_0x71de6e(0x13b)+_0x1c55ab+_0x71de6e(0xef)));}}}}async function executeSingleJourneyPush(_0x5903f6,_0x467548,_0x15d346,_0x129050,_0x16052f,_0x1d8c4e){const _0x469f8a=a152_0x525fdb,{journeyDefToRequest:_0x318c12,activationDefToCreateRequest:_0x28e070,yamlRuleToApi:_0x54eb55,validateSegmentRule:_0x2108a7}=_0x1d8c4e,_0x516741=new Map(),_0x5620f8=new Map();recoverSegmentIdsFromPushRecovery(_0x467548,_0x516741,_0x15d346[_0x469f8a(0x1a9)]);const _0x4e74d7=new Map(),_0x44e290=new Map(),_0x5e0f73=new Map();let _0x2c72fa;const _0x5e6c82=async()=>{const _0x3fbc13=_0x469f8a;if(_0x2c72fa)return;_0x2c72fa=new Map();if(!_0x467548['existingJourney'])return;const _0x157878=await _0x5903f6['journey']['listActivations'](_0x467548[_0x3fbc13(0x10e)]['id']);for(const _0x5a1b2c of _0x157878){const _0x19c06d=journeyActivationStepToYaml(_0x5a1b2c,_0x15d346[_0x3fbc13(0x157)],_0x15d346[_0x3fbc13(0x176)]),_0x58ba16=activationSignature(_0x19c06d);!_0x2c72fa[_0x3fbc13(0x162)](_0x58ba16)&&_0x2c72fa['set'](_0x58ba16,_0x5a1b2c['id']),_0x19c06d[_0x3fbc13(0x190)]&&_0x5620f8[_0x3fbc13(0xc5)](_0x19c06d['name'],_0x5a1b2c['id']);}};await matchExistingJourneySegments(_0x5903f6,_0x467548,_0x129050[_0x469f8a(0x19e)],_0x15d346[_0x469f8a(0x12e)],_0x15d346[_0x469f8a(0x1a9)]);const _0x1eb98b={'resolveSegmentId':async _0x3a92da=>{const _0x53116c=_0x469f8a,_0x3d9a47=_0x15d346['segmentNameToId']['get'](_0x3a92da);if(!_0x3d9a47)throw new SDKError(ErrorCode[_0x53116c(0x1aa)],'Segment\x20not\x20found:\x20'+_0x3a92da+_0x53116c(0x13e)+_0x467548[_0x53116c(0xdc)][_0x53116c(0x190)]+')');return _0x3d9a47;},'resolveEmbeddedSegmentId':async(_0x31a517,_0x889020)=>{const _0x376fe5=_0x469f8a,_0xf1eb38=_0x15d346['segmentNameToId'][_0x376fe5(0xf4)](_0x31a517);if(_0xf1eb38)return _0xf1eb38;const _0x102704=_0x15d346['existingSegments'][_0x376fe5(0xed)](_0x21207f=>_0x21207f['name']===_0x31a517);if(_0x102704)return _0x15d346[_0x376fe5(0x1a9)][_0x376fe5(0xc5)](_0x31a517,_0x102704['id']),_0x102704['id'];if(_0x467548[_0x376fe5(0x17a)]){const {stageName:_0x4a27ed,criteriaName:_0x5781ee}=findSegmentCriteriaLocation(_0x467548['yamlConfig'],_0x31a517);return _0x2108a7(_0x31a517,_0x889020['rule']),_0x44e290[_0x376fe5(0xc5)](_0x31a517,{'definition':_0x889020,'stageName':_0x4a27ed,'criteriaName':_0x5781ee}),createPendingSegmentId(_0x31a517);}const _0x44d913=_0x467548[_0x376fe5(0x10e)]?.['id'];if(!_0x44d913)throw new SDKError(ErrorCode[_0x376fe5(0x196)],_0x376fe5(0x1a6));const _0x907e27=_0x4e74d7[_0x376fe5(0xf4)](_0x31a517);if(_0x907e27)return _0x907e27;const _0x23ef0d=((async()=>{const _0xa1f2e7=_0x376fe5;_0x2108a7(_0x31a517,_0x889020[_0xa1f2e7(0x144)]);const _0xe129e1=generateDeterministicJourneySegmentName(_0x467548[_0xa1f2e7(0xdc)][_0xa1f2e7(0x190)],_0x31a517),_0x40efb3=_0x15d346[_0xa1f2e7(0x12e)][_0xa1f2e7(0xed)](_0x101fb4=>_0x101fb4[_0xa1f2e7(0x190)]===_0xe129e1),_0x18d82c=createSegmentIdResolver(_0x15d346[_0xa1f2e7(0x1a9)],_0x31a517),_0x289929=await resolveRuleSegmentIds(_0x889020[_0xa1f2e7(0x144)],_0x18d82c);let _0x507023;return _0x40efb3?(await _0x5903f6[_0xa1f2e7(0xb7)][_0xa1f2e7(0xbe)](_0x129050['parentId'],_0x40efb3['id'],{'description':_0x889020['description']||'Entry\x20criteria:\x20'+_0x31a517,'rule':_0x54eb55(_0x289929),'countPopulation':!![]}),_0x507023=_0x40efb3['id'],saveSegmentToPushRecovery(_0x467548[_0xa1f2e7(0xf0)],_0x467548[_0xa1f2e7(0xdc)][_0xa1f2e7(0x190)],_0x31a517,{'segmentId':_0x507023,'uniqueServerName':_0xe129e1,'createdAt':new Date()['toISOString']()})):_0x507023=await createOrRecoverEmbeddedSegment(_0x5903f6,_0x467548,{'localName':_0x31a517,'uniqueSegmentName':_0xe129e1,'description':_0x889020[_0xa1f2e7(0x117)]||'Entry\x20criteria:\x20'+_0x31a517,'journeyId':_0x44d913,'resolvedRule':_0x289929,'parentId':_0x129050[_0xa1f2e7(0x19e)],'folderId':_0x129050['rootFolderId']||''},_0x54eb55),_0x15d346[_0xa1f2e7(0x1a9)][_0xa1f2e7(0xc5)](_0x31a517,_0x507023),_0x516741[_0xa1f2e7(0xc5)](_0x31a517,_0x507023),_0x507023;})());_0x4e74d7['set'](_0x31a517,_0x23ef0d);try{return await _0x23ef0d;}finally{_0x4e74d7[_0x376fe5(0x11d)](_0x31a517);}},'resolveActivationId':async _0x5701db=>{const _0x2392cd=_0x469f8a,_0x5c31fb=_0x5620f8[_0x2392cd(0xf4)](_0x5701db);if(_0x5c31fb)return _0x5c31fb;if(_0x467548[_0x2392cd(0x10e)]){await _0x5e6c82();const _0x3f87a4=_0x5620f8['get'](_0x5701db);if(_0x3f87a4)return _0x3f87a4;}throw new SDKError(ErrorCode[_0x2392cd(0x10b)],'Activation\x20not\x20found:\x20'+_0x5701db+_0x2392cd(0x13e)+_0x467548[_0x2392cd(0xdc)][_0x2392cd(0x190)]+_0x2392cd(0x15c)+_0x2392cd(0xcc));},'resolveEmbeddedActivationId':async(_0x97d036,_0x234e2f)=>{const _0x418aba=_0x469f8a,_0x1d9d3a=_0x5620f8[_0x418aba(0xf4)](_0x97d036);if(_0x1d9d3a)return _0x1d9d3a;if(_0x467548[_0x418aba(0x17a)])return _0x5e0f73[_0x418aba(0xc5)](_0x97d036,_0x234e2f),createPendingActivationId(_0x97d036);if(_0x467548[_0x418aba(0x10e)]){await _0x5e6c82();const _0x358235=_0x5620f8['get'](_0x234e2f[_0x418aba(0x190)]);if(_0x358235)return _0x5620f8[_0x418aba(0xc5)](_0x97d036,_0x358235),_0x358235;const _0x39e9af=activationSignature(_0x234e2f),_0xd8081c=_0x2c72fa?.['get'](_0x39e9af);if(_0xd8081c)return _0x5620f8[_0x418aba(0xc5)](_0x97d036,_0xd8081c),_0xd8081c;const _0x1f48fd=await _0x28e070(_0x234e2f,_0x15d346[_0x418aba(0x175)]),_0x12403a={..._0x1f48fd,..._0x234e2f['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x234e2f[_0x418aba(0x11e)]}},_0x371223=await _0x5903f6[_0x418aba(0x168)][_0x418aba(0x185)](_0x467548[_0x418aba(0x10e)]['id'],_0x12403a);return _0x5620f8['set'](_0x97d036,_0x371223['id']),_0x371223['id'];}throw new SDKError(ErrorCode[_0x418aba(0x196)],_0x418aba(0xb8));},'resolveJourneyId':async _0x3c4668=>{const _0x284fc0=_0x469f8a;try{return await _0x5903f6[_0x284fc0(0x168)][_0x284fc0(0x118)](_0x129050[_0x284fc0(0x19e)],_0x3c4668);}catch(_0x3110bb){throw new SDKError(ErrorCode[_0x284fc0(0x10b)],'Journey\x20\x27'+_0x3c4668+_0x284fc0(0xd2)+_0x467548['yamlConfig']['name']+'\x27)',_0x3110bb);}},'resolveStageId':async(_0x1dc5cd,_0x146524)=>{const _0x3f9ae8=_0x469f8a,_0xbc7c8a=await _0x5903f6[_0x3f9ae8(0x168)][_0x3f9ae8(0x11b)](_0x1dc5cd),_0x3fdc3d=_0xbc7c8a['attributes'][_0x3f9ae8(0x156)][_0x3f9ae8(0xed)](_0x419808=>_0x419808['name'][_0x3f9ae8(0x1ab)]()===_0x146524[_0x3f9ae8(0x1ab)]());if(!_0x3fdc3d?.['id'])throw new SDKError(ErrorCode[_0x3f9ae8(0x10b)],_0x3f9ae8(0xd3)+_0x146524+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0xbc7c8a[_0x3f9ae8(0x161)][_0x3f9ae8(0x183)]||_0xbc7c8a[_0x3f9ae8(0x161)][_0x3f9ae8(0x190)])+'\x27');return _0x3fdc3d['id'];}},_0x4922bf=await _0x318c12(_0x467548[_0x469f8a(0xdc)],_0x129050[_0x469f8a(0x19e)],_0x1eb98b),_0x5b21f3=_0x129050[_0x469f8a(0xbc)]||_0x129050[_0x469f8a(0xf5)];_0x5b21f3&&(_0x4922bf['relationships']={'parentFolder':{'data':{'id':_0x5b21f3,'type':_0x469f8a(0x109)}}});if(_0x467548['isNew']){if(_0x44e290[_0x469f8a(0x145)]>0x0||_0x5e0f73[_0x469f8a(0x145)]>0x0)return await executeThreeStepJourneyCreate(_0x5903f6,_0x467548,_0x4922bf,{'pendingEmbeddedSegments':_0x44e290,'pendingEmbeddedActivations':_0x5e0f73,'embeddedSegmentNameToId':_0x516741,'journeyActivationNameToId':_0x5620f8},{..._0x129050,'effectiveFolderId':_0x5b21f3},_0x15d346,_0x16052f,_0x1d8c4e);else{ensureJourneyDefaults(_0x4922bf[_0x469f8a(0x161)]);const _0x24a04e=await _0x5903f6[_0x469f8a(0x168)][_0x469f8a(0x127)](_0x4922bf);return deletePushRecovery(_0x467548['absolutePath']),{'action':_0x469f8a(0x12a),'journeyId':_0x24a04e['id'],'embeddedSegmentNameToId':_0x516741};}}else{if(_0x467548[_0x469f8a(0x166)]&&_0x467548['existingJourney']){_0x4922bf['id']=_0x467548[_0x469f8a(0x10e)]['id'];const _0x4e75b0=_0x4922bf['attributes'];_0x467548[_0x469f8a(0x10e)][_0x469f8a(0x161)]?.[_0x469f8a(0x183)]&&(_0x4e75b0[_0x469f8a(0x183)]=_0x467548[_0x469f8a(0x10e)][_0x469f8a(0x161)][_0x469f8a(0x183)]);const _0x2e6022=_0x467548[_0x469f8a(0x10e)]['attributes']?.[_0x469f8a(0x156)];return _0x2e6022&&_0x4922bf[_0x469f8a(0x161)][_0x469f8a(0x156)]&&injectExistingStageIds(_0x4922bf['attributes'][_0x469f8a(0x156)],_0x2e6022),ensureJourneyDefaults(_0x4e75b0),await _0x5903f6[_0x469f8a(0x168)]['update'](_0x467548[_0x469f8a(0x10e)]['id'],_0x4922bf),deletePushRecovery(_0x467548[_0x469f8a(0xf0)]),{'action':_0x469f8a(0x120),'journeyId':_0x467548['existingJourney']['id'],'embeddedSegmentNameToId':_0x516741};}}return deletePushRecovery(_0x467548['absolutePath']),{'action':_0x469f8a(0xcd),'journeyId':_0x467548['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x516741};}function findSegmentCriteriaLocation(_0x34e716,_0x4df592){const _0x2e940e=a152_0x525fdb,_0x1aa9c9=_0x34e716[_0x2e940e(0x15b)]||_0x34e716[_0x2e940e(0x1ad)]?.[0x0]?.[_0x2e940e(0x15b)]||[];let _0x25c1e7=_0x2e940e(0x169),_0x5631a4=_0x4df592;const _0x2b54ca=_0x34e716[_0x2e940e(0x154)]||_0x34e716[_0x2e940e(0x1ad)]?.[0x0]?.[_0x2e940e(0x154)];if(_0x2b54ca?.[_0x2e940e(0xb7)]===_0x4df592)return{'stageName':_0x2e940e(0x154),'criteriaName':_0x2b54ca[_0x2e940e(0x190)]||_0x4df592};_0x108da2:for(const _0x4e6db3 of _0x1aa9c9){if(_0x4e6db3[_0x2e940e(0x152)]?.[_0x2e940e(0xb7)]===_0x4df592){_0x25c1e7=_0x4e6db3[_0x2e940e(0x190)],_0x5631a4=_0x4e6db3[_0x2e940e(0x152)][_0x2e940e(0x190)]||_0x4df592;break;}if(_0x4e6db3[_0x2e940e(0x1a8)])for(const _0x1593ae of _0x4e6db3[_0x2e940e(0x1a8)]){if(_0x1593ae[_0x2e940e(0x186)]===_0x2e940e(0x18c)&&_0x1593ae[_0x2e940e(0x19a)]?.[_0x2e940e(0x160)])for(const _0x1b4112 of _0x1593ae['with'][_0x2e940e(0x160)]){if(_0x1b4112[_0x2e940e(0xb7)]===_0x4df592){_0x25c1e7=_0x4e6db3['name'],_0x5631a4=_0x1b4112[_0x2e940e(0x190)]||_0x4df592;break _0x108da2;}}}}return{'stageName':_0x25c1e7,'criteriaName':_0x5631a4};}async function executeThreeStepJourneyCreate(_0x7b108a,_0x2f83c5,_0x2850bb,_0x306f5c,_0x45aa22,_0x3df3c5,_0x1bf3e9,_0x512dd5){const _0x294213=a152_0x525fdb,{activationDefToCreateRequest:_0x2d6fad,yamlRuleToApi:_0x1c5f4f}=_0x512dd5,{pendingEmbeddedSegments:_0x4a288f,pendingEmbeddedActivations:_0x1b945c,embeddedSegmentNameToId:_0xb54548}=_0x306f5c,_0x39011b=JSON[_0x294213(0xa6)](JSON[_0x294213(0x103)](_0x2850bb));ensureJourneyDefaults(_0x39011b[_0x294213(0x161)]),stripPendingIds(_0x39011b);const _0x4cb85a=await _0x7b108a['journey'][_0x294213(0x127)](_0x39011b),_0x4cb932=_0x4cb85a['id'],_0x1691ad=new Map();for(const _0x23d987 of _0x4cb85a['attributes'][_0x294213(0x156)]){_0x1691ad[_0x294213(0xc5)](_0x23d987[_0x294213(0x190)][_0x294213(0x1ab)](),_0x23d987['id']);}recoverSegmentIdsFromPushRecovery(_0x2f83c5,_0xb54548,_0x3df3c5[_0x294213(0x1a9)]);for(const [_0x38db56,{definition:_0x1044dc}]of _0x4a288f){if(_0xb54548[_0x294213(0x162)](_0x38db56)){_0x1bf3e9['onProgress']?.({'type':_0x294213(0x135),'journeyName':_0x2f83c5['yamlConfig'][_0x294213(0x190)],'segmentName':_0x38db56});continue;}const _0xaeb214=generateDeterministicJourneySegmentName(_0x2f83c5[_0x294213(0xdc)][_0x294213(0x190)],_0x38db56);_0x1bf3e9[_0x294213(0xe8)]?.({'type':_0x294213(0x14c),'journeyName':_0x2f83c5[_0x294213(0xdc)]['name'],'segmentName':_0x38db56});const _0x19d6c1=createSegmentIdResolver(_0x3df3c5['segmentNameToId'],_0x38db56),_0x5afd72=await resolveRuleSegmentIds(_0x1044dc[_0x294213(0x144)],_0x19d6c1),_0x3456ea=await createOrRecoverEmbeddedSegment(_0x7b108a,_0x2f83c5,{'localName':_0x38db56,'uniqueSegmentName':_0xaeb214,'description':_0x1044dc[_0x294213(0x117)]||'Entry\x20criteria:\x20'+_0x38db56,'journeyId':_0x4cb932,'resolvedRule':_0x5afd72,'parentId':_0x45aa22[_0x294213(0x19e)],'folderId':_0x45aa22['effectiveFolderId']||''},_0x1c5f4f);_0xb54548[_0x294213(0xc5)](_0x38db56,_0x3456ea),_0x3df3c5['segmentNameToId'][_0x294213(0xc5)](_0x38db56,_0x3456ea),_0x1bf3e9[_0x294213(0xe8)]?.({'type':'embedded_segment_created','journeyName':_0x2f83c5[_0x294213(0xdc)][_0x294213(0x190)],'segmentName':_0x38db56});}const _0x35f241=new Map();for(const [_0x204d9c,_0x272c9a]of _0x1b945c){_0x1bf3e9[_0x294213(0xe8)]?.({'type':'embedded_activation_creating','journeyName':_0x2f83c5[_0x294213(0xdc)]['name'],'activationName':_0x204d9c});const _0x559ae0=await _0x2d6fad(_0x272c9a,_0x3df3c5['activationContext']),_0x443eba={..._0x559ae0,..._0x272c9a[_0x294213(0x11e)]!==undefined&&{'runAfterJourneyRefresh':_0x272c9a['run_after_journey_refresh']}},_0xd31223=await _0x7b108a['journey'][_0x294213(0x185)](_0x4cb932,_0x443eba);_0x35f241['set'](_0x204d9c,_0xd31223['id']),_0x306f5c[_0x294213(0xd0)][_0x294213(0xc5)](_0x204d9c,_0xd31223['id']),_0x1bf3e9[_0x294213(0xe8)]?.({'type':_0x294213(0xe6),'journeyName':_0x2f83c5[_0x294213(0xdc)]['name'],'activationName':_0x204d9c});}const _0x197cd9=JSON[_0x294213(0xa6)](JSON[_0x294213(0x103)](_0x2850bb));return _0x197cd9['id']=_0x4cb932,ensureJourneyDefaults(_0x197cd9[_0x294213(0x161)]),resolvePendingIdsInRequest(_0x197cd9,_0x2850bb,_0x1691ad,_0xb54548,_0x35f241,_0x1bf3e9),await _0x7b108a[_0x294213(0x168)][_0x294213(0xbf)](_0x4cb932,_0x197cd9),deletePushRecovery(_0x2f83c5['absolutePath']),{'action':'created','journeyId':_0x4cb932,'embeddedSegmentNameToId':_0xb54548};}export function stripWaitStepPendingIds(_0x44d027){const _0x4d7779=a152_0x525fdb,_0x26d5c1=_0x44d027[_0x4d7779(0xa8)]&&isPendingSegmentId(_0x44d027[_0x4d7779(0xa8)]),_0x125134=_0x44d027[_0x4d7779(0x16d)]?.[_0x4d7779(0x1a4)](_0x5de2ee=>_0x5de2ee[_0x4d7779(0x114)]&&isPendingSegmentId(_0x5de2ee[_0x4d7779(0x114)]));(_0x26d5c1||_0x125134)&&(_0x44d027[_0x4d7779(0x133)]=_0x4d7779(0x12f),_0x44d027[_0x4d7779(0x165)]=0x1,_0x44d027[_0x4d7779(0x119)]=_0x4d7779(0xff),delete _0x44d027[_0x4d7779(0xa8)],delete _0x44d027['conditionTimeoutDuration'],delete _0x44d027[_0x4d7779(0x192)],delete _0x44d027[_0x4d7779(0x16d)]);}export function resolveWaitStepPendingIds(_0x936b18,_0xb41c2b,_0x4da0dc,_0x378b70){const _0x5c99e9=a152_0x525fdb;if(_0xb41c2b[_0x5c99e9(0xa8)]&&isPendingSegmentId(_0xb41c2b[_0x5c99e9(0xa8)])){const _0x45d9c4=_0x4da0dc(_0xb41c2b[_0x5c99e9(0xa8)],_0x5c99e9(0x122)+_0x378b70+'\x27\x20wait\x20condition');_0x45d9c4&&(_0x936b18[_0x5c99e9(0x133)]=_0x5c99e9(0x1a5),_0x936b18[_0x5c99e9(0xa8)]=_0x45d9c4,delete _0x936b18[_0x5c99e9(0x165)],delete _0x936b18[_0x5c99e9(0x119)],_0xb41c2b[_0x5c99e9(0x16b)]!==undefined&&(_0x936b18[_0x5c99e9(0x16b)]=_0xb41c2b['conditionTimeoutDuration']),_0xb41c2b['conditionTimeoutUnit']&&(_0x936b18[_0x5c99e9(0x192)]=_0xb41c2b[_0x5c99e9(0x192)]));}if(_0xb41c2b[_0x5c99e9(0x16d)]){const _0xa6d041=_0xb41c2b[_0x5c99e9(0x16d)]['some'](_0x59b156=>_0x59b156[_0x5c99e9(0x114)]&&isPendingSegmentId(_0x59b156[_0x5c99e9(0x114)]));if(_0xa6d041){const _0xc8698e=_0xb41c2b[_0x5c99e9(0x16d)]['map'](_0x20c1d2=>{const _0x8b9b6f=_0x5c99e9;if(_0x20c1d2[_0x8b9b6f(0x114)]&&isPendingSegmentId(_0x20c1d2['segmentId'])){const _0x50a8ab=_0x4da0dc(_0x20c1d2[_0x8b9b6f(0x114)],_0x8b9b6f(0x122)+_0x378b70+'\x27\x20wait\x20condition');return{..._0x20c1d2,'segmentId':_0x50a8ab||_0x20c1d2['segmentId']};}return{..._0x20c1d2};});_0x936b18['waitStepType']='Condition',_0x936b18[_0x5c99e9(0x16d)]=_0xc8698e,delete _0x936b18[_0x5c99e9(0x165)],delete _0x936b18[_0x5c99e9(0x119)],delete _0x936b18[_0x5c99e9(0xa8)],delete _0x936b18[_0x5c99e9(0x16b)],delete _0x936b18['conditionTimeoutUnit'];}}}function stripPendingIds(_0x4b485b){const _0x15496e=a152_0x525fdb;_0x4b485b[_0x15496e(0x161)][_0x15496e(0x154)]?.[_0x15496e(0x114)]&&isPendingSegmentId(_0x4b485b[_0x15496e(0x161)][_0x15496e(0x154)][_0x15496e(0x114)])&&delete _0x4b485b[_0x15496e(0x161)][_0x15496e(0x154)];for(const _0x2c9e1d of _0x4b485b[_0x15496e(0x161)][_0x15496e(0x156)]||[]){_0x2c9e1d[_0x15496e(0x158)]?.['segmentId']&&isPendingSegmentId(_0x2c9e1d['entryCriteria'][_0x15496e(0x114)])&&delete _0x2c9e1d[_0x15496e(0x158)];_0x2c9e1d['milestone']?.['segmentId']&&isPendingSegmentId(_0x2c9e1d[_0x15496e(0x132)]['segmentId'])&&delete _0x2c9e1d[_0x15496e(0x132)];_0x2c9e1d[_0x15496e(0x138)]&&(_0x2c9e1d[_0x15496e(0x138)]=_0x2c9e1d[_0x15496e(0x138)]['filter'](_0x1fe251=>!_0x1fe251['segmentId']||!isPendingSegmentId(_0x1fe251['segmentId'])));if(_0x2c9e1d['steps'])for(const _0x31c754 of Object[_0x15496e(0x17c)](_0x2c9e1d['steps'])){const _0x58a490=_0x2c9e1d[_0x15496e(0x1a8)][_0x31c754];_0x58a490['type']===_0x15496e(0xb0)&&_0x58a490[_0x15496e(0xb6)]&&isPendingActivationId(_0x58a490[_0x15496e(0xb6)])&&(_0x58a490[_0x15496e(0xb6)]='');if(_0x58a490[_0x15496e(0x186)]===_0x15496e(0x18e)&&_0x58a490['branches'])for(const _0x33df16 of _0x58a490['branches']){_0x33df16[_0x15496e(0x114)]&&isPendingSegmentId(_0x33df16['segmentId'])&&(_0x33df16[_0x15496e(0x114)]='');}_0x58a490[_0x15496e(0x186)]===_0x15496e(0xfa)&&stripWaitStepPendingIds(_0x58a490);}}}function resolvePendingIdsInRequest(_0x1491a0,_0x18614c,_0x343311,_0x13c6b4,_0x588c70,_0x16302d){const _0x30f7fc=a152_0x525fdb,_0x216d4b=(_0x500eab,_0x1e3ac8)=>{const _0x1bfb11=a152_0x400d;if(!isPendingSegmentId(_0x500eab))return _0x500eab;const _0x49ee70=extractPendingSegmentName(_0x500eab),_0x4cfb3a=_0x13c6b4['get'](_0x49ee70);return!_0x4cfb3a&&_0x16302d[_0x1bfb11(0x193)]?.(_0x1bfb11(0xde)+_0x49ee70+_0x1bfb11(0x108)+_0x1e3ac8),_0x4cfb3a;};if(_0x1491a0[_0x30f7fc(0x161)][_0x30f7fc(0x154)]?.[_0x30f7fc(0x114)]&&isPendingSegmentId(_0x1491a0[_0x30f7fc(0x161)][_0x30f7fc(0x154)][_0x30f7fc(0x114)])){const _0x4c39cb=_0x216d4b(_0x1491a0[_0x30f7fc(0x161)]['goal'][_0x30f7fc(0x114)],_0x30f7fc(0x1a2));_0x4c39cb&&(_0x1491a0[_0x30f7fc(0x161)][_0x30f7fc(0x154)]['segmentId']=_0x4c39cb);}for(const _0x117352 of _0x1491a0[_0x30f7fc(0x161)][_0x30f7fc(0x156)]||[]){const _0x2ef858=_0x343311[_0x30f7fc(0xf4)](_0x117352[_0x30f7fc(0x190)][_0x30f7fc(0x1ab)]());_0x2ef858&&(_0x117352['id']=_0x2ef858);if(_0x117352[_0x30f7fc(0x158)]?.[_0x30f7fc(0x114)]&&isPendingSegmentId(_0x117352['entryCriteria'][_0x30f7fc(0x114)])){const _0x3378af=_0x216d4b(_0x117352[_0x30f7fc(0x158)][_0x30f7fc(0x114)],'stage\x20\x27'+_0x117352[_0x30f7fc(0x190)]+_0x30f7fc(0x100));_0x3378af&&(_0x117352[_0x30f7fc(0x158)]['segmentId']=_0x3378af);}if(_0x117352['exitCriterias'])for(const _0x3675b5 of _0x117352['exitCriterias']){if(_0x3675b5['segmentId']&&isPendingSegmentId(_0x3675b5['segmentId'])){const _0x49f47b=_0x216d4b(_0x3675b5['segmentId'],'stage\x20\x27'+_0x117352[_0x30f7fc(0x190)]+_0x30f7fc(0xd7));_0x49f47b&&(_0x3675b5[_0x30f7fc(0x114)]=_0x49f47b);}}if(_0x117352[_0x30f7fc(0x132)]?.[_0x30f7fc(0x114)]&&isPendingSegmentId(_0x117352[_0x30f7fc(0x132)][_0x30f7fc(0x114)])){const _0x10c89c=_0x216d4b(_0x117352[_0x30f7fc(0x132)][_0x30f7fc(0x114)],_0x30f7fc(0x122)+_0x117352[_0x30f7fc(0x190)]+'\x27\x20milestone');_0x10c89c&&(_0x117352[_0x30f7fc(0x132)]['segmentId']=_0x10c89c);}if(_0x117352[_0x30f7fc(0x1a8)]){const _0x35d219=_0x5cf1f2=>_0x18614c[_0x30f7fc(0x161)]['journeyStages']?.[_0x30f7fc(0xed)](_0x488a2=>_0x488a2['name'][_0x30f7fc(0x1ab)]()===_0x117352[_0x30f7fc(0x190)][_0x30f7fc(0x1ab)]())?.[_0x30f7fc(0x1a8)]?.[_0x5cf1f2];for(const _0xa7a807 of Object[_0x30f7fc(0x17c)](_0x117352['steps'])){const _0x1cb726=_0x117352[_0x30f7fc(0x1a8)][_0xa7a807],_0x55802b=_0x35d219(_0xa7a807);if(_0x1cb726[_0x30f7fc(0x186)]===_0x30f7fc(0xb0)&&_0x1cb726[_0x30f7fc(0xb6)]&&(isPendingActivationId(_0x1cb726[_0x30f7fc(0xb6)])||_0x1cb726['journeyActivationStepId']==='')){if(_0x55802b?.['journeyActivationStepId']&&isPendingActivationId(_0x55802b[_0x30f7fc(0xb6)])){const _0x36b5fa=extractPendingActivationName(_0x55802b['journeyActivationStepId']),_0x5ac497=_0x588c70['get'](_0x36b5fa);_0x5ac497&&(_0x1cb726[_0x30f7fc(0xb6)]=_0x5ac497);}}if(_0x1cb726[_0x30f7fc(0x186)]==='DecisionPoint'&&_0x1cb726[_0x30f7fc(0x160)]&&_0x55802b?.[_0x30f7fc(0x160)])for(let _0x5716f6=0x0;_0x5716f6<_0x1cb726[_0x30f7fc(0x160)][_0x30f7fc(0xfe)];_0x5716f6++){const _0x5a5eeb=_0x1cb726[_0x30f7fc(0x160)][_0x5716f6],_0x358a18=_0x55802b['branches'][_0x5716f6];if(_0x358a18?.[_0x30f7fc(0x114)]&&isPendingSegmentId(_0x358a18[_0x30f7fc(0x114)])){const _0x548ad5=_0x216d4b(_0x358a18[_0x30f7fc(0x114)],'stage\x20\x27'+_0x117352[_0x30f7fc(0x190)]+_0x30f7fc(0x171)+(_0x5a5eeb[_0x30f7fc(0x190)]||_0x5716f6)+'\x27');_0x548ad5&&(_0x5a5eeb[_0x30f7fc(0x114)]=_0x548ad5);}}_0x1cb726['type']===_0x30f7fc(0xfa)&&_0x55802b?.[_0x30f7fc(0x186)]===_0x30f7fc(0xfa)&&resolveWaitStepPendingIds(_0x1cb726,_0x55802b,_0x216d4b,_0x117352[_0x30f7fc(0x190)]);}}}}
@@ -1 +1 @@
1
- function a153_0x4a80(_0x109371,_0x24a08d){_0x109371=_0x109371-0x17c;const _0x52e911=a153_0x52e9();let _0x4a80d9=_0x52e911[_0x109371];return _0x4a80d9;}(function(_0x5cea8a,_0x28909e){const _0x35565f=a153_0x4a80,_0x109836=_0x5cea8a();while(!![]){try{const _0x50ee54=-parseInt(_0x35565f(0x180))/0x1*(-parseInt(_0x35565f(0x17d))/0x2)+-parseInt(_0x35565f(0x187))/0x3+-parseInt(_0x35565f(0x185))/0x4*(parseInt(_0x35565f(0x18b))/0x5)+parseInt(_0x35565f(0x188))/0x6+parseInt(_0x35565f(0x17e))/0x7*(-parseInt(_0x35565f(0x184))/0x8)+-parseInt(_0x35565f(0x189))/0x9+parseInt(_0x35565f(0x186))/0xa;if(_0x50ee54===_0x28909e)break;else _0x109836['push'](_0x109836['shift']());}catch(_0x1252b9){_0x109836['push'](_0x109836['shift']());}}}(a153_0x52e9,0xedda1));export function buildFolderIdToPathMap(_0x30cc2b){const _0x2c3b5b=a153_0x4a80,_0x5b0707=new Map(),_0x2cc605=new Map();for(const _0xc5434a of _0x30cc2b){_0x2cc605['set'](_0xc5434a['id'],_0xc5434a);}const _0x286ff4=new Set();for(const _0x21e7ab of _0x30cc2b){!_0x21e7ab['parentFolderId']&&_0x286ff4[_0x2c3b5b(0x182)](_0x21e7ab['id']);}function _0x492286(_0x47807e){const _0x3b1ac3=_0x2c3b5b;if(_0x5b0707['has'](_0x47807e['id']))return _0x5b0707[_0x3b1ac3(0x17c)](_0x47807e['id']);if(_0x286ff4[_0x3b1ac3(0x18a)](_0x47807e['id']))return _0x5b0707[_0x3b1ac3(0x181)](_0x47807e['id'],''),'';if(_0x47807e[_0x3b1ac3(0x17f)]){const _0x3ac6ea=_0x2cc605[_0x3b1ac3(0x17c)](_0x47807e[_0x3b1ac3(0x17f)]);if(_0x3ac6ea){const _0x113bef=_0x492286(_0x3ac6ea),_0x15381f=_0x113bef?_0x113bef+'/'+_0x47807e[_0x3b1ac3(0x183)]:_0x47807e[_0x3b1ac3(0x183)];return _0x5b0707[_0x3b1ac3(0x181)](_0x47807e['id'],_0x15381f),_0x15381f;}}const _0x160739=_0x47807e['name'];return _0x5b0707[_0x3b1ac3(0x181)](_0x47807e['id'],_0x160739),_0x160739;}for(const _0x5474bc of _0x30cc2b){_0x492286(_0x5474bc);}return _0x5b0707;}export function buildFolderPathToIdMap(_0x1f5399){const _0x3ddcbc=a153_0x4a80,_0x3559aa=new Map(),_0x2400b5=new Map();for(const _0x1d7008 of _0x1f5399){_0x2400b5[_0x3ddcbc(0x181)](_0x1d7008['id'],_0x1d7008);}const _0xaa314d=new Set();for(const _0x48f4cc of _0x1f5399){!_0x48f4cc[_0x3ddcbc(0x17f)]&&_0xaa314d[_0x3ddcbc(0x182)](_0x48f4cc['id']);}function _0x18f412(_0x127d84){const _0x1328d2=_0x3ddcbc;if(_0xaa314d[_0x1328d2(0x18a)](_0x127d84['id']))return'';if(_0x127d84['parentFolderId']){const _0x45b67e=_0x2400b5['get'](_0x127d84['parentFolderId']);if(_0x45b67e){const _0x127cdf=_0x18f412(_0x45b67e);return _0x127cdf?_0x127cdf+'/'+_0x127d84[_0x1328d2(0x183)]:_0x127d84[_0x1328d2(0x183)];}}return _0x127d84[_0x1328d2(0x183)];}for(const _0x21f2d0 of _0x1f5399){const _0x11e4e8=_0x18f412(_0x21f2d0);_0x3559aa[_0x3ddcbc(0x181)](_0x11e4e8,_0x21f2d0['id']);}return _0x3559aa;}export function buildFolderMaps(_0x39ab01){const _0x2b7074=a153_0x4a80,_0x1192c7=buildFolderIdToPathMap(_0x39ab01),_0xdd78a2=new Map();for(const [_0x4c2e9c,_0x63ac8d]of _0x1192c7){_0xdd78a2[_0x2b7074(0x181)](_0x63ac8d,_0x4c2e9c);}return{'idToPath':_0x1192c7,'pathToId':_0xdd78a2};}function a153_0x52e9(){const _0x55a891=['3290760jGlsNq','has','535TpexTh','get','1449194klPSLt','1955751xKIFnz','parentFolderId','1ZysEPy','set','add','name','16yXHzSZ','24460lzQjka','33645030AFkaqj','4634373DbpRXJ','51978NFjTbU'];a153_0x52e9=function(){return _0x55a891;};return a153_0x52e9();}export function getFolderPath(_0x52dc49,_0x3c155f){if(!_0x52dc49)return'';return _0x3c155f['get'](_0x52dc49)??'';}
1
+ (function(_0x59d394,_0x73a4c0){const _0x1fe056=a153_0x1e2f,_0x390cd1=_0x59d394();while(!![]){try{const _0x1ea333=-parseInt(_0x1fe056(0x170))/0x1*(parseInt(_0x1fe056(0x175))/0x2)+-parseInt(_0x1fe056(0x174))/0x3+-parseInt(_0x1fe056(0x177))/0x4+parseInt(_0x1fe056(0x16e))/0x5*(-parseInt(_0x1fe056(0x16a))/0x6)+parseInt(_0x1fe056(0x16f))/0x7*(-parseInt(_0x1fe056(0x173))/0x8)+parseInt(_0x1fe056(0x16d))/0x9+-parseInt(_0x1fe056(0x178))/0xa*(-parseInt(_0x1fe056(0x16b))/0xb);if(_0x1ea333===_0x73a4c0)break;else _0x390cd1['push'](_0x390cd1['shift']());}catch(_0x5a861d){_0x390cd1['push'](_0x390cd1['shift']());}}}(a153_0x42ce,0x49e7a));export function buildFolderIdToPathMap(_0x2468ef){const _0x3688a3=a153_0x1e2f,_0x3e85de=new Map(),_0x22f759=new Map();for(const _0x15a716 of _0x2468ef){_0x22f759[_0x3688a3(0x176)](_0x15a716['id'],_0x15a716);}const _0x958205=new Set();for(const _0x5c6e92 of _0x2468ef){!_0x5c6e92['parentFolderId']&&_0x958205[_0x3688a3(0x172)](_0x5c6e92['id']);}function _0x514eaa(_0x396419){const _0x132397=_0x3688a3;if(_0x3e85de['has'](_0x396419['id']))return _0x3e85de[_0x132397(0x169)](_0x396419['id']);if(_0x958205['has'](_0x396419['id']))return _0x3e85de[_0x132397(0x176)](_0x396419['id'],''),'';if(_0x396419[_0x132397(0x171)]){const _0x2022e7=_0x22f759['get'](_0x396419['parentFolderId']);if(_0x2022e7){const _0x48e9c4=_0x514eaa(_0x2022e7),_0xf17f65=_0x48e9c4?_0x48e9c4+'/'+_0x396419[_0x132397(0x179)]:_0x396419[_0x132397(0x179)];return _0x3e85de['set'](_0x396419['id'],_0xf17f65),_0xf17f65;}}const _0xe7c48a=_0x396419[_0x132397(0x179)];return _0x3e85de[_0x132397(0x176)](_0x396419['id'],_0xe7c48a),_0xe7c48a;}for(const _0x1e81fd of _0x2468ef){_0x514eaa(_0x1e81fd);}return _0x3e85de;}function a153_0x42ce(){const _0x44e696=['1530lnjSxf','33leGrQQ','has','4918311SBYFTe','2010hbhaGK','1095087iKVLFL','604886BVeRbf','parentFolderId','add','24eXLIdu','390432siZTrq','2UCeALB','set','331392ozwvXN','3819820DAlBMP','name','get'];a153_0x42ce=function(){return _0x44e696;};return a153_0x42ce();}export function buildFolderPathToIdMap(_0x433783){const _0x257bda=a153_0x1e2f,_0x4a1084=new Map(),_0x4d4ab7=new Map();for(const _0x31a0bd of _0x433783){_0x4d4ab7[_0x257bda(0x176)](_0x31a0bd['id'],_0x31a0bd);}const _0x1aa539=new Set();for(const _0x3846df of _0x433783){!_0x3846df[_0x257bda(0x171)]&&_0x1aa539[_0x257bda(0x172)](_0x3846df['id']);}function _0x17684c(_0x5424c4){const _0x5281bb=_0x257bda;if(_0x1aa539[_0x5281bb(0x16c)](_0x5424c4['id']))return'';if(_0x5424c4['parentFolderId']){const _0x5c0472=_0x4d4ab7[_0x5281bb(0x169)](_0x5424c4['parentFolderId']);if(_0x5c0472){const _0x520275=_0x17684c(_0x5c0472);return _0x520275?_0x520275+'/'+_0x5424c4['name']:_0x5424c4[_0x5281bb(0x179)];}}return _0x5424c4[_0x5281bb(0x179)];}for(const _0x382649 of _0x433783){const _0x24fce5=_0x17684c(_0x382649);_0x4a1084[_0x257bda(0x176)](_0x24fce5,_0x382649['id']);}return _0x4a1084;}export function buildFolderMaps(_0x5dd31f){const _0x23b00e=a153_0x1e2f,_0x24f8f4=buildFolderIdToPathMap(_0x5dd31f),_0xa9d974=new Map();for(const [_0x576c74,_0x324c15]of _0x24f8f4){_0xa9d974[_0x23b00e(0x176)](_0x324c15,_0x576c74);}return{'idToPath':_0x24f8f4,'pathToId':_0xa9d974};}function a153_0x1e2f(_0xfa373c,_0x5edfa4){_0xfa373c=_0xfa373c-0x169;const _0x42ce87=a153_0x42ce();let _0x1e2f6d=_0x42ce87[_0xfa373c];return _0x1e2f6d;}export function getFolderPath(_0x15645b,_0x4bcbab){const _0x1319b8=a153_0x1e2f;if(!_0x15645b)return'';return _0x4bcbab[_0x1319b8(0x169)](_0x15645b)??'';}
@@ -1 +1 @@
1
- function a154_0x9ef6(_0x1a89ec,_0x71cf88){_0x1a89ec=_0x1a89ec-0xce;const _0x2c4964=a154_0x2c49();let _0x9ef6e5=_0x2c4964[_0x1a89ec];return _0x9ef6e5;}(function(_0x21f22c,_0xac2cab){const _0x376f57=a154_0x9ef6,_0x1861b9=_0x21f22c();while(!![]){try{const _0x5eeec7=-parseInt(_0x376f57(0xf3))/0x1+-parseInt(_0x376f57(0xd4))/0x2*(parseInt(_0x376f57(0xd7))/0x3)+-parseInt(_0x376f57(0xf4))/0x4*(-parseInt(_0x376f57(0xdd))/0x5)+-parseInt(_0x376f57(0xe4))/0x6+parseInt(_0x376f57(0xf5))/0x7*(-parseInt(_0x376f57(0xe5))/0x8)+parseInt(_0x376f57(0xed))/0x9*(-parseInt(_0x376f57(0xe3))/0xa)+parseInt(_0x376f57(0xdf))/0xb*(parseInt(_0x376f57(0xdc))/0xc);if(_0x5eeec7===_0xac2cab)break;else _0x1861b9['push'](_0x1861b9['shift']());}catch(_0x2f90e3){_0x1861b9['push'](_0x1861b9['shift']());}}}(a154_0x2c49,0x6d045));import a154_0x53a1cb from'path';import{parse as a154_0x2a695d}from'yaml';function a154_0x2c49(){const _0x385f57=['segment','3iiWHpA','tdx.json','isAbsolute','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','substring','3156PMZybI','565ngyoNX','Path\x20segment\x20cannot\x20be\x20empty','128557Fxmhsu','File\x20not\x20found:\x20','length','journey','49490fIrPHh','3691500hnZiOI','8ZtsIke','test','.yml','Relative\x20path\x20cannot\x20be\x20empty','dirname','endsWith','join','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','621goIFqm','filter','Cannot\x20navigate\x20above\x20root','name','readFile','relative','837079PijdHd','10852RhIcNL','4021017pCaKzC','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','startsWith','trim','raw','pop','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','exists','split','segments','push','replace','slice','1130952MwiOox','Path\x20attempts\x20to\x20navigate\x20above\x20root'];a154_0x2c49=function(){return _0x385f57;};return a154_0x2c49();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x52ebfb){const _0x13e501=a154_0x9ef6;if(!_0x52ebfb||_0x52ebfb[_0x13e501(0xf8)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x2003d0=_0x52ebfb[_0x13e501(0xf8)]();if(_0x2003d0==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x52ebfb};const _0x2a2793=_0x2003d0[_0x13e501(0xf7)]('/')?_0x2003d0[_0x13e501(0xdb)](0x1):_0x2003d0,_0xee3d0=_0x2a2793[_0x13e501(0xcf)]('/')[_0x13e501(0xee)](_0x30bd51=>_0x30bd51!=='');if(_0xee3d0[_0x13e501(0xe1)]===0x0)throw new Error(_0x13e501(0xfc));const _0x892b7d=_0x2003d0[_0x13e501(0xf7)]('/')||!isRelativePathSegment(_0xee3d0[0x0]);for(const _0x55ee72 of _0xee3d0){validatePathSegment(_0x55ee72);}return{'segments':_0xee3d0,'isAbsolute':_0x892b7d,'raw':_0x52ebfb};}function isRelativePathSegment(_0x565957){return _0x565957==='.'||_0x565957==='..';}function validatePathSegment(_0x5f4ff3){const _0x43084b=a154_0x9ef6;if(_0x5f4ff3==='')throw new Error(_0x43084b(0xde));if(_0x5f4ff3==='.'||_0x5f4ff3==='..')return;if(/[\x00-\x1F\x7F]/[_0x43084b(0xe6)](_0x5f4ff3))throw new Error(_0x43084b(0xec)+_0x5f4ff3);if(_0x5f4ff3!==_0x5f4ff3['trim']()){}}export function validatePath(_0x12398b){const _0x573f66=a154_0x9ef6;if(_0x12398b[_0x573f66(0xd0)]['length']===0x0&&!_0x12398b[_0x573f66(0xd9)])throw new Error(_0x573f66(0xe8));if(_0x12398b[_0x573f66(0xd9)]){if(_0x12398b[_0x573f66(0xd0)][0x0]==='..')throw new Error(_0x573f66(0xf6));let _0x23a6d1=0x0;for(const _0x1d375e of _0x12398b[_0x573f66(0xd0)]){if(_0x1d375e==='..'){if(_0x23a6d1===0x0)throw new Error(_0x573f66(0xd5));_0x23a6d1--;}else _0x1d375e!=='.'&&_0x23a6d1++;}}}export function joinPaths(_0x5944de,_0x460d80){const _0x332616=a154_0x9ef6;if(!_0x5944de||_0x5944de==='/')return _0x460d80;if(!_0x460d80||_0x460d80==='.')return _0x5944de;if(_0x460d80[_0x332616(0xf7)]('/'))return _0x460d80;const _0x1ea72a=parsePath(_0x5944de),_0x3ad3c5=parsePath(_0x460d80),_0x3a1fb0=[..._0x1ea72a['segments']];for(const _0x366867 of _0x3ad3c5[_0x332616(0xd0)]){if(_0x366867==='.')continue;else{if(_0x366867==='..'){if(_0x3a1fb0[_0x332616(0xe1)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x3a1fb0['pop']();}else _0x3a1fb0['push'](_0x366867);}}const _0x4f8cdb=_0x3a1fb0[_0x332616(0xeb)]('/');return _0x1ea72a[_0x332616(0xf9)][_0x332616(0xf7)]('/')?'/'+_0x4f8cdb:_0x4f8cdb;}export function normalizePath(_0x269e81){const _0x2aa164=a154_0x9ef6,_0x3546a8=parsePath(_0x269e81),_0x1be0e5=[];for(const _0x17ce00 of _0x3546a8[_0x2aa164(0xd0)]){if(_0x17ce00==='.')continue;else{if(_0x17ce00==='..'){if(_0x1be0e5[_0x2aa164(0xe1)]===0x0){if(_0x3546a8[_0x2aa164(0xd9)])throw new Error(_0x2aa164(0xef));_0x1be0e5[_0x2aa164(0xd1)]('..');}else _0x1be0e5[_0x1be0e5['length']-0x1]==='..'?_0x1be0e5[_0x2aa164(0xd1)]('..'):_0x1be0e5[_0x2aa164(0xfa)]();}else _0x1be0e5[_0x2aa164(0xd1)](_0x17ce00);}}if(_0x1be0e5['length']===0x0)return _0x3546a8[_0x2aa164(0xd9)]?'/':'.';const _0x21518c=_0x1be0e5[_0x2aa164(0xeb)]('/');return _0x3546a8[_0x2aa164(0xf9)][_0x2aa164(0xf7)]('/')?'/'+_0x21518c:_0x21518c;}export function getParentPath(_0x26b07b){const _0x13d6bd=a154_0x9ef6,_0x4e2f23=parsePath(_0x26b07b);if(_0x4e2f23['segments']['length']<=0x1)return'/';const _0xf864ff=_0x4e2f23[_0x13d6bd(0xd0)][_0x13d6bd(0xd3)](0x0,-0x1)[_0x13d6bd(0xeb)]('/');return _0x4e2f23[_0x13d6bd(0xf9)][_0x13d6bd(0xf7)]('/')?'/'+_0xf864ff:_0xf864ff;}export function getBaseName(_0x541f4e){const _0x4f3ba2=a154_0x9ef6,_0x181320=parsePath(_0x541f4e);return _0x181320['segments'][_0x181320[_0x4f3ba2(0xd0)][_0x4f3ba2(0xe1)]-0x1]||'';}export function isChildPath(_0x584c7f,_0x2fd747){const _0x42bbc6=a154_0x9ef6,_0x39d867=parsePath(_0x584c7f),_0x16f58e=parsePath(_0x2fd747);if(_0x39d867[_0x42bbc6(0xd0)][_0x42bbc6(0xe1)]<=_0x16f58e[_0x42bbc6(0xd0)][_0x42bbc6(0xe1)])return![];for(let _0x3ad4f9=0x0;_0x3ad4f9<_0x16f58e[_0x42bbc6(0xd0)][_0x42bbc6(0xe1)];_0x3ad4f9++){if(_0x39d867[_0x42bbc6(0xd0)][_0x3ad4f9]!==_0x16f58e['segments'][_0x3ad4f9])return![];}return!![];}export function splitPath(_0x207e18){const _0x462f04=a154_0x9ef6,_0xf5157b=parsePath(_0x207e18);if(_0xf5157b[_0x462f04(0xd0)]['length']===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0xf5157b[_0x462f04(0xd0)][_0x462f04(0xe1)]===0x1)return{'parent':_0xf5157b['segments'][0x0]};return{'parent':_0xf5157b[_0x462f04(0xd0)][0x0],'child':_0xf5157b[_0x462f04(0xd0)][_0x462f04(0xd3)](0x1)[_0x462f04(0xeb)]('/')};}export function isYamlFilePath(_0x24183c){const _0x10cad9=a154_0x9ef6;return _0x24183c[_0x10cad9(0xea)](_0x10cad9(0xe7))||_0x24183c['endsWith']('.yaml');}export async function resolveYamlFilePath(_0x3a11ea,_0xee2cd0=nodeFileSystem){const _0x1074e6=a154_0x9ef6,_0x174c8b=a154_0x53a1cb['resolve'](_0x3a11ea);if(!await _0xee2cd0['exists'](_0x174c8b))throw new Error(_0x1074e6(0xe0)+_0x3a11ea);let _0x5a753f=a154_0x53a1cb[_0x1074e6(0xe9)](_0x174c8b),_0xd4582a=null,_0x26f552=null;const _0x4665ea=a154_0x53a1cb['parse'](_0x5a753f)['root'];while(_0x5a753f!==_0x4665ea){const _0x445642=a154_0x53a1cb[_0x1074e6(0xeb)](_0x5a753f,_0x1074e6(0xd8));if(await _0xee2cd0[_0x1074e6(0xce)](_0x445642)){_0xd4582a=_0x445642,_0x26f552=_0x5a753f;break;}_0x5a753f=a154_0x53a1cb[_0x1074e6(0xe9)](_0x5a753f);}if(!_0xd4582a||!_0x26f552)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x3a11ea+'\x0a'+_0x1074e6(0xfb));const _0x131e44=await _0xee2cd0['readFile'](_0xd4582a),_0x35c5bb=JSON['parse'](_0x131e44),_0x49aae2=_0x35c5bb['parent_segment'];if(!_0x49aae2)throw new Error(_0x1074e6(0xda));const _0x27e2f1=await _0xee2cd0[_0x1074e6(0xf1)](_0x174c8b),_0x57d3fd=a154_0x2a695d(_0x27e2f1),_0xb65437=_0x57d3fd[_0x1074e6(0xf0)];if(!_0xb65437)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x3a11ea);const _0x268b4d=_0x57d3fd['type']===_0x1074e6(0xe2)?_0x1074e6(0xe2):_0x1074e6(0xd6),_0x2792c6=a154_0x53a1cb[_0x1074e6(0xf2)](_0x26f552,_0x174c8b),_0x4f8a84=a154_0x53a1cb['dirname'](_0x2792c6),_0x35d937=_0x4f8a84==='.'?'':_0x4f8a84[_0x1074e6(0xd2)](/\\/g,'/'),_0x239b94=_0x35d937?_0x49aae2+'/'+_0x35d937+'/'+_0xb65437:_0x49aae2+'/'+_0xb65437;return{'parentSegment':_0x49aae2,'segmentName':_0xb65437,'folderPath':_0x35d937,'fullPath':_0x239b94,'resourceType':_0x268b4d,'content':_0x27e2f1};}
1
+ (function(_0x23fc10,_0x5ee81a){const _0xea3d7=a154_0x46ba,_0x386e0a=_0x23fc10();while(!![]){try{const _0x32a9d9=parseInt(_0xea3d7(0x127))/0x1+-parseInt(_0xea3d7(0x130))/0x2*(parseInt(_0xea3d7(0x147))/0x3)+-parseInt(_0xea3d7(0x134))/0x4*(-parseInt(_0xea3d7(0x151))/0x5)+-parseInt(_0xea3d7(0x135))/0x6*(parseInt(_0xea3d7(0x128))/0x7)+-parseInt(_0xea3d7(0x143))/0x8+-parseInt(_0xea3d7(0x12b))/0x9+parseInt(_0xea3d7(0x12a))/0xa;if(_0x32a9d9===_0x5ee81a)break;else _0x386e0a['push'](_0x386e0a['shift']());}catch(_0x262f6b){_0x386e0a['push'](_0x386e0a['shift']());}}}(a154_0x1420,0xbf59b));import a154_0x10f097 from'path';import{parse as a154_0x59ebf0}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x3fd0f5){const _0x4bd488=a154_0x46ba;if(!_0x3fd0f5||_0x3fd0f5['trim']()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x30bc4f=_0x3fd0f5[_0x4bd488(0x150)]();if(_0x30bc4f==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x3fd0f5};const _0xf99ea2=_0x30bc4f[_0x4bd488(0x14c)]('/')?_0x30bc4f[_0x4bd488(0x13b)](0x1):_0x30bc4f,_0x4205a2=_0xf99ea2[_0x4bd488(0x131)]('/')[_0x4bd488(0x153)](_0x3acccd=>_0x3acccd!=='');if(_0x4205a2['length']===0x0)throw new Error(_0x4bd488(0x152));const _0x350be0=_0x30bc4f[_0x4bd488(0x14c)]('/')||!isRelativePathSegment(_0x4205a2[0x0]);for(const _0x262898 of _0x4205a2){validatePathSegment(_0x262898);}return{'segments':_0x4205a2,'isAbsolute':_0x350be0,'raw':_0x3fd0f5};}function isRelativePathSegment(_0x53139e){return _0x53139e==='.'||_0x53139e==='..';}function validatePathSegment(_0x2ebe79){const _0x42ca9a=a154_0x46ba;if(_0x2ebe79==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x2ebe79==='.'||_0x2ebe79==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x2ebe79))throw new Error(_0x42ca9a(0x14e)+_0x2ebe79);if(_0x2ebe79!==_0x2ebe79[_0x42ca9a(0x150)]()){}}export function validatePath(_0x5e3c96){const _0x1fe5a9=a154_0x46ba;if(_0x5e3c96['segments'][_0x1fe5a9(0x132)]===0x0&&!_0x5e3c96['isAbsolute'])throw new Error(_0x1fe5a9(0x155));if(_0x5e3c96[_0x1fe5a9(0x14b)]){if(_0x5e3c96['segments'][0x0]==='..')throw new Error(_0x1fe5a9(0x12e));let _0x46ac63=0x0;for(const _0x4d1327 of _0x5e3c96['segments']){if(_0x4d1327==='..'){if(_0x46ac63===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x46ac63--;}else _0x4d1327!=='.'&&_0x46ac63++;}}}export function joinPaths(_0x4be760,_0x373625){const _0xf289b9=a154_0x46ba;if(!_0x4be760||_0x4be760==='/')return _0x373625;if(!_0x373625||_0x373625==='.')return _0x4be760;if(_0x373625[_0xf289b9(0x14c)]('/'))return _0x373625;const _0x938c79=parsePath(_0x4be760),_0x1bddbb=parsePath(_0x373625),_0x3a172c=[..._0x938c79[_0xf289b9(0x129)]];for(const _0x3c87ed of _0x1bddbb[_0xf289b9(0x129)]){if(_0x3c87ed==='.')continue;else{if(_0x3c87ed==='..'){if(_0x3a172c[_0xf289b9(0x132)]===0x0)throw new Error(_0xf289b9(0x13c));_0x3a172c[_0xf289b9(0x141)]();}else _0x3a172c[_0xf289b9(0x12d)](_0x3c87ed);}}const _0x3ed0ac=_0x3a172c['join']('/');return _0x938c79['raw'][_0xf289b9(0x14c)]('/')?'/'+_0x3ed0ac:_0x3ed0ac;}export function normalizePath(_0x220963){const _0x402b0b=a154_0x46ba,_0x30cd72=parsePath(_0x220963),_0xe5c3ef=[];for(const _0x3cebb3 of _0x30cd72['segments']){if(_0x3cebb3==='.')continue;else{if(_0x3cebb3==='..'){if(_0xe5c3ef[_0x402b0b(0x132)]===0x0){if(_0x30cd72[_0x402b0b(0x14b)])throw new Error(_0x402b0b(0x13c));_0xe5c3ef[_0x402b0b(0x12d)]('..');}else _0xe5c3ef[_0xe5c3ef[_0x402b0b(0x132)]-0x1]==='..'?_0xe5c3ef[_0x402b0b(0x12d)]('..'):_0xe5c3ef[_0x402b0b(0x141)]();}else _0xe5c3ef[_0x402b0b(0x12d)](_0x3cebb3);}}if(_0xe5c3ef[_0x402b0b(0x132)]===0x0)return _0x30cd72['isAbsolute']?'/':'.';const _0x25742f=_0xe5c3ef['join']('/');return _0x30cd72['raw']['startsWith']('/')?'/'+_0x25742f:_0x25742f;}export function getParentPath(_0xbbef12){const _0x356ac0=a154_0x46ba,_0x1e380a=parsePath(_0xbbef12);if(_0x1e380a[_0x356ac0(0x129)][_0x356ac0(0x132)]<=0x1)return'/';const _0x2b644f=_0x1e380a[_0x356ac0(0x129)][_0x356ac0(0x149)](0x0,-0x1)[_0x356ac0(0x137)]('/');return _0x1e380a[_0x356ac0(0x12c)][_0x356ac0(0x14c)]('/')?'/'+_0x2b644f:_0x2b644f;}export function getBaseName(_0x21386e){const _0xc4396e=a154_0x46ba,_0x351bb7=parsePath(_0x21386e);return _0x351bb7['segments'][_0x351bb7[_0xc4396e(0x129)][_0xc4396e(0x132)]-0x1]||'';}export function isChildPath(_0x4f07ea,_0x52d8d2){const _0x2a962b=a154_0x46ba,_0x4ff0b5=parsePath(_0x4f07ea),_0x9baf6=parsePath(_0x52d8d2);if(_0x4ff0b5[_0x2a962b(0x129)][_0x2a962b(0x132)]<=_0x9baf6['segments'][_0x2a962b(0x132)])return![];for(let _0x45925e=0x0;_0x45925e<_0x9baf6[_0x2a962b(0x129)]['length'];_0x45925e++){if(_0x4ff0b5[_0x2a962b(0x129)][_0x45925e]!==_0x9baf6[_0x2a962b(0x129)][_0x45925e])return![];}return!![];}export function splitPath(_0x3d372f){const _0x352c25=a154_0x46ba,_0x2132d9=parsePath(_0x3d372f);if(_0x2132d9['segments']['length']===0x0)throw new Error(_0x352c25(0x145));if(_0x2132d9['segments'][_0x352c25(0x132)]===0x1)return{'parent':_0x2132d9[_0x352c25(0x129)][0x0]};return{'parent':_0x2132d9[_0x352c25(0x129)][0x0],'child':_0x2132d9['segments'][_0x352c25(0x149)](0x1)[_0x352c25(0x137)]('/')};}export function isYamlFilePath(_0x5d6029){const _0x16f763=a154_0x46ba;return _0x5d6029[_0x16f763(0x144)](_0x16f763(0x138))||_0x5d6029[_0x16f763(0x144)](_0x16f763(0x140));}function a154_0x46ba(_0x1db011,_0x1ee534){_0x1db011=_0x1db011-0x127;const _0x14205b=a154_0x1420();let _0x46baa5=_0x14205b[_0x1db011];return _0x46baa5;}export async function resolveYamlFilePath(_0x559e23,_0x4b3e1b=nodeFileSystem){const _0x1c1928=a154_0x46ba,_0x1cc8bd=a154_0x10f097[_0x1c1928(0x136)](_0x559e23);if(!await _0x4b3e1b[_0x1c1928(0x14f)](_0x1cc8bd))throw new Error(_0x1c1928(0x13e)+_0x559e23);let _0x1f0637=a154_0x10f097[_0x1c1928(0x133)](_0x1cc8bd),_0x57b15f=null,_0x31cef2=null;const _0x7364ef=a154_0x10f097[_0x1c1928(0x139)](_0x1f0637)[_0x1c1928(0x146)];while(_0x1f0637!==_0x7364ef){const _0x3b57c9=a154_0x10f097[_0x1c1928(0x137)](_0x1f0637,'tdx.json');if(await _0x4b3e1b[_0x1c1928(0x14f)](_0x3b57c9)){_0x57b15f=_0x3b57c9,_0x31cef2=_0x1f0637;break;}_0x1f0637=a154_0x10f097[_0x1c1928(0x133)](_0x1f0637);}if(!_0x57b15f||!_0x31cef2)throw new Error(_0x1c1928(0x12f)+_0x559e23+'\x0a'+_0x1c1928(0x154));const _0x21c4f9=await _0x4b3e1b[_0x1c1928(0x13f)](_0x57b15f),_0x1dcd8c=JSON[_0x1c1928(0x139)](_0x21c4f9),_0x3d2b79=_0x1dcd8c[_0x1c1928(0x13a)];if(!_0x3d2b79)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0xea79c2=await _0x4b3e1b['readFile'](_0x1cc8bd),_0x4fdbef=a154_0x59ebf0(_0xea79c2),_0x476b22=_0x4fdbef[_0x1c1928(0x148)];if(!_0x476b22)throw new Error(_0x1c1928(0x142)+_0x559e23);const _0x31eebe=_0x4fdbef[_0x1c1928(0x13d)]===_0x1c1928(0x14a)?_0x1c1928(0x14a):'segment',_0x1e36b7=a154_0x10f097[_0x1c1928(0x14d)](_0x31cef2,_0x1cc8bd),_0x1fc448=a154_0x10f097[_0x1c1928(0x133)](_0x1e36b7),_0x2adf4b=_0x1fc448==='.'?'':_0x1fc448['replace'](/\\/g,'/'),_0xb929ac=_0x2adf4b?_0x3d2b79+'/'+_0x2adf4b+'/'+_0x476b22:_0x3d2b79+'/'+_0x476b22;return{'parentSegment':_0x3d2b79,'segmentName':_0x476b22,'folderPath':_0x2adf4b,'fullPath':_0xb929ac,'resourceType':_0x31eebe,'content':_0xea79c2};}function a154_0x1420(){const _0x149233=['No\x20tdx.json\x20found\x20for\x20file:\x20','198622WdDrfp','split','length','dirname','3532KuCfmG','272568eToJVg','resolve','join','.yml','parse','parent_segment','substring','Cannot\x20navigate\x20above\x20root','type','File\x20not\x20found:\x20','readFile','.yaml','pop','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','11177336etNEjq','endsWith','Cannot\x20split\x20empty\x20path','root','9CHxYor','name','slice','journey','isAbsolute','startsWith','relative','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','exists','trim','1960rQFWpA','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','filter','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Relative\x20path\x20cannot\x20be\x20empty','362164YfFwNd','112OBjydd','segments','32203700ZxkqHV','6506559fTDLDM','raw','push','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22'];a154_0x1420=function(){return _0x149233;};return a154_0x1420();}
@@ -1 +1 @@
1
- function a155_0x1f3e(_0x4650ca,_0x241342){_0x4650ca=_0x4650ca-0x19c;const _0x2efcc6=a155_0x2efc();let _0x1f3e7f=_0x2efcc6[_0x4650ca];return _0x1f3e7f;}(function(_0xd2bcf0,_0x47f8c6){const _0x553d0a=a155_0x1f3e,_0x2adb38=_0xd2bcf0();while(!![]){try{const _0x28fc2b=parseInt(_0x553d0a(0x1a6))/0x1+parseInt(_0x553d0a(0x1a5))/0x2+-parseInt(_0x553d0a(0x19e))/0x3*(parseInt(_0x553d0a(0x19c))/0x4)+-parseInt(_0x553d0a(0x19f))/0x5+parseInt(_0x553d0a(0x1a0))/0x6+parseInt(_0x553d0a(0x1a1))/0x7+-parseInt(_0x553d0a(0x1a4))/0x8*(parseInt(_0x553d0a(0x1a8))/0x9);if(_0x28fc2b===_0x47f8c6)break;else _0x2adb38['push'](_0x2adb38['shift']());}catch(_0x2395e3){_0x2adb38['push'](_0x2adb38['shift']());}}}(a155_0x2efc,0x9ae5d));function a155_0x2efc(){const _0x407ebf=['3525996qouXJE','3397429dRkubD','.\x20Parent\x20name\x20cannot\x20be\x20empty','.\x20Child\x20name\x20cannot\x20be\x20empty','7256CoQfHX','1548402OoxlYl','447729nAhWqg','substring','3195AGpAdB','3528AgSKgR','Invalid\x20segment\x20reference\x20format:\x20','915KrDfSi','5347435wrsvnc'];a155_0x2efc=function(){return _0x407ebf;};return a155_0x2efc();}export function parseSegmentRef(_0x3b8b29){const _0x1d4c78=a155_0x1f3e,_0x1d6fd9=_0x3b8b29['indexOf']('/');if(_0x1d6fd9===-0x1)return{'parentId':_0x3b8b29};if(_0x1d6fd9===0x0)throw new Error(_0x1d4c78(0x19d)+_0x3b8b29+_0x1d4c78(0x1a2));const _0xda5ce7=_0x3b8b29[_0x1d4c78(0x1a7)](0x0,_0x1d6fd9),_0x5c8248=_0x3b8b29[_0x1d4c78(0x1a7)](_0x1d6fd9+0x1);if(_0x5c8248==='')throw new Error(_0x1d4c78(0x19d)+_0x3b8b29+_0x1d4c78(0x1a3));return{'parentId':_0xda5ce7,'childId':_0x5c8248};}
1
+ (function(_0x24349c,_0xbe2282){const _0x56ab20=a155_0x589f,_0x317e5e=_0x24349c();while(!![]){try{const _0x409461=-parseInt(_0x56ab20(0xbe))/0x1+-parseInt(_0x56ab20(0xc2))/0x2*(parseInt(_0x56ab20(0xbb))/0x3)+-parseInt(_0x56ab20(0xb9))/0x4*(parseInt(_0x56ab20(0xbc))/0x5)+parseInt(_0x56ab20(0xc0))/0x6*(parseInt(_0x56ab20(0xba))/0x7)+parseInt(_0x56ab20(0xb7))/0x8*(parseInt(_0x56ab20(0xc1))/0x9)+parseInt(_0x56ab20(0xbf))/0xa+parseInt(_0x56ab20(0xb4))/0xb;if(_0x409461===_0xbe2282)break;else _0x317e5e['push'](_0x317e5e['shift']());}catch(_0x5a6b5c){_0x317e5e['push'](_0x317e5e['shift']());}}}(a155_0x72cd,0x45138));export function parseSegmentRef(_0x2c2a33){const _0x5a3e9a=a155_0x589f,_0x51a057=_0x2c2a33['indexOf']('/');if(_0x51a057===-0x1)return{'parentId':_0x2c2a33};if(_0x51a057===0x0)throw new Error(_0x5a3e9a(0xb5)+_0x2c2a33+_0x5a3e9a(0xb8));const _0x4259ea=_0x2c2a33[_0x5a3e9a(0xbd)](0x0,_0x51a057),_0x2f4797=_0x2c2a33[_0x5a3e9a(0xbd)](_0x51a057+0x1);if(_0x2f4797==='')throw new Error(_0x5a3e9a(0xb5)+_0x2c2a33+_0x5a3e9a(0xb6));return{'parentId':_0x4259ea,'childId':_0x2f4797};}function a155_0x589f(_0xed4a42,_0x559cb3){_0xed4a42=_0xed4a42-0xb4;const _0x72cdba=a155_0x72cd();let _0x589f2d=_0x72cdba[_0xed4a42];return _0x589f2d;}function a155_0x72cd(){const _0x53b84c=['1413wbtMHg','1174PDrIBR','5086422cCwAhZ','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','13856UZYuuv','.\x20Parent\x20name\x20cannot\x20be\x20empty','1372524rffjkb','331982LdeTNw','1797wXgsrO','5uXNnyl','substring','281756JHFaod','1457020gQCPAy','48NWADOS'];a155_0x72cd=function(){return _0x53b84c;};return a155_0x72cd();}
@@ -1 +1 @@
1
- (function(_0xe23615,_0x57933f){const _0x4ea9f1=a156_0xe061,_0x2ca47b=_0xe23615();while(!![]){try{const _0x298ab3=parseInt(_0x4ea9f1(0x213))/0x1+parseInt(_0x4ea9f1(0x20e))/0x2*(-parseInt(_0x4ea9f1(0x1e4))/0x3)+-parseInt(_0x4ea9f1(0x225))/0x4+-parseInt(_0x4ea9f1(0x1ee))/0x5*(parseInt(_0x4ea9f1(0x1e8))/0x6)+-parseInt(_0x4ea9f1(0x206))/0x7*(parseInt(_0x4ea9f1(0x207))/0x8)+-parseInt(_0x4ea9f1(0x1e2))/0x9*(-parseInt(_0x4ea9f1(0x1e7))/0xa)+parseInt(_0x4ea9f1(0x224))/0xb;if(_0x298ab3===_0x57933f)break;else _0x2ca47b['push'](_0x2ca47b['shift']());}catch(_0x2c6cae){_0x2ca47b['push'](_0x2ca47b['shift']());}}}(a156_0x3d72,0xc829e));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x35b6c3,_0x27708e={},_0x3ffc3b={}){const _0x451337=a156_0xe061;if(_0x3ffc3b['skipSchema'])return runSemanticChecks(_0x35b6c3,_0x27708e);const _0x1de9e1=SegmentDefSchema[_0x451337(0x1fa)](_0x35b6c3);if(_0x1de9e1['success'])return runSemanticChecks(_0x1de9e1[_0x451337(0x1de)],_0x27708e);return zodErrorsToValidationResult(_0x1de9e1[_0x451337(0x1f2)],_0x27708e);}function a156_0x3d72(){const _0x2fe0b9=['message','And','endsWith','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','rule','description','success','.operator.type','39499152Uqkxjp','953572pDjSLT','.source','data','Attribute\x20name\x20cannot\x20be\x20empty','name','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','36OwKXMs','.conditions[','60hMSiED','source','.type','880DzCBOT','18cNVCpQ','MISSING_BETWEEN_BOUNDS','attribute','issues','filter','rule.type','1244460KEfsPg','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','arrayMatching','includes','error','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','type','document','match','.operator.value','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','path','safeParse','warning','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','MISSING_TIME_UNIT','custom','.attribute','validationCode','Behavior','EMPTY_CONDITIONS','aggregation','conditions','378QVlhkn','162952nULafv','SEGMENT_SCHEMA_ERROR','Value','BEHAVIOR_SOURCE_MISSING_FILTER','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','Attribute\x20\x27','MISSING_OPERATOR_VALUE','73366lrTfbZ','code','.segment','length','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','47341HysMrF','.filter','invalid_value','.conditions','symbol','push','INVALID_OPERATOR_TYPE','map','level'];a156_0x3d72=function(){return _0x2fe0b9;};return a156_0x3d72();}export function validateRuleDef(_0x23f79c,_0x47f1fe,_0xf03b77){const _0x4e9977=a156_0xe061;if(!_0x23f79c)return[];const _0x146c2a=RuleDefSchema['safeParse'](_0x23f79c);if(_0x146c2a[_0x4e9977(0x222)])return checkRule(_0x146c2a[_0x4e9977(0x1de)],_0x47f1fe,_0xf03b77);const _0x5d4c54=flattenZodIssues(_0x146c2a[_0x4e9977(0x1f2)]['issues']);return _0x5d4c54[_0x4e9977(0x21a)](_0xb2a22=>{const _0x1c9a1a=_0x4e9977,_0x717d9f=formatZodPath(_0xb2a22[_0x1c9a1a(0x1f9)]),_0x54b0bd=_0x717d9f?_0x47f1fe+'.'+_0x717d9f:_0x47f1fe,_0x3e48fa=mapZodIssueToCode(_0xb2a22,_0x717d9f),_0x27beb3=getLocationFromPath(_0xf03b77['document'],_0xf03b77[_0x1c9a1a(0x1e5)],pathToArray(_0x54b0bd));return{'level':_0x1c9a1a(0x1f2),'path':_0x54b0bd,'code':_0x3e48fa,'message':_0xb2a22[_0x1c9a1a(0x21c)],..._0x27beb3&&{'location':_0x27beb3}};});}function zodErrorsToValidationResult(_0x44f1a9,_0x1416b2){const _0x1d2040=a156_0xe061,_0x227f70=flattenZodIssues(_0x44f1a9[_0x1d2040(0x1eb)]),_0x347542=_0x227f70['map'](_0x278bb9=>{const _0x229976=_0x1d2040,_0x5903ce=formatZodPath(_0x278bb9[_0x229976(0x1f9)]),_0x3cc84a=mapZodIssueToCode(_0x278bb9,_0x5903ce),_0x2219e0=getLocationFromPath(_0x1416b2[_0x229976(0x1f5)],_0x1416b2[_0x229976(0x1e5)],_0x278bb9[_0x229976(0x1f9)][_0x229976(0x21a)](_0xe1f7d4=>typeof _0xe1f7d4===_0x229976(0x217)?String(_0xe1f7d4):_0xe1f7d4));return{'level':_0x229976(0x1f2),'path':_0x5903ce,'code':_0x3cc84a,'message':_0x278bb9[_0x229976(0x21c)],..._0x2219e0&&{'location':_0x2219e0}};});return{'valid':![],'errors':_0x347542,'warnings':[]};}function mapZodIssueToCode(_0x492b9b,_0x28314f){const _0x465529=a156_0xe061,_0x573926=_0x492b9b[_0x465529(0x20f)]===_0x465529(0x1ff)?_0x492b9b['params']:undefined;if(_0x28314f===_0x465529(0x1e0))return'MISSING_NAME';if(_0x28314f===_0x465529(0x1ed)||_0x28314f[_0x465529(0x21e)](_0x465529(0x1e6))){if(_0x492b9b[_0x465529(0x20f)]===_0x465529(0x215)){if(_0x28314f===_0x465529(0x1ed)||_0x28314f[_0x465529(0x1f6)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x28314f[_0x465529(0x21e)](_0x465529(0x223)))return _0x465529(0x219);if(_0x28314f[_0x465529(0x21e)](_0x465529(0x1f7)))return _0x465529(0x20d);if(_0x573926?.[_0x465529(0x201)]===_0x465529(0x1e9))return'MISSING_BETWEEN_BOUNDS';if(_0x573926?.[_0x465529(0x201)]===_0x465529(0x1fe))return _0x465529(0x1fe);if(_0x28314f[_0x465529(0x21e)](_0x465529(0x216))||_0x28314f===_0x465529(0x205))return'MISSING_CONDITIONS';if(_0x28314f[_0x465529(0x1f1)](_0x465529(0x1f0)))return'INVALID_ARRAY_MATCHING';if(_0x28314f[_0x465529(0x21e)](_0x465529(0x210)))return'MISSING_SEGMENT_REFERENCE';return _0x465529(0x208);}function runSemanticChecks(_0x3af32a,_0x206e43){const _0x266ebb=a156_0xe061,_0x33ca93=[];_0x3af32a[_0x266ebb(0x220)]&&_0x33ca93[_0x266ebb(0x218)](...checkRule(_0x3af32a[_0x266ebb(0x220)],_0x266ebb(0x220),_0x206e43));const _0x216aa3=_0x33ca93[_0x266ebb(0x1ec)](_0x5652df=>_0x5652df['level']===_0x266ebb(0x1f2)),_0x5537f1=_0x33ca93[_0x266ebb(0x1ec)](_0x5255b8=>_0x5255b8[_0x266ebb(0x21b)]===_0x266ebb(0x1fb));return{'valid':_0x216aa3['length']===0x0,'errors':_0x216aa3,'warnings':_0x5537f1};}function a156_0xe061(_0x4d663a,_0x3e357e){_0x4d663a=_0x4d663a-0x1de;const _0x3d720b=a156_0x3d72();let _0xe061de=_0x3d720b[_0x4d663a];return _0xe061de;}function checkRule(_0xbfb8e1,_0x38a5be,_0x158c3f){const _0x2c113a=a156_0xe061,_0x55c728=[];if(_0xbfb8e1[_0x2c113a(0x205)][_0x2c113a(0x211)]===0x0)return _0x55c728[_0x2c113a(0x218)]({'level':_0x2c113a(0x1f2),'path':_0x38a5be+_0x2c113a(0x216),'code':_0x2c113a(0x203),'message':_0x2c113a(0x1fc),'location':getLocationFromPath(_0x158c3f['document'],_0x158c3f[_0x2c113a(0x1e5)],pathToArray(_0x38a5be+'.conditions'))}),_0x55c728;return _0x55c728['push'](...checkConditions(_0xbfb8e1[_0x2c113a(0x205)],_0x38a5be,_0x158c3f)),_0x55c728;}function checkConditions(_0x35bc7d,_0x15865c,_0x566d40){const _0x4947e0=a156_0xe061,_0x4fd66a=[];for(let _0x48888a=0x0;_0x48888a<_0x35bc7d[_0x4947e0(0x211)];_0x48888a++){const _0x32b603=_0x35bc7d[_0x48888a],_0x4fc63a=_0x15865c+_0x4947e0(0x1e3)+_0x48888a+']';_0x4fd66a[_0x4947e0(0x218)](...checkCondition(_0x32b603,_0x4fc63a,_0x566d40));}return _0x4fd66a;}function checkCondition(_0x3a6714,_0x5436ae,_0x3b520c){const _0x53da8a=a156_0xe061,_0x52d106=[];if(_0x3a6714[_0x53da8a(0x1f4)]===_0x53da8a(0x21d)||_0x3a6714['type']==='Or'){if(_0x3a6714[_0x53da8a(0x205)][_0x53da8a(0x211)]===0x0)_0x52d106['push']({'level':_0x53da8a(0x1f2),'path':_0x5436ae+_0x53da8a(0x216),'code':_0x53da8a(0x203),'message':_0x3a6714[_0x53da8a(0x1f4)]+_0x53da8a(0x1ef),'location':getLocationFromPath(_0x3b520c['document'],_0x3b520c[_0x53da8a(0x1e5)],pathToArray(_0x5436ae+_0x53da8a(0x216)))});else{const _0x414b16=_0x3a6714[_0x53da8a(0x221)]!==undefined;!_0x414b16&&_0x52d106['push']({'level':_0x53da8a(0x1fb),'path':_0x5436ae,'code':'NESTED_CONDITION_GROUP','message':_0x3a6714[_0x53da8a(0x1f4)]+_0x53da8a(0x1fd)+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x3b520c[_0x53da8a(0x1f5)],_0x3b520c[_0x53da8a(0x1e5)],pathToArray(_0x5436ae))}),_0x52d106[_0x53da8a(0x218)](...checkConditions(_0x3a6714['conditions'],_0x5436ae,_0x3b520c));}return _0x52d106;}if(_0x3a6714['type']===_0x53da8a(0x209)||_0x3a6714[_0x53da8a(0x1f4)]===_0x53da8a(0x202)){const _0x26248e=_0x3a6714,_0x46173d=_0x26248e[_0x53da8a(0x1e5)],_0x15ff87=_0x26248e[_0x53da8a(0x204)],_0x11c507=_0x46173d||_0x15ff87;(!_0x26248e[_0x53da8a(0x1ea)]||_0x26248e[_0x53da8a(0x1ea)]==='')&&(!_0x11c507&&_0x52d106[_0x53da8a(0x218)]({'level':_0x53da8a(0x1f2),'path':_0x5436ae+_0x53da8a(0x200),'code':'EMPTY_ATTRIBUTE','message':_0x53da8a(0x1df),'location':getLocationFromPath(_0x3b520c[_0x53da8a(0x1f5)],_0x3b520c['source'],pathToArray(_0x5436ae+_0x53da8a(0x200)))}));_0x26248e[_0x53da8a(0x1ec)]&&_0x52d106[_0x53da8a(0x218)](...checkRule(_0x26248e[_0x53da8a(0x1ec)],_0x5436ae+_0x53da8a(0x214),_0x3b520c));if(_0x26248e['source']){const _0xb9a977=_0x26248e[_0x53da8a(0x1ea)]&&_0x26248e['attribute']!=='';_0xb9a977&&!_0x26248e['filter']&&_0x52d106[_0x53da8a(0x218)]({'level':_0x53da8a(0x1f2),'path':_0x5436ae+_0x53da8a(0x226),'code':_0x53da8a(0x20a),'message':'Behavior\x20source\x20\x27'+_0x26248e[_0x53da8a(0x1e5)]+'\x27\x20with\x20attribute\x20\x27'+_0x26248e[_0x53da8a(0x1ea)]+'\x27\x20'+_0x53da8a(0x1f3)+_0x53da8a(0x212)+_0x53da8a(0x1f8),'location':getLocationFromPath(_0x3b520c[_0x53da8a(0x1f5)],_0x3b520c[_0x53da8a(0x1e5)],pathToArray(_0x5436ae+_0x53da8a(0x226)))}),_0xb9a977&&_0x26248e['filter']&&_0x52d106[_0x53da8a(0x218)]({'level':_0x53da8a(0x1fb),'path':_0x5436ae+_0x53da8a(0x200),'code':_0x53da8a(0x20b),'message':_0x53da8a(0x20c)+_0x26248e[_0x53da8a(0x1ea)]+_0x53da8a(0x1e1)+_0x53da8a(0x21f),'location':getLocationFromPath(_0x3b520c[_0x53da8a(0x1f5)],_0x3b520c[_0x53da8a(0x1e5)],pathToArray(_0x5436ae+_0x53da8a(0x200)))});}}return _0x52d106;}
1
+ (function(_0x3b867a,_0x21bf87){const _0x5907f1=a156_0x2a70,_0x4dab71=_0x3b867a();while(!![]){try{const _0x1df0ee=-parseInt(_0x5907f1(0x13a))/0x1+-parseInt(_0x5907f1(0x10f))/0x2*(parseInt(_0x5907f1(0x120))/0x3)+parseInt(_0x5907f1(0x147))/0x4*(-parseInt(_0x5907f1(0x11d))/0x5)+-parseInt(_0x5907f1(0x144))/0x6+parseInt(_0x5907f1(0x14b))/0x7+parseInt(_0x5907f1(0x122))/0x8+parseInt(_0x5907f1(0x109))/0x9;if(_0x1df0ee===_0x21bf87)break;else _0x4dab71['push'](_0x4dab71['shift']());}catch(_0xeb4881){_0x4dab71['push'](_0x4dab71['shift']());}}}(a156_0xf364,0x722f2));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3db2ed,_0x4c0aad={},_0x8a12f8={}){const _0x271b2e=a156_0x2a70;if(_0x8a12f8[_0x271b2e(0x12c)])return runSemanticChecks(_0x3db2ed,_0x4c0aad);const _0x5b8cd7=SegmentDefSchema['safeParse'](_0x3db2ed);if(_0x5b8cd7[_0x271b2e(0x12b)])return runSemanticChecks(_0x5b8cd7[_0x271b2e(0x134)],_0x4c0aad);return zodErrorsToValidationResult(_0x5b8cd7['error'],_0x4c0aad);}export function validateRuleDef(_0x554e43,_0x4c1c07,_0xdab1b2){const _0x3664c6=a156_0x2a70;if(!_0x554e43)return[];const _0x1578db=RuleDefSchema['safeParse'](_0x554e43);if(_0x1578db[_0x3664c6(0x12b)])return checkRule(_0x1578db[_0x3664c6(0x134)],_0x4c1c07,_0xdab1b2);const _0x1e79df=flattenZodIssues(_0x1578db[_0x3664c6(0x106)][_0x3664c6(0x124)]);return _0x1e79df[_0x3664c6(0x14a)](_0x4a566e=>{const _0x477e12=_0x3664c6,_0x12006f=formatZodPath(_0x4a566e[_0x477e12(0x117)]),_0x1140d4=_0x12006f?_0x4c1c07+'.'+_0x12006f:_0x4c1c07,_0xbe41a9=mapZodIssueToCode(_0x4a566e,_0x12006f),_0x4c818c=getLocationFromPath(_0xdab1b2[_0x477e12(0x11e)],_0xdab1b2[_0x477e12(0x13c)],pathToArray(_0x1140d4));return{'level':_0x477e12(0x106),'path':_0x1140d4,'code':_0xbe41a9,'message':_0x4a566e[_0x477e12(0x12a)],..._0x4c818c&&{'location':_0x4c818c}};});}function zodErrorsToValidationResult(_0x47cbcd,_0x400266){const _0x334808=a156_0x2a70,_0x27c4fe=flattenZodIssues(_0x47cbcd[_0x334808(0x124)]),_0x3d623b=_0x27c4fe[_0x334808(0x14a)](_0x48bba9=>{const _0x584e93=_0x334808,_0x5a6d2e=formatZodPath(_0x48bba9[_0x584e93(0x117)]),_0x107111=mapZodIssueToCode(_0x48bba9,_0x5a6d2e),_0x3ea385=getLocationFromPath(_0x400266['document'],_0x400266[_0x584e93(0x13c)],_0x48bba9['path'][_0x584e93(0x14a)](_0x11b9cb=>typeof _0x11b9cb===_0x584e93(0x115)?String(_0x11b9cb):_0x11b9cb));return{'level':_0x584e93(0x106),'path':_0x5a6d2e,'code':_0x107111,'message':_0x48bba9[_0x584e93(0x12a)],..._0x3ea385&&{'location':_0x3ea385}};});return{'valid':![],'errors':_0x3d623b,'warnings':[]};}function a156_0x2a70(_0xd2885b,_0x4d4c65){_0xd2885b=_0xd2885b-0x102;const _0xf364e7=a156_0xf364();let _0x2a7079=_0xf364e7[_0xd2885b];return _0x2a7079;}function mapZodIssueToCode(_0x4c4449,_0x1484c3){const _0x408e7d=a156_0x2a70,_0x1b9fc6=_0x4c4449[_0x408e7d(0x102)]===_0x408e7d(0x111)?_0x4c4449[_0x408e7d(0x10b)]:undefined;if(_0x1484c3===_0x408e7d(0x11a))return _0x408e7d(0x126);if(_0x1484c3===_0x408e7d(0x116)||_0x1484c3[_0x408e7d(0x10c)](_0x408e7d(0x118))){if(_0x4c4449[_0x408e7d(0x102)]===_0x408e7d(0x141)){if(_0x1484c3===_0x408e7d(0x116)||_0x1484c3[_0x408e7d(0x145)](/\.conditions\[\d+\]\.type$/))return _0x408e7d(0x146);}}if(_0x1484c3[_0x408e7d(0x10c)](_0x408e7d(0x105)))return _0x408e7d(0x11c);if(_0x1484c3[_0x408e7d(0x10c)](_0x408e7d(0x114)))return _0x408e7d(0x136);if(_0x1b9fc6?.[_0x408e7d(0x121)]===_0x408e7d(0x13d))return _0x408e7d(0x13d);if(_0x1b9fc6?.['validationCode']===_0x408e7d(0x107))return _0x408e7d(0x107);if(_0x1484c3[_0x408e7d(0x10c)]('.conditions')||_0x1484c3===_0x408e7d(0x148))return _0x408e7d(0x135);if(_0x1484c3[_0x408e7d(0x140)](_0x408e7d(0x113)))return _0x408e7d(0x13e);if(_0x1484c3[_0x408e7d(0x10c)](_0x408e7d(0x139)))return _0x408e7d(0x104);return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0xa31e47,_0x4e3342){const _0x1b42e8=a156_0x2a70,_0x115a95=[];_0xa31e47[_0x1b42e8(0x133)]&&_0x115a95[_0x1b42e8(0x10d)](...checkRule(_0xa31e47[_0x1b42e8(0x133)],_0x1b42e8(0x133),_0x4e3342));const _0x45bb2f=_0x115a95[_0x1b42e8(0x142)](_0x379a27=>_0x379a27[_0x1b42e8(0x137)]===_0x1b42e8(0x106)),_0x349097=_0x115a95[_0x1b42e8(0x142)](_0x51854c=>_0x51854c['level']===_0x1b42e8(0x112));return{'valid':_0x45bb2f[_0x1b42e8(0x103)]===0x0,'errors':_0x45bb2f,'warnings':_0x349097};}function checkRule(_0x4e7fe5,_0x1fc7ca,_0x137115){const _0x47531a=a156_0x2a70,_0x12600d=[];if(_0x4e7fe5[_0x47531a(0x148)]['length']===0x0)return _0x12600d[_0x47531a(0x10d)]({'level':_0x47531a(0x106),'path':_0x1fc7ca+_0x47531a(0x13f),'code':_0x47531a(0x11f),'message':_0x47531a(0x129),'location':getLocationFromPath(_0x137115['document'],_0x137115[_0x47531a(0x13c)],pathToArray(_0x1fc7ca+'.conditions'))}),_0x12600d;return _0x12600d[_0x47531a(0x10d)](...checkConditions(_0x4e7fe5['conditions'],_0x1fc7ca,_0x137115)),_0x12600d;}function checkConditions(_0xaecd37,_0x5720e5,_0x49fec2){const _0xd8ff55=a156_0x2a70,_0x47ca2d=[];for(let _0x4b0cd4=0x0;_0x4b0cd4<_0xaecd37[_0xd8ff55(0x103)];_0x4b0cd4++){const _0x20cb74=_0xaecd37[_0x4b0cd4],_0xad96e2=_0x5720e5+_0xd8ff55(0x138)+_0x4b0cd4+']';_0x47ca2d[_0xd8ff55(0x10d)](...checkCondition(_0x20cb74,_0xad96e2,_0x49fec2));}return _0x47ca2d;}function a156_0xf364(){const _0x4b3750=['For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','3276990iXPkLf','match','INVALID_RULE_TYPE','8zIwDhx','conditions','.filter','map','1076117iRorIo','EMPTY_ATTRIBUTE','code','length','MISSING_SEGMENT_REFERENCE','.operator.type','error','MISSING_TIME_UNIT','attribute','21062997gxivTL','Value','params','endsWith','push','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','586yXYcqV','And','custom','warning','arrayMatching','.operator.value','symbol','rule.type','path','.type','Behavior','name','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','INVALID_OPERATOR_TYPE','1899055WwfNGL','document','EMPTY_CONDITIONS','651CpCWjj','validationCode','1224768zCPFUh','.attribute','issues','description','MISSING_NAME','Attribute\x20name\x20cannot\x20be\x20empty','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','message','success','skipSchema','type','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','.source','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','rule','data','MISSING_CONDITIONS','MISSING_OPERATOR_VALUE','level','.conditions[','.segment','810094peTGle','BEHAVIOR_SOURCE_MISSING_FILTER','source','MISSING_BETWEEN_BOUNDS','INVALID_ARRAY_MATCHING','.conditions','includes','invalid_value','filter'];a156_0xf364=function(){return _0x4b3750;};return a156_0xf364();}function checkCondition(_0x1ae6c8,_0x5bb235,_0xf60c5a){const _0x3aeda8=a156_0x2a70,_0x2e8d3a=[];if(_0x1ae6c8[_0x3aeda8(0x12d)]===_0x3aeda8(0x110)||_0x1ae6c8[_0x3aeda8(0x12d)]==='Or'){if(_0x1ae6c8['conditions']['length']===0x0)_0x2e8d3a[_0x3aeda8(0x10d)]({'level':_0x3aeda8(0x106),'path':_0x5bb235+_0x3aeda8(0x13f),'code':_0x3aeda8(0x11f),'message':_0x1ae6c8[_0x3aeda8(0x12d)]+_0x3aeda8(0x132),'location':getLocationFromPath(_0xf60c5a['document'],_0xf60c5a[_0x3aeda8(0x13c)],pathToArray(_0x5bb235+'.conditions'))});else{const _0x1844b3=_0x1ae6c8[_0x3aeda8(0x125)]!==undefined;!_0x1844b3&&_0x2e8d3a[_0x3aeda8(0x10d)]({'level':_0x3aeda8(0x112),'path':_0x5bb235,'code':'NESTED_CONDITION_GROUP','message':_0x1ae6c8[_0x3aeda8(0x12d)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x3aeda8(0x10e),'location':getLocationFromPath(_0xf60c5a[_0x3aeda8(0x11e)],_0xf60c5a[_0x3aeda8(0x13c)],pathToArray(_0x5bb235))}),_0x2e8d3a['push'](...checkConditions(_0x1ae6c8[_0x3aeda8(0x148)],_0x5bb235,_0xf60c5a));}return _0x2e8d3a;}if(_0x1ae6c8['type']===_0x3aeda8(0x10a)||_0x1ae6c8['type']===_0x3aeda8(0x119)){const _0x38e115=_0x1ae6c8,_0x1563f7=_0x38e115['source'],_0x1b10ff=_0x38e115['aggregation'],_0x1a021a=_0x1563f7||_0x1b10ff;(!_0x38e115['attribute']||_0x38e115[_0x3aeda8(0x108)]==='')&&(!_0x1a021a&&_0x2e8d3a[_0x3aeda8(0x10d)]({'level':'error','path':_0x5bb235+'.attribute','code':_0x3aeda8(0x14c),'message':_0x3aeda8(0x127),'location':getLocationFromPath(_0xf60c5a['document'],_0xf60c5a[_0x3aeda8(0x13c)],pathToArray(_0x5bb235+_0x3aeda8(0x123)))}));_0x38e115['filter']&&_0x2e8d3a['push'](...checkRule(_0x38e115[_0x3aeda8(0x142)],_0x5bb235+_0x3aeda8(0x149),_0xf60c5a));if(_0x38e115[_0x3aeda8(0x13c)]){const _0x299b00=_0x38e115['attribute']&&_0x38e115[_0x3aeda8(0x108)]!=='';_0x299b00&&!_0x38e115['filter']&&_0x2e8d3a[_0x3aeda8(0x10d)]({'level':'error','path':_0x5bb235+'.source','code':_0x3aeda8(0x13b),'message':'Behavior\x20source\x20\x27'+_0x38e115[_0x3aeda8(0x13c)]+'\x27\x20with\x20attribute\x20\x27'+_0x38e115[_0x3aeda8(0x108)]+'\x27\x20'+_0x3aeda8(0x11b)+_0x3aeda8(0x128)+_0x3aeda8(0x12e),'location':getLocationFromPath(_0xf60c5a[_0x3aeda8(0x11e)],_0xf60c5a['source'],pathToArray(_0x5bb235+_0x3aeda8(0x12f)))}),_0x299b00&&_0x38e115[_0x3aeda8(0x142)]&&_0x2e8d3a['push']({'level':'warning','path':_0x5bb235+_0x3aeda8(0x123),'code':_0x3aeda8(0x131),'message':'Attribute\x20\x27'+_0x38e115[_0x3aeda8(0x108)]+_0x3aeda8(0x130)+_0x3aeda8(0x143),'location':getLocationFromPath(_0xf60c5a['document'],_0xf60c5a[_0x3aeda8(0x13c)],pathToArray(_0x5bb235+_0x3aeda8(0x123)))});}}return _0x2e8d3a;}