@treasuredata/tdx 2026.6.4 → 2026.6.5

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 (241) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-move-command.d.ts +19 -0
  45. package/dist/commands/segment-move-command.d.ts.map +1 -0
  46. package/dist/commands/segment-move-command.js +1 -0
  47. package/dist/commands/segment-move-command.js.map +1 -0
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/table-deleted.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/unset-command.js +1 -1
  59. package/dist/commands/upgrade-command.js +1 -1
  60. package/dist/commands/use-command.js +1 -1
  61. package/dist/commands/user-command.js +1 -1
  62. package/dist/commands/work-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.d.ts +18 -0
  106. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  107. package/dist/sdk/client/cdp-api-client.js +1 -1
  108. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  109. package/dist/sdk/client/delivery-api-client.js +1 -1
  110. package/dist/sdk/client/endpoints.js +1 -1
  111. package/dist/sdk/client/engage-api-client.js +1 -1
  112. package/dist/sdk/client/http-client.js +1 -1
  113. package/dist/sdk/client/llm-api-client.js +1 -1
  114. package/dist/sdk/client/oauth-refresh.js +1 -1
  115. package/dist/sdk/client/rate-limiter.js +1 -1
  116. package/dist/sdk/client/td-api-client.js +1 -1
  117. package/dist/sdk/client/trino-api-client.js +1 -1
  118. package/dist/sdk/client/workflow-client.js +1 -1
  119. package/dist/sdk/connection-validator.js +1 -1
  120. package/dist/sdk/connection.js +1 -1
  121. package/dist/sdk/delivery.js +1 -1
  122. package/dist/sdk/engage/campaign-pull.js +1 -1
  123. package/dist/sdk/engage/campaign-push.js +1 -1
  124. package/dist/sdk/engage/campaign-validator.js +1 -1
  125. package/dist/sdk/engage/campaign-yaml.js +1 -1
  126. package/dist/sdk/engage/template-pull.js +1 -1
  127. package/dist/sdk/engage/template-push.js +1 -1
  128. package/dist/sdk/engage/template-validator.js +1 -1
  129. package/dist/sdk/engage/template-yaml.js +1 -1
  130. package/dist/sdk/engage/types/campaign-def.js +1 -1
  131. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  132. package/dist/sdk/engage/types/template-schema.js +1 -1
  133. package/dist/sdk/engage.js +1 -1
  134. package/dist/sdk/errors.js +1 -1
  135. package/dist/sdk/index.js +1 -1
  136. package/dist/sdk/io/index.js +1 -1
  137. package/dist/sdk/io/node-filesystem.js +1 -1
  138. package/dist/sdk/job.js +1 -1
  139. package/dist/sdk/journey.js +1 -1
  140. package/dist/sdk/llm/chat-cache.js +1 -1
  141. package/dist/sdk/llm/index.js +1 -1
  142. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  143. package/dist/sdk/llm/model-factors.js +1 -1
  144. package/dist/sdk/llm/user-settings.js +1 -1
  145. package/dist/sdk/personalization.js +1 -1
  146. package/dist/sdk/policy.js +1 -1
  147. package/dist/sdk/query/deleted-table-validation.js +1 -1
  148. package/dist/sdk/query/index.js +1 -1
  149. package/dist/sdk/query/sql-parser.js +1 -1
  150. package/dist/sdk/realtime.js +1 -1
  151. package/dist/sdk/schedule.js +1 -1
  152. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/fields-display.js +1 -1
  154. package/dist/sdk/segment/file-discovery.js +1 -1
  155. package/dist/sdk/segment/journey-utils.js +1 -1
  156. package/dist/sdk/segment/journey-validator.js +1 -1
  157. package/dist/sdk/segment/journey-yaml.js +1 -1
  158. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  159. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/pull-workflow.js +1 -1
  161. package/dist/sdk/segment/push-recovery.js +1 -1
  162. package/dist/sdk/segment/push-workflow.js +1 -1
  163. package/dist/sdk/segment/resolution-context.js +1 -1
  164. package/dist/sdk/segment/segment-path-parser.js +1 -1
  165. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  166. package/dist/sdk/segment/segment-validator.js +1 -1
  167. package/dist/sdk/segment/target-resolution.js +1 -1
  168. package/dist/sdk/segment/tdx-config.js +1 -1
  169. package/dist/sdk/segment/types/activation-schema.js +1 -1
  170. package/dist/sdk/segment/types/journey-def.js +1 -1
  171. package/dist/sdk/segment/types/journey-schema.js +1 -1
  172. package/dist/sdk/segment/types/segment-def.js +1 -1
  173. package/dist/sdk/segment/types/segment-schema.js +1 -1
  174. package/dist/sdk/segment/validate-files.js +1 -1
  175. package/dist/sdk/segment/yaml-validator.js +1 -1
  176. package/dist/sdk/segment.d.ts +28 -1
  177. package/dist/sdk/segment.d.ts.map +1 -1
  178. package/dist/sdk/segment.js +1 -1
  179. package/dist/sdk/segment.js.map +1 -1
  180. package/dist/sdk/types/cdp.d.ts +15 -0
  181. package/dist/sdk/types/cdp.d.ts.map +1 -1
  182. package/dist/sdk/types/index.d.ts +1 -1
  183. package/dist/sdk/types/index.d.ts.map +1 -1
  184. package/dist/sdk/types/index.js +1 -1
  185. package/dist/sdk/types/index.js.map +1 -1
  186. package/dist/sdk/types/progress.js +1 -1
  187. package/dist/sdk/types/workspace.js +1 -1
  188. package/dist/sdk/user.js +1 -1
  189. package/dist/sdk/util/format-detector.js +1 -1
  190. package/dist/sdk/util/formatters.js +1 -1
  191. package/dist/sdk/util/index.js +1 -1
  192. package/dist/sdk/util/paginate.js +1 -1
  193. package/dist/sdk/util/tree-formatter.js +1 -1
  194. package/dist/sdk/workflow/archive-validation.js +1 -1
  195. package/dist/sdk/workflow/clone-workflow.js +1 -1
  196. package/dist/sdk/workflow/index.js +1 -1
  197. package/dist/sdk/workflow/pull-workflow.js +1 -1
  198. package/dist/sdk/workflow/push-workflow.js +1 -1
  199. package/dist/sdk/workflow/task-graph.js +1 -1
  200. package/dist/sdk/workflow/tdx-config.js +1 -1
  201. package/dist/sdk/workflow/workflow-utils.js +1 -1
  202. package/dist/sdk/workspace/access-tracker.js +1 -1
  203. package/dist/sdk/workspace/frontmatter.js +1 -1
  204. package/dist/sdk/workspace/git.js +1 -1
  205. package/dist/sdk/workspace/index.js +1 -1
  206. package/dist/sdk/workspace/templates.js +1 -1
  207. package/dist/sdk/workspace/weekly.js +1 -1
  208. package/dist/sdk/workspace/wikilinks.js +1 -1
  209. package/dist/test-utils/command-runner.js +1 -1
  210. package/dist/test-utils/factories.js +1 -1
  211. package/dist/test-utils/fixtures.js +1 -1
  212. package/dist/test-utils/http-mock.js +1 -1
  213. package/dist/test-utils/index.js +1 -1
  214. package/dist/utils/async.js +1 -1
  215. package/dist/utils/colors.js +1 -1
  216. package/dist/utils/diff.js +1 -1
  217. package/dist/utils/file-permissions.js +1 -1
  218. package/dist/utils/file-reader.js +1 -1
  219. package/dist/utils/github-releases.js +1 -1
  220. package/dist/utils/global-cache.js +1 -1
  221. package/dist/utils/json-loader.js +1 -1
  222. package/dist/utils/local-cache.js +1 -1
  223. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  224. package/dist/utils/logger/formatters/index.js +1 -1
  225. package/dist/utils/logger/handlers/console-handler.js +1 -1
  226. package/dist/utils/logger/handlers/file-handler.js +1 -1
  227. package/dist/utils/logger/handlers/index.js +1 -1
  228. package/dist/utils/logger/handlers/null-handler.js +1 -1
  229. package/dist/utils/logger/index.js +1 -1
  230. package/dist/utils/logger/logger.js +1 -1
  231. package/dist/utils/logger/types.js +1 -1
  232. package/dist/utils/option-validation.js +1 -1
  233. package/dist/utils/process.js +1 -1
  234. package/dist/utils/prompt.js +1 -1
  235. package/dist/utils/spinner.js +1 -1
  236. package/dist/utils/sse-parser.js +1 -1
  237. package/dist/utils/string-utils.js +1 -1
  238. package/dist/utils/table-ref-parser.js +1 -1
  239. package/dist/utils/tdx-logger.js +1 -1
  240. package/dist/utils/version-check.js +1 -1
  241. package/package.json +1 -1
@@ -1 +1 @@
1
- const a155_0x213229=a155_0x27e5;(function(_0x4f8b6a,_0x7f42f0){const _0x1529e1=a155_0x27e5,_0x1e41f8=_0x4f8b6a();while(!![]){try{const _0x195fe7=parseInt(_0x1529e1(0x1a8))/0x1+parseInt(_0x1529e1(0x12e))/0x2*(-parseInt(_0x1529e1(0x1bd))/0x3)+-parseInt(_0x1529e1(0x15d))/0x4*(parseInt(_0x1529e1(0x129))/0x5)+parseInt(_0x1529e1(0x150))/0x6+-parseInt(_0x1529e1(0x105))/0x7*(parseInt(_0x1529e1(0x193))/0x8)+-parseInt(_0x1529e1(0xde))/0x9+parseInt(_0x1529e1(0x146))/0xa*(parseInt(_0x1529e1(0x163))/0xb);if(_0x195fe7===_0x7f42f0)break;else _0x1e41f8['push'](_0x1e41f8['shift']());}catch(_0x47bb02){_0x1e41f8['push'](_0x1e41f8['shift']());}}}(a155_0x4014,0x35dfa));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a155_0x213229(0xf5));export const PENDING_SEGMENT_PREFIX=a155_0x213229(0x11a);export const PENDING_ACTIVATION_PREFIX=a155_0x213229(0x1a5);export function createPendingSegmentId(_0x165912){return''+PENDING_SEGMENT_PREFIX+_0x165912+'__';}export function isPendingSegmentId(_0x3cc8d4){const _0x168f0f=a155_0x213229;return _0x3cc8d4[_0x168f0f(0x116)](PENDING_SEGMENT_PREFIX)&&!_0x3cc8d4['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2252ca){const _0xc2d13c=a155_0x213229;return _0x2252ca[_0xc2d13c(0x1c6)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5edec9){return''+PENDING_ACTIVATION_PREFIX+_0x5edec9+'__';}export function isPendingActivationId(_0x377b4e){const _0x36a891=a155_0x213229;return _0x377b4e[_0x36a891(0x116)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x40cf0d){const _0xdca3d8=a155_0x213229;return _0x40cf0d[_0xdca3d8(0x1c6)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x29c264,_0x157086){const _0x35c1a4=a155_0x213229,_0xe79614=_0x29c264+'::'+(_0x157086[_0x35c1a4(0xfe)]()||_0x35c1a4(0x175)),_0x576798=createHash('sha1')[_0x35c1a4(0x152)](_0xe79614)['digest'](_0x35c1a4(0x1b2))[_0x35c1a4(0x19d)](0x0,0xc);return _0x35c1a4(0x1d2)+_0x576798;}export function ensureJourneyDefaults(_0x491719){const _0x4a3ed5=a155_0x213229;!_0x491719['description']&&(_0x491719[_0x4a3ed5(0x177)]=''),!_0x491719['state']&&(_0x491719[_0x4a3ed5(0x14e)]='draft');}export function injectExistingStageIds(_0x1ba813,_0x3dbc26){const _0x191883=a155_0x213229,_0x2713f7=new Map(_0x3dbc26[_0x191883(0x19f)](_0x576176=>[_0x576176[_0x191883(0x108)],_0x576176['id']]));for(const _0x56d4c5 of _0x1ba813){if(!_0x56d4c5['id']){const _0x512329=_0x2713f7['get'](_0x56d4c5[_0x191883(0x108)]);_0x512329&&(_0x56d4c5['id']=_0x512329);}}}function a155_0x4014(){const _0x5c32de=['toString','relative','attributes','Delete\x20the\x20push\x20recovery\x20file\x20(','updateSegmentById','\x27\x20entry\x20criteria','diff','join','deleteSegment','33009OmNABE','segmentFolderId','message','deps','split','keys','listActivations','goal','resolveSegment','replace','yamlActivation','DecisionPoint','logDeleted','folderId','waitStepType','folderPath','results','push','sort','journeyBundleName','ACTIVATION_UPDATE_ERROR','journey_entry_criteria_','logInfo','createdSegmentId','\x20journey\x20from\x20file:\x20','index','activation_template_id','find','type','folder_creating','debug','notification','null','resolvedRule','waitStep','conditions','3574953riLYRJ','deleteActivation','idToEmailMap','entry','conditionTimeoutDuration','\x27\x20exit\x20criteria','versionNumber','run_after_journey_refresh','toISOString','entryCriteria','localName','with','segmentByFolderAndName','user','\x27\x20by\x20rule\x20content','filter','isNew','journeyBundlesByFolderAndName','segment_deleting','parse','journey_updating','./child-segment-yaml.js','journey','tdx.sdk.push-workflow','Created\x20segment\x20\x27','goal\x20criteria','onProgress','rule','activationContext','and\x20the\x20server\x20segment,\x20then\x20retry.','\x27\x20for\x20','logSuccess','trim','resolveJourneyId','Created\x20folder\x20\x27','journeyById','Updated\x20activation\x20\x27','createActivation','\x20(referenced\x20in\x20journey\x20','2576BhAwUa','object','branches','name','NOT_FOUND','activation_updated','conditionTimeoutUnit','max','updateActivation','segment_updated','parentId','parseDocument','Embedded\x20segment\x20\x27','Fetching\x20','schedule','Segment\x20not\x20found','journey_updated','startsWith','hasChanges','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','__pending_','Updating\x20segment\x20\x27','add','SEGMENT_UPDATE_ERROR','validatedRequest','verbose','all','Name\x20has\x20already\x20been\x20taken','created','updated','dirname','some','relationships','progress','deleted','82785xNrKvt','activation_creating','journeyActivationStepId','entries','withProgress','62JGOwuq','from','SEGMENT_SYNTAX_ERROR','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','journeys','segmentId','journey_created','effectiveFolderId','kind','rootFolderId','Matched\x20server\x20segment\x20\x27','Deleted\x20activation\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Journey\x20\x27','activationParams','stages','activations','connector_config','journeyId','embedded_segment_creating','buildUserMaps','Creating\x20folder\x20\x27','absolutePath','createFolder','370jIqNLS','values','yamlConfig','Failed\x20to\x20resolve\x20segment\x20','existingSegment','reduce','steps','create','state','\x27\x20decision\x20point\x20branch\x20\x27','2155254giIdXw','journeyActivationNameToId','update','day','.$1.push-recovery.json','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegment\x20failed\x20for\x20','exitCriterias','):\x20','embedded_activation_creating','toLowerCase','behavior','\x20error(s)','52gknUoH','all_columns','stringify','includes','journeyStages','Creating\x20activation\x20\x27','132121XbVOwz','item','ACTIVATION_SYNTAX_ERROR','\x20activation\x20\x27','set','createJourneySegment','activation_updating','activationActions','delete','uniqueSegmentName','size','logWarning','stage\x20\x27','INTERNAL','Updated\x20segment\x20\x27','Activation','\x27...',').\x20','segment','length','description','journeyName','action','nameToType','segment_creating','activationStepsById','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','activation_deleted','uniqueServerName','activationsBySegmentId','\x27\x20wait\x20condition','utf-8','segments','has','embedded_activation_created','match','get','decision_point','segment_deleted','conditionSegmentId','skipSegments','folderPathToId','list','Segment\x20not\x20found:\x20','entry_criteria','Creating\x20segment\x20\x27','existingJourney','createSegment','984JrPsqn','milestone','parentFolder','connection','nameToId','SEGMENT_NOT_FOUND','unchanged','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Created\x20journey\x20\x27','Failed\x20to\x20','slice','segment_created','map','\x0a\x20\x20','segmentNameToId','getJourney','existingSegments','Condition','__pending_act_','../../utils/async.js','connectionIdToNameMap','415865nhSvEC','isArray','flatMap','embeddedSegmentNameToId','Updating\x20activation\x20\x27','columns','waitStepUnit','WaitStep','data','valid','hex','getSegment'];a155_0x4014=function(){return _0x5c32de;};return a155_0x4014();}export function resolveTDFolderPath(_0x2f87be,_0x18a668,_0x4fb91d){if(!_0x18a668)return _0x2f87be;if(_0x2f87be===_0x4fb91d||_0x2f87be['startsWith'](_0x4fb91d+'/'))return _0x2f87be;return _0x2f87be?_0x4fb91d+'/'+_0x2f87be:_0x4fb91d;}export function addFoldersToCreate(_0x249da1,_0x27e8d7,_0x233bbd){const _0x11859c=a155_0x213229;if(!_0x249da1)return;if(_0x27e8d7[_0x11859c(0x184)](_0x249da1))return;const _0x1185d6=_0x249da1[_0x11859c(0x1c1)]('/');let _0x1a0f9e='';for(const _0x1726b6 of _0x1185d6){_0x1a0f9e=_0x1a0f9e?_0x1a0f9e+'/'+_0x1726b6:_0x1726b6,!_0x27e8d7[_0x11859c(0x184)](_0x1a0f9e)&&_0x233bbd[_0x11859c(0x11c)](_0x1a0f9e);}}export function sortFoldersByDepth(_0x16504e){return[..._0x16504e]['sort']((_0x367543,_0x302d35)=>{const _0x35087b=a155_0x27e5,_0x14effd=(_0x367543[_0x35087b(0x186)](/\//g)||[])['length'],_0x83c756=(_0x302d35[_0x35087b(0x186)](/\//g)||[])[_0x35087b(0x176)];return _0x14effd-_0x83c756;});}import*as a155_0x28f1ca from'yaml';import{readFileSync}from'fs';import a155_0x55d76c from'path';import{isJourneyDef,parseYamlString as a155_0x1d7fcb,toYamlString as a155_0x452fd9,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(_0x3d285b){const _0x21e967=a155_0x213229;if(Array[_0x21e967(0x1a9)](_0x3d285b))return'['+_0x3d285b[_0x21e967(0x19f)](_0x3bfbab=>stableStringify(_0x3bfbab))['join'](',')+']';if(_0x3d285b&&typeof _0x3d285b===_0x21e967(0x106)){const _0x2f8e45=_0x3d285b,_0xbe7285=Object['keys'](_0x2f8e45)[_0x21e967(0x1cf)](),_0x1fe6d2=_0xbe7285[_0x21e967(0x19f)](_0xc3b079=>'\x22'+_0xc3b079+'\x22:'+stableStringify(_0x2f8e45[_0xc3b079]));return'{'+_0x1fe6d2[_0x21e967(0x1bb)](',')+'}';}const _0x27f84e=JSON[_0x21e967(0x15f)](_0x3d285b);return _0x27f84e===undefined?_0x21e967(0xda):_0x27f84e;}function activationSignature(_0x1fc5cd){const _0x5c3dc3=a155_0x213229,_0x322b23={'connection':_0x1fc5cd[_0x5c3dc3(0x196)],..._0x1fc5cd[_0x5c3dc3(0x15e)]!==undefined&&{'all_columns':_0x1fc5cd['all_columns']},..._0x1fc5cd[_0x5c3dc3(0x1ad)]!==undefined&&{'columns':_0x1fc5cd['columns']},..._0x1fc5cd[_0x5c3dc3(0x15b)]!==undefined&&{'behavior':_0x1fc5cd[_0x5c3dc3(0x15b)]},..._0x1fc5cd[_0x5c3dc3(0x113)]!==undefined&&{'schedule':_0x1fc5cd[_0x5c3dc3(0x113)]},..._0x1fc5cd[_0x5c3dc3(0xd9)]!==undefined&&{'notification':_0x1fc5cd[_0x5c3dc3(0xd9)]},..._0x1fc5cd[_0x5c3dc3(0x13f)]!==undefined&&{'connector_config':_0x1fc5cd['connector_config']},..._0x1fc5cd['activation_template_id']!==undefined&&{'activation_template_id':_0x1fc5cd[_0x5c3dc3(0x1d7)]}};return stableStringify(_0x322b23);}async function fetchSegment(_0x1d13a7,_0x4555db,_0x4a58ab,_0x5769d0){const _0x4c5158=a155_0x213229,_0x13f8a5=_0x5769d0?.[_0x4c5158(0xd5)](_0x1ce19f=>_0x1ce19f['id']===_0x4a58ab);if(_0x13f8a5)return _0x13f8a5;try{return await _0x1d13a7[_0x4c5158(0x175)][_0x4c5158(0x1b3)](_0x4555db,_0x4a58ab);}catch(_0x4955c3){logger[_0x4c5158(0xd8)](_0x4c5158(0x156)+_0x4a58ab+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x4955c3);try{return await _0x1d13a7[_0x4c5158(0x175)]['getSegmentEntity'](_0x4a58ab);}catch(_0x1310e1){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x4a58ab+':\x20'+_0x1310e1),null;}}}function a155_0x27e5(_0x5e088f,_0x535437){_0x5e088f=_0x5e088f-0xd5;const _0x40148c=a155_0x4014();let _0x27e5a7=_0x40148c[_0x5e088f];return _0x27e5a7;}function recoverSegmentIdsFromPushRecovery(_0x3e53b6,_0xf20dea,_0x55b572){const _0x42f040=a155_0x213229,_0x2e37f7=readPushRecovery(_0x3e53b6[_0x42f040(0x144)]);if(_0x2e37f7?.[_0x42f040(0x178)]===_0x3e53b6[_0x42f040(0x148)][_0x42f040(0x108)])for(const [_0x413beb,_0xdeff18]of Object[_0x42f040(0x12c)](_0x2e37f7[_0x42f040(0x183)])){const _0x2666a6=generateDeterministicJourneySegmentName(_0x3e53b6[_0x42f040(0x148)][_0x42f040(0x108)],_0x413beb);_0xdeff18[_0x42f040(0x17f)]===_0x2666a6&&(_0xf20dea[_0x42f040(0x167)](_0x413beb,_0xdeff18[_0x42f040(0x133)]),_0x55b572[_0x42f040(0x167)](_0x413beb,_0xdeff18['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x159eef,_0x5c0510,_0x11493b,_0x5b013e){const _0x595384=a155_0x213229;let _0xa3d9c;try{_0xa3d9c=await _0x159eef[_0x595384(0x175)][_0x595384(0x168)]({'name':_0x11493b['uniqueSegmentName'],'description':_0x11493b[_0x595384(0x177)],'journeyId':_0x11493b['journeyId'],'rule':_0x5b013e(_0x11493b[_0x595384(0xdb)],!![]),'countPopulation':!![],'parentFolderId':_0x11493b[_0x595384(0x1ca)],'audienceId':_0x11493b[_0x595384(0x10f)]});}catch(_0x15ca46){const _0x295c76=_0x15ca46 instanceof Error&&_0x15ca46[_0x595384(0x1bf)][_0x595384(0x160)](_0x595384(0x121));if(_0x295c76){const _0x32ac66=readPushRecovery(_0x5c0510[_0x595384(0x144)]),_0x5e5fc1=_0x32ac66?.[_0x595384(0x178)]===_0x5c0510['yamlConfig']['name']?_0x32ac66['segments'][_0x11493b['localName']]:undefined;if(_0x5e5fc1?.[_0x595384(0x17f)]===_0x11493b['uniqueSegmentName'])await _0x159eef['segment'][_0x595384(0x1b8)](_0x11493b['parentId'],_0x5e5fc1[_0x595384(0x133)],{'description':_0x11493b[_0x595384(0x177)],'rule':_0x5b013e(_0x11493b[_0x595384(0xdb)],!![]),'countPopulation':!![]}),_0xa3d9c=_0x5e5fc1[_0x595384(0x133)];else throw new SDKError(ErrorCode[_0x595384(0x11d)],_0x595384(0x111)+_0x11493b[_0x595384(0xe8)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x595384(0x1b7)+_0x5c0510[_0x595384(0x144)]['replace'](/([^/]+)$/,_0x595384(0x154))+')\x20')+_0x595384(0xfb),_0x15ca46);}else throw _0x15ca46;}return saveSegmentToPushRecovery(_0x5c0510[_0x595384(0x144)],_0x5c0510[_0x595384(0x148)][_0x595384(0x108)],_0x11493b[_0x595384(0xe8)],{'segmentId':_0xa3d9c,'uniqueServerName':_0x11493b[_0x595384(0x16c)],'createdAt':new Date()[_0x595384(0xe6)]()}),_0xa3d9c;}export async function prepareSegmentFiles(_0x28668c,_0x29b587,_0x208ca5,_0x2f87f1,_0xa42fa1){const _0x54980f=a155_0x213229,{activationDefToCreateRequest:_0x5241a1}=await import(_0x54980f(0xf3)),_0x82d80e=[],_0x3ce882=new Set();for(const {yamlConfig:_0x18e099,folderPath:_0x36ab8c,sourcePath:_0x2e8962}of _0x28668c){const _0x29d03d=resolveTDFolderPath(_0x36ab8c,_0x2f87f1,_0xa42fa1),_0x93ffd1=_0x29d03d+':'+_0x18e099[_0x54980f(0x108)],_0x18e381=_0x29b587[_0x54980f(0xea)]['get'](_0x93ffd1),_0x2dd6f1=_0x18e381?_0x29b587[_0x54980f(0x180)][_0x54980f(0x187)](_0x18e381['id'])||[]:[];addFoldersToCreate(_0x29d03d,_0x29b587[_0x54980f(0x18c)],_0x3ce882);const _0x4e830b=calculateActivationActions(_0x18e099[_0x54980f(0x13e)]||[],_0x2dd6f1,_0x29b587[_0x54980f(0xe0)],_0x29b587[_0x54980f(0x1a7)]);for(const _0x2cfb8e of _0x4e830b){(_0x2cfb8e['type']===_0x54980f(0x14d)||_0x2cfb8e[_0x54980f(0xd6)]===_0x54980f(0x152))&&_0x2cfb8e[_0x54980f(0x1c7)]&&(_0x2cfb8e[_0x54980f(0x11e)]=await _0x5241a1(_0x2cfb8e[_0x54980f(0x1c7)],_0x208ca5));}const _0x25d4ff=calculateSegmentDiff(_0x18e099,_0x18e381,_0x2dd6f1,_0x29b587[_0x54980f(0xe0)],_0x29b587['connectionIdToNameMap']);_0x82d80e[_0x54980f(0x1ce)]({'relativePath':_0x18e099['name'],'absolutePath':_0x2e8962,'yamlConfig':_0x18e099,'folderPath':_0x29d03d,'existingSegment':_0x18e381,'existingActivations':_0x2dd6f1,'isNew':_0x25d4ff[_0x54980f(0xee)],'hasChanges':_0x25d4ff[_0x54980f(0x117)],'diff':_0x25d4ff[_0x54980f(0x1ba)],'activationActions':_0x4e830b});}return{'segmentFiles':_0x82d80e,'foldersToCreate':_0x3ce882};}export async function prepareJourneyFiles(_0x362710,_0x1a7d0a,_0x5003ed,_0x6604c8){const _0x44c135=a155_0x213229,_0x5b249a=[],_0x13506e=new Set();for(const {yamlConfig:_0x36cf3a,folderPath:_0x2028de,sourcePath:_0x596b84}of _0x362710){const _0x3663af=resolveTDFolderPath(_0x2028de,_0x5003ed,_0x6604c8),_0x1d398c=_0x3663af+':'+_0x36cf3a[_0x44c135(0x108)],_0x21e234=_0x1a7d0a[_0x44c135(0xef)]['get'](_0x1d398c);let _0x1b09b9,_0x266155;if(_0x21e234&&_0x21e234[_0x44c135(0x176)]>0x0){const _0x1699e8=buildLocalExpandedRuleMappings(_0x36cf3a),{createYamlContext:_0x30224f,prefetchJourneySegments:_0x545e6f}=createPushYamlContextForBundle(_0x1a7d0a[_0x44c135(0x1c0)],_0x1a7d0a[_0x44c135(0x10f)],_0x1a7d0a['existingSegments'],_0x1699e8,_0x1a7d0a[_0x44c135(0xe0)],_0x1a7d0a[_0x44c135(0x1a7)],_0x1a7d0a[_0x44c135(0x17c)],_0x1a7d0a[_0x44c135(0x101)]);await _0x545e6f(_0x21e234[_0x44c135(0x19f)](_0x1f07e0=>_0x1f07e0['id']));const _0x5c6976=await _0x1a7d0a[_0x44c135(0x1c0)][_0x44c135(0xf4)]['getLatestJourneyId'](_0x21e234[0x0]['journeyBundleId']),_0x246a84=hasMultipleVersions(_0x36cf3a),_0x5cd6f0=async _0xff3372=>{const _0x348e21=_0x44c135,_0x2c6408=_0x1a7d0a[_0x348e21(0x101)]?.[_0x348e21(0x187)](_0xff3372);if(_0x2c6408)return _0x2c6408;return _0x1a7d0a['fetchJourney']({'journeyId':_0xff3372,'journeyName':_0x36cf3a['name'],'isMultiVersion':_0x21e234[_0x348e21(0x176)]>0x1});};if(_0x246a84&&_0x21e234[_0x44c135(0x176)]>0x1){const _0x31e778=[];for(const _0x34dda1 of _0x21e234){const _0x3ef850=_0x34dda1[_0x44c135(0xe4)]||0x1;_0x1a7d0a[_0x44c135(0x127)]?.['update'](_0x44c135(0x112)+_0x36cf3a['name']+'\x20v'+_0x3ef850);const _0x37ff1c=await _0x5cd6f0(_0x34dda1['id']),_0x360cb1=_0x30224f(_0x34dda1['id']),_0x28062b=await journeyResponseToDef(_0x37ff1c,_0x360cb1);_0x31e778[_0x44c135(0x1ce)]({'item':_0x34dda1,'yaml':_0x28062b});}const _0x2f8095=buildLocalRuleToNameMappingFromJourney(_0x36cf3a);_0x266155=buildMergedJourneyDef(_0x31e778,_0x2f8095,_0x5c6976);const _0x3fd281=Math[_0x44c135(0x10c)](..._0x31e778[_0x44c135(0x19f)](_0xc49d58=>_0xc49d58[_0x44c135(0x164)]['versionNumber']||0x0)),_0x4a7da8=_0x21e234['find'](_0x1231f4=>(_0x1231f4[_0x44c135(0xe4)]||0x0)===_0x3fd281);_0x4a7da8&&(_0x1a7d0a[_0x44c135(0x127)]?.[_0x44c135(0x152)](_0x44c135(0x112)+_0x36cf3a[_0x44c135(0x108)]+'\x20v'+_0x3fd281),_0x1b09b9=await _0x5cd6f0(_0x4a7da8['id']));}else{const _0x1c67a5=_0x21e234[_0x21e234[_0x44c135(0x176)]-0x1];_0x1a7d0a[_0x44c135(0x127)]?.[_0x44c135(0x152)](_0x44c135(0x112)+_0x36cf3a['name']),_0x1b09b9=await _0x5cd6f0(_0x1c67a5['id']);const _0x4b5052=_0x30224f(_0x1c67a5['id']),_0x220312=await journeyResponseToDef(_0x1b09b9,_0x4b5052),_0x4c24a5=buildLocalRuleToNameMappingFromJourney(_0x36cf3a);_0x266155=buildMergedJourneyDef([{'item':_0x1c67a5,'yaml':_0x220312}],_0x4c24a5,_0x5c6976);}}addFoldersToCreate(_0x3663af,_0x1a7d0a[_0x44c135(0x18c)],_0x13506e);const _0x4a8310=calculateJourneyDiff(_0x36cf3a,_0x266155);_0x5b249a['push']({'relativePath':_0x36cf3a[_0x44c135(0x108)],'absolutePath':_0x596b84,'yamlConfig':_0x36cf3a,'folderPath':_0x3663af,'existingJourney':_0x1b09b9,'isNew':_0x4a8310[_0x44c135(0xee)],'hasChanges':_0x4a8310['hasChanges'],'diff':_0x4a8310['diff']});}return{'journeyFiles':_0x5b249a,'foldersToCreate':_0x13506e};}export function calculateActivationActions(_0x30a3a1,_0x5ad173,_0x593c51,_0xef9eb5){const _0x18926d=a155_0x213229,_0x49c11c=[],_0x55f97b=new Map();for(const _0x230711 of _0x5ad173){_0x55f97b[_0x18926d(0x167)](_0x230711[_0x18926d(0x108)],_0x230711);}const _0x34dbb9=new Map();for(const _0x271673 of _0x30a3a1){_0x34dbb9['set'](_0x271673[_0x18926d(0x108)],_0x271673);}for(const _0xe5cf06 of _0x30a3a1){const _0x1b518f=_0x55f97b['get'](_0xe5cf06['name']);if(!_0x1b518f)_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x14d),'name':_0xe5cf06[_0x18926d(0x108)],'yamlActivation':_0xe5cf06});else{const _0x2146d0=activationResponseToDef(_0x1b518f,_0x593c51,_0xef9eb5),_0xaaeb70=a155_0x28f1ca[_0x18926d(0x15f)](_0x2146d0),_0x598a2e=a155_0x28f1ca[_0x18926d(0x15f)](_0xe5cf06);_0xaaeb70!==_0x598a2e&&_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x152),'name':_0xe5cf06[_0x18926d(0x108)],'yamlActivation':_0xe5cf06,'existingActivation':_0x1b518f});}}for(const _0x1cfa29 of _0x5ad173){!_0x34dbb9[_0x18926d(0x184)](_0x1cfa29[_0x18926d(0x108)])&&_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x16b),'name':_0x1cfa29[_0x18926d(0x108)],'existingActivation':_0x1cfa29});}return _0x49c11c;}function calculateYamlDiff(_0x4fb30e,_0x4d477c){if(_0x4d477c){const _0x1e10a4=generateDiff(_0x4d477c,_0x4fb30e),_0x53e15c=hasChanges(_0x1e10a4);return{'isNew':![],'hasChanges':_0x53e15c,'diff':_0x53e15c?formatDiffWithColors(_0x1e10a4):undefined};}const _0x198906=generateDiff('',_0x4fb30e);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x198906)};}export function calculateSegmentDiff(_0x3f2de7,_0x48b361,_0x3876ae,_0x5427cc,_0x1e4617){const _0x931e5d=segmentToYamlString(_0x3f2de7),_0x2541b2=_0x48b361?segmentToYamlString(segmentWithActivationsToYaml(_0x48b361,_0x3876ae,undefined,_0x5427cc,_0x1e4617)):undefined;return calculateYamlDiff(_0x931e5d,_0x2541b2);}export function calculateJourneyDiff(_0x236450,_0x5bc459){const _0x4ba88d=normalizeJourneyDef(_0x236450,_0x236450),_0x37f9f6=a155_0x452fd9(_0x4ba88d),_0x1302d4=_0x5bc459?a155_0x452fd9(normalizeJourneyDef(_0x5bc459,_0x236450)):undefined;return calculateYamlDiff(_0x37f9f6,_0x1302d4);}export function findSegmentsToDelete(_0x40111f,_0x5cbb88,_0x157d76,_0x1692db,_0x51cd6d){const _0x47e6c8=new Set();for(const {yamlConfig:_0xff0bcd,folderPath:_0x47566c}of _0x5cbb88){_0x47e6c8['add'](_0x47566c+':'+_0xff0bcd['name']);}return _0x40111f['filter'](_0x12fc60=>{const _0x735e02=a155_0x27e5,_0x1f8d9e=_0x12fc60['segmentFolderId']?_0x157d76['get'](_0x12fc60[_0x735e02(0x1be)][_0x735e02(0x1b4)]())||'':'',_0x40f217=_0x1f8d9e+':'+_0x12fc60[_0x735e02(0x108)];if(_0x47e6c8[_0x735e02(0x184)](_0x40f217))return![];if(_0x51cd6d)return _0x1f8d9e===_0x1692db||_0x1f8d9e[_0x735e02(0x116)](_0x1692db+'/');return!![];});}export function findJourneysToDelete(_0xac30f8,_0x4d7988,_0x62452f,_0x200ed1,_0x54d31f){const _0x6f7db1=a155_0x213229,_0x4dfd6e=new Set();for(const {yamlConfig:_0x131aa0,folderPath:_0xaa6af0}of _0x4d7988){_0x4dfd6e[_0x6f7db1(0x11c)](_0xaa6af0+':'+_0x131aa0['name']);}return _0xac30f8[_0x6f7db1(0xed)](_0x3b60cb=>{const _0x1fc9bf=_0x6f7db1,_0x241f13=_0x3b60cb[_0x1fc9bf(0x1ca)]?_0x62452f[_0x1fc9bf(0x187)](_0x3b60cb[_0x1fc9bf(0x1ca)])||'':'',_0xdb3c58=_0x241f13+':'+_0x3b60cb[_0x1fc9bf(0x1d0)];if(_0x4dfd6e[_0x1fc9bf(0x184)](_0xdb3c58))return![];if(_0x54d31f)return _0x241f13===_0x200ed1||_0x241f13[_0x1fc9bf(0x116)](_0x200ed1+'/');return!![];});}export function buildSegmentLookupMap(_0x5ea753,_0x4f0a44){const _0x477fce=a155_0x213229,_0x4bfade=new Map();for(const _0x35567e of _0x5ea753){const _0x1e30bb=_0x35567e[_0x477fce(0x1be)]?_0x4f0a44[_0x477fce(0x187)](_0x35567e['segmentFolderId'][_0x477fce(0x1b4)]())||'':'',_0x30cde4=_0x1e30bb+':'+_0x35567e[_0x477fce(0x108)];_0x4bfade[_0x477fce(0x167)](_0x30cde4,_0x35567e);}return _0x4bfade;}export function buildSegmentNameToIdMap(_0x488817){const _0x59f045=a155_0x213229,_0x5d33aa=new Map();for(const _0x3a055a of _0x488817){_0x5d33aa['set'](_0x3a055a[_0x59f045(0x108)],_0x3a055a['id']);}return _0x5d33aa;}export function buildJourneyBundleLookupMap(_0x49a957,_0x36863c){const _0x5b7fc7=a155_0x213229,_0x459db8=new Map();for(const _0x408688 of _0x49a957){const _0xeb7d21=_0x408688['folderId']?_0x36863c['get'](_0x408688['folderId'])||'':'',_0x4ac3f8=_0xeb7d21+':'+_0x408688[_0x5b7fc7(0x1d0)];!_0x459db8['has'](_0x4ac3f8)&&_0x459db8[_0x5b7fc7(0x167)](_0x4ac3f8,[]),_0x459db8['get'](_0x4ac3f8)['push'](_0x408688);}for(const _0x561614 of _0x459db8[_0x5b7fc7(0x147)]()){_0x561614[_0x5b7fc7(0x1cf)]((_0x57a1bd,_0x5cf544)=>(_0x57a1bd['versionNumber']||0x0)-(_0x5cf544['versionNumber']||0x0));}return _0x459db8;}export function collectFoldersToCreate(_0x3658fe,_0x2b0919){const _0x23b145=a155_0x213229,_0x2fbfb6=new Set();for(const _0x3b4e03 of _0x3658fe){if(!_0x3b4e03)continue;if(_0x2b0919['has'](_0x3b4e03))continue;const _0x55bf94=_0x3b4e03[_0x23b145(0x1c1)]('/');let _0x50bf2c='';for(const _0x572215 of _0x55bf94){_0x50bf2c=_0x50bf2c?_0x50bf2c+'/'+_0x572215:_0x572215,!_0x2b0919[_0x23b145(0x184)](_0x50bf2c)&&_0x2fbfb6['add'](_0x50bf2c);}}return _0x2fbfb6;}export function parseAndClassifyYamlFiles(_0x44d12b,_0x337a3e,_0x1a9cfc){const _0x5ef72a=a155_0x213229,_0x59061b=[],_0x4c2a16=[];for(const _0x59b126 of _0x44d12b){const _0x25ba76=a155_0x55d76c[_0x5ef72a(0x1b5)](_0x337a3e,a155_0x55d76c[_0x5ef72a(0x124)](_0x59b126)),_0x6fde59=_0x25ba76==='.'?'':_0x25ba76[_0x5ef72a(0x1c6)](/\\/g,'/'),_0x5f59e7=readFileSync(_0x59b126,'utf-8'),_0x4369b8=a155_0x28f1ca[_0x5ef72a(0xf1)](_0x5f59e7);if(isJourneyDef(_0x4369b8)){const _0x48047d=a155_0x1d7fcb(_0x5f59e7);_0x4c2a16[_0x5ef72a(0x1ce)]({'yamlConfig':_0x48047d,'folderPath':_0x6fde59,'sourcePath':_0x59b126});}else{if(!_0x1a9cfc?.[_0x5ef72a(0x18b)]){const _0x5d1f34=parseSegmentYamlFile(_0x5f59e7),_0x1f97b2=normalizeChildSegmentYaml(_0x5d1f34);_0x59061b['push']({'yamlConfig':_0x1f97b2,'folderPath':_0x6fde59,'sourcePath':_0x59b126});}}}return{'segments':_0x59061b,'journeys':_0x4c2a16};}export function validateParsedFiles(_0x2ba56f,_0x4e0a6d){const _0x3a66e7=a155_0x213229,_0x1f5859=[];for(const {yamlConfig:_0x32a91a,sourcePath:_0x449f0d}of _0x2ba56f['segments']){const _0x57d301=readFileSync(_0x449f0d,'utf-8'),_0x3ecddd=a155_0x28f1ca[_0x3a66e7(0x110)](_0x57d301),_0x387630=validateSegmentDef(_0x32a91a,{'source':_0x57d301,'document':_0x3ecddd},{'skipSchema':!![]});if(!_0x387630[_0x3a66e7(0x1b1)]){const _0xc1e092=a155_0x55d76c[_0x3a66e7(0x1b5)](_0x4e0a6d,_0x449f0d);_0x1f5859[_0x3a66e7(0x1ce)]({'filePath':_0xc1e092,'source':_0x57d301,'result':_0x387630,'isJourney':![]});}}for(const {yamlConfig:_0x2dc4e5,sourcePath:_0x437b27}of _0x2ba56f[_0x3a66e7(0x132)]){const _0x2d8d5f=readFileSync(_0x437b27,_0x3a66e7(0x182)),_0x3dc6dc=a155_0x28f1ca[_0x3a66e7(0x110)](_0x2d8d5f),_0x492f14=validateJourneyDef(_0x2dc4e5,{'source':_0x2d8d5f,'document':_0x3dc6dc},{'skipSchema':!![]});if(!_0x492f14[_0x3a66e7(0x1b1)]){const _0x560027=a155_0x55d76c[_0x3a66e7(0x1b5)](_0x4e0a6d,_0x437b27);_0x1f5859[_0x3a66e7(0x1ce)]({'filePath':_0x560027,'source':_0x2d8d5f,'result':_0x492f14,'isJourney':!![]});}}return _0x1f5859;}export function formatValidationErrors(_0x44ea85){const _0x1a60f9=a155_0x213229,_0x4b0382=[];for(const {filePath:_0x5df401,source:_0x14c6b1,result:_0x8c0dc0,isJourney:_0x8692b0}of _0x44ea85){const _0x3fb47b=_0x8692b0?_0x1a60f9(0xf4):_0x1a60f9(0x175);_0x4b0382[_0x1a60f9(0x1ce)]('\x0a'+_0x5df401+'\x20('+_0x3fb47b+_0x1a60f9(0x158)+_0x8c0dc0['errors']['length']+_0x1a60f9(0x15c)),_0x4b0382['push'](formatValidationResult(_0x8c0dc0,_0x14c6b1,_0x5df401));}return _0x4b0382[_0x1a60f9(0x1bb)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x392b5c){const _0x324d5a=a155_0x213229,_0xaf5bab=new Set(),_0x39558d=new Map(),_0x2f06b2=collectSegmentUsageCounts(_0x392b5c);if(_0x392b5c[_0x324d5a(0x183)])for(const [_0x4617e9,_0x3c7744]of Object[_0x324d5a(0x12c)](_0x392b5c[_0x324d5a(0x183)])){_0xaf5bab[_0x324d5a(0x11c)](_0x4617e9);if(_0x3c7744[_0x324d5a(0xf9)]){const _0xe1ae64=yamlRuleToApi(_0x3c7744[_0x324d5a(0xf9)]),_0x444b02=apiRuleToYaml(_0xe1ae64);_0x39558d[_0x324d5a(0x167)](_0x4617e9,_0x444b02);}}const _0x248bcf=new Map();let _0x22f7e5=0x0;for(const [_0xbee8f6,_0x18a05b]of _0x39558d){const _0x50faaa=serializeExpandedRule(_0x18a05b,_0x39558d),_0x36556e=_0x248bcf[_0x324d5a(0x187)](_0x50faaa)||[];_0x36556e[_0x324d5a(0x1ce)]({'name':_0xbee8f6,'index':_0x22f7e5}),_0x248bcf[_0x324d5a(0x167)](_0x50faaa,_0x36556e),_0x22f7e5++;}const _0xf9ac7b=new Map();for(const [_0x5a84d9,_0x4ca5ac]of _0x248bcf){const _0x44aded=_0x4ca5ac[_0x324d5a(0x19d)]()[_0x324d5a(0x1cf)]((_0x4dec95,_0x572fc8)=>{const _0x5af217=_0x324d5a,_0x2309fb=_0x2f06b2[_0x5af217(0x187)](_0x4dec95['name'])||0x0,_0x16d161=_0x2f06b2['get'](_0x572fc8[_0x5af217(0x108)])||0x0;if(_0x2309fb!==_0x16d161)return _0x16d161-_0x2309fb;return _0x4dec95[_0x5af217(0x1d6)]-_0x572fc8[_0x5af217(0x1d6)];})[_0x324d5a(0x19f)](_0xbc2081=>_0xbc2081[_0x324d5a(0x108)]),_0x520492=[];for(const _0x19ac72 of _0x44aded){const _0x203719=_0x2f06b2['get'](_0x19ac72)||0x0,_0x434319=Math[_0x324d5a(0x10c)](_0x203719,0x1);for(let _0x469c57=0x0;_0x469c57<_0x434319;_0x469c57++){_0x520492[_0x324d5a(0x1ce)](_0x19ac72);}}_0xf9ac7b['set'](_0x5a84d9,_0x520492);}return{'existingLocalSegmentNames':_0xaf5bab,'localSegmentRules':_0x39558d,'localExpandedRuleToNames':_0xf9ac7b};}export function createSegmentIdResolver(_0x1ec6ed,_0x1c312e){return async _0x4211b7=>{const _0x1c5308=a155_0x27e5,_0x1d878f=_0x1ec6ed[_0x1c5308(0x187)](_0x4211b7);if(!_0x1d878f)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1c5308(0x18e)+_0x4211b7+_0x1c5308(0x17d)+_0x1c312e+'\x27)');return _0x1d878f;};}export function extractRootFolderId(_0x2465f5){const _0x1ca617=a155_0x213229;return _0x2465f5[_0x1ca617(0x126)]?.['parentSegmentFolder']?.[_0x1ca617(0x1b0)]?.['id']||_0x2465f5[_0x1ca617(0x126)]?.[_0x1ca617(0x195)]?.['data']?.['id'];}export function buildConnectionMaps(_0x5666e5){const _0x194498=a155_0x213229,_0xa30a93=new Map(),_0x3e6c44=new Map(),_0x560e27=new Map();for(const _0x391524 of _0x5666e5){_0xa30a93['set'](_0x391524['name'],parseInt(_0x391524['id'],0xa)),_0x3e6c44[_0x194498(0x167)](_0x391524['id'],_0x391524['name']),_0x560e27[_0x194498(0x167)](_0x391524['name'],_0x391524[_0x194498(0xd6)]);}return{'nameToId':_0xa30a93,'idToName':_0x3e6c44,'nameToType':_0x560e27};}export function calculatePushStats(_0x551203,_0x4a54b5,_0x18f840,_0x3c7fa1,_0x26f296,_0x4847e6,_0x58e472){const _0x12be35=a155_0x213229,_0x4869a0=_0x551203[_0x12be35(0xed)](_0x36a854=>_0x36a854[_0x12be35(0xee)]),_0x346373=_0x551203[_0x12be35(0xed)](_0x36c3f2=>!_0x36c3f2['isNew']&&_0x36c3f2[_0x12be35(0x117)]),_0x32af35=_0x551203[_0x12be35(0xed)](_0x295c51=>!_0x295c51['isNew']&&!_0x295c51['hasChanges']),_0x3d980a=_0x4847e6?_0x3c7fa1:[],_0x7a5a4f=_0x4a54b5[_0x12be35(0xed)](_0x552a8e=>_0x552a8e[_0x12be35(0xee)]),_0x5b8595=_0x4a54b5[_0x12be35(0xed)](_0x591559=>!_0x591559[_0x12be35(0xee)]&&_0x591559['hasChanges']),_0x244864=_0x4a54b5[_0x12be35(0xed)](_0x1a3ef0=>!_0x1a3ef0[_0x12be35(0xee)]&&!_0x1a3ef0[_0x12be35(0x117)]),_0x123269=_0x4847e6?_0x26f296:[],_0xd2c5ca=_0x551203[_0x12be35(0x1aa)](_0x1ddffa=>_0x1ddffa[_0x12be35(0x16a)]),_0x595834=_0xd2c5ca[_0x12be35(0xed)](_0x2ea189=>_0x2ea189[_0x12be35(0xd6)]===_0x12be35(0x14d)),_0x4ef877=_0xd2c5ca['filter'](_0x534996=>_0x534996[_0x12be35(0xd6)]===_0x12be35(0x152)),_0x3848cf=_0xd2c5ca['filter'](_0x5c4845=>_0x5c4845[_0x12be35(0xd6)]===_0x12be35(0x16b)),_0x27d2aa=Array[_0x12be35(0x12f)](_0x18f840)['sort'](),_0x138dc6=_0x58e472?![]:_0x4869a0[_0x12be35(0x176)]>0x0||_0x346373[_0x12be35(0x176)]>0x0||_0x3d980a[_0x12be35(0x176)]>0x0,_0x2b3cb8=_0x7a5a4f['length']>0x0||_0x5b8595['length']>0x0||_0x123269[_0x12be35(0x176)]>0x0,_0x5a83ad=_0x58e472?![]:_0xd2c5ca[_0x12be35(0x176)]>0x0,_0x34d59a=_0x27d2aa[_0x12be35(0x176)]>0x0;return{'segments':{'new':_0x4869a0,'changed':_0x346373,'unchanged':_0x32af35,'toDelete':_0x3d980a},'journeys':{'new':_0x7a5a4f,'changed':_0x5b8595,'unchanged':_0x244864,'toDelete':_0x123269},'activations':{'all':_0xd2c5ca,'toCreate':_0x595834,'toUpdate':_0x4ef877,'toDelete':_0x3848cf},'folders':{'toCreate':_0x27d2aa},'counts':{'segments':{'new':_0x4869a0[_0x12be35(0x176)],'changed':_0x346373['length'],'unchanged':_0x32af35[_0x12be35(0x176)],'toDelete':_0x3d980a['length']},'journeys':{'new':_0x7a5a4f[_0x12be35(0x176)],'changed':_0x5b8595['length'],'unchanged':_0x244864[_0x12be35(0x176)],'toDelete':_0x123269[_0x12be35(0x176)]},'activations':{'create':_0x595834[_0x12be35(0x176)],'update':_0x4ef877[_0x12be35(0x176)],'delete':_0x3848cf[_0x12be35(0x176)]},'folders':_0x27d2aa[_0x12be35(0x176)]},'hasChanges':_0x138dc6||_0x2b3cb8||_0x5a83ad||_0x34d59a};}export async function buildPushExecutionContext(_0x6b917,_0x4dbdc9,_0xf28d38,_0x1fb066,_0x4ceda3,_0x4fc666){const _0x13e2c2=a155_0x213229,_0x571819=extractRootFolderId(_0xf28d38),{pathToId:_0x178b77,idToPath:_0x4ea740}=buildFolderMaps(_0x4ceda3),_0x1b9c0e=buildSegmentNameToIdMap(_0x1fb066),_0x12ff8b=new Map(),{batchAsync:_0x804e49}=await import(_0x13e2c2(0x1a6)),[_0x493fd8,_0x1558cb]=await Promise[_0x13e2c2(0x120)]([_0x6b917[_0x13e2c2(0xeb)][_0x13e2c2(0x142)](),_0x6b917[_0x13e2c2(0x196)][_0x13e2c2(0x18d)](),((async()=>{!_0x4fc666&&_0x1fb066['length']>0x0&&await _0x804e49(_0x1fb066,async _0x5f3111=>{const _0x16039c=a155_0x27e5,_0x59115e=await _0x6b917[_0x16039c(0x175)][_0x16039c(0x1c3)](_0x4dbdc9,_0x5f3111['id']);_0x12ff8b['set'](_0x5f3111['id'],_0x59115e);});})())]),{emailToId:_0x5d2f2d,idToEmail:_0x30dc23}=_0x493fd8,_0x1ea8c7=buildConnectionMaps(_0x1558cb);return{'rootFolderId':_0x571819,'folderPathToId':_0x178b77,'folderIdToPath':_0x4ea740,'segmentNameToId':_0x1b9c0e,'activationsBySegmentId':_0x12ff8b,'emailToIdMap':_0x5d2f2d,'idToEmailMap':_0x30dc23,'connectionNameToIdMap':_0x1ea8c7[_0x13e2c2(0x197)],'connectionIdToNameMap':_0x1ea8c7['idToName'],'connectionNameToTypeMap':_0x1ea8c7[_0x13e2c2(0x17a)]};}export function createPushYamlContextForBundle(_0x46ab93,_0x12018f,_0x24bf27,_0x50306c,_0x4b29ea,_0x380816,_0x33478e,_0x4e256d){const {existingLocalSegmentNames:_0x231de0,localExpandedRuleToNames:_0x2b7b2b}=_0x50306c,_0x52908f=new Set(),_0x5b0b5e=new Map(),_0x9d9f5f=new Map(),_0x4e81db=new Map(),_0x5ddf74=createJumpTargetCache(),_0x25cba8=new Map(),_0x4665ce=new Map(),_0xa9f52f=new Set();let _0x431b18;const _0xa49d6f=_0x2db170=>{const _0x25ab7f={'resolveSegment':async _0xe5b5a3=>{const _0x184c9a=a155_0x27e5,_0x18cf6b=_0x4e81db[_0x184c9a(0x187)](_0xe5b5a3);if(_0x18cf6b!==undefined)return{'name':_0x18cf6b,'isJourneyLocal':!![]};try{const _0x2144fb=await fetchSegment(_0x46ab93,_0x12018f,_0xe5b5a3,_0x24bf27);if(!_0x2144fb)throw new Error(_0x184c9a(0x114));const _0x392b4d=generateJourneyLocalName(_0x2144fb[_0x184c9a(0x108)]),_0x328740=_0x2144fb[_0x184c9a(0x136)]===SEGMENT_KIND_JOURNEY&&_0x392b4d!==undefined;let _0x377313=_0x2144fb['name'],_0x166447;if(_0x328740&&_0x2144fb[_0x184c9a(0xf9)]){const _0x54d62a=apiRuleToYaml(_0x2144fb[_0x184c9a(0xf9)]);_0x4665ce[_0x184c9a(0x167)](_0xe5b5a3,_0x54d62a);const _0x23a6a9=async _0x4d9a98=>{const _0x42310e=_0x184c9a,_0x412cad=collectSegmentRefsFromRule(_0x4d9a98);for(const _0x48eced of _0x412cad){if(!_0x4665ce['has'](_0x48eced))try{const _0x5cf062=await fetchSegment(_0x46ab93,_0x12018f,_0x48eced,_0x24bf27);if(_0x5cf062?.[_0x42310e(0xf9)]){const _0x3c134d=apiRuleToYaml(_0x5cf062['rule']);_0x4665ce[_0x42310e(0x167)](_0x48eced,_0x3c134d),await _0x23a6a9(_0x3c134d);}}catch(_0x328388){logger[_0x42310e(0xd8)](_0x42310e(0x155)+_0x48eced+':\x20'+_0x328388);}}};await _0x23a6a9(_0x54d62a);const _0x1cb75e=serializeExpandedRule(_0x54d62a,_0x4665ce),_0x7fd6ee=_0x2b7b2b['get'](_0x1cb75e);if(_0x7fd6ee&&_0x7fd6ee[_0x184c9a(0x176)]>0x0){const _0x3ddb81=_0x5b0b5e[_0x184c9a(0x187)](_0x1cb75e)||0x0,_0x451f70=_0x7fd6ee[_0x3ddb81]||_0x7fd6ee[_0x7fd6ee['length']-0x1];_0x5b0b5e[_0x184c9a(0x167)](_0x1cb75e,_0x3ddb81+0x1),_0x377313=_0x451f70,_0x52908f[_0x184c9a(0x11c)](_0x377313),_0x4e81db['set'](_0xe5b5a3,_0x377313);const _0x488e7f=await resolveRuleSegmentRefs(_0x54d62a,async _0x4ad729=>{const _0x5299ce=_0x4e81db['get'](_0x4ad729);if(_0x5299ce)return _0x5299ce;const _0x124e0b=await _0x431b18['resolveSegment'](_0x4ad729);return _0x124e0b['name'];});_0x166447={'description':_0x2144fb['description'],'rule':_0x488e7f};}else{const _0x410609=_0x25cba8[_0x184c9a(0x187)](_0x1cb75e);if(_0x410609)_0x377313=_0x410609,_0x4e81db[_0x184c9a(0x167)](_0xe5b5a3,_0x377313);else{if(_0x392b4d){let _0x5a9921=_0x392b4d,_0x8d9219=0x2;while(_0x52908f['has'](_0x5a9921)||_0x231de0[_0x184c9a(0x184)](_0x5a9921)){_0x5a9921=_0x392b4d+'_'+_0x8d9219,_0x8d9219++;}_0x52908f['add'](_0x5a9921),_0x377313=_0x5a9921;}_0x4e81db[_0x184c9a(0x167)](_0xe5b5a3,_0x377313),_0x25cba8['set'](_0x1cb75e,_0x377313);const _0x433bbc=await resolveRuleSegmentRefs(_0x54d62a,async _0x305de6=>{const _0x243a90=_0x184c9a,_0x58481b=_0x4e81db['get'](_0x305de6);if(_0x58481b)return _0x58481b;const _0xea834a=await _0x431b18[_0x243a90(0x1c5)](_0x305de6);return _0xea834a[_0x243a90(0x108)];});_0x166447={'description':_0x2144fb['description'],'rule':_0x433bbc};}}}return{'name':_0x377313,'isJourneyLocal':_0x328740,'definition':_0x166447};}catch(_0x580261){return logger[_0x184c9a(0xd8)](_0x184c9a(0x149)+_0xe5b5a3+':\x20'+_0x580261),{'name':_0xe5b5a3,'isJourneyLocal':![]};}},'resolveActivation':async _0x6fe9f3=>{const _0x33f1e7=a155_0x27e5,_0xceacc=_0x9d9f5f[_0x33f1e7(0x187)](_0x6fe9f3);if(_0xceacc!==undefined)return{'name':_0xceacc,'isJourneyLocal':!![]};try{let _0x2badf7=_0x33478e?.['get'](_0x6fe9f3);!_0x2badf7&&(_0x2badf7=await _0x46ab93[_0x33f1e7(0xf4)]['getActivation'](_0x2db170,_0x6fe9f3));const _0x62de98=_0x2badf7[_0x33f1e7(0x1b6)][_0x33f1e7(0x13c)][_0x33f1e7(0x108)]||_0x6fe9f3,_0x437c39=sanitizeYamlKey(_0x62de98)||'activation_'+_0x6fe9f3,_0x33c2b3=_0x437c39;_0x9d9f5f['set'](_0x6fe9f3,_0x33c2b3);const _0x4c5e89=journeyActivationStepToYaml(_0x2badf7,_0x4b29ea,_0x380816);return{'name':_0x33c2b3,'isJourneyLocal':!![],'definition':_0x4c5e89};}catch(_0x8c1cd6){return logger[_0x33f1e7(0xd8)]('Failed\x20to\x20resolve\x20activation\x20'+_0x6fe9f3+':\x20'+_0x8c1cd6),{'name':_0x6fe9f3,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x121e52,_0x230993)=>resolveJumpTarget(_0x121e52,_0x230993,_0x5ddf74,async _0x2f3b19=>{const _0x486e79=a155_0x27e5,_0xe66947=_0x4e256d?.[_0x486e79(0x187)](_0x2f3b19);if(_0xe66947)return _0xe66947;return _0x46ab93[_0x486e79(0xf4)]['getJourney'](_0x2f3b19);})};return _0x431b18=_0x25ab7f,_0x25ab7f;},_0x40d546=async _0x3e9c9f=>{const _0x34ab8b=a155_0x27e5,{collectSegmentIdsFromJourneyApi:_0x59320f}=await import('./journey-yaml.js'),{batchAsync:_0x2edd42}=await import(_0x34ab8b(0x1a6)),_0x40801b=new Set();for(const _0x41725b of _0x3e9c9f){let _0x4cd8a1=_0x4e256d?.['get'](_0x41725b);!_0x4cd8a1&&(_0x4cd8a1=await _0x46ab93['journey'][_0x34ab8b(0x1a2)](_0x41725b));const _0x3a8342=_0x59320f(_0x4cd8a1);for(const _0x483f43 of _0x3a8342){_0x40801b[_0x34ab8b(0x11c)](_0x483f43);}}let _0x14a511=Array['from'](_0x40801b);while(_0x14a511[_0x34ab8b(0x176)]>0x0){const _0x3d875c=_0x14a511[_0x34ab8b(0xed)](_0x279e21=>!_0xa9f52f[_0x34ab8b(0x184)](_0x279e21));if(_0x3d875c[_0x34ab8b(0x176)]===0x0)break;const _0x57823c=await _0x2edd42(_0x3d875c,async _0xc88a63=>{const _0x43aec2=_0x34ab8b;_0xa9f52f[_0x43aec2(0x11c)](_0xc88a63);const _0x2ae162=await fetchSegment(_0x46ab93,_0x12018f,_0xc88a63,_0x24bf27);if(!_0x2ae162)return null;return{'segmentId':_0xc88a63,'segment':_0x2ae162};},0xa),_0x3f28a5=new Set();for(const _0x4e053a of _0x57823c){if(!_0x4e053a?.[_0x34ab8b(0x175)]?.['rule'])continue;const _0x5d11f7=apiRuleToYaml(_0x4e053a[_0x34ab8b(0x175)]['rule']);_0x4665ce[_0x34ab8b(0x167)](_0x4e053a[_0x34ab8b(0x133)],_0x5d11f7);const _0x3c7b1a=collectSegmentRefsFromRule(_0x5d11f7);for(const _0x5ccd6a of _0x3c7b1a){!_0xa9f52f[_0x34ab8b(0x184)](_0x5ccd6a)&&_0x3f28a5[_0x34ab8b(0x11c)](_0x5ccd6a);}}_0x14a511=Array[_0x34ab8b(0x12f)](_0x3f28a5);}};return{'createYamlContext':_0xa49d6f,'prefetchJourneySegments':_0x40d546};}export async function executePushSegments(_0x278ba3,_0x9a95f4,_0xbea0ec,_0x1be8ad,_0x322cd8){const _0x663900=a155_0x213229,{segmentDefToCreateRequest:_0xb2ee73,segmentDefToUpdateRequest:_0x59066a}=await import(_0x663900(0xf3)),_0x1dcf17=_0xbea0ec['folderPathToId'],_0xff1961=0x5,_0x336198=async _0x9828d6=>{const _0x54d707=_0x663900,_0x13c7fa=_0x9828d6[_0x54d707(0x1cc)]?_0x1dcf17['get'](_0x9828d6[_0x54d707(0x1cc)]):undefined;let _0x50345;const _0x29aa91={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x377114=_0x9828d6[_0x54d707(0x148)];if(_0x9828d6[_0x54d707(0x148)][_0x54d707(0xf9)]){const _0x372a03=createSegmentIdResolver(_0xbea0ec['segmentNameToId'],_0x9828d6[_0x54d707(0x148)]['name']),_0x1b57e3=await resolveRuleSegmentIds(_0x9828d6['yamlConfig'][_0x54d707(0xf9)],_0x372a03);_0x377114={..._0x9828d6[_0x54d707(0x148)],'rule':_0x1b57e3};}try{if(_0x9828d6[_0x54d707(0xee)]){_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x17b),'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)]});const _0x2f962f=_0xb2ee73(_0x377114,_0x13c7fa),_0xc2a191=await _0x322cd8['withProgress'](_0x54d707(0x190)+_0x9828d6['yamlConfig']['name']+_0x54d707(0x173),()=>_0x278ba3[_0x54d707(0x175)][_0x54d707(0x192)](_0x1be8ad[_0x54d707(0x10f)],_0x2f962f));_0x50345=_0xc2a191[_0x54d707(0x1b0)]['id'],_0xbea0ec[_0x54d707(0x1a1)][_0x54d707(0x167)](_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)],_0x50345),_0x29aa91['createdSegmentId']={'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)],'id':_0x50345},_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x19e),'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)],'segmentId':_0x50345}),_0x322cd8[_0x54d707(0xfd)]?.(_0x54d707(0xf6)+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27'),_0x29aa91[_0x54d707(0x122)]=0x1;}else{if(_0x9828d6[_0x54d707(0x117)]){_0x322cd8[_0x54d707(0xf8)]?.({'type':'segment_updating','name':_0x9828d6[_0x54d707(0x148)]['name']});const _0x25c173=_0x59066a(_0x377114);_0x13c7fa!==_0x9828d6['existingSegment']?.['segmentFolderId']&&(_0x25c173[_0x54d707(0x1be)]=_0x13c7fa?parseInt(_0x13c7fa,0xa):undefined),await _0x322cd8['withProgress'](_0x54d707(0x11b)+_0x9828d6[_0x54d707(0x148)]['name']+_0x54d707(0x173),()=>_0x278ba3[_0x54d707(0x175)][_0x54d707(0x1b8)](_0x1be8ad[_0x54d707(0x10f)],_0x9828d6[_0x54d707(0x14a)]['id'],_0x25c173)),_0x50345=_0x9828d6[_0x54d707(0x14a)]['id'],_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x10e),'name':_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]}),_0x322cd8[_0x54d707(0xfd)]?.(_0x54d707(0x171)+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27'),_0x29aa91['updated']=0x1;}else _0x50345=_0x9828d6[_0x54d707(0x14a)]['id'];}}catch(_0x2b9ffa){const _0x2dd1ff=isHttp400Error(_0x2b9ffa),_0x4855c4=_0x2dd1ff?ErrorCode[_0x54d707(0x130)]:ErrorCode[_0x54d707(0x11d)],_0x5eb40a=getErrorMessage(_0x2b9ffa);throw new SDKError(_0x4855c4,_0x54d707(0x19c)+(_0x9828d6[_0x54d707(0xee)]?'create':_0x54d707(0x152))+'\x20segment\x20from\x20file:\x20'+_0x9828d6[_0x54d707(0x144)]+_0x54d707(0x1a0)+_0x5eb40a,_0x2b9ffa);}try{const _0x5f40bd=await syncActivationsForSegment(_0x278ba3,_0x1be8ad[_0x54d707(0x10f)],_0x50345,_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)],_0x9828d6[_0x54d707(0x16a)],_0x322cd8,_0x9828d6[_0x54d707(0x144)]);_0x29aa91[_0x54d707(0x13e)]=_0x5f40bd;}catch(_0x34562b){if(_0x34562b instanceof SDKError)throw _0x34562b;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27\x20from\x20file:\x20'+_0x9828d6['absolutePath']+_0x54d707(0x1a0)+getErrorMessage(_0x34562b),_0x34562b);}return _0x29aa91;},_0x2d1a15=await batchAsync(_0x9a95f4,_0x336198,_0xff1961),_0x53501c={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x3e85e2 of _0x2d1a15){_0x53501c[_0x663900(0x122)]+=_0x3e85e2[_0x663900(0x122)],_0x53501c[_0x663900(0x123)]+=_0x3e85e2[_0x663900(0x123)],_0x3e85e2[_0x663900(0x1d4)]&&_0x53501c['createdSegmentIds']['set'](_0x3e85e2[_0x663900(0x1d4)][_0x663900(0x108)],_0x3e85e2[_0x663900(0x1d4)]['id']),_0x53501c['activations'][_0x663900(0x122)]+=_0x3e85e2[_0x663900(0x13e)][_0x663900(0x122)],_0x53501c[_0x663900(0x13e)][_0x663900(0x123)]+=_0x3e85e2['activations'][_0x663900(0x123)],_0x53501c[_0x663900(0x13e)][_0x663900(0x128)]+=_0x3e85e2[_0x663900(0x13e)][_0x663900(0x128)];}return _0x53501c;}async function syncActivationsForSegment(_0x45881e,_0x96c86e,_0x19a0ec,_0x2a5972,_0x2e4297,_0x8a13f4,_0x767cb1){const _0x5d54f4=a155_0x213229,_0x551caf={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x24b972 of _0x2e4297){try{if(_0x24b972[_0x5d54f4(0xd6)]===_0x5d54f4(0x14d)&&_0x24b972['validatedRequest'])_0x8a13f4['onProgress']?.({'type':_0x5d54f4(0x12a),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),await _0x8a13f4[_0x5d54f4(0x12d)](_0x5d54f4(0x162)+_0x24b972['name']+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0x103)](_0x96c86e,_0x19a0ec,_0x24b972[_0x5d54f4(0x11e)])),_0x8a13f4['onProgress']?.({'type':'activation_created','segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0xfd)]?.('Created\x20activation\x20\x27'+_0x24b972['name']+'\x27'),_0x551caf['created']++;else{if(_0x24b972[_0x5d54f4(0xd6)]==='update'&&_0x24b972['validatedRequest']&&_0x24b972['existingActivation'])_0x8a13f4['onProgress']?.({'type':_0x5d54f4(0x169),'segmentName':_0x2a5972,'activationName':_0x24b972['name']}),await _0x8a13f4[_0x5d54f4(0x12d)](_0x5d54f4(0x1ac)+_0x24b972[_0x5d54f4(0x108)]+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0x10d)](_0x96c86e,_0x19a0ec,_0x24b972['existingActivation']['id'],_0x24b972[_0x5d54f4(0x11e)])),_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':_0x5d54f4(0x10a),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0xfd)]?.(_0x5d54f4(0x102)+_0x24b972[_0x5d54f4(0x108)]+'\x27'),_0x551caf[_0x5d54f4(0x123)]++;else _0x24b972['type']===_0x5d54f4(0x16b)&&_0x24b972['existingActivation']&&(_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':'activation_deleting','segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),await _0x8a13f4[_0x5d54f4(0x12d)]('Deleting\x20activation\x20\x27'+_0x24b972['name']+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0xdf)](_0x96c86e,_0x19a0ec,_0x24b972['existingActivation']['id'])),_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':_0x5d54f4(0x17e),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0x1c9)]?.(_0x5d54f4(0x139)+_0x24b972[_0x5d54f4(0x108)]+'\x27'),_0x551caf[_0x5d54f4(0x128)]++);}}catch(_0x306a7b){const _0x31dd3f=isHttp400Error(_0x306a7b),_0x13dd16=_0x31dd3f?ErrorCode[_0x5d54f4(0x165)]:ErrorCode[_0x5d54f4(0x1d1)],_0x33d709=getErrorMessage(_0x306a7b);throw new SDKError(_0x13dd16,'Failed\x20to\x20'+_0x24b972[_0x5d54f4(0xd6)]+_0x5d54f4(0x166)+_0x24b972[_0x5d54f4(0x108)]+'\x27\x20from\x20file:\x20'+_0x767cb1+'\x0a\x20\x20'+_0x33d709,_0x306a7b);}}return _0x551caf;}export async function executePushFolders(_0x3783a2,_0x30a42c,_0x126ce9,_0x303752,_0x2306a7){const _0x3e40c6=a155_0x213229,_0x4edef4=new Map(_0x126ce9),_0x611748=sortFoldersByDepth(_0x30a42c);for(const _0x462063 of _0x611748){const _0x27cd92=_0x462063['split']('/'),_0x13e1a6=_0x27cd92[_0x27cd92[_0x3e40c6(0x176)]-0x1],_0x5d9c60=_0x27cd92[_0x3e40c6(0x19d)](0x0,-0x1)['join']('/'),_0x2d9c7e=_0x4edef4[_0x3e40c6(0x187)](_0x5d9c60);_0x2306a7[_0x3e40c6(0xf8)]?.({'type':_0x3e40c6(0xd7),'folder':_0x462063});const _0x3bec31={'name':_0x13e1a6,'parentFolderId':_0x2d9c7e},_0x5bd1cf=await _0x2306a7['withProgress'](_0x3e40c6(0x143)+_0x462063+_0x3e40c6(0x173),()=>_0x3783a2[_0x3e40c6(0x175)][_0x3e40c6(0x145)](_0x303752[_0x3e40c6(0x10f)],_0x3bec31));_0x4edef4[_0x3e40c6(0x167)](_0x462063,_0x5bd1cf['data']['id']),_0x2306a7[_0x3e40c6(0xf8)]?.({'type':'folder_created','folder':_0x462063,'folderId':_0x5bd1cf['data']['id']}),_0x2306a7[_0x3e40c6(0x1d3)]?.(_0x3e40c6(0x100)+_0x462063+'\x27');}return _0x4edef4;}export async function executePushSegmentDeletions(_0x386d3b,_0x385a6b,_0x525f59){const _0x32e56f=a155_0x213229;if(_0x385a6b[_0x32e56f(0x176)]===0x0)return 0x0;const {batchAsync:_0x538a6d}=await import(_0x32e56f(0x1a6)),_0x43556c=0x5,_0x289715=await _0x538a6d(_0x385a6b,async _0x10ae73=>{const _0x978c85=_0x32e56f;return _0x525f59[_0x978c85(0xf8)]?.({'type':_0x978c85(0xf0),'name':_0x10ae73[_0x978c85(0x108)]}),await _0x386d3b[_0x978c85(0x175)][_0x978c85(0x1bc)](_0x10ae73['id']),_0x525f59[_0x978c85(0xf8)]?.({'type':_0x978c85(0x189),'name':_0x10ae73[_0x978c85(0x108)]}),_0x525f59[_0x978c85(0x1c9)]?.('Deleted\x20segment\x20\x27'+_0x10ae73[_0x978c85(0x108)]+'\x27'),0x1;},_0x43556c);return _0x289715[_0x32e56f(0x14b)]((_0x12d319,_0x20cd64)=>_0x12d319+_0x20cd64,0x0);}export async function executePushJourneys(_0x512588,_0x457d12,_0x267198,_0x557334,_0xbe3f3a){const _0x1d4bcd=a155_0x213229,{journeyDefToRequest:_0x5629ee}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x329003,yamlRuleToApi:_0xd251b7,validateSegmentRule:_0x234a3e}=await import(_0x1d4bcd(0xf3)),_0x26b609={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x48de8a=new Map(_0x267198[_0x1d4bcd(0x1a1)]),_0x151f94=0x5;for(let _0x3c45ea=0x0;_0x3c45ea<_0x457d12[_0x1d4bcd(0x176)];_0x3c45ea+=_0x151f94){const _0x5b92f9=_0x457d12[_0x1d4bcd(0x19d)](_0x3c45ea,_0x3c45ea+_0x151f94),_0x327843=await Promise['all'](_0x5b92f9[_0x1d4bcd(0x19f)](async _0x3881a9=>{const _0x13bc9c=_0x1d4bcd;if(!_0x3881a9['isNew']&&!_0x3881a9[_0x13bc9c(0x117)])return{'action':_0x13bc9c(0x199),'name':_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)],'journeyId':_0x3881a9[_0x13bc9c(0x191)]?.['id']};const _0x50f922=_0x3881a9[_0x13bc9c(0x1cc)]?_0x267198[_0x13bc9c(0x18c)]['get'](_0x3881a9['folderPath']):undefined;_0xbe3f3a[_0x13bc9c(0xf8)]?.({'type':_0x3881a9[_0x13bc9c(0xee)]?'journey_creating':_0x13bc9c(0xf2),'name':_0x3881a9['yamlConfig'][_0x13bc9c(0x108)]});try{const _0x5ba75a=await executeSingleJourneyPush(_0x512588,_0x3881a9,{..._0x267198,'segmentNameToId':_0x48de8a},{'parentId':_0x557334[_0x13bc9c(0x10f)],'rootFolderId':_0x557334['rootFolderId'],'folderId':_0x50f922,'verbose':_0x557334[_0x13bc9c(0x11f)]},_0xbe3f3a,{'journeyDefToRequest':_0x5629ee,'activationDefToCreateRequest':_0x329003,'yamlRuleToApi':_0xd251b7,'validateSegmentRule':_0x234a3e});for(const [_0x19ea73,_0x3391c1]of _0x5ba75a[_0x13bc9c(0x1ab)]){_0x48de8a[_0x13bc9c(0x167)](_0x19ea73,_0x3391c1),_0x26b609[_0x13bc9c(0x1ab)][_0x13bc9c(0x167)](_0x19ea73,_0x3391c1);}if(_0x5ba75a['action']==='created')_0xbe3f3a[_0x13bc9c(0xf8)]?.({'type':_0x13bc9c(0x134),'name':_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)],'journeyId':_0x5ba75a[_0x13bc9c(0x140)]}),_0xbe3f3a['logSuccess']?.(_0x13bc9c(0x19b)+_0x3881a9[_0x13bc9c(0x148)]['name']+'\x27'),_0x26b609['created']++;else _0x5ba75a['action']===_0x13bc9c(0x123)&&(_0xbe3f3a['onProgress']?.({'type':_0x13bc9c(0x115),'name':_0x3881a9[_0x13bc9c(0x148)]['name']}),_0xbe3f3a[_0x13bc9c(0xfd)]?.('Updated\x20journey\x20\x27'+_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)]+'\x27'),_0x26b609['updated']++);return{'action':_0x5ba75a[_0x13bc9c(0x179)],'name':_0x3881a9[_0x13bc9c(0x148)]['name'],'journeyId':_0x5ba75a[_0x13bc9c(0x140)]};}catch(_0xb7ed5c){const _0x36585b=isHttp400Error(_0xb7ed5c),_0x7cded4=_0x36585b?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3ef7b4=getErrorMessage(_0xb7ed5c);throw new SDKError(_0x7cded4,_0x13bc9c(0x19c)+(_0x3881a9[_0x13bc9c(0xee)]?_0x13bc9c(0x14d):'update')+_0x13bc9c(0x1d5)+_0x3881a9[_0x13bc9c(0x144)]+_0x13bc9c(0x1a0)+_0x3ef7b4,_0xb7ed5c);}}));_0x26b609[_0x1d4bcd(0x1cd)][_0x1d4bcd(0x1ce)](..._0x327843);}return _0x26b609;}async function matchExistingJourneySegments(_0x43fc03,_0x274674,_0x3586cf,_0x410fdb,_0x1a6db7){const _0x4c050d=a155_0x213229;if(!_0x274674[_0x4c050d(0x191)]||!_0x274674[_0x4c050d(0x148)]['segments'])return;const _0x58fa94=new Map(),_0x5016f3=new Set();for(const _0x1c874e of Object['keys'](_0x274674[_0x4c050d(0x148)][_0x4c050d(0x183)])){const _0x48be4a=generateDeterministicJourneySegmentName(_0x274674[_0x4c050d(0x148)]['name'],_0x1c874e);_0x58fa94['set'](_0x48be4a,_0x1c874e),_0x5016f3[_0x4c050d(0x11c)](_0x1c874e);}const _0x35ec3e=[],_0x57d06a=collectSegmentIdsFromJourneyApi(_0x274674['existingJourney']);for(const _0x92a1f2 of _0x57d06a){const _0x56b2b4=await fetchSegment(_0x43fc03,_0x3586cf,_0x92a1f2,_0x410fdb);if(!_0x56b2b4?.[_0x4c050d(0x108)])continue;const _0x43f267=_0x58fa94['get'](_0x56b2b4[_0x4c050d(0x108)]);_0x43f267?(_0x1a6db7[_0x4c050d(0x167)](_0x43f267,_0x92a1f2),_0x5016f3[_0x4c050d(0x16b)](_0x43f267)):_0x35ec3e[_0x4c050d(0x1ce)]({'id':_0x92a1f2,'seg':_0x56b2b4});}if(_0x5016f3[_0x4c050d(0x16d)]>0x0&&_0x35ec3e[_0x4c050d(0x176)]>0x0){const {localExpandedRuleToNames:_0x214b09}=buildLocalExpandedRuleMappings(_0x274674[_0x4c050d(0x148)]),_0x334bf4=new Map();for(const {id:_0x5a23ea,seg:_0xfcbdab}of _0x35ec3e){if(_0xfcbdab[_0x4c050d(0xf9)]){const _0x51da08=apiRuleToYaml(_0xfcbdab['rule']);_0x334bf4['set'](_0x5a23ea,_0x51da08);}}for(const {id:_0x1b3fe6,seg:_0xdb296e}of _0x35ec3e){if(!_0xdb296e[_0x4c050d(0xf9)])continue;const _0x1e36e2=_0x334bf4['get'](_0x1b3fe6);if(!_0x1e36e2)continue;const _0x5edcb0=serializeExpandedRule(_0x1e36e2,_0x334bf4),_0x642961=_0x214b09[_0x4c050d(0x187)](_0x5edcb0);if(_0x642961){const _0x4664aa=_0x642961[_0x4c050d(0xd5)](_0x672fa=>_0x5016f3[_0x4c050d(0x184)](_0x672fa));_0x4664aa&&(_0x1a6db7[_0x4c050d(0x167)](_0x4664aa,_0x1b3fe6),_0x5016f3['delete'](_0x4664aa),logger['debug'](_0x4c050d(0x138)+_0xdb296e[_0x4c050d(0x108)]+'\x27\x20to\x20local\x20\x27'+_0x4664aa+_0x4c050d(0xec)));}}}}async function executeSingleJourneyPush(_0x2d3f2a,_0x6b57c4,_0x4a4be9,_0x11202d,_0x44e193,_0x23c079){const _0x30a47e=a155_0x213229,{journeyDefToRequest:_0x3a7ebb,activationDefToCreateRequest:_0x26e042,yamlRuleToApi:_0x387fc0,validateSegmentRule:_0x480258}=_0x23c079,_0x134110=new Map(),_0x325734=new Map();recoverSegmentIdsFromPushRecovery(_0x6b57c4,_0x134110,_0x4a4be9['segmentNameToId']);const _0x15bca5=new Map(),_0x3e5b44=new Map(),_0x25fa30=new Map();let _0x11ad7a;const _0x39fd37=async()=>{const _0x5302ae=a155_0x27e5;if(_0x11ad7a)return;_0x11ad7a=new Map();if(!_0x6b57c4['existingJourney'])return;const _0x5a9b7c=await _0x2d3f2a[_0x5302ae(0xf4)][_0x5302ae(0x1c3)](_0x6b57c4['existingJourney']['id']);for(const _0x136d55 of _0x5a9b7c){const _0x1edf4e=journeyActivationStepToYaml(_0x136d55,_0x4a4be9['idToEmailMap'],_0x4a4be9[_0x5302ae(0x1a7)]),_0x56b2a7=activationSignature(_0x1edf4e);!_0x11ad7a[_0x5302ae(0x184)](_0x56b2a7)&&_0x11ad7a[_0x5302ae(0x167)](_0x56b2a7,_0x136d55['id']),_0x1edf4e['name']&&_0x325734[_0x5302ae(0x167)](_0x1edf4e[_0x5302ae(0x108)],_0x136d55['id']);}};await matchExistingJourneySegments(_0x2d3f2a,_0x6b57c4,_0x11202d[_0x30a47e(0x10f)],_0x4a4be9[_0x30a47e(0x1a3)],_0x4a4be9['segmentNameToId']);const _0x46bed7={'resolveSegmentId':async _0x3d6954=>{const _0x5627d5=_0x30a47e,_0x34d698=_0x4a4be9[_0x5627d5(0x1a1)][_0x5627d5(0x187)](_0x3d6954);if(!_0x34d698)throw new SDKError(ErrorCode[_0x5627d5(0x198)],'Segment\x20not\x20found:\x20'+_0x3d6954+_0x5627d5(0x104)+_0x6b57c4[_0x5627d5(0x148)][_0x5627d5(0x108)]+')');return _0x34d698;},'resolveEmbeddedSegmentId':async(_0x3f7746,_0x4b4b2f)=>{const _0x3674fb=_0x30a47e,_0x1d4abf=_0x4a4be9[_0x3674fb(0x1a1)][_0x3674fb(0x187)](_0x3f7746);if(_0x1d4abf)return _0x1d4abf;const _0x5780ba=_0x4a4be9[_0x3674fb(0x1a3)]['find'](_0x19fd18=>_0x19fd18['name']===_0x3f7746);if(_0x5780ba)return _0x4a4be9[_0x3674fb(0x1a1)][_0x3674fb(0x167)](_0x3f7746,_0x5780ba['id']),_0x5780ba['id'];if(_0x6b57c4[_0x3674fb(0xee)]){const {stageName:_0x1a3cb2,criteriaName:_0x1fec91}=findSegmentCriteriaLocation(_0x6b57c4[_0x3674fb(0x148)],_0x3f7746);return _0x480258(_0x3f7746,_0x4b4b2f['rule']),_0x3e5b44[_0x3674fb(0x167)](_0x3f7746,{'definition':_0x4b4b2f,'stageName':_0x1a3cb2,'criteriaName':_0x1fec91}),createPendingSegmentId(_0x3f7746);}const _0x3790cc=_0x6b57c4[_0x3674fb(0x191)]?.['id'];if(!_0x3790cc)throw new SDKError(ErrorCode[_0x3674fb(0x170)],_0x3674fb(0x13a));const _0x4ffd7a=_0x15bca5[_0x3674fb(0x187)](_0x3f7746);if(_0x4ffd7a)return _0x4ffd7a;const _0x55c107=((async()=>{const _0x1efcbe=_0x3674fb;_0x480258(_0x3f7746,_0x4b4b2f[_0x1efcbe(0xf9)]);const _0x3ba2e4=generateDeterministicJourneySegmentName(_0x6b57c4[_0x1efcbe(0x148)][_0x1efcbe(0x108)],_0x3f7746),_0x2747b0=_0x4a4be9[_0x1efcbe(0x1a3)][_0x1efcbe(0xd5)](_0x32b5b5=>_0x32b5b5[_0x1efcbe(0x108)]===_0x3ba2e4),_0x5bb42d=createSegmentIdResolver(_0x4a4be9[_0x1efcbe(0x1a1)],_0x3f7746),_0x53c752=await resolveRuleSegmentIds(_0x4b4b2f[_0x1efcbe(0xf9)],_0x5bb42d);let _0x5a74a3;return _0x2747b0?(await _0x2d3f2a['segment'][_0x1efcbe(0x1b8)](_0x11202d['parentId'],_0x2747b0['id'],{'description':_0x4b4b2f[_0x1efcbe(0x177)]||'Entry\x20criteria:\x20'+_0x3f7746,'rule':_0x387fc0(_0x53c752),'countPopulation':!![]}),_0x5a74a3=_0x2747b0['id'],saveSegmentToPushRecovery(_0x6b57c4['absolutePath'],_0x6b57c4['yamlConfig'][_0x1efcbe(0x108)],_0x3f7746,{'segmentId':_0x5a74a3,'uniqueServerName':_0x3ba2e4,'createdAt':new Date()['toISOString']()})):_0x5a74a3=await createOrRecoverEmbeddedSegment(_0x2d3f2a,_0x6b57c4,{'localName':_0x3f7746,'uniqueSegmentName':_0x3ba2e4,'description':_0x4b4b2f[_0x1efcbe(0x177)]||'Entry\x20criteria:\x20'+_0x3f7746,'journeyId':_0x3790cc,'resolvedRule':_0x53c752,'parentId':_0x11202d[_0x1efcbe(0x10f)],'folderId':_0x11202d[_0x1efcbe(0x137)]||''},_0x387fc0),_0x4a4be9[_0x1efcbe(0x1a1)][_0x1efcbe(0x167)](_0x3f7746,_0x5a74a3),_0x134110['set'](_0x3f7746,_0x5a74a3),_0x5a74a3;})());_0x15bca5[_0x3674fb(0x167)](_0x3f7746,_0x55c107);try{return await _0x55c107;}finally{_0x15bca5['delete'](_0x3f7746);}},'resolveActivationId':async _0x587814=>{const _0x4e199b=_0x30a47e,_0xf25c0e=_0x325734[_0x4e199b(0x187)](_0x587814);if(_0xf25c0e)return _0xf25c0e;if(_0x6b57c4[_0x4e199b(0x191)]){await _0x39fd37();const _0x5528ea=_0x325734[_0x4e199b(0x187)](_0x587814);if(_0x5528ea)return _0x5528ea;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x587814+_0x4e199b(0x104)+_0x6b57c4[_0x4e199b(0x148)]['name']+_0x4e199b(0x174)+_0x4e199b(0x131));},'resolveEmbeddedActivationId':async(_0x148efc,_0x16a9d4)=>{const _0xd0f8f7=_0x30a47e,_0x1c25fe=_0x325734[_0xd0f8f7(0x187)](_0x148efc);if(_0x1c25fe)return _0x1c25fe;if(_0x6b57c4['isNew'])return _0x25fa30[_0xd0f8f7(0x167)](_0x148efc,_0x16a9d4),createPendingActivationId(_0x148efc);if(_0x6b57c4['existingJourney']){await _0x39fd37();const _0x358e91=_0x325734['get'](_0x16a9d4['name']);if(_0x358e91)return _0x325734['set'](_0x148efc,_0x358e91),_0x358e91;const _0x35b799=activationSignature(_0x16a9d4),_0x4d2f85=_0x11ad7a?.[_0xd0f8f7(0x187)](_0x35b799);if(_0x4d2f85)return _0x325734['set'](_0x148efc,_0x4d2f85),_0x4d2f85;const _0x327770=await _0x26e042(_0x16a9d4,_0x4a4be9[_0xd0f8f7(0xfa)]),_0x1b9980={..._0x327770,..._0x16a9d4['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x16a9d4[_0xd0f8f7(0xe5)]}},_0x4ff41a=await _0x2d3f2a[_0xd0f8f7(0xf4)]['createActivation'](_0x6b57c4['existingJourney']['id'],_0x1b9980);return _0x325734[_0xd0f8f7(0x167)](_0x148efc,_0x4ff41a['id']),_0x4ff41a['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0xd0f8f7(0x118));},'resolveJourneyId':async _0x3bf34c=>{const _0x16f076=_0x30a47e;try{return await _0x2d3f2a['journey'][_0x16f076(0xff)](_0x11202d[_0x16f076(0x10f)],_0x3bf34c);}catch(_0x158273){throw new SDKError(ErrorCode[_0x16f076(0x109)],_0x16f076(0x13b)+_0x3bf34c+_0x16f076(0x19a)+_0x6b57c4[_0x16f076(0x148)][_0x16f076(0x108)]+'\x27)',_0x158273);}},'resolveStageId':async(_0x118095,_0x38e40e)=>{const _0x3aed00=_0x30a47e,_0x2bc9e2=await _0x2d3f2a[_0x3aed00(0xf4)]['getJourney'](_0x118095),_0x4a8cec=_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x161)][_0x3aed00(0xd5)](_0x4bab9f=>_0x4bab9f[_0x3aed00(0x108)][_0x3aed00(0x15a)]()===_0x38e40e[_0x3aed00(0x15a)]());if(!_0x4a8cec?.['id'])throw new SDKError(ErrorCode[_0x3aed00(0x109)],'Stage\x20\x27'+_0x38e40e+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x1d0)]||_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x108)])+'\x27');return _0x4a8cec['id'];}},_0x114e28=await _0x3a7ebb(_0x6b57c4[_0x30a47e(0x148)],_0x11202d['parentId'],_0x46bed7),_0x5f22bd=_0x11202d[_0x30a47e(0x1ca)]||_0x11202d['rootFolderId'];_0x5f22bd&&(_0x114e28[_0x30a47e(0x126)]={'parentFolder':{'data':{'id':_0x5f22bd,'type':'folder'}}});if(_0x6b57c4['isNew']){if(_0x3e5b44[_0x30a47e(0x16d)]>0x0||_0x25fa30[_0x30a47e(0x16d)]>0x0)return await executeThreeStepJourneyCreate(_0x2d3f2a,_0x6b57c4,_0x114e28,{'pendingEmbeddedSegments':_0x3e5b44,'pendingEmbeddedActivations':_0x25fa30,'embeddedSegmentNameToId':_0x134110,'journeyActivationNameToId':_0x325734},{..._0x11202d,'effectiveFolderId':_0x5f22bd},_0x4a4be9,_0x44e193,_0x23c079);else{ensureJourneyDefaults(_0x114e28['attributes']);const _0x64152f=await _0x2d3f2a[_0x30a47e(0xf4)][_0x30a47e(0x14d)](_0x114e28);return deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':_0x30a47e(0x122),'journeyId':_0x64152f['id'],'embeddedSegmentNameToId':_0x134110};}}else{if(_0x6b57c4['hasChanges']&&_0x6b57c4[_0x30a47e(0x191)]){_0x114e28['id']=_0x6b57c4[_0x30a47e(0x191)]['id'];const _0x19f2e8=_0x114e28[_0x30a47e(0x1b6)];_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)]?.[_0x30a47e(0x1d0)]&&(_0x19f2e8[_0x30a47e(0x1d0)]=_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)][_0x30a47e(0x1d0)]);const _0x113790=_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)]?.[_0x30a47e(0x161)];return _0x113790&&_0x114e28[_0x30a47e(0x1b6)]['journeyStages']&&injectExistingStageIds(_0x114e28[_0x30a47e(0x1b6)][_0x30a47e(0x161)],_0x113790),ensureJourneyDefaults(_0x19f2e8),await _0x2d3f2a[_0x30a47e(0xf4)][_0x30a47e(0x152)](_0x6b57c4[_0x30a47e(0x191)]['id'],_0x114e28),deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':_0x30a47e(0x123),'journeyId':_0x6b57c4['existingJourney']['id'],'embeddedSegmentNameToId':_0x134110};}}return deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':'unchanged','journeyId':_0x6b57c4[_0x30a47e(0x191)]?.['id'],'embeddedSegmentNameToId':_0x134110};}function findSegmentCriteriaLocation(_0x37e113,_0x954226){const _0x50ca2c=a155_0x213229,_0x12c470=_0x37e113[_0x50ca2c(0x13d)]||_0x37e113['journeys']?.[0x0]?.[_0x50ca2c(0x13d)]||[];let _0x43a5ee=_0x50ca2c(0xe1),_0xd39788=_0x954226;const _0x2629b6=_0x37e113[_0x50ca2c(0x1c4)]||_0x37e113[_0x50ca2c(0x132)]?.[0x0]?.[_0x50ca2c(0x1c4)];if(_0x2629b6?.['segment']===_0x954226)return{'stageName':_0x50ca2c(0x1c4),'criteriaName':_0x2629b6[_0x50ca2c(0x108)]||_0x954226};_0x3b372f:for(const _0x52df10 of _0x12c470){if(_0x52df10[_0x50ca2c(0x18f)]?.['segment']===_0x954226){_0x43a5ee=_0x52df10[_0x50ca2c(0x108)],_0xd39788=_0x52df10[_0x50ca2c(0x18f)][_0x50ca2c(0x108)]||_0x954226;break;}if(_0x52df10[_0x50ca2c(0x14c)])for(const _0x3b63a1 of _0x52df10[_0x50ca2c(0x14c)]){if(_0x3b63a1[_0x50ca2c(0xd6)]===_0x50ca2c(0x188)&&_0x3b63a1['with']?.[_0x50ca2c(0x107)])for(const _0x465326 of _0x3b63a1[_0x50ca2c(0xe9)][_0x50ca2c(0x107)]){if(_0x465326[_0x50ca2c(0x175)]===_0x954226){_0x43a5ee=_0x52df10[_0x50ca2c(0x108)],_0xd39788=_0x465326['name']||_0x954226;break _0x3b372f;}}}}return{'stageName':_0x43a5ee,'criteriaName':_0xd39788};}async function executeThreeStepJourneyCreate(_0x19fb78,_0x5c1748,_0x1171dc,_0x57b225,_0x45f17e,_0x4bcf14,_0x474f78,_0x274ba1){const _0x1a1165=a155_0x213229,{activationDefToCreateRequest:_0x29ac92,yamlRuleToApi:_0x5848c5}=_0x274ba1,{pendingEmbeddedSegments:_0x267d3a,pendingEmbeddedActivations:_0x3cd2f0,embeddedSegmentNameToId:_0x45fc24}=_0x57b225,_0x28d0c9=JSON[_0x1a1165(0xf1)](JSON[_0x1a1165(0x15f)](_0x1171dc));ensureJourneyDefaults(_0x28d0c9['attributes']),stripPendingIds(_0x28d0c9);const _0x1da99d=await _0x19fb78[_0x1a1165(0xf4)][_0x1a1165(0x14d)](_0x28d0c9),_0x90c69e=_0x1da99d['id'],_0x200696=new Map();for(const _0x4c87fa of _0x1da99d[_0x1a1165(0x1b6)][_0x1a1165(0x161)]){_0x200696[_0x1a1165(0x167)](_0x4c87fa[_0x1a1165(0x108)]['toLowerCase'](),_0x4c87fa['id']);}recoverSegmentIdsFromPushRecovery(_0x5c1748,_0x45fc24,_0x4bcf14[_0x1a1165(0x1a1)]);for(const [_0x3a6e53,{definition:_0x5024ab}]of _0x267d3a){if(_0x45fc24['has'](_0x3a6e53)){_0x474f78[_0x1a1165(0xf8)]?.({'type':'embedded_segment_created','journeyName':_0x5c1748[_0x1a1165(0x148)][_0x1a1165(0x108)],'segmentName':_0x3a6e53});continue;}const _0x13f3fd=generateDeterministicJourneySegmentName(_0x5c1748[_0x1a1165(0x148)][_0x1a1165(0x108)],_0x3a6e53);_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x141),'journeyName':_0x5c1748[_0x1a1165(0x148)]['name'],'segmentName':_0x3a6e53});const _0xaf5072=createSegmentIdResolver(_0x4bcf14['segmentNameToId'],_0x3a6e53),_0x4f20ef=await resolveRuleSegmentIds(_0x5024ab['rule'],_0xaf5072),_0x4d99ec=await createOrRecoverEmbeddedSegment(_0x19fb78,_0x5c1748,{'localName':_0x3a6e53,'uniqueSegmentName':_0x13f3fd,'description':_0x5024ab[_0x1a1165(0x177)]||'Entry\x20criteria:\x20'+_0x3a6e53,'journeyId':_0x90c69e,'resolvedRule':_0x4f20ef,'parentId':_0x45f17e[_0x1a1165(0x10f)],'folderId':_0x45f17e[_0x1a1165(0x135)]||''},_0x5848c5);_0x45fc24[_0x1a1165(0x167)](_0x3a6e53,_0x4d99ec),_0x4bcf14['segmentNameToId'][_0x1a1165(0x167)](_0x3a6e53,_0x4d99ec),_0x474f78[_0x1a1165(0xf8)]?.({'type':'embedded_segment_created','journeyName':_0x5c1748[_0x1a1165(0x148)]['name'],'segmentName':_0x3a6e53});}const _0x218561=new Map();for(const [_0x3f993a,_0x59fb25]of _0x3cd2f0){_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x159),'journeyName':_0x5c1748['yamlConfig']['name'],'activationName':_0x3f993a});const _0x211fad=await _0x29ac92(_0x59fb25,_0x4bcf14[_0x1a1165(0xfa)]),_0x4ae311={..._0x211fad,..._0x59fb25[_0x1a1165(0xe5)]!==undefined&&{'runAfterJourneyRefresh':_0x59fb25['run_after_journey_refresh']}},_0x376411=await _0x19fb78[_0x1a1165(0xf4)]['createActivation'](_0x90c69e,_0x4ae311);_0x218561[_0x1a1165(0x167)](_0x3f993a,_0x376411['id']),_0x57b225[_0x1a1165(0x151)][_0x1a1165(0x167)](_0x3f993a,_0x376411['id']),_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x185),'journeyName':_0x5c1748['yamlConfig'][_0x1a1165(0x108)],'activationName':_0x3f993a});}const _0x5e7265=JSON[_0x1a1165(0xf1)](JSON[_0x1a1165(0x15f)](_0x1171dc));return _0x5e7265['id']=_0x90c69e,ensureJourneyDefaults(_0x5e7265[_0x1a1165(0x1b6)]),resolvePendingIdsInRequest(_0x5e7265,_0x1171dc,_0x200696,_0x45fc24,_0x218561,_0x474f78),await _0x19fb78[_0x1a1165(0xf4)][_0x1a1165(0x152)](_0x90c69e,_0x5e7265),deletePushRecovery(_0x5c1748[_0x1a1165(0x144)]),{'action':_0x1a1165(0x122),'journeyId':_0x90c69e,'embeddedSegmentNameToId':_0x45fc24};}export function stripWaitStepPendingIds(_0x525242){const _0x4cb505=a155_0x213229,_0x1d27ea=_0x525242[_0x4cb505(0x18a)]&&isPendingSegmentId(_0x525242[_0x4cb505(0x18a)]),_0x142c45=_0x525242[_0x4cb505(0xdd)]?.[_0x4cb505(0x125)](_0x5a833c=>_0x5a833c[_0x4cb505(0x133)]&&isPendingSegmentId(_0x5a833c['segmentId']));(_0x1d27ea||_0x142c45)&&(_0x525242[_0x4cb505(0x1cb)]='Duration',_0x525242[_0x4cb505(0xdc)]=0x1,_0x525242[_0x4cb505(0x1ae)]=_0x4cb505(0x153),delete _0x525242[_0x4cb505(0x18a)],delete _0x525242['conditionTimeoutDuration'],delete _0x525242[_0x4cb505(0x10b)],delete _0x525242['conditions']);}export function resolveWaitStepPendingIds(_0x3f780a,_0x28edc7,_0x46c325,_0x5a70f7){const _0x2f202c=a155_0x213229;if(_0x28edc7[_0x2f202c(0x18a)]&&isPendingSegmentId(_0x28edc7['conditionSegmentId'])){const _0x174095=_0x46c325(_0x28edc7['conditionSegmentId'],_0x2f202c(0x16f)+_0x5a70f7+_0x2f202c(0x181));_0x174095&&(_0x3f780a[_0x2f202c(0x1cb)]=_0x2f202c(0x1a4),_0x3f780a[_0x2f202c(0x18a)]=_0x174095,delete _0x3f780a[_0x2f202c(0xdc)],delete _0x3f780a[_0x2f202c(0x1ae)],_0x28edc7[_0x2f202c(0xe2)]!==undefined&&(_0x3f780a['conditionTimeoutDuration']=_0x28edc7['conditionTimeoutDuration']),_0x28edc7[_0x2f202c(0x10b)]&&(_0x3f780a['conditionTimeoutUnit']=_0x28edc7[_0x2f202c(0x10b)]));}if(_0x28edc7[_0x2f202c(0xdd)]){const _0x598005=_0x28edc7[_0x2f202c(0xdd)][_0x2f202c(0x125)](_0x341783=>_0x341783[_0x2f202c(0x133)]&&isPendingSegmentId(_0x341783[_0x2f202c(0x133)]));if(_0x598005){const _0x3acd97=_0x28edc7['conditions'][_0x2f202c(0x19f)](_0x5af9b5=>{const _0x2a3bbe=_0x2f202c;if(_0x5af9b5[_0x2a3bbe(0x133)]&&isPendingSegmentId(_0x5af9b5[_0x2a3bbe(0x133)])){const _0x4d1cee=_0x46c325(_0x5af9b5[_0x2a3bbe(0x133)],_0x2a3bbe(0x16f)+_0x5a70f7+_0x2a3bbe(0x181));return{..._0x5af9b5,'segmentId':_0x4d1cee||_0x5af9b5[_0x2a3bbe(0x133)]};}return{..._0x5af9b5};});_0x3f780a['waitStepType']=_0x2f202c(0x1a4),_0x3f780a[_0x2f202c(0xdd)]=_0x3acd97,delete _0x3f780a['waitStep'],delete _0x3f780a[_0x2f202c(0x1ae)],delete _0x3f780a['conditionSegmentId'],delete _0x3f780a['conditionTimeoutDuration'],delete _0x3f780a[_0x2f202c(0x10b)];}}}function stripPendingIds(_0x3ab5a7){const _0x18150e=a155_0x213229;_0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)][_0x18150e(0x133)])&&delete _0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)];for(const _0x3c29ff of _0x3ab5a7['attributes'][_0x18150e(0x161)]||[]){_0x3c29ff[_0x18150e(0xe7)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3c29ff['entryCriteria'][_0x18150e(0x133)])&&delete _0x3c29ff[_0x18150e(0xe7)];_0x3c29ff[_0x18150e(0x194)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3c29ff['milestone'][_0x18150e(0x133)])&&delete _0x3c29ff['milestone'];_0x3c29ff[_0x18150e(0x157)]&&(_0x3c29ff[_0x18150e(0x157)]=_0x3c29ff[_0x18150e(0x157)][_0x18150e(0xed)](_0x31d143=>!_0x31d143[_0x18150e(0x133)]||!isPendingSegmentId(_0x31d143['segmentId'])));if(_0x3c29ff[_0x18150e(0x14c)])for(const _0x45a958 of Object[_0x18150e(0x1c2)](_0x3c29ff[_0x18150e(0x14c)])){const _0x10faf1=_0x3c29ff['steps'][_0x45a958];_0x10faf1[_0x18150e(0xd6)]===_0x18150e(0x172)&&_0x10faf1['journeyActivationStepId']&&isPendingActivationId(_0x10faf1[_0x18150e(0x12b)])&&(_0x10faf1[_0x18150e(0x12b)]='');if(_0x10faf1['type']===_0x18150e(0x1c8)&&_0x10faf1[_0x18150e(0x107)])for(const _0x57bc55 of _0x10faf1[_0x18150e(0x107)]){_0x57bc55[_0x18150e(0x133)]&&isPendingSegmentId(_0x57bc55[_0x18150e(0x133)])&&(_0x57bc55[_0x18150e(0x133)]='');}_0x10faf1[_0x18150e(0xd6)]===_0x18150e(0x1af)&&stripWaitStepPendingIds(_0x10faf1);}}}function resolvePendingIdsInRequest(_0x4c94f9,_0x56438c,_0x2bf504,_0x273345,_0x2cf722,_0x26e37e){const _0x196549=a155_0x213229,_0xb6a941=(_0x3de90f,_0x36203c)=>{const _0x519f77=a155_0x27e5;if(!isPendingSegmentId(_0x3de90f))return _0x3de90f;const _0x9ef28e=extractPendingSegmentName(_0x3de90f),_0x257d5e=_0x273345[_0x519f77(0x187)](_0x9ef28e);return!_0x257d5e&&_0x26e37e[_0x519f77(0x16e)]?.(_0x519f77(0x119)+_0x9ef28e+_0x519f77(0xfc)+_0x36203c),_0x257d5e;};if(_0x4c94f9[_0x196549(0x1b6)][_0x196549(0x1c4)]?.['segmentId']&&isPendingSegmentId(_0x4c94f9['attributes'][_0x196549(0x1c4)][_0x196549(0x133)])){const _0x2e2bc2=_0xb6a941(_0x4c94f9[_0x196549(0x1b6)][_0x196549(0x1c4)][_0x196549(0x133)],_0x196549(0xf7));_0x2e2bc2&&(_0x4c94f9['attributes'][_0x196549(0x1c4)][_0x196549(0x133)]=_0x2e2bc2);}for(const _0x1b8fa9 of _0x4c94f9[_0x196549(0x1b6)][_0x196549(0x161)]||[]){const _0x861b70=_0x2bf504[_0x196549(0x187)](_0x1b8fa9['name'][_0x196549(0x15a)]());_0x861b70&&(_0x1b8fa9['id']=_0x861b70);if(_0x1b8fa9[_0x196549(0xe7)]?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1b8fa9['entryCriteria'][_0x196549(0x133)])){const _0x39f949=_0xb6a941(_0x1b8fa9[_0x196549(0xe7)][_0x196549(0x133)],'stage\x20\x27'+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0x1b9));_0x39f949&&(_0x1b8fa9['entryCriteria']['segmentId']=_0x39f949);}if(_0x1b8fa9[_0x196549(0x157)])for(const _0x5a5637 of _0x1b8fa9[_0x196549(0x157)]){if(_0x5a5637[_0x196549(0x133)]&&isPendingSegmentId(_0x5a5637[_0x196549(0x133)])){const _0x12df5c=_0xb6a941(_0x5a5637['segmentId'],_0x196549(0x16f)+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0xe3));_0x12df5c&&(_0x5a5637[_0x196549(0x133)]=_0x12df5c);}}if(_0x1b8fa9[_0x196549(0x194)]?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1b8fa9[_0x196549(0x194)]['segmentId'])){const _0x5ef28e=_0xb6a941(_0x1b8fa9[_0x196549(0x194)]['segmentId'],'stage\x20\x27'+_0x1b8fa9['name']+'\x27\x20milestone');_0x5ef28e&&(_0x1b8fa9[_0x196549(0x194)][_0x196549(0x133)]=_0x5ef28e);}if(_0x1b8fa9[_0x196549(0x14c)]){const _0x33d28e=_0x35759f=>_0x56438c[_0x196549(0x1b6)]['journeyStages']?.['find'](_0x5ef9a6=>_0x5ef9a6[_0x196549(0x108)][_0x196549(0x15a)]()===_0x1b8fa9['name'][_0x196549(0x15a)]())?.[_0x196549(0x14c)]?.[_0x35759f];for(const _0x2e70ae of Object[_0x196549(0x1c2)](_0x1b8fa9[_0x196549(0x14c)])){const _0x5119bf=_0x1b8fa9[_0x196549(0x14c)][_0x2e70ae],_0x397ed3=_0x33d28e(_0x2e70ae);if(_0x5119bf[_0x196549(0xd6)]===_0x196549(0x172)&&_0x5119bf[_0x196549(0x12b)]&&(isPendingActivationId(_0x5119bf[_0x196549(0x12b)])||_0x5119bf['journeyActivationStepId']==='')){if(_0x397ed3?.[_0x196549(0x12b)]&&isPendingActivationId(_0x397ed3[_0x196549(0x12b)])){const _0x50c6fd=extractPendingActivationName(_0x397ed3[_0x196549(0x12b)]),_0x3740ed=_0x2cf722[_0x196549(0x187)](_0x50c6fd);_0x3740ed&&(_0x5119bf['journeyActivationStepId']=_0x3740ed);}}if(_0x5119bf[_0x196549(0xd6)]===_0x196549(0x1c8)&&_0x5119bf[_0x196549(0x107)]&&_0x397ed3?.[_0x196549(0x107)])for(let _0x2ec549=0x0;_0x2ec549<_0x5119bf[_0x196549(0x107)][_0x196549(0x176)];_0x2ec549++){const _0x179abd=_0x5119bf[_0x196549(0x107)][_0x2ec549],_0x1c82e7=_0x397ed3[_0x196549(0x107)][_0x2ec549];if(_0x1c82e7?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1c82e7['segmentId'])){const _0x1f6f22=_0xb6a941(_0x1c82e7[_0x196549(0x133)],_0x196549(0x16f)+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0x14f)+(_0x179abd[_0x196549(0x108)]||_0x2ec549)+'\x27');_0x1f6f22&&(_0x179abd['segmentId']=_0x1f6f22);}}_0x5119bf[_0x196549(0xd6)]===_0x196549(0x1af)&&_0x397ed3?.[_0x196549(0xd6)]===_0x196549(0x1af)&&resolveWaitStepPendingIds(_0x5119bf,_0x397ed3,_0xb6a941,_0x1b8fa9['name']);}}}}
1
+ const a156_0x1fb252=a156_0x419a;(function(_0x434787,_0x439d28){const _0x2c07a8=a156_0x419a,_0x51d399=_0x434787();while(!![]){try{const _0x599262=parseInt(_0x2c07a8(0x8c))/0x1*(-parseInt(_0x2c07a8(0x130))/0x2)+-parseInt(_0x2c07a8(0x152))/0x3+-parseInt(_0x2c07a8(0x15a))/0x4*(-parseInt(_0x2c07a8(0x17f))/0x5)+-parseInt(_0x2c07a8(0x142))/0x6+parseInt(_0x2c07a8(0x98))/0x7+-parseInt(_0x2c07a8(0x12d))/0x8+parseInt(_0x2c07a8(0x170))/0x9*(parseInt(_0x2c07a8(0xcb))/0xa);if(_0x599262===_0x439d28)break;else _0x51d399['push'](_0x51d399['shift']());}catch(_0x24a5f3){_0x51d399['push'](_0x51d399['shift']());}}}(a156_0x56c5,0x77033));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a156_0x1fb252(0x13a));export const PENDING_SEGMENT_PREFIX=a156_0x1fb252(0x86);export const PENDING_ACTIVATION_PREFIX=a156_0x1fb252(0x84);export function createPendingSegmentId(_0x87de0){return''+PENDING_SEGMENT_PREFIX+_0x87de0+'__';}export function isPendingSegmentId(_0x3871d4){const _0xe2e867=a156_0x1fb252;return _0x3871d4[_0xe2e867(0xc9)](PENDING_SEGMENT_PREFIX)&&!_0x3871d4[_0xe2e867(0xc9)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x25a546){return _0x25a546['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x126826){return''+PENDING_ACTIVATION_PREFIX+_0x126826+'__';}export function isPendingActivationId(_0x349399){const _0x3402c2=a156_0x1fb252;return _0x349399[_0x3402c2(0xc9)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x2b87e9){const _0x30a056=a156_0x1fb252;return _0x2b87e9[_0x30a056(0xea)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x47bcd1,_0x4bbf4a){const _0x1b993e=a156_0x1fb252,_0x52652a=_0x47bcd1+'::'+(_0x4bbf4a['trim']()||'segment'),_0x1c3c9c=createHash('sha1')[_0x1b993e(0xec)](_0x52652a)['digest'](_0x1b993e(0x151))[_0x1b993e(0x14b)](0x0,0xc);return _0x1b993e(0x123)+_0x1c3c9c;}export function ensureJourneyDefaults(_0x3ab78f){const _0x559de3=a156_0x1fb252;!_0x3ab78f[_0x559de3(0x140)]&&(_0x3ab78f[_0x559de3(0x140)]=''),!_0x3ab78f[_0x559de3(0x14f)]&&(_0x3ab78f[_0x559de3(0x14f)]=_0x559de3(0x9d));}export function injectExistingStageIds(_0x258583,_0x561ff1){const _0x574c38=a156_0x1fb252,_0xe3b19a=new Map(_0x561ff1[_0x574c38(0x117)](_0x3cceb1=>[_0x3cceb1[_0x574c38(0xfe)],_0x3cceb1['id']]));for(const _0x1fdb4d of _0x258583){if(!_0x1fdb4d['id']){const _0x388afc=_0xe3b19a[_0x574c38(0xab)](_0x1fdb4d['name']);_0x388afc&&(_0x1fdb4d['id']=_0x388afc);}}}export function resolveTDFolderPath(_0x4e288d,_0x3d3dde,_0x265bb2){const _0xf5941c=a156_0x1fb252;if(!_0x3d3dde)return _0x4e288d;if(_0x4e288d===_0x265bb2||_0x4e288d[_0xf5941c(0xc9)](_0x265bb2+'/'))return _0x4e288d;return _0x4e288d?_0x265bb2+'/'+_0x4e288d:_0x265bb2;}export function addFoldersToCreate(_0x24b423,_0x29bd88,_0x35f02f){const _0x8e59e0=a156_0x1fb252;if(!_0x24b423)return;if(_0x29bd88['has'](_0x24b423))return;const _0x306791=_0x24b423[_0x8e59e0(0x147)]('/');let _0x2075a9='';for(const _0x418f95 of _0x306791){_0x2075a9=_0x2075a9?_0x2075a9+'/'+_0x418f95:_0x418f95,!_0x29bd88['has'](_0x2075a9)&&_0x35f02f[_0x8e59e0(0xc4)](_0x2075a9);}}export function sortFoldersByDepth(_0x238ae3){return[..._0x238ae3]['sort']((_0x65a1f4,_0x49585a)=>{const _0x5bbed8=a156_0x419a,_0x5486be=(_0x65a1f4[_0x5bbed8(0x11d)](/\//g)||[])[_0x5bbed8(0x10d)],_0x5a7b82=(_0x49585a['match'](/\//g)||[])['length'];return _0x5486be-_0x5a7b82;});}import*as a156_0x3f638c from'yaml';import{readFileSync}from'fs';import a156_0xf0850a from'path';import{isJourneyDef,parseYamlString as a156_0x41e5fb,toYamlString as a156_0x3891d9,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(_0x1b8bdf){const _0x4395f1=a156_0x1fb252;if(Array[_0x4395f1(0x178)](_0x1b8bdf))return'['+_0x1b8bdf[_0x4395f1(0x117)](_0x382ece=>stableStringify(_0x382ece))[_0x4395f1(0x139)](',')+']';if(_0x1b8bdf&&typeof _0x1b8bdf==='object'){const _0x408bb2=_0x1b8bdf,_0x2bb9af=Object[_0x4395f1(0x125)](_0x408bb2)[_0x4395f1(0xd1)](),_0x1e6f04=_0x2bb9af[_0x4395f1(0x117)](_0x2b0105=>'\x22'+_0x2b0105+'\x22:'+stableStringify(_0x408bb2[_0x2b0105]));return'{'+_0x1e6f04['join'](',')+'}';}const _0x5f445b=JSON['stringify'](_0x1b8bdf);return _0x5f445b===undefined?'null':_0x5f445b;}function activationSignature(_0x6702c9){const _0x2d5e79=a156_0x1fb252,_0x5a2796={'connection':_0x6702c9[_0x2d5e79(0x16d)],..._0x6702c9[_0x2d5e79(0xb1)]!==undefined&&{'all_columns':_0x6702c9['all_columns']},..._0x6702c9[_0x2d5e79(0xb8)]!==undefined&&{'columns':_0x6702c9[_0x2d5e79(0xb8)]},..._0x6702c9[_0x2d5e79(0x103)]!==undefined&&{'behavior':_0x6702c9[_0x2d5e79(0x103)]},..._0x6702c9[_0x2d5e79(0xd7)]!==undefined&&{'schedule':_0x6702c9['schedule']},..._0x6702c9[_0x2d5e79(0x101)]!==undefined&&{'notification':_0x6702c9[_0x2d5e79(0x101)]},..._0x6702c9[_0x2d5e79(0xfd)]!==undefined&&{'connector_config':_0x6702c9[_0x2d5e79(0xfd)]},..._0x6702c9['activation_template_id']!==undefined&&{'activation_template_id':_0x6702c9[_0x2d5e79(0xe4)]}};return stableStringify(_0x5a2796);}async function fetchSegment(_0x2702ce,_0x232bcf,_0xf21f57,_0x51fb08){const _0x31418b=a156_0x1fb252,_0x581e01=_0x51fb08?.[_0x31418b(0x162)](_0xda80cd=>_0xda80cd['id']===_0xf21f57);if(_0x581e01)return _0x581e01;try{return await _0x2702ce[_0x31418b(0xfb)]['getSegment'](_0x232bcf,_0xf21f57);}catch(_0x4398a2){logger[_0x31418b(0x15f)](_0x31418b(0xc5)+_0xf21f57+_0x31418b(0x114)+_0x4398a2);try{return await _0x2702ce[_0x31418b(0xfb)]['getSegmentEntity'](_0xf21f57);}catch(_0x4a262c){return logger[_0x31418b(0x15f)](_0x31418b(0xbb)+_0xf21f57+':\x20'+_0x4a262c),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4e1bf2,_0x443617,_0x4f97fe){const _0x8305=a156_0x1fb252,_0x5e8554=readPushRecovery(_0x4e1bf2[_0x8305(0x8e)]);if(_0x5e8554?.[_0x8305(0x141)]===_0x4e1bf2[_0x8305(0xb2)][_0x8305(0xfe)])for(const [_0x4a3bd6,_0x2b1c2f]of Object[_0x8305(0x87)](_0x5e8554[_0x8305(0x9e)])){const _0x5e8f0d=generateDeterministicJourneySegmentName(_0x4e1bf2[_0x8305(0xb2)][_0x8305(0xfe)],_0x4a3bd6);_0x2b1c2f['uniqueServerName']===_0x5e8f0d&&(_0x443617[_0x8305(0xeb)](_0x4a3bd6,_0x2b1c2f[_0x8305(0x8a)]),_0x4f97fe[_0x8305(0xeb)](_0x4a3bd6,_0x2b1c2f[_0x8305(0x8a)]));}}async function createOrRecoverEmbeddedSegment(_0x3ac67b,_0x78608b,_0xcac128,_0x7e68c9){const _0x507ad4=a156_0x1fb252;let _0x32e0f9;try{_0x32e0f9=await _0x3ac67b['segment']['createJourneySegment']({'name':_0xcac128[_0x507ad4(0x15c)],'description':_0xcac128[_0x507ad4(0x140)],'journeyId':_0xcac128[_0x507ad4(0xa3)],'rule':_0x7e68c9(_0xcac128[_0x507ad4(0xac)],!![]),'countPopulation':!![],'parentFolderId':_0xcac128['folderId'],'audienceId':_0xcac128[_0x507ad4(0x13c)]});}catch(_0x5394ca){const _0x48a0f2=_0x5394ca instanceof Error&&_0x5394ca['message'][_0x507ad4(0x179)](_0x507ad4(0xff));if(_0x48a0f2){const _0x2e1f3a=readPushRecovery(_0x78608b[_0x507ad4(0x8e)]),_0xbbf420=_0x2e1f3a?.[_0x507ad4(0x141)]===_0x78608b[_0x507ad4(0xb2)][_0x507ad4(0xfe)]?_0x2e1f3a[_0x507ad4(0x9e)][_0xcac128[_0x507ad4(0x95)]]:undefined;if(_0xbbf420?.[_0x507ad4(0x161)]===_0xcac128['uniqueSegmentName'])await _0x3ac67b[_0x507ad4(0xfb)][_0x507ad4(0x176)](_0xcac128['parentId'],_0xbbf420[_0x507ad4(0x8a)],{'description':_0xcac128[_0x507ad4(0x140)],'rule':_0x7e68c9(_0xcac128['resolvedRule'],!![]),'countPopulation':!![]}),_0x32e0f9=_0xbbf420[_0x507ad4(0x8a)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0xcac128[_0x507ad4(0x95)]+_0x507ad4(0x8b)+(_0x507ad4(0x166)+_0x78608b[_0x507ad4(0x8e)][_0x507ad4(0xea)](/([^/]+)$/,_0x507ad4(0x15e))+')\x20')+_0x507ad4(0x14d),_0x5394ca);}else throw _0x5394ca;}return saveSegmentToPushRecovery(_0x78608b['absolutePath'],_0x78608b['yamlConfig'][_0x507ad4(0xfe)],_0xcac128['localName'],{'segmentId':_0x32e0f9,'uniqueServerName':_0xcac128['uniqueSegmentName'],'createdAt':new Date()[_0x507ad4(0x17a)]()}),_0x32e0f9;}export async function prepareSegmentFiles(_0x32c895,_0x6f0c07,_0x3a8838,_0x4d0326,_0x3c38d2){const _0x239980=a156_0x1fb252,{activationDefToCreateRequest:_0x3dc0f6}=await import(_0x239980(0xe8)),_0x7238db=[],_0x121786=new Set();for(const {yamlConfig:_0x66124e,folderPath:_0x1ea7a8,sourcePath:_0x2e9135}of _0x32c895){const _0x2c0ef1=resolveTDFolderPath(_0x1ea7a8,_0x4d0326,_0x3c38d2),_0x3d43ea=_0x2c0ef1+':'+_0x66124e[_0x239980(0xfe)],_0x3965e0=_0x6f0c07[_0x239980(0x85)]['get'](_0x3d43ea),_0x30c10b=_0x3965e0?_0x6f0c07[_0x239980(0xcd)][_0x239980(0xab)](_0x3965e0['id'])||[]:[];addFoldersToCreate(_0x2c0ef1,_0x6f0c07['folderPathToId'],_0x121786);const _0x5de405=calculateActivationActions(_0x66124e[_0x239980(0x14c)]||[],_0x30c10b,_0x6f0c07[_0x239980(0xc1)],_0x6f0c07[_0x239980(0xa6)]);for(const _0x27d55b of _0x5de405){(_0x27d55b['type']==='create'||_0x27d55b[_0x239980(0x138)]==='update')&&_0x27d55b[_0x239980(0x107)]&&(_0x27d55b[_0x239980(0x10c)]=await _0x3dc0f6(_0x27d55b[_0x239980(0x107)],_0x3a8838));}const _0x50c4c3=calculateSegmentDiff(_0x66124e,_0x3965e0,_0x30c10b,_0x6f0c07[_0x239980(0xc1)],_0x6f0c07[_0x239980(0xa6)]);_0x7238db['push']({'relativePath':_0x66124e[_0x239980(0xfe)],'absolutePath':_0x2e9135,'yamlConfig':_0x66124e,'folderPath':_0x2c0ef1,'existingSegment':_0x3965e0,'existingActivations':_0x30c10b,'isNew':_0x50c4c3[_0x239980(0x8d)],'hasChanges':_0x50c4c3['hasChanges'],'diff':_0x50c4c3[_0x239980(0xc7)],'activationActions':_0x5de405});}return{'segmentFiles':_0x7238db,'foldersToCreate':_0x121786};}export async function prepareJourneyFiles(_0x15443e,_0x5a3615,_0x1accd6,_0x1e84de){const _0x59415a=a156_0x1fb252,_0x4a9bd3=[],_0x1eb1da=new Set();for(const {yamlConfig:_0x3fd49c,folderPath:_0x40acfa,sourcePath:_0x267894}of _0x15443e){const _0x16af46=resolveTDFolderPath(_0x40acfa,_0x1accd6,_0x1e84de),_0x123c94=_0x16af46+':'+_0x3fd49c[_0x59415a(0xfe)],_0x5cd264=_0x5a3615[_0x59415a(0xd4)][_0x59415a(0xab)](_0x123c94);let _0x5262f0,_0x2fb44f;if(_0x5cd264&&_0x5cd264[_0x59415a(0x10d)]>0x0){const _0x19a245=buildLocalExpandedRuleMappings(_0x3fd49c),{createYamlContext:_0x2df179,prefetchJourneySegments:_0x24f8de}=createPushYamlContextForBundle(_0x5a3615[_0x59415a(0x94)],_0x5a3615[_0x59415a(0x13c)],_0x5a3615[_0x59415a(0xc2)],_0x19a245,_0x5a3615[_0x59415a(0xc1)],_0x5a3615[_0x59415a(0xa6)],_0x5a3615[_0x59415a(0x102)],_0x5a3615['journeyById']);await _0x24f8de(_0x5cd264[_0x59415a(0x117)](_0x3383b5=>_0x3383b5['id']));const _0x13a6fa=await _0x5a3615['deps']['journey']['getLatestJourneyId'](_0x5cd264[0x0]['journeyBundleId']),_0x25130c=hasMultipleVersions(_0x3fd49c),_0x1b252f=async _0x225840=>{const _0x393e38=_0x59415a,_0x2d4f95=_0x5a3615[_0x393e38(0x143)]?.[_0x393e38(0xab)](_0x225840);if(_0x2d4f95)return _0x2d4f95;return _0x5a3615['fetchJourney']({'journeyId':_0x225840,'journeyName':_0x3fd49c[_0x393e38(0xfe)],'isMultiVersion':_0x5cd264['length']>0x1});};if(_0x25130c&&_0x5cd264[_0x59415a(0x10d)]>0x1){const _0x4fc8d7=[];for(const _0x1f8985 of _0x5cd264){const _0x2e2195=_0x1f8985['versionNumber']||0x1;_0x5a3615['progress']?.[_0x59415a(0xec)](_0x59415a(0x177)+_0x3fd49c[_0x59415a(0xfe)]+'\x20v'+_0x2e2195);const _0x1b2c91=await _0x1b252f(_0x1f8985['id']),_0x483eff=_0x2df179(_0x1f8985['id']),_0x1160f3=await journeyResponseToDef(_0x1b2c91,_0x483eff);_0x4fc8d7[_0x59415a(0xc6)]({'item':_0x1f8985,'yaml':_0x1160f3});}const _0x258978=buildLocalRuleToNameMappingFromJourney(_0x3fd49c);_0x2fb44f=buildMergedJourneyDef(_0x4fc8d7,_0x258978,_0x13a6fa);const _0x2988ae=Math[_0x59415a(0x10a)](..._0x4fc8d7['map'](_0x18e80f=>_0x18e80f[_0x59415a(0x109)]['versionNumber']||0x0)),_0x1a9fb3=_0x5cd264[_0x59415a(0x162)](_0x5b9bf7=>(_0x5b9bf7[_0x59415a(0x83)]||0x0)===_0x2988ae);_0x1a9fb3&&(_0x5a3615['progress']?.['update'](_0x59415a(0x177)+_0x3fd49c[_0x59415a(0xfe)]+'\x20v'+_0x2988ae),_0x5262f0=await _0x1b252f(_0x1a9fb3['id']));}else{const _0x2451d0=_0x5cd264[_0x5cd264[_0x59415a(0x10d)]-0x1];_0x5a3615[_0x59415a(0xa5)]?.[_0x59415a(0xec)](_0x59415a(0x177)+_0x3fd49c['name']),_0x5262f0=await _0x1b252f(_0x2451d0['id']);const _0x5906b6=_0x2df179(_0x2451d0['id']),_0x309a58=await journeyResponseToDef(_0x5262f0,_0x5906b6),_0x220bc1=buildLocalRuleToNameMappingFromJourney(_0x3fd49c);_0x2fb44f=buildMergedJourneyDef([{'item':_0x2451d0,'yaml':_0x309a58}],_0x220bc1,_0x13a6fa);}}addFoldersToCreate(_0x16af46,_0x5a3615[_0x59415a(0xe9)],_0x1eb1da);const _0x9e6791=calculateJourneyDiff(_0x3fd49c,_0x2fb44f);_0x4a9bd3[_0x59415a(0xc6)]({'relativePath':_0x3fd49c['name'],'absolutePath':_0x267894,'yamlConfig':_0x3fd49c,'folderPath':_0x16af46,'existingJourney':_0x5262f0,'isNew':_0x9e6791[_0x59415a(0x8d)],'hasChanges':_0x9e6791['hasChanges'],'diff':_0x9e6791[_0x59415a(0xc7)]});}return{'journeyFiles':_0x4a9bd3,'foldersToCreate':_0x1eb1da};}export function calculateActivationActions(_0x451f6a,_0x8acf7e,_0x2b29df,_0x4c1e71){const _0x525e51=a156_0x1fb252,_0x427505=[],_0x2db7c7=new Map();for(const _0x26330c of _0x8acf7e){_0x2db7c7['set'](_0x26330c[_0x525e51(0xfe)],_0x26330c);}const _0x4c53b2=new Map();for(const _0x2f0853 of _0x451f6a){_0x4c53b2['set'](_0x2f0853['name'],_0x2f0853);}for(const _0x40e224 of _0x451f6a){const _0x54ff26=_0x2db7c7[_0x525e51(0xab)](_0x40e224[_0x525e51(0xfe)]);if(!_0x54ff26)_0x427505[_0x525e51(0xc6)]({'type':_0x525e51(0x105),'name':_0x40e224[_0x525e51(0xfe)],'yamlActivation':_0x40e224});else{const _0x425d8c=activationResponseToDef(_0x54ff26,_0x2b29df,_0x4c1e71),_0x5e3e95=a156_0x3f638c[_0x525e51(0x124)](_0x425d8c),_0x3c86a5=a156_0x3f638c[_0x525e51(0x124)](_0x40e224);_0x5e3e95!==_0x3c86a5&&_0x427505['push']({'type':_0x525e51(0xec),'name':_0x40e224['name'],'yamlActivation':_0x40e224,'existingActivation':_0x54ff26});}}for(const _0x163447 of _0x8acf7e){!_0x4c53b2['has'](_0x163447[_0x525e51(0xfe)])&&_0x427505[_0x525e51(0xc6)]({'type':_0x525e51(0x14e),'name':_0x163447[_0x525e51(0xfe)],'existingActivation':_0x163447});}return _0x427505;}function calculateYamlDiff(_0x351840,_0x23e9a7){if(_0x23e9a7){const _0x1782e8=generateDiff(_0x23e9a7,_0x351840),_0x5ed002=hasChanges(_0x1782e8);return{'isNew':![],'hasChanges':_0x5ed002,'diff':_0x5ed002?formatDiffWithColors(_0x1782e8):undefined};}const _0x145528=generateDiff('',_0x351840);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x145528)};}export function calculateSegmentDiff(_0x11a624,_0x3b79da,_0x9bf77b,_0x2a2e41,_0x2e7809){const _0x30198b=segmentToYamlString(_0x11a624),_0x37657e=_0x3b79da?segmentToYamlString(segmentWithActivationsToYaml(_0x3b79da,_0x9bf77b,undefined,_0x2a2e41,_0x2e7809)):undefined;return calculateYamlDiff(_0x30198b,_0x37657e);}export function calculateJourneyDiff(_0x412e1b,_0x292a82){const _0x186877=normalizeJourneyDef(_0x412e1b,_0x412e1b),_0x36f6ea=a156_0x3891d9(_0x186877),_0x3b1008=_0x292a82?a156_0x3891d9(normalizeJourneyDef(_0x292a82,_0x412e1b)):undefined;return calculateYamlDiff(_0x36f6ea,_0x3b1008);}export function findSegmentsToDelete(_0x5b1ced,_0x3e64a6,_0x21a519,_0x4877d0,_0x4f6e00){const _0x5f4047=a156_0x1fb252,_0x9e7fed=new Set();for(const {yamlConfig:_0x28e040,folderPath:_0x43dde5}of _0x3e64a6){_0x9e7fed[_0x5f4047(0xc4)](_0x43dde5+':'+_0x28e040[_0x5f4047(0xfe)]);}return _0x5b1ced['filter'](_0x15da4d=>{const _0x24a2b4=_0x5f4047,_0x597fd3=_0x15da4d[_0x24a2b4(0xba)]?_0x21a519[_0x24a2b4(0xab)](_0x15da4d['segmentFolderId'][_0x24a2b4(0x110)]())||'':'',_0x5a5493=_0x597fd3+':'+_0x15da4d[_0x24a2b4(0xfe)];if(_0x9e7fed[_0x24a2b4(0xde)](_0x5a5493))return![];if(_0x4f6e00)return _0x597fd3===_0x4877d0||_0x597fd3[_0x24a2b4(0xc9)](_0x4877d0+'/');return!![];});}export function findJourneysToDelete(_0x5bcce1,_0x50f93c,_0x1f3f6c,_0x567444,_0x5ab15a){const _0x4df19f=a156_0x1fb252,_0x443c72=new Set();for(const {yamlConfig:_0x404274,folderPath:_0x94e5ca}of _0x50f93c){_0x443c72[_0x4df19f(0xc4)](_0x94e5ca+':'+_0x404274[_0x4df19f(0xfe)]);}return _0x5bcce1[_0x4df19f(0x11b)](_0xf243d9=>{const _0x4bf95d=_0x4df19f,_0x413553=_0xf243d9[_0x4bf95d(0x146)]?_0x1f3f6c[_0x4bf95d(0xab)](_0xf243d9[_0x4bf95d(0x146)])||'':'',_0x82f93e=_0x413553+':'+_0xf243d9[_0x4bf95d(0xa8)];if(_0x443c72[_0x4bf95d(0xde)](_0x82f93e))return![];if(_0x5ab15a)return _0x413553===_0x567444||_0x413553[_0x4bf95d(0xc9)](_0x567444+'/');return!![];});}export function buildSegmentLookupMap(_0x8682cf,_0x45ee31){const _0x34c471=a156_0x1fb252,_0x350d6d=new Map();for(const _0x234048 of _0x8682cf){const _0x1feabe=_0x234048['segmentFolderId']?_0x45ee31[_0x34c471(0xab)](_0x234048[_0x34c471(0xba)][_0x34c471(0x110)]())||'':'',_0x3eb39f=_0x1feabe+':'+_0x234048[_0x34c471(0xfe)];_0x350d6d[_0x34c471(0xeb)](_0x3eb39f,_0x234048);}return _0x350d6d;}export function buildSegmentNameToIdMap(_0x16f3ff){const _0x32506d=a156_0x1fb252,_0x439934=new Map();for(const _0x2975c4 of _0x16f3ff){_0x439934[_0x32506d(0xeb)](_0x2975c4['name'],_0x2975c4['id']);}return _0x439934;}export function buildJourneyBundleLookupMap(_0x572b97,_0x2d672c){const _0x4c24be=a156_0x1fb252,_0x36d6d6=new Map();for(const _0x271db6 of _0x572b97){const _0x424cee=_0x271db6['folderId']?_0x2d672c['get'](_0x271db6[_0x4c24be(0x146)])||'':'',_0x53ad37=_0x424cee+':'+_0x271db6[_0x4c24be(0xa8)];!_0x36d6d6[_0x4c24be(0xde)](_0x53ad37)&&_0x36d6d6[_0x4c24be(0xeb)](_0x53ad37,[]),_0x36d6d6[_0x4c24be(0xab)](_0x53ad37)[_0x4c24be(0xc6)](_0x271db6);}for(const _0x5dbe61 of _0x36d6d6[_0x4c24be(0x14a)]()){_0x5dbe61[_0x4c24be(0xd1)]((_0x3ba26c,_0x26c7e4)=>(_0x3ba26c['versionNumber']||0x0)-(_0x26c7e4[_0x4c24be(0x83)]||0x0));}return _0x36d6d6;}function a156_0x419a(_0x375c59,_0x2a69f5){_0x375c59=_0x375c59-0x80;const _0x56c508=a156_0x56c5();let _0x419a31=_0x56c508[_0x375c59];return _0x419a31;}export function collectFoldersToCreate(_0x44fec3,_0x5696e5){const _0x5f117d=a156_0x1fb252,_0x1a4ffd=new Set();for(const _0x46b920 of _0x44fec3){if(!_0x46b920)continue;if(_0x5696e5[_0x5f117d(0xde)](_0x46b920))continue;const _0x46e049=_0x46b920[_0x5f117d(0x147)]('/');let _0xd09be7='';for(const _0x34092d of _0x46e049){_0xd09be7=_0xd09be7?_0xd09be7+'/'+_0x34092d:_0x34092d,!_0x5696e5[_0x5f117d(0xde)](_0xd09be7)&&_0x1a4ffd[_0x5f117d(0xc4)](_0xd09be7);}}return _0x1a4ffd;}export function parseAndClassifyYamlFiles(_0x40a0d8,_0x22ac23,_0x5b8c76){const _0x3abfc2=a156_0x1fb252,_0x19a00d=[],_0x5e772b=[];for(const _0x51fc8f of _0x40a0d8){const _0x185e8c=a156_0xf0850a[_0x3abfc2(0x131)](_0x22ac23,a156_0xf0850a[_0x3abfc2(0x137)](_0x51fc8f)),_0x2a954b=_0x185e8c==='.'?'':_0x185e8c[_0x3abfc2(0xea)](/\\/g,'/'),_0x1d83fa=readFileSync(_0x51fc8f,_0x3abfc2(0xd2)),_0x18c448=a156_0x3f638c['parse'](_0x1d83fa);if(isJourneyDef(_0x18c448)){const _0x363190=a156_0x41e5fb(_0x1d83fa);_0x5e772b[_0x3abfc2(0xc6)]({'yamlConfig':_0x363190,'folderPath':_0x2a954b,'sourcePath':_0x51fc8f});}else{if(!_0x5b8c76?.['skipSegments']){const _0x3caf3e=parseSegmentYamlFile(_0x1d83fa),_0xca7abd=normalizeChildSegmentYaml(_0x3caf3e);_0x19a00d[_0x3abfc2(0xc6)]({'yamlConfig':_0xca7abd,'folderPath':_0x2a954b,'sourcePath':_0x51fc8f});}}}return{'segments':_0x19a00d,'journeys':_0x5e772b};}export function validateParsedFiles(_0x32db81,_0x127435){const _0xfee751=a156_0x1fb252,_0x1c37cf=[];for(const {yamlConfig:_0x55f7da,sourcePath:_0x432c76}of _0x32db81[_0xfee751(0x9e)]){const _0x25361a=readFileSync(_0x432c76,_0xfee751(0xd2)),_0x2f6c60=a156_0x3f638c[_0xfee751(0xb9)](_0x25361a),_0x5ed071=validateSegmentDef(_0x55f7da,{'source':_0x25361a,'document':_0x2f6c60},{'skipSchema':!![]});if(!_0x5ed071[_0xfee751(0x160)]){const _0x490ae0=a156_0xf0850a[_0xfee751(0x131)](_0x127435,_0x432c76);_0x1c37cf['push']({'filePath':_0x490ae0,'source':_0x25361a,'result':_0x5ed071,'isJourney':![]});}}for(const {yamlConfig:_0x1782ae,sourcePath:_0x4de3b6}of _0x32db81[_0xfee751(0x128)]){const _0x4f5f28=readFileSync(_0x4de3b6,_0xfee751(0xd2)),_0xcf0214=a156_0x3f638c[_0xfee751(0xb9)](_0x4f5f28),_0x594ac1=validateJourneyDef(_0x1782ae,{'source':_0x4f5f28,'document':_0xcf0214},{'skipSchema':!![]});if(!_0x594ac1[_0xfee751(0x160)]){const _0x316e7e=a156_0xf0850a[_0xfee751(0x131)](_0x127435,_0x4de3b6);_0x1c37cf[_0xfee751(0xc6)]({'filePath':_0x316e7e,'source':_0x4f5f28,'result':_0x594ac1,'isJourney':!![]});}}return _0x1c37cf;}export function formatValidationErrors(_0x30f878){const _0x264c0e=a156_0x1fb252,_0x25f08e=[];for(const {filePath:_0x590490,source:_0x4710dd,result:_0x5cb656,isJourney:_0x71bf8}of _0x30f878){const _0x3ef1a8=_0x71bf8?_0x264c0e(0xb6):_0x264c0e(0xfb);_0x25f08e[_0x264c0e(0xc6)]('\x0a'+_0x590490+'\x20('+_0x3ef1a8+'):\x20'+_0x5cb656[_0x264c0e(0x9f)][_0x264c0e(0x10d)]+_0x264c0e(0xdf)),_0x25f08e['push'](formatValidationResult(_0x5cb656,_0x4710dd,_0x590490));}return _0x25f08e[_0x264c0e(0x139)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x27843a){const _0xd78a65=a156_0x1fb252,_0xb05f8e=new Set(),_0x5dffd7=new Map(),_0x30d075=collectSegmentUsageCounts(_0x27843a);if(_0x27843a[_0xd78a65(0x9e)])for(const [_0x3ab74f,_0x29c5d7]of Object[_0xd78a65(0x87)](_0x27843a['segments'])){_0xb05f8e[_0xd78a65(0xc4)](_0x3ab74f);if(_0x29c5d7['rule']){const _0x4521e5=yamlRuleToApi(_0x29c5d7[_0xd78a65(0xce)]),_0x2a16d9=apiRuleToYaml(_0x4521e5);_0x5dffd7[_0xd78a65(0xeb)](_0x3ab74f,_0x2a16d9);}}const _0x338a0=new Map();let _0x5627fc=0x0;for(const [_0x618984,_0x2eb065]of _0x5dffd7){const _0x23887b=serializeExpandedRule(_0x2eb065,_0x5dffd7),_0x4c429d=_0x338a0[_0xd78a65(0xab)](_0x23887b)||[];_0x4c429d[_0xd78a65(0xc6)]({'name':_0x618984,'index':_0x5627fc}),_0x338a0['set'](_0x23887b,_0x4c429d),_0x5627fc++;}const _0x464eb3=new Map();for(const [_0x33253d,_0x19244d]of _0x338a0){const _0x464ac3=_0x19244d['slice']()['sort']((_0x355e84,_0x3ca1e)=>{const _0x5b4035=_0xd78a65,_0x28de6f=_0x30d075['get'](_0x355e84[_0x5b4035(0xfe)])||0x0,_0x3f1baa=_0x30d075[_0x5b4035(0xab)](_0x3ca1e['name'])||0x0;if(_0x28de6f!==_0x3f1baa)return _0x3f1baa-_0x28de6f;return _0x355e84['index']-_0x3ca1e[_0x5b4035(0x172)];})[_0xd78a65(0x117)](_0x271dc3=>_0x271dc3['name']),_0x2921bb=[];for(const _0xf12267 of _0x464ac3){const _0x2dc724=_0x30d075['get'](_0xf12267)||0x0,_0x4ad83e=Math['max'](_0x2dc724,0x1);for(let _0x175000=0x0;_0x175000<_0x4ad83e;_0x175000++){_0x2921bb[_0xd78a65(0xc6)](_0xf12267);}}_0x464eb3[_0xd78a65(0xeb)](_0x33253d,_0x2921bb);}return{'existingLocalSegmentNames':_0xb05f8e,'localSegmentRules':_0x5dffd7,'localExpandedRuleToNames':_0x464eb3};}export function createSegmentIdResolver(_0x30a083,_0x3240dc){return async _0x54cba2=>{const _0x4fbaed=a156_0x419a,_0x3e3b43=_0x30a083['get'](_0x54cba2);if(!_0x3e3b43)throw new SDKError(ErrorCode[_0x4fbaed(0xd5)],_0x4fbaed(0x10e)+_0x54cba2+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x3240dc+'\x27)');return _0x3e3b43;};}export function extractRootFolderId(_0x3d6668){const _0x1417fb=a156_0x1fb252;return _0x3d6668[_0x1417fb(0x91)]?.[_0x1417fb(0x11f)]?.['data']?.['id']||_0x3d6668['relationships']?.[_0x1417fb(0xf3)]?.[_0x1417fb(0x12b)]?.['id'];}export function buildConnectionMaps(_0x9917f6){const _0x386491=a156_0x1fb252,_0x15eb36=new Map(),_0x2850da=new Map(),_0x23fb71=new Map();for(const _0x27712f of _0x9917f6){_0x15eb36[_0x386491(0xeb)](_0x27712f['name'],parseInt(_0x27712f['id'],0xa)),_0x2850da[_0x386491(0xeb)](_0x27712f['id'],_0x27712f[_0x386491(0xfe)]),_0x23fb71[_0x386491(0xeb)](_0x27712f[_0x386491(0xfe)],_0x27712f[_0x386491(0x138)]);}return{'nameToId':_0x15eb36,'idToName':_0x2850da,'nameToType':_0x23fb71};}export function calculatePushStats(_0x2b9d21,_0x3fb2b7,_0x1b5fed,_0x4c57e6,_0x436985,_0x381318,_0x2ec10f){const _0x36db1e=a156_0x1fb252,_0x37d8e7=_0x2b9d21[_0x36db1e(0x11b)](_0x53c5ce=>_0x53c5ce[_0x36db1e(0x8d)]),_0x5ca09d=_0x2b9d21['filter'](_0x3749aa=>!_0x3749aa[_0x36db1e(0x8d)]&&_0x3749aa[_0x36db1e(0x168)]),_0x32fc2c=_0x2b9d21[_0x36db1e(0x11b)](_0x42f982=>!_0x42f982[_0x36db1e(0x8d)]&&!_0x42f982[_0x36db1e(0x168)]),_0x19a26e=_0x381318?_0x4c57e6:[],_0x2f011a=_0x3fb2b7[_0x36db1e(0x11b)](_0x32174f=>_0x32174f[_0x36db1e(0x8d)]),_0x5560a2=_0x3fb2b7[_0x36db1e(0x11b)](_0x3e1314=>!_0x3e1314[_0x36db1e(0x8d)]&&_0x3e1314[_0x36db1e(0x168)]),_0x51798d=_0x3fb2b7[_0x36db1e(0x11b)](_0x14b49e=>!_0x14b49e['isNew']&&!_0x14b49e[_0x36db1e(0x168)]),_0x541b62=_0x381318?_0x436985:[],_0x13026a=_0x2b9d21[_0x36db1e(0x12f)](_0x36c618=>_0x36c618[_0x36db1e(0x173)]),_0x1e1c57=_0x13026a[_0x36db1e(0x11b)](_0x3cfd24=>_0x3cfd24[_0x36db1e(0x138)]===_0x36db1e(0x105)),_0x3e2893=_0x13026a['filter'](_0x376ad1=>_0x376ad1[_0x36db1e(0x138)]===_0x36db1e(0xec)),_0x1fe5a0=_0x13026a['filter'](_0x192a54=>_0x192a54[_0x36db1e(0x138)]===_0x36db1e(0x14e)),_0x11d3e0=Array[_0x36db1e(0x183)](_0x1b5fed)[_0x36db1e(0xd1)](),_0x3ba1cd=_0x2ec10f?![]:_0x37d8e7[_0x36db1e(0x10d)]>0x0||_0x5ca09d[_0x36db1e(0x10d)]>0x0||_0x19a26e['length']>0x0,_0x1985e4=_0x2f011a[_0x36db1e(0x10d)]>0x0||_0x5560a2[_0x36db1e(0x10d)]>0x0||_0x541b62['length']>0x0,_0x5d2597=_0x2ec10f?![]:_0x13026a[_0x36db1e(0x10d)]>0x0,_0x56ff0a=_0x11d3e0[_0x36db1e(0x10d)]>0x0;return{'segments':{'new':_0x37d8e7,'changed':_0x5ca09d,'unchanged':_0x32fc2c,'toDelete':_0x19a26e},'journeys':{'new':_0x2f011a,'changed':_0x5560a2,'unchanged':_0x51798d,'toDelete':_0x541b62},'activations':{'all':_0x13026a,'toCreate':_0x1e1c57,'toUpdate':_0x3e2893,'toDelete':_0x1fe5a0},'folders':{'toCreate':_0x11d3e0},'counts':{'segments':{'new':_0x37d8e7['length'],'changed':_0x5ca09d[_0x36db1e(0x10d)],'unchanged':_0x32fc2c['length'],'toDelete':_0x19a26e['length']},'journeys':{'new':_0x2f011a[_0x36db1e(0x10d)],'changed':_0x5560a2['length'],'unchanged':_0x51798d['length'],'toDelete':_0x541b62[_0x36db1e(0x10d)]},'activations':{'create':_0x1e1c57['length'],'update':_0x3e2893[_0x36db1e(0x10d)],'delete':_0x1fe5a0[_0x36db1e(0x10d)]},'folders':_0x11d3e0[_0x36db1e(0x10d)]},'hasChanges':_0x3ba1cd||_0x1985e4||_0x5d2597||_0x56ff0a};}export async function buildPushExecutionContext(_0x4cfd3c,_0x47c77e,_0x4bf902,_0x1f110c,_0x38ba20,_0x3df5cd){const _0x459023=a156_0x1fb252,_0x57522b=extractRootFolderId(_0x4bf902),{pathToId:_0x2862f5,idToPath:_0x569768}=buildFolderMaps(_0x38ba20),_0x5c409d=buildSegmentNameToIdMap(_0x1f110c),_0x57df77=new Map(),{batchAsync:_0x28a840}=await import(_0x459023(0x11e)),[_0x2c2315,_0x4799c3]=await Promise[_0x459023(0x153)]([_0x4cfd3c[_0x459023(0x100)]['buildUserMaps'](),_0x4cfd3c['connection'][_0x459023(0xdd)](),((async()=>{!_0x3df5cd&&_0x1f110c['length']>0x0&&await _0x28a840(_0x1f110c,async _0xf52176=>{const _0x56bd69=a156_0x419a,_0x3a1540=await _0x4cfd3c[_0x56bd69(0xfb)]['listActivations'](_0x47c77e,_0xf52176['id']);_0x57df77['set'](_0xf52176['id'],_0x3a1540);});})())]),{emailToId:_0x317aa3,idToEmail:_0x58101e}=_0x2c2315,_0x3002c5=buildConnectionMaps(_0x4799c3);return{'rootFolderId':_0x57522b,'folderPathToId':_0x2862f5,'folderIdToPath':_0x569768,'segmentNameToId':_0x5c409d,'activationsBySegmentId':_0x57df77,'emailToIdMap':_0x317aa3,'idToEmailMap':_0x58101e,'connectionNameToIdMap':_0x3002c5[_0x459023(0x157)],'connectionIdToNameMap':_0x3002c5[_0x459023(0xf7)],'connectionNameToTypeMap':_0x3002c5[_0x459023(0x90)]};}export function createPushYamlContextForBundle(_0x1afffe,_0x3b120d,_0x589d02,_0x38b569,_0x11409a,_0x3e9198,_0x41ab26,_0x2e46a6){const {existingLocalSegmentNames:_0xbbd1e1,localExpandedRuleToNames:_0xdaaee7}=_0x38b569,_0x199ec4=new Set(),_0x365ca7=new Map(),_0x520219=new Map(),_0x40728e=new Map(),_0x493ea8=createJumpTargetCache(),_0xd6c969=new Map(),_0x360fb8=new Map(),_0xc4cff7=new Set();let _0xe1750b;const _0x348430=_0x376d70=>{const _0x1f0a28={'resolveSegment':async _0x5a981d=>{const _0x5048ac=a156_0x419a,_0x112acc=_0x40728e[_0x5048ac(0xab)](_0x5a981d);if(_0x112acc!==undefined)return{'name':_0x112acc,'isJourneyLocal':!![]};try{const _0x573ebc=await fetchSegment(_0x1afffe,_0x3b120d,_0x5a981d,_0x589d02);if(!_0x573ebc)throw new Error('Segment\x20not\x20found');const _0x5d23cb=generateJourneyLocalName(_0x573ebc['name']),_0x2d1547=_0x573ebc[_0x5048ac(0xe7)]===SEGMENT_KIND_JOURNEY&&_0x5d23cb!==undefined;let _0x46e21c=_0x573ebc[_0x5048ac(0xfe)],_0x2cd8da;if(_0x2d1547&&_0x573ebc[_0x5048ac(0xce)]){const _0x3a8743=apiRuleToYaml(_0x573ebc[_0x5048ac(0xce)]);_0x360fb8['set'](_0x5a981d,_0x3a8743);const _0x495bea=async _0xee0796=>{const _0x2f6af6=_0x5048ac,_0x155729=collectSegmentRefsFromRule(_0xee0796);for(const _0x528977 of _0x155729){if(!_0x360fb8[_0x2f6af6(0xde)](_0x528977))try{const _0x5abf22=await fetchSegment(_0x1afffe,_0x3b120d,_0x528977,_0x589d02);if(_0x5abf22?.[_0x2f6af6(0xce)]){const _0x552953=apiRuleToYaml(_0x5abf22[_0x2f6af6(0xce)]);_0x360fb8[_0x2f6af6(0xeb)](_0x528977,_0x552953),await _0x495bea(_0x552953);}}catch(_0x5b2211){logger[_0x2f6af6(0x15f)](_0x2f6af6(0x163)+_0x528977+':\x20'+_0x5b2211);}}};await _0x495bea(_0x3a8743);const _0x817fcb=serializeExpandedRule(_0x3a8743,_0x360fb8),_0x1595e9=_0xdaaee7[_0x5048ac(0xab)](_0x817fcb);if(_0x1595e9&&_0x1595e9[_0x5048ac(0x10d)]>0x0){const _0x4d5680=_0x365ca7[_0x5048ac(0xab)](_0x817fcb)||0x0,_0x5925a5=_0x1595e9[_0x4d5680]||_0x1595e9[_0x1595e9['length']-0x1];_0x365ca7['set'](_0x817fcb,_0x4d5680+0x1),_0x46e21c=_0x5925a5,_0x199ec4[_0x5048ac(0xc4)](_0x46e21c),_0x40728e[_0x5048ac(0xeb)](_0x5a981d,_0x46e21c);const _0x472dde=await resolveRuleSegmentRefs(_0x3a8743,async _0x15106d=>{const _0x302761=_0x5048ac,_0x254c2c=_0x40728e[_0x302761(0xab)](_0x15106d);if(_0x254c2c)return _0x254c2c;const _0x496517=await _0xe1750b[_0x302761(0xa4)](_0x15106d);return _0x496517['name'];});_0x2cd8da={'description':_0x573ebc[_0x5048ac(0x140)],'rule':_0x472dde};}else{const _0x3e2a71=_0xd6c969['get'](_0x817fcb);if(_0x3e2a71)_0x46e21c=_0x3e2a71,_0x40728e[_0x5048ac(0xeb)](_0x5a981d,_0x46e21c);else{if(_0x5d23cb){let _0x551709=_0x5d23cb,_0x41829b=0x2;while(_0x199ec4[_0x5048ac(0xde)](_0x551709)||_0xbbd1e1[_0x5048ac(0xde)](_0x551709)){_0x551709=_0x5d23cb+'_'+_0x41829b,_0x41829b++;}_0x199ec4[_0x5048ac(0xc4)](_0x551709),_0x46e21c=_0x551709;}_0x40728e[_0x5048ac(0xeb)](_0x5a981d,_0x46e21c),_0xd6c969[_0x5048ac(0xeb)](_0x817fcb,_0x46e21c);const _0x4d4624=await resolveRuleSegmentRefs(_0x3a8743,async _0x5283a2=>{const _0x1a202a=_0x5048ac,_0xe6f2cb=_0x40728e[_0x1a202a(0xab)](_0x5283a2);if(_0xe6f2cb)return _0xe6f2cb;const _0x428ec0=await _0xe1750b[_0x1a202a(0xa4)](_0x5283a2);return _0x428ec0[_0x1a202a(0xfe)];});_0x2cd8da={'description':_0x573ebc[_0x5048ac(0x140)],'rule':_0x4d4624};}}}return{'name':_0x46e21c,'isJourneyLocal':_0x2d1547,'definition':_0x2cd8da};}catch(_0x5becc3){return logger[_0x5048ac(0x15f)](_0x5048ac(0x17e)+_0x5a981d+':\x20'+_0x5becc3),{'name':_0x5a981d,'isJourneyLocal':![]};}},'resolveActivation':async _0x4bc4d5=>{const _0x5804bf=a156_0x419a,_0x2478c2=_0x520219['get'](_0x4bc4d5);if(_0x2478c2!==undefined)return{'name':_0x2478c2,'isJourneyLocal':!![]};try{let _0x1d4e93=_0x41ab26?.[_0x5804bf(0xab)](_0x4bc4d5);!_0x1d4e93&&(_0x1d4e93=await _0x1afffe[_0x5804bf(0xb6)]['getActivation'](_0x376d70,_0x4bc4d5));const _0x1ddec1=_0x1d4e93[_0x5804bf(0x16b)][_0x5804bf(0x93)]['name']||_0x4bc4d5,_0x1226b9=sanitizeYamlKey(_0x1ddec1)||_0x5804bf(0x115)+_0x4bc4d5,_0x326334=_0x1226b9;_0x520219['set'](_0x4bc4d5,_0x326334);const _0x48fcaa=journeyActivationStepToYaml(_0x1d4e93,_0x11409a,_0x3e9198);return{'name':_0x326334,'isJourneyLocal':!![],'definition':_0x48fcaa};}catch(_0x1e96b9){return logger[_0x5804bf(0x15f)](_0x5804bf(0xf2)+_0x4bc4d5+':\x20'+_0x1e96b9),{'name':_0x4bc4d5,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3c2aea,_0x2ff01b)=>resolveJumpTarget(_0x3c2aea,_0x2ff01b,_0x493ea8,async _0x5c5ef4=>{const _0x83e5cf=a156_0x419a,_0x107d84=_0x2e46a6?.['get'](_0x5c5ef4);if(_0x107d84)return _0x107d84;return _0x1afffe[_0x83e5cf(0xb6)]['getJourney'](_0x5c5ef4);})};return _0xe1750b=_0x1f0a28,_0x1f0a28;},_0x15e6ba=async _0x4e61ac=>{const _0x47fc70=a156_0x419a,{collectSegmentIdsFromJourneyApi:_0x3bf079}=await import(_0x47fc70(0x169)),{batchAsync:_0x5bdb94}=await import('../../utils/async.js'),_0x5e8a5f=new Set();for(const _0x4342f8 of _0x4e61ac){let _0x502c8c=_0x2e46a6?.[_0x47fc70(0xab)](_0x4342f8);!_0x502c8c&&(_0x502c8c=await _0x1afffe['journey'][_0x47fc70(0xcc)](_0x4342f8));const _0x1eea4a=_0x3bf079(_0x502c8c);for(const _0xcda087 of _0x1eea4a){_0x5e8a5f[_0x47fc70(0xc4)](_0xcda087);}}let _0x4a6820=Array[_0x47fc70(0x183)](_0x5e8a5f);while(_0x4a6820['length']>0x0){const _0x8c4e15=_0x4a6820[_0x47fc70(0x11b)](_0x27d84b=>!_0xc4cff7[_0x47fc70(0xde)](_0x27d84b));if(_0x8c4e15[_0x47fc70(0x10d)]===0x0)break;const _0x51d8a1=await _0x5bdb94(_0x8c4e15,async _0x9a67e4=>{const _0x123d45=_0x47fc70;_0xc4cff7[_0x123d45(0xc4)](_0x9a67e4);const _0x3e2c83=await fetchSegment(_0x1afffe,_0x3b120d,_0x9a67e4,_0x589d02);if(!_0x3e2c83)return null;return{'segmentId':_0x9a67e4,'segment':_0x3e2c83};},0xa),_0x476e15=new Set();for(const _0x8a7c57 of _0x51d8a1){if(!_0x8a7c57?.[_0x47fc70(0xfb)]?.[_0x47fc70(0xce)])continue;const _0x429663=apiRuleToYaml(_0x8a7c57[_0x47fc70(0xfb)]['rule']);_0x360fb8['set'](_0x8a7c57[_0x47fc70(0x8a)],_0x429663);const _0x5b5d91=collectSegmentRefsFromRule(_0x429663);for(const _0x398b9a of _0x5b5d91){!_0xc4cff7[_0x47fc70(0xde)](_0x398b9a)&&_0x476e15['add'](_0x398b9a);}}_0x4a6820=Array['from'](_0x476e15);}};return{'createYamlContext':_0x348430,'prefetchJourneySegments':_0x15e6ba};}export async function executePushSegments(_0x1a836d,_0x26bf39,_0x2157db,_0x5928f5,_0x3bb9f0){const _0x2b36d2=a156_0x1fb252,{segmentDefToCreateRequest:_0x115c94,segmentDefToUpdateRequest:_0xdc36a5}=await import(_0x2b36d2(0xe8)),_0x40ea1f=_0x2157db[_0x2b36d2(0xe9)],_0x572531=0x5,_0x152d27=async _0x2b22af=>{const _0x3c06a7=_0x2b36d2,_0x51f44d=_0x2b22af['folderPath']?_0x40ea1f[_0x3c06a7(0xab)](_0x2b22af['folderPath']):undefined;let _0x439230;const _0x1b12ab={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2ad067=_0x2b22af['yamlConfig'];if(_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xce)]){const _0x5bf094=createSegmentIdResolver(_0x2157db[_0x3c06a7(0xed)],_0x2b22af[_0x3c06a7(0xb2)]['name']),_0x807d9f=await resolveRuleSegmentIds(_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xce)],_0x5bf094);_0x2ad067={..._0x2b22af[_0x3c06a7(0xb2)],'rule':_0x807d9f};}try{if(_0x2b22af[_0x3c06a7(0x8d)]){_0x3bb9f0['onProgress']?.({'type':_0x3c06a7(0x10f),'name':_0x2b22af['yamlConfig']['name']});const _0x51b200=_0x115c94(_0x2ad067,_0x51f44d),_0x524b42=await _0x3bb9f0[_0x3c06a7(0xdb)](_0x3c06a7(0x13f)+_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)]+'\x27...',()=>_0x1a836d[_0x3c06a7(0xfb)][_0x3c06a7(0x150)](_0x5928f5[_0x3c06a7(0x13c)],_0x51b200));_0x439230=_0x524b42['data']['id'],_0x2157db[_0x3c06a7(0xed)][_0x3c06a7(0xeb)](_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)],_0x439230),_0x1b12ab['createdSegmentId']={'name':_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)],'id':_0x439230},_0x3bb9f0[_0x3c06a7(0x106)]?.({'type':_0x3c06a7(0x88),'name':_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)],'segmentId':_0x439230}),_0x3bb9f0[_0x3c06a7(0x92)]?.('Created\x20segment\x20\x27'+_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)]+'\x27'),_0x1b12ab[_0x3c06a7(0xb7)]=0x1;}else{if(_0x2b22af['hasChanges']){_0x3bb9f0[_0x3c06a7(0x106)]?.({'type':_0x3c06a7(0x81),'name':_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)]});const _0x559070=_0xdc36a5(_0x2ad067);_0x51f44d!==_0x2b22af[_0x3c06a7(0xa1)]?.[_0x3c06a7(0xba)]&&(_0x559070[_0x3c06a7(0xba)]=_0x51f44d?parseInt(_0x51f44d,0xa):undefined),await _0x3bb9f0['withProgress'](_0x3c06a7(0x121)+_0x2b22af[_0x3c06a7(0xb2)]['name']+'\x27...',()=>_0x1a836d['segment'][_0x3c06a7(0x176)](_0x5928f5[_0x3c06a7(0x13c)],_0x2b22af['existingSegment']['id'],_0x559070)),_0x439230=_0x2b22af['existingSegment']['id'],_0x3bb9f0[_0x3c06a7(0x106)]?.({'type':_0x3c06a7(0xf5),'name':_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)]}),_0x3bb9f0[_0x3c06a7(0x92)]?.(_0x3c06a7(0x12e)+_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)]+'\x27'),_0x1b12ab[_0x3c06a7(0xcf)]=0x1;}else _0x439230=_0x2b22af[_0x3c06a7(0xa1)]['id'];}}catch(_0x509fef){const _0x539539=isHttp400Error(_0x509fef),_0x5a92ff=_0x539539?ErrorCode[_0x3c06a7(0x16f)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x5c85dd=getErrorMessage(_0x509fef);throw new SDKError(_0x5a92ff,_0x3c06a7(0x12a)+(_0x2b22af[_0x3c06a7(0x8d)]?'create':_0x3c06a7(0xec))+_0x3c06a7(0xca)+_0x2b22af[_0x3c06a7(0x8e)]+_0x3c06a7(0x158)+_0x5c85dd,_0x509fef);}try{const _0x40b9b1=await syncActivationsForSegment(_0x1a836d,_0x5928f5[_0x3c06a7(0x13c)],_0x439230,_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)],_0x2b22af[_0x3c06a7(0x173)],_0x3bb9f0,_0x2b22af['absolutePath']);_0x1b12ab[_0x3c06a7(0x14c)]=_0x40b9b1;}catch(_0x6ad30d){if(_0x6ad30d instanceof SDKError)throw _0x6ad30d;throw new SDKError(ErrorCode[_0x3c06a7(0x12c)],_0x3c06a7(0x165)+_0x2b22af[_0x3c06a7(0xb2)][_0x3c06a7(0xfe)]+_0x3c06a7(0xae)+_0x2b22af[_0x3c06a7(0x8e)]+'\x0a\x20\x20'+getErrorMessage(_0x6ad30d),_0x6ad30d);}return _0x1b12ab;},_0x3c0e98=await batchAsync(_0x26bf39,_0x152d27,_0x572531),_0x3fa261={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4a0389 of _0x3c0e98){_0x3fa261['created']+=_0x4a0389[_0x2b36d2(0xb7)],_0x3fa261['updated']+=_0x4a0389[_0x2b36d2(0xcf)],_0x4a0389[_0x2b36d2(0xf6)]&&_0x3fa261['createdSegmentIds'][_0x2b36d2(0xeb)](_0x4a0389[_0x2b36d2(0xf6)][_0x2b36d2(0xfe)],_0x4a0389[_0x2b36d2(0xf6)]['id']),_0x3fa261['activations'][_0x2b36d2(0xb7)]+=_0x4a0389[_0x2b36d2(0x14c)][_0x2b36d2(0xb7)],_0x3fa261['activations'][_0x2b36d2(0xcf)]+=_0x4a0389[_0x2b36d2(0x14c)]['updated'],_0x3fa261[_0x2b36d2(0x14c)][_0x2b36d2(0x15d)]+=_0x4a0389[_0x2b36d2(0x14c)]['deleted'];}return _0x3fa261;}async function syncActivationsForSegment(_0x3896c8,_0x24f99d,_0x32e30e,_0xeba62f,_0x31adda,_0x3ec01d,_0x4edc83){const _0xa70345=a156_0x1fb252,_0x13335a={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x57d305 of _0x31adda){try{if(_0x57d305['type']==='create'&&_0x57d305[_0xa70345(0x10c)])_0x3ec01d[_0xa70345(0x106)]?.({'type':_0xa70345(0x118),'segmentName':_0xeba62f,'activationName':_0x57d305[_0xa70345(0xfe)]}),await _0x3ec01d[_0xa70345(0xdb)]('Creating\x20activation\x20\x27'+_0x57d305[_0xa70345(0xfe)]+_0xa70345(0xfa),()=>_0x3896c8[_0xa70345(0xfb)]['createActivation'](_0x24f99d,_0x32e30e,_0x57d305['validatedRequest'])),_0x3ec01d[_0xa70345(0x106)]?.({'type':_0xa70345(0xe2),'segmentName':_0xeba62f,'activationName':_0x57d305[_0xa70345(0xfe)]}),_0x3ec01d[_0xa70345(0x92)]?.(_0xa70345(0x120)+_0x57d305[_0xa70345(0xfe)]+'\x27'),_0x13335a[_0xa70345(0xb7)]++;else{if(_0x57d305[_0xa70345(0x138)]===_0xa70345(0xec)&&_0x57d305[_0xa70345(0x10c)]&&_0x57d305['existingActivation'])_0x3ec01d[_0xa70345(0x106)]?.({'type':_0xa70345(0x149),'segmentName':_0xeba62f,'activationName':_0x57d305['name']}),await _0x3ec01d[_0xa70345(0xdb)](_0xa70345(0x82)+_0x57d305['name']+'\x27...',()=>_0x3896c8['segment']['updateActivation'](_0x24f99d,_0x32e30e,_0x57d305[_0xa70345(0xad)]['id'],_0x57d305[_0xa70345(0x10c)])),_0x3ec01d[_0xa70345(0x106)]?.({'type':'activation_updated','segmentName':_0xeba62f,'activationName':_0x57d305[_0xa70345(0xfe)]}),_0x3ec01d['logSuccess']?.(_0xa70345(0x182)+_0x57d305[_0xa70345(0xfe)]+'\x27'),_0x13335a[_0xa70345(0xcf)]++;else _0x57d305[_0xa70345(0x138)]===_0xa70345(0x14e)&&_0x57d305[_0xa70345(0xad)]&&(_0x3ec01d[_0xa70345(0x106)]?.({'type':_0xa70345(0xfc),'segmentName':_0xeba62f,'activationName':_0x57d305[_0xa70345(0xfe)]}),await _0x3ec01d['withProgress']('Deleting\x20activation\x20\x27'+_0x57d305[_0xa70345(0xfe)]+_0xa70345(0xfa),()=>_0x3896c8[_0xa70345(0xfb)][_0xa70345(0x144)](_0x24f99d,_0x32e30e,_0x57d305[_0xa70345(0xad)]['id'])),_0x3ec01d['onProgress']?.({'type':_0xa70345(0x8f),'segmentName':_0xeba62f,'activationName':_0x57d305[_0xa70345(0xfe)]}),_0x3ec01d['logDeleted']?.('Deleted\x20activation\x20\x27'+_0x57d305[_0xa70345(0xfe)]+'\x27'),_0x13335a[_0xa70345(0x15d)]++);}}catch(_0x2d8eb0){const _0x4263dc=isHttp400Error(_0x2d8eb0),_0x582cb0=_0x4263dc?ErrorCode[_0xa70345(0xf4)]:ErrorCode[_0xa70345(0x12c)],_0x8c1713=getErrorMessage(_0x2d8eb0);throw new SDKError(_0x582cb0,'Failed\x20to\x20'+_0x57d305[_0xa70345(0x138)]+_0xa70345(0x13e)+_0x57d305[_0xa70345(0xfe)]+_0xa70345(0xae)+_0x4edc83+_0xa70345(0x158)+_0x8c1713,_0x2d8eb0);}}return _0x13335a;}function a156_0x56c5(){const _0x1bbd91=['max','embeddedSegmentNameToId','validatedRequest','length','Segment\x20not\x20found:\x20','segment_creating','toString','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','run_after_journey_refresh','Condition',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','activation_','segment_deleted','map','activation_creating','journeyStages','verbose','filter','embedded_activation_creating','match','../../utils/async.js','parentSegmentFolder','Created\x20activation\x20\x27','Updating\x20segment\x20\x27','stage\x20\x27','journey_entry_criteria_','stringify','keys','stages','resolveJourneyId','journeys','parse','Failed\x20to\x20','data','ACTIVATION_UPDATE_ERROR','1867808NttpSH','Updated\x20segment\x20\x27','flatMap','327994TVYfkw','relative','unchanged','Updated\x20journey\x20\x27','journeyActivationNameToId','goal','deleteSegment','dirname','type','join','tdx.sdk.push-workflow','Entry\x20criteria:\x20','parentId','day','\x20activation\x20\x27','Creating\x20segment\x20\x27','description','journeyName','4390752xMfqCs','journeyById','deleteActivation','waitStepType','folderId','split','\x27\x20exit\x20criteria','activation_updating','values','slice','activations','and\x20the\x20server\x20segment,\x20then\x20retry.','delete','state','createSegment','hex','1992438tMIAPd','all','Created\x20journey\x20\x27','JOURNEY_SYNTAX_ERROR','action','nameToId','\x0a\x20\x20','Creating\x20folder\x20\x27','95044cacdJI','INTERNAL','uniqueSegmentName','deleted','.$1.push-recovery.json','debug','valid','uniqueServerName','find','Failed\x20to\x20fetch\x20referenced\x20segment\x20','\x27\x20decision\x20point\x20branch\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Delete\x20the\x20push\x20recovery\x20file\x20(','JOURNEY_UPDATE_ERROR','hasChanges','./journey-yaml.js','journey_created','attributes','\x27\x20entry\x20criteria','connection','journey_creating','SEGMENT_SYNTAX_ERROR','35307STWkgq','\x20(referenced\x20in\x20journey\x20','index','activationActions','Activation','\x27\x20milestone','updateSegmentById','Fetching\x20','isArray','includes','toISOString','DecisionPoint','listActivations','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20resolve\x20segment\x20','185FtAAzf','\x27\x20by\x20rule\x20content','reduce','Updated\x20activation\x20\x27','from','NOT_FOUND','segment_updating','Updating\x20activation\x20\x27','versionNumber','__pending_act_','segmentByFolderAndName','__pending_','entries','segment_created','exitCriterias','segmentId','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','3MqrBOe','isNew','absolutePath','activation_deleted','nameToType','relationships','logSuccess','activationParams','deps','localName','steps','conditionTimeoutDuration','876512gXOiwZ','folder_creating','branches','logInfo','entryCriteria','draft','segments','errors','goal\x20criteria','existingSegment','segment_deleting','journeyId','resolveSegment','progress','connectionIdToNameMap','milestone','journeyBundleName','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','WaitStep','get','resolvedRule','existingActivation','\x27\x20from\x20file:\x20','some','activationContext','all_columns','yamlConfig','journey_updating','conditionTimeoutUnit','size','journey','created','columns','parseDocument','segmentFolderId','getSegmentEntity\x20also\x20failed\x20for\x20',').\x20','journey_updated','toLowerCase','\x27\x20not\x20found\x20in\x20journey\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','idToEmailMap','existingSegments','existingJourney','add','getSegment\x20failed\x20for\x20','push','diff','embedded_activation_created','startsWith','\x20segment\x20from\x20file:\x20','4090VzJEXi','getJourney','activationsBySegmentId','rule','updated','logWarning','sort','utf-8','with','journeyBundlesByFolderAndName','SEGMENT_NOT_FOUND','conditions','schedule','embedded_segment_creating','Created\x20folder\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','withProgress','journeyActivationStepId','list','has','\x20error(s)','Duration','embedded_segment_created','activation_created','effectiveFolderId','activation_template_id','createActivation','waitStep','kind','./child-segment-yaml.js','folderPathToId','replace','set','update','segmentNameToId','\x20journey\x20from\x20file:\x20','logDeleted','folderPath','folder_created','Failed\x20to\x20resolve\x20activation\x20','parentFolder','ACTIVATION_SYNTAX_ERROR','segment_updated','createdSegmentId','idToName','conditionSegmentId','waitStepUnit','\x27...','segment','activation_deleting','connector_config','name','Name\x20has\x20already\x20been\x20taken','user','notification','activationStepsById','behavior','createFolder','create','onProgress','yamlActivation','rootFolderId','item'];a156_0x56c5=function(){return _0x1bbd91;};return a156_0x56c5();}export async function executePushFolders(_0x3fab77,_0x12e864,_0x2cd588,_0x12ff7a,_0x10d5f7){const _0x1ba30c=a156_0x1fb252,_0x3367ed=new Map(_0x2cd588),_0x989caa=sortFoldersByDepth(_0x12e864);for(const _0x48f495 of _0x989caa){const _0x38fa4d=_0x48f495[_0x1ba30c(0x147)]('/'),_0x4990b4=_0x38fa4d[_0x38fa4d['length']-0x1],_0x1223d0=_0x38fa4d[_0x1ba30c(0x14b)](0x0,-0x1)[_0x1ba30c(0x139)]('/'),_0x5a3e74=_0x3367ed['get'](_0x1223d0);_0x10d5f7[_0x1ba30c(0x106)]?.({'type':_0x1ba30c(0x99),'folder':_0x48f495});const _0x44e74f={'name':_0x4990b4,'parentFolderId':_0x5a3e74},_0x36daf1=await _0x10d5f7['withProgress'](_0x1ba30c(0x159)+_0x48f495+'\x27...',()=>_0x3fab77[_0x1ba30c(0xfb)][_0x1ba30c(0x104)](_0x12ff7a[_0x1ba30c(0x13c)],_0x44e74f));_0x3367ed[_0x1ba30c(0xeb)](_0x48f495,_0x36daf1[_0x1ba30c(0x12b)]['id']),_0x10d5f7[_0x1ba30c(0x106)]?.({'type':_0x1ba30c(0xf1),'folder':_0x48f495,'folderId':_0x36daf1[_0x1ba30c(0x12b)]['id']}),_0x10d5f7[_0x1ba30c(0x9b)]?.(_0x1ba30c(0xd9)+_0x48f495+'\x27');}return _0x3367ed;}export async function executePushSegmentDeletions(_0xc8e078,_0x2e0d3d,_0x1d582f){const _0xd0ce2a=a156_0x1fb252;if(_0x2e0d3d[_0xd0ce2a(0x10d)]===0x0)return 0x0;const {batchAsync:_0x465bf3}=await import('../../utils/async.js'),_0x553c8b=0x5,_0x51bd24=await _0x465bf3(_0x2e0d3d,async _0x140274=>{const _0x15c95a=_0xd0ce2a;return _0x1d582f['onProgress']?.({'type':_0x15c95a(0xa2),'name':_0x140274[_0x15c95a(0xfe)]}),await _0xc8e078[_0x15c95a(0xfb)][_0x15c95a(0x136)](_0x140274['id']),_0x1d582f['onProgress']?.({'type':_0x15c95a(0x116),'name':_0x140274[_0x15c95a(0xfe)]}),_0x1d582f[_0x15c95a(0xef)]?.('Deleted\x20segment\x20\x27'+_0x140274[_0x15c95a(0xfe)]+'\x27'),0x1;},_0x553c8b);return _0x51bd24[_0xd0ce2a(0x181)]((_0x5c0a74,_0x2bc70f)=>_0x5c0a74+_0x2bc70f,0x0);}export async function executePushJourneys(_0x4949fe,_0x1bd311,_0x5633dd,_0x7243b8,_0x5ee56e){const _0x4d5228=a156_0x1fb252,{journeyDefToRequest:_0x5edfe9}=await import(_0x4d5228(0x169)),{activationDefToCreateRequest:_0x115034,yamlRuleToApi:_0x3ff02e,validateSegmentRule:_0x58be01}=await import(_0x4d5228(0xe8)),_0x11df31={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x172f93=new Map(_0x5633dd[_0x4d5228(0xed)]),_0x50034b=0x5;for(let _0xcb734b=0x0;_0xcb734b<_0x1bd311['length'];_0xcb734b+=_0x50034b){const _0x40ac1f=_0x1bd311[_0x4d5228(0x14b)](_0xcb734b,_0xcb734b+_0x50034b),_0x5770a4=await Promise[_0x4d5228(0x153)](_0x40ac1f[_0x4d5228(0x117)](async _0x5a18ad=>{const _0x263ecc=_0x4d5228;if(!_0x5a18ad[_0x263ecc(0x8d)]&&!_0x5a18ad[_0x263ecc(0x168)])return{'action':_0x263ecc(0x132),'name':_0x5a18ad['yamlConfig'][_0x263ecc(0xfe)],'journeyId':_0x5a18ad['existingJourney']?.['id']};const _0x40afe8=_0x5a18ad[_0x263ecc(0xf0)]?_0x5633dd['folderPathToId'][_0x263ecc(0xab)](_0x5a18ad[_0x263ecc(0xf0)]):undefined;_0x5ee56e[_0x263ecc(0x106)]?.({'type':_0x5a18ad[_0x263ecc(0x8d)]?_0x263ecc(0x16e):_0x263ecc(0xb3),'name':_0x5a18ad[_0x263ecc(0xb2)][_0x263ecc(0xfe)]});try{const _0x4e1ec5=await executeSingleJourneyPush(_0x4949fe,_0x5a18ad,{..._0x5633dd,'segmentNameToId':_0x172f93},{'parentId':_0x7243b8[_0x263ecc(0x13c)],'rootFolderId':_0x7243b8[_0x263ecc(0x108)],'folderId':_0x40afe8,'verbose':_0x7243b8[_0x263ecc(0x11a)]},_0x5ee56e,{'journeyDefToRequest':_0x5edfe9,'activationDefToCreateRequest':_0x115034,'yamlRuleToApi':_0x3ff02e,'validateSegmentRule':_0x58be01});for(const [_0x35ea6a,_0x1423a9]of _0x4e1ec5[_0x263ecc(0x10b)]){_0x172f93[_0x263ecc(0xeb)](_0x35ea6a,_0x1423a9),_0x11df31[_0x263ecc(0x10b)][_0x263ecc(0xeb)](_0x35ea6a,_0x1423a9);}if(_0x4e1ec5[_0x263ecc(0x156)]===_0x263ecc(0xb7))_0x5ee56e[_0x263ecc(0x106)]?.({'type':_0x263ecc(0x16a),'name':_0x5a18ad['yamlConfig'][_0x263ecc(0xfe)],'journeyId':_0x4e1ec5['journeyId']}),_0x5ee56e[_0x263ecc(0x92)]?.(_0x263ecc(0x154)+_0x5a18ad['yamlConfig'][_0x263ecc(0xfe)]+'\x27'),_0x11df31['created']++;else _0x4e1ec5['action']===_0x263ecc(0xcf)&&(_0x5ee56e['onProgress']?.({'type':_0x263ecc(0xbd),'name':_0x5a18ad[_0x263ecc(0xb2)][_0x263ecc(0xfe)]}),_0x5ee56e[_0x263ecc(0x92)]?.(_0x263ecc(0x133)+_0x5a18ad['yamlConfig']['name']+'\x27'),_0x11df31['updated']++);return{'action':_0x4e1ec5[_0x263ecc(0x156)],'name':_0x5a18ad[_0x263ecc(0xb2)][_0x263ecc(0xfe)],'journeyId':_0x4e1ec5[_0x263ecc(0xa3)]};}catch(_0x347ef2){const _0x31014a=isHttp400Error(_0x347ef2),_0x230a84=_0x31014a?ErrorCode[_0x263ecc(0x155)]:ErrorCode[_0x263ecc(0x167)],_0x41c1b6=getErrorMessage(_0x347ef2);throw new SDKError(_0x230a84,'Failed\x20to\x20'+(_0x5a18ad['isNew']?_0x263ecc(0x105):_0x263ecc(0xec))+_0x263ecc(0xee)+_0x5a18ad[_0x263ecc(0x8e)]+_0x263ecc(0x158)+_0x41c1b6,_0x347ef2);}}));_0x11df31['results'][_0x4d5228(0xc6)](..._0x5770a4);}return _0x11df31;}async function matchExistingJourneySegments(_0x599926,_0x1ab44c,_0x277ad9,_0x350df4,_0x98a7b7){const _0x3ce303=a156_0x1fb252;if(!_0x1ab44c[_0x3ce303(0xc3)]||!_0x1ab44c[_0x3ce303(0xb2)][_0x3ce303(0x9e)])return;const _0xd3ea46=new Map(),_0x82688e=new Set();for(const _0x1ca862 of Object['keys'](_0x1ab44c['yamlConfig'][_0x3ce303(0x9e)])){const _0xdf9056=generateDeterministicJourneySegmentName(_0x1ab44c[_0x3ce303(0xb2)][_0x3ce303(0xfe)],_0x1ca862);_0xd3ea46[_0x3ce303(0xeb)](_0xdf9056,_0x1ca862),_0x82688e[_0x3ce303(0xc4)](_0x1ca862);}const _0x5615c0=[],_0x461a72=collectSegmentIdsFromJourneyApi(_0x1ab44c[_0x3ce303(0xc3)]);for(const _0x3ac6fd of _0x461a72){const _0x4b2cd9=await fetchSegment(_0x599926,_0x277ad9,_0x3ac6fd,_0x350df4);if(!_0x4b2cd9?.[_0x3ce303(0xfe)])continue;const _0x41cb90=_0xd3ea46['get'](_0x4b2cd9[_0x3ce303(0xfe)]);_0x41cb90?(_0x98a7b7[_0x3ce303(0xeb)](_0x41cb90,_0x3ac6fd),_0x82688e[_0x3ce303(0x14e)](_0x41cb90)):_0x5615c0[_0x3ce303(0xc6)]({'id':_0x3ac6fd,'seg':_0x4b2cd9});}if(_0x82688e[_0x3ce303(0xb5)]>0x0&&_0x5615c0['length']>0x0){const {localExpandedRuleToNames:_0x53f20c}=buildLocalExpandedRuleMappings(_0x1ab44c[_0x3ce303(0xb2)]),_0x42dcae=new Map();for(const {id:_0x410c4f,seg:_0x545be1}of _0x5615c0){if(_0x545be1[_0x3ce303(0xce)]){const _0x4baaf1=apiRuleToYaml(_0x545be1[_0x3ce303(0xce)]);_0x42dcae[_0x3ce303(0xeb)](_0x410c4f,_0x4baaf1);}}for(const {id:_0x57d30e,seg:_0x1adcfd}of _0x5615c0){if(!_0x1adcfd[_0x3ce303(0xce)])continue;const _0x50eb45=_0x42dcae[_0x3ce303(0xab)](_0x57d30e);if(!_0x50eb45)continue;const _0x4a2e82=serializeExpandedRule(_0x50eb45,_0x42dcae),_0x18082b=_0x53f20c[_0x3ce303(0xab)](_0x4a2e82);if(_0x18082b){const _0x51f743=_0x18082b['find'](_0x43db8a=>_0x82688e[_0x3ce303(0xde)](_0x43db8a));_0x51f743&&(_0x98a7b7[_0x3ce303(0xeb)](_0x51f743,_0x57d30e),_0x82688e[_0x3ce303(0x14e)](_0x51f743),logger[_0x3ce303(0x15f)](_0x3ce303(0x17d)+_0x1adcfd['name']+'\x27\x20to\x20local\x20\x27'+_0x51f743+_0x3ce303(0x180)));}}}}async function executeSingleJourneyPush(_0x3fda35,_0x252493,_0x522338,_0x5ce889,_0x595c3a,_0xd3b949){const _0x7965ac=a156_0x1fb252,{journeyDefToRequest:_0x30171d,activationDefToCreateRequest:_0x3dc1ea,yamlRuleToApi:_0x228a6f,validateSegmentRule:_0x49d5d9}=_0xd3b949,_0x475418=new Map(),_0x453907=new Map();recoverSegmentIdsFromPushRecovery(_0x252493,_0x475418,_0x522338[_0x7965ac(0xed)]);const _0x573656=new Map(),_0x4c1ffe=new Map(),_0x1551e7=new Map();let _0x100664;const _0x288f7c=async()=>{const _0x41aefa=_0x7965ac;if(_0x100664)return;_0x100664=new Map();if(!_0x252493[_0x41aefa(0xc3)])return;const _0x43d301=await _0x3fda35[_0x41aefa(0xb6)][_0x41aefa(0x17c)](_0x252493['existingJourney']['id']);for(const _0x5a991c of _0x43d301){const _0x3d0737=journeyActivationStepToYaml(_0x5a991c,_0x522338[_0x41aefa(0xc1)],_0x522338[_0x41aefa(0xa6)]),_0x25ec82=activationSignature(_0x3d0737);!_0x100664['has'](_0x25ec82)&&_0x100664[_0x41aefa(0xeb)](_0x25ec82,_0x5a991c['id']),_0x3d0737[_0x41aefa(0xfe)]&&_0x453907[_0x41aefa(0xeb)](_0x3d0737[_0x41aefa(0xfe)],_0x5a991c['id']);}};await matchExistingJourneySegments(_0x3fda35,_0x252493,_0x5ce889[_0x7965ac(0x13c)],_0x522338[_0x7965ac(0xc2)],_0x522338[_0x7965ac(0xed)]);const _0x29a1d0={'resolveSegmentId':async _0x4abbf6=>{const _0x5a09a4=_0x7965ac,_0x4121d4=_0x522338[_0x5a09a4(0xed)][_0x5a09a4(0xab)](_0x4abbf6);if(!_0x4121d4)throw new SDKError(ErrorCode[_0x5a09a4(0xd5)],_0x5a09a4(0x10e)+_0x4abbf6+_0x5a09a4(0x171)+_0x252493[_0x5a09a4(0xb2)][_0x5a09a4(0xfe)]+')');return _0x4121d4;},'resolveEmbeddedSegmentId':async(_0xd31770,_0x48dcc8)=>{const _0x4a463e=_0x7965ac,_0x508de0=_0x522338[_0x4a463e(0xed)][_0x4a463e(0xab)](_0xd31770);if(_0x508de0)return _0x508de0;const _0x4b65eb=_0x522338[_0x4a463e(0xc2)]['find'](_0x3d3f70=>_0x3d3f70[_0x4a463e(0xfe)]===_0xd31770);if(_0x4b65eb)return _0x522338[_0x4a463e(0xed)][_0x4a463e(0xeb)](_0xd31770,_0x4b65eb['id']),_0x4b65eb['id'];if(_0x252493[_0x4a463e(0x8d)]){const {stageName:_0x5dfe88,criteriaName:_0x5f168a}=findSegmentCriteriaLocation(_0x252493[_0x4a463e(0xb2)],_0xd31770);return _0x49d5d9(_0xd31770,_0x48dcc8[_0x4a463e(0xce)]),_0x4c1ffe['set'](_0xd31770,{'definition':_0x48dcc8,'stageName':_0x5dfe88,'criteriaName':_0x5f168a}),createPendingSegmentId(_0xd31770);}const _0x25e49c=_0x252493['existingJourney']?.['id'];if(!_0x25e49c)throw new SDKError(ErrorCode[_0x4a463e(0x15b)],_0x4a463e(0xda));const _0x2f5fc1=_0x573656[_0x4a463e(0xab)](_0xd31770);if(_0x2f5fc1)return _0x2f5fc1;const _0x5ebd8d=((async()=>{const _0x80b0c5=_0x4a463e;_0x49d5d9(_0xd31770,_0x48dcc8[_0x80b0c5(0xce)]);const _0x5924dc=generateDeterministicJourneySegmentName(_0x252493[_0x80b0c5(0xb2)][_0x80b0c5(0xfe)],_0xd31770),_0x5aec65=_0x522338['existingSegments'][_0x80b0c5(0x162)](_0x44a8a4=>_0x44a8a4[_0x80b0c5(0xfe)]===_0x5924dc),_0x4c901b=createSegmentIdResolver(_0x522338[_0x80b0c5(0xed)],_0xd31770),_0x87f15c=await resolveRuleSegmentIds(_0x48dcc8[_0x80b0c5(0xce)],_0x4c901b);let _0x2b610c;return _0x5aec65?(await _0x3fda35['segment'][_0x80b0c5(0x176)](_0x5ce889[_0x80b0c5(0x13c)],_0x5aec65['id'],{'description':_0x48dcc8['description']||_0x80b0c5(0x13b)+_0xd31770,'rule':_0x228a6f(_0x87f15c),'countPopulation':!![]}),_0x2b610c=_0x5aec65['id'],saveSegmentToPushRecovery(_0x252493[_0x80b0c5(0x8e)],_0x252493[_0x80b0c5(0xb2)][_0x80b0c5(0xfe)],_0xd31770,{'segmentId':_0x2b610c,'uniqueServerName':_0x5924dc,'createdAt':new Date()[_0x80b0c5(0x17a)]()})):_0x2b610c=await createOrRecoverEmbeddedSegment(_0x3fda35,_0x252493,{'localName':_0xd31770,'uniqueSegmentName':_0x5924dc,'description':_0x48dcc8[_0x80b0c5(0x140)]||_0x80b0c5(0x13b)+_0xd31770,'journeyId':_0x25e49c,'resolvedRule':_0x87f15c,'parentId':_0x5ce889[_0x80b0c5(0x13c)],'folderId':_0x5ce889[_0x80b0c5(0x108)]||''},_0x228a6f),_0x522338[_0x80b0c5(0xed)][_0x80b0c5(0xeb)](_0xd31770,_0x2b610c),_0x475418[_0x80b0c5(0xeb)](_0xd31770,_0x2b610c),_0x2b610c;})());_0x573656[_0x4a463e(0xeb)](_0xd31770,_0x5ebd8d);try{return await _0x5ebd8d;}finally{_0x573656[_0x4a463e(0x14e)](_0xd31770);}},'resolveActivationId':async _0x4a2835=>{const _0x5625e6=_0x7965ac,_0x300564=_0x453907[_0x5625e6(0xab)](_0x4a2835);if(_0x300564)return _0x300564;if(_0x252493[_0x5625e6(0xc3)]){await _0x288f7c();const _0x505131=_0x453907[_0x5625e6(0xab)](_0x4a2835);if(_0x505131)return _0x505131;}throw new SDKError(ErrorCode[_0x5625e6(0x80)],'Activation\x20not\x20found:\x20'+_0x4a2835+'\x20(referenced\x20in\x20journey\x20'+_0x252493['yamlConfig'][_0x5625e6(0xfe)]+_0x5625e6(0xbc)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x24d49f,_0x4765f9)=>{const _0x30b1fb=_0x7965ac,_0x4be6b3=_0x453907[_0x30b1fb(0xab)](_0x24d49f);if(_0x4be6b3)return _0x4be6b3;if(_0x252493[_0x30b1fb(0x8d)])return _0x1551e7[_0x30b1fb(0xeb)](_0x24d49f,_0x4765f9),createPendingActivationId(_0x24d49f);if(_0x252493[_0x30b1fb(0xc3)]){await _0x288f7c();const _0x423d19=_0x453907[_0x30b1fb(0xab)](_0x4765f9[_0x30b1fb(0xfe)]);if(_0x423d19)return _0x453907[_0x30b1fb(0xeb)](_0x24d49f,_0x423d19),_0x423d19;const _0x20e146=activationSignature(_0x4765f9),_0x14e579=_0x100664?.[_0x30b1fb(0xab)](_0x20e146);if(_0x14e579)return _0x453907['set'](_0x24d49f,_0x14e579),_0x14e579;const _0x5ea7d9=await _0x3dc1ea(_0x4765f9,_0x522338[_0x30b1fb(0xb0)]),_0x477619={..._0x5ea7d9,..._0x4765f9[_0x30b1fb(0x112)]!==undefined&&{'runAfterJourneyRefresh':_0x4765f9['run_after_journey_refresh']}},_0xf7ebf9=await _0x3fda35[_0x30b1fb(0xb6)][_0x30b1fb(0xe5)](_0x252493[_0x30b1fb(0xc3)]['id'],_0x477619);return _0x453907[_0x30b1fb(0xeb)](_0x24d49f,_0xf7ebf9['id']),_0xf7ebf9['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x30b1fb(0xa9));},'resolveJourneyId':async _0x418221=>{const _0x4c74de=_0x7965ac;try{return await _0x3fda35[_0x4c74de(0xb6)][_0x4c74de(0x127)](_0x5ce889[_0x4c74de(0x13c)],_0x418221);}catch(_0x2da4d0){throw new SDKError(ErrorCode[_0x4c74de(0x80)],'Journey\x20\x27'+_0x418221+_0x4c74de(0x111)+_0x252493[_0x4c74de(0xb2)][_0x4c74de(0xfe)]+'\x27)',_0x2da4d0);}},'resolveStageId':async(_0x2236fe,_0x5cc657)=>{const _0x1161c1=_0x7965ac,_0x322d83=await _0x3fda35['journey'][_0x1161c1(0xcc)](_0x2236fe),_0x2e1cea=_0x322d83[_0x1161c1(0x16b)]['journeyStages']['find'](_0x39094b=>_0x39094b[_0x1161c1(0xfe)][_0x1161c1(0xbe)]()===_0x5cc657[_0x1161c1(0xbe)]());if(!_0x2e1cea?.['id'])throw new SDKError(ErrorCode[_0x1161c1(0x80)],'Stage\x20\x27'+_0x5cc657+_0x1161c1(0xbf)+(_0x322d83[_0x1161c1(0x16b)][_0x1161c1(0xa8)]||_0x322d83[_0x1161c1(0x16b)][_0x1161c1(0xfe)])+'\x27');return _0x2e1cea['id'];}},_0xb05e7=await _0x30171d(_0x252493[_0x7965ac(0xb2)],_0x5ce889[_0x7965ac(0x13c)],_0x29a1d0),_0xf295dd=_0x5ce889[_0x7965ac(0x146)]||_0x5ce889['rootFolderId'];_0xf295dd&&(_0xb05e7[_0x7965ac(0x91)]={'parentFolder':{'data':{'id':_0xf295dd,'type':'folder'}}});if(_0x252493['isNew']){if(_0x4c1ffe['size']>0x0||_0x1551e7[_0x7965ac(0xb5)]>0x0)return await executeThreeStepJourneyCreate(_0x3fda35,_0x252493,_0xb05e7,{'pendingEmbeddedSegments':_0x4c1ffe,'pendingEmbeddedActivations':_0x1551e7,'embeddedSegmentNameToId':_0x475418,'journeyActivationNameToId':_0x453907},{..._0x5ce889,'effectiveFolderId':_0xf295dd},_0x522338,_0x595c3a,_0xd3b949);else{ensureJourneyDefaults(_0xb05e7[_0x7965ac(0x16b)]);const _0x4b62b6=await _0x3fda35[_0x7965ac(0xb6)][_0x7965ac(0x105)](_0xb05e7);return deletePushRecovery(_0x252493[_0x7965ac(0x8e)]),{'action':_0x7965ac(0xb7),'journeyId':_0x4b62b6['id'],'embeddedSegmentNameToId':_0x475418};}}else{if(_0x252493[_0x7965ac(0x168)]&&_0x252493['existingJourney']){_0xb05e7['id']=_0x252493[_0x7965ac(0xc3)]['id'];const _0x50bbf1=_0xb05e7[_0x7965ac(0x16b)];_0x252493['existingJourney'][_0x7965ac(0x16b)]?.[_0x7965ac(0xa8)]&&(_0x50bbf1[_0x7965ac(0xa8)]=_0x252493[_0x7965ac(0xc3)][_0x7965ac(0x16b)]['journeyBundleName']);const _0x1e65db=_0x252493[_0x7965ac(0xc3)][_0x7965ac(0x16b)]?.[_0x7965ac(0x119)];return _0x1e65db&&_0xb05e7[_0x7965ac(0x16b)][_0x7965ac(0x119)]&&injectExistingStageIds(_0xb05e7[_0x7965ac(0x16b)]['journeyStages'],_0x1e65db),ensureJourneyDefaults(_0x50bbf1),await _0x3fda35[_0x7965ac(0xb6)]['update'](_0x252493['existingJourney']['id'],_0xb05e7),deletePushRecovery(_0x252493[_0x7965ac(0x8e)]),{'action':_0x7965ac(0xcf),'journeyId':_0x252493[_0x7965ac(0xc3)]['id'],'embeddedSegmentNameToId':_0x475418};}}return deletePushRecovery(_0x252493[_0x7965ac(0x8e)]),{'action':'unchanged','journeyId':_0x252493['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x475418};}function findSegmentCriteriaLocation(_0x353745,_0x203d7f){const _0x52bd73=a156_0x1fb252,_0x1af9c3=_0x353745[_0x52bd73(0x126)]||_0x353745[_0x52bd73(0x128)]?.[0x0]?.[_0x52bd73(0x126)]||[];let _0x15a8cf='entry',_0x1a9c01=_0x203d7f;const _0x37804d=_0x353745[_0x52bd73(0x135)]||_0x353745[_0x52bd73(0x128)]?.[0x0]?.[_0x52bd73(0x135)];if(_0x37804d?.['segment']===_0x203d7f)return{'stageName':_0x52bd73(0x135),'criteriaName':_0x37804d[_0x52bd73(0xfe)]||_0x203d7f};_0x5a5b4a:for(const _0x5254ab of _0x1af9c3){if(_0x5254ab['entry_criteria']?.[_0x52bd73(0xfb)]===_0x203d7f){_0x15a8cf=_0x5254ab[_0x52bd73(0xfe)],_0x1a9c01=_0x5254ab['entry_criteria']['name']||_0x203d7f;break;}if(_0x5254ab[_0x52bd73(0x96)])for(const _0x4b77c7 of _0x5254ab[_0x52bd73(0x96)]){if(_0x4b77c7[_0x52bd73(0x138)]==='decision_point'&&_0x4b77c7[_0x52bd73(0xd3)]?.[_0x52bd73(0x9a)])for(const _0x338e07 of _0x4b77c7['with'][_0x52bd73(0x9a)]){if(_0x338e07[_0x52bd73(0xfb)]===_0x203d7f){_0x15a8cf=_0x5254ab[_0x52bd73(0xfe)],_0x1a9c01=_0x338e07['name']||_0x203d7f;break _0x5a5b4a;}}}}return{'stageName':_0x15a8cf,'criteriaName':_0x1a9c01};}async function executeThreeStepJourneyCreate(_0x1de3c4,_0x1ddde0,_0x2e0cec,_0x1206dd,_0xc61969,_0x2f1377,_0x2a7cfa,_0x835d8b){const _0x5ef43f=a156_0x1fb252,{activationDefToCreateRequest:_0x3b075b,yamlRuleToApi:_0x467ff3}=_0x835d8b,{pendingEmbeddedSegments:_0x3cd250,pendingEmbeddedActivations:_0x583a9c,embeddedSegmentNameToId:_0x14bf4e}=_0x1206dd,_0x25f7ce=JSON[_0x5ef43f(0x129)](JSON[_0x5ef43f(0x124)](_0x2e0cec));ensureJourneyDefaults(_0x25f7ce[_0x5ef43f(0x16b)]),stripPendingIds(_0x25f7ce);const _0x147c09=await _0x1de3c4[_0x5ef43f(0xb6)]['create'](_0x25f7ce),_0x3e8947=_0x147c09['id'],_0x1e6c3d=new Map();for(const _0x1ef1c6 of _0x147c09[_0x5ef43f(0x16b)]['journeyStages']){_0x1e6c3d[_0x5ef43f(0xeb)](_0x1ef1c6[_0x5ef43f(0xfe)]['toLowerCase'](),_0x1ef1c6['id']);}recoverSegmentIdsFromPushRecovery(_0x1ddde0,_0x14bf4e,_0x2f1377[_0x5ef43f(0xed)]);for(const [_0x7b43e0,{definition:_0xc7f03}]of _0x3cd250){if(_0x14bf4e[_0x5ef43f(0xde)](_0x7b43e0)){_0x2a7cfa['onProgress']?.({'type':_0x5ef43f(0xe1),'journeyName':_0x1ddde0['yamlConfig']['name'],'segmentName':_0x7b43e0});continue;}const _0x12bae9=generateDeterministicJourneySegmentName(_0x1ddde0[_0x5ef43f(0xb2)]['name'],_0x7b43e0);_0x2a7cfa[_0x5ef43f(0x106)]?.({'type':_0x5ef43f(0xd8),'journeyName':_0x1ddde0[_0x5ef43f(0xb2)][_0x5ef43f(0xfe)],'segmentName':_0x7b43e0});const _0x20fc9d=createSegmentIdResolver(_0x2f1377[_0x5ef43f(0xed)],_0x7b43e0),_0x47ca57=await resolveRuleSegmentIds(_0xc7f03[_0x5ef43f(0xce)],_0x20fc9d),_0x1ba1f6=await createOrRecoverEmbeddedSegment(_0x1de3c4,_0x1ddde0,{'localName':_0x7b43e0,'uniqueSegmentName':_0x12bae9,'description':_0xc7f03[_0x5ef43f(0x140)]||_0x5ef43f(0x13b)+_0x7b43e0,'journeyId':_0x3e8947,'resolvedRule':_0x47ca57,'parentId':_0xc61969[_0x5ef43f(0x13c)],'folderId':_0xc61969[_0x5ef43f(0xe3)]||''},_0x467ff3);_0x14bf4e[_0x5ef43f(0xeb)](_0x7b43e0,_0x1ba1f6),_0x2f1377[_0x5ef43f(0xed)][_0x5ef43f(0xeb)](_0x7b43e0,_0x1ba1f6),_0x2a7cfa[_0x5ef43f(0x106)]?.({'type':'embedded_segment_created','journeyName':_0x1ddde0[_0x5ef43f(0xb2)][_0x5ef43f(0xfe)],'segmentName':_0x7b43e0});}const _0x2f1585=new Map();for(const [_0x12cce5,_0x3f49b1]of _0x583a9c){_0x2a7cfa[_0x5ef43f(0x106)]?.({'type':_0x5ef43f(0x11c),'journeyName':_0x1ddde0[_0x5ef43f(0xb2)][_0x5ef43f(0xfe)],'activationName':_0x12cce5});const _0x5f2f12=await _0x3b075b(_0x3f49b1,_0x2f1377[_0x5ef43f(0xb0)]),_0x1ae1a2={..._0x5f2f12,..._0x3f49b1['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x3f49b1[_0x5ef43f(0x112)]}},_0x57e66d=await _0x1de3c4['journey'][_0x5ef43f(0xe5)](_0x3e8947,_0x1ae1a2);_0x2f1585[_0x5ef43f(0xeb)](_0x12cce5,_0x57e66d['id']),_0x1206dd[_0x5ef43f(0x134)][_0x5ef43f(0xeb)](_0x12cce5,_0x57e66d['id']),_0x2a7cfa[_0x5ef43f(0x106)]?.({'type':_0x5ef43f(0xc8),'journeyName':_0x1ddde0[_0x5ef43f(0xb2)]['name'],'activationName':_0x12cce5});}const _0x43396f=JSON[_0x5ef43f(0x129)](JSON['stringify'](_0x2e0cec));return _0x43396f['id']=_0x3e8947,ensureJourneyDefaults(_0x43396f['attributes']),resolvePendingIdsInRequest(_0x43396f,_0x2e0cec,_0x1e6c3d,_0x14bf4e,_0x2f1585,_0x2a7cfa),await _0x1de3c4[_0x5ef43f(0xb6)][_0x5ef43f(0xec)](_0x3e8947,_0x43396f),deletePushRecovery(_0x1ddde0[_0x5ef43f(0x8e)]),{'action':_0x5ef43f(0xb7),'journeyId':_0x3e8947,'embeddedSegmentNameToId':_0x14bf4e};}export function stripWaitStepPendingIds(_0x3d74d4){const _0x2ec705=a156_0x1fb252,_0x4b9471=_0x3d74d4[_0x2ec705(0xf8)]&&isPendingSegmentId(_0x3d74d4[_0x2ec705(0xf8)]),_0x406ad6=_0x3d74d4['conditions']?.[_0x2ec705(0xaf)](_0x319d9c=>_0x319d9c[_0x2ec705(0x8a)]&&isPendingSegmentId(_0x319d9c['segmentId']));(_0x4b9471||_0x406ad6)&&(_0x3d74d4['waitStepType']=_0x2ec705(0xe0),_0x3d74d4[_0x2ec705(0xe6)]=0x1,_0x3d74d4[_0x2ec705(0xf9)]=_0x2ec705(0x13d),delete _0x3d74d4[_0x2ec705(0xf8)],delete _0x3d74d4[_0x2ec705(0x97)],delete _0x3d74d4['conditionTimeoutUnit'],delete _0x3d74d4[_0x2ec705(0xd6)]);}export function resolveWaitStepPendingIds(_0x5f3780,_0x56ef50,_0x44c891,_0x2daea0){const _0x4904aa=a156_0x1fb252;if(_0x56ef50[_0x4904aa(0xf8)]&&isPendingSegmentId(_0x56ef50['conditionSegmentId'])){const _0x1910b0=_0x44c891(_0x56ef50[_0x4904aa(0xf8)],_0x4904aa(0x122)+_0x2daea0+'\x27\x20wait\x20condition');_0x1910b0&&(_0x5f3780['waitStepType']=_0x4904aa(0x113),_0x5f3780[_0x4904aa(0xf8)]=_0x1910b0,delete _0x5f3780[_0x4904aa(0xe6)],delete _0x5f3780[_0x4904aa(0xf9)],_0x56ef50[_0x4904aa(0x97)]!==undefined&&(_0x5f3780['conditionTimeoutDuration']=_0x56ef50['conditionTimeoutDuration']),_0x56ef50[_0x4904aa(0xb4)]&&(_0x5f3780[_0x4904aa(0xb4)]=_0x56ef50[_0x4904aa(0xb4)]));}if(_0x56ef50[_0x4904aa(0xd6)]){const _0x1c4faf=_0x56ef50['conditions'][_0x4904aa(0xaf)](_0x4df514=>_0x4df514[_0x4904aa(0x8a)]&&isPendingSegmentId(_0x4df514['segmentId']));if(_0x1c4faf){const _0x28c75d=_0x56ef50[_0x4904aa(0xd6)][_0x4904aa(0x117)](_0x349869=>{const _0x237eab=_0x4904aa;if(_0x349869[_0x237eab(0x8a)]&&isPendingSegmentId(_0x349869[_0x237eab(0x8a)])){const _0x158ddf=_0x44c891(_0x349869['segmentId'],_0x237eab(0x122)+_0x2daea0+'\x27\x20wait\x20condition');return{..._0x349869,'segmentId':_0x158ddf||_0x349869[_0x237eab(0x8a)]};}return{..._0x349869};});_0x5f3780[_0x4904aa(0x145)]=_0x4904aa(0x113),_0x5f3780[_0x4904aa(0xd6)]=_0x28c75d,delete _0x5f3780['waitStep'],delete _0x5f3780[_0x4904aa(0xf9)],delete _0x5f3780[_0x4904aa(0xf8)],delete _0x5f3780[_0x4904aa(0x97)],delete _0x5f3780[_0x4904aa(0xb4)];}}}function stripPendingIds(_0x3fc83a){const _0x104155=a156_0x1fb252;_0x3fc83a['attributes']['goal']?.[_0x104155(0x8a)]&&isPendingSegmentId(_0x3fc83a['attributes']['goal']['segmentId'])&&delete _0x3fc83a[_0x104155(0x16b)][_0x104155(0x135)];for(const _0x5cfaf0 of _0x3fc83a[_0x104155(0x16b)][_0x104155(0x119)]||[]){_0x5cfaf0['entryCriteria']?.[_0x104155(0x8a)]&&isPendingSegmentId(_0x5cfaf0[_0x104155(0x9c)][_0x104155(0x8a)])&&delete _0x5cfaf0[_0x104155(0x9c)];_0x5cfaf0['milestone']?.[_0x104155(0x8a)]&&isPendingSegmentId(_0x5cfaf0[_0x104155(0xa7)][_0x104155(0x8a)])&&delete _0x5cfaf0[_0x104155(0xa7)];_0x5cfaf0[_0x104155(0x89)]&&(_0x5cfaf0[_0x104155(0x89)]=_0x5cfaf0['exitCriterias']['filter'](_0x24b7dd=>!_0x24b7dd[_0x104155(0x8a)]||!isPendingSegmentId(_0x24b7dd[_0x104155(0x8a)])));if(_0x5cfaf0[_0x104155(0x96)])for(const _0x2c37ec of Object[_0x104155(0x125)](_0x5cfaf0[_0x104155(0x96)])){const _0x1e21c4=_0x5cfaf0[_0x104155(0x96)][_0x2c37ec];_0x1e21c4[_0x104155(0x138)]===_0x104155(0x174)&&_0x1e21c4['journeyActivationStepId']&&isPendingActivationId(_0x1e21c4[_0x104155(0xdc)])&&(_0x1e21c4[_0x104155(0xdc)]='');if(_0x1e21c4['type']===_0x104155(0x17b)&&_0x1e21c4[_0x104155(0x9a)])for(const _0x1d43cb of _0x1e21c4[_0x104155(0x9a)]){_0x1d43cb[_0x104155(0x8a)]&&isPendingSegmentId(_0x1d43cb['segmentId'])&&(_0x1d43cb[_0x104155(0x8a)]='');}_0x1e21c4[_0x104155(0x138)]===_0x104155(0xaa)&&stripWaitStepPendingIds(_0x1e21c4);}}}function resolvePendingIdsInRequest(_0x53c702,_0x1ae564,_0x475094,_0x18c949,_0x469bf3,_0x22c10a){const _0x29925d=a156_0x1fb252,_0x3dbe9b=(_0x2aa462,_0x1d3080)=>{const _0x2bdc01=a156_0x419a;if(!isPendingSegmentId(_0x2aa462))return _0x2aa462;const _0x40309c=extractPendingSegmentName(_0x2aa462),_0x3a1b40=_0x18c949[_0x2bdc01(0xab)](_0x40309c);return!_0x3a1b40&&_0x22c10a[_0x2bdc01(0xd0)]?.(_0x2bdc01(0xc0)+_0x40309c+'\x27\x20for\x20'+_0x1d3080),_0x3a1b40;};if(_0x53c702['attributes'][_0x29925d(0x135)]?.[_0x29925d(0x8a)]&&isPendingSegmentId(_0x53c702[_0x29925d(0x16b)][_0x29925d(0x135)][_0x29925d(0x8a)])){const _0x5eb54b=_0x3dbe9b(_0x53c702[_0x29925d(0x16b)][_0x29925d(0x135)][_0x29925d(0x8a)],_0x29925d(0xa0));_0x5eb54b&&(_0x53c702['attributes']['goal'][_0x29925d(0x8a)]=_0x5eb54b);}for(const _0x2b6395 of _0x53c702['attributes'][_0x29925d(0x119)]||[]){const _0x2ed052=_0x475094[_0x29925d(0xab)](_0x2b6395[_0x29925d(0xfe)][_0x29925d(0xbe)]());_0x2ed052&&(_0x2b6395['id']=_0x2ed052);if(_0x2b6395[_0x29925d(0x9c)]?.[_0x29925d(0x8a)]&&isPendingSegmentId(_0x2b6395[_0x29925d(0x9c)][_0x29925d(0x8a)])){const _0x4b5827=_0x3dbe9b(_0x2b6395[_0x29925d(0x9c)][_0x29925d(0x8a)],_0x29925d(0x122)+_0x2b6395[_0x29925d(0xfe)]+_0x29925d(0x16c));_0x4b5827&&(_0x2b6395[_0x29925d(0x9c)][_0x29925d(0x8a)]=_0x4b5827);}if(_0x2b6395[_0x29925d(0x89)])for(const _0x8ee3b7 of _0x2b6395[_0x29925d(0x89)]){if(_0x8ee3b7['segmentId']&&isPendingSegmentId(_0x8ee3b7[_0x29925d(0x8a)])){const _0x35d4da=_0x3dbe9b(_0x8ee3b7[_0x29925d(0x8a)],_0x29925d(0x122)+_0x2b6395[_0x29925d(0xfe)]+_0x29925d(0x148));_0x35d4da&&(_0x8ee3b7[_0x29925d(0x8a)]=_0x35d4da);}}if(_0x2b6395[_0x29925d(0xa7)]?.[_0x29925d(0x8a)]&&isPendingSegmentId(_0x2b6395['milestone']['segmentId'])){const _0x517158=_0x3dbe9b(_0x2b6395[_0x29925d(0xa7)][_0x29925d(0x8a)],_0x29925d(0x122)+_0x2b6395[_0x29925d(0xfe)]+_0x29925d(0x175));_0x517158&&(_0x2b6395['milestone']['segmentId']=_0x517158);}if(_0x2b6395[_0x29925d(0x96)]){const _0x660986=_0x165d40=>_0x1ae564[_0x29925d(0x16b)]['journeyStages']?.[_0x29925d(0x162)](_0x25187e=>_0x25187e['name'][_0x29925d(0xbe)]()===_0x2b6395[_0x29925d(0xfe)]['toLowerCase']())?.['steps']?.[_0x165d40];for(const _0x4418e1 of Object[_0x29925d(0x125)](_0x2b6395[_0x29925d(0x96)])){const _0x55f525=_0x2b6395[_0x29925d(0x96)][_0x4418e1],_0x1e7ca9=_0x660986(_0x4418e1);if(_0x55f525[_0x29925d(0x138)]===_0x29925d(0x174)&&_0x55f525[_0x29925d(0xdc)]&&(isPendingActivationId(_0x55f525['journeyActivationStepId'])||_0x55f525[_0x29925d(0xdc)]==='')){if(_0x1e7ca9?.[_0x29925d(0xdc)]&&isPendingActivationId(_0x1e7ca9['journeyActivationStepId'])){const _0x583629=extractPendingActivationName(_0x1e7ca9[_0x29925d(0xdc)]),_0x3fc445=_0x469bf3['get'](_0x583629);_0x3fc445&&(_0x55f525[_0x29925d(0xdc)]=_0x3fc445);}}if(_0x55f525[_0x29925d(0x138)]==='DecisionPoint'&&_0x55f525[_0x29925d(0x9a)]&&_0x1e7ca9?.[_0x29925d(0x9a)])for(let _0x51026b=0x0;_0x51026b<_0x55f525['branches']['length'];_0x51026b++){const _0x141897=_0x55f525[_0x29925d(0x9a)][_0x51026b],_0x54f88e=_0x1e7ca9[_0x29925d(0x9a)][_0x51026b];if(_0x54f88e?.[_0x29925d(0x8a)]&&isPendingSegmentId(_0x54f88e[_0x29925d(0x8a)])){const _0x5667f9=_0x3dbe9b(_0x54f88e[_0x29925d(0x8a)],'stage\x20\x27'+_0x2b6395[_0x29925d(0xfe)]+_0x29925d(0x164)+(_0x141897['name']||_0x51026b)+'\x27');_0x5667f9&&(_0x141897[_0x29925d(0x8a)]=_0x5667f9);}}_0x55f525[_0x29925d(0x138)]===_0x29925d(0xaa)&&_0x1e7ca9?.[_0x29925d(0x138)]===_0x29925d(0xaa)&&resolveWaitStepPendingIds(_0x55f525,_0x1e7ca9,_0x3dbe9b,_0x2b6395[_0x29925d(0xfe)]);}}}}
@@ -1 +1 @@
1
- function a156_0x464e(_0x2f7d89,_0x5e00d5){_0x2f7d89=_0x2f7d89-0x1f2;const _0x11186f=a156_0x1118();let _0x464ed2=_0x11186f[_0x2f7d89];return _0x464ed2;}(function(_0x562c50,_0x5d3b22){const _0x1a091e=a156_0x464e,_0x1eddc5=_0x562c50();while(!![]){try{const _0x5ba0e7=-parseInt(_0x1a091e(0x1fb))/0x1+-parseInt(_0x1a091e(0x1f9))/0x2+-parseInt(_0x1a091e(0x200))/0x3*(parseInt(_0x1a091e(0x1ff))/0x4)+-parseInt(_0x1a091e(0x201))/0x5*(parseInt(_0x1a091e(0x1f3))/0x6)+-parseInt(_0x1a091e(0x1f5))/0x7*(parseInt(_0x1a091e(0x1f2))/0x8)+-parseInt(_0x1a091e(0x1fc))/0x9+parseInt(_0x1a091e(0x1fd))/0xa;if(_0x5ba0e7===_0x5d3b22)break;else _0x1eddc5['push'](_0x1eddc5['shift']());}catch(_0x241ce9){_0x1eddc5['push'](_0x1eddc5['shift']());}}}(a156_0x1118,0x87777));export function buildFolderIdToPathMap(_0x4cc826){const _0x133384=a156_0x464e,_0x4297fb=new Map(),_0x369bb6=new Map();for(const _0x263d8b of _0x4cc826){_0x369bb6[_0x133384(0x1f7)](_0x263d8b['id'],_0x263d8b);}const _0x5c1e33=new Set();for(const _0x39d0fa of _0x4cc826){!_0x39d0fa[_0x133384(0x1f4)]&&_0x5c1e33[_0x133384(0x1fa)](_0x39d0fa['id']);}function _0x1bd04d(_0xbf7f9a){const _0x3ea8d5=_0x133384;if(_0x4297fb[_0x3ea8d5(0x1f8)](_0xbf7f9a['id']))return _0x4297fb['get'](_0xbf7f9a['id']);if(_0x5c1e33[_0x3ea8d5(0x1f8)](_0xbf7f9a['id']))return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],''),'';if(_0xbf7f9a['parentFolderId']){const _0x3a083e=_0x369bb6[_0x3ea8d5(0x1f6)](_0xbf7f9a[_0x3ea8d5(0x1f4)]);if(_0x3a083e){const _0xbc2504=_0x1bd04d(_0x3a083e),_0x479bba=_0xbc2504?_0xbc2504+'/'+_0xbf7f9a['name']:_0xbf7f9a[_0x3ea8d5(0x1fe)];return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],_0x479bba),_0x479bba;}}const _0x3799fb=_0xbf7f9a[_0x3ea8d5(0x1fe)];return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],_0x3799fb),_0x3799fb;}for(const _0x1ecafc of _0x4cc826){_0x1bd04d(_0x1ecafc);}return _0x4297fb;}export function buildFolderPathToIdMap(_0x292e4e){const _0x151510=a156_0x464e,_0x4e3075=new Map(),_0x4f9524=new Map();for(const _0x1d9974 of _0x292e4e){_0x4f9524[_0x151510(0x1f7)](_0x1d9974['id'],_0x1d9974);}const _0x4fbc21=new Set();for(const _0x36470f of _0x292e4e){!_0x36470f[_0x151510(0x1f4)]&&_0x4fbc21[_0x151510(0x1fa)](_0x36470f['id']);}function _0xe56f(_0x4aed2f){const _0x3a0841=_0x151510;if(_0x4fbc21['has'](_0x4aed2f['id']))return'';if(_0x4aed2f['parentFolderId']){const _0x408f78=_0x4f9524['get'](_0x4aed2f['parentFolderId']);if(_0x408f78){const _0x7cdf94=_0xe56f(_0x408f78);return _0x7cdf94?_0x7cdf94+'/'+_0x4aed2f[_0x3a0841(0x1fe)]:_0x4aed2f[_0x3a0841(0x1fe)];}}return _0x4aed2f[_0x3a0841(0x1fe)];}for(const _0x39d579 of _0x292e4e){const _0x57785e=_0xe56f(_0x39d579);_0x4e3075[_0x151510(0x1f7)](_0x57785e,_0x39d579['id']);}return _0x4e3075;}function a156_0x1118(){const _0x56dc74=['40137710uZzOvH','name','2655020OUXwCP','3pUKgKo','40IJAriP','1512328ykIXfF','583206FPqPMO','parentFolderId','35KTqIMH','get','set','has','1176122bIBLhx','add','259338Rgqwdl','2024397CUIYxz'];a156_0x1118=function(){return _0x56dc74;};return a156_0x1118();}export function buildFolderMaps(_0x299558){const _0x624567=buildFolderIdToPathMap(_0x299558),_0x1e6a88=new Map();for(const [_0x5945fd,_0x366078]of _0x624567){_0x1e6a88['set'](_0x366078,_0x5945fd);}return{'idToPath':_0x624567,'pathToId':_0x1e6a88};}export function getFolderPath(_0x9288b1,_0x316fc3){const _0x8db2e8=a156_0x464e;if(!_0x9288b1)return'';return _0x316fc3[_0x8db2e8(0x1f6)](_0x9288b1)??'';}
1
+ (function(_0x5ac7c5,_0x562053){const _0x3d763b=a157_0x31ae,_0x228451=_0x5ac7c5();while(!![]){try{const _0x4a89ae=-parseInt(_0x3d763b(0xe1))/0x1+-parseInt(_0x3d763b(0xe4))/0x2*(-parseInt(_0x3d763b(0xea))/0x3)+parseInt(_0x3d763b(0xe2))/0x4+-parseInt(_0x3d763b(0xe7))/0x5+-parseInt(_0x3d763b(0xe0))/0x6*(-parseInt(_0x3d763b(0xe3))/0x7)+-parseInt(_0x3d763b(0xe5))/0x8+parseInt(_0x3d763b(0xee))/0x9;if(_0x4a89ae===_0x562053)break;else _0x228451['push'](_0x228451['shift']());}catch(_0x96e50d){_0x228451['push'](_0x228451['shift']());}}}(a157_0x14c1,0xe2927));export function buildFolderIdToPathMap(_0x2897f4){const _0x34e784=a157_0x31ae,_0x2d52f2=new Map(),_0x3fb5fa=new Map();for(const _0x59d5d4 of _0x2897f4){_0x3fb5fa[_0x34e784(0xe6)](_0x59d5d4['id'],_0x59d5d4);}const _0x4a7149=new Set();for(const _0x38dbb3 of _0x2897f4){!_0x38dbb3[_0x34e784(0xe9)]&&_0x4a7149[_0x34e784(0xec)](_0x38dbb3['id']);}function _0x4a0b2c(_0x42adae){const _0x1d92ee=_0x34e784;if(_0x2d52f2[_0x1d92ee(0xe8)](_0x42adae['id']))return _0x2d52f2[_0x1d92ee(0xed)](_0x42adae['id']);if(_0x4a7149[_0x1d92ee(0xe8)](_0x42adae['id']))return _0x2d52f2[_0x1d92ee(0xe6)](_0x42adae['id'],''),'';if(_0x42adae['parentFolderId']){const _0x3c9472=_0x3fb5fa[_0x1d92ee(0xed)](_0x42adae['parentFolderId']);if(_0x3c9472){const _0x2b4256=_0x4a0b2c(_0x3c9472),_0x1286e7=_0x2b4256?_0x2b4256+'/'+_0x42adae[_0x1d92ee(0xeb)]:_0x42adae['name'];return _0x2d52f2[_0x1d92ee(0xe6)](_0x42adae['id'],_0x1286e7),_0x1286e7;}}const _0x51ac0b=_0x42adae['name'];return _0x2d52f2[_0x1d92ee(0xe6)](_0x42adae['id'],_0x51ac0b),_0x51ac0b;}for(const _0x563b4f of _0x2897f4){_0x4a0b2c(_0x563b4f);}return _0x2d52f2;}export function buildFolderPathToIdMap(_0x8fc25f){const _0x114a60=a157_0x31ae,_0x2de4c2=new Map(),_0x11b92a=new Map();for(const _0x21db87 of _0x8fc25f){_0x11b92a[_0x114a60(0xe6)](_0x21db87['id'],_0x21db87);}const _0x3b13fe=new Set();for(const _0x12c9e of _0x8fc25f){!_0x12c9e[_0x114a60(0xe9)]&&_0x3b13fe['add'](_0x12c9e['id']);}function _0x2f307f(_0x292274){const _0x42b93e=_0x114a60;if(_0x3b13fe[_0x42b93e(0xe8)](_0x292274['id']))return'';if(_0x292274['parentFolderId']){const _0x3f22ec=_0x11b92a[_0x42b93e(0xed)](_0x292274[_0x42b93e(0xe9)]);if(_0x3f22ec){const _0x374b8d=_0x2f307f(_0x3f22ec);return _0x374b8d?_0x374b8d+'/'+_0x292274['name']:_0x292274[_0x42b93e(0xeb)];}}return _0x292274[_0x42b93e(0xeb)];}for(const _0x413d21 of _0x8fc25f){const _0x1e1264=_0x2f307f(_0x413d21);_0x2de4c2['set'](_0x1e1264,_0x413d21['id']);}return _0x2de4c2;}function a157_0x14c1(){const _0x21fe82=['parentFolderId','588zOfWEV','name','add','get','25775307BMGuFP','34230ayMAiI','1104842esEWzx','3681520bTQFtv','1785TYotgB','254RnyyqZ','11319096iArpOe','set','9081010ydvKxq','has'];a157_0x14c1=function(){return _0x21fe82;};return a157_0x14c1();}function a157_0x31ae(_0x39fd55,_0xbefae2){_0x39fd55=_0x39fd55-0xe0;const _0x14c1eb=a157_0x14c1();let _0x31ae03=_0x14c1eb[_0x39fd55];return _0x31ae03;}export function buildFolderMaps(_0x5cfd33){const _0x49f33b=buildFolderIdToPathMap(_0x5cfd33),_0x2b0ff0=new Map();for(const [_0x30c6b7,_0x190a19]of _0x49f33b){_0x2b0ff0['set'](_0x190a19,_0x30c6b7);}return{'idToPath':_0x49f33b,'pathToId':_0x2b0ff0};}export function getFolderPath(_0x3ed7cb,_0xd4bb7d){const _0x2be92e=a157_0x31ae;if(!_0x3ed7cb)return'';return _0xd4bb7d[_0x2be92e(0xed)](_0x3ed7cb)??'';}
@@ -1 +1 @@
1
- (function(_0x8adc4a,_0xda913f){const _0x214762=a157_0xbd72,_0x52be67=_0x8adc4a();while(!![]){try{const _0xe194e3=parseInt(_0x214762(0xdd))/0x1+parseInt(_0x214762(0xe0))/0x2*(parseInt(_0x214762(0xdf))/0x3)+parseInt(_0x214762(0xc7))/0x4+parseInt(_0x214762(0xcc))/0x5*(parseInt(_0x214762(0xc1))/0x6)+parseInt(_0x214762(0xc3))/0x7*(-parseInt(_0x214762(0xde))/0x8)+-parseInt(_0x214762(0xeb))/0x9*(parseInt(_0x214762(0xf1))/0xa)+parseInt(_0x214762(0xda))/0xb*(parseInt(_0x214762(0xd7))/0xc);if(_0xe194e3===_0xda913f)break;else _0x52be67['push'](_0x52be67['shift']());}catch(_0x13907c){_0x52be67['push'](_0x52be67['shift']());}}}(a157_0x2578,0xc2c93));import a157_0x21e016 from'path';import{parse as a157_0x121487}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x34aede){const _0xd595af=a157_0xbd72;if(!_0x34aede||_0x34aede[_0xd595af(0xe3)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x395af8=_0x34aede[_0xd595af(0xe3)]();if(_0x395af8==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x34aede};const _0x2129fe=_0x395af8[_0xd595af(0xe5)]('/')?_0x395af8[_0xd595af(0xc2)](0x1):_0x395af8,_0x225e28=_0x2129fe[_0xd595af(0xc0)]('/')[_0xd595af(0xe8)](_0x53d4cd=>_0x53d4cd!=='');if(_0x225e28[_0xd595af(0xd1)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x2e1cbf=_0x395af8[_0xd595af(0xe5)]('/')||!isRelativePathSegment(_0x225e28[0x0]);for(const _0x27eecc of _0x225e28){validatePathSegment(_0x27eecc);}return{'segments':_0x225e28,'isAbsolute':_0x2e1cbf,'raw':_0x34aede};}function isRelativePathSegment(_0x3a3db5){return _0x3a3db5==='.'||_0x3a3db5==='..';}function a157_0x2578(){const _0x338b8d=['10874830OkkpRF','segments','split','330258ljXSDH','substring','335573CMCWFV','root','name','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','5624504qLAXav','journey','isAbsolute','Cannot\x20split\x20empty\x20path','Path\x20attempts\x20to\x20navigate\x20above\x20root','45JwWYhF','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','raw','pop','segment','length','replace','parse','.yml','test','.yaml','10772628GpySpL','resolve','Path\x20segment\x20cannot\x20be\x20empty','11rxDXOi','push','endsWith','179370HGfbEK','240XXUjoc','1542iKCtxI','1342aWhSNA','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','dirname','trim','Cannot\x20navigate\x20above\x20root','startsWith','slice','join','filter','type','Relative\x20path\x20cannot\x20be\x20empty','9JFAzqF','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','tdx.json','readFile'];a157_0x2578=function(){return _0x338b8d;};return a157_0x2578();}function validatePathSegment(_0x61a2d2){const _0x4f19da=a157_0xbd72;if(_0x61a2d2==='')throw new Error(_0x4f19da(0xd9));if(_0x61a2d2==='.'||_0x61a2d2==='..')return;if(/[\x00-\x1F\x7F]/[_0x4f19da(0xd5)](_0x61a2d2))throw new Error(_0x4f19da(0xed)+_0x61a2d2);if(_0x61a2d2!==_0x61a2d2[_0x4f19da(0xe3)]()){}}export function validatePath(_0x23a4ca){const _0x15c599=a157_0xbd72;if(_0x23a4ca[_0x15c599(0xbf)][_0x15c599(0xd1)]===0x0&&!_0x23a4ca['isAbsolute'])throw new Error(_0x15c599(0xea));if(_0x23a4ca[_0x15c599(0xc9)]){if(_0x23a4ca[_0x15c599(0xbf)][0x0]==='..')throw new Error(_0x15c599(0xc6));let _0x5f01f7=0x0;for(const _0xe2527 of _0x23a4ca[_0x15c599(0xbf)]){if(_0xe2527==='..'){if(_0x5f01f7===0x0)throw new Error(_0x15c599(0xcb));_0x5f01f7--;}else _0xe2527!=='.'&&_0x5f01f7++;}}}export function joinPaths(_0x416483,_0x3473f0){const _0x4280b4=a157_0xbd72;if(!_0x416483||_0x416483==='/')return _0x3473f0;if(!_0x3473f0||_0x3473f0==='.')return _0x416483;if(_0x3473f0['startsWith']('/'))return _0x3473f0;const _0x2a978e=parsePath(_0x416483),_0x217f3e=parsePath(_0x3473f0),_0x39a13b=[..._0x2a978e[_0x4280b4(0xbf)]];for(const _0xc1b908 of _0x217f3e[_0x4280b4(0xbf)]){if(_0xc1b908==='.')continue;else{if(_0xc1b908==='..'){if(_0x39a13b[_0x4280b4(0xd1)]===0x0)throw new Error(_0x4280b4(0xe4));_0x39a13b['pop']();}else _0x39a13b[_0x4280b4(0xdb)](_0xc1b908);}}const _0x7c7f89=_0x39a13b[_0x4280b4(0xe7)]('/');return _0x2a978e[_0x4280b4(0xce)]['startsWith']('/')?'/'+_0x7c7f89:_0x7c7f89;}export function normalizePath(_0x13cb10){const _0x241db6=a157_0xbd72,_0x4a10fb=parsePath(_0x13cb10),_0x278daf=[];for(const _0x46ba59 of _0x4a10fb[_0x241db6(0xbf)]){if(_0x46ba59==='.')continue;else{if(_0x46ba59==='..'){if(_0x278daf[_0x241db6(0xd1)]===0x0){if(_0x4a10fb['isAbsolute'])throw new Error(_0x241db6(0xe4));_0x278daf[_0x241db6(0xdb)]('..');}else _0x278daf[_0x278daf['length']-0x1]==='..'?_0x278daf[_0x241db6(0xdb)]('..'):_0x278daf[_0x241db6(0xcf)]();}else _0x278daf[_0x241db6(0xdb)](_0x46ba59);}}if(_0x278daf['length']===0x0)return _0x4a10fb['isAbsolute']?'/':'.';const _0x2cc1dc=_0x278daf[_0x241db6(0xe7)]('/');return _0x4a10fb[_0x241db6(0xce)][_0x241db6(0xe5)]('/')?'/'+_0x2cc1dc:_0x2cc1dc;}export function getParentPath(_0x1ad0be){const _0x4e6fcd=a157_0xbd72,_0x2be7fa=parsePath(_0x1ad0be);if(_0x2be7fa['segments'][_0x4e6fcd(0xd1)]<=0x1)return'/';const _0x5c12cd=_0x2be7fa[_0x4e6fcd(0xbf)][_0x4e6fcd(0xe6)](0x0,-0x1)[_0x4e6fcd(0xe7)]('/');return _0x2be7fa[_0x4e6fcd(0xce)][_0x4e6fcd(0xe5)]('/')?'/'+_0x5c12cd:_0x5c12cd;}export function getBaseName(_0x516986){const _0xa47d1=a157_0xbd72,_0x2a43da=parsePath(_0x516986);return _0x2a43da[_0xa47d1(0xbf)][_0x2a43da[_0xa47d1(0xbf)][_0xa47d1(0xd1)]-0x1]||'';}function a157_0xbd72(_0x57c112,_0x10fd2b){_0x57c112=_0x57c112-0xbf;const _0x257831=a157_0x2578();let _0xbd7252=_0x257831[_0x57c112];return _0xbd7252;}export function isChildPath(_0x58c981,_0x1391de){const _0x136ccf=a157_0xbd72,_0x227422=parsePath(_0x58c981),_0xf1000e=parsePath(_0x1391de);if(_0x227422[_0x136ccf(0xbf)][_0x136ccf(0xd1)]<=_0xf1000e[_0x136ccf(0xbf)][_0x136ccf(0xd1)])return![];for(let _0x3aabe5=0x0;_0x3aabe5<_0xf1000e[_0x136ccf(0xbf)]['length'];_0x3aabe5++){if(_0x227422[_0x136ccf(0xbf)][_0x3aabe5]!==_0xf1000e[_0x136ccf(0xbf)][_0x3aabe5])return![];}return!![];}export function splitPath(_0x4f79c5){const _0x59735c=a157_0xbd72,_0x435499=parsePath(_0x4f79c5);if(_0x435499[_0x59735c(0xbf)]['length']===0x0)throw new Error(_0x59735c(0xca));if(_0x435499[_0x59735c(0xbf)][_0x59735c(0xd1)]===0x1)return{'parent':_0x435499[_0x59735c(0xbf)][0x0]};return{'parent':_0x435499[_0x59735c(0xbf)][0x0],'child':_0x435499['segments'][_0x59735c(0xe6)](0x1)[_0x59735c(0xe7)]('/')};}export function isYamlFilePath(_0x34a7f1){const _0x50d19f=a157_0xbd72;return _0x34a7f1[_0x50d19f(0xdc)](_0x50d19f(0xd4))||_0x34a7f1[_0x50d19f(0xdc)](_0x50d19f(0xd6));}export async function resolveYamlFilePath(_0x18355d,_0x25e8d9=nodeFileSystem){const _0x204266=a157_0xbd72,_0xfa7e66=a157_0x21e016[_0x204266(0xd8)](_0x18355d);if(!await _0x25e8d9[_0x204266(0xec)](_0xfa7e66))throw new Error('File\x20not\x20found:\x20'+_0x18355d);let _0x147fae=a157_0x21e016[_0x204266(0xe2)](_0xfa7e66),_0x523713=null,_0xee4eb1=null;const _0x21befe=a157_0x21e016[_0x204266(0xd3)](_0x147fae)[_0x204266(0xc4)];while(_0x147fae!==_0x21befe){const _0x192b8e=a157_0x21e016[_0x204266(0xe7)](_0x147fae,_0x204266(0xef));if(await _0x25e8d9[_0x204266(0xec)](_0x192b8e)){_0x523713=_0x192b8e,_0xee4eb1=_0x147fae;break;}_0x147fae=a157_0x21e016[_0x204266(0xe2)](_0x147fae);}if(!_0x523713||!_0xee4eb1)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x18355d+'\x0a'+_0x204266(0xcd));const _0x58a263=await _0x25e8d9[_0x204266(0xf0)](_0x523713),_0x22ff08=JSON[_0x204266(0xd3)](_0x58a263),_0x37111e=_0x22ff08['parent_segment'];if(!_0x37111e)throw new Error(_0x204266(0xee));const _0xb0bc8e=await _0x25e8d9[_0x204266(0xf0)](_0xfa7e66),_0x5db8e3=a157_0x121487(_0xb0bc8e),_0x19cf06=_0x5db8e3[_0x204266(0xc5)];if(!_0x19cf06)throw new Error(_0x204266(0xe1)+_0x18355d);const _0x5e8bdf=_0x5db8e3[_0x204266(0xe9)]===_0x204266(0xc8)?_0x204266(0xc8):_0x204266(0xd0),_0x1fbc5f=a157_0x21e016['relative'](_0xee4eb1,_0xfa7e66),_0x4f903c=a157_0x21e016[_0x204266(0xe2)](_0x1fbc5f),_0x5a25be=_0x4f903c==='.'?'':_0x4f903c[_0x204266(0xd2)](/\\/g,'/'),_0x4b7b3c=_0x5a25be?_0x37111e+'/'+_0x5a25be+'/'+_0x19cf06:_0x37111e+'/'+_0x19cf06;return{'parentSegment':_0x37111e,'segmentName':_0x19cf06,'folderPath':_0x5a25be,'fullPath':_0x4b7b3c,'resourceType':_0x5e8bdf,'content':_0xb0bc8e};}
1
+ (function(_0x5e16c9,_0x6c1a3a){const _0x19b30f=a158_0x43e7,_0x3b2d63=_0x5e16c9();while(!![]){try{const _0x5a0524=-parseInt(_0x19b30f(0x1e8))/0x1+parseInt(_0x19b30f(0x20a))/0x2+parseInt(_0x19b30f(0x1fa))/0x3+parseInt(_0x19b30f(0x20e))/0x4*(parseInt(_0x19b30f(0x214))/0x5)+-parseInt(_0x19b30f(0x207))/0x6*(parseInt(_0x19b30f(0x204))/0x7)+parseInt(_0x19b30f(0x1f6))/0x8+-parseInt(_0x19b30f(0x1fe))/0x9*(-parseInt(_0x19b30f(0x209))/0xa);if(_0x5a0524===_0x6c1a3a)break;else _0x3b2d63['push'](_0x3b2d63['shift']());}catch(_0x54f379){_0x3b2d63['push'](_0x3b2d63['shift']());}}}(a158_0x3afc,0x629c8));import a158_0x5d9739 from'path';import{parse as a158_0x88dccb}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x1d0cbc){const _0x1d80ba=a158_0x43e7;if(!_0x1d0cbc||_0x1d0cbc[_0x1d80ba(0x213)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x29da16=_0x1d0cbc[_0x1d80ba(0x213)]();if(_0x29da16==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x1d0cbc};const _0x55d8ee=_0x29da16['startsWith']('/')?_0x29da16[_0x1d80ba(0x1e7)](0x1):_0x29da16,_0xda1bc2=_0x55d8ee[_0x1d80ba(0x215)]('/')[_0x1d80ba(0x1fb)](_0xa1048a=>_0xa1048a!=='');if(_0xda1bc2['length']===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x111536=_0x29da16[_0x1d80ba(0x1f8)]('/')||!isRelativePathSegment(_0xda1bc2[0x0]);for(const _0x4b0963 of _0xda1bc2){validatePathSegment(_0x4b0963);}return{'segments':_0xda1bc2,'isAbsolute':_0x111536,'raw':_0x1d0cbc};}function isRelativePathSegment(_0xb19a04){return _0xb19a04==='.'||_0xb19a04==='..';}function a158_0x3afc(){const _0x2454c7=['20MEXxOt','exists','raw','parent_segment','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','trim','241610oHoHlk','split','substring','802397dnfhPD','isAbsolute','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','.yml','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','type','segments','join','tdx.json','root','dirname','Relative\x20path\x20cannot\x20be\x20empty','endsWith','2334800cImZKf','slice','startsWith','Path\x20attempts\x20to\x20navigate\x20above\x20root','687348VgoXdn','filter','pop','name','6687621zpVuPV','journey','test','push','parse','Cannot\x20navigate\x20above\x20root','3733933WGVtHh','File\x20not\x20found:\x20','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','6CPJPnh','length','10whXNcj','468166QFqWTh','readFile','Path\x20segment\x20cannot\x20be\x20empty','resolve'];a158_0x3afc=function(){return _0x2454c7;};return a158_0x3afc();}function validatePathSegment(_0x18fc9f){const _0x300412=a158_0x43e7;if(_0x18fc9f==='')throw new Error(_0x300412(0x20c));if(_0x18fc9f==='.'||_0x18fc9f==='..')return;if(/[\x00-\x1F\x7F]/[_0x300412(0x200)](_0x18fc9f))throw new Error(_0x300412(0x1ed)+_0x18fc9f);if(_0x18fc9f!==_0x18fc9f['trim']()){}}export function validatePath(_0x24d73d){const _0x49234c=a158_0x43e7;if(_0x24d73d['segments']['length']===0x0&&!_0x24d73d[_0x49234c(0x1e9)])throw new Error(_0x49234c(0x1f4));if(_0x24d73d['isAbsolute']){if(_0x24d73d[_0x49234c(0x1ef)][0x0]==='..')throw new Error(_0x49234c(0x1ea));let _0x4b37bc=0x0;for(const _0x365134 of _0x24d73d[_0x49234c(0x1ef)]){if(_0x365134==='..'){if(_0x4b37bc===0x0)throw new Error(_0x49234c(0x1f9));_0x4b37bc--;}else _0x365134!=='.'&&_0x4b37bc++;}}}function a158_0x43e7(_0x391023,_0x1237a9){_0x391023=_0x391023-0x1e7;const _0x3afcb4=a158_0x3afc();let _0x43e7a7=_0x3afcb4[_0x391023];return _0x43e7a7;}export function joinPaths(_0x3c1040,_0x5ac34f){const _0x224fd5=a158_0x43e7;if(!_0x3c1040||_0x3c1040==='/')return _0x5ac34f;if(!_0x5ac34f||_0x5ac34f==='.')return _0x3c1040;if(_0x5ac34f['startsWith']('/'))return _0x5ac34f;const _0x16274e=parsePath(_0x3c1040),_0x278efc=parsePath(_0x5ac34f),_0x52f90d=[..._0x16274e[_0x224fd5(0x1ef)]];for(const _0x3b6a40 of _0x278efc['segments']){if(_0x3b6a40==='.')continue;else{if(_0x3b6a40==='..'){if(_0x52f90d[_0x224fd5(0x208)]===0x0)throw new Error(_0x224fd5(0x203));_0x52f90d[_0x224fd5(0x1fc)]();}else _0x52f90d[_0x224fd5(0x201)](_0x3b6a40);}}const _0x544ffa=_0x52f90d['join']('/');return _0x16274e[_0x224fd5(0x210)][_0x224fd5(0x1f8)]('/')?'/'+_0x544ffa:_0x544ffa;}export function normalizePath(_0x5b804e){const _0x15f7bc=a158_0x43e7,_0x5b90f9=parsePath(_0x5b804e),_0x120f37=[];for(const _0x11d596 of _0x5b90f9[_0x15f7bc(0x1ef)]){if(_0x11d596==='.')continue;else{if(_0x11d596==='..'){if(_0x120f37['length']===0x0){if(_0x5b90f9['isAbsolute'])throw new Error(_0x15f7bc(0x203));_0x120f37[_0x15f7bc(0x201)]('..');}else _0x120f37[_0x120f37[_0x15f7bc(0x208)]-0x1]==='..'?_0x120f37[_0x15f7bc(0x201)]('..'):_0x120f37['pop']();}else _0x120f37[_0x15f7bc(0x201)](_0x11d596);}}if(_0x120f37[_0x15f7bc(0x208)]===0x0)return _0x5b90f9['isAbsolute']?'/':'.';const _0x5513ce=_0x120f37[_0x15f7bc(0x1f0)]('/');return _0x5b90f9[_0x15f7bc(0x210)][_0x15f7bc(0x1f8)]('/')?'/'+_0x5513ce:_0x5513ce;}export function getParentPath(_0x161948){const _0x3b2c90=a158_0x43e7,_0x978700=parsePath(_0x161948);if(_0x978700[_0x3b2c90(0x1ef)][_0x3b2c90(0x208)]<=0x1)return'/';const _0x2c263a=_0x978700[_0x3b2c90(0x1ef)][_0x3b2c90(0x1f7)](0x0,-0x1)[_0x3b2c90(0x1f0)]('/');return _0x978700['raw'][_0x3b2c90(0x1f8)]('/')?'/'+_0x2c263a:_0x2c263a;}export function getBaseName(_0x66f081){const _0x57f662=a158_0x43e7,_0x7f7d0b=parsePath(_0x66f081);return _0x7f7d0b[_0x57f662(0x1ef)][_0x7f7d0b[_0x57f662(0x1ef)]['length']-0x1]||'';}export function isChildPath(_0x1af2b7,_0x129b67){const _0x25fcfd=a158_0x43e7,_0x544939=parsePath(_0x1af2b7),_0x597319=parsePath(_0x129b67);if(_0x544939[_0x25fcfd(0x1ef)][_0x25fcfd(0x208)]<=_0x597319[_0x25fcfd(0x1ef)][_0x25fcfd(0x208)])return![];for(let _0x12a23b=0x0;_0x12a23b<_0x597319['segments'][_0x25fcfd(0x208)];_0x12a23b++){if(_0x544939[_0x25fcfd(0x1ef)][_0x12a23b]!==_0x597319[_0x25fcfd(0x1ef)][_0x12a23b])return![];}return!![];}export function splitPath(_0x19056d){const _0x3e1c48=a158_0x43e7,_0x3bda84=parsePath(_0x19056d);if(_0x3bda84[_0x3e1c48(0x1ef)][_0x3e1c48(0x208)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x3bda84[_0x3e1c48(0x1ef)][_0x3e1c48(0x208)]===0x1)return{'parent':_0x3bda84[_0x3e1c48(0x1ef)][0x0]};return{'parent':_0x3bda84[_0x3e1c48(0x1ef)][0x0],'child':_0x3bda84[_0x3e1c48(0x1ef)]['slice'](0x1)[_0x3e1c48(0x1f0)]('/')};}export function isYamlFilePath(_0x1b59fb){const _0x319067=a158_0x43e7;return _0x1b59fb[_0x319067(0x1f5)](_0x319067(0x1ec))||_0x1b59fb[_0x319067(0x1f5)]('.yaml');}export async function resolveYamlFilePath(_0x1717e7,_0x598c03=nodeFileSystem){const _0x38c4db=a158_0x43e7,_0x539b91=a158_0x5d9739[_0x38c4db(0x20d)](_0x1717e7);if(!await _0x598c03[_0x38c4db(0x20f)](_0x539b91))throw new Error(_0x38c4db(0x205)+_0x1717e7);let _0x28a790=a158_0x5d9739['dirname'](_0x539b91),_0x1dcb00=null,_0x15deeb=null;const _0x38134e=a158_0x5d9739['parse'](_0x28a790)[_0x38c4db(0x1f2)];while(_0x28a790!==_0x38134e){const _0x30de2d=a158_0x5d9739[_0x38c4db(0x1f0)](_0x28a790,_0x38c4db(0x1f1));if(await _0x598c03[_0x38c4db(0x20f)](_0x30de2d)){_0x1dcb00=_0x30de2d,_0x15deeb=_0x28a790;break;}_0x28a790=a158_0x5d9739[_0x38c4db(0x1f3)](_0x28a790);}if(!_0x1dcb00||!_0x15deeb)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x1717e7+'\x0a'+_0x38c4db(0x206));const _0x2ffcb7=await _0x598c03[_0x38c4db(0x20b)](_0x1dcb00),_0x21d45c=JSON[_0x38c4db(0x202)](_0x2ffcb7),_0x5c3d7c=_0x21d45c[_0x38c4db(0x211)];if(!_0x5c3d7c)throw new Error(_0x38c4db(0x1eb));const _0x4e9037=await _0x598c03['readFile'](_0x539b91),_0x39eb17=a158_0x88dccb(_0x4e9037),_0xa6cd3a=_0x39eb17[_0x38c4db(0x1fd)];if(!_0xa6cd3a)throw new Error(_0x38c4db(0x212)+_0x1717e7);const _0x281d49=_0x39eb17[_0x38c4db(0x1ee)]==='journey'?_0x38c4db(0x1ff):'segment',_0x232e59=a158_0x5d9739['relative'](_0x15deeb,_0x539b91),_0x250206=a158_0x5d9739[_0x38c4db(0x1f3)](_0x232e59),_0x33aea0=_0x250206==='.'?'':_0x250206['replace'](/\\/g,'/'),_0x4e7dcf=_0x33aea0?_0x5c3d7c+'/'+_0x33aea0+'/'+_0xa6cd3a:_0x5c3d7c+'/'+_0xa6cd3a;return{'parentSegment':_0x5c3d7c,'segmentName':_0xa6cd3a,'folderPath':_0x33aea0,'fullPath':_0x4e7dcf,'resourceType':_0x281d49,'content':_0x4e9037};}
@@ -1 +1 @@
1
- function a158_0x1b20(_0x19184f,_0x12ff16){_0x19184f=_0x19184f-0x14f;const _0x4a7675=a158_0x4a76();let _0x1b2077=_0x4a7675[_0x19184f];return _0x1b2077;}function a158_0x4a76(){const _0x4e9a61=['1261112EGrhgy','55OcphEi','16872nWMYZj','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','substring','4NiWynk','602TZzyJZ','1714520DdrQLM','indexOf','19548rigRcd','623570gcthqH','555Ekbpiz','4006OLzult','24840OVbQfs'];a158_0x4a76=function(){return _0x4e9a61;};return a158_0x4a76();}(function(_0x334762,_0x3c4092){const _0x3d0230=a158_0x1b20,_0x181508=_0x334762();while(!![]){try{const _0x24ceb3=-parseInt(_0x3d0230(0x154))/0x1+parseInt(_0x3d0230(0x150))/0x2*(-parseInt(_0x3d0230(0x14f))/0x3)+-parseInt(_0x3d0230(0x158))/0x4*(-parseInt(_0x3d0230(0x15a))/0x5)+parseInt(_0x3d0230(0x15c))/0x6*(parseInt(_0x3d0230(0x159))/0x7)+-parseInt(_0x3d0230(0x152))/0x8+-parseInt(_0x3d0230(0x151))/0x9+parseInt(_0x3d0230(0x15d))/0xa*(parseInt(_0x3d0230(0x153))/0xb);if(_0x24ceb3===_0x3c4092)break;else _0x181508['push'](_0x181508['shift']());}catch(_0x58e7e6){_0x181508['push'](_0x181508['shift']());}}}(a158_0x4a76,0x5e7eb));export function parseSegmentRef(_0xfe14b1){const _0x1a86ee=a158_0x1b20,_0x7fa1f4=_0xfe14b1[_0x1a86ee(0x15b)]('/');if(_0x7fa1f4===-0x1)return{'parentId':_0xfe14b1};if(_0x7fa1f4===0x0)throw new Error(_0x1a86ee(0x155)+_0xfe14b1+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x32beef=_0xfe14b1[_0x1a86ee(0x157)](0x0,_0x7fa1f4),_0x3b5aca=_0xfe14b1['substring'](_0x7fa1f4+0x1);if(_0x3b5aca==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0xfe14b1+_0x1a86ee(0x156));return{'parentId':_0x32beef,'childId':_0x3b5aca};}
1
+ (function(_0x5e9b56,_0x25eb2e){const _0x366647=a159_0x40cf,_0x3b5bb3=_0x5e9b56();while(!![]){try{const _0xaef065=parseInt(_0x366647(0xf0))/0x1+parseInt(_0x366647(0xe3))/0x2*(-parseInt(_0x366647(0xef))/0x3)+parseInt(_0x366647(0xeb))/0x4*(-parseInt(_0x366647(0xe8))/0x5)+parseInt(_0x366647(0xe5))/0x6*(-parseInt(_0x366647(0xe4))/0x7)+parseInt(_0x366647(0xe2))/0x8+parseInt(_0x366647(0xea))/0x9*(-parseInt(_0x366647(0xe6))/0xa)+parseInt(_0x366647(0xec))/0xb*(parseInt(_0x366647(0xee))/0xc);if(_0xaef065===_0x25eb2e)break;else _0x3b5bb3['push'](_0x3b5bb3['shift']());}catch(_0x36cc55){_0x3b5bb3['push'](_0x3b5bb3['shift']());}}}(a159_0x27f0,0xbbce7));function a159_0x27f0(){const _0x5d1055=['8bYSyqi','7cnadlu','9194682UpnFfE','780aegQGO','substring','12970UaLXrc','.\x20Parent\x20name\x20cannot\x20be\x20empty','103428skdNWw','1708tooNwL','43549693hfFNSD','indexOf','12qNsTxP','591168AZWsck','530636cPHbdF','Invalid\x20segment\x20reference\x20format:\x20','4833928ZMcZtC'];a159_0x27f0=function(){return _0x5d1055;};return a159_0x27f0();}function a159_0x40cf(_0x3e620d,_0x98ab0e){_0x3e620d=_0x3e620d-0xe2;const _0x27f0d1=a159_0x27f0();let _0x40cf56=_0x27f0d1[_0x3e620d];return _0x40cf56;}export function parseSegmentRef(_0x41dc48){const _0x55f036=a159_0x40cf,_0x4df249=_0x41dc48[_0x55f036(0xed)]('/');if(_0x4df249===-0x1)return{'parentId':_0x41dc48};if(_0x4df249===0x0)throw new Error(_0x55f036(0xf1)+_0x41dc48+_0x55f036(0xe9));const _0x967014=_0x41dc48[_0x55f036(0xe7)](0x0,_0x4df249),_0x23cdc0=_0x41dc48[_0x55f036(0xe7)](_0x4df249+0x1);if(_0x23cdc0==='')throw new Error(_0x55f036(0xf1)+_0x41dc48+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x967014,'childId':_0x23cdc0};}
@@ -1 +1 @@
1
- (function(_0x1d666b,_0xed3ddf){const _0x4d699f=a159_0x279f,_0x2956c0=_0x1d666b();while(!![]){try{const _0xfa0a6d=-parseInt(_0x4d699f(0x1a4))/0x1*(-parseInt(_0x4d699f(0x17c))/0x2)+parseInt(_0x4d699f(0x1a8))/0x3*(parseInt(_0x4d699f(0x17f))/0x4)+-parseInt(_0x4d699f(0x18d))/0x5*(-parseInt(_0x4d699f(0x194))/0x6)+-parseInt(_0x4d699f(0x199))/0x7+parseInt(_0x4d699f(0x190))/0x8*(-parseInt(_0x4d699f(0x185))/0x9)+parseInt(_0x4d699f(0x173))/0xa+-parseInt(_0x4d699f(0x170))/0xb;if(_0xfa0a6d===_0xed3ddf)break;else _0x2956c0['push'](_0x2956c0['shift']());}catch(_0x562ee5){_0x2956c0['push'](_0x2956c0['shift']());}}}(a159_0x43dc,0x1882f));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x25efbb,_0x2a6897={},_0xc51495={}){const _0x383d02=a159_0x279f;if(_0xc51495[_0x383d02(0x180)])return runSemanticChecks(_0x25efbb,_0x2a6897);const _0x95dfe8=SegmentDefSchema[_0x383d02(0x1ab)](_0x25efbb);if(_0x95dfe8[_0x383d02(0x1b2)])return runSemanticChecks(_0x95dfe8[_0x383d02(0x15b)],_0x2a6897);return zodErrorsToValidationResult(_0x95dfe8[_0x383d02(0x192)],_0x2a6897);}export function validateRuleDef(_0x21e4e1,_0x48af95,_0x413a38){const _0x2b3577=a159_0x279f;if(!_0x21e4e1)return[];const _0x28bbcb=RuleDefSchema['safeParse'](_0x21e4e1);if(_0x28bbcb[_0x2b3577(0x1b2)])return checkRule(_0x28bbcb['data'],_0x48af95,_0x413a38);const _0x3de9f1=flattenZodIssues(_0x28bbcb[_0x2b3577(0x192)][_0x2b3577(0x1ad)]);return _0x3de9f1['map'](_0x196f0a=>{const _0x50d9b6=_0x2b3577,_0x283aa3=formatZodPath(_0x196f0a[_0x50d9b6(0x16e)]),_0x2dee4d=_0x283aa3?_0x48af95+'.'+_0x283aa3:_0x48af95,_0x30286a=mapZodIssueToCode(_0x196f0a,_0x283aa3),_0x9698d5=getLocationFromPath(_0x413a38[_0x50d9b6(0x1ac)],_0x413a38[_0x50d9b6(0x178)],pathToArray(_0x2dee4d));return{'level':'error','path':_0x2dee4d,'code':_0x30286a,'message':_0x196f0a[_0x50d9b6(0x19a)],..._0x9698d5&&{'location':_0x9698d5}};});}function zodErrorsToValidationResult(_0x42cf0a,_0x49a93a){const _0x224606=a159_0x279f,_0x2b5dbc=flattenZodIssues(_0x42cf0a['issues']),_0x2e45b1=_0x2b5dbc[_0x224606(0x177)](_0x315925=>{const _0x374f30=_0x224606,_0x368f3d=formatZodPath(_0x315925[_0x374f30(0x16e)]),_0x226e5a=mapZodIssueToCode(_0x315925,_0x368f3d),_0x4168fc=getLocationFromPath(_0x49a93a[_0x374f30(0x1ac)],_0x49a93a['source'],_0x315925['path'][_0x374f30(0x177)](_0x80fc9f=>typeof _0x80fc9f===_0x374f30(0x15d)?String(_0x80fc9f):_0x80fc9f));return{'level':_0x374f30(0x192),'path':_0x368f3d,'code':_0x226e5a,'message':_0x315925[_0x374f30(0x19a)],..._0x4168fc&&{'location':_0x4168fc}};});return{'valid':![],'errors':_0x2e45b1,'warnings':[]};}function mapZodIssueToCode(_0x104609,_0x419954){const _0x3fe3e0=a159_0x279f,_0x42d654=_0x104609[_0x3fe3e0(0x196)]===_0x3fe3e0(0x18a)?_0x104609[_0x3fe3e0(0x195)]:undefined;if(_0x419954==='name')return'MISSING_NAME';if(_0x419954==='rule.type'||_0x419954[_0x3fe3e0(0x1b1)]('.type')){if(_0x104609[_0x3fe3e0(0x196)]===_0x3fe3e0(0x1a2)){if(_0x419954===_0x3fe3e0(0x169)||_0x419954[_0x3fe3e0(0x15f)](/\.conditions\[\d+\]\.type$/))return _0x3fe3e0(0x175);}}if(_0x419954[_0x3fe3e0(0x1b1)](_0x3fe3e0(0x1a3)))return _0x3fe3e0(0x197);if(_0x419954[_0x3fe3e0(0x1b1)]('.operator.value'))return _0x3fe3e0(0x161);if(_0x42d654?.[_0x3fe3e0(0x15c)]===_0x3fe3e0(0x187))return _0x3fe3e0(0x187);if(_0x42d654?.[_0x3fe3e0(0x15c)]===_0x3fe3e0(0x17e))return'MISSING_TIME_UNIT';if(_0x419954[_0x3fe3e0(0x1b1)]('.conditions')||_0x419954==='conditions')return _0x3fe3e0(0x1b0);if(_0x419954[_0x3fe3e0(0x1a1)](_0x3fe3e0(0x1af)))return'INVALID_ARRAY_MATCHING';if(_0x419954[_0x3fe3e0(0x1b1)](_0x3fe3e0(0x19b)))return'MISSING_SEGMENT_REFERENCE';return _0x3fe3e0(0x176);}function runSemanticChecks(_0x306643,_0x280160){const _0x22e066=a159_0x279f,_0x2e19ce=[];_0x306643['rule']&&_0x2e19ce[_0x22e066(0x189)](...checkRule(_0x306643[_0x22e066(0x18b)],'rule',_0x280160));const _0x291d51=_0x2e19ce[_0x22e066(0x16f)](_0x5a7462=>_0x5a7462[_0x22e066(0x168)]==='error'),_0x4c1fc0=_0x2e19ce[_0x22e066(0x16f)](_0x307e10=>_0x307e10['level']===_0x22e066(0x162));return{'valid':_0x291d51[_0x22e066(0x198)]===0x0,'errors':_0x291d51,'warnings':_0x4c1fc0};}function checkRule(_0x875312,_0x307a32,_0x284e0e){const _0x4566d7=a159_0x279f,_0x37f06f=[];if(_0x875312[_0x4566d7(0x1a7)][_0x4566d7(0x198)]===0x0)return _0x37f06f[_0x4566d7(0x189)]({'level':_0x4566d7(0x192),'path':_0x307a32+_0x4566d7(0x163),'code':'EMPTY_CONDITIONS','message':_0x4566d7(0x186),'location':getLocationFromPath(_0x284e0e[_0x4566d7(0x1ac)],_0x284e0e[_0x4566d7(0x178)],pathToArray(_0x307a32+'.conditions'))}),_0x37f06f;return _0x37f06f['push'](...checkConditions(_0x875312[_0x4566d7(0x1a7)],_0x307a32,_0x284e0e)),_0x37f06f;}function checkConditions(_0x530d1e,_0x1b693e,_0x1ac70c){const _0x2dc356=a159_0x279f,_0xe8a437=[];for(let _0x4c72d2=0x0;_0x4c72d2<_0x530d1e['length'];_0x4c72d2++){const _0x2c704d=_0x530d1e[_0x4c72d2],_0x190c8f=_0x1b693e+_0x2dc356(0x1a5)+_0x4c72d2+']';_0xe8a437[_0x2dc356(0x189)](...checkCondition(_0x2c704d,_0x190c8f,_0x1ac70c));}return _0xe8a437;}function checkCondition(_0x63c02d,_0x4a69d1,_0xd8e01c){const _0x4f243a=a159_0x279f,_0x39ebf9=[];if(_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x19f)||_0x63c02d[_0x4f243a(0x167)]==='Or'||_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x164)){if(_0x63c02d[_0x4f243a(0x1a7)][_0x4f243a(0x198)]===0x0)_0x39ebf9['push']({'level':_0x4f243a(0x192),'path':_0x4a69d1+_0x4f243a(0x163),'code':_0x4f243a(0x1a0),'message':_0x63c02d['type']+_0x4f243a(0x18f),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x163)))});else{const _0x29568a=_0x63c02d['description']!==undefined,_0x4bc2d9=_0x63c02d[_0x4f243a(0x167)]==='Composite';!_0x29568a&&!_0x4bc2d9&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x162),'path':_0x4a69d1,'code':_0x4f243a(0x174),'message':_0x63c02d[_0x4f243a(0x167)]+_0x4f243a(0x18c)+_0x4f243a(0x1a6)+_0x4f243a(0x160),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1))}),_0x39ebf9['push'](...checkConditions(_0x63c02d[_0x4f243a(0x1a7)],_0x4a69d1,_0xd8e01c));}return _0x39ebf9;}if(_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x1aa)||_0x63c02d['type']===_0x4f243a(0x184)){const _0x2dc944=_0x63c02d,_0x2bb4f0=_0x2dc944[_0x4f243a(0x178)],_0x347950=_0x2dc944[_0x4f243a(0x165)],_0x4c1171=_0x2bb4f0||_0x347950,_0xb850c2=_0x2dc944[_0x4f243a(0x1ae)]?.[_0x4f243a(0x167)];if((_0xb850c2===_0x4f243a(0x17d)||_0xb850c2==='TimeWithinNext')&&_0x2dc944['operator']?.['not']!==undefined){const _0x1ffa71=_0x2dc944[_0x4f243a(0x1ae)][_0x4f243a(0x19d)]===!![];_0x39ebf9[_0x4f243a(0x189)]({'level':_0x1ffa71?_0x4f243a(0x192):'warning','path':_0x4a69d1+_0x4f243a(0x172),'code':_0x4f243a(0x16d),'message':_0x1ffa71?_0x4f243a(0x19e)+_0xb850c2+_0x4f243a(0x17a)+_0x4f243a(0x166)+_0x4f243a(0x188):_0x4f243a(0x19e)+_0xb850c2+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+_0x4f243a(0x183),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x172)))});}(!_0x2dc944[_0x4f243a(0x193)]||_0x2dc944['attribute']==='')&&(!_0x4c1171&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x192),'path':_0x4a69d1+'.attribute','code':_0x4f243a(0x1a9),'message':_0x4f243a(0x171),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x179)))}));_0x2dc944[_0x4f243a(0x16f)]&&_0x39ebf9[_0x4f243a(0x189)](...checkRule(_0x2dc944[_0x4f243a(0x16f)],_0x4a69d1+_0x4f243a(0x19c),_0xd8e01c));if(_0x2dc944[_0x4f243a(0x178)]){const _0x2f54c6=_0x2dc944[_0x4f243a(0x193)]&&_0x2dc944[_0x4f243a(0x193)]!=='';_0x2f54c6&&!_0x2dc944['filter']&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x192),'path':_0x4a69d1+'.source','code':_0x4f243a(0x181),'message':'Behavior\x20source\x20\x27'+_0x2dc944['source']+_0x4f243a(0x18e)+_0x2dc944[_0x4f243a(0x193)]+'\x27\x20'+_0x4f243a(0x15e)+_0x4f243a(0x191)+_0x4f243a(0x182),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c['source'],pathToArray(_0x4a69d1+_0x4f243a(0x16a)))}),_0x2f54c6&&_0x2dc944[_0x4f243a(0x16f)]&&_0x39ebf9['push']({'level':_0x4f243a(0x162),'path':_0x4a69d1+_0x4f243a(0x179),'code':_0x4f243a(0x16c),'message':_0x4f243a(0x1b3)+_0x2dc944[_0x4f243a(0x193)]+_0x4f243a(0x17b)+_0x4f243a(0x16b),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c['source'],pathToArray(_0x4a69d1+_0x4f243a(0x179)))});}}return _0x39ebf9;}function a159_0x279f(_0x191457,_0x5ede60){_0x191457=_0x191457-0x15b;const _0x43dca2=a159_0x43dc();let _0x279f38=_0x43dca2[_0x191457];return _0x279f38;}function a159_0x43dc(){const _0x26a4f5=['\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','1788PdUhwI','TimeWithinPast','MISSING_TIME_UNIT','1768VJZvMp','skipSchema','BEHAVIOR_SOURCE_MISSING_FILTER','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','Behavior','84951UpXpeG','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','MISSING_BETWEEN_BOUNDS','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','push','custom','rule','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','980615Bjuzsb','\x27\x20with\x20attribute\x20\x27','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','56bNfZir','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','attribute','6OwrpPt','params','code','INVALID_OPERATOR_TYPE','length','282422NNsonr','message','.segment','.filter','not','Operator\x20\x27','And','EMPTY_CONDITIONS','includes','invalid_value','.operator.type','82iMFalB','.conditions[','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','conditions','1002prArlK','EMPTY_ATTRIBUTE','Value','safeParse','document','issues','operator','arrayMatching','MISSING_CONDITIONS','endsWith','success','Attribute\x20\x27','data','validationCode','symbol','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','match','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_OPERATOR_VALUE','warning','.conditions','Composite','aggregation','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','type','level','rule.type','.source','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','TEMPORAL_NEGATION_UNSUPPORTED','path','filter','2320967UWkSqn','Attribute\x20name\x20cannot\x20be\x20empty','.operator.not','7560Ynvpbq','NESTED_CONDITION_GROUP','INVALID_RULE_TYPE','SEGMENT_SCHEMA_ERROR','map','source','.attribute','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'];a159_0x43dc=function(){return _0x26a4f5;};return a159_0x43dc();}
1
+ (function(_0x296f87,_0x498e35){const _0x4bffe2=a160_0x82ce,_0x187439=_0x296f87();while(!![]){try{const _0x225d90=-parseInt(_0x4bffe2(0x1c2))/0x1*(parseInt(_0x4bffe2(0x1c7))/0x2)+-parseInt(_0x4bffe2(0x1a0))/0x3+-parseInt(_0x4bffe2(0x19c))/0x4+-parseInt(_0x4bffe2(0x1e4))/0x5*(-parseInt(_0x4bffe2(0x1d8))/0x6)+-parseInt(_0x4bffe2(0x19d))/0x7*(parseInt(_0x4bffe2(0x1d0))/0x8)+-parseInt(_0x4bffe2(0x1a3))/0x9*(parseInt(_0x4bffe2(0x1d9))/0xa)+parseInt(_0x4bffe2(0x1bc))/0xb;if(_0x225d90===_0x498e35)break;else _0x187439['push'](_0x187439['shift']());}catch(_0x22dbcf){_0x187439['push'](_0x187439['shift']());}}}(a160_0x5b20,0x26269));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x2a4200,_0x379ba8={},_0x2f8c5c={}){const _0x23d0c9=a160_0x82ce;if(_0x2f8c5c[_0x23d0c9(0x1d3)])return runSemanticChecks(_0x2a4200,_0x379ba8);const _0x13f1a9=SegmentDefSchema[_0x23d0c9(0x1af)](_0x2a4200);if(_0x13f1a9[_0x23d0c9(0x1a5)])return runSemanticChecks(_0x13f1a9[_0x23d0c9(0x1cb)],_0x379ba8);return zodErrorsToValidationResult(_0x13f1a9[_0x23d0c9(0x19e)],_0x379ba8);}export function validateRuleDef(_0xcf1dd,_0x5cc79a,_0x417bcb){const _0x611202=a160_0x82ce;if(!_0xcf1dd)return[];const _0x9003cc=RuleDefSchema['safeParse'](_0xcf1dd);if(_0x9003cc[_0x611202(0x1a5)])return checkRule(_0x9003cc[_0x611202(0x1cb)],_0x5cc79a,_0x417bcb);const _0x32a3be=flattenZodIssues(_0x9003cc[_0x611202(0x19e)][_0x611202(0x1b2)]);return _0x32a3be[_0x611202(0x19f)](_0x8862d7=>{const _0x3bb08b=_0x611202,_0x1aaa69=formatZodPath(_0x8862d7[_0x3bb08b(0x1dd)]),_0x2a3849=_0x1aaa69?_0x5cc79a+'.'+_0x1aaa69:_0x5cc79a,_0x38e777=mapZodIssueToCode(_0x8862d7,_0x1aaa69),_0x365878=getLocationFromPath(_0x417bcb[_0x3bb08b(0x1b6)],_0x417bcb[_0x3bb08b(0x1cf)],pathToArray(_0x2a3849));return{'level':'error','path':_0x2a3849,'code':_0x38e777,'message':_0x8862d7[_0x3bb08b(0x1a8)],..._0x365878&&{'location':_0x365878}};});}function zodErrorsToValidationResult(_0xddb860,_0x3d35a7){const _0x5d2b4f=a160_0x82ce,_0x299b3b=flattenZodIssues(_0xddb860['issues']),_0x1c5aae=_0x299b3b[_0x5d2b4f(0x19f)](_0x48bf6b=>{const _0x5dfea9=_0x5d2b4f,_0x5eb8e3=formatZodPath(_0x48bf6b[_0x5dfea9(0x1dd)]),_0x6c722a=mapZodIssueToCode(_0x48bf6b,_0x5eb8e3),_0x353494=getLocationFromPath(_0x3d35a7[_0x5dfea9(0x1b6)],_0x3d35a7['source'],_0x48bf6b[_0x5dfea9(0x1dd)][_0x5dfea9(0x19f)](_0x46335a=>typeof _0x46335a===_0x5dfea9(0x199)?String(_0x46335a):_0x46335a));return{'level':_0x5dfea9(0x19e),'path':_0x5eb8e3,'code':_0x6c722a,'message':_0x48bf6b[_0x5dfea9(0x1a8)],..._0x353494&&{'location':_0x353494}};});return{'valid':![],'errors':_0x1c5aae,'warnings':[]};}function mapZodIssueToCode(_0x217a5b,_0x41cf4f){const _0x406477=a160_0x82ce,_0x2c4a43=_0x217a5b[_0x406477(0x1d7)]===_0x406477(0x1b4)?_0x217a5b['params']:undefined;if(_0x41cf4f==='name')return _0x406477(0x1c9);if(_0x41cf4f===_0x406477(0x1ca)||_0x41cf4f['endsWith'](_0x406477(0x1ce))){if(_0x217a5b[_0x406477(0x1d7)]===_0x406477(0x1b0)){if(_0x41cf4f==='rule.type'||_0x41cf4f['match'](/\.conditions\[\d+\]\.type$/))return _0x406477(0x1a2);}}if(_0x41cf4f[_0x406477(0x1e5)](_0x406477(0x1de)))return _0x406477(0x1bd);if(_0x41cf4f[_0x406477(0x1e5)](_0x406477(0x1b7)))return _0x406477(0x1c3);if(_0x2c4a43?.[_0x406477(0x1d2)]==='MISSING_BETWEEN_BOUNDS')return _0x406477(0x1e6);if(_0x2c4a43?.[_0x406477(0x1d2)]===_0x406477(0x1d1))return _0x406477(0x1d1);if(_0x41cf4f[_0x406477(0x1e5)]('.conditions')||_0x41cf4f==='conditions')return _0x406477(0x1bf);if(_0x41cf4f[_0x406477(0x1b9)]('arrayMatching'))return _0x406477(0x1be);if(_0x41cf4f['endsWith'](_0x406477(0x1b1)))return'MISSING_SEGMENT_REFERENCE';return'SEGMENT_SCHEMA_ERROR';}function a160_0x82ce(_0x350e81,_0x3f077f){_0x350e81=_0x350e81-0x195;const _0x5b20fb=a160_0x5b20();let _0x82ce10=_0x5b20fb[_0x350e81];return _0x82ce10;}function runSemanticChecks(_0x13590a,_0x24ab8b){const _0xbf139e=a160_0x82ce,_0x251af4=[];_0x13590a[_0xbf139e(0x1ba)]&&_0x251af4[_0xbf139e(0x1db)](...checkRule(_0x13590a[_0xbf139e(0x1ba)],_0xbf139e(0x1ba),_0x24ab8b));const _0x45033f=_0x251af4['filter'](_0x292c64=>_0x292c64[_0xbf139e(0x1b5)]===_0xbf139e(0x19e)),_0x37bfad=_0x251af4[_0xbf139e(0x197)](_0x494cd0=>_0x494cd0['level']===_0xbf139e(0x195));return{'valid':_0x45033f['length']===0x0,'errors':_0x45033f,'warnings':_0x37bfad};}function checkRule(_0xa90de,_0x3cee65,_0x29eef7){const _0x541e31=a160_0x82ce,_0x114adb=[];if(_0xa90de[_0x541e31(0x1e2)]['length']===0x0)return _0x114adb['push']({'level':_0x541e31(0x19e),'path':_0x3cee65+_0x541e31(0x1dc),'code':_0x541e31(0x1d6),'message':_0x541e31(0x1ac),'location':getLocationFromPath(_0x29eef7[_0x541e31(0x1b6)],_0x29eef7[_0x541e31(0x1cf)],pathToArray(_0x3cee65+_0x541e31(0x1dc)))}),_0x114adb;return _0x114adb['push'](...checkConditions(_0xa90de['conditions'],_0x3cee65,_0x29eef7)),_0x114adb;}function checkConditions(_0x25f7de,_0x42a7eb,_0x3ea2aa){const _0x420adf=a160_0x82ce,_0x4053e7=[];for(let _0x1d864f=0x0;_0x1d864f<_0x25f7de[_0x420adf(0x1c1)];_0x1d864f++){const _0x16dba9=_0x25f7de[_0x1d864f],_0x13c844=_0x42a7eb+_0x420adf(0x1b3)+_0x1d864f+']';_0x4053e7[_0x420adf(0x1db)](...checkCondition(_0x16dba9,_0x13c844,_0x3ea2aa));}return _0x4053e7;}function checkCondition(_0x435397,_0x49f43d,_0x56ff6a){const _0x3e8609=a160_0x82ce,_0x3cde20=[];if(_0x435397[_0x3e8609(0x1ab)]===_0x3e8609(0x1bb)||_0x435397['type']==='Or'||_0x435397[_0x3e8609(0x1ab)]===_0x3e8609(0x1d4)){if(_0x435397[_0x3e8609(0x1e2)]['length']===0x0)_0x3cde20[_0x3e8609(0x1db)]({'level':_0x3e8609(0x19e),'path':_0x49f43d+_0x3e8609(0x1dc),'code':'EMPTY_CONDITIONS','message':_0x435397[_0x3e8609(0x1ab)]+_0x3e8609(0x1e3),'location':getLocationFromPath(_0x56ff6a[_0x3e8609(0x1b6)],_0x56ff6a[_0x3e8609(0x1cf)],pathToArray(_0x49f43d+'.conditions'))});else{const _0x48a54c=_0x435397[_0x3e8609(0x1ad)]!==undefined,_0x411651=_0x435397[_0x3e8609(0x1ab)]===_0x3e8609(0x1d4);!_0x48a54c&&!_0x411651&&_0x3cde20[_0x3e8609(0x1db)]({'level':_0x3e8609(0x195),'path':_0x49f43d,'code':_0x3e8609(0x1df),'message':_0x435397['type']+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x3e8609(0x1a6)+_0x3e8609(0x1c6),'location':getLocationFromPath(_0x56ff6a[_0x3e8609(0x1b6)],_0x56ff6a[_0x3e8609(0x1cf)],pathToArray(_0x49f43d))}),_0x3cde20['push'](...checkConditions(_0x435397['conditions'],_0x49f43d,_0x56ff6a));}return _0x3cde20;}if(_0x435397[_0x3e8609(0x1ab)]===_0x3e8609(0x1c5)||_0x435397[_0x3e8609(0x1ab)]==='Behavior'){const _0x2b4187=_0x435397,_0x37739d=_0x2b4187[_0x3e8609(0x1cf)],_0x4249c6=_0x2b4187[_0x3e8609(0x1e1)],_0x2fc299=_0x37739d||_0x4249c6,_0x2e4c3b=_0x2b4187[_0x3e8609(0x1c4)]?.[_0x3e8609(0x1ab)];if((_0x2e4c3b===_0x3e8609(0x1c8)||_0x2e4c3b===_0x3e8609(0x1e0))&&_0x2b4187[_0x3e8609(0x1c4)]?.[_0x3e8609(0x1a7)]!==undefined){const _0xc59cd4=_0x2b4187[_0x3e8609(0x1c4)][_0x3e8609(0x1a7)]===!![];_0x3cde20['push']({'level':_0xc59cd4?_0x3e8609(0x19e):'warning','path':_0x49f43d+_0x3e8609(0x1cc),'code':'TEMPORAL_NEGATION_UNSUPPORTED','message':_0xc59cd4?_0x3e8609(0x19a)+_0x2e4c3b+'\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'+'Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.':_0x3e8609(0x19a)+_0x2e4c3b+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+'Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','location':getLocationFromPath(_0x56ff6a[_0x3e8609(0x1b6)],_0x56ff6a[_0x3e8609(0x1cf)],pathToArray(_0x49f43d+_0x3e8609(0x1cc)))});}(!_0x2b4187[_0x3e8609(0x1e7)]||_0x2b4187[_0x3e8609(0x1e7)]==='')&&(!_0x2fc299&&_0x3cde20['push']({'level':'error','path':_0x49f43d+'.attribute','code':_0x3e8609(0x1b8),'message':_0x3e8609(0x1ae),'location':getLocationFromPath(_0x56ff6a[_0x3e8609(0x1b6)],_0x56ff6a['source'],pathToArray(_0x49f43d+_0x3e8609(0x1aa)))}));_0x2b4187[_0x3e8609(0x197)]&&_0x3cde20[_0x3e8609(0x1db)](...checkRule(_0x2b4187[_0x3e8609(0x197)],_0x49f43d+_0x3e8609(0x19b),_0x56ff6a));if(_0x2b4187[_0x3e8609(0x1cf)]){const _0x160444=_0x2b4187[_0x3e8609(0x1e7)]&&_0x2b4187['attribute']!=='';_0x160444&&!_0x2b4187[_0x3e8609(0x197)]&&_0x3cde20[_0x3e8609(0x1db)]({'level':_0x3e8609(0x19e),'path':_0x49f43d+_0x3e8609(0x1a1),'code':_0x3e8609(0x1a9),'message':_0x3e8609(0x198)+_0x2b4187[_0x3e8609(0x1cf)]+_0x3e8609(0x1da)+_0x2b4187[_0x3e8609(0x1e7)]+'\x27\x20'+_0x3e8609(0x1c0)+_0x3e8609(0x196)+_0x3e8609(0x1cd),'location':getLocationFromPath(_0x56ff6a['document'],_0x56ff6a[_0x3e8609(0x1cf)],pathToArray(_0x49f43d+_0x3e8609(0x1a1)))}),_0x160444&&_0x2b4187[_0x3e8609(0x197)]&&_0x3cde20[_0x3e8609(0x1db)]({'level':_0x3e8609(0x195),'path':_0x49f43d+'.attribute','code':_0x3e8609(0x1a4),'message':'Attribute\x20\x27'+_0x2b4187[_0x3e8609(0x1e7)]+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+_0x3e8609(0x1d5),'location':getLocationFromPath(_0x56ff6a[_0x3e8609(0x1b6)],_0x56ff6a[_0x3e8609(0x1cf)],pathToArray(_0x49f43d+'.attribute'))});}}return _0x3cde20;}function a160_0x5b20(){const _0x1942b0=['type','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','description','Attribute\x20name\x20cannot\x20be\x20empty','safeParse','invalid_value','.segment','issues','.conditions[','custom','level','document','.operator.value','EMPTY_ATTRIBUTE','includes','rule','And','9265806hzmvTd','INVALID_OPERATOR_TYPE','INVALID_ARRAY_MATCHING','MISSING_CONDITIONS','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','length','172759QpAKIe','MISSING_OPERATOR_VALUE','operator','Value','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','2dkvKwD','TimeWithinPast','MISSING_NAME','rule.type','data','.operator.not','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','.type','source','8BoprzU','MISSING_TIME_UNIT','validationCode','skipSchema','Composite','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','EMPTY_CONDITIONS','code','413226VoiUzR','2096810yTbBSl','\x27\x20with\x20attribute\x20\x27','push','.conditions','path','.operator.type','NESTED_CONDITION_GROUP','TimeWithinNext','aggregation','conditions','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','20PXlKMG','endsWith','MISSING_BETWEEN_BOUNDS','attribute','warning','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','filter','Behavior\x20source\x20\x27','symbol','Operator\x20\x27','.filter','1013004WEHIlS','1870918bYiyWC','error','map','175800CTvdYt','.source','INVALID_RULE_TYPE','9ccizqI','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','success','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','not','message','BEHAVIOR_SOURCE_MISSING_FILTER','.attribute'];a160_0x5b20=function(){return _0x1942b0;};return a160_0x5b20();}