@treasuredata/tdx 2026.7.0 → 2026.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) 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.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-move-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/table-deleted.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.d.ts +1 -0
  105. package/dist/sdk/client/http-client.d.ts.map +1 -1
  106. package/dist/sdk/client/http-client.js +1 -1
  107. package/dist/sdk/client/http-client.js.map +1 -1
  108. package/dist/sdk/client/llm-api-client.js +1 -1
  109. package/dist/sdk/client/oauth-refresh.js +1 -1
  110. package/dist/sdk/client/rate-limiter.js +1 -1
  111. package/dist/sdk/client/td-api-client.js +1 -1
  112. package/dist/sdk/client/trino-api-client.js +1 -1
  113. package/dist/sdk/client/workflow-client.js +1 -1
  114. package/dist/sdk/connection-validator.js +1 -1
  115. package/dist/sdk/connection.js +1 -1
  116. package/dist/sdk/delivery.js +1 -1
  117. package/dist/sdk/engage/campaign-pull.js +1 -1
  118. package/dist/sdk/engage/campaign-push.js +1 -1
  119. package/dist/sdk/engage/campaign-validator.js +1 -1
  120. package/dist/sdk/engage/campaign-yaml.js +1 -1
  121. package/dist/sdk/engage/template-pull.js +1 -1
  122. package/dist/sdk/engage/template-push.js +1 -1
  123. package/dist/sdk/engage/template-validator.js +1 -1
  124. package/dist/sdk/engage/template-yaml.js +1 -1
  125. package/dist/sdk/engage/types/campaign-def.js +1 -1
  126. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  127. package/dist/sdk/engage/types/template-schema.js +1 -1
  128. package/dist/sdk/engage.js +1 -1
  129. package/dist/sdk/errors.js +1 -1
  130. package/dist/sdk/index.js +1 -1
  131. package/dist/sdk/io/index.js +1 -1
  132. package/dist/sdk/io/node-filesystem.js +1 -1
  133. package/dist/sdk/job.js +1 -1
  134. package/dist/sdk/journey.js +1 -1
  135. package/dist/sdk/llm/chat-cache.js +1 -1
  136. package/dist/sdk/llm/index.js +1 -1
  137. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  138. package/dist/sdk/llm/model-factors.js +1 -1
  139. package/dist/sdk/llm/user-settings.js +1 -1
  140. package/dist/sdk/personalization.js +1 -1
  141. package/dist/sdk/policy.js +1 -1
  142. package/dist/sdk/query/deleted-table-validation.js +1 -1
  143. package/dist/sdk/query/index.js +1 -1
  144. package/dist/sdk/query/sql-parser.js +1 -1
  145. package/dist/sdk/realtime.js +1 -1
  146. package/dist/sdk/schedule.js +1 -1
  147. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/fields-display.js +1 -1
  149. package/dist/sdk/segment/file-discovery.js +1 -1
  150. package/dist/sdk/segment/journey-utils.js +1 -1
  151. package/dist/sdk/segment/journey-validator.js +1 -1
  152. package/dist/sdk/segment/journey-yaml.js +1 -1
  153. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  154. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  155. package/dist/sdk/segment/pull-workflow.js +1 -1
  156. package/dist/sdk/segment/push-recovery.js +1 -1
  157. package/dist/sdk/segment/push-workflow.js +1 -1
  158. package/dist/sdk/segment/resolution-context.js +1 -1
  159. package/dist/sdk/segment/segment-path-parser.js +1 -1
  160. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  161. package/dist/sdk/segment/segment-validator.js +1 -1
  162. package/dist/sdk/segment/target-resolution.js +1 -1
  163. package/dist/sdk/segment/tdx-config.js +1 -1
  164. package/dist/sdk/segment/types/activation-schema.js +1 -1
  165. package/dist/sdk/segment/types/journey-def.js +1 -1
  166. package/dist/sdk/segment/types/journey-schema.js +1 -1
  167. package/dist/sdk/segment/types/segment-def.js +1 -1
  168. package/dist/sdk/segment/types/segment-schema.js +1 -1
  169. package/dist/sdk/segment/validate-files.js +1 -1
  170. package/dist/sdk/segment/yaml-validator.js +1 -1
  171. package/dist/sdk/segment.js +1 -1
  172. package/dist/sdk/types/index.js +1 -1
  173. package/dist/sdk/types/progress.js +1 -1
  174. package/dist/sdk/types/workspace.js +1 -1
  175. package/dist/sdk/user.js +1 -1
  176. package/dist/sdk/util/format-detector.js +1 -1
  177. package/dist/sdk/util/formatters.js +1 -1
  178. package/dist/sdk/util/index.js +1 -1
  179. package/dist/sdk/util/paginate.js +1 -1
  180. package/dist/sdk/util/tree-formatter.js +1 -1
  181. package/dist/sdk/util/tree-search.js +1 -1
  182. package/dist/sdk/workflow/archive-validation.js +1 -1
  183. package/dist/sdk/workflow/clone-workflow.js +1 -1
  184. package/dist/sdk/workflow/index.js +1 -1
  185. package/dist/sdk/workflow/pull-workflow.js +1 -1
  186. package/dist/sdk/workflow/push-workflow.js +1 -1
  187. package/dist/sdk/workflow/task-graph.js +1 -1
  188. package/dist/sdk/workflow/tdx-config.js +1 -1
  189. package/dist/sdk/workflow/workflow-utils.js +1 -1
  190. package/dist/sdk/workspace/access-tracker.js +1 -1
  191. package/dist/sdk/workspace/frontmatter.js +1 -1
  192. package/dist/sdk/workspace/git.js +1 -1
  193. package/dist/sdk/workspace/index.js +1 -1
  194. package/dist/sdk/workspace/templates.js +1 -1
  195. package/dist/sdk/workspace/weekly.js +1 -1
  196. package/dist/sdk/workspace/wikilinks.js +1 -1
  197. package/dist/test-utils/command-runner.js +1 -1
  198. package/dist/test-utils/factories.js +1 -1
  199. package/dist/test-utils/fixtures.js +1 -1
  200. package/dist/test-utils/http-mock.js +1 -1
  201. package/dist/test-utils/index.js +1 -1
  202. package/dist/utils/async.js +1 -1
  203. package/dist/utils/colors.js +1 -1
  204. package/dist/utils/diff.js +1 -1
  205. package/dist/utils/file-permissions.js +1 -1
  206. package/dist/utils/file-reader.js +1 -1
  207. package/dist/utils/github-releases.js +1 -1
  208. package/dist/utils/global-cache.js +1 -1
  209. package/dist/utils/json-loader.js +1 -1
  210. package/dist/utils/local-cache.js +1 -1
  211. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  212. package/dist/utils/logger/formatters/index.js +1 -1
  213. package/dist/utils/logger/handlers/console-handler.js +1 -1
  214. package/dist/utils/logger/handlers/file-handler.js +1 -1
  215. package/dist/utils/logger/handlers/index.js +1 -1
  216. package/dist/utils/logger/handlers/null-handler.js +1 -1
  217. package/dist/utils/logger/index.js +1 -1
  218. package/dist/utils/logger/logger.js +1 -1
  219. package/dist/utils/logger/types.js +1 -1
  220. package/dist/utils/option-validation.js +1 -1
  221. package/dist/utils/process.js +1 -1
  222. package/dist/utils/prompt.js +1 -1
  223. package/dist/utils/spinner.js +1 -1
  224. package/dist/utils/sse-parser.js +1 -1
  225. package/dist/utils/string-utils.js +1 -1
  226. package/dist/utils/table-ref-parser.js +1 -1
  227. package/dist/utils/tdx-logger.js +1 -1
  228. package/dist/utils/version-check.js +1 -1
  229. package/package.json +1 -1
@@ -1 +1 @@
1
- const a156_0x16b6ef=a156_0x55ff;(function(_0x4c6ff8,_0x1d8e47){const _0x2f030d=a156_0x55ff,_0x521a99=_0x4c6ff8();while(!![]){try{const _0x44f01a=parseInt(_0x2f030d(0x120))/0x1+parseInt(_0x2f030d(0x20a))/0x2+-parseInt(_0x2f030d(0x200))/0x3*(-parseInt(_0x2f030d(0x1ac))/0x4)+parseInt(_0x2f030d(0x18b))/0x5+-parseInt(_0x2f030d(0x1b7))/0x6+parseInt(_0x2f030d(0x1a0))/0x7+parseInt(_0x2f030d(0x13a))/0x8;if(_0x44f01a===_0x1d8e47)break;else _0x521a99['push'](_0x521a99['shift']());}catch(_0xeb9ac){_0x521a99['push'](_0x521a99['shift']());}}}(a156_0xb34a,0xe2b51));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';function a156_0xb34a(){const _0x5762c1=['createdSegmentId','activation_deleted','columns','values','entries','withProgress','size','resolvedRule','skipSegments','create','waitStep','Condition','attributes','activationActions','getActivation','\x27\x20milestone','segmentByFolderAndName','logWarning','Segment\x20not\x20found','journey_creating','verbose','entry','debug','waitStepUnit','dirname','Creating\x20activation\x20\x27','getLatestJourneyId','\x27\x20decision\x20point\x20branch\x20\x27','existingActivation','WaitStep','journey_updated','deps','activation_template_id','update','journeys','getSegmentEntity','relative','stage\x20\x27','from','toISOString','uniqueSegmentName','SEGMENT_UPDATE_ERROR','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Created\x20journey\x20\x27','ACTIVATION_UPDATE_ERROR','rule','length','keys','results','../../utils/async.js','\x0a\x20\x20','Name\x20has\x20already\x20been\x20taken','activationStepsById','goal','fetchJourney','embedded_activation_creating','segmentFolderId','delete','Updated\x20activation\x20\x27','effectiveFolderId','parseDocument','errors','valid','\x27\x20from\x20file:\x20','relationships','Created\x20activation\x20\x27','deleted','activationContext','journeyName','rootFolderId','journey_created','\x27\x20exit\x20criteria','3175165sehRpf','existingSegments','conditionSegmentId','filter','\x20journey\x20from\x20file:\x20','Segment\x20not\x20found:\x20','journeyBundleName','action','journeyById','reduce','INTERNAL','name','folderPath','segment','utf-8','./child-segment-yaml.js','idToName','journeyId','getJourney','existingJourney','\x20activation\x20\x27','1479443rXgjnc','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','decision_point','idToEmailMap','embeddedSegmentNameToId','embedded_segment_created','find','segment_creating','Stage\x20\x27','steps','activation_updating','run_after_journey_refresh','12pIAotA','Delete\x20the\x20push\x20recovery\x20file\x20(','journeyActivationNameToId','folderId','journey','message','stringify','parse','all','parentSegmentFolder','behavior','9998316IlPiRf','updated','SEGMENT_NOT_FOUND','Deleting\x20activation\x20\x27','__pending_','description','Fetching\x20','connector_config','sha1','max','Matched\x20server\x20segment\x20\x27','deleteSegment','item','add','match','updateActivation','set','journeyStages','conditionTimeoutDuration','progress','Activation','has','yamlConfig','activation_updated','state','connectionIdToNameMap','./journey-yaml.js','journey_entry_criteria_','\x27\x20for\x20','replace','conditionTimeoutUnit','toLowerCase','type','logInfo','segmentId','embedded_segment_creating','connection','\x20(referenced\x20in\x20journey\x20','yamlActivation','):\x20','segmentNameToId','toString','buildUserMaps','resolveSegment','listActivations','branches','slice','localName','conditions',').\x20','versionNumber','split','\x27\x20wait\x20condition','activation_','digest','diff','entry_criteria','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','exitCriterias','startsWith',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','\x20error(s)','JOURNEY_UPDATE_ERROR','includes','waitStepType','\x27\x20not\x20found\x20in\x20journey\x20\x27','SEGMENT_SYNTAX_ERROR','Journey\x20\x27','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','hex','journeyActivationStepId','isNew','\x27...','99219ptakDb','with','Entry\x20criteria:\x20','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','trim','\x20segment\x20from\x20file:\x20','object','validatedRequest','join','updateSegmentById','1294674ZQZFFN','sort','parentId','logDeleted','segment_updating','segments','deleteActivation','schedule','notification','journey_updating','Failed\x20to\x20','Duration','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','hasChanges','logSuccess','entryCriteria','list','activations','folder','index','milestone','all_columns','segment_created','\x27\x20entry\x20criteria','getSegmentEntity\x20also\x20failed\x20for\x20','kind','onProgress','\x27\x20by\x20rule\x20content','get','existingSegment','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','folderPathToId','18152kHxkfG','activation_deleting','getSegment\x20failed\x20for\x20','data','getSegment','nameToId','journeyBundlesByFolderAndName','Failed\x20to\x20fetch\x20referenced\x20segment\x20','draft','Created\x20segment\x20\x27','__pending_act_','push','embedded_activation_created','JOURNEY_SYNTAX_ERROR','stages','Deleted\x20segment\x20\x27','Updated\x20journey\x20\x27','user','NOT_FOUND','Failed\x20to\x20resolve\x20activation\x20','some','activationParams','map','tdx.sdk.push-workflow','unchanged','uniqueServerName','7871112iQLkNb','Updating\x20segment\x20\x27','absolutePath','journeyBundleId','day','createFolder','created','Updating\x20activation\x20\x27','and\x20the\x20server\x20segment,\x20then\x20retry.'];a156_0xb34a=function(){return _0x5762c1;};return a156_0xb34a();}const logger=Logger['of'](a156_0x16b6ef(0x137));export const PENDING_SEGMENT_PREFIX=a156_0x16b6ef(0x1bb);export const PENDING_ACTIVATION_PREFIX=a156_0x16b6ef(0x12a);export function createPendingSegmentId(_0xc69c16){return''+PENDING_SEGMENT_PREFIX+_0xc69c16+'__';}export function isPendingSegmentId(_0x1aa4c0){const _0x1d95f9=a156_0x16b6ef;return _0x1aa4c0['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x1aa4c0[_0x1d95f9(0x1f2)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5eac2c){const _0x5f375c=a156_0x16b6ef;return _0x5eac2c[_0x5f375c(0x1d4)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x53813f){return''+PENDING_ACTIVATION_PREFIX+_0x53813f+'__';}export function isPendingActivationId(_0x2b6385){const _0x2a0497=a156_0x16b6ef;return _0x2b6385[_0x2a0497(0x1f2)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1dea30){const _0x2ea5d6=a156_0x16b6ef;return _0x1dea30[_0x2ea5d6(0x1d4)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1c12f9,_0x3743d2){const _0x183665=a156_0x16b6ef,_0x49347f=_0x1c12f9+'::'+(_0x3743d2[_0x183665(0x204)]()||_0x183665(0x198)),_0x154bbe=createHash(_0x183665(0x1bf))['update'](_0x49347f)[_0x183665(0x1ed)](_0x183665(0x1fc))[_0x183665(0x1e5)](0x0,0xc);return _0x183665(0x1d2)+_0x154bbe;}export function ensureJourneyDefaults(_0x4ffc5e){const _0x415b75=a156_0x16b6ef;!_0x4ffc5e[_0x415b75(0x1bc)]&&(_0x4ffc5e['description']=''),!_0x4ffc5e['state']&&(_0x4ffc5e[_0x415b75(0x1cf)]=_0x415b75(0x128));}export function injectExistingStageIds(_0x32d696,_0x12d363){const _0x4fab08=a156_0x16b6ef,_0x23d537=new Map(_0x12d363[_0x4fab08(0x136)](_0x4a3b4c=>[_0x4a3b4c[_0x4fab08(0x196)],_0x4a3b4c['id']]));for(const _0x453634 of _0x32d696){if(!_0x453634['id']){const _0x3e415b=_0x23d537[_0x4fab08(0x11c)](_0x453634['name']);_0x3e415b&&(_0x453634['id']=_0x3e415b);}}}export function resolveTDFolderPath(_0x5be794,_0x3fcd04,_0xd8afc8){const _0xaf2e51=a156_0x16b6ef;if(!_0x3fcd04)return _0x5be794;if(_0x5be794===_0xd8afc8||_0x5be794[_0xaf2e51(0x1f2)](_0xd8afc8+'/'))return _0x5be794;return _0x5be794?_0xd8afc8+'/'+_0x5be794:_0xd8afc8;}export function addFoldersToCreate(_0x1ea2c4,_0x17cc47,_0x38fc7d){const _0x5c35ac=a156_0x16b6ef;if(!_0x1ea2c4)return;if(_0x17cc47[_0x5c35ac(0x1cc)](_0x1ea2c4))return;const _0x5a7ea3=_0x1ea2c4[_0x5c35ac(0x1ea)]('/');let _0xd92c57='';for(const _0x332695 of _0x5a7ea3){_0xd92c57=_0xd92c57?_0xd92c57+'/'+_0x332695:_0x332695,!_0x17cc47['has'](_0xd92c57)&&_0x38fc7d['add'](_0xd92c57);}}export function sortFoldersByDepth(_0x3b35e3){return[..._0x3b35e3]['sort']((_0x4ab743,_0x4ddbf0)=>{const _0x563a30=a156_0x55ff,_0x26ea1d=(_0x4ab743[_0x563a30(0x1c5)](/\//g)||[])['length'],_0x4c0b05=(_0x4ddbf0[_0x563a30(0x1c5)](/\//g)||[])[_0x563a30(0x171)];return _0x26ea1d-_0x4c0b05;});}import*as a156_0x2aea44 from'yaml';import{readFileSync}from'fs';import a156_0x5cc7de from'path';import{isJourneyDef,parseYamlString as a156_0x18dca3,toYamlString as a156_0x1c9c49,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(_0x4bba0f){const _0x3a3c32=a156_0x16b6ef;if(Array['isArray'](_0x4bba0f))return'['+_0x4bba0f[_0x3a3c32(0x136)](_0x56dd36=>stableStringify(_0x56dd36))[_0x3a3c32(0x208)](',')+']';if(_0x4bba0f&&typeof _0x4bba0f===_0x3a3c32(0x206)){const _0x13d94e=_0x4bba0f,_0xe6c590=Object[_0x3a3c32(0x172)](_0x13d94e)[_0x3a3c32(0x20b)](),_0x326e39=_0xe6c590[_0x3a3c32(0x136)](_0x400ce2=>'\x22'+_0x400ce2+'\x22:'+stableStringify(_0x13d94e[_0x400ce2]));return'{'+_0x326e39[_0x3a3c32(0x208)](',')+'}';}const _0x1bbdc3=JSON['stringify'](_0x4bba0f);return _0x1bbdc3===undefined?'null':_0x1bbdc3;}function activationSignature(_0x2704e3){const _0x387b04=a156_0x16b6ef,_0x169464={'connection':_0x2704e3['connection'],..._0x2704e3[_0x387b04(0x115)]!==undefined&&{'all_columns':_0x2704e3[_0x387b04(0x115)]},..._0x2704e3['columns']!==undefined&&{'columns':_0x2704e3[_0x387b04(0x145)]},..._0x2704e3[_0x387b04(0x1b6)]!==undefined&&{'behavior':_0x2704e3[_0x387b04(0x1b6)]},..._0x2704e3[_0x387b04(0x211)]!==undefined&&{'schedule':_0x2704e3[_0x387b04(0x211)]},..._0x2704e3['notification']!==undefined&&{'notification':_0x2704e3[_0x387b04(0x212)]},..._0x2704e3['connector_config']!==undefined&&{'connector_config':_0x2704e3[_0x387b04(0x1be)]},..._0x2704e3[_0x387b04(0x163)]!==undefined&&{'activation_template_id':_0x2704e3['activation_template_id']}};return stableStringify(_0x169464);}async function fetchSegment(_0x3a8987,_0xd83635,_0x50a618,_0x295d86){const _0x5d8788=a156_0x16b6ef,_0x387e82=_0x295d86?.[_0x5d8788(0x1a6)](_0x531824=>_0x531824['id']===_0x50a618);if(_0x387e82)return _0x387e82;try{return await _0x3a8987[_0x5d8788(0x198)][_0x5d8788(0x124)](_0xd83635,_0x50a618);}catch(_0x49af23){logger['debug'](_0x5d8788(0x122)+_0x50a618+_0x5d8788(0x1f3)+_0x49af23);try{return await _0x3a8987[_0x5d8788(0x198)][_0x5d8788(0x166)](_0x50a618);}catch(_0x202ae3){return logger[_0x5d8788(0x159)](_0x5d8788(0x118)+_0x50a618+':\x20'+_0x202ae3),null;}}}function recoverSegmentIdsFromPushRecovery(_0x6e9db0,_0x450e11,_0x52b403){const _0x26b4c6=a156_0x16b6ef,_0x495662=readPushRecovery(_0x6e9db0[_0x26b4c6(0x13c)]);if(_0x495662?.['journeyName']===_0x6e9db0['yamlConfig'][_0x26b4c6(0x196)])for(const [_0x16aee9,_0x218a5f]of Object['entries'](_0x495662[_0x26b4c6(0x20f)])){const _0x3088d1=generateDeterministicJourneySegmentName(_0x6e9db0[_0x26b4c6(0x1cd)][_0x26b4c6(0x196)],_0x16aee9);_0x218a5f[_0x26b4c6(0x139)]===_0x3088d1&&(_0x450e11[_0x26b4c6(0x1c7)](_0x16aee9,_0x218a5f[_0x26b4c6(0x1d9)]),_0x52b403[_0x26b4c6(0x1c7)](_0x16aee9,_0x218a5f[_0x26b4c6(0x1d9)]));}}async function createOrRecoverEmbeddedSegment(_0x3da4cc,_0xc1e78b,_0x5d77c7,_0x2a2531){const _0x41f912=a156_0x16b6ef;let _0x1173a9;try{_0x1173a9=await _0x3da4cc[_0x41f912(0x198)]['createJourneySegment']({'name':_0x5d77c7['uniqueSegmentName'],'description':_0x5d77c7[_0x41f912(0x1bc)],'journeyId':_0x5d77c7[_0x41f912(0x19c)],'rule':_0x2a2531(_0x5d77c7['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x5d77c7[_0x41f912(0x1af)],'audienceId':_0x5d77c7[_0x41f912(0x20c)]});}catch(_0x408576){const _0x568da7=_0x408576 instanceof Error&&_0x408576[_0x41f912(0x1b1)][_0x41f912(0x1f6)](_0x41f912(0x176));if(_0x568da7){const _0x42177b=readPushRecovery(_0xc1e78b[_0x41f912(0x13c)]),_0x35e047=_0x42177b?.[_0x41f912(0x187)]===_0xc1e78b['yamlConfig'][_0x41f912(0x196)]?_0x42177b[_0x41f912(0x20f)][_0x5d77c7[_0x41f912(0x1e6)]]:undefined;if(_0x35e047?.[_0x41f912(0x139)]===_0x5d77c7['uniqueSegmentName'])await _0x3da4cc[_0x41f912(0x198)][_0x41f912(0x209)](_0x5d77c7[_0x41f912(0x20c)],_0x35e047[_0x41f912(0x1d9)],{'description':_0x5d77c7['description'],'rule':_0x2a2531(_0x5d77c7[_0x41f912(0x14a)],!![]),'countPopulation':!![]}),_0x1173a9=_0x35e047[_0x41f912(0x1d9)];else throw new SDKError(ErrorCode[_0x41f912(0x16c)],'Embedded\x20segment\x20\x27'+_0x5d77c7[_0x41f912(0x1e6)]+_0x41f912(0x203)+(_0x41f912(0x1ad)+_0xc1e78b[_0x41f912(0x13c)]['replace'](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x41f912(0x142),_0x408576);}else throw _0x408576;}return saveSegmentToPushRecovery(_0xc1e78b['absolutePath'],_0xc1e78b[_0x41f912(0x1cd)][_0x41f912(0x196)],_0x5d77c7[_0x41f912(0x1e6)],{'segmentId':_0x1173a9,'uniqueServerName':_0x5d77c7[_0x41f912(0x16b)],'createdAt':new Date()[_0x41f912(0x16a)]()}),_0x1173a9;}export async function prepareSegmentFiles(_0x3bd8b1,_0x42eff5,_0x35231c,_0x5e9665,_0x5b9acd){const _0x44f60=a156_0x16b6ef,{activationDefToCreateRequest:_0x1059a6}=await import('./child-segment-yaml.js'),_0x2c192e=[],_0x4c125e=new Set();for(const {yamlConfig:_0x4302b0,folderPath:_0x52d2c8,sourcePath:_0x17891a}of _0x3bd8b1){const _0x4dce4e=resolveTDFolderPath(_0x52d2c8,_0x5e9665,_0x5b9acd),_0x1f514c=_0x4dce4e+':'+_0x4302b0['name'],_0x44b365=_0x42eff5[_0x44f60(0x153)]['get'](_0x1f514c),_0x138072=_0x44b365?_0x42eff5['activationsBySegmentId'][_0x44f60(0x11c)](_0x44b365['id'])||[]:[];addFoldersToCreate(_0x4dce4e,_0x42eff5[_0x44f60(0x11f)],_0x4c125e);const _0x2ba8cc=calculateActivationActions(_0x4302b0['activations']||[],_0x138072,_0x42eff5[_0x44f60(0x1a3)],_0x42eff5['connectionIdToNameMap']);for(const _0xd4427 of _0x2ba8cc){(_0xd4427['type']===_0x44f60(0x14c)||_0xd4427['type']===_0x44f60(0x164))&&_0xd4427[_0x44f60(0x1dd)]&&(_0xd4427[_0x44f60(0x207)]=await _0x1059a6(_0xd4427[_0x44f60(0x1dd)],_0x35231c));}const _0x3818c5=calculateSegmentDiff(_0x4302b0,_0x44b365,_0x138072,_0x42eff5[_0x44f60(0x1a3)],_0x42eff5[_0x44f60(0x1d0)]);_0x2c192e[_0x44f60(0x12b)]({'relativePath':_0x4302b0[_0x44f60(0x196)],'absolutePath':_0x17891a,'yamlConfig':_0x4302b0,'folderPath':_0x4dce4e,'existingSegment':_0x44b365,'existingActivations':_0x138072,'isNew':_0x3818c5[_0x44f60(0x1fe)],'hasChanges':_0x3818c5[_0x44f60(0x10d)],'diff':_0x3818c5[_0x44f60(0x1ee)],'activationActions':_0x2ba8cc});}return{'segmentFiles':_0x2c192e,'foldersToCreate':_0x4c125e};}export async function prepareJourneyFiles(_0x40467b,_0x2353ba,_0x282382,_0x1395b4){const _0x2a195d=a156_0x16b6ef,_0x1e886b=[],_0x5babff=new Set();for(const {yamlConfig:_0x7ef2e8,folderPath:_0x13ee04,sourcePath:_0x5d0f66}of _0x40467b){const _0x41d620=resolveTDFolderPath(_0x13ee04,_0x282382,_0x1395b4),_0x3fd9c2=_0x41d620+':'+_0x7ef2e8[_0x2a195d(0x196)],_0x2701fe=_0x2353ba[_0x2a195d(0x126)][_0x2a195d(0x11c)](_0x3fd9c2);let _0x35e47e,_0x183821;if(_0x2701fe&&_0x2701fe[_0x2a195d(0x171)]>0x0){const _0x11528e=buildLocalExpandedRuleMappings(_0x7ef2e8),{createYamlContext:_0x3974f6,prefetchJourneySegments:_0x3f5640}=createPushYamlContextForBundle(_0x2353ba[_0x2a195d(0x162)],_0x2353ba['parentId'],_0x2353ba[_0x2a195d(0x18c)],_0x11528e,_0x2353ba[_0x2a195d(0x1a3)],_0x2353ba[_0x2a195d(0x1d0)],_0x2353ba[_0x2a195d(0x177)],_0x2353ba[_0x2a195d(0x193)]);await _0x3f5640(_0x2701fe[_0x2a195d(0x136)](_0xe370ed=>_0xe370ed['id']));const _0x441a71=await _0x2353ba[_0x2a195d(0x162)][_0x2a195d(0x1b0)][_0x2a195d(0x15d)](_0x2701fe[0x0][_0x2a195d(0x13d)]),_0x2ccee7=hasMultipleVersions(_0x7ef2e8),_0x3b2d40=async _0x22b75b=>{const _0x4c7c92=_0x2a195d,_0x26e18e=_0x2353ba[_0x4c7c92(0x193)]?.[_0x4c7c92(0x11c)](_0x22b75b);if(_0x26e18e)return _0x26e18e;return _0x2353ba[_0x4c7c92(0x179)]({'journeyId':_0x22b75b,'journeyName':_0x7ef2e8[_0x4c7c92(0x196)],'isMultiVersion':_0x2701fe[_0x4c7c92(0x171)]>0x1});};if(_0x2ccee7&&_0x2701fe['length']>0x1){const _0x32645f=[];for(const _0x245f09 of _0x2701fe){const _0x17d197=_0x245f09[_0x2a195d(0x1e9)]||0x1;_0x2353ba[_0x2a195d(0x1ca)]?.[_0x2a195d(0x164)](_0x2a195d(0x1bd)+_0x7ef2e8[_0x2a195d(0x196)]+'\x20v'+_0x17d197);const _0x59af5a=await _0x3b2d40(_0x245f09['id']),_0x324131=_0x3974f6(_0x245f09['id']),_0x753f1a=await journeyResponseToDef(_0x59af5a,_0x324131);_0x32645f[_0x2a195d(0x12b)]({'item':_0x245f09,'yaml':_0x753f1a});}const _0x411239=buildLocalRuleToNameMappingFromJourney(_0x7ef2e8);_0x183821=buildMergedJourneyDef(_0x32645f,_0x411239,_0x441a71);const _0x19f8d6=Math[_0x2a195d(0x1c0)](..._0x32645f[_0x2a195d(0x136)](_0x33c344=>_0x33c344[_0x2a195d(0x1c3)][_0x2a195d(0x1e9)]||0x0)),_0x1057b5=_0x2701fe[_0x2a195d(0x1a6)](_0x347c45=>(_0x347c45[_0x2a195d(0x1e9)]||0x0)===_0x19f8d6);_0x1057b5&&(_0x2353ba[_0x2a195d(0x1ca)]?.[_0x2a195d(0x164)](_0x2a195d(0x1bd)+_0x7ef2e8[_0x2a195d(0x196)]+'\x20v'+_0x19f8d6),_0x35e47e=await _0x3b2d40(_0x1057b5['id']));}else{const _0x37d63b=_0x2701fe[_0x2701fe[_0x2a195d(0x171)]-0x1];_0x2353ba[_0x2a195d(0x1ca)]?.['update'](_0x2a195d(0x1bd)+_0x7ef2e8[_0x2a195d(0x196)]),_0x35e47e=await _0x3b2d40(_0x37d63b['id']);const _0x55a591=_0x3974f6(_0x37d63b['id']),_0x1e6f36=await journeyResponseToDef(_0x35e47e,_0x55a591),_0x1b28bd=buildLocalRuleToNameMappingFromJourney(_0x7ef2e8);_0x183821=buildMergedJourneyDef([{'item':_0x37d63b,'yaml':_0x1e6f36}],_0x1b28bd,_0x441a71);}}addFoldersToCreate(_0x41d620,_0x2353ba[_0x2a195d(0x11f)],_0x5babff);const _0x3f75aa=calculateJourneyDiff(_0x7ef2e8,_0x183821);_0x1e886b[_0x2a195d(0x12b)]({'relativePath':_0x7ef2e8[_0x2a195d(0x196)],'absolutePath':_0x5d0f66,'yamlConfig':_0x7ef2e8,'folderPath':_0x41d620,'existingJourney':_0x35e47e,'isNew':_0x3f75aa[_0x2a195d(0x1fe)],'hasChanges':_0x3f75aa[_0x2a195d(0x10d)],'diff':_0x3f75aa[_0x2a195d(0x1ee)]});}return{'journeyFiles':_0x1e886b,'foldersToCreate':_0x5babff};}export function calculateActivationActions(_0xdfb5c9,_0x5bdb05,_0x287497,_0x30b0e2){const _0x119bd2=a156_0x16b6ef,_0xbc6125=[],_0x2ef70f=new Map();for(const _0x217dd9 of _0x5bdb05){_0x2ef70f['set'](_0x217dd9[_0x119bd2(0x196)],_0x217dd9);}const _0x166564=new Map();for(const _0x54b330 of _0xdfb5c9){_0x166564[_0x119bd2(0x1c7)](_0x54b330[_0x119bd2(0x196)],_0x54b330);}for(const _0x24e526 of _0xdfb5c9){const _0xf0a139=_0x2ef70f['get'](_0x24e526[_0x119bd2(0x196)]);if(!_0xf0a139)_0xbc6125[_0x119bd2(0x12b)]({'type':_0x119bd2(0x14c),'name':_0x24e526[_0x119bd2(0x196)],'yamlActivation':_0x24e526});else{const _0x48115c=activationResponseToDef(_0xf0a139,_0x287497,_0x30b0e2),_0x1c0907=a156_0x2aea44['stringify'](_0x48115c),_0x3ed728=a156_0x2aea44[_0x119bd2(0x1b2)](_0x24e526);_0x1c0907!==_0x3ed728&&_0xbc6125['push']({'type':_0x119bd2(0x164),'name':_0x24e526[_0x119bd2(0x196)],'yamlActivation':_0x24e526,'existingActivation':_0xf0a139});}}for(const _0x2fe6b9 of _0x5bdb05){!_0x166564[_0x119bd2(0x1cc)](_0x2fe6b9[_0x119bd2(0x196)])&&_0xbc6125[_0x119bd2(0x12b)]({'type':_0x119bd2(0x17c),'name':_0x2fe6b9[_0x119bd2(0x196)],'existingActivation':_0x2fe6b9});}return _0xbc6125;}function calculateYamlDiff(_0x25fdc3,_0x35dacf){if(_0x35dacf){const _0x5a9150=generateDiff(_0x35dacf,_0x25fdc3),_0x471c67=hasChanges(_0x5a9150);return{'isNew':![],'hasChanges':_0x471c67,'diff':_0x471c67?formatDiffWithColors(_0x5a9150):undefined};}const _0x2bb7e9=generateDiff('',_0x25fdc3);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x2bb7e9)};}export function calculateSegmentDiff(_0x36e87d,_0x4abe68,_0x4589f6,_0x1cbfc2,_0x4ff72d){const _0x43108f=segmentToYamlString(_0x36e87d),_0x39a6c5=_0x4abe68?segmentToYamlString(segmentWithActivationsToYaml(_0x4abe68,_0x4589f6,undefined,_0x1cbfc2,_0x4ff72d)):undefined;return calculateYamlDiff(_0x43108f,_0x39a6c5);}export function calculateJourneyDiff(_0x4ad55c,_0x26a1f3){const _0x2a6784=normalizeJourneyDef(_0x4ad55c,_0x4ad55c),_0x15a82a=a156_0x1c9c49(_0x2a6784),_0x231642=_0x26a1f3?a156_0x1c9c49(normalizeJourneyDef(_0x26a1f3,_0x4ad55c)):undefined;return calculateYamlDiff(_0x15a82a,_0x231642);}export function findSegmentsToDelete(_0x925960,_0x4814c9,_0x53e509,_0x1e6373,_0x42ba60){const _0x5dfb14=a156_0x16b6ef,_0x25c891=new Set();for(const {yamlConfig:_0x1e1390,folderPath:_0x42f792}of _0x4814c9){_0x25c891[_0x5dfb14(0x1c4)](_0x42f792+':'+_0x1e1390['name']);}return _0x925960[_0x5dfb14(0x18e)](_0x1585fa=>{const _0xd7a186=_0x5dfb14,_0x192aa9=_0x1585fa[_0xd7a186(0x17b)]?_0x53e509['get'](_0x1585fa[_0xd7a186(0x17b)][_0xd7a186(0x1e0)]())||'':'',_0x284abb=_0x192aa9+':'+_0x1585fa[_0xd7a186(0x196)];if(_0x25c891[_0xd7a186(0x1cc)](_0x284abb))return![];if(_0x42ba60)return _0x192aa9===_0x1e6373||_0x192aa9[_0xd7a186(0x1f2)](_0x1e6373+'/');return!![];});}export function findJourneysToDelete(_0x1b5d39,_0x233a22,_0x3c8217,_0x5bd259,_0x38cf78){const _0xb38cae=a156_0x16b6ef,_0x22078e=new Set();for(const {yamlConfig:_0x43994e,folderPath:_0x35983e}of _0x233a22){_0x22078e['add'](_0x35983e+':'+_0x43994e[_0xb38cae(0x196)]);}return _0x1b5d39[_0xb38cae(0x18e)](_0x46fb31=>{const _0x2396f0=_0xb38cae,_0x5b7369=_0x46fb31[_0x2396f0(0x1af)]?_0x3c8217[_0x2396f0(0x11c)](_0x46fb31[_0x2396f0(0x1af)])||'':'',_0x423c74=_0x5b7369+':'+_0x46fb31['journeyBundleName'];if(_0x22078e[_0x2396f0(0x1cc)](_0x423c74))return![];if(_0x38cf78)return _0x5b7369===_0x5bd259||_0x5b7369[_0x2396f0(0x1f2)](_0x5bd259+'/');return!![];});}export function buildSegmentLookupMap(_0x128002,_0xb6460c){const _0xeecf1=a156_0x16b6ef,_0x3c8959=new Map();for(const _0x68beb2 of _0x128002){const _0x3c0cc9=_0x68beb2[_0xeecf1(0x17b)]?_0xb6460c[_0xeecf1(0x11c)](_0x68beb2[_0xeecf1(0x17b)]['toString']())||'':'',_0x2e8d7e=_0x3c0cc9+':'+_0x68beb2['name'];_0x3c8959[_0xeecf1(0x1c7)](_0x2e8d7e,_0x68beb2);}return _0x3c8959;}export function buildSegmentNameToIdMap(_0x527285){const _0x20ee54=a156_0x16b6ef,_0x3fb582=new Map();for(const _0x559491 of _0x527285){_0x3fb582['set'](_0x559491[_0x20ee54(0x196)],_0x559491['id']);}return _0x3fb582;}export function buildJourneyBundleLookupMap(_0x48c8a9,_0x5dc9f6){const _0x5d48d2=a156_0x16b6ef,_0x1511e5=new Map();for(const _0x8b4e16 of _0x48c8a9){const _0x2f9306=_0x8b4e16['folderId']?_0x5dc9f6['get'](_0x8b4e16[_0x5d48d2(0x1af)])||'':'',_0x1a1b9c=_0x2f9306+':'+_0x8b4e16[_0x5d48d2(0x191)];!_0x1511e5[_0x5d48d2(0x1cc)](_0x1a1b9c)&&_0x1511e5['set'](_0x1a1b9c,[]),_0x1511e5[_0x5d48d2(0x11c)](_0x1a1b9c)[_0x5d48d2(0x12b)](_0x8b4e16);}for(const _0x5a86d9 of _0x1511e5[_0x5d48d2(0x146)]()){_0x5a86d9[_0x5d48d2(0x20b)]((_0x4e7f7f,_0x245006)=>(_0x4e7f7f[_0x5d48d2(0x1e9)]||0x0)-(_0x245006[_0x5d48d2(0x1e9)]||0x0));}return _0x1511e5;}export function collectFoldersToCreate(_0xdbbea2,_0x12301d){const _0x960626=a156_0x16b6ef,_0x24deaf=new Set();for(const _0x439644 of _0xdbbea2){if(!_0x439644)continue;if(_0x12301d['has'](_0x439644))continue;const _0x4a364f=_0x439644[_0x960626(0x1ea)]('/');let _0x265a81='';for(const _0x26204f of _0x4a364f){_0x265a81=_0x265a81?_0x265a81+'/'+_0x26204f:_0x26204f,!_0x12301d[_0x960626(0x1cc)](_0x265a81)&&_0x24deaf[_0x960626(0x1c4)](_0x265a81);}}return _0x24deaf;}function a156_0x55ff(_0x2aeb33,_0x3f5963){_0x2aeb33=_0x2aeb33-0x10a;const _0xb34ab9=a156_0xb34a();let _0x55ff96=_0xb34ab9[_0x2aeb33];return _0x55ff96;}export function parseAndClassifyYamlFiles(_0x4e8491,_0x22825c,_0x20d3f3){const _0x1c40b6=a156_0x16b6ef,_0x23edb9=[],_0x18a18b=[];for(const _0x5c1efd of _0x4e8491){const _0x3292d0=a156_0x5cc7de[_0x1c40b6(0x167)](_0x22825c,a156_0x5cc7de[_0x1c40b6(0x15b)](_0x5c1efd)),_0xd9e3dd=_0x3292d0==='.'?'':_0x3292d0[_0x1c40b6(0x1d4)](/\\/g,'/'),_0x1ee759=readFileSync(_0x5c1efd,_0x1c40b6(0x199)),_0x3a61e6=a156_0x2aea44['parse'](_0x1ee759);if(isJourneyDef(_0x3a61e6,_0x5c1efd)){const _0x3691bd=a156_0x18dca3(_0x1ee759);_0x18a18b[_0x1c40b6(0x12b)]({'yamlConfig':_0x3691bd,'folderPath':_0xd9e3dd,'sourcePath':_0x5c1efd});}else{if(!_0x20d3f3?.[_0x1c40b6(0x14b)]){const _0x217068=parseSegmentYamlFile(_0x1ee759),_0x956660=normalizeChildSegmentYaml(_0x217068);_0x23edb9['push']({'yamlConfig':_0x956660,'folderPath':_0xd9e3dd,'sourcePath':_0x5c1efd});}}}return{'segments':_0x23edb9,'journeys':_0x18a18b};}export function validateParsedFiles(_0x4124aa,_0x3b9cd5){const _0x510c91=a156_0x16b6ef,_0x1c8056=[];for(const {yamlConfig:_0x18fbf3,sourcePath:_0x34680f}of _0x4124aa[_0x510c91(0x20f)]){const _0x3c88ce=readFileSync(_0x34680f,'utf-8'),_0x20133a=a156_0x2aea44[_0x510c91(0x17f)](_0x3c88ce),_0x4f2347=validateSegmentDef(_0x18fbf3,{'source':_0x3c88ce,'document':_0x20133a},{'skipSchema':!![]});if(!_0x4f2347[_0x510c91(0x181)]){const _0x4c51e8=a156_0x5cc7de[_0x510c91(0x167)](_0x3b9cd5,_0x34680f);_0x1c8056[_0x510c91(0x12b)]({'filePath':_0x4c51e8,'source':_0x3c88ce,'result':_0x4f2347,'isJourney':![]});}}for(const {yamlConfig:_0x4e323b,sourcePath:_0x206e45}of _0x4124aa[_0x510c91(0x165)]){const _0x2a9e6f=readFileSync(_0x206e45,_0x510c91(0x199)),_0x1ebbb3=a156_0x2aea44[_0x510c91(0x17f)](_0x2a9e6f),_0x4aa7fc=validateJourneyDef(_0x4e323b,{'source':_0x2a9e6f,'document':_0x1ebbb3},{'skipSchema':!![]});if(!_0x4aa7fc[_0x510c91(0x181)]){const _0x17001e=a156_0x5cc7de[_0x510c91(0x167)](_0x3b9cd5,_0x206e45);_0x1c8056['push']({'filePath':_0x17001e,'source':_0x2a9e6f,'result':_0x4aa7fc,'isJourney':!![]});}}return _0x1c8056;}export function formatValidationErrors(_0x37aa0a){const _0x5f46c5=a156_0x16b6ef,_0xd2a44c=[];for(const {filePath:_0x17ab33,source:_0x4008ef,result:_0x5898b8,isJourney:_0x4e137f}of _0x37aa0a){const _0x2e9fe9=_0x4e137f?'journey':_0x5f46c5(0x198);_0xd2a44c[_0x5f46c5(0x12b)]('\x0a'+_0x17ab33+'\x20('+_0x2e9fe9+_0x5f46c5(0x1de)+_0x5898b8[_0x5f46c5(0x180)][_0x5f46c5(0x171)]+_0x5f46c5(0x1f4)),_0xd2a44c[_0x5f46c5(0x12b)](formatValidationResult(_0x5898b8,_0x4008ef,_0x17ab33));}return _0xd2a44c['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x549752){const _0x392da3=a156_0x16b6ef,_0x303c29=new Set(),_0x209652=new Map(),_0x47e61b=collectSegmentUsageCounts(_0x549752);if(_0x549752[_0x392da3(0x20f)])for(const [_0x7ea591,_0x18b234]of Object[_0x392da3(0x147)](_0x549752['segments'])){_0x303c29['add'](_0x7ea591);if(_0x18b234[_0x392da3(0x170)]){const _0x5c9966=yamlRuleToApi(_0x18b234[_0x392da3(0x170)]),_0x3024c8=apiRuleToYaml(_0x5c9966);_0x209652[_0x392da3(0x1c7)](_0x7ea591,_0x3024c8);}}const _0x2190e4=new Map();let _0x50749c=0x0;for(const [_0x336ae7,_0x5f0b01]of _0x209652){const _0x1cba34=serializeExpandedRule(_0x5f0b01,_0x209652),_0x3d0fb2=_0x2190e4[_0x392da3(0x11c)](_0x1cba34)||[];_0x3d0fb2['push']({'name':_0x336ae7,'index':_0x50749c}),_0x2190e4[_0x392da3(0x1c7)](_0x1cba34,_0x3d0fb2),_0x50749c++;}const _0x26b2db=new Map();for(const [_0x31d778,_0x22af2e]of _0x2190e4){const _0x333cb5=_0x22af2e[_0x392da3(0x1e5)]()[_0x392da3(0x20b)]((_0x2d1bfe,_0x5432b0)=>{const _0x51adcb=_0x392da3,_0x3037dc=_0x47e61b[_0x51adcb(0x11c)](_0x2d1bfe[_0x51adcb(0x196)])||0x0,_0x123d90=_0x47e61b['get'](_0x5432b0[_0x51adcb(0x196)])||0x0;if(_0x3037dc!==_0x123d90)return _0x123d90-_0x3037dc;return _0x2d1bfe[_0x51adcb(0x113)]-_0x5432b0['index'];})[_0x392da3(0x136)](_0x20904a=>_0x20904a[_0x392da3(0x196)]),_0x4dc590=[];for(const _0xf6b8a3 of _0x333cb5){const _0x13f366=_0x47e61b[_0x392da3(0x11c)](_0xf6b8a3)||0x0,_0x41042e=Math[_0x392da3(0x1c0)](_0x13f366,0x1);for(let _0x41636f=0x0;_0x41636f<_0x41042e;_0x41636f++){_0x4dc590[_0x392da3(0x12b)](_0xf6b8a3);}}_0x26b2db[_0x392da3(0x1c7)](_0x31d778,_0x4dc590);}return{'existingLocalSegmentNames':_0x303c29,'localSegmentRules':_0x209652,'localExpandedRuleToNames':_0x26b2db};}export function createSegmentIdResolver(_0x56b4a1,_0x265bfc){return async _0x3bb9c2=>{const _0x164c68=a156_0x55ff,_0x1b3537=_0x56b4a1[_0x164c68(0x11c)](_0x3bb9c2);if(!_0x1b3537)throw new SDKError(ErrorCode[_0x164c68(0x1b9)],_0x164c68(0x190)+_0x3bb9c2+_0x164c68(0x11e)+_0x265bfc+'\x27)');return _0x1b3537;};}export function extractRootFolderId(_0x490084){const _0x2ab78a=a156_0x16b6ef;return _0x490084[_0x2ab78a(0x183)]?.[_0x2ab78a(0x1b5)]?.[_0x2ab78a(0x123)]?.['id']||_0x490084['relationships']?.['parentFolder']?.[_0x2ab78a(0x123)]?.['id'];}export function buildConnectionMaps(_0x434543){const _0x313332=a156_0x16b6ef,_0x5d5527=new Map(),_0x304c62=new Map(),_0x1a8a7d=new Map();for(const _0x7a2512 of _0x434543){_0x5d5527[_0x313332(0x1c7)](_0x7a2512[_0x313332(0x196)],parseInt(_0x7a2512['id'],0xa)),_0x304c62[_0x313332(0x1c7)](_0x7a2512['id'],_0x7a2512[_0x313332(0x196)]),_0x1a8a7d['set'](_0x7a2512['name'],_0x7a2512[_0x313332(0x1d7)]);}return{'nameToId':_0x5d5527,'idToName':_0x304c62,'nameToType':_0x1a8a7d};}export function calculatePushStats(_0x2c6498,_0x22b9da,_0x478478,_0x25af8c,_0x3dcf20,_0x568361,_0x29101d){const _0x24954e=a156_0x16b6ef,_0x4be4be=_0x2c6498[_0x24954e(0x18e)](_0x2ca0e7=>_0x2ca0e7[_0x24954e(0x1fe)]),_0x4f8441=_0x2c6498[_0x24954e(0x18e)](_0x33bc87=>!_0x33bc87[_0x24954e(0x1fe)]&&_0x33bc87[_0x24954e(0x10d)]),_0x5aceac=_0x2c6498[_0x24954e(0x18e)](_0x50b014=>!_0x50b014[_0x24954e(0x1fe)]&&!_0x50b014[_0x24954e(0x10d)]),_0x52c699=_0x568361?_0x25af8c:[],_0x470c18=_0x22b9da[_0x24954e(0x18e)](_0x3f7f35=>_0x3f7f35['isNew']),_0x1799a1=_0x22b9da[_0x24954e(0x18e)](_0x1ec89e=>!_0x1ec89e[_0x24954e(0x1fe)]&&_0x1ec89e[_0x24954e(0x10d)]),_0x3fa38d=_0x22b9da['filter'](_0x4dfadf=>!_0x4dfadf[_0x24954e(0x1fe)]&&!_0x4dfadf[_0x24954e(0x10d)]),_0x244b4f=_0x568361?_0x3dcf20:[],_0xeff4c0=_0x2c6498['flatMap'](_0x124588=>_0x124588[_0x24954e(0x150)]),_0x272dd4=_0xeff4c0[_0x24954e(0x18e)](_0x2dace7=>_0x2dace7['type']===_0x24954e(0x14c)),_0x404539=_0xeff4c0[_0x24954e(0x18e)](_0x15498a=>_0x15498a[_0x24954e(0x1d7)]===_0x24954e(0x164)),_0x3b58ad=_0xeff4c0[_0x24954e(0x18e)](_0x21debf=>_0x21debf['type']===_0x24954e(0x17c)),_0x3dcda3=Array[_0x24954e(0x169)](_0x478478)[_0x24954e(0x20b)](),_0x11df1f=_0x29101d?![]:_0x4be4be[_0x24954e(0x171)]>0x0||_0x4f8441[_0x24954e(0x171)]>0x0||_0x52c699[_0x24954e(0x171)]>0x0,_0x201397=_0x470c18[_0x24954e(0x171)]>0x0||_0x1799a1[_0x24954e(0x171)]>0x0||_0x244b4f[_0x24954e(0x171)]>0x0,_0x6aa8e3=_0x29101d?![]:_0xeff4c0[_0x24954e(0x171)]>0x0,_0x567d5d=_0x3dcda3[_0x24954e(0x171)]>0x0;return{'segments':{'new':_0x4be4be,'changed':_0x4f8441,'unchanged':_0x5aceac,'toDelete':_0x52c699},'journeys':{'new':_0x470c18,'changed':_0x1799a1,'unchanged':_0x3fa38d,'toDelete':_0x244b4f},'activations':{'all':_0xeff4c0,'toCreate':_0x272dd4,'toUpdate':_0x404539,'toDelete':_0x3b58ad},'folders':{'toCreate':_0x3dcda3},'counts':{'segments':{'new':_0x4be4be['length'],'changed':_0x4f8441['length'],'unchanged':_0x5aceac[_0x24954e(0x171)],'toDelete':_0x52c699[_0x24954e(0x171)]},'journeys':{'new':_0x470c18[_0x24954e(0x171)],'changed':_0x1799a1['length'],'unchanged':_0x3fa38d[_0x24954e(0x171)],'toDelete':_0x244b4f[_0x24954e(0x171)]},'activations':{'create':_0x272dd4[_0x24954e(0x171)],'update':_0x404539[_0x24954e(0x171)],'delete':_0x3b58ad[_0x24954e(0x171)]},'folders':_0x3dcda3[_0x24954e(0x171)]},'hasChanges':_0x11df1f||_0x201397||_0x6aa8e3||_0x567d5d};}export async function buildPushExecutionContext(_0x1c4e04,_0x3c0b93,_0x20adea,_0x5b2386,_0x366147,_0x30be1e){const _0x4c2817=a156_0x16b6ef,_0x4fe763=extractRootFolderId(_0x20adea),{pathToId:_0x2688cf,idToPath:_0x5f1dce}=buildFolderMaps(_0x366147),_0x4584da=buildSegmentNameToIdMap(_0x5b2386),_0x4b31f6=new Map(),{batchAsync:_0x483826}=await import(_0x4c2817(0x174)),[_0x29f18f,_0x500cee]=await Promise[_0x4c2817(0x1b4)]([_0x1c4e04[_0x4c2817(0x131)][_0x4c2817(0x1e1)](),_0x1c4e04[_0x4c2817(0x1db)][_0x4c2817(0x110)](),((async()=>{const _0x2e897f=_0x4c2817;!_0x30be1e&&_0x5b2386[_0x2e897f(0x171)]>0x0&&await _0x483826(_0x5b2386,async _0x22f9ef=>{const _0x6cd872=_0x2e897f,_0x5adedb=await _0x1c4e04[_0x6cd872(0x198)][_0x6cd872(0x1e3)](_0x3c0b93,_0x22f9ef['id']);_0x4b31f6[_0x6cd872(0x1c7)](_0x22f9ef['id'],_0x5adedb);});})())]),{emailToId:_0x5b4455,idToEmail:_0x68ba79}=_0x29f18f,_0x21ad9f=buildConnectionMaps(_0x500cee);return{'rootFolderId':_0x4fe763,'folderPathToId':_0x2688cf,'folderIdToPath':_0x5f1dce,'segmentNameToId':_0x4584da,'activationsBySegmentId':_0x4b31f6,'emailToIdMap':_0x5b4455,'idToEmailMap':_0x68ba79,'connectionNameToIdMap':_0x21ad9f[_0x4c2817(0x125)],'connectionIdToNameMap':_0x21ad9f[_0x4c2817(0x19b)],'connectionNameToTypeMap':_0x21ad9f['nameToType']};}export function createPushYamlContextForBundle(_0x5f0c1,_0x189047,_0x22edcf,_0x2f109d,_0x30367e,_0x491c21,_0x1e7cfa,_0x3a1737){const {existingLocalSegmentNames:_0x4bdd7b,localExpandedRuleToNames:_0x3152f5}=_0x2f109d,_0x504779=new Set(),_0x32be8a=new Map(),_0x1d078c=new Map(),_0x599597=new Map(),_0x229b49=createJumpTargetCache(),_0x44cdb5=new Map(),_0x414c6f=new Map(),_0x41cd8b=new Set();let _0x25a46c;const _0x41e48e=_0x50dee1=>{const _0x3d3d3c={'resolveSegment':async _0x300ed4=>{const _0x5786c5=a156_0x55ff,_0x45f3af=_0x599597[_0x5786c5(0x11c)](_0x300ed4);if(_0x45f3af!==undefined)return{'name':_0x45f3af,'isJourneyLocal':!![]};try{const _0x1bb1c0=await fetchSegment(_0x5f0c1,_0x189047,_0x300ed4,_0x22edcf);if(!_0x1bb1c0)throw new Error(_0x5786c5(0x155));const _0x9342a=generateJourneyLocalName(_0x1bb1c0['name']),_0x31c1f9=_0x1bb1c0[_0x5786c5(0x119)]===SEGMENT_KIND_JOURNEY&&_0x9342a!==undefined;let _0x27c06f=_0x1bb1c0[_0x5786c5(0x196)],_0x524f7a;if(_0x31c1f9&&_0x1bb1c0[_0x5786c5(0x170)]){const _0x5a1cf4=apiRuleToYaml(_0x1bb1c0[_0x5786c5(0x170)]);_0x414c6f[_0x5786c5(0x1c7)](_0x300ed4,_0x5a1cf4);const _0x117ec7=async _0x281953=>{const _0x974636=_0x5786c5,_0x294061=collectSegmentRefsFromRule(_0x281953);for(const _0x4a96b8 of _0x294061){if(!_0x414c6f[_0x974636(0x1cc)](_0x4a96b8))try{const _0x335a22=await fetchSegment(_0x5f0c1,_0x189047,_0x4a96b8,_0x22edcf);if(_0x335a22?.[_0x974636(0x170)]){const _0x56a91f=apiRuleToYaml(_0x335a22['rule']);_0x414c6f[_0x974636(0x1c7)](_0x4a96b8,_0x56a91f),await _0x117ec7(_0x56a91f);}}catch(_0x67baa6){logger[_0x974636(0x159)](_0x974636(0x127)+_0x4a96b8+':\x20'+_0x67baa6);}}};await _0x117ec7(_0x5a1cf4);const _0x952a1a=serializeExpandedRule(_0x5a1cf4,_0x414c6f),_0x32e5ee=_0x3152f5['get'](_0x952a1a);if(_0x32e5ee&&_0x32e5ee[_0x5786c5(0x171)]>0x0){const _0x51f128=_0x32be8a[_0x5786c5(0x11c)](_0x952a1a)||0x0,_0x547eaf=_0x32e5ee[_0x51f128]||_0x32e5ee[_0x32e5ee[_0x5786c5(0x171)]-0x1];_0x32be8a[_0x5786c5(0x1c7)](_0x952a1a,_0x51f128+0x1),_0x27c06f=_0x547eaf,_0x504779[_0x5786c5(0x1c4)](_0x27c06f),_0x599597['set'](_0x300ed4,_0x27c06f);const _0x2925da=await resolveRuleSegmentRefs(_0x5a1cf4,async _0x4f65a3=>{const _0x4ac457=_0x5786c5,_0x3f0b0b=_0x599597[_0x4ac457(0x11c)](_0x4f65a3);if(_0x3f0b0b)return _0x3f0b0b;const _0x43addb=await _0x25a46c[_0x4ac457(0x1e2)](_0x4f65a3);return _0x43addb['name'];});_0x524f7a={'description':_0x1bb1c0['description'],'rule':_0x2925da};}else{const _0x40e1a6=_0x44cdb5[_0x5786c5(0x11c)](_0x952a1a);if(_0x40e1a6)_0x27c06f=_0x40e1a6,_0x599597[_0x5786c5(0x1c7)](_0x300ed4,_0x27c06f);else{if(_0x9342a){let _0x5f502a=_0x9342a,_0x547ed6=0x2;while(_0x504779['has'](_0x5f502a)||_0x4bdd7b['has'](_0x5f502a)){_0x5f502a=_0x9342a+'_'+_0x547ed6,_0x547ed6++;}_0x504779[_0x5786c5(0x1c4)](_0x5f502a),_0x27c06f=_0x5f502a;}_0x599597['set'](_0x300ed4,_0x27c06f),_0x44cdb5[_0x5786c5(0x1c7)](_0x952a1a,_0x27c06f);const _0x3442b2=await resolveRuleSegmentRefs(_0x5a1cf4,async _0x7ea511=>{const _0xef5be=_0x5786c5,_0x50a419=_0x599597['get'](_0x7ea511);if(_0x50a419)return _0x50a419;const _0x5a5ecf=await _0x25a46c[_0xef5be(0x1e2)](_0x7ea511);return _0x5a5ecf[_0xef5be(0x196)];});_0x524f7a={'description':_0x1bb1c0[_0x5786c5(0x1bc)],'rule':_0x3442b2};}}}return{'name':_0x27c06f,'isJourneyLocal':_0x31c1f9,'definition':_0x524f7a};}catch(_0xb8e92d){return logger[_0x5786c5(0x159)]('Failed\x20to\x20resolve\x20segment\x20'+_0x300ed4+':\x20'+_0xb8e92d),{'name':_0x300ed4,'isJourneyLocal':![]};}},'resolveActivation':async _0xb20390=>{const _0x2c0138=a156_0x55ff,_0x655b53=_0x1d078c[_0x2c0138(0x11c)](_0xb20390);if(_0x655b53!==undefined)return{'name':_0x655b53,'isJourneyLocal':!![]};try{let _0x446122=_0x1e7cfa?.[_0x2c0138(0x11c)](_0xb20390);!_0x446122&&(_0x446122=await _0x5f0c1['journey'][_0x2c0138(0x151)](_0x50dee1,_0xb20390));const _0x187b79=_0x446122[_0x2c0138(0x14f)][_0x2c0138(0x135)][_0x2c0138(0x196)]||_0xb20390,_0x38d200=sanitizeYamlKey(_0x187b79)||_0x2c0138(0x1ec)+_0xb20390,_0x10aa7f=_0x38d200;_0x1d078c[_0x2c0138(0x1c7)](_0xb20390,_0x10aa7f);const _0x3725f3=journeyActivationStepToYaml(_0x446122,_0x30367e,_0x491c21);return{'name':_0x10aa7f,'isJourneyLocal':!![],'definition':_0x3725f3};}catch(_0x5dfe9a){return logger[_0x2c0138(0x159)](_0x2c0138(0x133)+_0xb20390+':\x20'+_0x5dfe9a),{'name':_0xb20390,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x174899,_0x3e3536)=>resolveJumpTarget(_0x174899,_0x3e3536,_0x229b49,async _0xb9ee02=>{const _0x5f6683=a156_0x55ff,_0x40f76a=_0x3a1737?.[_0x5f6683(0x11c)](_0xb9ee02);if(_0x40f76a)return _0x40f76a;return _0x5f0c1[_0x5f6683(0x1b0)]['getJourney'](_0xb9ee02);})};return _0x25a46c=_0x3d3d3c,_0x3d3d3c;},_0x4a588e=async _0x3cde7a=>{const _0x4c1102=a156_0x55ff,{collectSegmentIdsFromJourneyApi:_0x369648}=await import(_0x4c1102(0x1d1)),{batchAsync:_0x5a1a81}=await import(_0x4c1102(0x174)),_0x3671cf=new Set();for(const _0x388aef of _0x3cde7a){let _0x318158=_0x3a1737?.['get'](_0x388aef);!_0x318158&&(_0x318158=await _0x5f0c1[_0x4c1102(0x1b0)][_0x4c1102(0x19d)](_0x388aef));const _0x4ceaa3=_0x369648(_0x318158);for(const _0x14ab73 of _0x4ceaa3){_0x3671cf['add'](_0x14ab73);}}let _0x3c77fb=Array['from'](_0x3671cf);while(_0x3c77fb[_0x4c1102(0x171)]>0x0){const _0x33bb34=_0x3c77fb[_0x4c1102(0x18e)](_0xcb7262=>!_0x41cd8b['has'](_0xcb7262));if(_0x33bb34[_0x4c1102(0x171)]===0x0)break;const _0x43236c=await _0x5a1a81(_0x33bb34,async _0x523e25=>{const _0x33ae69=_0x4c1102;_0x41cd8b[_0x33ae69(0x1c4)](_0x523e25);const _0x5d3902=await fetchSegment(_0x5f0c1,_0x189047,_0x523e25,_0x22edcf);if(!_0x5d3902)return null;return{'segmentId':_0x523e25,'segment':_0x5d3902};},0xa),_0x409a3f=new Set();for(const _0x36b409 of _0x43236c){if(!_0x36b409?.[_0x4c1102(0x198)]?.[_0x4c1102(0x170)])continue;const _0x3e29b8=apiRuleToYaml(_0x36b409[_0x4c1102(0x198)][_0x4c1102(0x170)]);_0x414c6f[_0x4c1102(0x1c7)](_0x36b409['segmentId'],_0x3e29b8);const _0x5d7fb1=collectSegmentRefsFromRule(_0x3e29b8);for(const _0x408235 of _0x5d7fb1){!_0x41cd8b[_0x4c1102(0x1cc)](_0x408235)&&_0x409a3f[_0x4c1102(0x1c4)](_0x408235);}}_0x3c77fb=Array['from'](_0x409a3f);}};return{'createYamlContext':_0x41e48e,'prefetchJourneySegments':_0x4a588e};}export async function executePushSegments(_0x35109a,_0x44879,_0x35282d,_0x1b3e55,_0x1f5230){const _0x14ffc7=a156_0x16b6ef,{segmentDefToCreateRequest:_0x540953,segmentDefToUpdateRequest:_0x58a4fc}=await import(_0x14ffc7(0x19a)),_0x1b2597=_0x35282d[_0x14ffc7(0x11f)],_0xb7b997=0x5,_0x48b1ea=async _0x5523cd=>{const _0x89a425=_0x14ffc7,_0xb5742e=_0x5523cd[_0x89a425(0x197)]?_0x1b2597[_0x89a425(0x11c)](_0x5523cd[_0x89a425(0x197)]):undefined;let _0x307281;const _0x13713d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0xd478fe=_0x5523cd['yamlConfig'];if(_0x5523cd['yamlConfig'][_0x89a425(0x170)]){const _0x3e50ed=createSegmentIdResolver(_0x35282d['segmentNameToId'],_0x5523cd['yamlConfig'][_0x89a425(0x196)]),_0x570ebc=await resolveRuleSegmentIds(_0x5523cd['yamlConfig'][_0x89a425(0x170)],_0x3e50ed);_0xd478fe={..._0x5523cd['yamlConfig'],'rule':_0x570ebc};}try{if(_0x5523cd[_0x89a425(0x1fe)]){_0x1f5230['onProgress']?.({'type':_0x89a425(0x1a7),'name':_0x5523cd[_0x89a425(0x1cd)]['name']});const _0xb0207c=_0x540953(_0xd478fe,_0xb5742e),_0x2292e6=await _0x1f5230[_0x89a425(0x148)]('Creating\x20segment\x20\x27'+_0x5523cd[_0x89a425(0x1cd)]['name']+_0x89a425(0x1ff),()=>_0x35109a[_0x89a425(0x198)]['createSegment'](_0x1b3e55['parentId'],_0xb0207c));_0x307281=_0x2292e6[_0x89a425(0x123)]['id'],_0x35282d[_0x89a425(0x1df)][_0x89a425(0x1c7)](_0x5523cd[_0x89a425(0x1cd)][_0x89a425(0x196)],_0x307281),_0x13713d[_0x89a425(0x143)]={'name':_0x5523cd['yamlConfig'][_0x89a425(0x196)],'id':_0x307281},_0x1f5230['onProgress']?.({'type':_0x89a425(0x116),'name':_0x5523cd[_0x89a425(0x1cd)][_0x89a425(0x196)],'segmentId':_0x307281}),_0x1f5230[_0x89a425(0x10e)]?.(_0x89a425(0x129)+_0x5523cd[_0x89a425(0x1cd)]['name']+'\x27'),_0x13713d[_0x89a425(0x140)]=0x1;}else{if(_0x5523cd[_0x89a425(0x10d)]){_0x1f5230[_0x89a425(0x11a)]?.({'type':_0x89a425(0x20e),'name':_0x5523cd[_0x89a425(0x1cd)]['name']});const _0xf6668c=_0x58a4fc(_0xd478fe);_0xb5742e!==_0x5523cd[_0x89a425(0x11d)]?.[_0x89a425(0x17b)]&&(_0xf6668c[_0x89a425(0x17b)]=_0xb5742e?parseInt(_0xb5742e,0xa):undefined),await _0x1f5230['withProgress'](_0x89a425(0x13b)+_0x5523cd['yamlConfig'][_0x89a425(0x196)]+_0x89a425(0x1ff),()=>_0x35109a[_0x89a425(0x198)]['updateSegmentById'](_0x1b3e55[_0x89a425(0x20c)],_0x5523cd[_0x89a425(0x11d)]['id'],_0xf6668c)),_0x307281=_0x5523cd[_0x89a425(0x11d)]['id'],_0x1f5230['onProgress']?.({'type':'segment_updated','name':_0x5523cd[_0x89a425(0x1cd)][_0x89a425(0x196)]}),_0x1f5230[_0x89a425(0x10e)]?.('Updated\x20segment\x20\x27'+_0x5523cd[_0x89a425(0x1cd)][_0x89a425(0x196)]+'\x27'),_0x13713d['updated']=0x1;}else _0x307281=_0x5523cd[_0x89a425(0x11d)]['id'];}}catch(_0x2ad7b1){const _0x3745ca=isHttp400Error(_0x2ad7b1),_0xe96660=_0x3745ca?ErrorCode[_0x89a425(0x1f9)]:ErrorCode[_0x89a425(0x16c)],_0x48d312=getErrorMessage(_0x2ad7b1);throw new SDKError(_0xe96660,_0x89a425(0x10a)+(_0x5523cd[_0x89a425(0x1fe)]?_0x89a425(0x14c):'update')+_0x89a425(0x205)+_0x5523cd[_0x89a425(0x13c)]+'\x0a\x20\x20'+_0x48d312,_0x2ad7b1);}try{const _0x56fb69=await syncActivationsForSegment(_0x35109a,_0x1b3e55[_0x89a425(0x20c)],_0x307281,_0x5523cd['yamlConfig'][_0x89a425(0x196)],_0x5523cd[_0x89a425(0x150)],_0x1f5230,_0x5523cd[_0x89a425(0x13c)]);_0x13713d['activations']=_0x56fb69;}catch(_0x4b22e3){if(_0x4b22e3 instanceof SDKError)throw _0x4b22e3;throw new SDKError(ErrorCode[_0x89a425(0x16f)],_0x89a425(0x1a1)+_0x5523cd[_0x89a425(0x1cd)][_0x89a425(0x196)]+'\x27\x20from\x20file:\x20'+_0x5523cd[_0x89a425(0x13c)]+_0x89a425(0x175)+getErrorMessage(_0x4b22e3),_0x4b22e3);}return _0x13713d;},_0x54667f=await batchAsync(_0x44879,_0x48b1ea,_0xb7b997),_0xc01ab9={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x286f14 of _0x54667f){_0xc01ab9[_0x14ffc7(0x140)]+=_0x286f14[_0x14ffc7(0x140)],_0xc01ab9[_0x14ffc7(0x1b8)]+=_0x286f14['updated'],_0x286f14[_0x14ffc7(0x143)]&&_0xc01ab9['createdSegmentIds']['set'](_0x286f14[_0x14ffc7(0x143)][_0x14ffc7(0x196)],_0x286f14[_0x14ffc7(0x143)]['id']),_0xc01ab9[_0x14ffc7(0x111)]['created']+=_0x286f14[_0x14ffc7(0x111)][_0x14ffc7(0x140)],_0xc01ab9['activations']['updated']+=_0x286f14[_0x14ffc7(0x111)][_0x14ffc7(0x1b8)],_0xc01ab9[_0x14ffc7(0x111)][_0x14ffc7(0x185)]+=_0x286f14[_0x14ffc7(0x111)][_0x14ffc7(0x185)];}return _0xc01ab9;}async function syncActivationsForSegment(_0x22380f,_0x29f576,_0x18c50d,_0x469799,_0xf69499,_0x28f970,_0x47a221){const _0x222284=a156_0x16b6ef,_0x25aee6={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x42a580 of _0xf69499){try{if(_0x42a580[_0x222284(0x1d7)]===_0x222284(0x14c)&&_0x42a580[_0x222284(0x207)])_0x28f970['onProgress']?.({'type':'activation_creating','segmentName':_0x469799,'activationName':_0x42a580[_0x222284(0x196)]}),await _0x28f970[_0x222284(0x148)](_0x222284(0x15c)+_0x42a580[_0x222284(0x196)]+_0x222284(0x1ff),()=>_0x22380f[_0x222284(0x198)]['createActivation'](_0x29f576,_0x18c50d,_0x42a580['validatedRequest'])),_0x28f970[_0x222284(0x11a)]?.({'type':'activation_created','segmentName':_0x469799,'activationName':_0x42a580[_0x222284(0x196)]}),_0x28f970[_0x222284(0x10e)]?.(_0x222284(0x184)+_0x42a580[_0x222284(0x196)]+'\x27'),_0x25aee6[_0x222284(0x140)]++;else{if(_0x42a580[_0x222284(0x1d7)]===_0x222284(0x164)&&_0x42a580['validatedRequest']&&_0x42a580[_0x222284(0x15f)])_0x28f970['onProgress']?.({'type':_0x222284(0x1aa),'segmentName':_0x469799,'activationName':_0x42a580[_0x222284(0x196)]}),await _0x28f970[_0x222284(0x148)](_0x222284(0x141)+_0x42a580[_0x222284(0x196)]+_0x222284(0x1ff),()=>_0x22380f[_0x222284(0x198)][_0x222284(0x1c6)](_0x29f576,_0x18c50d,_0x42a580[_0x222284(0x15f)]['id'],_0x42a580[_0x222284(0x207)])),_0x28f970[_0x222284(0x11a)]?.({'type':_0x222284(0x1ce),'segmentName':_0x469799,'activationName':_0x42a580['name']}),_0x28f970[_0x222284(0x10e)]?.(_0x222284(0x17d)+_0x42a580[_0x222284(0x196)]+'\x27'),_0x25aee6[_0x222284(0x1b8)]++;else _0x42a580[_0x222284(0x1d7)]===_0x222284(0x17c)&&_0x42a580[_0x222284(0x15f)]&&(_0x28f970[_0x222284(0x11a)]?.({'type':_0x222284(0x121),'segmentName':_0x469799,'activationName':_0x42a580[_0x222284(0x196)]}),await _0x28f970[_0x222284(0x148)](_0x222284(0x1ba)+_0x42a580[_0x222284(0x196)]+'\x27...',()=>_0x22380f[_0x222284(0x198)][_0x222284(0x210)](_0x29f576,_0x18c50d,_0x42a580['existingActivation']['id'])),_0x28f970[_0x222284(0x11a)]?.({'type':_0x222284(0x144),'segmentName':_0x469799,'activationName':_0x42a580['name']}),_0x28f970[_0x222284(0x20d)]?.('Deleted\x20activation\x20\x27'+_0x42a580[_0x222284(0x196)]+'\x27'),_0x25aee6[_0x222284(0x185)]++);}}catch(_0x3212c1){const _0x428620=isHttp400Error(_0x3212c1),_0x1d76a4=_0x428620?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x1c1ce8=getErrorMessage(_0x3212c1);throw new SDKError(_0x1d76a4,'Failed\x20to\x20'+_0x42a580['type']+_0x222284(0x19f)+_0x42a580[_0x222284(0x196)]+_0x222284(0x182)+_0x47a221+_0x222284(0x175)+_0x1c1ce8,_0x3212c1);}}return _0x25aee6;}export async function executePushFolders(_0x2ac3f6,_0x38d5e2,_0x303f96,_0x4cbe64,_0x11a182){const _0x1cc869=a156_0x16b6ef,_0x79a3b8=new Map(_0x303f96),_0x2397f4=sortFoldersByDepth(_0x38d5e2);for(const _0x25a1d2 of _0x2397f4){const _0x1976e9=_0x25a1d2['split']('/'),_0x395dc1=_0x1976e9[_0x1976e9[_0x1cc869(0x171)]-0x1],_0x5a75d4=_0x1976e9[_0x1cc869(0x1e5)](0x0,-0x1)[_0x1cc869(0x208)]('/'),_0x305444=_0x79a3b8['get'](_0x5a75d4);_0x11a182[_0x1cc869(0x11a)]?.({'type':'folder_creating','folder':_0x25a1d2});const _0x3767af={'name':_0x395dc1,'parentFolderId':_0x305444},_0x42b70c=await _0x11a182[_0x1cc869(0x148)]('Creating\x20folder\x20\x27'+_0x25a1d2+'\x27...',()=>_0x2ac3f6[_0x1cc869(0x198)][_0x1cc869(0x13f)](_0x4cbe64[_0x1cc869(0x20c)],_0x3767af));_0x79a3b8[_0x1cc869(0x1c7)](_0x25a1d2,_0x42b70c[_0x1cc869(0x123)]['id']),_0x11a182[_0x1cc869(0x11a)]?.({'type':'folder_created','folder':_0x25a1d2,'folderId':_0x42b70c[_0x1cc869(0x123)]['id']}),_0x11a182[_0x1cc869(0x1d8)]?.('Created\x20folder\x20\x27'+_0x25a1d2+'\x27');}return _0x79a3b8;}export async function executePushSegmentDeletions(_0xe7d407,_0x24d184,_0x1ef6ad){const _0x51ac05=a156_0x16b6ef;if(_0x24d184[_0x51ac05(0x171)]===0x0)return 0x0;const {batchAsync:_0x114966}=await import(_0x51ac05(0x174)),_0x376a8f=0x5,_0x944c40=await _0x114966(_0x24d184,async _0x37e79d=>{const _0x1db1d6=_0x51ac05;return _0x1ef6ad[_0x1db1d6(0x11a)]?.({'type':'segment_deleting','name':_0x37e79d[_0x1db1d6(0x196)]}),await _0xe7d407[_0x1db1d6(0x198)][_0x1db1d6(0x1c2)](_0x37e79d['id']),_0x1ef6ad[_0x1db1d6(0x11a)]?.({'type':'segment_deleted','name':_0x37e79d[_0x1db1d6(0x196)]}),_0x1ef6ad['logDeleted']?.(_0x1db1d6(0x12f)+_0x37e79d['name']+'\x27'),0x1;},_0x376a8f);return _0x944c40[_0x51ac05(0x194)]((_0x263af7,_0x3023b1)=>_0x263af7+_0x3023b1,0x0);}export async function executePushJourneys(_0x495bd5,_0x2bd408,_0x24383e,_0x1bc9f9,_0x1c2054){const _0x549189=a156_0x16b6ef,{journeyDefToRequest:_0x18c08f}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x5c3979,yamlRuleToApi:_0x3881b5,validateSegmentRule:_0x46cd91}=await import(_0x549189(0x19a)),_0x4e42fe={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4cb0e9=new Map(_0x24383e[_0x549189(0x1df)]),_0x2f7dd6=0x5;for(let _0xd1764e=0x0;_0xd1764e<_0x2bd408[_0x549189(0x171)];_0xd1764e+=_0x2f7dd6){const _0x151566=_0x2bd408[_0x549189(0x1e5)](_0xd1764e,_0xd1764e+_0x2f7dd6),_0x10bb6c=await Promise[_0x549189(0x1b4)](_0x151566[_0x549189(0x136)](async _0x26d771=>{const _0x2bd34f=_0x549189;if(!_0x26d771[_0x2bd34f(0x1fe)]&&!_0x26d771[_0x2bd34f(0x10d)])return{'action':_0x2bd34f(0x138),'name':_0x26d771[_0x2bd34f(0x1cd)][_0x2bd34f(0x196)],'journeyId':_0x26d771[_0x2bd34f(0x19e)]?.['id']};const _0x270f15=_0x26d771[_0x2bd34f(0x197)]?_0x24383e[_0x2bd34f(0x11f)]['get'](_0x26d771[_0x2bd34f(0x197)]):undefined;_0x1c2054['onProgress']?.({'type':_0x26d771[_0x2bd34f(0x1fe)]?_0x2bd34f(0x156):_0x2bd34f(0x213),'name':_0x26d771['yamlConfig'][_0x2bd34f(0x196)]});try{const _0x484321=await executeSingleJourneyPush(_0x495bd5,_0x26d771,{..._0x24383e,'segmentNameToId':_0x4cb0e9},{'parentId':_0x1bc9f9[_0x2bd34f(0x20c)],'rootFolderId':_0x1bc9f9[_0x2bd34f(0x188)],'folderId':_0x270f15,'verbose':_0x1bc9f9[_0x2bd34f(0x157)]},_0x1c2054,{'journeyDefToRequest':_0x18c08f,'activationDefToCreateRequest':_0x5c3979,'yamlRuleToApi':_0x3881b5,'validateSegmentRule':_0x46cd91});for(const [_0x3a0636,_0x5b64da]of _0x484321['embeddedSegmentNameToId']){_0x4cb0e9[_0x2bd34f(0x1c7)](_0x3a0636,_0x5b64da),_0x4e42fe[_0x2bd34f(0x1a4)][_0x2bd34f(0x1c7)](_0x3a0636,_0x5b64da);}if(_0x484321[_0x2bd34f(0x192)]===_0x2bd34f(0x140))_0x1c2054[_0x2bd34f(0x11a)]?.({'type':_0x2bd34f(0x189),'name':_0x26d771['yamlConfig'][_0x2bd34f(0x196)],'journeyId':_0x484321['journeyId']}),_0x1c2054[_0x2bd34f(0x10e)]?.(_0x2bd34f(0x16e)+_0x26d771['yamlConfig']['name']+'\x27'),_0x4e42fe[_0x2bd34f(0x140)]++;else _0x484321['action']===_0x2bd34f(0x1b8)&&(_0x1c2054['onProgress']?.({'type':_0x2bd34f(0x161),'name':_0x26d771[_0x2bd34f(0x1cd)][_0x2bd34f(0x196)]}),_0x1c2054['logSuccess']?.(_0x2bd34f(0x130)+_0x26d771[_0x2bd34f(0x1cd)][_0x2bd34f(0x196)]+'\x27'),_0x4e42fe[_0x2bd34f(0x1b8)]++);return{'action':_0x484321[_0x2bd34f(0x192)],'name':_0x26d771[_0x2bd34f(0x1cd)]['name'],'journeyId':_0x484321[_0x2bd34f(0x19c)]};}catch(_0x54ada){const _0x3779e9=isHttp400Error(_0x54ada),_0x42b566=_0x3779e9?ErrorCode[_0x2bd34f(0x12d)]:ErrorCode[_0x2bd34f(0x1f5)],_0x2095e8=getErrorMessage(_0x54ada);throw new SDKError(_0x42b566,_0x2bd34f(0x10a)+(_0x26d771[_0x2bd34f(0x1fe)]?_0x2bd34f(0x14c):_0x2bd34f(0x164))+_0x2bd34f(0x18f)+_0x26d771['absolutePath']+_0x2bd34f(0x175)+_0x2095e8,_0x54ada);}}));_0x4e42fe[_0x549189(0x173)][_0x549189(0x12b)](..._0x10bb6c);}return _0x4e42fe;}async function matchExistingJourneySegments(_0x418b91,_0x533249,_0x50f263,_0x334c09,_0x4f1107){const _0x11ca7a=a156_0x16b6ef;if(!_0x533249[_0x11ca7a(0x19e)]||!_0x533249[_0x11ca7a(0x1cd)][_0x11ca7a(0x20f)])return;const _0x4e5f9a=new Map(),_0x498e96=new Set();for(const _0x58bb5a of Object[_0x11ca7a(0x172)](_0x533249[_0x11ca7a(0x1cd)]['segments'])){const _0x4f07b5=generateDeterministicJourneySegmentName(_0x533249['yamlConfig']['name'],_0x58bb5a);_0x4e5f9a['set'](_0x4f07b5,_0x58bb5a),_0x498e96['add'](_0x58bb5a);}const _0x29c9a6=[],_0x2a0676=collectSegmentIdsFromJourneyApi(_0x533249[_0x11ca7a(0x19e)]);for(const _0x3a4c25 of _0x2a0676){const _0x48a203=await fetchSegment(_0x418b91,_0x50f263,_0x3a4c25,_0x334c09);if(!_0x48a203?.['name'])continue;const _0x5a4e08=_0x4e5f9a[_0x11ca7a(0x11c)](_0x48a203[_0x11ca7a(0x196)]);_0x5a4e08?(_0x4f1107[_0x11ca7a(0x1c7)](_0x5a4e08,_0x3a4c25),_0x498e96['delete'](_0x5a4e08)):_0x29c9a6[_0x11ca7a(0x12b)]({'id':_0x3a4c25,'seg':_0x48a203});}if(_0x498e96[_0x11ca7a(0x149)]>0x0&&_0x29c9a6['length']>0x0){const {localExpandedRuleToNames:_0x34f831}=buildLocalExpandedRuleMappings(_0x533249[_0x11ca7a(0x1cd)]),_0x315ae8=new Map();for(const {id:_0x108486,seg:_0xef8780}of _0x29c9a6){if(_0xef8780[_0x11ca7a(0x170)]){const _0x1b65a6=apiRuleToYaml(_0xef8780['rule']);_0x315ae8[_0x11ca7a(0x1c7)](_0x108486,_0x1b65a6);}}for(const {id:_0x5bffff,seg:_0x54a267}of _0x29c9a6){if(!_0x54a267[_0x11ca7a(0x170)])continue;const _0x1a1072=_0x315ae8[_0x11ca7a(0x11c)](_0x5bffff);if(!_0x1a1072)continue;const _0x126936=serializeExpandedRule(_0x1a1072,_0x315ae8),_0x5b3eed=_0x34f831['get'](_0x126936);if(_0x5b3eed){const _0x58d1ab=_0x5b3eed[_0x11ca7a(0x1a6)](_0x527127=>_0x498e96[_0x11ca7a(0x1cc)](_0x527127));_0x58d1ab&&(_0x4f1107[_0x11ca7a(0x1c7)](_0x58d1ab,_0x5bffff),_0x498e96['delete'](_0x58d1ab),logger[_0x11ca7a(0x159)](_0x11ca7a(0x1c1)+_0x54a267[_0x11ca7a(0x196)]+'\x27\x20to\x20local\x20\x27'+_0x58d1ab+_0x11ca7a(0x11b)));}}}}async function executeSingleJourneyPush(_0x257651,_0x53db1c,_0x1f673d,_0x2fc351,_0x28fa4b,_0x44913b){const _0x4164fa=a156_0x16b6ef,{journeyDefToRequest:_0x35687b,activationDefToCreateRequest:_0x56eea2,yamlRuleToApi:_0x541426,validateSegmentRule:_0x2b3958}=_0x44913b,_0x42790d=new Map(),_0x5b36a9=new Map();recoverSegmentIdsFromPushRecovery(_0x53db1c,_0x42790d,_0x1f673d[_0x4164fa(0x1df)]);const _0xff14d2=new Map(),_0x4ae9fe=new Map(),_0x1e1eb0=new Map();let _0x2ff1b2;const _0x388040=async()=>{const _0x147dec=_0x4164fa;if(_0x2ff1b2)return;_0x2ff1b2=new Map();if(!_0x53db1c[_0x147dec(0x19e)])return;const _0x3a1728=await _0x257651[_0x147dec(0x1b0)][_0x147dec(0x1e3)](_0x53db1c[_0x147dec(0x19e)]['id']);for(const _0x15b56b of _0x3a1728){const _0x2fb894=journeyActivationStepToYaml(_0x15b56b,_0x1f673d[_0x147dec(0x1a3)],_0x1f673d[_0x147dec(0x1d0)]),_0x2aa113=activationSignature(_0x2fb894);!_0x2ff1b2['has'](_0x2aa113)&&_0x2ff1b2['set'](_0x2aa113,_0x15b56b['id']),_0x2fb894[_0x147dec(0x196)]&&_0x5b36a9[_0x147dec(0x1c7)](_0x2fb894[_0x147dec(0x196)],_0x15b56b['id']);}};await matchExistingJourneySegments(_0x257651,_0x53db1c,_0x2fc351[_0x4164fa(0x20c)],_0x1f673d['existingSegments'],_0x1f673d[_0x4164fa(0x1df)]);const _0x72724f={'resolveSegmentId':async _0x2dee1e=>{const _0x3e8302=_0x4164fa,_0x10ab8d=_0x1f673d[_0x3e8302(0x1df)]['get'](_0x2dee1e);if(!_0x10ab8d)throw new SDKError(ErrorCode[_0x3e8302(0x1b9)],_0x3e8302(0x190)+_0x2dee1e+_0x3e8302(0x1dc)+_0x53db1c[_0x3e8302(0x1cd)][_0x3e8302(0x196)]+')');return _0x10ab8d;},'resolveEmbeddedSegmentId':async(_0x1ca1af,_0x456728)=>{const _0x50bc95=_0x4164fa,_0x4ec54a=_0x1f673d[_0x50bc95(0x1df)][_0x50bc95(0x11c)](_0x1ca1af);if(_0x4ec54a)return _0x4ec54a;const _0x34302b=_0x1f673d[_0x50bc95(0x18c)][_0x50bc95(0x1a6)](_0x3f9de7=>_0x3f9de7[_0x50bc95(0x196)]===_0x1ca1af);if(_0x34302b)return _0x1f673d[_0x50bc95(0x1df)][_0x50bc95(0x1c7)](_0x1ca1af,_0x34302b['id']),_0x34302b['id'];if(_0x53db1c[_0x50bc95(0x1fe)]){const {stageName:_0x374f0d,criteriaName:_0xb9bb60}=findSegmentCriteriaLocation(_0x53db1c[_0x50bc95(0x1cd)],_0x1ca1af);return _0x2b3958(_0x1ca1af,_0x456728[_0x50bc95(0x170)]),_0x4ae9fe[_0x50bc95(0x1c7)](_0x1ca1af,{'definition':_0x456728,'stageName':_0x374f0d,'criteriaName':_0xb9bb60}),createPendingSegmentId(_0x1ca1af);}const _0x1f1231=_0x53db1c['existingJourney']?.['id'];if(!_0x1f1231)throw new SDKError(ErrorCode[_0x50bc95(0x195)],_0x50bc95(0x16d));const _0x548fd5=_0xff14d2[_0x50bc95(0x11c)](_0x1ca1af);if(_0x548fd5)return _0x548fd5;const _0x483b41=((async()=>{const _0x264bf1=_0x50bc95;_0x2b3958(_0x1ca1af,_0x456728[_0x264bf1(0x170)]);const _0x3aefe9=generateDeterministicJourneySegmentName(_0x53db1c[_0x264bf1(0x1cd)][_0x264bf1(0x196)],_0x1ca1af),_0x38f1d9=_0x1f673d[_0x264bf1(0x18c)][_0x264bf1(0x1a6)](_0x4684e1=>_0x4684e1[_0x264bf1(0x196)]===_0x3aefe9),_0x1986c2=createSegmentIdResolver(_0x1f673d[_0x264bf1(0x1df)],_0x1ca1af),_0x15254d=await resolveRuleSegmentIds(_0x456728[_0x264bf1(0x170)],_0x1986c2);let _0x2112d7;return _0x38f1d9?(await _0x257651[_0x264bf1(0x198)]['updateSegmentById'](_0x2fc351[_0x264bf1(0x20c)],_0x38f1d9['id'],{'description':_0x456728[_0x264bf1(0x1bc)]||_0x264bf1(0x202)+_0x1ca1af,'rule':_0x541426(_0x15254d),'countPopulation':!![]}),_0x2112d7=_0x38f1d9['id'],saveSegmentToPushRecovery(_0x53db1c[_0x264bf1(0x13c)],_0x53db1c[_0x264bf1(0x1cd)]['name'],_0x1ca1af,{'segmentId':_0x2112d7,'uniqueServerName':_0x3aefe9,'createdAt':new Date()[_0x264bf1(0x16a)]()})):_0x2112d7=await createOrRecoverEmbeddedSegment(_0x257651,_0x53db1c,{'localName':_0x1ca1af,'uniqueSegmentName':_0x3aefe9,'description':_0x456728[_0x264bf1(0x1bc)]||_0x264bf1(0x202)+_0x1ca1af,'journeyId':_0x1f1231,'resolvedRule':_0x15254d,'parentId':_0x2fc351[_0x264bf1(0x20c)],'folderId':_0x2fc351[_0x264bf1(0x188)]||''},_0x541426),_0x1f673d['segmentNameToId']['set'](_0x1ca1af,_0x2112d7),_0x42790d[_0x264bf1(0x1c7)](_0x1ca1af,_0x2112d7),_0x2112d7;})());_0xff14d2[_0x50bc95(0x1c7)](_0x1ca1af,_0x483b41);try{return await _0x483b41;}finally{_0xff14d2[_0x50bc95(0x17c)](_0x1ca1af);}},'resolveActivationId':async _0x32fa39=>{const _0x29d515=_0x4164fa,_0x3a8338=_0x5b36a9['get'](_0x32fa39);if(_0x3a8338)return _0x3a8338;if(_0x53db1c['existingJourney']){await _0x388040();const _0x5aafa6=_0x5b36a9[_0x29d515(0x11c)](_0x32fa39);if(_0x5aafa6)return _0x5aafa6;}throw new SDKError(ErrorCode[_0x29d515(0x132)],'Activation\x20not\x20found:\x20'+_0x32fa39+_0x29d515(0x1dc)+_0x53db1c[_0x29d515(0x1cd)][_0x29d515(0x196)]+_0x29d515(0x1e8)+_0x29d515(0x1f0));},'resolveEmbeddedActivationId':async(_0x3f6f1e,_0x3e6b6c)=>{const _0x1493ba=_0x4164fa,_0x27c474=_0x5b36a9[_0x1493ba(0x11c)](_0x3f6f1e);if(_0x27c474)return _0x27c474;if(_0x53db1c['isNew'])return _0x1e1eb0['set'](_0x3f6f1e,_0x3e6b6c),createPendingActivationId(_0x3f6f1e);if(_0x53db1c[_0x1493ba(0x19e)]){await _0x388040();const _0x1b6878=_0x5b36a9[_0x1493ba(0x11c)](_0x3e6b6c[_0x1493ba(0x196)]);if(_0x1b6878)return _0x5b36a9[_0x1493ba(0x1c7)](_0x3f6f1e,_0x1b6878),_0x1b6878;const _0xf4ce1d=activationSignature(_0x3e6b6c),_0x129f89=_0x2ff1b2?.['get'](_0xf4ce1d);if(_0x129f89)return _0x5b36a9[_0x1493ba(0x1c7)](_0x3f6f1e,_0x129f89),_0x129f89;const _0x32ab57=await _0x56eea2(_0x3e6b6c,_0x1f673d[_0x1493ba(0x186)]),_0x4fb13e={..._0x32ab57,..._0x3e6b6c[_0x1493ba(0x1ab)]!==undefined&&{'runAfterJourneyRefresh':_0x3e6b6c['run_after_journey_refresh']}},_0x3f292d=await _0x257651[_0x1493ba(0x1b0)]['createActivation'](_0x53db1c[_0x1493ba(0x19e)]['id'],_0x4fb13e);return _0x5b36a9['set'](_0x3f6f1e,_0x3f292d['id']),_0x3f292d['id'];}throw new SDKError(ErrorCode[_0x1493ba(0x195)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x2b6de0=>{const _0x3b44ae=_0x4164fa;try{return await _0x257651[_0x3b44ae(0x1b0)]['resolveJourneyId'](_0x2fc351['parentId'],_0x2b6de0);}catch(_0x2a96d7){throw new SDKError(ErrorCode[_0x3b44ae(0x132)],_0x3b44ae(0x1fa)+_0x2b6de0+_0x3b44ae(0x1fb)+_0x53db1c[_0x3b44ae(0x1cd)][_0x3b44ae(0x196)]+'\x27)',_0x2a96d7);}},'resolveStageId':async(_0x12db9e,_0x56cac0)=>{const _0x33c59e=_0x4164fa,_0x3bc233=await _0x257651[_0x33c59e(0x1b0)][_0x33c59e(0x19d)](_0x12db9e),_0x1c20ec=_0x3bc233['attributes']['journeyStages']['find'](_0x11a9d4=>_0x11a9d4['name']['toLowerCase']()===_0x56cac0[_0x33c59e(0x1d6)]());if(!_0x1c20ec?.['id'])throw new SDKError(ErrorCode[_0x33c59e(0x132)],_0x33c59e(0x1a8)+_0x56cac0+_0x33c59e(0x1f8)+(_0x3bc233[_0x33c59e(0x14f)]['journeyBundleName']||_0x3bc233[_0x33c59e(0x14f)][_0x33c59e(0x196)])+'\x27');return _0x1c20ec['id'];}},_0x3bf43f=await _0x35687b(_0x53db1c[_0x4164fa(0x1cd)],_0x2fc351[_0x4164fa(0x20c)],_0x72724f),_0x709be0=_0x2fc351[_0x4164fa(0x1af)]||_0x2fc351[_0x4164fa(0x188)];_0x709be0&&(_0x3bf43f[_0x4164fa(0x183)]={'parentFolder':{'data':{'id':_0x709be0,'type':_0x4164fa(0x112)}}});if(_0x53db1c[_0x4164fa(0x1fe)]){if(_0x4ae9fe[_0x4164fa(0x149)]>0x0||_0x1e1eb0[_0x4164fa(0x149)]>0x0)return await executeThreeStepJourneyCreate(_0x257651,_0x53db1c,_0x3bf43f,{'pendingEmbeddedSegments':_0x4ae9fe,'pendingEmbeddedActivations':_0x1e1eb0,'embeddedSegmentNameToId':_0x42790d,'journeyActivationNameToId':_0x5b36a9},{..._0x2fc351,'effectiveFolderId':_0x709be0},_0x1f673d,_0x28fa4b,_0x44913b);else{ensureJourneyDefaults(_0x3bf43f['attributes']);const _0x2aba3e=await _0x257651[_0x4164fa(0x1b0)]['create'](_0x3bf43f);return deletePushRecovery(_0x53db1c[_0x4164fa(0x13c)]),{'action':_0x4164fa(0x140),'journeyId':_0x2aba3e['id'],'embeddedSegmentNameToId':_0x42790d};}}else{if(_0x53db1c['hasChanges']&&_0x53db1c[_0x4164fa(0x19e)]){_0x3bf43f['id']=_0x53db1c[_0x4164fa(0x19e)]['id'];const _0xbf143d=_0x3bf43f[_0x4164fa(0x14f)];_0x53db1c['existingJourney'][_0x4164fa(0x14f)]?.[_0x4164fa(0x191)]&&(_0xbf143d[_0x4164fa(0x191)]=_0x53db1c['existingJourney'][_0x4164fa(0x14f)][_0x4164fa(0x191)]);const _0xa8bd6c=_0x53db1c['existingJourney']['attributes']?.[_0x4164fa(0x1c8)];return _0xa8bd6c&&_0x3bf43f[_0x4164fa(0x14f)]['journeyStages']&&injectExistingStageIds(_0x3bf43f['attributes'][_0x4164fa(0x1c8)],_0xa8bd6c),ensureJourneyDefaults(_0xbf143d),await _0x257651[_0x4164fa(0x1b0)]['update'](_0x53db1c['existingJourney']['id'],_0x3bf43f),deletePushRecovery(_0x53db1c[_0x4164fa(0x13c)]),{'action':_0x4164fa(0x1b8),'journeyId':_0x53db1c[_0x4164fa(0x19e)]['id'],'embeddedSegmentNameToId':_0x42790d};}}return deletePushRecovery(_0x53db1c[_0x4164fa(0x13c)]),{'action':_0x4164fa(0x138),'journeyId':_0x53db1c[_0x4164fa(0x19e)]?.['id'],'embeddedSegmentNameToId':_0x42790d};}function findSegmentCriteriaLocation(_0x366539,_0x45bdf7){const _0x2d6237=a156_0x16b6ef,_0x44c581=_0x366539['stages']||_0x366539[_0x2d6237(0x165)]?.[0x0]?.[_0x2d6237(0x12e)]||[];let _0x275c09=_0x2d6237(0x158),_0x228e0f=_0x45bdf7;const _0x5e90c0=_0x366539[_0x2d6237(0x178)]||_0x366539[_0x2d6237(0x165)]?.[0x0]?.['goal'];if(_0x5e90c0?.[_0x2d6237(0x198)]===_0x45bdf7)return{'stageName':_0x2d6237(0x178),'criteriaName':_0x5e90c0[_0x2d6237(0x196)]||_0x45bdf7};_0x2b5a6d:for(const _0x6af0a of _0x44c581){if(_0x6af0a[_0x2d6237(0x1ef)]?.['segment']===_0x45bdf7){_0x275c09=_0x6af0a[_0x2d6237(0x196)],_0x228e0f=_0x6af0a[_0x2d6237(0x1ef)][_0x2d6237(0x196)]||_0x45bdf7;break;}if(_0x6af0a[_0x2d6237(0x1a9)])for(const _0x5f2ed2 of _0x6af0a[_0x2d6237(0x1a9)]){if(_0x5f2ed2['type']===_0x2d6237(0x1a2)&&_0x5f2ed2[_0x2d6237(0x201)]?.[_0x2d6237(0x1e4)])for(const _0x2fa8a6 of _0x5f2ed2[_0x2d6237(0x201)][_0x2d6237(0x1e4)]){if(_0x2fa8a6[_0x2d6237(0x198)]===_0x45bdf7){_0x275c09=_0x6af0a['name'],_0x228e0f=_0x2fa8a6[_0x2d6237(0x196)]||_0x45bdf7;break _0x2b5a6d;}}}}return{'stageName':_0x275c09,'criteriaName':_0x228e0f};}async function executeThreeStepJourneyCreate(_0x15f8bd,_0x18f168,_0x172a00,_0x25199d,_0x4ec105,_0x4e0844,_0x4d3cc7,_0x4141be){const _0x191543=a156_0x16b6ef,{activationDefToCreateRequest:_0x343ffe,yamlRuleToApi:_0x51d3c1}=_0x4141be,{pendingEmbeddedSegments:_0x34a844,pendingEmbeddedActivations:_0x33e2ce,embeddedSegmentNameToId:_0x254b20}=_0x25199d,_0x396b44=JSON['parse'](JSON[_0x191543(0x1b2)](_0x172a00));ensureJourneyDefaults(_0x396b44['attributes']),stripPendingIds(_0x396b44);const _0x239800=await _0x15f8bd[_0x191543(0x1b0)][_0x191543(0x14c)](_0x396b44),_0x230662=_0x239800['id'],_0x1347f2=new Map();for(const _0x356b26 of _0x239800['attributes'][_0x191543(0x1c8)]){_0x1347f2['set'](_0x356b26[_0x191543(0x196)]['toLowerCase'](),_0x356b26['id']);}recoverSegmentIdsFromPushRecovery(_0x18f168,_0x254b20,_0x4e0844[_0x191543(0x1df)]);for(const [_0x399f75,{definition:_0x5d8fa6}]of _0x34a844){if(_0x254b20[_0x191543(0x1cc)](_0x399f75)){_0x4d3cc7[_0x191543(0x11a)]?.({'type':_0x191543(0x1a5),'journeyName':_0x18f168[_0x191543(0x1cd)][_0x191543(0x196)],'segmentName':_0x399f75});continue;}const _0x62f67e=generateDeterministicJourneySegmentName(_0x18f168['yamlConfig']['name'],_0x399f75);_0x4d3cc7[_0x191543(0x11a)]?.({'type':_0x191543(0x1da),'journeyName':_0x18f168['yamlConfig'][_0x191543(0x196)],'segmentName':_0x399f75});const _0x4e4336=createSegmentIdResolver(_0x4e0844[_0x191543(0x1df)],_0x399f75),_0xc12414=await resolveRuleSegmentIds(_0x5d8fa6[_0x191543(0x170)],_0x4e4336),_0x4f8f21=await createOrRecoverEmbeddedSegment(_0x15f8bd,_0x18f168,{'localName':_0x399f75,'uniqueSegmentName':_0x62f67e,'description':_0x5d8fa6[_0x191543(0x1bc)]||'Entry\x20criteria:\x20'+_0x399f75,'journeyId':_0x230662,'resolvedRule':_0xc12414,'parentId':_0x4ec105['parentId'],'folderId':_0x4ec105[_0x191543(0x17e)]||''},_0x51d3c1);_0x254b20[_0x191543(0x1c7)](_0x399f75,_0x4f8f21),_0x4e0844[_0x191543(0x1df)]['set'](_0x399f75,_0x4f8f21),_0x4d3cc7[_0x191543(0x11a)]?.({'type':_0x191543(0x1a5),'journeyName':_0x18f168[_0x191543(0x1cd)][_0x191543(0x196)],'segmentName':_0x399f75});}const _0x2e8e90=new Map();for(const [_0x1f6bc5,_0x2a91f3]of _0x33e2ce){_0x4d3cc7[_0x191543(0x11a)]?.({'type':_0x191543(0x17a),'journeyName':_0x18f168[_0x191543(0x1cd)][_0x191543(0x196)],'activationName':_0x1f6bc5});const _0x5e4886=await _0x343ffe(_0x2a91f3,_0x4e0844[_0x191543(0x186)]),_0x20587f={..._0x5e4886,..._0x2a91f3[_0x191543(0x1ab)]!==undefined&&{'runAfterJourneyRefresh':_0x2a91f3[_0x191543(0x1ab)]}},_0x2b4236=await _0x15f8bd[_0x191543(0x1b0)]['createActivation'](_0x230662,_0x20587f);_0x2e8e90[_0x191543(0x1c7)](_0x1f6bc5,_0x2b4236['id']),_0x25199d[_0x191543(0x1ae)][_0x191543(0x1c7)](_0x1f6bc5,_0x2b4236['id']),_0x4d3cc7['onProgress']?.({'type':_0x191543(0x12c),'journeyName':_0x18f168[_0x191543(0x1cd)][_0x191543(0x196)],'activationName':_0x1f6bc5});}const _0x46d57c=JSON[_0x191543(0x1b3)](JSON[_0x191543(0x1b2)](_0x172a00));return _0x46d57c['id']=_0x230662,ensureJourneyDefaults(_0x46d57c['attributes']),resolvePendingIdsInRequest(_0x46d57c,_0x172a00,_0x1347f2,_0x254b20,_0x2e8e90,_0x4d3cc7),await _0x15f8bd['journey'][_0x191543(0x164)](_0x230662,_0x46d57c),deletePushRecovery(_0x18f168['absolutePath']),{'action':_0x191543(0x140),'journeyId':_0x230662,'embeddedSegmentNameToId':_0x254b20};}export function stripWaitStepPendingIds(_0x30b17a){const _0xc15e80=a156_0x16b6ef,_0x1736c0=_0x30b17a[_0xc15e80(0x18d)]&&isPendingSegmentId(_0x30b17a[_0xc15e80(0x18d)]),_0x286c6e=_0x30b17a['conditions']?.[_0xc15e80(0x134)](_0x117ea8=>_0x117ea8[_0xc15e80(0x1d9)]&&isPendingSegmentId(_0x117ea8[_0xc15e80(0x1d9)]));(_0x1736c0||_0x286c6e)&&(_0x30b17a[_0xc15e80(0x1f7)]=_0xc15e80(0x10b),_0x30b17a[_0xc15e80(0x14d)]=0x1,_0x30b17a['waitStepUnit']=_0xc15e80(0x13e),delete _0x30b17a[_0xc15e80(0x18d)],delete _0x30b17a[_0xc15e80(0x1c9)],delete _0x30b17a[_0xc15e80(0x1d5)],delete _0x30b17a['conditions']);}export function resolveWaitStepPendingIds(_0x1bb36e,_0x3cfb9b,_0xaf9b53,_0x371df0){const _0x262d32=a156_0x16b6ef;if(_0x3cfb9b[_0x262d32(0x18d)]&&isPendingSegmentId(_0x3cfb9b[_0x262d32(0x18d)])){const _0x46832e=_0xaf9b53(_0x3cfb9b[_0x262d32(0x18d)],_0x262d32(0x168)+_0x371df0+_0x262d32(0x1eb));_0x46832e&&(_0x1bb36e[_0x262d32(0x1f7)]=_0x262d32(0x14e),_0x1bb36e[_0x262d32(0x18d)]=_0x46832e,delete _0x1bb36e[_0x262d32(0x14d)],delete _0x1bb36e[_0x262d32(0x15a)],_0x3cfb9b[_0x262d32(0x1c9)]!==undefined&&(_0x1bb36e[_0x262d32(0x1c9)]=_0x3cfb9b['conditionTimeoutDuration']),_0x3cfb9b[_0x262d32(0x1d5)]&&(_0x1bb36e[_0x262d32(0x1d5)]=_0x3cfb9b[_0x262d32(0x1d5)]));}if(_0x3cfb9b['conditions']){const _0x5ae480=_0x3cfb9b[_0x262d32(0x1e7)]['some'](_0x3dad8a=>_0x3dad8a[_0x262d32(0x1d9)]&&isPendingSegmentId(_0x3dad8a['segmentId']));if(_0x5ae480){const _0x6fe8f=_0x3cfb9b['conditions'][_0x262d32(0x136)](_0x485e25=>{const _0x397ebc=_0x262d32;if(_0x485e25['segmentId']&&isPendingSegmentId(_0x485e25['segmentId'])){const _0x543c99=_0xaf9b53(_0x485e25['segmentId'],'stage\x20\x27'+_0x371df0+_0x397ebc(0x1eb));return{..._0x485e25,'segmentId':_0x543c99||_0x485e25['segmentId']};}return{..._0x485e25};});_0x1bb36e['waitStepType']=_0x262d32(0x14e),_0x1bb36e['conditions']=_0x6fe8f,delete _0x1bb36e[_0x262d32(0x14d)],delete _0x1bb36e[_0x262d32(0x15a)],delete _0x1bb36e['conditionSegmentId'],delete _0x1bb36e['conditionTimeoutDuration'],delete _0x1bb36e[_0x262d32(0x1d5)];}}}function stripPendingIds(_0x150a08){const _0x64789=a156_0x16b6ef;_0x150a08['attributes'][_0x64789(0x178)]?.[_0x64789(0x1d9)]&&isPendingSegmentId(_0x150a08[_0x64789(0x14f)]['goal'][_0x64789(0x1d9)])&&delete _0x150a08[_0x64789(0x14f)][_0x64789(0x178)];for(const _0x46313c of _0x150a08[_0x64789(0x14f)]['journeyStages']||[]){_0x46313c[_0x64789(0x10f)]?.['segmentId']&&isPendingSegmentId(_0x46313c[_0x64789(0x10f)][_0x64789(0x1d9)])&&delete _0x46313c[_0x64789(0x10f)];_0x46313c['milestone']?.['segmentId']&&isPendingSegmentId(_0x46313c[_0x64789(0x114)][_0x64789(0x1d9)])&&delete _0x46313c[_0x64789(0x114)];_0x46313c['exitCriterias']&&(_0x46313c[_0x64789(0x1f1)]=_0x46313c[_0x64789(0x1f1)]['filter'](_0x482cb6=>!_0x482cb6[_0x64789(0x1d9)]||!isPendingSegmentId(_0x482cb6[_0x64789(0x1d9)])));if(_0x46313c[_0x64789(0x1a9)])for(const _0x13f269 of Object[_0x64789(0x172)](_0x46313c[_0x64789(0x1a9)])){const _0xc8b164=_0x46313c[_0x64789(0x1a9)][_0x13f269];_0xc8b164[_0x64789(0x1d7)]===_0x64789(0x1cb)&&_0xc8b164['journeyActivationStepId']&&isPendingActivationId(_0xc8b164[_0x64789(0x1fd)])&&(_0xc8b164[_0x64789(0x1fd)]='');if(_0xc8b164['type']==='DecisionPoint'&&_0xc8b164[_0x64789(0x1e4)])for(const _0x2eea91 of _0xc8b164[_0x64789(0x1e4)]){_0x2eea91[_0x64789(0x1d9)]&&isPendingSegmentId(_0x2eea91[_0x64789(0x1d9)])&&(_0x2eea91[_0x64789(0x1d9)]='');}_0xc8b164[_0x64789(0x1d7)]==='WaitStep'&&stripWaitStepPendingIds(_0xc8b164);}}}function resolvePendingIdsInRequest(_0x1695c7,_0x3da56b,_0x36dcf5,_0x2414b5,_0x506e40,_0x5173ca){const _0x275d81=a156_0x16b6ef,_0x14e88a=(_0xbecae7,_0x5cf48a)=>{const _0x3f713c=a156_0x55ff;if(!isPendingSegmentId(_0xbecae7))return _0xbecae7;const _0x6de4b5=extractPendingSegmentName(_0xbecae7),_0x454776=_0x2414b5[_0x3f713c(0x11c)](_0x6de4b5);return!_0x454776&&_0x5173ca[_0x3f713c(0x154)]?.(_0x3f713c(0x10c)+_0x6de4b5+_0x3f713c(0x1d3)+_0x5cf48a),_0x454776;};if(_0x1695c7[_0x275d81(0x14f)][_0x275d81(0x178)]?.['segmentId']&&isPendingSegmentId(_0x1695c7['attributes']['goal']['segmentId'])){const _0x494884=_0x14e88a(_0x1695c7[_0x275d81(0x14f)]['goal'][_0x275d81(0x1d9)],'goal\x20criteria');_0x494884&&(_0x1695c7['attributes'][_0x275d81(0x178)]['segmentId']=_0x494884);}for(const _0x3faa96 of _0x1695c7[_0x275d81(0x14f)]['journeyStages']||[]){const _0x4a0a67=_0x36dcf5['get'](_0x3faa96[_0x275d81(0x196)][_0x275d81(0x1d6)]());_0x4a0a67&&(_0x3faa96['id']=_0x4a0a67);if(_0x3faa96[_0x275d81(0x10f)]?.[_0x275d81(0x1d9)]&&isPendingSegmentId(_0x3faa96['entryCriteria'][_0x275d81(0x1d9)])){const _0x37d785=_0x14e88a(_0x3faa96[_0x275d81(0x10f)][_0x275d81(0x1d9)],_0x275d81(0x168)+_0x3faa96[_0x275d81(0x196)]+_0x275d81(0x117));_0x37d785&&(_0x3faa96[_0x275d81(0x10f)][_0x275d81(0x1d9)]=_0x37d785);}if(_0x3faa96[_0x275d81(0x1f1)])for(const _0xb2438c of _0x3faa96['exitCriterias']){if(_0xb2438c[_0x275d81(0x1d9)]&&isPendingSegmentId(_0xb2438c[_0x275d81(0x1d9)])){const _0x417ad1=_0x14e88a(_0xb2438c['segmentId'],'stage\x20\x27'+_0x3faa96[_0x275d81(0x196)]+_0x275d81(0x18a));_0x417ad1&&(_0xb2438c[_0x275d81(0x1d9)]=_0x417ad1);}}if(_0x3faa96[_0x275d81(0x114)]?.['segmentId']&&isPendingSegmentId(_0x3faa96[_0x275d81(0x114)][_0x275d81(0x1d9)])){const _0x37965c=_0x14e88a(_0x3faa96[_0x275d81(0x114)][_0x275d81(0x1d9)],'stage\x20\x27'+_0x3faa96[_0x275d81(0x196)]+_0x275d81(0x152));_0x37965c&&(_0x3faa96['milestone'][_0x275d81(0x1d9)]=_0x37965c);}if(_0x3faa96['steps']){const _0x5caa83=_0xe20cd3=>_0x3da56b['attributes']['journeyStages']?.[_0x275d81(0x1a6)](_0x4a3b5d=>_0x4a3b5d[_0x275d81(0x196)][_0x275d81(0x1d6)]()===_0x3faa96['name']['toLowerCase']())?.['steps']?.[_0xe20cd3];for(const _0x599c7b of Object[_0x275d81(0x172)](_0x3faa96[_0x275d81(0x1a9)])){const _0x29bf93=_0x3faa96['steps'][_0x599c7b],_0x2e75cb=_0x5caa83(_0x599c7b);if(_0x29bf93[_0x275d81(0x1d7)]===_0x275d81(0x1cb)&&_0x29bf93['journeyActivationStepId']&&(isPendingActivationId(_0x29bf93[_0x275d81(0x1fd)])||_0x29bf93[_0x275d81(0x1fd)]==='')){if(_0x2e75cb?.[_0x275d81(0x1fd)]&&isPendingActivationId(_0x2e75cb[_0x275d81(0x1fd)])){const _0x2653fa=extractPendingActivationName(_0x2e75cb[_0x275d81(0x1fd)]),_0x59e248=_0x506e40[_0x275d81(0x11c)](_0x2653fa);_0x59e248&&(_0x29bf93[_0x275d81(0x1fd)]=_0x59e248);}}if(_0x29bf93[_0x275d81(0x1d7)]==='DecisionPoint'&&_0x29bf93[_0x275d81(0x1e4)]&&_0x2e75cb?.[_0x275d81(0x1e4)])for(let _0x18dfbb=0x0;_0x18dfbb<_0x29bf93[_0x275d81(0x1e4)][_0x275d81(0x171)];_0x18dfbb++){const _0x1780af=_0x29bf93[_0x275d81(0x1e4)][_0x18dfbb],_0x33a17c=_0x2e75cb[_0x275d81(0x1e4)][_0x18dfbb];if(_0x33a17c?.[_0x275d81(0x1d9)]&&isPendingSegmentId(_0x33a17c[_0x275d81(0x1d9)])){const _0x134b77=_0x14e88a(_0x33a17c[_0x275d81(0x1d9)],_0x275d81(0x168)+_0x3faa96[_0x275d81(0x196)]+_0x275d81(0x15e)+(_0x1780af[_0x275d81(0x196)]||_0x18dfbb)+'\x27');_0x134b77&&(_0x1780af[_0x275d81(0x1d9)]=_0x134b77);}}_0x29bf93[_0x275d81(0x1d7)]===_0x275d81(0x160)&&_0x2e75cb?.[_0x275d81(0x1d7)]==='WaitStep'&&resolveWaitStepPendingIds(_0x29bf93,_0x2e75cb,_0x14e88a,_0x3faa96[_0x275d81(0x196)]);}}}}
1
+ const a156_0x4b23a2=a156_0x4c9d;(function(_0x43d7e1,_0xc3bc45){const _0x59952e=a156_0x4c9d,_0x50ed3a=_0x43d7e1();while(!![]){try{const _0x4e0c0c=parseInt(_0x59952e(0x293))/0x1+parseInt(_0x59952e(0x254))/0x2*(-parseInt(_0x59952e(0x1e1))/0x3)+-parseInt(_0x59952e(0x26f))/0x4+-parseInt(_0x59952e(0x279))/0x5*(-parseInt(_0x59952e(0x27b))/0x6)+-parseInt(_0x59952e(0x1d1))/0x7*(parseInt(_0x59952e(0x1d0))/0x8)+-parseInt(_0x59952e(0x1e6))/0x9+parseInt(_0x59952e(0x288))/0xa*(parseInt(_0x59952e(0x2c0))/0xb);if(_0x4e0c0c===_0xc3bc45)break;else _0x50ed3a['push'](_0x50ed3a['shift']());}catch(_0x5362f2){_0x50ed3a['push'](_0x50ed3a['shift']());}}}(a156_0x38b5,0x49c39));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a156_0x4b23a2(0x238));export const PENDING_SEGMENT_PREFIX=a156_0x4b23a2(0x2a3);export const PENDING_ACTIVATION_PREFIX=a156_0x4b23a2(0x266);export function createPendingSegmentId(_0x36122b){return''+PENDING_SEGMENT_PREFIX+_0x36122b+'__';}export function isPendingSegmentId(_0x3e13c0){const _0x5ae359=a156_0x4b23a2;return _0x3e13c0[_0x5ae359(0x21b)](PENDING_SEGMENT_PREFIX)&&!_0x3e13c0['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x979935){return _0x979935['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5db39b){return''+PENDING_ACTIVATION_PREFIX+_0x5db39b+'__';}export function isPendingActivationId(_0x2acde2){const _0x2757b8=a156_0x4b23a2;return _0x2acde2[_0x2757b8(0x21b)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x44bbd6){return _0x44bbd6['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x192ad6,_0x31c556){const _0x33f982=a156_0x4b23a2,_0x269460=_0x192ad6+'::'+(_0x31c556[_0x33f982(0x1d9)]()||_0x33f982(0x21e)),_0x4be879=createHash(_0x33f982(0x208))[_0x33f982(0x263)](_0x269460)[_0x33f982(0x2a9)](_0x33f982(0x242))[_0x33f982(0x20f)](0x0,0xc);return _0x33f982(0x2af)+_0x4be879;}export function ensureJourneyDefaults(_0x198c8b){const _0x456e9f=a156_0x4b23a2;!_0x198c8b['description']&&(_0x198c8b[_0x456e9f(0x2a1)]=''),!_0x198c8b[_0x456e9f(0x1df)]&&(_0x198c8b[_0x456e9f(0x1df)]=_0x456e9f(0x246));}export function injectExistingStageIds(_0x25b13c,_0x5d0185){const _0x36f093=a156_0x4b23a2,_0x1b9284=new Map(_0x5d0185[_0x36f093(0x262)](_0x3e9b43=>[_0x3e9b43[_0x36f093(0x26b)],_0x3e9b43['id']]));for(const _0x355a98 of _0x25b13c){if(!_0x355a98['id']){const _0x425518=_0x1b9284[_0x36f093(0x2b4)](_0x355a98[_0x36f093(0x26b)]);_0x425518&&(_0x355a98['id']=_0x425518);}}}export function resolveTDFolderPath(_0x11355b,_0x338c01,_0x2527b2){const _0x7c77ad=a156_0x4b23a2;if(!_0x338c01)return _0x11355b;if(_0x11355b===_0x2527b2||_0x11355b[_0x7c77ad(0x21b)](_0x2527b2+'/'))return _0x11355b;return _0x11355b?_0x2527b2+'/'+_0x11355b:_0x2527b2;}export function addFoldersToCreate(_0xce3a0,_0x53d195,_0x3bb955){const _0x26968b=a156_0x4b23a2;if(!_0xce3a0)return;if(_0x53d195[_0x26968b(0x29b)](_0xce3a0))return;const _0x1419e8=_0xce3a0[_0x26968b(0x257)]('/');let _0xbf2e46='';for(const _0x539aad of _0x1419e8){_0xbf2e46=_0xbf2e46?_0xbf2e46+'/'+_0x539aad:_0x539aad,!_0x53d195[_0x26968b(0x29b)](_0xbf2e46)&&_0x3bb955[_0x26968b(0x1f8)](_0xbf2e46);}}export function sortFoldersByDepth(_0x371d7e){const _0x35827c=a156_0x4b23a2;return[..._0x371d7e][_0x35827c(0x20e)]((_0xaff4c0,_0x7e26bb)=>{const _0x3c12ee=_0x35827c,_0x20e50a=(_0xaff4c0['match'](/\//g)||[])[_0x3c12ee(0x234)],_0x3d8b69=(_0x7e26bb['match'](/\//g)||[])[_0x3c12ee(0x234)];return _0x20e50a-_0x3d8b69;});}import*as a156_0x6bbf38 from'yaml';import{readFileSync}from'fs';import a156_0x30df6d from'path';import{isJourneyDef,parseYamlString as a156_0x4f2e7e,toYamlString as a156_0x491368,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(_0x1ecce5){const _0x5e9191=a156_0x4b23a2;if(Array[_0x5e9191(0x1e2)](_0x1ecce5))return'['+_0x1ecce5['map'](_0x4f5de5=>stableStringify(_0x4f5de5))[_0x5e9191(0x21a)](',')+']';if(_0x1ecce5&&typeof _0x1ecce5===_0x5e9191(0x211)){const _0x5affde=_0x1ecce5,_0x2f6cb9=Object[_0x5e9191(0x297)](_0x5affde)[_0x5e9191(0x20e)](),_0x3fbb10=_0x2f6cb9[_0x5e9191(0x262)](_0x30353a=>'\x22'+_0x30353a+'\x22:'+stableStringify(_0x5affde[_0x30353a]));return'{'+_0x3fbb10[_0x5e9191(0x21a)](',')+'}';}const _0x2ff33a=JSON[_0x5e9191(0x1c9)](_0x1ecce5);return _0x2ff33a===undefined?_0x5e9191(0x2ac):_0x2ff33a;}function activationSignature(_0x34f6aa){const _0x1432e9=a156_0x4b23a2,_0x634231={'connection':_0x34f6aa[_0x1432e9(0x26e)],..._0x34f6aa[_0x1432e9(0x1f5)]!==undefined&&{'all_columns':_0x34f6aa['all_columns']},..._0x34f6aa[_0x1432e9(0x292)]!==undefined&&{'columns':_0x34f6aa['columns']},..._0x34f6aa[_0x1432e9(0x2bf)]!==undefined&&{'behavior':_0x34f6aa[_0x1432e9(0x2bf)]},..._0x34f6aa[_0x1432e9(0x1e7)]!==undefined&&{'schedule':_0x34f6aa[_0x1432e9(0x1e7)]},..._0x34f6aa[_0x1432e9(0x1fd)]!==undefined&&{'notification':_0x34f6aa['notification']},..._0x34f6aa[_0x1432e9(0x206)]!==undefined&&{'connector_config':_0x34f6aa[_0x1432e9(0x206)]},..._0x34f6aa[_0x1432e9(0x2b3)]!==undefined&&{'activation_template_id':_0x34f6aa[_0x1432e9(0x2b3)]}};return stableStringify(_0x634231);}async function fetchSegment(_0x4cb6ca,_0xd4e46a,_0x54e46d,_0x591811){const _0x11bf11=a156_0x4b23a2,_0x39d352=_0x591811?.[_0x11bf11(0x2bb)](_0x5388be=>_0x5388be['id']===_0x54e46d);if(_0x39d352)return _0x39d352;try{return await _0x4cb6ca['segment'][_0x11bf11(0x1d5)](_0xd4e46a,_0x54e46d);}catch(_0x35e641){logger[_0x11bf11(0x25f)]('getSegment\x20failed\x20for\x20'+_0x54e46d+_0x11bf11(0x264)+_0x35e641);try{return await _0x4cb6ca[_0x11bf11(0x21e)]['getSegmentEntity'](_0x54e46d);}catch(_0x1ad1f9){return logger[_0x11bf11(0x25f)](_0x11bf11(0x232)+_0x54e46d+':\x20'+_0x1ad1f9),null;}}}function recoverSegmentIdsFromPushRecovery(_0x5089fd,_0x131cc7,_0xed7113){const _0x8baccd=a156_0x4b23a2,_0x2f54bd=readPushRecovery(_0x5089fd[_0x8baccd(0x280)]);if(_0x2f54bd?.['journeyName']===_0x5089fd[_0x8baccd(0x272)]['name'])for(const [_0x26b043,_0x486e97]of Object['entries'](_0x2f54bd[_0x8baccd(0x1c7)])){const _0x4e7f56=generateDeterministicJourneySegmentName(_0x5089fd[_0x8baccd(0x272)][_0x8baccd(0x26b)],_0x26b043);_0x486e97['uniqueServerName']===_0x4e7f56&&(_0x131cc7[_0x8baccd(0x24e)](_0x26b043,_0x486e97[_0x8baccd(0x236)]),_0xed7113[_0x8baccd(0x24e)](_0x26b043,_0x486e97[_0x8baccd(0x236)]));}}function a156_0x4c9d(_0x3afe1a,_0x30e81a){_0x3afe1a=_0x3afe1a-0x1c4;const _0x38b5b7=a156_0x38b5();let _0x4c9d91=_0x38b5b7[_0x3afe1a];return _0x4c9d91;}async function createOrRecoverEmbeddedSegment(_0x6a8ac2,_0x1f9c86,_0x528ab4,_0x3c7402){const _0x338f6b=a156_0x4b23a2;let _0x1f5ccf;try{_0x1f5ccf=await _0x6a8ac2[_0x338f6b(0x21e)][_0x338f6b(0x2b6)]({'name':_0x528ab4['uniqueSegmentName'],'description':_0x528ab4[_0x338f6b(0x2a1)],'journeyId':_0x528ab4[_0x338f6b(0x21c)],'rule':_0x3c7402(_0x528ab4['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x528ab4[_0x338f6b(0x273)],'audienceId':_0x528ab4[_0x338f6b(0x23b)]});}catch(_0x150e94){const _0x3c54dd=_0x150e94 instanceof Error&&_0x150e94[_0x338f6b(0x25b)][_0x338f6b(0x276)](_0x338f6b(0x1ee));if(_0x3c54dd){const _0x622c1b=readPushRecovery(_0x1f9c86[_0x338f6b(0x280)]),_0x5a6f84=_0x622c1b?.[_0x338f6b(0x25c)]===_0x1f9c86[_0x338f6b(0x272)][_0x338f6b(0x26b)]?_0x622c1b[_0x338f6b(0x1c7)][_0x528ab4[_0x338f6b(0x2a5)]]:undefined;if(_0x5a6f84?.[_0x338f6b(0x28d)]===_0x528ab4[_0x338f6b(0x284)])await _0x6a8ac2['segment']['updateSegmentById'](_0x528ab4[_0x338f6b(0x23b)],_0x5a6f84[_0x338f6b(0x236)],{'description':_0x528ab4[_0x338f6b(0x2a1)],'rule':_0x3c7402(_0x528ab4[_0x338f6b(0x204)],!![]),'countPopulation':!![]}),_0x1f5ccf=_0x5a6f84[_0x338f6b(0x236)];else throw new SDKError(ErrorCode[_0x338f6b(0x1dc)],_0x338f6b(0x2a7)+_0x528ab4[_0x338f6b(0x2a5)]+_0x338f6b(0x237)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x1f9c86['absolutePath']['replace'](/([^/]+)$/,_0x338f6b(0x267))+')\x20')+_0x338f6b(0x295),_0x150e94);}else throw _0x150e94;}return saveSegmentToPushRecovery(_0x1f9c86[_0x338f6b(0x280)],_0x1f9c86[_0x338f6b(0x272)][_0x338f6b(0x26b)],_0x528ab4[_0x338f6b(0x2a5)],{'segmentId':_0x1f5ccf,'uniqueServerName':_0x528ab4[_0x338f6b(0x284)],'createdAt':new Date()[_0x338f6b(0x227)]()}),_0x1f5ccf;}export async function prepareSegmentFiles(_0x553115,_0x241078,_0x53b544,_0x144f11,_0x591551){const _0x320517=a156_0x4b23a2,{activationDefToCreateRequest:_0x2ab711}=await import(_0x320517(0x1d7)),_0x1f069e=[],_0x3cb264=new Set();for(const {yamlConfig:_0xea1e0c,folderPath:_0x427390,sourcePath:_0xdeffc1}of _0x553115){const _0x46b61e=resolveTDFolderPath(_0x427390,_0x144f11,_0x591551),_0x5d3836=_0x46b61e+':'+_0xea1e0c['name'],_0x530c4b=_0x241078[_0x320517(0x214)][_0x320517(0x2b4)](_0x5d3836),_0xbac2f3=_0x530c4b?_0x241078['activationsBySegmentId'][_0x320517(0x2b4)](_0x530c4b['id'])||[]:[];addFoldersToCreate(_0x46b61e,_0x241078[_0x320517(0x1f6)],_0x3cb264);const _0x4586cb=calculateActivationActions(_0xea1e0c[_0x320517(0x294)]||[],_0xbac2f3,_0x241078[_0x320517(0x286)],_0x241078['connectionIdToNameMap']);for(const _0x1dce27 of _0x4586cb){(_0x1dce27['type']===_0x320517(0x1db)||_0x1dce27[_0x320517(0x253)]===_0x320517(0x263))&&_0x1dce27['yamlActivation']&&(_0x1dce27[_0x320517(0x1d8)]=await _0x2ab711(_0x1dce27[_0x320517(0x1ed)],_0x53b544));}const _0x170ef2=calculateSegmentDiff(_0xea1e0c,_0x530c4b,_0xbac2f3,_0x241078[_0x320517(0x286)],_0x241078['connectionIdToNameMap']);_0x1f069e[_0x320517(0x220)]({'relativePath':_0xea1e0c[_0x320517(0x26b)],'absolutePath':_0xdeffc1,'yamlConfig':_0xea1e0c,'folderPath':_0x46b61e,'existingSegment':_0x530c4b,'existingActivations':_0xbac2f3,'isNew':_0x170ef2[_0x320517(0x2c5)],'hasChanges':_0x170ef2[_0x320517(0x265)],'diff':_0x170ef2[_0x320517(0x2a4)],'activationActions':_0x4586cb});}return{'segmentFiles':_0x1f069e,'foldersToCreate':_0x3cb264};}export async function prepareJourneyFiles(_0x18e81c,_0x563753,_0x48e3a8,_0x564e53){const _0x581ccc=a156_0x4b23a2,_0x2aa692=[],_0x505b60=new Set();for(const {yamlConfig:_0x32ef22,folderPath:_0x4b8db4,sourcePath:_0x2e3e3f}of _0x18e81c){const _0x4afc1e=resolveTDFolderPath(_0x4b8db4,_0x48e3a8,_0x564e53),_0x566cc4=_0x4afc1e+':'+_0x32ef22[_0x581ccc(0x26b)],_0x71cf08=_0x563753[_0x581ccc(0x28c)][_0x581ccc(0x2b4)](_0x566cc4);let _0x22621a,_0x41ac25;if(_0x71cf08&&_0x71cf08[_0x581ccc(0x234)]>0x0){const _0xa3fd80=buildLocalExpandedRuleMappings(_0x32ef22),{createYamlContext:_0x8dd069,prefetchJourneySegments:_0x30632f}=createPushYamlContextForBundle(_0x563753['deps'],_0x563753[_0x581ccc(0x23b)],_0x563753[_0x581ccc(0x282)],_0xa3fd80,_0x563753[_0x581ccc(0x286)],_0x563753[_0x581ccc(0x1f1)],_0x563753[_0x581ccc(0x20b)],_0x563753[_0x581ccc(0x22a)]);await _0x30632f(_0x71cf08[_0x581ccc(0x262)](_0x2643cf=>_0x2643cf['id']));const _0xbb5543=await _0x563753['deps']['journey'][_0x581ccc(0x207)](_0x71cf08[0x0][_0x581ccc(0x2bd)]),_0x585fbe=hasMultipleVersions(_0x32ef22),_0x5c1477=async _0x552e8f=>{const _0x2f92de=_0x581ccc,_0x1a1e8d=_0x563753[_0x2f92de(0x22a)]?.[_0x2f92de(0x2b4)](_0x552e8f);if(_0x1a1e8d)return _0x1a1e8d;return _0x563753['fetchJourney']({'journeyId':_0x552e8f,'journeyName':_0x32ef22[_0x2f92de(0x26b)],'isMultiVersion':_0x71cf08['length']>0x1});};if(_0x585fbe&&_0x71cf08[_0x581ccc(0x234)]>0x1){const _0x1d78e0=[];for(const _0x5dccf0 of _0x71cf08){const _0x16f63a=_0x5dccf0['versionNumber']||0x1;_0x563753[_0x581ccc(0x229)]?.[_0x581ccc(0x263)]('Fetching\x20'+_0x32ef22[_0x581ccc(0x26b)]+'\x20v'+_0x16f63a);const _0x451440=await _0x5c1477(_0x5dccf0['id']),_0xc17129=_0x8dd069(_0x5dccf0['id']),_0x32560d=await journeyResponseToDef(_0x451440,_0xc17129);_0x1d78e0['push']({'item':_0x5dccf0,'yaml':_0x32560d});}const _0x381160=buildLocalRuleToNameMappingFromJourney(_0x32ef22);_0x41ac25=buildMergedJourneyDef(_0x1d78e0,_0x381160,_0xbb5543);const _0x1421a2=Math[_0x581ccc(0x228)](..._0x1d78e0[_0x581ccc(0x262)](_0x311e4a=>_0x311e4a['item'][_0x581ccc(0x1e3)]||0x0)),_0x2c04b6=_0x71cf08['find'](_0x5d200b=>(_0x5d200b[_0x581ccc(0x1e3)]||0x0)===_0x1421a2);_0x2c04b6&&(_0x563753['progress']?.['update'](_0x581ccc(0x271)+_0x32ef22[_0x581ccc(0x26b)]+'\x20v'+_0x1421a2),_0x22621a=await _0x5c1477(_0x2c04b6['id']));}else{const _0x19edf6=_0x71cf08[_0x71cf08[_0x581ccc(0x234)]-0x1];_0x563753[_0x581ccc(0x229)]?.['update'](_0x581ccc(0x271)+_0x32ef22['name']),_0x22621a=await _0x5c1477(_0x19edf6['id']);const _0x234bc=_0x8dd069(_0x19edf6['id']),_0xbe571f=await journeyResponseToDef(_0x22621a,_0x234bc),_0x2ab93b=buildLocalRuleToNameMappingFromJourney(_0x32ef22);_0x41ac25=buildMergedJourneyDef([{'item':_0x19edf6,'yaml':_0xbe571f}],_0x2ab93b,_0xbb5543);}}addFoldersToCreate(_0x4afc1e,_0x563753[_0x581ccc(0x1f6)],_0x505b60);const _0x1b0f05=calculateJourneyDiff(_0x32ef22,_0x41ac25);_0x2aa692['push']({'relativePath':_0x32ef22[_0x581ccc(0x26b)],'absolutePath':_0x2e3e3f,'yamlConfig':_0x32ef22,'folderPath':_0x4afc1e,'existingJourney':_0x22621a,'isNew':_0x1b0f05[_0x581ccc(0x2c5)],'hasChanges':_0x1b0f05['hasChanges'],'diff':_0x1b0f05[_0x581ccc(0x2a4)]});}return{'journeyFiles':_0x2aa692,'foldersToCreate':_0x505b60};}export function calculateActivationActions(_0x39f9b8,_0x17c3d6,_0x49daaf,_0x46f5b6){const _0x17c72a=a156_0x4b23a2,_0x1d8448=[],_0x42b022=new Map();for(const _0x5728b0 of _0x17c3d6){_0x42b022[_0x17c72a(0x24e)](_0x5728b0[_0x17c72a(0x26b)],_0x5728b0);}const _0x3ae3e2=new Map();for(const _0x5b09ca of _0x39f9b8){_0x3ae3e2[_0x17c72a(0x24e)](_0x5b09ca[_0x17c72a(0x26b)],_0x5b09ca);}for(const _0x5416f9 of _0x39f9b8){const _0x1cfdc5=_0x42b022[_0x17c72a(0x2b4)](_0x5416f9[_0x17c72a(0x26b)]);if(!_0x1cfdc5)_0x1d8448[_0x17c72a(0x220)]({'type':'create','name':_0x5416f9[_0x17c72a(0x26b)],'yamlActivation':_0x5416f9});else{const _0x51d8ec=activationResponseToDef(_0x1cfdc5,_0x49daaf,_0x46f5b6),_0x10756f=a156_0x6bbf38[_0x17c72a(0x1c9)](_0x51d8ec),_0xbd8d80=a156_0x6bbf38[_0x17c72a(0x1c9)](_0x5416f9);_0x10756f!==_0xbd8d80&&_0x1d8448[_0x17c72a(0x220)]({'type':_0x17c72a(0x263),'name':_0x5416f9[_0x17c72a(0x26b)],'yamlActivation':_0x5416f9,'existingActivation':_0x1cfdc5});}}for(const _0x161142 of _0x17c3d6){!_0x3ae3e2[_0x17c72a(0x29b)](_0x161142[_0x17c72a(0x26b)])&&_0x1d8448[_0x17c72a(0x220)]({'type':'delete','name':_0x161142[_0x17c72a(0x26b)],'existingActivation':_0x161142});}return _0x1d8448;}function calculateYamlDiff(_0x142d5b,_0x383ac5){if(_0x383ac5){const _0x5c01ee=generateDiff(_0x383ac5,_0x142d5b),_0x10a87a=hasChanges(_0x5c01ee);return{'isNew':![],'hasChanges':_0x10a87a,'diff':_0x10a87a?formatDiffWithColors(_0x5c01ee):undefined};}const _0xed0de0=generateDiff('',_0x142d5b);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xed0de0)};}export function calculateSegmentDiff(_0x5e7f8b,_0x249d2f,_0x26bd9f,_0x7d6b1e,_0xe85e16){const _0x43ee70=segmentToYamlString(_0x5e7f8b),_0x5515fd=_0x249d2f?segmentToYamlString(segmentWithActivationsToYaml(_0x249d2f,_0x26bd9f,undefined,_0x7d6b1e,_0xe85e16)):undefined;return calculateYamlDiff(_0x43ee70,_0x5515fd);}export function calculateJourneyDiff(_0x2255e8,_0x2b5b90){const _0x1ec70e=normalizeJourneyDef(_0x2255e8,_0x2255e8),_0x1194f4=a156_0x491368(_0x1ec70e),_0x858e7a=_0x2b5b90?a156_0x491368(normalizeJourneyDef(_0x2b5b90,_0x2255e8)):undefined;return calculateYamlDiff(_0x1194f4,_0x858e7a);}export function findSegmentsToDelete(_0x2a3595,_0x5899d4,_0x36e980,_0x5eb69f,_0x189382){const _0x233bd6=a156_0x4b23a2,_0x5599a3=new Set();for(const {yamlConfig:_0x24ed87,folderPath:_0x3a2ed8}of _0x5899d4){_0x5599a3[_0x233bd6(0x1f8)](_0x3a2ed8+':'+_0x24ed87['name']);}return _0x2a3595[_0x233bd6(0x23e)](_0x5f095c=>{const _0x37d539=_0x233bd6,_0x4af051=_0x5f095c[_0x37d539(0x1c8)]?_0x36e980[_0x37d539(0x2b4)](_0x5f095c['segmentFolderId'][_0x37d539(0x27f)]())||'':'',_0x2672bb=_0x4af051+':'+_0x5f095c['name'];if(_0x5599a3[_0x37d539(0x29b)](_0x2672bb))return![];if(_0x189382)return _0x4af051===_0x5eb69f||_0x4af051[_0x37d539(0x21b)](_0x5eb69f+'/');return!![];});}export function findJourneysToDelete(_0x1dd1ba,_0x5b72b9,_0x59cc05,_0x586ca7,_0x56c2d1){const _0x4daea5=a156_0x4b23a2,_0x5e8983=new Set();for(const {yamlConfig:_0x5f4fee,folderPath:_0x3aca8e}of _0x5b72b9){_0x5e8983[_0x4daea5(0x1f8)](_0x3aca8e+':'+_0x5f4fee[_0x4daea5(0x26b)]);}return _0x1dd1ba[_0x4daea5(0x23e)](_0x10b9e2=>{const _0x17b5e2=_0x4daea5,_0x5f3ae3=_0x10b9e2[_0x17b5e2(0x273)]?_0x59cc05[_0x17b5e2(0x2b4)](_0x10b9e2[_0x17b5e2(0x273)])||'':'',_0x24d9fe=_0x5f3ae3+':'+_0x10b9e2['journeyBundleName'];if(_0x5e8983[_0x17b5e2(0x29b)](_0x24d9fe))return![];if(_0x56c2d1)return _0x5f3ae3===_0x586ca7||_0x5f3ae3[_0x17b5e2(0x21b)](_0x586ca7+'/');return!![];});}export function buildSegmentLookupMap(_0x5dddeb,_0x4e48d3){const _0x5d34db=a156_0x4b23a2,_0x42cb36=new Map();for(const _0x34143b of _0x5dddeb){const _0x32bf0b=_0x34143b[_0x5d34db(0x1c8)]?_0x4e48d3[_0x5d34db(0x2b4)](_0x34143b[_0x5d34db(0x1c8)][_0x5d34db(0x27f)]())||'':'',_0x749c05=_0x32bf0b+':'+_0x34143b[_0x5d34db(0x26b)];_0x42cb36[_0x5d34db(0x24e)](_0x749c05,_0x34143b);}return _0x42cb36;}export function buildSegmentNameToIdMap(_0x16428b){const _0xd0efc2=a156_0x4b23a2,_0x2fa906=new Map();for(const _0x1a79d1 of _0x16428b){_0x2fa906['set'](_0x1a79d1[_0xd0efc2(0x26b)],_0x1a79d1['id']);}return _0x2fa906;}export function buildJourneyBundleLookupMap(_0x2f3127,_0x3274df){const _0x49476b=a156_0x4b23a2,_0x172acf=new Map();for(const _0x9865dd of _0x2f3127){const _0x3e660e=_0x9865dd[_0x49476b(0x273)]?_0x3274df[_0x49476b(0x2b4)](_0x9865dd[_0x49476b(0x273)])||'':'',_0x24e9d6=_0x3e660e+':'+_0x9865dd[_0x49476b(0x223)];!_0x172acf['has'](_0x24e9d6)&&_0x172acf[_0x49476b(0x24e)](_0x24e9d6,[]),_0x172acf[_0x49476b(0x2b4)](_0x24e9d6)[_0x49476b(0x220)](_0x9865dd);}for(const _0x35db0c of _0x172acf[_0x49476b(0x29e)]()){_0x35db0c[_0x49476b(0x20e)]((_0x4b8bd6,_0x29114f)=>(_0x4b8bd6['versionNumber']||0x0)-(_0x29114f[_0x49476b(0x1e3)]||0x0));}return _0x172acf;}export function collectFoldersToCreate(_0x873cde,_0x2b4228){const _0x72c919=a156_0x4b23a2,_0x1e3077=new Set();for(const _0x301181 of _0x873cde){if(!_0x301181)continue;if(_0x2b4228['has'](_0x301181))continue;const _0x131f27=_0x301181['split']('/');let _0x9e531e='';for(const _0x22457a of _0x131f27){_0x9e531e=_0x9e531e?_0x9e531e+'/'+_0x22457a:_0x22457a,!_0x2b4228[_0x72c919(0x29b)](_0x9e531e)&&_0x1e3077[_0x72c919(0x1f8)](_0x9e531e);}}return _0x1e3077;}export function parseAndClassifyYamlFiles(_0x230b1f,_0x4f957b,_0x1e9cb9){const _0x481475=a156_0x4b23a2,_0x25c8e6=[],_0xd01374=[];for(const _0x4b109f of _0x230b1f){const _0x46ceb9=a156_0x30df6d[_0x481475(0x2b5)](_0x4f957b,a156_0x30df6d['dirname'](_0x4b109f)),_0x4e3bd5=_0x46ceb9==='.'?'':_0x46ceb9[_0x481475(0x26d)](/\\/g,'/'),_0x7740cc=readFileSync(_0x4b109f,_0x481475(0x235)),_0x29816c=a156_0x6bbf38[_0x481475(0x1f2)](_0x7740cc);if(isJourneyDef(_0x29816c,_0x4b109f)){const _0x1ff3b7=a156_0x4f2e7e(_0x7740cc);_0xd01374[_0x481475(0x220)]({'yamlConfig':_0x1ff3b7,'folderPath':_0x4e3bd5,'sourcePath':_0x4b109f});}else{if(!_0x1e9cb9?.['skipSegments']){const _0xd47e44=parseSegmentYamlFile(_0x7740cc),_0x1d16f8=normalizeChildSegmentYaml(_0xd47e44);_0x25c8e6[_0x481475(0x220)]({'yamlConfig':_0x1d16f8,'folderPath':_0x4e3bd5,'sourcePath':_0x4b109f});}}}return{'segments':_0x25c8e6,'journeys':_0xd01374};}export function validateParsedFiles(_0x381c8e,_0x464584){const _0x3c34c4=a156_0x4b23a2,_0x4b9037=[];for(const {yamlConfig:_0x1b5ff4,sourcePath:_0x4eed89}of _0x381c8e[_0x3c34c4(0x1c7)]){const _0x28f017=readFileSync(_0x4eed89,_0x3c34c4(0x235)),_0x4d5e2b=a156_0x6bbf38[_0x3c34c4(0x281)](_0x28f017),_0x3cdd13=validateSegmentDef(_0x1b5ff4,{'source':_0x28f017,'document':_0x4d5e2b},{'skipSchema':!![]});if(!_0x3cdd13[_0x3c34c4(0x29f)]){const _0xf21e28=a156_0x30df6d[_0x3c34c4(0x2b5)](_0x464584,_0x4eed89);_0x4b9037[_0x3c34c4(0x220)]({'filePath':_0xf21e28,'source':_0x28f017,'result':_0x3cdd13,'isJourney':![]});}}for(const {yamlConfig:_0x525979,sourcePath:_0x1e156d}of _0x381c8e[_0x3c34c4(0x2c3)]){const _0x516e0a=readFileSync(_0x1e156d,_0x3c34c4(0x235)),_0x271ff2=a156_0x6bbf38[_0x3c34c4(0x281)](_0x516e0a),_0x5754b7=validateJourneyDef(_0x525979,{'source':_0x516e0a,'document':_0x271ff2},{'skipSchema':!![]});if(!_0x5754b7[_0x3c34c4(0x29f)]){const _0x2fb911=a156_0x30df6d['relative'](_0x464584,_0x1e156d);_0x4b9037[_0x3c34c4(0x220)]({'filePath':_0x2fb911,'source':_0x516e0a,'result':_0x5754b7,'isJourney':!![]});}}return _0x4b9037;}export function formatValidationErrors(_0x3adb5a){const _0x5ad078=a156_0x4b23a2,_0x1a83cf=[];for(const {filePath:_0x204749,source:_0x1a1bd1,result:_0x34342f,isJourney:_0x434ad0}of _0x3adb5a){const _0x1f9b1b=_0x434ad0?_0x5ad078(0x277):_0x5ad078(0x21e);_0x1a83cf['push']('\x0a'+_0x204749+'\x20('+_0x1f9b1b+_0x5ad078(0x22d)+_0x34342f[_0x5ad078(0x289)][_0x5ad078(0x234)]+_0x5ad078(0x28e)),_0x1a83cf[_0x5ad078(0x220)](formatValidationResult(_0x34342f,_0x1a1bd1,_0x204749));}return _0x1a83cf['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x5662e0){const _0x25f843=a156_0x4b23a2,_0x404094=new Set(),_0x536855=new Map(),_0x400c5a=collectSegmentUsageCounts(_0x5662e0);if(_0x5662e0[_0x25f843(0x1c7)])for(const [_0x2ec195,_0x53868a]of Object[_0x25f843(0x22f)](_0x5662e0[_0x25f843(0x1c7)])){_0x404094[_0x25f843(0x1f8)](_0x2ec195);if(_0x53868a[_0x25f843(0x244)]){const _0x7b00bd=yamlRuleToApi(_0x53868a[_0x25f843(0x244)]),_0x58188b=apiRuleToYaml(_0x7b00bd);_0x536855[_0x25f843(0x24e)](_0x2ec195,_0x58188b);}}const _0x1d13a8=new Map();let _0x30df2b=0x0;for(const [_0x473d63,_0x41459b]of _0x536855){const _0x2089d5=serializeExpandedRule(_0x41459b,_0x536855),_0x347469=_0x1d13a8[_0x25f843(0x2b4)](_0x2089d5)||[];_0x347469[_0x25f843(0x220)]({'name':_0x473d63,'index':_0x30df2b}),_0x1d13a8[_0x25f843(0x24e)](_0x2089d5,_0x347469),_0x30df2b++;}const _0x14e5fc=new Map();for(const [_0x2ecabf,_0x32918f]of _0x1d13a8){const _0x538e9c=_0x32918f[_0x25f843(0x20f)]()['sort']((_0x179ff2,_0x4adef4)=>{const _0x4b7fda=_0x25f843,_0x281a3b=_0x400c5a[_0x4b7fda(0x2b4)](_0x179ff2['name'])||0x0,_0x537479=_0x400c5a[_0x4b7fda(0x2b4)](_0x4adef4[_0x4b7fda(0x26b)])||0x0;if(_0x281a3b!==_0x537479)return _0x537479-_0x281a3b;return _0x179ff2[_0x4b7fda(0x201)]-_0x4adef4['index'];})[_0x25f843(0x262)](_0x461d9f=>_0x461d9f[_0x25f843(0x26b)]),_0x2bfa7b=[];for(const _0xb6cc95 of _0x538e9c){const _0x52e9d7=_0x400c5a['get'](_0xb6cc95)||0x0,_0x2662bc=Math[_0x25f843(0x228)](_0x52e9d7,0x1);for(let _0x4d4921=0x0;_0x4d4921<_0x2662bc;_0x4d4921++){_0x2bfa7b[_0x25f843(0x220)](_0xb6cc95);}}_0x14e5fc[_0x25f843(0x24e)](_0x2ecabf,_0x2bfa7b);}return{'existingLocalSegmentNames':_0x404094,'localSegmentRules':_0x536855,'localExpandedRuleToNames':_0x14e5fc};}export function createSegmentIdResolver(_0x48e754,_0x1875c6){return async _0x4b6b9f=>{const _0x5a9066=a156_0x4c9d,_0x343c38=_0x48e754['get'](_0x4b6b9f);if(!_0x343c38)throw new SDKError(ErrorCode[_0x5a9066(0x1d3)],_0x5a9066(0x29c)+_0x4b6b9f+_0x5a9066(0x1cc)+_0x1875c6+'\x27)');return _0x343c38;};}export function extractRootFolderId(_0x4c0d87){const _0x40b4e7=a156_0x4b23a2;return _0x4c0d87['relationships']?.[_0x40b4e7(0x278)]?.['data']?.['id']||_0x4c0d87[_0x40b4e7(0x1ca)]?.[_0x40b4e7(0x1fe)]?.[_0x40b4e7(0x2b1)]?.['id'];}export function buildConnectionMaps(_0x294e7e){const _0x498eb6=a156_0x4b23a2,_0x596e11=new Map(),_0x48b78e=new Map(),_0xdc5c03=new Map();for(const _0x396b2d of _0x294e7e){_0x596e11['set'](_0x396b2d['name'],parseInt(_0x396b2d['id'],0xa)),_0x48b78e[_0x498eb6(0x24e)](_0x396b2d['id'],_0x396b2d[_0x498eb6(0x26b)]),_0xdc5c03['set'](_0x396b2d[_0x498eb6(0x26b)],_0x396b2d[_0x498eb6(0x253)]);}return{'nameToId':_0x596e11,'idToName':_0x48b78e,'nameToType':_0xdc5c03};}export function calculatePushStats(_0x43f4ac,_0x501809,_0x5bcf29,_0x467b37,_0x459a27,_0x491f1d,_0x201293){const _0x17e81d=a156_0x4b23a2,_0x1f6666=_0x43f4ac[_0x17e81d(0x23e)](_0x35178c=>_0x35178c[_0x17e81d(0x2c5)]),_0x5a7fd3=_0x43f4ac['filter'](_0x22deb8=>!_0x22deb8['isNew']&&_0x22deb8[_0x17e81d(0x265)]),_0x82f21=_0x43f4ac['filter'](_0x2ed19b=>!_0x2ed19b['isNew']&&!_0x2ed19b['hasChanges']),_0x5727cf=_0x491f1d?_0x467b37:[],_0x1e51ad=_0x501809[_0x17e81d(0x23e)](_0x3ac48a=>_0x3ac48a['isNew']),_0x5a3c85=_0x501809[_0x17e81d(0x23e)](_0xb002f6=>!_0xb002f6['isNew']&&_0xb002f6[_0x17e81d(0x265)]),_0x14204e=_0x501809[_0x17e81d(0x23e)](_0x2c0918=>!_0x2c0918['isNew']&&!_0x2c0918['hasChanges']),_0x3eaad0=_0x491f1d?_0x459a27:[],_0x2e66d9=_0x43f4ac[_0x17e81d(0x2ae)](_0x2f5462=>_0x2f5462['activationActions']),_0x112d8a=_0x2e66d9['filter'](_0x5b1041=>_0x5b1041[_0x17e81d(0x253)]==='create'),_0xfc24ba=_0x2e66d9[_0x17e81d(0x23e)](_0x39d48a=>_0x39d48a['type']==='update'),_0x1b6fa8=_0x2e66d9[_0x17e81d(0x23e)](_0x1c1048=>_0x1c1048[_0x17e81d(0x253)]==='delete'),_0x12fc3a=Array['from'](_0x5bcf29)[_0x17e81d(0x20e)](),_0x266903=_0x201293?![]:_0x1f6666[_0x17e81d(0x234)]>0x0||_0x5a7fd3['length']>0x0||_0x5727cf[_0x17e81d(0x234)]>0x0,_0x3a6458=_0x1e51ad[_0x17e81d(0x234)]>0x0||_0x5a3c85['length']>0x0||_0x3eaad0[_0x17e81d(0x234)]>0x0,_0x9691eb=_0x201293?![]:_0x2e66d9[_0x17e81d(0x234)]>0x0,_0x3d3152=_0x12fc3a[_0x17e81d(0x234)]>0x0;return{'segments':{'new':_0x1f6666,'changed':_0x5a7fd3,'unchanged':_0x82f21,'toDelete':_0x5727cf},'journeys':{'new':_0x1e51ad,'changed':_0x5a3c85,'unchanged':_0x14204e,'toDelete':_0x3eaad0},'activations':{'all':_0x2e66d9,'toCreate':_0x112d8a,'toUpdate':_0xfc24ba,'toDelete':_0x1b6fa8},'folders':{'toCreate':_0x12fc3a},'counts':{'segments':{'new':_0x1f6666[_0x17e81d(0x234)],'changed':_0x5a7fd3['length'],'unchanged':_0x82f21['length'],'toDelete':_0x5727cf[_0x17e81d(0x234)]},'journeys':{'new':_0x1e51ad[_0x17e81d(0x234)],'changed':_0x5a3c85[_0x17e81d(0x234)],'unchanged':_0x14204e[_0x17e81d(0x234)],'toDelete':_0x3eaad0[_0x17e81d(0x234)]},'activations':{'create':_0x112d8a[_0x17e81d(0x234)],'update':_0xfc24ba[_0x17e81d(0x234)],'delete':_0x1b6fa8[_0x17e81d(0x234)]},'folders':_0x12fc3a[_0x17e81d(0x234)]},'hasChanges':_0x266903||_0x3a6458||_0x9691eb||_0x3d3152};}export async function buildPushExecutionContext(_0x54521b,_0x533d71,_0x51b3b0,_0x12048b,_0x7d01d8,_0x453a68){const _0x5dbb51=a156_0x4b23a2,_0x1f3413=extractRootFolderId(_0x51b3b0),{pathToId:_0x429040,idToPath:_0x49c28f}=buildFolderMaps(_0x7d01d8),_0x2521cd=buildSegmentNameToIdMap(_0x12048b),_0x265966=new Map(),{batchAsync:_0x3d55e5}=await import('../../utils/async.js'),[_0x33c9fc,_0x59add9]=await Promise['all']([_0x54521b['user'][_0x5dbb51(0x25d)](),_0x54521b[_0x5dbb51(0x26e)]['list'](),((async()=>{const _0x581477=_0x5dbb51;!_0x453a68&&_0x12048b[_0x581477(0x234)]>0x0&&await _0x3d55e5(_0x12048b,async _0x1d84c3=>{const _0x33522d=_0x581477,_0x4340a4=await _0x54521b[_0x33522d(0x21e)][_0x33522d(0x1c5)](_0x533d71,_0x1d84c3['id']);_0x265966[_0x33522d(0x24e)](_0x1d84c3['id'],_0x4340a4);});})())]),{emailToId:_0x5bf828,idToEmail:_0x2e9329}=_0x33c9fc,_0x5129a7=buildConnectionMaps(_0x59add9);return{'rootFolderId':_0x1f3413,'folderPathToId':_0x429040,'folderIdToPath':_0x49c28f,'segmentNameToId':_0x2521cd,'activationsBySegmentId':_0x265966,'emailToIdMap':_0x5bf828,'idToEmailMap':_0x2e9329,'connectionNameToIdMap':_0x5129a7[_0x5dbb51(0x1d4)],'connectionIdToNameMap':_0x5129a7['idToName'],'connectionNameToTypeMap':_0x5129a7[_0x5dbb51(0x2a0)]};}export function createPushYamlContextForBundle(_0x54ecdc,_0x2f52ae,_0x474986,_0x4493ae,_0x951ac9,_0x1ee911,_0x3cec22,_0x44a0de){const {existingLocalSegmentNames:_0x8abac3,localExpandedRuleToNames:_0xa1b617}=_0x4493ae,_0x4d7339=new Set(),_0x4c88ff=new Map(),_0x4d6ff1=new Map(),_0x3dbf14=new Map(),_0x9bb022=createJumpTargetCache(),_0x312d43=new Map(),_0x300465=new Map(),_0x5ed168=new Set();let _0x1893f2;const _0x1a838e=_0x37322a=>{const _0x1dc9f2={'resolveSegment':async _0x1cf092=>{const _0x25a0c5=a156_0x4c9d,_0x1bc4f3=_0x3dbf14[_0x25a0c5(0x2b4)](_0x1cf092);if(_0x1bc4f3!==undefined)return{'name':_0x1bc4f3,'isJourneyLocal':!![]};try{const _0x417e97=await fetchSegment(_0x54ecdc,_0x2f52ae,_0x1cf092,_0x474986);if(!_0x417e97)throw new Error(_0x25a0c5(0x2a2));const _0x3d418d=generateJourneyLocalName(_0x417e97[_0x25a0c5(0x26b)]),_0x16011d=_0x417e97['kind']===SEGMENT_KIND_JOURNEY&&_0x3d418d!==undefined;let _0x4a0036=_0x417e97['name'],_0x316f9e;if(_0x16011d&&_0x417e97['rule']){const _0x3f0e89=apiRuleToYaml(_0x417e97[_0x25a0c5(0x244)]);_0x300465[_0x25a0c5(0x24e)](_0x1cf092,_0x3f0e89);const _0x34d47f=async _0x412c81=>{const _0x1b2a06=_0x25a0c5,_0x21fac3=collectSegmentRefsFromRule(_0x412c81);for(const _0x51bd03 of _0x21fac3){if(!_0x300465[_0x1b2a06(0x29b)](_0x51bd03))try{const _0x1bb4aa=await fetchSegment(_0x54ecdc,_0x2f52ae,_0x51bd03,_0x474986);if(_0x1bb4aa?.[_0x1b2a06(0x244)]){const _0x1af754=apiRuleToYaml(_0x1bb4aa[_0x1b2a06(0x244)]);_0x300465[_0x1b2a06(0x24e)](_0x51bd03,_0x1af754),await _0x34d47f(_0x1af754);}}catch(_0x49715b){logger[_0x1b2a06(0x25f)](_0x1b2a06(0x1e9)+_0x51bd03+':\x20'+_0x49715b);}}};await _0x34d47f(_0x3f0e89);const _0x30e2a0=serializeExpandedRule(_0x3f0e89,_0x300465),_0x23d85=_0xa1b617[_0x25a0c5(0x2b4)](_0x30e2a0);if(_0x23d85&&_0x23d85[_0x25a0c5(0x234)]>0x0){const _0x1242f1=_0x4c88ff['get'](_0x30e2a0)||0x0,_0x5d40f8=_0x23d85[_0x1242f1]||_0x23d85[_0x23d85['length']-0x1];_0x4c88ff[_0x25a0c5(0x24e)](_0x30e2a0,_0x1242f1+0x1),_0x4a0036=_0x5d40f8,_0x4d7339['add'](_0x4a0036),_0x3dbf14[_0x25a0c5(0x24e)](_0x1cf092,_0x4a0036);const _0x2255f9=await resolveRuleSegmentRefs(_0x3f0e89,async _0x4dcf71=>{const _0xbf1876=_0x25a0c5,_0x20668b=_0x3dbf14['get'](_0x4dcf71);if(_0x20668b)return _0x20668b;const _0x19fc9f=await _0x1893f2[_0xbf1876(0x22e)](_0x4dcf71);return _0x19fc9f[_0xbf1876(0x26b)];});_0x316f9e={'description':_0x417e97[_0x25a0c5(0x2a1)],'rule':_0x2255f9};}else{const _0x54da99=_0x312d43[_0x25a0c5(0x2b4)](_0x30e2a0);if(_0x54da99)_0x4a0036=_0x54da99,_0x3dbf14[_0x25a0c5(0x24e)](_0x1cf092,_0x4a0036);else{if(_0x3d418d){let _0x51157b=_0x3d418d,_0x2fd479=0x2;while(_0x4d7339['has'](_0x51157b)||_0x8abac3[_0x25a0c5(0x29b)](_0x51157b)){_0x51157b=_0x3d418d+'_'+_0x2fd479,_0x2fd479++;}_0x4d7339[_0x25a0c5(0x1f8)](_0x51157b),_0x4a0036=_0x51157b;}_0x3dbf14[_0x25a0c5(0x24e)](_0x1cf092,_0x4a0036),_0x312d43[_0x25a0c5(0x24e)](_0x30e2a0,_0x4a0036);const _0x3015bb=await resolveRuleSegmentRefs(_0x3f0e89,async _0x443987=>{const _0x3a56b=_0x25a0c5,_0x28c64a=_0x3dbf14[_0x3a56b(0x2b4)](_0x443987);if(_0x28c64a)return _0x28c64a;const _0x27404e=await _0x1893f2[_0x3a56b(0x22e)](_0x443987);return _0x27404e[_0x3a56b(0x26b)];});_0x316f9e={'description':_0x417e97['description'],'rule':_0x3015bb};}}}return{'name':_0x4a0036,'isJourneyLocal':_0x16011d,'definition':_0x316f9e};}catch(_0x277b32){return logger[_0x25a0c5(0x25f)]('Failed\x20to\x20resolve\x20segment\x20'+_0x1cf092+':\x20'+_0x277b32),{'name':_0x1cf092,'isJourneyLocal':![]};}},'resolveActivation':async _0x318eb8=>{const _0x6ec44b=a156_0x4c9d,_0x362e71=_0x4d6ff1['get'](_0x318eb8);if(_0x362e71!==undefined)return{'name':_0x362e71,'isJourneyLocal':!![]};try{let _0x36567d=_0x3cec22?.['get'](_0x318eb8);!_0x36567d&&(_0x36567d=await _0x54ecdc[_0x6ec44b(0x277)]['getActivation'](_0x37322a,_0x318eb8));const _0x27bbd1=_0x36567d[_0x6ec44b(0x1cf)][_0x6ec44b(0x210)][_0x6ec44b(0x26b)]||_0x318eb8,_0x108e32=sanitizeYamlKey(_0x27bbd1)||_0x6ec44b(0x23c)+_0x318eb8,_0x59f4e7=_0x108e32;_0x4d6ff1[_0x6ec44b(0x24e)](_0x318eb8,_0x59f4e7);const _0x864da=journeyActivationStepToYaml(_0x36567d,_0x951ac9,_0x1ee911);return{'name':_0x59f4e7,'isJourneyLocal':!![],'definition':_0x864da};}catch(_0x558f7b){return logger['debug'](_0x6ec44b(0x24a)+_0x318eb8+':\x20'+_0x558f7b),{'name':_0x318eb8,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x29b02d,_0x5d6dad)=>resolveJumpTarget(_0x29b02d,_0x5d6dad,_0x9bb022,async _0x3614d5=>{const _0xc2f3d7=a156_0x4c9d,_0xaca50c=_0x44a0de?.[_0xc2f3d7(0x2b4)](_0x3614d5);if(_0xaca50c)return _0xaca50c;return _0x54ecdc[_0xc2f3d7(0x277)][_0xc2f3d7(0x28b)](_0x3614d5);})};return _0x1893f2=_0x1dc9f2,_0x1dc9f2;},_0x1796e4=async _0x1c4ad8=>{const _0xc50ce7=a156_0x4c9d,{collectSegmentIdsFromJourneyApi:_0x4edbf4}=await import(_0xc50ce7(0x1de)),{batchAsync:_0x1aa9ea}=await import(_0xc50ce7(0x213)),_0x326c38=new Set();for(const _0x4ef650 of _0x1c4ad8){let _0x5274ff=_0x44a0de?.['get'](_0x4ef650);!_0x5274ff&&(_0x5274ff=await _0x54ecdc[_0xc50ce7(0x277)][_0xc50ce7(0x28b)](_0x4ef650));const _0x5f1574=_0x4edbf4(_0x5274ff);for(const _0x4e8d65 of _0x5f1574){_0x326c38[_0xc50ce7(0x1f8)](_0x4e8d65);}}let _0x314c14=Array[_0xc50ce7(0x258)](_0x326c38);while(_0x314c14['length']>0x0){const _0x374d6d=_0x314c14['filter'](_0x4c5cfa=>!_0x5ed168['has'](_0x4c5cfa));if(_0x374d6d[_0xc50ce7(0x234)]===0x0)break;const _0x4b00db=await _0x1aa9ea(_0x374d6d,async _0x5dfe94=>{_0x5ed168['add'](_0x5dfe94);const _0x4f60d8=await fetchSegment(_0x54ecdc,_0x2f52ae,_0x5dfe94,_0x474986);if(!_0x4f60d8)return null;return{'segmentId':_0x5dfe94,'segment':_0x4f60d8};},0xa),_0x31bbf7=new Set();for(const _0x78e899 of _0x4b00db){if(!_0x78e899?.['segment']?.[_0xc50ce7(0x244)])continue;const _0x3d2c13=apiRuleToYaml(_0x78e899['segment']['rule']);_0x300465[_0xc50ce7(0x24e)](_0x78e899[_0xc50ce7(0x236)],_0x3d2c13);const _0x4625ac=collectSegmentRefsFromRule(_0x3d2c13);for(const _0x4a8118 of _0x4625ac){!_0x5ed168[_0xc50ce7(0x29b)](_0x4a8118)&&_0x31bbf7[_0xc50ce7(0x1f8)](_0x4a8118);}}_0x314c14=Array['from'](_0x31bbf7);}};return{'createYamlContext':_0x1a838e,'prefetchJourneySegments':_0x1796e4};}export async function executePushSegments(_0xd1b16b,_0x256c51,_0x352238,_0x50311a,_0x141f0a){const _0xc86299=a156_0x4b23a2,{segmentDefToCreateRequest:_0x25b074,segmentDefToUpdateRequest:_0x3d8a06}=await import(_0xc86299(0x1d7)),_0x5c5e8b=_0x352238[_0xc86299(0x1f6)],_0x52213c=0x5,_0x343f92=async _0x38b7ab=>{const _0x234dec=_0xc86299,_0x179452=_0x38b7ab[_0x234dec(0x225)]?_0x5c5e8b[_0x234dec(0x2b4)](_0x38b7ab[_0x234dec(0x225)]):undefined;let _0x5d6985;const _0x2b16bc={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x305dea=_0x38b7ab[_0x234dec(0x272)];if(_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x244)]){const _0xf67847=createSegmentIdResolver(_0x352238[_0x234dec(0x251)],_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x26b)]),_0x57971f=await resolveRuleSegmentIds(_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x244)],_0xf67847);_0x305dea={..._0x38b7ab[_0x234dec(0x272)],'rule':_0x57971f};}try{if(_0x38b7ab[_0x234dec(0x2c5)]){_0x141f0a[_0x234dec(0x202)]?.({'type':'segment_creating','name':_0x38b7ab[_0x234dec(0x272)]['name']});const _0xba1044=_0x25b074(_0x305dea,_0x179452),_0x7094e9=await _0x141f0a['withProgress'](_0x234dec(0x27c)+_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x26b)]+_0x234dec(0x1dd),()=>_0xd1b16b[_0x234dec(0x21e)]['createSegment'](_0x50311a[_0x234dec(0x23b)],_0xba1044));_0x5d6985=_0x7094e9['data']['id'],_0x352238[_0x234dec(0x251)][_0x234dec(0x24e)](_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x26b)],_0x5d6985),_0x2b16bc[_0x234dec(0x20d)]={'name':_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x26b)],'id':_0x5d6985},_0x141f0a[_0x234dec(0x202)]?.({'type':_0x234dec(0x250),'name':_0x38b7ab['yamlConfig'][_0x234dec(0x26b)],'segmentId':_0x5d6985}),_0x141f0a['logSuccess']?.(_0x234dec(0x24b)+_0x38b7ab['yamlConfig'][_0x234dec(0x26b)]+'\x27'),_0x2b16bc[_0x234dec(0x2b7)]=0x1;}else{if(_0x38b7ab[_0x234dec(0x265)]){_0x141f0a['onProgress']?.({'type':_0x234dec(0x247),'name':_0x38b7ab[_0x234dec(0x272)]['name']});const _0x53ba69=_0x3d8a06(_0x305dea);_0x179452!==_0x38b7ab[_0x234dec(0x1ff)]?.[_0x234dec(0x1c8)]&&(_0x53ba69[_0x234dec(0x1c8)]=_0x179452?parseInt(_0x179452,0xa):undefined),await _0x141f0a[_0x234dec(0x217)](_0x234dec(0x28f)+_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x26b)]+_0x234dec(0x1dd),()=>_0xd1b16b[_0x234dec(0x21e)][_0x234dec(0x298)](_0x50311a[_0x234dec(0x23b)],_0x38b7ab['existingSegment']['id'],_0x53ba69)),_0x5d6985=_0x38b7ab[_0x234dec(0x1ff)]['id'],_0x141f0a['onProgress']?.({'type':'segment_updated','name':_0x38b7ab['yamlConfig'][_0x234dec(0x26b)]}),_0x141f0a[_0x234dec(0x2ab)]?.(_0x234dec(0x1f4)+_0x38b7ab[_0x234dec(0x272)][_0x234dec(0x26b)]+'\x27'),_0x2b16bc['updated']=0x1;}else _0x5d6985=_0x38b7ab[_0x234dec(0x1ff)]['id'];}}catch(_0x5e5d4e){const _0x28d0da=isHttp400Error(_0x5e5d4e),_0x2a5e94=_0x28d0da?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x234dec(0x1dc)],_0x18ee92=getErrorMessage(_0x5e5d4e);throw new SDKError(_0x2a5e94,'Failed\x20to\x20'+(_0x38b7ab[_0x234dec(0x2c5)]?_0x234dec(0x1db):'update')+_0x234dec(0x24d)+_0x38b7ab['absolutePath']+_0x234dec(0x252)+_0x18ee92,_0x5e5d4e);}try{const _0x46507d=await syncActivationsForSegment(_0xd1b16b,_0x50311a[_0x234dec(0x23b)],_0x5d6985,_0x38b7ab[_0x234dec(0x272)]['name'],_0x38b7ab['activationActions'],_0x141f0a,_0x38b7ab[_0x234dec(0x280)]);_0x2b16bc['activations']=_0x46507d;}catch(_0x122113){if(_0x122113 instanceof SDKError)throw _0x122113;throw new SDKError(ErrorCode[_0x234dec(0x2a6)],_0x234dec(0x269)+_0x38b7ab[_0x234dec(0x272)]['name']+_0x234dec(0x2be)+_0x38b7ab[_0x234dec(0x280)]+_0x234dec(0x252)+getErrorMessage(_0x122113),_0x122113);}return _0x2b16bc;},_0x19d7e2=await batchAsync(_0x256c51,_0x343f92,_0x52213c),_0x7959f9={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x58a134 of _0x19d7e2){_0x7959f9[_0xc86299(0x2b7)]+=_0x58a134[_0xc86299(0x2b7)],_0x7959f9[_0xc86299(0x2b9)]+=_0x58a134[_0xc86299(0x2b9)],_0x58a134[_0xc86299(0x20d)]&&_0x7959f9[_0xc86299(0x290)]['set'](_0x58a134['createdSegmentId'][_0xc86299(0x26b)],_0x58a134['createdSegmentId']['id']),_0x7959f9['activations'][_0xc86299(0x2b7)]+=_0x58a134[_0xc86299(0x294)]['created'],_0x7959f9[_0xc86299(0x294)]['updated']+=_0x58a134[_0xc86299(0x294)][_0xc86299(0x2b9)],_0x7959f9[_0xc86299(0x294)][_0xc86299(0x255)]+=_0x58a134[_0xc86299(0x294)][_0xc86299(0x255)];}return _0x7959f9;}function a156_0x38b5(){const _0x2b25d3=['journeyName','buildUserMaps','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','debug','\x27\x20entry\x20criteria','with','map','update',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','hasChanges','__pending_act_','.$1.push-recovery.json','rootFolderId','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','existingActivation','name','run_after_journey_refresh','replace','connection','2133404BmOVZw','\x27\x20to\x20local\x20\x27','Fetching\x20','yamlConfig','folderId','conditionTimeoutDuration','folder_creating','includes','journey','parentSegmentFolder','2423105VzgfxA','activation_creating','6HMyWWf','Creating\x20segment\x20\x27','Updated\x20journey\x20\x27','waitStepType','toString','absolutePath','parseDocument','existingSegments','effectiveFolderId','uniqueSegmentName','conditionSegmentId','idToEmailMap','Creating\x20folder\x20\x27','5170aFPNOn','errors','action','getJourney','journeyBundlesByFolderAndName','uniqueServerName','\x20error(s)','Updating\x20segment\x20\x27','createdSegmentIds','unchanged','columns','504712VTNtxZ','activations','and\x20the\x20server\x20segment,\x20then\x20retry.','activationContext','keys','updateSegmentById','activation_updated','delete','has','Segment\x20not\x20found:\x20','activation_created','values','valid','nameToType','description','Segment\x20not\x20found','__pending_','diff','localName','ACTIVATION_UPDATE_ERROR','Embedded\x20segment\x20\x27','\x20journey\x20from\x20file:\x20','digest','\x27\x20for\x20','logSuccess','null','entry','flatMap','journey_entry_criteria_','updateActivation','data','\x27\x20not\x20found\x20in\x20journey\x20\x27','activation_template_id','get','relative','createJourneySegment','created','Creating\x20activation\x20\x27','updated','journeyActivationStepId','find','Matched\x20server\x20segment\x20\x27','journeyBundleId','\x27\x20from\x20file:\x20','behavior','17743cHFJtw','Created\x20activation\x20\x27','DecisionPoint','journeys','createActivation','isNew','embedded_activation_created','listActivations','deleteSegment','segments','segmentFolderId','stringify','relationships','steps','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','goal\x20criteria','milestone','attributes','16CROOJe','1018654cCIioU','Deleted\x20segment\x20\x27','SEGMENT_NOT_FOUND','nameToId','getSegment','embeddedSegmentNameToId','./child-segment-yaml.js','validatedRequest','trim','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','create','SEGMENT_UPDATE_ERROR','\x27...','./journey-yaml.js','state','\x27\x20wait\x20condition','1619181eycvnW','isArray','versionNumber','folder_created','existingJourney','1412955Kyrxyn','schedule','activation_deleted','Failed\x20to\x20fetch\x20referenced\x20segment\x20','goal','embedded_segment_creating','Deleting\x20activation\x20\x27','yamlActivation','Name\x20has\x20already\x20been\x20taken','WaitStep','some','connectionIdToNameMap','parse','JOURNEY_UPDATE_ERROR','Updated\x20segment\x20\x27','all_columns','folderPathToId','resolveJourneyId','add','entryCriteria','waitStepUnit','exitCriterias','Updated\x20activation\x20\x27','notification','parentFolder','existingSegment','Duration','index','onProgress','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','resolvedRule','NOT_FOUND','connector_config','getLatestJourneyId','sha1','Failed\x20to\x20','logDeleted','activationStepsById','Stage\x20\x27','createdSegmentId','sort','slice','activationParams','object','embedded_segment_created','../../utils/async.js','segmentByFolderAndName','activation_updating','waitStep','withProgress','results','branches','join','startsWith','journeyId','toLowerCase','segment','journey_updating','push','stages','Activation','journeyBundleName','conditions','folderPath','journeyStages','toISOString','max','progress','journeyById','journey_updated','journey_created','):\x20','resolveSegment','entries','decision_point','\x20(referenced\x20in\x20journey\x20','getSegmentEntity\x20also\x20failed\x20for\x20','size','length','utf-8','segmentId','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','tdx.sdk.push-workflow','logInfo','Entry\x20criteria:\x20','parentId','activation_','logWarning','filter','Created\x20journey\x20\x27','journeyActivationNameToId','conditionTimeoutUnit','hex','INTERNAL','rule','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','draft','segment_updating','Condition','stage\x20\x27','Failed\x20to\x20resolve\x20activation\x20','Created\x20segment\x20\x27','segment_deleted','\x20segment\x20from\x20file:\x20','set','reduce','segment_created','segmentNameToId','\x0a\x20\x20','type','2GgEend','deleted',').\x20','split','from','JOURNEY_SYNTAX_ERROR','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','message'];a156_0x38b5=function(){return _0x2b25d3;};return a156_0x38b5();}async function syncActivationsForSegment(_0x326800,_0x19b2d8,_0x5f4914,_0x2d7054,_0x41f443,_0x2a0225,_0x57999a){const _0x45d6cc=a156_0x4b23a2,_0x53082d={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x51570f of _0x41f443){try{if(_0x51570f['type']===_0x45d6cc(0x1db)&&_0x51570f[_0x45d6cc(0x1d8)])_0x2a0225[_0x45d6cc(0x202)]?.({'type':_0x45d6cc(0x27a),'segmentName':_0x2d7054,'activationName':_0x51570f[_0x45d6cc(0x26b)]}),await _0x2a0225[_0x45d6cc(0x217)](_0x45d6cc(0x2b8)+_0x51570f[_0x45d6cc(0x26b)]+'\x27...',()=>_0x326800[_0x45d6cc(0x21e)][_0x45d6cc(0x2c4)](_0x19b2d8,_0x5f4914,_0x51570f[_0x45d6cc(0x1d8)])),_0x2a0225[_0x45d6cc(0x202)]?.({'type':_0x45d6cc(0x29d),'segmentName':_0x2d7054,'activationName':_0x51570f['name']}),_0x2a0225[_0x45d6cc(0x2ab)]?.(_0x45d6cc(0x2c1)+_0x51570f[_0x45d6cc(0x26b)]+'\x27'),_0x53082d[_0x45d6cc(0x2b7)]++;else{if(_0x51570f[_0x45d6cc(0x253)]===_0x45d6cc(0x263)&&_0x51570f['validatedRequest']&&_0x51570f['existingActivation'])_0x2a0225[_0x45d6cc(0x202)]?.({'type':_0x45d6cc(0x215),'segmentName':_0x2d7054,'activationName':_0x51570f[_0x45d6cc(0x26b)]}),await _0x2a0225['withProgress']('Updating\x20activation\x20\x27'+_0x51570f[_0x45d6cc(0x26b)]+_0x45d6cc(0x1dd),()=>_0x326800['segment'][_0x45d6cc(0x2b0)](_0x19b2d8,_0x5f4914,_0x51570f[_0x45d6cc(0x26a)]['id'],_0x51570f[_0x45d6cc(0x1d8)])),_0x2a0225[_0x45d6cc(0x202)]?.({'type':_0x45d6cc(0x299),'segmentName':_0x2d7054,'activationName':_0x51570f[_0x45d6cc(0x26b)]}),_0x2a0225[_0x45d6cc(0x2ab)]?.(_0x45d6cc(0x1fc)+_0x51570f[_0x45d6cc(0x26b)]+'\x27'),_0x53082d[_0x45d6cc(0x2b9)]++;else _0x51570f[_0x45d6cc(0x253)]===_0x45d6cc(0x29a)&&_0x51570f[_0x45d6cc(0x26a)]&&(_0x2a0225['onProgress']?.({'type':'activation_deleting','segmentName':_0x2d7054,'activationName':_0x51570f[_0x45d6cc(0x26b)]}),await _0x2a0225[_0x45d6cc(0x217)](_0x45d6cc(0x1ec)+_0x51570f['name']+_0x45d6cc(0x1dd),()=>_0x326800[_0x45d6cc(0x21e)]['deleteActivation'](_0x19b2d8,_0x5f4914,_0x51570f['existingActivation']['id'])),_0x2a0225[_0x45d6cc(0x202)]?.({'type':_0x45d6cc(0x1e8),'segmentName':_0x2d7054,'activationName':_0x51570f[_0x45d6cc(0x26b)]}),_0x2a0225[_0x45d6cc(0x20a)]?.('Deleted\x20activation\x20\x27'+_0x51570f[_0x45d6cc(0x26b)]+'\x27'),_0x53082d[_0x45d6cc(0x255)]++);}}catch(_0x273d12){const _0x333a77=isHttp400Error(_0x273d12),_0x55220b=_0x333a77?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x45d6cc(0x2a6)],_0xd0591f=getErrorMessage(_0x273d12);throw new SDKError(_0x55220b,_0x45d6cc(0x209)+_0x51570f[_0x45d6cc(0x253)]+'\x20activation\x20\x27'+_0x51570f[_0x45d6cc(0x26b)]+_0x45d6cc(0x2be)+_0x57999a+_0x45d6cc(0x252)+_0xd0591f,_0x273d12);}}return _0x53082d;}export async function executePushFolders(_0x48449c,_0x5b6cf8,_0x5367d7,_0x31d8a7,_0x4b484d){const _0x2efa0f=a156_0x4b23a2,_0x145497=new Map(_0x5367d7),_0x42227c=sortFoldersByDepth(_0x5b6cf8);for(const _0x2b36b6 of _0x42227c){const _0x154606=_0x2b36b6[_0x2efa0f(0x257)]('/'),_0x4dc122=_0x154606[_0x154606[_0x2efa0f(0x234)]-0x1],_0x471af3=_0x154606[_0x2efa0f(0x20f)](0x0,-0x1)[_0x2efa0f(0x21a)]('/'),_0x58b47a=_0x145497[_0x2efa0f(0x2b4)](_0x471af3);_0x4b484d[_0x2efa0f(0x202)]?.({'type':_0x2efa0f(0x275),'folder':_0x2b36b6});const _0xa05c36={'name':_0x4dc122,'parentFolderId':_0x58b47a},_0x1fdde7=await _0x4b484d[_0x2efa0f(0x217)](_0x2efa0f(0x287)+_0x2b36b6+_0x2efa0f(0x1dd),()=>_0x48449c[_0x2efa0f(0x21e)]['createFolder'](_0x31d8a7[_0x2efa0f(0x23b)],_0xa05c36));_0x145497['set'](_0x2b36b6,_0x1fdde7[_0x2efa0f(0x2b1)]['id']),_0x4b484d['onProgress']?.({'type':_0x2efa0f(0x1e4),'folder':_0x2b36b6,'folderId':_0x1fdde7[_0x2efa0f(0x2b1)]['id']}),_0x4b484d[_0x2efa0f(0x239)]?.('Created\x20folder\x20\x27'+_0x2b36b6+'\x27');}return _0x145497;}export async function executePushSegmentDeletions(_0x314d2c,_0x389705,_0x2776ff){const _0x1a9754=a156_0x4b23a2;if(_0x389705[_0x1a9754(0x234)]===0x0)return 0x0;const {batchAsync:_0x25c2dd}=await import(_0x1a9754(0x213)),_0x4d411=0x5,_0x5d5b6f=await _0x25c2dd(_0x389705,async _0x39216d=>{const _0x4cc7fb=_0x1a9754;return _0x2776ff[_0x4cc7fb(0x202)]?.({'type':'segment_deleting','name':_0x39216d[_0x4cc7fb(0x26b)]}),await _0x314d2c[_0x4cc7fb(0x21e)][_0x4cc7fb(0x1c6)](_0x39216d['id']),_0x2776ff['onProgress']?.({'type':_0x4cc7fb(0x24c),'name':_0x39216d[_0x4cc7fb(0x26b)]}),_0x2776ff['logDeleted']?.(_0x4cc7fb(0x1d2)+_0x39216d['name']+'\x27'),0x1;},_0x4d411);return _0x5d5b6f[_0x1a9754(0x24f)]((_0x5d07e7,_0x32a9e9)=>_0x5d07e7+_0x32a9e9,0x0);}export async function executePushJourneys(_0x1d7d76,_0x22315e,_0x466bd3,_0xd393ba,_0x26abf4){const _0x2b62a9=a156_0x4b23a2,{journeyDefToRequest:_0x4ed9fd}=await import(_0x2b62a9(0x1de)),{activationDefToCreateRequest:_0x16ecd8,yamlRuleToApi:_0x25b63e,validateSegmentRule:_0x2cb903}=await import('./child-segment-yaml.js'),_0x3166d4={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4a198b=new Map(_0x466bd3[_0x2b62a9(0x251)]),_0x7ea0d2=0x5;for(let _0x185069=0x0;_0x185069<_0x22315e[_0x2b62a9(0x234)];_0x185069+=_0x7ea0d2){const _0x4f7147=_0x22315e[_0x2b62a9(0x20f)](_0x185069,_0x185069+_0x7ea0d2),_0x3bdfc7=await Promise['all'](_0x4f7147[_0x2b62a9(0x262)](async _0x5e8697=>{const _0x4221db=_0x2b62a9;if(!_0x5e8697['isNew']&&!_0x5e8697[_0x4221db(0x265)])return{'action':_0x4221db(0x291),'name':_0x5e8697[_0x4221db(0x272)]['name'],'journeyId':_0x5e8697['existingJourney']?.['id']};const _0x1c3b4f=_0x5e8697['folderPath']?_0x466bd3[_0x4221db(0x1f6)]['get'](_0x5e8697[_0x4221db(0x225)]):undefined;_0x26abf4[_0x4221db(0x202)]?.({'type':_0x5e8697['isNew']?'journey_creating':_0x4221db(0x21f),'name':_0x5e8697[_0x4221db(0x272)][_0x4221db(0x26b)]});try{const _0x4dfad2=await executeSingleJourneyPush(_0x1d7d76,_0x5e8697,{..._0x466bd3,'segmentNameToId':_0x4a198b},{'parentId':_0xd393ba['parentId'],'rootFolderId':_0xd393ba[_0x4221db(0x268)],'folderId':_0x1c3b4f,'verbose':_0xd393ba['verbose']},_0x26abf4,{'journeyDefToRequest':_0x4ed9fd,'activationDefToCreateRequest':_0x16ecd8,'yamlRuleToApi':_0x25b63e,'validateSegmentRule':_0x2cb903});for(const [_0x2cb9f6,_0x58c11f]of _0x4dfad2[_0x4221db(0x1d6)]){_0x4a198b[_0x4221db(0x24e)](_0x2cb9f6,_0x58c11f),_0x3166d4['embeddedSegmentNameToId'][_0x4221db(0x24e)](_0x2cb9f6,_0x58c11f);}if(_0x4dfad2[_0x4221db(0x28a)]==='created')_0x26abf4['onProgress']?.({'type':_0x4221db(0x22c),'name':_0x5e8697[_0x4221db(0x272)]['name'],'journeyId':_0x4dfad2['journeyId']}),_0x26abf4[_0x4221db(0x2ab)]?.(_0x4221db(0x23f)+_0x5e8697[_0x4221db(0x272)][_0x4221db(0x26b)]+'\x27'),_0x3166d4[_0x4221db(0x2b7)]++;else _0x4dfad2[_0x4221db(0x28a)]===_0x4221db(0x2b9)&&(_0x26abf4[_0x4221db(0x202)]?.({'type':_0x4221db(0x22b),'name':_0x5e8697[_0x4221db(0x272)][_0x4221db(0x26b)]}),_0x26abf4[_0x4221db(0x2ab)]?.(_0x4221db(0x27d)+_0x5e8697[_0x4221db(0x272)][_0x4221db(0x26b)]+'\x27'),_0x3166d4[_0x4221db(0x2b9)]++);return{'action':_0x4dfad2[_0x4221db(0x28a)],'name':_0x5e8697[_0x4221db(0x272)][_0x4221db(0x26b)],'journeyId':_0x4dfad2[_0x4221db(0x21c)]};}catch(_0x4c0e7c){const _0x1e21a9=isHttp400Error(_0x4c0e7c),_0x3dd6fe=_0x1e21a9?ErrorCode[_0x4221db(0x259)]:ErrorCode[_0x4221db(0x1f3)],_0x391260=getErrorMessage(_0x4c0e7c);throw new SDKError(_0x3dd6fe,_0x4221db(0x209)+(_0x5e8697[_0x4221db(0x2c5)]?_0x4221db(0x1db):_0x4221db(0x263))+_0x4221db(0x2a8)+_0x5e8697[_0x4221db(0x280)]+_0x4221db(0x252)+_0x391260,_0x4c0e7c);}}));_0x3166d4[_0x2b62a9(0x218)][_0x2b62a9(0x220)](..._0x3bdfc7);}return _0x3166d4;}async function matchExistingJourneySegments(_0x2b2d10,_0x500820,_0x2dd3a5,_0x43d675,_0x284d7a){const _0x34f9b0=a156_0x4b23a2;if(!_0x500820[_0x34f9b0(0x1e5)]||!_0x500820[_0x34f9b0(0x272)][_0x34f9b0(0x1c7)])return;const _0x5162e8=new Map(),_0x16b844=new Set();for(const _0x358f6b of Object[_0x34f9b0(0x297)](_0x500820[_0x34f9b0(0x272)][_0x34f9b0(0x1c7)])){const _0x35bc71=generateDeterministicJourneySegmentName(_0x500820[_0x34f9b0(0x272)][_0x34f9b0(0x26b)],_0x358f6b);_0x5162e8[_0x34f9b0(0x24e)](_0x35bc71,_0x358f6b),_0x16b844[_0x34f9b0(0x1f8)](_0x358f6b);}const _0x496a89=[],_0x1e8e8f=collectSegmentIdsFromJourneyApi(_0x500820[_0x34f9b0(0x1e5)]);for(const _0x55dfb5 of _0x1e8e8f){const _0x3b7fc4=await fetchSegment(_0x2b2d10,_0x2dd3a5,_0x55dfb5,_0x43d675);if(!_0x3b7fc4?.['name'])continue;const _0x250f3b=_0x5162e8[_0x34f9b0(0x2b4)](_0x3b7fc4[_0x34f9b0(0x26b)]);_0x250f3b?(_0x284d7a[_0x34f9b0(0x24e)](_0x250f3b,_0x55dfb5),_0x16b844[_0x34f9b0(0x29a)](_0x250f3b)):_0x496a89[_0x34f9b0(0x220)]({'id':_0x55dfb5,'seg':_0x3b7fc4});}if(_0x16b844[_0x34f9b0(0x233)]>0x0&&_0x496a89['length']>0x0){const {localExpandedRuleToNames:_0xcd756}=buildLocalExpandedRuleMappings(_0x500820[_0x34f9b0(0x272)]),_0xe02abe=new Map();for(const {id:_0x3eaa8c,seg:_0x4b7ab3}of _0x496a89){if(_0x4b7ab3['rule']){const _0x3b8622=apiRuleToYaml(_0x4b7ab3['rule']);_0xe02abe[_0x34f9b0(0x24e)](_0x3eaa8c,_0x3b8622);}}for(const {id:_0x2cb8e1,seg:_0x57ba00}of _0x496a89){if(!_0x57ba00[_0x34f9b0(0x244)])continue;const _0x268df3=_0xe02abe['get'](_0x2cb8e1);if(!_0x268df3)continue;const _0x2725a3=serializeExpandedRule(_0x268df3,_0xe02abe),_0xad4e96=_0xcd756['get'](_0x2725a3);if(_0xad4e96){const _0x17f45a=_0xad4e96[_0x34f9b0(0x2bb)](_0x153dd7=>_0x16b844[_0x34f9b0(0x29b)](_0x153dd7));_0x17f45a&&(_0x284d7a[_0x34f9b0(0x24e)](_0x17f45a,_0x2cb8e1),_0x16b844[_0x34f9b0(0x29a)](_0x17f45a),logger['debug'](_0x34f9b0(0x2bc)+_0x57ba00[_0x34f9b0(0x26b)]+_0x34f9b0(0x270)+_0x17f45a+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x522837,_0x1e306f,_0x2354b7,_0x3f3757,_0xa53160,_0x2b20f2){const _0xb929e3=a156_0x4b23a2,{journeyDefToRequest:_0x44c7c5,activationDefToCreateRequest:_0x5976b3,yamlRuleToApi:_0x16c491,validateSegmentRule:_0x3e56a5}=_0x2b20f2,_0x5ef2f8=new Map(),_0x2a0f80=new Map();recoverSegmentIdsFromPushRecovery(_0x1e306f,_0x5ef2f8,_0x2354b7[_0xb929e3(0x251)]);const _0x5676fd=new Map(),_0x22b5bd=new Map(),_0x1836b5=new Map();let _0x540c9c;const _0x101666=async()=>{const _0x55677f=_0xb929e3;if(_0x540c9c)return;_0x540c9c=new Map();if(!_0x1e306f[_0x55677f(0x1e5)])return;const _0x151618=await _0x522837[_0x55677f(0x277)][_0x55677f(0x1c5)](_0x1e306f[_0x55677f(0x1e5)]['id']);for(const _0x3dfc50 of _0x151618){const _0x402965=journeyActivationStepToYaml(_0x3dfc50,_0x2354b7[_0x55677f(0x286)],_0x2354b7[_0x55677f(0x1f1)]),_0x4ac2d7=activationSignature(_0x402965);!_0x540c9c[_0x55677f(0x29b)](_0x4ac2d7)&&_0x540c9c[_0x55677f(0x24e)](_0x4ac2d7,_0x3dfc50['id']),_0x402965[_0x55677f(0x26b)]&&_0x2a0f80[_0x55677f(0x24e)](_0x402965[_0x55677f(0x26b)],_0x3dfc50['id']);}};await matchExistingJourneySegments(_0x522837,_0x1e306f,_0x3f3757[_0xb929e3(0x23b)],_0x2354b7[_0xb929e3(0x282)],_0x2354b7[_0xb929e3(0x251)]);const _0x39c82b={'resolveSegmentId':async _0x3dacdb=>{const _0x2d0194=_0xb929e3,_0x448ff2=_0x2354b7[_0x2d0194(0x251)][_0x2d0194(0x2b4)](_0x3dacdb);if(!_0x448ff2)throw new SDKError(ErrorCode[_0x2d0194(0x1d3)],_0x2d0194(0x29c)+_0x3dacdb+_0x2d0194(0x231)+_0x1e306f[_0x2d0194(0x272)][_0x2d0194(0x26b)]+')');return _0x448ff2;},'resolveEmbeddedSegmentId':async(_0x4644ec,_0x2811a0)=>{const _0x4ac309=_0xb929e3,_0x30456f=_0x2354b7[_0x4ac309(0x251)]['get'](_0x4644ec);if(_0x30456f)return _0x30456f;const _0x5f1103=_0x2354b7[_0x4ac309(0x282)]['find'](_0x178659=>_0x178659[_0x4ac309(0x26b)]===_0x4644ec);if(_0x5f1103)return _0x2354b7[_0x4ac309(0x251)][_0x4ac309(0x24e)](_0x4644ec,_0x5f1103['id']),_0x5f1103['id'];if(_0x1e306f[_0x4ac309(0x2c5)]){const {stageName:_0x444831,criteriaName:_0x39606c}=findSegmentCriteriaLocation(_0x1e306f['yamlConfig'],_0x4644ec);return _0x3e56a5(_0x4644ec,_0x2811a0[_0x4ac309(0x244)]),_0x22b5bd[_0x4ac309(0x24e)](_0x4644ec,{'definition':_0x2811a0,'stageName':_0x444831,'criteriaName':_0x39606c}),createPendingSegmentId(_0x4644ec);}const _0x16318f=_0x1e306f[_0x4ac309(0x1e5)]?.['id'];if(!_0x16318f)throw new SDKError(ErrorCode['INTERNAL'],_0x4ac309(0x245));const _0xb4bdbc=_0x5676fd[_0x4ac309(0x2b4)](_0x4644ec);if(_0xb4bdbc)return _0xb4bdbc;const _0x42c409=((async()=>{const _0x2598e9=_0x4ac309;_0x3e56a5(_0x4644ec,_0x2811a0[_0x2598e9(0x244)]);const _0x130451=generateDeterministicJourneySegmentName(_0x1e306f['yamlConfig']['name'],_0x4644ec),_0x4e4db9=_0x2354b7[_0x2598e9(0x282)][_0x2598e9(0x2bb)](_0x121652=>_0x121652[_0x2598e9(0x26b)]===_0x130451),_0x14ca37=createSegmentIdResolver(_0x2354b7[_0x2598e9(0x251)],_0x4644ec),_0x15df3b=await resolveRuleSegmentIds(_0x2811a0['rule'],_0x14ca37);let _0x57bb8d;return _0x4e4db9?(await _0x522837[_0x2598e9(0x21e)]['updateSegmentById'](_0x3f3757[_0x2598e9(0x23b)],_0x4e4db9['id'],{'description':_0x2811a0[_0x2598e9(0x2a1)]||_0x2598e9(0x23a)+_0x4644ec,'rule':_0x16c491(_0x15df3b),'countPopulation':!![]}),_0x57bb8d=_0x4e4db9['id'],saveSegmentToPushRecovery(_0x1e306f['absolutePath'],_0x1e306f['yamlConfig']['name'],_0x4644ec,{'segmentId':_0x57bb8d,'uniqueServerName':_0x130451,'createdAt':new Date()[_0x2598e9(0x227)]()})):_0x57bb8d=await createOrRecoverEmbeddedSegment(_0x522837,_0x1e306f,{'localName':_0x4644ec,'uniqueSegmentName':_0x130451,'description':_0x2811a0[_0x2598e9(0x2a1)]||_0x2598e9(0x23a)+_0x4644ec,'journeyId':_0x16318f,'resolvedRule':_0x15df3b,'parentId':_0x3f3757[_0x2598e9(0x23b)],'folderId':_0x3f3757[_0x2598e9(0x268)]||''},_0x16c491),_0x2354b7[_0x2598e9(0x251)][_0x2598e9(0x24e)](_0x4644ec,_0x57bb8d),_0x5ef2f8[_0x2598e9(0x24e)](_0x4644ec,_0x57bb8d),_0x57bb8d;})());_0x5676fd[_0x4ac309(0x24e)](_0x4644ec,_0x42c409);try{return await _0x42c409;}finally{_0x5676fd['delete'](_0x4644ec);}},'resolveActivationId':async _0x215a21=>{const _0x170e66=_0xb929e3,_0x4ed5f1=_0x2a0f80[_0x170e66(0x2b4)](_0x215a21);if(_0x4ed5f1)return _0x4ed5f1;if(_0x1e306f[_0x170e66(0x1e5)]){await _0x101666();const _0x1e924e=_0x2a0f80['get'](_0x215a21);if(_0x1e924e)return _0x1e924e;}throw new SDKError(ErrorCode[_0x170e66(0x205)],'Activation\x20not\x20found:\x20'+_0x215a21+_0x170e66(0x231)+_0x1e306f[_0x170e66(0x272)][_0x170e66(0x26b)]+_0x170e66(0x256)+_0x170e66(0x25e));},'resolveEmbeddedActivationId':async(_0x45ca90,_0x361ca1)=>{const _0x14e888=_0xb929e3,_0x343b16=_0x2a0f80[_0x14e888(0x2b4)](_0x45ca90);if(_0x343b16)return _0x343b16;if(_0x1e306f[_0x14e888(0x2c5)])return _0x1836b5[_0x14e888(0x24e)](_0x45ca90,_0x361ca1),createPendingActivationId(_0x45ca90);if(_0x1e306f[_0x14e888(0x1e5)]){await _0x101666();const _0x169c5c=_0x2a0f80[_0x14e888(0x2b4)](_0x361ca1[_0x14e888(0x26b)]);if(_0x169c5c)return _0x2a0f80[_0x14e888(0x24e)](_0x45ca90,_0x169c5c),_0x169c5c;const _0x1f1e98=activationSignature(_0x361ca1),_0x13df8e=_0x540c9c?.['get'](_0x1f1e98);if(_0x13df8e)return _0x2a0f80[_0x14e888(0x24e)](_0x45ca90,_0x13df8e),_0x13df8e;const _0x3f6f9e=await _0x5976b3(_0x361ca1,_0x2354b7[_0x14e888(0x296)]),_0xe40994={..._0x3f6f9e,..._0x361ca1[_0x14e888(0x26c)]!==undefined&&{'runAfterJourneyRefresh':_0x361ca1[_0x14e888(0x26c)]}},_0x4cabda=await _0x522837[_0x14e888(0x277)][_0x14e888(0x2c4)](_0x1e306f[_0x14e888(0x1e5)]['id'],_0xe40994);return _0x2a0f80[_0x14e888(0x24e)](_0x45ca90,_0x4cabda['id']),_0x4cabda['id'];}throw new SDKError(ErrorCode[_0x14e888(0x243)],_0x14e888(0x203));},'resolveJourneyId':async _0x7feba6=>{const _0x192336=_0xb929e3;try{return await _0x522837[_0x192336(0x277)][_0x192336(0x1f7)](_0x3f3757['parentId'],_0x7feba6);}catch(_0x35e3c1){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x7feba6+_0x192336(0x1da)+_0x1e306f['yamlConfig']['name']+'\x27)',_0x35e3c1);}},'resolveStageId':async(_0x2441f0,_0x248930)=>{const _0x113a70=_0xb929e3,_0x58fc0d=await _0x522837[_0x113a70(0x277)][_0x113a70(0x28b)](_0x2441f0),_0x45a60c=_0x58fc0d[_0x113a70(0x1cf)][_0x113a70(0x226)][_0x113a70(0x2bb)](_0x8a2a37=>_0x8a2a37['name'][_0x113a70(0x21d)]()===_0x248930[_0x113a70(0x21d)]());if(!_0x45a60c?.['id'])throw new SDKError(ErrorCode[_0x113a70(0x205)],_0x113a70(0x20c)+_0x248930+_0x113a70(0x2b2)+(_0x58fc0d['attributes']['journeyBundleName']||_0x58fc0d[_0x113a70(0x1cf)][_0x113a70(0x26b)])+'\x27');return _0x45a60c['id'];}},_0x51d363=await _0x44c7c5(_0x1e306f[_0xb929e3(0x272)],_0x3f3757['parentId'],_0x39c82b),_0x48640a=_0x3f3757[_0xb929e3(0x273)]||_0x3f3757[_0xb929e3(0x268)];_0x48640a&&(_0x51d363[_0xb929e3(0x1ca)]={'parentFolder':{'data':{'id':_0x48640a,'type':'folder'}}});if(_0x1e306f[_0xb929e3(0x2c5)]){if(_0x22b5bd['size']>0x0||_0x1836b5[_0xb929e3(0x233)]>0x0)return await executeThreeStepJourneyCreate(_0x522837,_0x1e306f,_0x51d363,{'pendingEmbeddedSegments':_0x22b5bd,'pendingEmbeddedActivations':_0x1836b5,'embeddedSegmentNameToId':_0x5ef2f8,'journeyActivationNameToId':_0x2a0f80},{..._0x3f3757,'effectiveFolderId':_0x48640a},_0x2354b7,_0xa53160,_0x2b20f2);else{ensureJourneyDefaults(_0x51d363[_0xb929e3(0x1cf)]);const _0x1569c8=await _0x522837[_0xb929e3(0x277)]['create'](_0x51d363);return deletePushRecovery(_0x1e306f[_0xb929e3(0x280)]),{'action':_0xb929e3(0x2b7),'journeyId':_0x1569c8['id'],'embeddedSegmentNameToId':_0x5ef2f8};}}else{if(_0x1e306f[_0xb929e3(0x265)]&&_0x1e306f[_0xb929e3(0x1e5)]){_0x51d363['id']=_0x1e306f[_0xb929e3(0x1e5)]['id'];const _0x14f30a=_0x51d363[_0xb929e3(0x1cf)];_0x1e306f[_0xb929e3(0x1e5)][_0xb929e3(0x1cf)]?.[_0xb929e3(0x223)]&&(_0x14f30a[_0xb929e3(0x223)]=_0x1e306f[_0xb929e3(0x1e5)][_0xb929e3(0x1cf)][_0xb929e3(0x223)]);const _0x27a865=_0x1e306f[_0xb929e3(0x1e5)][_0xb929e3(0x1cf)]?.[_0xb929e3(0x226)];return _0x27a865&&_0x51d363['attributes']['journeyStages']&&injectExistingStageIds(_0x51d363[_0xb929e3(0x1cf)][_0xb929e3(0x226)],_0x27a865),ensureJourneyDefaults(_0x14f30a),await _0x522837[_0xb929e3(0x277)][_0xb929e3(0x263)](_0x1e306f[_0xb929e3(0x1e5)]['id'],_0x51d363),deletePushRecovery(_0x1e306f[_0xb929e3(0x280)]),{'action':_0xb929e3(0x2b9),'journeyId':_0x1e306f[_0xb929e3(0x1e5)]['id'],'embeddedSegmentNameToId':_0x5ef2f8};}}return deletePushRecovery(_0x1e306f[_0xb929e3(0x280)]),{'action':_0xb929e3(0x291),'journeyId':_0x1e306f[_0xb929e3(0x1e5)]?.['id'],'embeddedSegmentNameToId':_0x5ef2f8};}function findSegmentCriteriaLocation(_0x3d0d9d,_0x4b7eed){const _0x3d2526=a156_0x4b23a2,_0x177404=_0x3d0d9d[_0x3d2526(0x221)]||_0x3d0d9d[_0x3d2526(0x2c3)]?.[0x0]?.[_0x3d2526(0x221)]||[];let _0x54aac1=_0x3d2526(0x2ad),_0x4ca7c7=_0x4b7eed;const _0x2b93bd=_0x3d0d9d[_0x3d2526(0x1ea)]||_0x3d0d9d['journeys']?.[0x0]?.[_0x3d2526(0x1ea)];if(_0x2b93bd?.[_0x3d2526(0x21e)]===_0x4b7eed)return{'stageName':'goal','criteriaName':_0x2b93bd[_0x3d2526(0x26b)]||_0x4b7eed};_0x941c1b:for(const _0x133466 of _0x177404){if(_0x133466['entry_criteria']?.[_0x3d2526(0x21e)]===_0x4b7eed){_0x54aac1=_0x133466[_0x3d2526(0x26b)],_0x4ca7c7=_0x133466['entry_criteria'][_0x3d2526(0x26b)]||_0x4b7eed;break;}if(_0x133466[_0x3d2526(0x1cb)])for(const _0x5ced13 of _0x133466[_0x3d2526(0x1cb)]){if(_0x5ced13['type']===_0x3d2526(0x230)&&_0x5ced13['with']?.[_0x3d2526(0x219)])for(const _0x2d2ea6 of _0x5ced13[_0x3d2526(0x261)]['branches']){if(_0x2d2ea6[_0x3d2526(0x21e)]===_0x4b7eed){_0x54aac1=_0x133466['name'],_0x4ca7c7=_0x2d2ea6['name']||_0x4b7eed;break _0x941c1b;}}}}return{'stageName':_0x54aac1,'criteriaName':_0x4ca7c7};}async function executeThreeStepJourneyCreate(_0x40c0d0,_0x87c51e,_0x3a4e2d,_0x42faab,_0x35510b,_0x1790a7,_0x2e4a10,_0x11067f){const _0xed7b1f=a156_0x4b23a2,{activationDefToCreateRequest:_0x4a0b71,yamlRuleToApi:_0x11c4a2}=_0x11067f,{pendingEmbeddedSegments:_0x70aadb,pendingEmbeddedActivations:_0x1fb7cc,embeddedSegmentNameToId:_0x140508}=_0x42faab,_0x4a8cd4=JSON[_0xed7b1f(0x1f2)](JSON[_0xed7b1f(0x1c9)](_0x3a4e2d));ensureJourneyDefaults(_0x4a8cd4['attributes']),stripPendingIds(_0x4a8cd4);const _0x42814a=await _0x40c0d0['journey'][_0xed7b1f(0x1db)](_0x4a8cd4),_0xf213b6=_0x42814a['id'],_0x22cb53=new Map();for(const _0x4a55b1 of _0x42814a[_0xed7b1f(0x1cf)]['journeyStages']){_0x22cb53[_0xed7b1f(0x24e)](_0x4a55b1[_0xed7b1f(0x26b)]['toLowerCase'](),_0x4a55b1['id']);}recoverSegmentIdsFromPushRecovery(_0x87c51e,_0x140508,_0x1790a7['segmentNameToId']);for(const [_0x132567,{definition:_0x4403b2}]of _0x70aadb){if(_0x140508['has'](_0x132567)){_0x2e4a10[_0xed7b1f(0x202)]?.({'type':_0xed7b1f(0x212),'journeyName':_0x87c51e['yamlConfig']['name'],'segmentName':_0x132567});continue;}const _0x349945=generateDeterministicJourneySegmentName(_0x87c51e[_0xed7b1f(0x272)]['name'],_0x132567);_0x2e4a10[_0xed7b1f(0x202)]?.({'type':_0xed7b1f(0x1eb),'journeyName':_0x87c51e[_0xed7b1f(0x272)][_0xed7b1f(0x26b)],'segmentName':_0x132567});const _0x3dab1f=createSegmentIdResolver(_0x1790a7[_0xed7b1f(0x251)],_0x132567),_0x5a4561=await resolveRuleSegmentIds(_0x4403b2[_0xed7b1f(0x244)],_0x3dab1f),_0x2b27a9=await createOrRecoverEmbeddedSegment(_0x40c0d0,_0x87c51e,{'localName':_0x132567,'uniqueSegmentName':_0x349945,'description':_0x4403b2[_0xed7b1f(0x2a1)]||_0xed7b1f(0x23a)+_0x132567,'journeyId':_0xf213b6,'resolvedRule':_0x5a4561,'parentId':_0x35510b['parentId'],'folderId':_0x35510b[_0xed7b1f(0x283)]||''},_0x11c4a2);_0x140508['set'](_0x132567,_0x2b27a9),_0x1790a7[_0xed7b1f(0x251)][_0xed7b1f(0x24e)](_0x132567,_0x2b27a9),_0x2e4a10[_0xed7b1f(0x202)]?.({'type':_0xed7b1f(0x212),'journeyName':_0x87c51e[_0xed7b1f(0x272)]['name'],'segmentName':_0x132567});}const _0x44f962=new Map();for(const [_0x35051c,_0x460d6d]of _0x1fb7cc){_0x2e4a10[_0xed7b1f(0x202)]?.({'type':'embedded_activation_creating','journeyName':_0x87c51e[_0xed7b1f(0x272)][_0xed7b1f(0x26b)],'activationName':_0x35051c});const _0x3a4940=await _0x4a0b71(_0x460d6d,_0x1790a7[_0xed7b1f(0x296)]),_0x333410={..._0x3a4940,..._0x460d6d[_0xed7b1f(0x26c)]!==undefined&&{'runAfterJourneyRefresh':_0x460d6d[_0xed7b1f(0x26c)]}},_0x2bbd89=await _0x40c0d0[_0xed7b1f(0x277)][_0xed7b1f(0x2c4)](_0xf213b6,_0x333410);_0x44f962[_0xed7b1f(0x24e)](_0x35051c,_0x2bbd89['id']),_0x42faab[_0xed7b1f(0x240)][_0xed7b1f(0x24e)](_0x35051c,_0x2bbd89['id']),_0x2e4a10[_0xed7b1f(0x202)]?.({'type':_0xed7b1f(0x1c4),'journeyName':_0x87c51e[_0xed7b1f(0x272)][_0xed7b1f(0x26b)],'activationName':_0x35051c});}const _0x3ac52d=JSON[_0xed7b1f(0x1f2)](JSON[_0xed7b1f(0x1c9)](_0x3a4e2d));return _0x3ac52d['id']=_0xf213b6,ensureJourneyDefaults(_0x3ac52d[_0xed7b1f(0x1cf)]),resolvePendingIdsInRequest(_0x3ac52d,_0x3a4e2d,_0x22cb53,_0x140508,_0x44f962,_0x2e4a10),await _0x40c0d0['journey'][_0xed7b1f(0x263)](_0xf213b6,_0x3ac52d),deletePushRecovery(_0x87c51e[_0xed7b1f(0x280)]),{'action':_0xed7b1f(0x2b7),'journeyId':_0xf213b6,'embeddedSegmentNameToId':_0x140508};}export function stripWaitStepPendingIds(_0x57571d){const _0x2bd3b3=a156_0x4b23a2,_0x33178=_0x57571d['conditionSegmentId']&&isPendingSegmentId(_0x57571d[_0x2bd3b3(0x285)]),_0x462fc2=_0x57571d['conditions']?.[_0x2bd3b3(0x1f0)](_0x1004e3=>_0x1004e3[_0x2bd3b3(0x236)]&&isPendingSegmentId(_0x1004e3[_0x2bd3b3(0x236)]));(_0x33178||_0x462fc2)&&(_0x57571d[_0x2bd3b3(0x27e)]=_0x2bd3b3(0x200),_0x57571d[_0x2bd3b3(0x216)]=0x1,_0x57571d[_0x2bd3b3(0x1fa)]='day',delete _0x57571d[_0x2bd3b3(0x285)],delete _0x57571d[_0x2bd3b3(0x274)],delete _0x57571d[_0x2bd3b3(0x241)],delete _0x57571d[_0x2bd3b3(0x224)]);}export function resolveWaitStepPendingIds(_0x35657f,_0x4eb388,_0x31a20a,_0x4b3f2d){const _0x4c269f=a156_0x4b23a2;if(_0x4eb388[_0x4c269f(0x285)]&&isPendingSegmentId(_0x4eb388[_0x4c269f(0x285)])){const _0x370ae5=_0x31a20a(_0x4eb388['conditionSegmentId'],_0x4c269f(0x249)+_0x4b3f2d+_0x4c269f(0x1e0));_0x370ae5&&(_0x35657f[_0x4c269f(0x27e)]=_0x4c269f(0x248),_0x35657f[_0x4c269f(0x285)]=_0x370ae5,delete _0x35657f[_0x4c269f(0x216)],delete _0x35657f['waitStepUnit'],_0x4eb388[_0x4c269f(0x274)]!==undefined&&(_0x35657f[_0x4c269f(0x274)]=_0x4eb388[_0x4c269f(0x274)]),_0x4eb388[_0x4c269f(0x241)]&&(_0x35657f['conditionTimeoutUnit']=_0x4eb388[_0x4c269f(0x241)]));}if(_0x4eb388[_0x4c269f(0x224)]){const _0x1bdab6=_0x4eb388[_0x4c269f(0x224)][_0x4c269f(0x1f0)](_0x2f9bd9=>_0x2f9bd9[_0x4c269f(0x236)]&&isPendingSegmentId(_0x2f9bd9[_0x4c269f(0x236)]));if(_0x1bdab6){const _0x5a2978=_0x4eb388[_0x4c269f(0x224)]['map'](_0x486ea8=>{const _0x2d21ea=_0x4c269f;if(_0x486ea8[_0x2d21ea(0x236)]&&isPendingSegmentId(_0x486ea8[_0x2d21ea(0x236)])){const _0x4361b1=_0x31a20a(_0x486ea8[_0x2d21ea(0x236)],_0x2d21ea(0x249)+_0x4b3f2d+'\x27\x20wait\x20condition');return{..._0x486ea8,'segmentId':_0x4361b1||_0x486ea8[_0x2d21ea(0x236)]};}return{..._0x486ea8};});_0x35657f[_0x4c269f(0x27e)]=_0x4c269f(0x248),_0x35657f['conditions']=_0x5a2978,delete _0x35657f['waitStep'],delete _0x35657f[_0x4c269f(0x1fa)],delete _0x35657f[_0x4c269f(0x285)],delete _0x35657f[_0x4c269f(0x274)],delete _0x35657f[_0x4c269f(0x241)];}}}function stripPendingIds(_0x3ce952){const _0x10da23=a156_0x4b23a2;_0x3ce952[_0x10da23(0x1cf)][_0x10da23(0x1ea)]?.[_0x10da23(0x236)]&&isPendingSegmentId(_0x3ce952['attributes'][_0x10da23(0x1ea)][_0x10da23(0x236)])&&delete _0x3ce952[_0x10da23(0x1cf)][_0x10da23(0x1ea)];for(const _0x30e69f of _0x3ce952['attributes'][_0x10da23(0x226)]||[]){_0x30e69f['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x30e69f[_0x10da23(0x1f9)][_0x10da23(0x236)])&&delete _0x30e69f['entryCriteria'];_0x30e69f[_0x10da23(0x1ce)]?.[_0x10da23(0x236)]&&isPendingSegmentId(_0x30e69f[_0x10da23(0x1ce)][_0x10da23(0x236)])&&delete _0x30e69f[_0x10da23(0x1ce)];_0x30e69f['exitCriterias']&&(_0x30e69f[_0x10da23(0x1fb)]=_0x30e69f[_0x10da23(0x1fb)]['filter'](_0x4b53ad=>!_0x4b53ad['segmentId']||!isPendingSegmentId(_0x4b53ad[_0x10da23(0x236)])));if(_0x30e69f[_0x10da23(0x1cb)])for(const _0x250a65 of Object[_0x10da23(0x297)](_0x30e69f[_0x10da23(0x1cb)])){const _0x575c65=_0x30e69f[_0x10da23(0x1cb)][_0x250a65];_0x575c65['type']===_0x10da23(0x222)&&_0x575c65[_0x10da23(0x2ba)]&&isPendingActivationId(_0x575c65[_0x10da23(0x2ba)])&&(_0x575c65[_0x10da23(0x2ba)]='');if(_0x575c65[_0x10da23(0x253)]===_0x10da23(0x2c2)&&_0x575c65[_0x10da23(0x219)])for(const _0x2dbc9a of _0x575c65[_0x10da23(0x219)]){_0x2dbc9a[_0x10da23(0x236)]&&isPendingSegmentId(_0x2dbc9a[_0x10da23(0x236)])&&(_0x2dbc9a[_0x10da23(0x236)]='');}_0x575c65[_0x10da23(0x253)]===_0x10da23(0x1ef)&&stripWaitStepPendingIds(_0x575c65);}}}function resolvePendingIdsInRequest(_0x3788a4,_0x32cea9,_0x24fd94,_0x5aad98,_0x3011f2,_0x28a83b){const _0x35bf6a=a156_0x4b23a2,_0x1ee2ca=(_0x1ffd7b,_0x8170f)=>{const _0x42541c=a156_0x4c9d;if(!isPendingSegmentId(_0x1ffd7b))return _0x1ffd7b;const _0x27a2b0=extractPendingSegmentName(_0x1ffd7b),_0x239a98=_0x5aad98[_0x42541c(0x2b4)](_0x27a2b0);return!_0x239a98&&_0x28a83b[_0x42541c(0x23d)]?.(_0x42541c(0x25a)+_0x27a2b0+_0x42541c(0x2aa)+_0x8170f),_0x239a98;};if(_0x3788a4[_0x35bf6a(0x1cf)][_0x35bf6a(0x1ea)]?.[_0x35bf6a(0x236)]&&isPendingSegmentId(_0x3788a4['attributes']['goal'][_0x35bf6a(0x236)])){const _0x113fab=_0x1ee2ca(_0x3788a4['attributes']['goal'][_0x35bf6a(0x236)],_0x35bf6a(0x1cd));_0x113fab&&(_0x3788a4['attributes'][_0x35bf6a(0x1ea)][_0x35bf6a(0x236)]=_0x113fab);}for(const _0x1ae4e5 of _0x3788a4[_0x35bf6a(0x1cf)][_0x35bf6a(0x226)]||[]){const _0x19c5d5=_0x24fd94[_0x35bf6a(0x2b4)](_0x1ae4e5[_0x35bf6a(0x26b)][_0x35bf6a(0x21d)]());_0x19c5d5&&(_0x1ae4e5['id']=_0x19c5d5);if(_0x1ae4e5[_0x35bf6a(0x1f9)]?.[_0x35bf6a(0x236)]&&isPendingSegmentId(_0x1ae4e5['entryCriteria'][_0x35bf6a(0x236)])){const _0x371571=_0x1ee2ca(_0x1ae4e5[_0x35bf6a(0x1f9)][_0x35bf6a(0x236)],_0x35bf6a(0x249)+_0x1ae4e5[_0x35bf6a(0x26b)]+_0x35bf6a(0x260));_0x371571&&(_0x1ae4e5['entryCriteria'][_0x35bf6a(0x236)]=_0x371571);}if(_0x1ae4e5['exitCriterias'])for(const _0x515248 of _0x1ae4e5['exitCriterias']){if(_0x515248['segmentId']&&isPendingSegmentId(_0x515248[_0x35bf6a(0x236)])){const _0x2db05f=_0x1ee2ca(_0x515248[_0x35bf6a(0x236)],_0x35bf6a(0x249)+_0x1ae4e5[_0x35bf6a(0x26b)]+'\x27\x20exit\x20criteria');_0x2db05f&&(_0x515248['segmentId']=_0x2db05f);}}if(_0x1ae4e5[_0x35bf6a(0x1ce)]?.[_0x35bf6a(0x236)]&&isPendingSegmentId(_0x1ae4e5[_0x35bf6a(0x1ce)][_0x35bf6a(0x236)])){const _0x55123e=_0x1ee2ca(_0x1ae4e5[_0x35bf6a(0x1ce)][_0x35bf6a(0x236)],_0x35bf6a(0x249)+_0x1ae4e5[_0x35bf6a(0x26b)]+'\x27\x20milestone');_0x55123e&&(_0x1ae4e5[_0x35bf6a(0x1ce)]['segmentId']=_0x55123e);}if(_0x1ae4e5[_0x35bf6a(0x1cb)]){const _0x44c5aa=_0x400273=>_0x32cea9[_0x35bf6a(0x1cf)][_0x35bf6a(0x226)]?.[_0x35bf6a(0x2bb)](_0x597a8d=>_0x597a8d[_0x35bf6a(0x26b)][_0x35bf6a(0x21d)]()===_0x1ae4e5['name'][_0x35bf6a(0x21d)]())?.[_0x35bf6a(0x1cb)]?.[_0x400273];for(const _0x5d7ea1 of Object[_0x35bf6a(0x297)](_0x1ae4e5[_0x35bf6a(0x1cb)])){const _0x325890=_0x1ae4e5[_0x35bf6a(0x1cb)][_0x5d7ea1],_0x50a870=_0x44c5aa(_0x5d7ea1);if(_0x325890[_0x35bf6a(0x253)]===_0x35bf6a(0x222)&&_0x325890[_0x35bf6a(0x2ba)]&&(isPendingActivationId(_0x325890['journeyActivationStepId'])||_0x325890[_0x35bf6a(0x2ba)]==='')){if(_0x50a870?.[_0x35bf6a(0x2ba)]&&isPendingActivationId(_0x50a870[_0x35bf6a(0x2ba)])){const _0x391401=extractPendingActivationName(_0x50a870[_0x35bf6a(0x2ba)]),_0x4f13e9=_0x3011f2['get'](_0x391401);_0x4f13e9&&(_0x325890['journeyActivationStepId']=_0x4f13e9);}}if(_0x325890[_0x35bf6a(0x253)]==='DecisionPoint'&&_0x325890[_0x35bf6a(0x219)]&&_0x50a870?.[_0x35bf6a(0x219)])for(let _0x10d908=0x0;_0x10d908<_0x325890['branches'][_0x35bf6a(0x234)];_0x10d908++){const _0x1241f3=_0x325890[_0x35bf6a(0x219)][_0x10d908],_0x2a0a58=_0x50a870['branches'][_0x10d908];if(_0x2a0a58?.[_0x35bf6a(0x236)]&&isPendingSegmentId(_0x2a0a58[_0x35bf6a(0x236)])){const _0x24f3f3=_0x1ee2ca(_0x2a0a58[_0x35bf6a(0x236)],'stage\x20\x27'+_0x1ae4e5[_0x35bf6a(0x26b)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x1241f3[_0x35bf6a(0x26b)]||_0x10d908)+'\x27');_0x24f3f3&&(_0x1241f3[_0x35bf6a(0x236)]=_0x24f3f3);}}_0x325890['type']==='WaitStep'&&_0x50a870?.[_0x35bf6a(0x253)]===_0x35bf6a(0x1ef)&&resolveWaitStepPendingIds(_0x325890,_0x50a870,_0x1ee2ca,_0x1ae4e5[_0x35bf6a(0x26b)]);}}}}
@@ -1 +1 @@
1
- (function(_0x52435a,_0x5ba5ea){const _0x591856=a157_0x3cac,_0x4acff3=_0x52435a();while(!![]){try{const _0x445d53=-parseInt(_0x591856(0x80))/0x1*(parseInt(_0x591856(0x7b))/0x2)+-parseInt(_0x591856(0x86))/0x3+parseInt(_0x591856(0x82))/0x4+-parseInt(_0x591856(0x7a))/0x5+-parseInt(_0x591856(0x83))/0x6*(-parseInt(_0x591856(0x7c))/0x7)+parseInt(_0x591856(0x7f))/0x8+parseInt(_0x591856(0x7d))/0x9;if(_0x445d53===_0x5ba5ea)break;else _0x4acff3['push'](_0x4acff3['shift']());}catch(_0x499f57){_0x4acff3['push'](_0x4acff3['shift']());}}}(a157_0x8092,0x2a88c));export function buildFolderIdToPathMap(_0x39911c){const _0x6011de=a157_0x3cac,_0x2d99d2=new Map(),_0x2ef1f8=new Map();for(const _0x452ebf of _0x39911c){_0x2ef1f8[_0x6011de(0x78)](_0x452ebf['id'],_0x452ebf);}const _0x30a8fa=new Set();for(const _0x435d85 of _0x39911c){!_0x435d85['parentFolderId']&&_0x30a8fa[_0x6011de(0x84)](_0x435d85['id']);}function _0x4c61c4(_0x30dd84){const _0x2bd8d1=_0x6011de;if(_0x2d99d2[_0x2bd8d1(0x81)](_0x30dd84['id']))return _0x2d99d2[_0x2bd8d1(0x85)](_0x30dd84['id']);if(_0x30a8fa['has'](_0x30dd84['id']))return _0x2d99d2[_0x2bd8d1(0x78)](_0x30dd84['id'],''),'';if(_0x30dd84[_0x2bd8d1(0x7e)]){const _0x591b1b=_0x2ef1f8[_0x2bd8d1(0x85)](_0x30dd84[_0x2bd8d1(0x7e)]);if(_0x591b1b){const _0x400182=_0x4c61c4(_0x591b1b),_0x534150=_0x400182?_0x400182+'/'+_0x30dd84[_0x2bd8d1(0x79)]:_0x30dd84[_0x2bd8d1(0x79)];return _0x2d99d2[_0x2bd8d1(0x78)](_0x30dd84['id'],_0x534150),_0x534150;}}const _0x1f3070=_0x30dd84['name'];return _0x2d99d2[_0x2bd8d1(0x78)](_0x30dd84['id'],_0x1f3070),_0x1f3070;}for(const _0x27d01d of _0x39911c){_0x4c61c4(_0x27d01d);}return _0x2d99d2;}export function buildFolderPathToIdMap(_0x565584){const _0x386b2d=a157_0x3cac,_0x5ebbcf=new Map(),_0xf4307=new Map();for(const _0x318ec3 of _0x565584){_0xf4307[_0x386b2d(0x78)](_0x318ec3['id'],_0x318ec3);}const _0x472be9=new Set();for(const _0x3dc5c0 of _0x565584){!_0x3dc5c0[_0x386b2d(0x7e)]&&_0x472be9[_0x386b2d(0x84)](_0x3dc5c0['id']);}function _0x2d9079(_0x224631){const _0x3e08c2=_0x386b2d;if(_0x472be9[_0x3e08c2(0x81)](_0x224631['id']))return'';if(_0x224631['parentFolderId']){const _0x53ef9e=_0xf4307[_0x3e08c2(0x85)](_0x224631[_0x3e08c2(0x7e)]);if(_0x53ef9e){const _0x4572ed=_0x2d9079(_0x53ef9e);return _0x4572ed?_0x4572ed+'/'+_0x224631[_0x3e08c2(0x79)]:_0x224631[_0x3e08c2(0x79)];}}return _0x224631[_0x3e08c2(0x79)];}for(const _0x288df3 of _0x565584){const _0x73dbd1=_0x2d9079(_0x288df3);_0x5ebbcf[_0x386b2d(0x78)](_0x73dbd1,_0x288df3['id']);}return _0x5ebbcf;}function a157_0x3cac(_0x5149cf,_0x346b46){_0x5149cf=_0x5149cf-0x78;const _0x8092ac=a157_0x8092();let _0x3caccf=_0x8092ac[_0x5149cf];return _0x3caccf;}function a157_0x8092(){const _0x1ada86=['parentFolderId','2315360fabtya','4itOBQL','has','689208vGhLSr','33414bMziHQ','add','get','278037ymQNti','set','name','1451300BUcoxg','114734CAmUBC','217tMWqSm','1370394tHNGpG'];a157_0x8092=function(){return _0x1ada86;};return a157_0x8092();}export function buildFolderMaps(_0x22195c){const _0x52d152=a157_0x3cac,_0x5e6234=buildFolderIdToPathMap(_0x22195c),_0x48b0a9=new Map();for(const [_0x2d6260,_0x3452bd]of _0x5e6234){_0x48b0a9[_0x52d152(0x78)](_0x3452bd,_0x2d6260);}return{'idToPath':_0x5e6234,'pathToId':_0x48b0a9};}export function getFolderPath(_0x18ad37,_0x521a23){const _0x1cee6c=a157_0x3cac;if(!_0x18ad37)return'';return _0x521a23[_0x1cee6c(0x85)](_0x18ad37)??'';}
1
+ function a157_0x3821(_0x1da524,_0x3633d5){_0x1da524=_0x1da524-0xf2;const _0x4c885f=a157_0x4c88();let _0x382106=_0x4c885f[_0x1da524];return _0x382106;}(function(_0x1b1664,_0x146579){const _0x396375=a157_0x3821,_0x290d3a=_0x1b1664();while(!![]){try{const _0x22f909=parseInt(_0x396375(0xfb))/0x1+parseInt(_0x396375(0xf5))/0x2+-parseInt(_0x396375(0x100))/0x3*(parseInt(_0x396375(0xf4))/0x4)+parseInt(_0x396375(0xfd))/0x5*(-parseInt(_0x396375(0xfc))/0x6)+-parseInt(_0x396375(0xf2))/0x7*(parseInt(_0x396375(0xf9))/0x8)+-parseInt(_0x396375(0xf3))/0x9+parseInt(_0x396375(0xff))/0xa;if(_0x22f909===_0x146579)break;else _0x290d3a['push'](_0x290d3a['shift']());}catch(_0x13d8bc){_0x290d3a['push'](_0x290d3a['shift']());}}}(a157_0x4c88,0xea22a));export function buildFolderIdToPathMap(_0x5d6b63){const _0x251d05=a157_0x3821,_0x22a462=new Map(),_0xab3a60=new Map();for(const _0xf6d84d of _0x5d6b63){_0xab3a60[_0x251d05(0xf6)](_0xf6d84d['id'],_0xf6d84d);}const _0x3369fe=new Set();for(const _0x5e6a67 of _0x5d6b63){!_0x5e6a67[_0x251d05(0xfe)]&&_0x3369fe[_0x251d05(0xf8)](_0x5e6a67['id']);}function _0x5b1742(_0x281e33){const _0x2a90ad=_0x251d05;if(_0x22a462[_0x2a90ad(0xfa)](_0x281e33['id']))return _0x22a462[_0x2a90ad(0xf7)](_0x281e33['id']);if(_0x3369fe[_0x2a90ad(0xfa)](_0x281e33['id']))return _0x22a462['set'](_0x281e33['id'],''),'';if(_0x281e33[_0x2a90ad(0xfe)]){const _0xd01e0b=_0xab3a60[_0x2a90ad(0xf7)](_0x281e33[_0x2a90ad(0xfe)]);if(_0xd01e0b){const _0x12745e=_0x5b1742(_0xd01e0b),_0x22131d=_0x12745e?_0x12745e+'/'+_0x281e33[_0x2a90ad(0x101)]:_0x281e33[_0x2a90ad(0x101)];return _0x22a462[_0x2a90ad(0xf6)](_0x281e33['id'],_0x22131d),_0x22131d;}}const _0x119347=_0x281e33[_0x2a90ad(0x101)];return _0x22a462[_0x2a90ad(0xf6)](_0x281e33['id'],_0x119347),_0x119347;}for(const _0x4197cf of _0x5d6b63){_0x5b1742(_0x4197cf);}return _0x22a462;}function a157_0x4c88(){const _0x17be4b=['name','105GtvKRC','12300426jDFOwB','4SbjeKy','2278030GwUKro','set','get','add','975248RkQILA','has','87366UNDxKu','1078026LCuORG','20MRqssM','parentFolderId','44809840gHyRlp','2503077czqtkW'];a157_0x4c88=function(){return _0x17be4b;};return a157_0x4c88();}export function buildFolderPathToIdMap(_0x3382fb){const _0x543965=a157_0x3821,_0x820024=new Map(),_0x5e4854=new Map();for(const _0x555165 of _0x3382fb){_0x5e4854[_0x543965(0xf6)](_0x555165['id'],_0x555165);}const _0xf5ff1c=new Set();for(const _0x505e0d of _0x3382fb){!_0x505e0d[_0x543965(0xfe)]&&_0xf5ff1c[_0x543965(0xf8)](_0x505e0d['id']);}function _0x49a2b7(_0x46107e){const _0x4de67c=_0x543965;if(_0xf5ff1c[_0x4de67c(0xfa)](_0x46107e['id']))return'';if(_0x46107e[_0x4de67c(0xfe)]){const _0x251c11=_0x5e4854[_0x4de67c(0xf7)](_0x46107e[_0x4de67c(0xfe)]);if(_0x251c11){const _0x51b9c1=_0x49a2b7(_0x251c11);return _0x51b9c1?_0x51b9c1+'/'+_0x46107e['name']:_0x46107e['name'];}}return _0x46107e[_0x4de67c(0x101)];}for(const _0x198f72 of _0x3382fb){const _0x52ee71=_0x49a2b7(_0x198f72);_0x820024[_0x543965(0xf6)](_0x52ee71,_0x198f72['id']);}return _0x820024;}export function buildFolderMaps(_0x2f0186){const _0x4daffc=a157_0x3821,_0x1e9c4a=buildFolderIdToPathMap(_0x2f0186),_0x225a41=new Map();for(const [_0x526742,_0x119fee]of _0x1e9c4a){_0x225a41[_0x4daffc(0xf6)](_0x119fee,_0x526742);}return{'idToPath':_0x1e9c4a,'pathToId':_0x225a41};}export function getFolderPath(_0x138461,_0x372e3a){const _0x40f1db=a157_0x3821;if(!_0x138461)return'';return _0x372e3a[_0x40f1db(0xf7)](_0x138461)??'';}
@@ -1 +1 @@
1
- (function(_0x5bfd43,_0x43ef00){const _0x1340c1=a158_0x1d7c,_0x508ecc=_0x5bfd43();while(!![]){try{const _0x17188a=parseInt(_0x1340c1(0x15a))/0x1*(parseInt(_0x1340c1(0x15e))/0x2)+-parseInt(_0x1340c1(0x140))/0x3*(-parseInt(_0x1340c1(0x161))/0x4)+parseInt(_0x1340c1(0x141))/0x5+parseInt(_0x1340c1(0x142))/0x6*(parseInt(_0x1340c1(0x15c))/0x7)+-parseInt(_0x1340c1(0x165))/0x8+parseInt(_0x1340c1(0x164))/0x9*(parseInt(_0x1340c1(0x168))/0xa)+-parseInt(_0x1340c1(0x163))/0xb;if(_0x17188a===_0x43ef00)break;else _0x508ecc['push'](_0x508ecc['shift']());}catch(_0x3d03bf){_0x508ecc['push'](_0x508ecc['shift']());}}}(a158_0x41c9,0xb850b));import a158_0x45b19d from'path';import{parse as a158_0x1e2202}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';import{isJourneyDef}from'./journey-yaml.js';export function parsePath(_0x2c4af2){const _0x536b87=a158_0x1d7c;if(!_0x2c4af2||_0x2c4af2[_0x536b87(0x157)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0xaade8d=_0x2c4af2[_0x536b87(0x157)]();if(_0xaade8d==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x2c4af2};const _0x314948=_0xaade8d['startsWith']('/')?_0xaade8d[_0x536b87(0x14c)](0x1):_0xaade8d,_0x382adb=_0x314948[_0x536b87(0x143)]('/')['filter'](_0x8229d=>_0x8229d!=='');if(_0x382adb[_0x536b87(0x160)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x4df03b=_0xaade8d[_0x536b87(0x159)]('/')||!isRelativePathSegment(_0x382adb[0x0]);for(const _0x488b7d of _0x382adb){validatePathSegment(_0x488b7d);}return{'segments':_0x382adb,'isAbsolute':_0x4df03b,'raw':_0x2c4af2};}function isRelativePathSegment(_0x1f74ee){return _0x1f74ee==='.'||_0x1f74ee==='..';}function a158_0x1d7c(_0x30ec64,_0x49cb7c){_0x30ec64=_0x30ec64-0x13f;const _0x41c9cf=a158_0x41c9();let _0x1d7cf2=_0x41c9cf[_0x30ec64];return _0x1d7cf2;}function validatePathSegment(_0x3e0909){const _0x4e7fa0=a158_0x1d7c;if(_0x3e0909==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x3e0909==='.'||_0x3e0909==='..')return;if(/[\x00-\x1F\x7F]/[_0x4e7fa0(0x154)](_0x3e0909))throw new Error(_0x4e7fa0(0x146)+_0x3e0909);if(_0x3e0909!==_0x3e0909[_0x4e7fa0(0x157)]()){}}export function validatePath(_0x125045){const _0x118716=a158_0x1d7c;if(_0x125045[_0x118716(0x152)][_0x118716(0x160)]===0x0&&!_0x125045['isAbsolute'])throw new Error(_0x118716(0x14e));if(_0x125045['isAbsolute']){if(_0x125045['segments'][0x0]==='..')throw new Error(_0x118716(0x15f));let _0x1bd9ba=0x0;for(const _0x2a03ab of _0x125045[_0x118716(0x152)]){if(_0x2a03ab==='..'){if(_0x1bd9ba===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x1bd9ba--;}else _0x2a03ab!=='.'&&_0x1bd9ba++;}}}export function joinPaths(_0x1376ba,_0x8edda5){const _0x367711=a158_0x1d7c;if(!_0x1376ba||_0x1376ba==='/')return _0x8edda5;if(!_0x8edda5||_0x8edda5==='.')return _0x1376ba;if(_0x8edda5[_0x367711(0x159)]('/'))return _0x8edda5;const _0x4fd940=parsePath(_0x1376ba),_0x496ae9=parsePath(_0x8edda5),_0x409f1f=[..._0x4fd940[_0x367711(0x152)]];for(const _0x3345aa of _0x496ae9[_0x367711(0x152)]){if(_0x3345aa==='.')continue;else{if(_0x3345aa==='..'){if(_0x409f1f[_0x367711(0x160)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x409f1f['pop']();}else _0x409f1f[_0x367711(0x162)](_0x3345aa);}}const _0x59f2b1=_0x409f1f['join']('/');return _0x4fd940[_0x367711(0x14a)]['startsWith']('/')?'/'+_0x59f2b1:_0x59f2b1;}export function normalizePath(_0x3bdb13){const _0xece66b=a158_0x1d7c,_0x50fcd8=parsePath(_0x3bdb13),_0x1aa741=[];for(const _0x58fd12 of _0x50fcd8[_0xece66b(0x152)]){if(_0x58fd12==='.')continue;else{if(_0x58fd12==='..'){if(_0x1aa741[_0xece66b(0x160)]===0x0){if(_0x50fcd8[_0xece66b(0x150)])throw new Error(_0xece66b(0x145));_0x1aa741[_0xece66b(0x162)]('..');}else _0x1aa741[_0x1aa741[_0xece66b(0x160)]-0x1]==='..'?_0x1aa741[_0xece66b(0x162)]('..'):_0x1aa741[_0xece66b(0x147)]();}else _0x1aa741[_0xece66b(0x162)](_0x58fd12);}}if(_0x1aa741[_0xece66b(0x160)]===0x0)return _0x50fcd8['isAbsolute']?'/':'.';const _0x5649ef=_0x1aa741[_0xece66b(0x15d)]('/');return _0x50fcd8[_0xece66b(0x14a)][_0xece66b(0x159)]('/')?'/'+_0x5649ef:_0x5649ef;}export function getParentPath(_0x2f4296){const _0x4e5cf0=a158_0x1d7c,_0x3c2cce=parsePath(_0x2f4296);if(_0x3c2cce['segments']['length']<=0x1)return'/';const _0x9675ce=_0x3c2cce[_0x4e5cf0(0x152)][_0x4e5cf0(0x14d)](0x0,-0x1)[_0x4e5cf0(0x15d)]('/');return _0x3c2cce[_0x4e5cf0(0x14a)][_0x4e5cf0(0x159)]('/')?'/'+_0x9675ce:_0x9675ce;}export function getBaseName(_0xe89d3b){const _0xc5663=a158_0x1d7c,_0x3dc31f=parsePath(_0xe89d3b);return _0x3dc31f['segments'][_0x3dc31f['segments'][_0xc5663(0x160)]-0x1]||'';}function a158_0x41c9(){const _0x4c82f4=['endsWith','startsWith','1xvySky','root','7DEsmnO','join','806402zPBfGT','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','length','861412aDkDyN','push','29106715JjpuMs','9ydSciH','1751464bCxGih','.yml','replace','1880290ZZMEPp','name','File\x20not\x20found:\x20','18oRVDxJ','7385395gDCgjt','1557156ZVtIdH','split','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','pop','parse','readFile','raw','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','substring','slice','Relative\x20path\x20cannot\x20be\x20empty','segment','isAbsolute','exists','segments','tdx.json','test','parent_segment','dirname','trim'];a158_0x41c9=function(){return _0x4c82f4;};return a158_0x41c9();}export function isChildPath(_0x2a54e1,_0x3a3338){const _0x2409be=a158_0x1d7c,_0xe8c9b4=parsePath(_0x2a54e1),_0x496ea3=parsePath(_0x3a3338);if(_0xe8c9b4[_0x2409be(0x152)][_0x2409be(0x160)]<=_0x496ea3[_0x2409be(0x152)][_0x2409be(0x160)])return![];for(let _0x3316a4=0x0;_0x3316a4<_0x496ea3['segments'][_0x2409be(0x160)];_0x3316a4++){if(_0xe8c9b4[_0x2409be(0x152)][_0x3316a4]!==_0x496ea3[_0x2409be(0x152)][_0x3316a4])return![];}return!![];}export function splitPath(_0x36a6b0){const _0xe58672=a158_0x1d7c,_0x2fed19=parsePath(_0x36a6b0);if(_0x2fed19[_0xe58672(0x152)][_0xe58672(0x160)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x2fed19[_0xe58672(0x152)][_0xe58672(0x160)]===0x1)return{'parent':_0x2fed19[_0xe58672(0x152)][0x0]};return{'parent':_0x2fed19['segments'][0x0],'child':_0x2fed19[_0xe58672(0x152)][_0xe58672(0x14d)](0x1)[_0xe58672(0x15d)]('/')};}export function isYamlFilePath(_0x2d4198){const _0x269ff3=a158_0x1d7c;return _0x2d4198[_0x269ff3(0x158)](_0x269ff3(0x166))||_0x2d4198[_0x269ff3(0x158)]('.yaml');}export async function resolveYamlFilePath(_0x4a6b4f,_0x246aa8=nodeFileSystem){const _0x2ceb8d=a158_0x1d7c,_0x5a3c66=a158_0x45b19d['resolve'](_0x4a6b4f);if(!await _0x246aa8[_0x2ceb8d(0x151)](_0x5a3c66))throw new Error(_0x2ceb8d(0x13f)+_0x4a6b4f);let _0x122036=a158_0x45b19d['dirname'](_0x5a3c66),_0x4e6631=null,_0x4c1c0d=null;const _0xdb07f3=a158_0x45b19d['parse'](_0x122036)[_0x2ceb8d(0x15b)];while(_0x122036!==_0xdb07f3){const _0x5a7027=a158_0x45b19d[_0x2ceb8d(0x15d)](_0x122036,_0x2ceb8d(0x153));if(await _0x246aa8[_0x2ceb8d(0x151)](_0x5a7027)){_0x4e6631=_0x5a7027,_0x4c1c0d=_0x122036;break;}_0x122036=a158_0x45b19d[_0x2ceb8d(0x156)](_0x122036);}if(!_0x4e6631||!_0x4c1c0d)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x4a6b4f+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x514980=await _0x246aa8[_0x2ceb8d(0x149)](_0x4e6631),_0x146b1c=JSON[_0x2ceb8d(0x148)](_0x514980),_0x10242b=_0x146b1c[_0x2ceb8d(0x155)];if(!_0x10242b)throw new Error(_0x2ceb8d(0x14b));const _0x284d25=await _0x246aa8[_0x2ceb8d(0x149)](_0x5a3c66),_0x5d424e=a158_0x1e2202(_0x284d25),_0x2fa4b3=_0x5d424e[_0x2ceb8d(0x169)];if(!_0x2fa4b3)throw new Error(_0x2ceb8d(0x144)+_0x4a6b4f);const _0xc4dd06=isJourneyDef(_0x5d424e,_0x5a3c66)?'journey':_0x2ceb8d(0x14f),_0x187d52=a158_0x45b19d['relative'](_0x4c1c0d,_0x5a3c66),_0x5919b1=a158_0x45b19d['dirname'](_0x187d52),_0x4b4630=_0x5919b1==='.'?'':_0x5919b1[_0x2ceb8d(0x167)](/\\/g,'/'),_0x4395d8=_0x4b4630?_0x10242b+'/'+_0x4b4630+'/'+_0x2fa4b3:_0x10242b+'/'+_0x2fa4b3;return{'parentSegment':_0x10242b,'segmentName':_0x2fa4b3,'folderPath':_0x4b4630,'fullPath':_0x4395d8,'resourceType':_0xc4dd06,'content':_0x284d25};}
1
+ (function(_0x423a6b,_0x16f817){const _0x3ac150=a158_0x282a,_0x5cd993=_0x423a6b();while(!![]){try{const _0x1e040c=-parseInt(_0x3ac150(0x177))/0x1*(-parseInt(_0x3ac150(0x154))/0x2)+parseInt(_0x3ac150(0x152))/0x3*(-parseInt(_0x3ac150(0x16e))/0x4)+-parseInt(_0x3ac150(0x14f))/0x5+-parseInt(_0x3ac150(0x165))/0x6*(parseInt(_0x3ac150(0x17a))/0x7)+parseInt(_0x3ac150(0x150))/0x8*(-parseInt(_0x3ac150(0x172))/0x9)+parseInt(_0x3ac150(0x173))/0xa+-parseInt(_0x3ac150(0x14e))/0xb*(-parseInt(_0x3ac150(0x156))/0xc);if(_0x1e040c===_0x16f817)break;else _0x5cd993['push'](_0x5cd993['shift']());}catch(_0x439244){_0x5cd993['push'](_0x5cd993['shift']());}}}(a158_0x15ac,0xef424));import a158_0xa0129b from'path';import{parse as a158_0x1f2df5}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';import{isJourneyDef}from'./journey-yaml.js';export function parsePath(_0x1ea6e8){const _0x2503f4=a158_0x282a;if(!_0x1ea6e8||_0x1ea6e8[_0x2503f4(0x17e)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x3bad8d=_0x1ea6e8[_0x2503f4(0x17e)]();if(_0x3bad8d==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x1ea6e8};const _0x5ec01d=_0x3bad8d[_0x2503f4(0x176)]('/')?_0x3bad8d[_0x2503f4(0x163)](0x1):_0x3bad8d,_0x44ae4d=_0x5ec01d[_0x2503f4(0x174)]('/')['filter'](_0x3c8adf=>_0x3c8adf!=='');if(_0x44ae4d['length']===0x0)throw new Error(_0x2503f4(0x168));const _0x5d2eeb=_0x3bad8d[_0x2503f4(0x176)]('/')||!isRelativePathSegment(_0x44ae4d[0x0]);for(const _0x38603d of _0x44ae4d){validatePathSegment(_0x38603d);}return{'segments':_0x44ae4d,'isAbsolute':_0x5d2eeb,'raw':_0x1ea6e8};}function isRelativePathSegment(_0x414bb3){return _0x414bb3==='.'||_0x414bb3==='..';}function validatePathSegment(_0x60a64c){const _0x182be5=a158_0x282a;if(_0x60a64c==='')throw new Error(_0x182be5(0x17d));if(_0x60a64c==='.'||_0x60a64c==='..')return;if(/[\x00-\x1F\x7F]/[_0x182be5(0x151)](_0x60a64c))throw new Error(_0x182be5(0x159)+_0x60a64c);if(_0x60a64c!==_0x60a64c[_0x182be5(0x17e)]()){}}export function validatePath(_0x185290){const _0xdabd6c=a158_0x282a;if(_0x185290['segments']['length']===0x0&&!_0x185290[_0xdabd6c(0x16f)])throw new Error(_0xdabd6c(0x17f));if(_0x185290[_0xdabd6c(0x16f)]){if(_0x185290['segments'][0x0]==='..')throw new Error(_0xdabd6c(0x153));let _0x7e588b=0x0;for(const _0x1a58f2 of _0x185290[_0xdabd6c(0x171)]){if(_0x1a58f2==='..'){if(_0x7e588b===0x0)throw new Error(_0xdabd6c(0x15b));_0x7e588b--;}else _0x1a58f2!=='.'&&_0x7e588b++;}}}function a158_0x15ac(){const _0x2a7985=['10037520CKBxhz','split','root','startsWith','2cCkSqM','exists','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','85659TverRv','parent_segment','No\x20tdx.json\x20found\x20for\x20file:\x20','Path\x20segment\x20cannot\x20be\x20empty','trim','Relative\x20path\x20cannot\x20be\x20empty','33FFgsCx','1509040ncECkx','12637536TvHXSI','test','453LYBngV','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','1297342utBVem','name','4821924YIlDhR','slice','endsWith','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','pop','Path\x20attempts\x20to\x20navigate\x20above\x20root','Cannot\x20split\x20empty\x20path','join','Cannot\x20navigate\x20above\x20root','readFile','tdx.json','resolve','push','substring','replace','150GcLSXO','parse','length','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','.yaml','raw','dirname','journey','segment','8984lOEdTD','isAbsolute','File\x20not\x20found:\x20','segments','9UnerLp'];a158_0x15ac=function(){return _0x2a7985;};return a158_0x15ac();}export function joinPaths(_0x54c063,_0x528306){const _0x5dc4ee=a158_0x282a;if(!_0x54c063||_0x54c063==='/')return _0x528306;if(!_0x528306||_0x528306==='.')return _0x54c063;if(_0x528306[_0x5dc4ee(0x176)]('/'))return _0x528306;const _0x50a82f=parsePath(_0x54c063),_0x2e56b7=parsePath(_0x528306),_0x27e9f5=[..._0x50a82f[_0x5dc4ee(0x171)]];for(const _0x1aeb0f of _0x2e56b7[_0x5dc4ee(0x171)]){if(_0x1aeb0f==='.')continue;else{if(_0x1aeb0f==='..'){if(_0x27e9f5['length']===0x0)throw new Error(_0x5dc4ee(0x15e));_0x27e9f5[_0x5dc4ee(0x15a)]();}else _0x27e9f5[_0x5dc4ee(0x162)](_0x1aeb0f);}}const _0x2714dd=_0x27e9f5[_0x5dc4ee(0x15d)]('/');return _0x50a82f['raw']['startsWith']('/')?'/'+_0x2714dd:_0x2714dd;}export function normalizePath(_0x5d3433){const _0x585708=a158_0x282a,_0x4699c2=parsePath(_0x5d3433),_0x59cc12=[];for(const _0x36534d of _0x4699c2[_0x585708(0x171)]){if(_0x36534d==='.')continue;else{if(_0x36534d==='..'){if(_0x59cc12[_0x585708(0x167)]===0x0){if(_0x4699c2[_0x585708(0x16f)])throw new Error(_0x585708(0x15e));_0x59cc12[_0x585708(0x162)]('..');}else _0x59cc12[_0x59cc12[_0x585708(0x167)]-0x1]==='..'?_0x59cc12[_0x585708(0x162)]('..'):_0x59cc12[_0x585708(0x15a)]();}else _0x59cc12[_0x585708(0x162)](_0x36534d);}}if(_0x59cc12[_0x585708(0x167)]===0x0)return _0x4699c2[_0x585708(0x16f)]?'/':'.';const _0x1200b2=_0x59cc12['join']('/');return _0x4699c2[_0x585708(0x16a)][_0x585708(0x176)]('/')?'/'+_0x1200b2:_0x1200b2;}export function getParentPath(_0x1fecfd){const _0x470506=a158_0x282a,_0xfea577=parsePath(_0x1fecfd);if(_0xfea577[_0x470506(0x171)][_0x470506(0x167)]<=0x1)return'/';const _0x3a1358=_0xfea577[_0x470506(0x171)][_0x470506(0x157)](0x0,-0x1)[_0x470506(0x15d)]('/');return _0xfea577[_0x470506(0x16a)][_0x470506(0x176)]('/')?'/'+_0x3a1358:_0x3a1358;}export function getBaseName(_0xd08858){const _0x36e31e=a158_0x282a,_0x51df75=parsePath(_0xd08858);return _0x51df75[_0x36e31e(0x171)][_0x51df75[_0x36e31e(0x171)][_0x36e31e(0x167)]-0x1]||'';}export function isChildPath(_0xfcab,_0x519c1a){const _0x569199=a158_0x282a,_0x388954=parsePath(_0xfcab),_0x10b273=parsePath(_0x519c1a);if(_0x388954['segments'][_0x569199(0x167)]<=_0x10b273[_0x569199(0x171)][_0x569199(0x167)])return![];for(let _0x3e29d5=0x0;_0x3e29d5<_0x10b273[_0x569199(0x171)]['length'];_0x3e29d5++){if(_0x388954['segments'][_0x3e29d5]!==_0x10b273[_0x569199(0x171)][_0x3e29d5])return![];}return!![];}export function splitPath(_0x1d5521){const _0x45efcb=a158_0x282a,_0x41df71=parsePath(_0x1d5521);if(_0x41df71['segments']['length']===0x0)throw new Error(_0x45efcb(0x15c));if(_0x41df71['segments']['length']===0x1)return{'parent':_0x41df71[_0x45efcb(0x171)][0x0]};return{'parent':_0x41df71[_0x45efcb(0x171)][0x0],'child':_0x41df71[_0x45efcb(0x171)][_0x45efcb(0x157)](0x1)['join']('/')};}function a158_0x282a(_0x14e43b,_0x5a76f3){_0x14e43b=_0x14e43b-0x14e;const _0x15ac57=a158_0x15ac();let _0x282a62=_0x15ac57[_0x14e43b];return _0x282a62;}export function isYamlFilePath(_0x2a8220){const _0x122954=a158_0x282a;return _0x2a8220[_0x122954(0x158)]('.yml')||_0x2a8220['endsWith'](_0x122954(0x169));}export async function resolveYamlFilePath(_0x1b2d68,_0x476a10=nodeFileSystem){const _0x5d87f2=a158_0x282a,_0x11f5c4=a158_0xa0129b[_0x5d87f2(0x161)](_0x1b2d68);if(!await _0x476a10['exists'](_0x11f5c4))throw new Error(_0x5d87f2(0x170)+_0x1b2d68);let _0x4c8545=a158_0xa0129b[_0x5d87f2(0x16b)](_0x11f5c4),_0x503c18=null,_0x21af8a=null;const _0x1c53ac=a158_0xa0129b[_0x5d87f2(0x166)](_0x4c8545)[_0x5d87f2(0x175)];while(_0x4c8545!==_0x1c53ac){const _0x57ce5f=a158_0xa0129b['join'](_0x4c8545,_0x5d87f2(0x160));if(await _0x476a10[_0x5d87f2(0x178)](_0x57ce5f)){_0x503c18=_0x57ce5f,_0x21af8a=_0x4c8545;break;}_0x4c8545=a158_0xa0129b[_0x5d87f2(0x16b)](_0x4c8545);}if(!_0x503c18||!_0x21af8a)throw new Error(_0x5d87f2(0x17c)+_0x1b2d68+'\x0a'+_0x5d87f2(0x179));const _0x12bece=await _0x476a10[_0x5d87f2(0x15f)](_0x503c18),_0x281528=JSON[_0x5d87f2(0x166)](_0x12bece),_0x469a61=_0x281528[_0x5d87f2(0x17b)];if(!_0x469a61)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x5cfb58=await _0x476a10[_0x5d87f2(0x15f)](_0x11f5c4),_0x29b74c=a158_0x1f2df5(_0x5cfb58),_0x348e99=_0x29b74c[_0x5d87f2(0x155)];if(!_0x348e99)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x1b2d68);const _0x3bde1b=isJourneyDef(_0x29b74c,_0x11f5c4)?_0x5d87f2(0x16c):_0x5d87f2(0x16d),_0x414de1=a158_0xa0129b['relative'](_0x21af8a,_0x11f5c4),_0x2722e1=a158_0xa0129b[_0x5d87f2(0x16b)](_0x414de1),_0x9d8304=_0x2722e1==='.'?'':_0x2722e1[_0x5d87f2(0x164)](/\\/g,'/'),_0x5a0226=_0x9d8304?_0x469a61+'/'+_0x9d8304+'/'+_0x348e99:_0x469a61+'/'+_0x348e99;return{'parentSegment':_0x469a61,'segmentName':_0x348e99,'folderPath':_0x9d8304,'fullPath':_0x5a0226,'resourceType':_0x3bde1b,'content':_0x5cfb58};}
@@ -1 +1 @@
1
- (function(_0x59f23b,_0x4e65ab){const _0x4b91ee=a159_0x3830,_0x1bf4aa=_0x59f23b();while(!![]){try{const _0x323eb6=-parseInt(_0x4b91ee(0x72))/0x1+-parseInt(_0x4b91ee(0x73))/0x2+-parseInt(_0x4b91ee(0x6c))/0x3*(parseInt(_0x4b91ee(0x71))/0x4)+parseInt(_0x4b91ee(0x6f))/0x5*(-parseInt(_0x4b91ee(0x6b))/0x6)+-parseInt(_0x4b91ee(0x6a))/0x7*(-parseInt(_0x4b91ee(0x70))/0x8)+-parseInt(_0x4b91ee(0x74))/0x9+parseInt(_0x4b91ee(0x6d))/0xa;if(_0x323eb6===_0x4e65ab)break;else _0x1bf4aa['push'](_0x1bf4aa['shift']());}catch(_0x2b1e9b){_0x1bf4aa['push'](_0x1bf4aa['shift']());}}}(a159_0x480d,0xc8084));function a159_0x3830(_0x15ca81,_0x5c2601){_0x15ca81=_0x15ca81-0x6a;const _0x480d11=a159_0x480d();let _0x383031=_0x480d11[_0x15ca81];return _0x383031;}function a159_0x480d(){const _0x3e321c=['25fbLMtl','832pqwAOy','1076WeAdJP','960418aHrJCG','588674CQtFuR','14184900YGlSXc','.\x20Child\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','66346TeTvwC','226098bdCceZ','12795pXvzeN','40001750kDrhgp','substring'];a159_0x480d=function(){return _0x3e321c;};return a159_0x480d();}export function parseSegmentRef(_0xb1324e){const _0xa82ec=a159_0x3830,_0xe821fb=_0xb1324e['indexOf']('/');if(_0xe821fb===-0x1)return{'parentId':_0xb1324e};if(_0xe821fb===0x0)throw new Error(_0xa82ec(0x76)+_0xb1324e+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x26cfac=_0xb1324e[_0xa82ec(0x6e)](0x0,_0xe821fb),_0x36816b=_0xb1324e[_0xa82ec(0x6e)](_0xe821fb+0x1);if(_0x36816b==='')throw new Error(_0xa82ec(0x76)+_0xb1324e+_0xa82ec(0x75));return{'parentId':_0x26cfac,'childId':_0x36816b};}
1
+ function a159_0x16dc(_0x3e5489,_0x407e20){_0x3e5489=_0x3e5489-0x121;const _0x436fa2=a159_0x436f();let _0x16dc23=_0x436fa2[_0x3e5489];return _0x16dc23;}(function(_0x3243b4,_0x2e2368){const _0x1f4a5c=a159_0x16dc,_0x114a19=_0x3243b4();while(!![]){try{const _0x4adaa9=parseInt(_0x1f4a5c(0x12a))/0x1+-parseInt(_0x1f4a5c(0x122))/0x2+parseInt(_0x1f4a5c(0x127))/0x3+parseInt(_0x1f4a5c(0x124))/0x4+-parseInt(_0x1f4a5c(0x12c))/0x5+parseInt(_0x1f4a5c(0x126))/0x6*(-parseInt(_0x1f4a5c(0x125))/0x7)+-parseInt(_0x1f4a5c(0x123))/0x8;if(_0x4adaa9===_0x2e2368)break;else _0x114a19['push'](_0x114a19['shift']());}catch(_0x119952){_0x114a19['push'](_0x114a19['shift']());}}}(a159_0x436f,0xcacd6));export function parseSegmentRef(_0x237ba6){const _0x5bbcef=a159_0x16dc,_0x287aba=_0x237ba6[_0x5bbcef(0x129)]('/');if(_0x287aba===-0x1)return{'parentId':_0x237ba6};if(_0x287aba===0x0)throw new Error(_0x5bbcef(0x12b)+_0x237ba6+_0x5bbcef(0x12d));const _0x5ccdbb=_0x237ba6[_0x5bbcef(0x128)](0x0,_0x287aba),_0x26ceff=_0x237ba6[_0x5bbcef(0x128)](_0x287aba+0x1);if(_0x26ceff==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x237ba6+_0x5bbcef(0x121));return{'parentId':_0x5ccdbb,'childId':_0x26ceff};}function a159_0x436f(){const _0x49b4fa=['4738880wRFvaM','21oBPaHI','2515452AuoNOx','3603402BxhOJI','substring','indexOf','1517330iXPnBT','Invalid\x20segment\x20reference\x20format:\x20','4035590IcgBRG','.\x20Parent\x20name\x20cannot\x20be\x20empty','.\x20Child\x20name\x20cannot\x20be\x20empty','257780yvPdJQ','7030176CPeNZS'];a159_0x436f=function(){return _0x49b4fa;};return a159_0x436f();}
@@ -1 +1 @@
1
- (function(_0x18bde6,_0x71ab80){const _0x445e57=a160_0x4eee,_0x309865=_0x18bde6();while(!![]){try{const _0x576296=-parseInt(_0x445e57(0x20e))/0x1+-parseInt(_0x445e57(0x237))/0x2+parseInt(_0x445e57(0x232))/0x3*(-parseInt(_0x445e57(0x21b))/0x4)+-parseInt(_0x445e57(0x207))/0x5*(parseInt(_0x445e57(0x203))/0x6)+-parseInt(_0x445e57(0x1ff))/0x7*(-parseInt(_0x445e57(0x20d))/0x8)+-parseInt(_0x445e57(0x200))/0x9+parseInt(_0x445e57(0x225))/0xa*(parseInt(_0x445e57(0x219))/0xb);if(_0x576296===_0x71ab80)break;else _0x309865['push'](_0x309865['shift']());}catch(_0x49aaa5){_0x309865['push'](_0x309865['shift']());}}}(a160_0xd297,0x97262));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x44cc21,_0x5e1c49={},_0x2cd9ce={}){const _0x463e26=a160_0x4eee;if(_0x2cd9ce[_0x463e26(0x1ec)])return runSemanticChecks(_0x44cc21,_0x5e1c49);const _0x1c9a65=SegmentDefSchema[_0x463e26(0x224)](_0x44cc21);if(_0x1c9a65[_0x463e26(0x1f6)])return runSemanticChecks(_0x1c9a65[_0x463e26(0x208)],_0x5e1c49);return zodErrorsToValidationResult(_0x1c9a65[_0x463e26(0x1f0)],_0x5e1c49);}export function validateRuleDef(_0x382ed0,_0x5a9bdb,_0x13ac7e){const _0x32f4c2=a160_0x4eee;if(!_0x382ed0)return[];const _0x3c8e26=RuleDefSchema[_0x32f4c2(0x224)](_0x382ed0);if(_0x3c8e26['success'])return checkRule(_0x3c8e26['data'],_0x5a9bdb,_0x13ac7e);const _0x17fd98=flattenZodIssues(_0x3c8e26[_0x32f4c2(0x1f0)][_0x32f4c2(0x211)]);return _0x17fd98['map'](_0x2cfa49=>{const _0x1f8b77=_0x32f4c2,_0xc9f808=formatZodPath(_0x2cfa49['path']),_0x2b9c78=_0xc9f808?_0x5a9bdb+'.'+_0xc9f808:_0x5a9bdb,_0x4fea2e=mapZodIssueToCode(_0x2cfa49,_0xc9f808),_0x4fbe34=getLocationFromPath(_0x13ac7e[_0x1f8b77(0x22c)],_0x13ac7e[_0x1f8b77(0x204)],pathToArray(_0x2b9c78));return{'level':_0x1f8b77(0x1f0),'path':_0x2b9c78,'code':_0x4fea2e,'message':_0x2cfa49['message'],..._0x4fbe34&&{'location':_0x4fbe34}};});}function zodErrorsToValidationResult(_0x6b9737,_0x300f8d){const _0x2939c6=a160_0x4eee,_0x1e0625=flattenZodIssues(_0x6b9737['issues']),_0x7b93e1=_0x1e0625[_0x2939c6(0x1ea)](_0x32be3c=>{const _0x486133=_0x2939c6,_0x43ce08=formatZodPath(_0x32be3c['path']),_0x14eaf0=mapZodIssueToCode(_0x32be3c,_0x43ce08),_0x24c7a8=getLocationFromPath(_0x300f8d[_0x486133(0x22c)],_0x300f8d[_0x486133(0x204)],_0x32be3c['path'][_0x486133(0x1ea)](_0x435b7f=>typeof _0x435b7f===_0x486133(0x22a)?String(_0x435b7f):_0x435b7f));return{'level':_0x486133(0x1f0),'path':_0x43ce08,'code':_0x14eaf0,'message':_0x32be3c[_0x486133(0x1ef)],..._0x24c7a8&&{'location':_0x24c7a8}};});return{'valid':![],'errors':_0x7b93e1,'warnings':[]};}function a160_0x4eee(_0x2115cf,_0x8698bd){_0x2115cf=_0x2115cf-0x1e7;const _0xd297b2=a160_0xd297();let _0x4eee41=_0xd297b2[_0x2115cf];return _0x4eee41;}function mapZodIssueToCode(_0x317756,_0x30ec16){const _0x2ee4b7=a160_0x4eee,_0x2013fd=_0x317756['code']===_0x2ee4b7(0x226)?_0x317756[_0x2ee4b7(0x220)]:undefined;if(_0x30ec16===_0x2ee4b7(0x20a))return _0x2ee4b7(0x214);if(_0x30ec16===_0x2ee4b7(0x202)||_0x30ec16[_0x2ee4b7(0x201)](_0x2ee4b7(0x1fc))){if(_0x317756['code']===_0x2ee4b7(0x217)){if(_0x30ec16===_0x2ee4b7(0x202)||_0x30ec16['match'](/\.conditions\[\d+\]\.type$/))return _0x2ee4b7(0x234);}}if(_0x30ec16['endsWith'](_0x2ee4b7(0x20f)))return'INVALID_OPERATOR_TYPE';if(_0x30ec16[_0x2ee4b7(0x201)](_0x2ee4b7(0x1f2)))return'MISSING_OPERATOR_VALUE';if(_0x2013fd?.[_0x2ee4b7(0x22d)]===_0x2ee4b7(0x233))return _0x2ee4b7(0x233);if(_0x2013fd?.[_0x2ee4b7(0x22d)]==='MISSING_TIME_UNIT')return _0x2ee4b7(0x1f8);if(_0x30ec16['endsWith'](_0x2ee4b7(0x1f4))||_0x30ec16===_0x2ee4b7(0x227))return _0x2ee4b7(0x1eb);if(_0x30ec16[_0x2ee4b7(0x20c)]('arrayMatching'))return _0x2ee4b7(0x238);if(_0x30ec16['endsWith'](_0x2ee4b7(0x218)))return _0x2ee4b7(0x21a);return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x305912,_0x4287ef){const _0x45106a=a160_0x4eee,_0x1f8e40=[];_0x305912[_0x45106a(0x21c)]&&_0x1f8e40[_0x45106a(0x1f1)](...checkRule(_0x305912[_0x45106a(0x21c)],_0x45106a(0x21c),_0x4287ef));const _0x423d42=_0x1f8e40['filter'](_0x44fbce=>_0x44fbce[_0x45106a(0x228)]===_0x45106a(0x1f0)),_0x611530=_0x1f8e40[_0x45106a(0x216)](_0x534027=>_0x534027[_0x45106a(0x228)]===_0x45106a(0x231));return{'valid':_0x423d42['length']===0x0,'errors':_0x423d42,'warnings':_0x611530};}function checkRule(_0x3e9f37,_0x5ae735,_0x365deb){const _0x5d54b9=a160_0x4eee,_0x36f867=[];if(_0x3e9f37[_0x5d54b9(0x227)][_0x5d54b9(0x205)]===0x0)return _0x36f867[_0x5d54b9(0x1f1)]({'level':_0x5d54b9(0x1f0),'path':_0x5ae735+_0x5d54b9(0x1f4),'code':'EMPTY_CONDITIONS','message':_0x5d54b9(0x230),'location':getLocationFromPath(_0x365deb[_0x5d54b9(0x22c)],_0x365deb[_0x5d54b9(0x204)],pathToArray(_0x5ae735+_0x5d54b9(0x1f4)))}),_0x36f867;return _0x36f867[_0x5d54b9(0x1f1)](...checkConditions(_0x3e9f37['conditions'],_0x5ae735,_0x365deb)),_0x36f867;}function checkConditions(_0x405974,_0x2336a5,_0x3f4716){const _0x466365=a160_0x4eee,_0x55ca52=[];for(let _0x2b7099=0x0;_0x2b7099<_0x405974[_0x466365(0x205)];_0x2b7099++){const _0x54f2e7=_0x405974[_0x2b7099],_0x3f2a17=_0x2336a5+_0x466365(0x20b)+_0x2b7099+']';_0x55ca52['push'](...checkCondition(_0x54f2e7,_0x3f2a17,_0x3f4716));}return _0x55ca52;}function a160_0xd297(){const _0x2ffd7a=['MISSING_TIME_UNIT','type','TEMPORAL_NEGATION_UNSUPPORTED','.attribute','.type','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','123550oyprms','8539380alzmOb','endsWith','rule.type','2341944VcNZBv','source','length','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','10sBHbSV','data','NESTED_CONDITION_GROUP','name','.conditions[','includes','416DEojbf','774133tihSUM','.operator.type','aggregation','issues','.operator.not','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_NAME','Composite','filter','invalid_value','.segment','48848415TNQlPS','MISSING_SEGMENT_REFERENCE','4YZPEeZ','rule','Behavior\x20source\x20\x27','Attribute\x20name\x20cannot\x20be\x20empty','TimeWithinNext','params','Attribute\x20\x27','.source','TimeWithinPast','safeParse','10xfQGEV','custom','conditions','level','attribute','symbol','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','document','validationCode','And','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','warning','3025041Ekmgsd','MISSING_BETWEEN_BOUNDS','INVALID_RULE_TYPE','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','operator','2455022WFHfVQ','INVALID_ARRAY_MATCHING','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','Operator\x20\x27','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','Behavior','map','MISSING_CONDITIONS','skipSchema','description','.filter','message','error','push','.operator.value','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','.conditions','not','success','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'];a160_0xd297=function(){return _0x2ffd7a;};return a160_0xd297();}function checkCondition(_0x2cb8af,_0x2c3fd0,_0x2849a4){const _0x17c0dd=a160_0x4eee,_0x391f1b=[];if(_0x2cb8af[_0x17c0dd(0x1f9)]===_0x17c0dd(0x22e)||_0x2cb8af['type']==='Or'||_0x2cb8af['type']===_0x17c0dd(0x215)){if(_0x2cb8af[_0x17c0dd(0x227)]['length']===0x0)_0x391f1b[_0x17c0dd(0x1f1)]({'level':_0x17c0dd(0x1f0),'path':_0x2c3fd0+'.conditions','code':'EMPTY_CONDITIONS','message':_0x2cb8af[_0x17c0dd(0x1f9)]+_0x17c0dd(0x1f3),'location':getLocationFromPath(_0x2849a4[_0x17c0dd(0x22c)],_0x2849a4[_0x17c0dd(0x204)],pathToArray(_0x2c3fd0+_0x17c0dd(0x1f4)))});else{const _0x22642c=_0x2cb8af[_0x17c0dd(0x1ed)]!==undefined,_0x1d78e1=_0x2cb8af[_0x17c0dd(0x1f9)]===_0x17c0dd(0x215);!_0x22642c&&!_0x1d78e1&&_0x391f1b[_0x17c0dd(0x1f1)]({'level':'warning','path':_0x2c3fd0,'code':_0x17c0dd(0x209),'message':_0x2cb8af[_0x17c0dd(0x1f9)]+_0x17c0dd(0x1f7)+_0x17c0dd(0x22b)+_0x17c0dd(0x213),'location':getLocationFromPath(_0x2849a4[_0x17c0dd(0x22c)],_0x2849a4[_0x17c0dd(0x204)],pathToArray(_0x2c3fd0))}),_0x391f1b[_0x17c0dd(0x1f1)](...checkConditions(_0x2cb8af['conditions'],_0x2c3fd0,_0x2849a4));}return _0x391f1b;}if(_0x2cb8af[_0x17c0dd(0x1f9)]==='Value'||_0x2cb8af['type']===_0x17c0dd(0x1e9)){const _0x6d52b2=_0x2cb8af,_0x1c7e53=_0x6d52b2[_0x17c0dd(0x204)],_0x3fcdf3=_0x6d52b2[_0x17c0dd(0x210)],_0x486d73=_0x1c7e53||_0x3fcdf3,_0x2c337f=_0x6d52b2[_0x17c0dd(0x236)]?.[_0x17c0dd(0x1f9)];if((_0x2c337f===_0x17c0dd(0x223)||_0x2c337f===_0x17c0dd(0x21f))&&_0x6d52b2[_0x17c0dd(0x236)]?.[_0x17c0dd(0x1f5)]!==undefined){const _0x5c4a1f=_0x6d52b2[_0x17c0dd(0x236)][_0x17c0dd(0x1f5)]===!![];_0x391f1b[_0x17c0dd(0x1f1)]({'level':_0x5c4a1f?'error':'warning','path':_0x2c3fd0+_0x17c0dd(0x212),'code':_0x17c0dd(0x1fa),'message':_0x5c4a1f?_0x17c0dd(0x1e7)+_0x2c337f+_0x17c0dd(0x1fd)+_0x17c0dd(0x1fe)+'Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.':'Operator\x20\x27'+_0x2c337f+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+_0x17c0dd(0x1e8),'location':getLocationFromPath(_0x2849a4[_0x17c0dd(0x22c)],_0x2849a4[_0x17c0dd(0x204)],pathToArray(_0x2c3fd0+'.operator.not'))});}(!_0x6d52b2['attribute']||_0x6d52b2['attribute']==='')&&(!_0x486d73&&_0x391f1b[_0x17c0dd(0x1f1)]({'level':'error','path':_0x2c3fd0+_0x17c0dd(0x1fb),'code':'EMPTY_ATTRIBUTE','message':_0x17c0dd(0x21e),'location':getLocationFromPath(_0x2849a4['document'],_0x2849a4['source'],pathToArray(_0x2c3fd0+_0x17c0dd(0x1fb)))}));_0x6d52b2['filter']&&_0x391f1b[_0x17c0dd(0x1f1)](...checkRule(_0x6d52b2[_0x17c0dd(0x216)],_0x2c3fd0+_0x17c0dd(0x1ee),_0x2849a4));if(_0x6d52b2['source']){const _0x492d89=_0x6d52b2[_0x17c0dd(0x229)]&&_0x6d52b2[_0x17c0dd(0x229)]!=='';_0x492d89&&!_0x6d52b2[_0x17c0dd(0x216)]&&_0x391f1b[_0x17c0dd(0x1f1)]({'level':_0x17c0dd(0x1f0),'path':_0x2c3fd0+_0x17c0dd(0x222),'code':'BEHAVIOR_SOURCE_MISSING_FILTER','message':_0x17c0dd(0x21d)+_0x6d52b2[_0x17c0dd(0x204)]+'\x27\x20with\x20attribute\x20\x27'+_0x6d52b2[_0x17c0dd(0x229)]+'\x27\x20'+_0x17c0dd(0x239)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x17c0dd(0x206),'location':getLocationFromPath(_0x2849a4[_0x17c0dd(0x22c)],_0x2849a4[_0x17c0dd(0x204)],pathToArray(_0x2c3fd0+_0x17c0dd(0x222)))}),_0x492d89&&_0x6d52b2[_0x17c0dd(0x216)]&&_0x391f1b['push']({'level':'warning','path':_0x2c3fd0+'.attribute','code':_0x17c0dd(0x22f),'message':_0x17c0dd(0x221)+_0x6d52b2[_0x17c0dd(0x229)]+_0x17c0dd(0x235)+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x2849a4[_0x17c0dd(0x22c)],_0x2849a4['source'],pathToArray(_0x2c3fd0+'.attribute'))});}}return _0x391f1b;}
1
+ (function(_0x30fb01,_0x2bc266){const _0x374c85=a160_0x2228,_0x2ba73b=_0x30fb01();while(!![]){try{const _0x29b840=parseInt(_0x374c85(0x21c))/0x1*(parseInt(_0x374c85(0x201))/0x2)+parseInt(_0x374c85(0x1df))/0x3+-parseInt(_0x374c85(0x218))/0x4*(-parseInt(_0x374c85(0x1f7))/0x5)+-parseInt(_0x374c85(0x212))/0x6*(parseInt(_0x374c85(0x205))/0x7)+-parseInt(_0x374c85(0x1e2))/0x8+-parseInt(_0x374c85(0x1f8))/0x9+parseInt(_0x374c85(0x1ff))/0xa;if(_0x29b840===_0x2bc266)break;else _0x2ba73b['push'](_0x2ba73b['shift']());}catch(_0xd14465){_0x2ba73b['push'](_0x2ba73b['shift']());}}}(a160_0x5845,0xefd77));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3a9b04,_0x5bd84b={},_0xb9c3e3={}){const _0x1a249e=a160_0x2228;if(_0xb9c3e3['skipSchema'])return runSemanticChecks(_0x3a9b04,_0x5bd84b);const _0x2a738f=SegmentDefSchema['safeParse'](_0x3a9b04);if(_0x2a738f[_0x1a249e(0x21d)])return runSemanticChecks(_0x2a738f[_0x1a249e(0x1f9)],_0x5bd84b);return zodErrorsToValidationResult(_0x2a738f[_0x1a249e(0x20e)],_0x5bd84b);}export function validateRuleDef(_0x4f2846,_0x238427,_0x404c40){const _0x2784c2=a160_0x2228;if(!_0x4f2846)return[];const _0xa72c28=RuleDefSchema[_0x2784c2(0x22a)](_0x4f2846);if(_0xa72c28[_0x2784c2(0x21d)])return checkRule(_0xa72c28[_0x2784c2(0x1f9)],_0x238427,_0x404c40);const _0x3d9445=flattenZodIssues(_0xa72c28['error']['issues']);return _0x3d9445['map'](_0x9c2b2e=>{const _0x13fdcb=_0x2784c2,_0x4f5ff6=formatZodPath(_0x9c2b2e[_0x13fdcb(0x217)]),_0x17212f=_0x4f5ff6?_0x238427+'.'+_0x4f5ff6:_0x238427,_0x1aa68c=mapZodIssueToCode(_0x9c2b2e,_0x4f5ff6),_0x5105cc=getLocationFromPath(_0x404c40[_0x13fdcb(0x216)],_0x404c40['source'],pathToArray(_0x17212f));return{'level':_0x13fdcb(0x20e),'path':_0x17212f,'code':_0x1aa68c,'message':_0x9c2b2e[_0x13fdcb(0x22b)],..._0x5105cc&&{'location':_0x5105cc}};});}function zodErrorsToValidationResult(_0x5e445a,_0x385aba){const _0x492a08=a160_0x2228,_0x2fd12f=flattenZodIssues(_0x5e445a[_0x492a08(0x21a)]),_0x3d798e=_0x2fd12f[_0x492a08(0x1e6)](_0x386c8d=>{const _0x52fa73=_0x492a08,_0x299d60=formatZodPath(_0x386c8d[_0x52fa73(0x217)]),_0x5a1fe2=mapZodIssueToCode(_0x386c8d,_0x299d60),_0x5dec11=getLocationFromPath(_0x385aba[_0x52fa73(0x216)],_0x385aba[_0x52fa73(0x20a)],_0x386c8d[_0x52fa73(0x217)]['map'](_0x5291b2=>typeof _0x5291b2==='symbol'?String(_0x5291b2):_0x5291b2));return{'level':_0x52fa73(0x20e),'path':_0x299d60,'code':_0x5a1fe2,'message':_0x386c8d['message'],..._0x5dec11&&{'location':_0x5dec11}};});return{'valid':![],'errors':_0x3d798e,'warnings':[]};}function mapZodIssueToCode(_0x46071f,_0x3f5cb4){const _0x3ed414=a160_0x2228,_0x48587a=_0x46071f[_0x3ed414(0x226)]===_0x3ed414(0x1f0)?_0x46071f[_0x3ed414(0x1fe)]:undefined;if(_0x3f5cb4===_0x3ed414(0x20f))return _0x3ed414(0x202);if(_0x3f5cb4===_0x3ed414(0x1e3)||_0x3f5cb4[_0x3ed414(0x214)](_0x3ed414(0x223))){if(_0x46071f[_0x3ed414(0x226)]===_0x3ed414(0x1de)){if(_0x3f5cb4===_0x3ed414(0x1e3)||_0x3f5cb4['match'](/\.conditions\[\d+\]\.type$/))return _0x3ed414(0x206);}}if(_0x3f5cb4[_0x3ed414(0x214)](_0x3ed414(0x21f)))return _0x3ed414(0x1fd);if(_0x3f5cb4[_0x3ed414(0x214)]('.operator.value'))return _0x3ed414(0x1ea);if(_0x48587a?.['validationCode']===_0x3ed414(0x20d))return'MISSING_BETWEEN_BOUNDS';if(_0x48587a?.[_0x3ed414(0x22c)]===_0x3ed414(0x225))return _0x3ed414(0x225);if(_0x3f5cb4[_0x3ed414(0x214)](_0x3ed414(0x1e5))||_0x3f5cb4===_0x3ed414(0x1ee))return'MISSING_CONDITIONS';if(_0x3f5cb4[_0x3ed414(0x1dd)](_0x3ed414(0x1f4)))return _0x3ed414(0x209);if(_0x3f5cb4[_0x3ed414(0x214)](_0x3ed414(0x1fc)))return _0x3ed414(0x222);return _0x3ed414(0x1e1);}function a160_0x2228(_0x4ee484,_0x158418){_0x4ee484=_0x4ee484-0x1dd;const _0x584515=a160_0x5845();let _0x222869=_0x584515[_0x4ee484];return _0x222869;}function runSemanticChecks(_0x1434e3,_0xd8014){const _0x30905c=a160_0x2228,_0x556d52=[];_0x1434e3['rule']&&_0x556d52[_0x30905c(0x215)](...checkRule(_0x1434e3['rule'],_0x30905c(0x208),_0xd8014));const _0x9845a2=_0x556d52[_0x30905c(0x221)](_0x4c9d8c=>_0x4c9d8c['level']===_0x30905c(0x20e)),_0x5287b0=_0x556d52[_0x30905c(0x221)](_0x5329d6=>_0x5329d6[_0x30905c(0x203)]==='warning');return{'valid':_0x9845a2[_0x30905c(0x211)]===0x0,'errors':_0x9845a2,'warnings':_0x5287b0};}function checkRule(_0x13fc2e,_0xf3f988,_0x11aa0e){const _0x3f5cdd=a160_0x2228,_0x4ebccc=[];if(_0x13fc2e[_0x3f5cdd(0x1ee)][_0x3f5cdd(0x211)]===0x0)return _0x4ebccc['push']({'level':_0x3f5cdd(0x20e),'path':_0xf3f988+_0x3f5cdd(0x1e5),'code':_0x3f5cdd(0x21e),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x11aa0e['document'],_0x11aa0e['source'],pathToArray(_0xf3f988+'.conditions'))}),_0x4ebccc;return _0x4ebccc['push'](...checkConditions(_0x13fc2e['conditions'],_0xf3f988,_0x11aa0e)),_0x4ebccc;}function a160_0x5845(){const _0x2be5a1=['the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','65ZpekTf','6475491bOCfzv','data','Behavior','.operator.not','.segment','INVALID_OPERATOR_TYPE','params','12211660gHianL','.filter','1620018kZFESk','MISSING_NAME','level','operator','2765Ezqclu','INVALID_RULE_TYPE','Operator\x20\x27','rule','INVALID_ARRAY_MATCHING','source','Value','.attribute','MISSING_BETWEEN_BOUNDS','error','name','not','length','8886LzYCuv','Attribute\x20name\x20cannot\x20be\x20empty','endsWith','push','document','path','207412brooSG','NESTED_CONDITION_GROUP','issues','Attribute\x20\x27','1TVRZyu','success','EMPTY_CONDITIONS','.operator.type','\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20','filter','MISSING_SEGMENT_REFERENCE','.type','Behavior\x20source\x20\x27','MISSING_TIME_UNIT','code','TimeWithinNext','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','And','safeParse','message','validationCode','includes','invalid_value','4628790mbjXWC','.conditions[','SEGMENT_SCHEMA_ERROR','15690472FGGApR','rule.type','aggregation','.conditions','map','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','warning','TimeWithinPast','MISSING_OPERATOR_VALUE','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','.source','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','conditions','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','custom','Composite','type','attribute','arrayMatching','TEMPORAL_NEGATION_UNSUPPORTED'];a160_0x5845=function(){return _0x2be5a1;};return a160_0x5845();}function checkConditions(_0x2f0293,_0xecef77,_0x10568c){const _0x5a163a=a160_0x2228,_0x1f75b7=[];for(let _0x5a2d04=0x0;_0x5a2d04<_0x2f0293[_0x5a163a(0x211)];_0x5a2d04++){const _0x4751bc=_0x2f0293[_0x5a2d04],_0x39f66c=_0xecef77+_0x5a163a(0x1e0)+_0x5a2d04+']';_0x1f75b7[_0x5a163a(0x215)](...checkCondition(_0x4751bc,_0x39f66c,_0x10568c));}return _0x1f75b7;}function checkCondition(_0x5eaa7e,_0x30919b,_0x3ed3da){const _0x4f4a69=a160_0x2228,_0x4634eb=[];if(_0x5eaa7e[_0x4f4a69(0x1f2)]===_0x4f4a69(0x229)||_0x5eaa7e[_0x4f4a69(0x1f2)]==='Or'||_0x5eaa7e['type']===_0x4f4a69(0x1f1)){if(_0x5eaa7e[_0x4f4a69(0x1ee)][_0x4f4a69(0x211)]===0x0)_0x4634eb[_0x4f4a69(0x215)]({'level':_0x4f4a69(0x20e),'path':_0x30919b+'.conditions','code':_0x4f4a69(0x21e),'message':_0x5eaa7e['type']+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x3ed3da[_0x4f4a69(0x216)],_0x3ed3da[_0x4f4a69(0x20a)],pathToArray(_0x30919b+'.conditions'))});else{const _0x376b12=_0x5eaa7e['description']!==undefined,_0xb6c7b6=_0x5eaa7e[_0x4f4a69(0x1f2)]===_0x4f4a69(0x1f1);!_0x376b12&&!_0xb6c7b6&&_0x4634eb[_0x4f4a69(0x215)]({'level':_0x4f4a69(0x1e8),'path':_0x30919b,'code':_0x4f4a69(0x219),'message':_0x5eaa7e['type']+_0x4f4a69(0x1eb)+'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(_0x3ed3da[_0x4f4a69(0x216)],_0x3ed3da[_0x4f4a69(0x20a)],pathToArray(_0x30919b))}),_0x4634eb[_0x4f4a69(0x215)](...checkConditions(_0x5eaa7e[_0x4f4a69(0x1ee)],_0x30919b,_0x3ed3da));}return _0x4634eb;}if(_0x5eaa7e[_0x4f4a69(0x1f2)]===_0x4f4a69(0x20b)||_0x5eaa7e[_0x4f4a69(0x1f2)]===_0x4f4a69(0x1fa)){const _0x891f7a=_0x5eaa7e,_0x5085f6=_0x891f7a[_0x4f4a69(0x20a)],_0x5ac927=_0x891f7a[_0x4f4a69(0x1e4)],_0x5311e9=_0x5085f6||_0x5ac927,_0x49e713=_0x891f7a['operator']?.[_0x4f4a69(0x1f2)];if((_0x49e713===_0x4f4a69(0x1e9)||_0x49e713===_0x4f4a69(0x227))&&_0x891f7a[_0x4f4a69(0x204)]?.['not']!==undefined){const _0x5ac034=_0x891f7a[_0x4f4a69(0x204)][_0x4f4a69(0x210)]===!![];_0x4634eb[_0x4f4a69(0x215)]({'level':_0x5ac034?'error':_0x4f4a69(0x1e8),'path':_0x30919b+_0x4f4a69(0x1fb),'code':_0x4f4a69(0x1f5),'message':_0x5ac034?'Operator\x20\x27'+_0x49e713+'\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'+_0x4f4a69(0x1ef)+'Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.':_0x4f4a69(0x207)+_0x49e713+_0x4f4a69(0x220)+'Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','location':getLocationFromPath(_0x3ed3da[_0x4f4a69(0x216)],_0x3ed3da['source'],pathToArray(_0x30919b+_0x4f4a69(0x1fb)))});}(!_0x891f7a[_0x4f4a69(0x1f3)]||_0x891f7a[_0x4f4a69(0x1f3)]==='')&&(!_0x5311e9&&_0x4634eb['push']({'level':_0x4f4a69(0x20e),'path':_0x30919b+_0x4f4a69(0x20c),'code':'EMPTY_ATTRIBUTE','message':_0x4f4a69(0x213),'location':getLocationFromPath(_0x3ed3da[_0x4f4a69(0x216)],_0x3ed3da['source'],pathToArray(_0x30919b+'.attribute'))}));_0x891f7a[_0x4f4a69(0x221)]&&_0x4634eb['push'](...checkRule(_0x891f7a[_0x4f4a69(0x221)],_0x30919b+_0x4f4a69(0x200),_0x3ed3da));if(_0x891f7a[_0x4f4a69(0x20a)]){const _0x2977df=_0x891f7a[_0x4f4a69(0x1f3)]&&_0x891f7a[_0x4f4a69(0x1f3)]!=='';_0x2977df&&!_0x891f7a[_0x4f4a69(0x221)]&&_0x4634eb['push']({'level':'error','path':_0x30919b+_0x4f4a69(0x1ec),'code':'BEHAVIOR_SOURCE_MISSING_FILTER','message':_0x4f4a69(0x224)+_0x891f7a['source']+'\x27\x20with\x20attribute\x20\x27'+_0x891f7a[_0x4f4a69(0x1f3)]+'\x27\x20'+_0x4f4a69(0x228)+_0x4f4a69(0x1f6)+_0x4f4a69(0x1ed),'location':getLocationFromPath(_0x3ed3da[_0x4f4a69(0x216)],_0x3ed3da[_0x4f4a69(0x20a)],pathToArray(_0x30919b+_0x4f4a69(0x1ec)))}),_0x2977df&&_0x891f7a[_0x4f4a69(0x221)]&&_0x4634eb[_0x4f4a69(0x215)]({'level':'warning','path':_0x30919b+_0x4f4a69(0x20c),'code':_0x4f4a69(0x1e7),'message':_0x4f4a69(0x21b)+_0x891f7a[_0x4f4a69(0x1f3)]+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x3ed3da[_0x4f4a69(0x216)],_0x3ed3da[_0x4f4a69(0x20a)],pathToArray(_0x30919b+_0x4f4a69(0x20c)))});}}return _0x4634eb;}