@treasuredata/tdx 2026.8.6 → 2026.9.0

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 (338) 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/codex-command.d.ts +2 -1
  19. package/dist/commands/codex-command.d.ts.map +1 -1
  20. package/dist/commands/codex-command.js +1 -1
  21. package/dist/commands/codex-command.js.map +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/delivery-command.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  28. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  29. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  30. package/dist/commands/engage-campaign-pull-command.js +1 -1
  31. package/dist/commands/engage-campaign-push-command.js +1 -1
  32. package/dist/commands/engage-campaign-validate-command.js +1 -1
  33. package/dist/commands/engage-command.d.ts +48 -0
  34. package/dist/commands/engage-command.d.ts.map +1 -1
  35. package/dist/commands/engage-command.js +1 -1
  36. package/dist/commands/engage-command.js.map +1 -1
  37. package/dist/commands/engage-landing-page-command.d.ts +48 -0
  38. package/dist/commands/engage-landing-page-command.d.ts.map +1 -0
  39. package/dist/commands/engage-landing-page-command.js +1 -0
  40. package/dist/commands/engage-landing-page-command.js.map +1 -0
  41. package/dist/commands/engage-template-pull-command.js +1 -1
  42. package/dist/commands/engage-template-push-command.js +1 -1
  43. package/dist/commands/engage-template-validate-command.js +1 -1
  44. package/dist/commands/job-command.js +1 -1
  45. package/dist/commands/journey-command.js +1 -1
  46. package/dist/commands/journey-validate-command.js +1 -1
  47. package/dist/commands/llm-command.js +1 -1
  48. package/dist/commands/mcp-command.js +1 -1
  49. package/dist/commands/p13n-command.d.ts +16 -1
  50. package/dist/commands/p13n-command.d.ts.map +1 -1
  51. package/dist/commands/p13n-command.js +1 -1
  52. package/dist/commands/p13n-command.js.map +1 -1
  53. package/dist/commands/parent-segment-command.js +1 -1
  54. package/dist/commands/policy-command.js +1 -1
  55. package/dist/commands/profile-command.js +1 -1
  56. package/dist/commands/profiles-command.js +1 -1
  57. package/dist/commands/query-command.js +1 -1
  58. package/dist/commands/schedule-command.js +1 -1
  59. package/dist/commands/segment-command.js +1 -1
  60. package/dist/commands/segment-create-command.js +1 -1
  61. package/dist/commands/segment-fields-command.js +1 -1
  62. package/dist/commands/segment-move-command.js +1 -1
  63. package/dist/commands/segment-pull-command.js +1 -1
  64. package/dist/commands/segment-push-command.js +1 -1
  65. package/dist/commands/segment-update-command.js +1 -1
  66. package/dist/commands/segment-use-command.js +1 -1
  67. package/dist/commands/segment-validate-command.js +1 -1
  68. package/dist/commands/segments.js +1 -1
  69. package/dist/commands/show.js +1 -1
  70. package/dist/commands/status-command.js +1 -1
  71. package/dist/commands/table-deleted.js +1 -1
  72. package/dist/commands/tables.js +1 -1
  73. package/dist/commands/unset-command.d.ts +1 -0
  74. package/dist/commands/unset-command.d.ts.map +1 -1
  75. package/dist/commands/unset-command.js +1 -1
  76. package/dist/commands/unset-command.js.map +1 -1
  77. package/dist/commands/upgrade-command.js +1 -1
  78. package/dist/commands/use-command.d.ts +1 -0
  79. package/dist/commands/use-command.d.ts.map +1 -1
  80. package/dist/commands/use-command.js +1 -1
  81. package/dist/commands/use-command.js.map +1 -1
  82. package/dist/commands/user-command.js +1 -1
  83. package/dist/commands/work-command.js +1 -1
  84. package/dist/commands/workflow-command.js +1 -1
  85. package/dist/core/auth.js +1 -1
  86. package/dist/core/command-output.js +1 -1
  87. package/dist/core/config.js +1 -1
  88. package/dist/core/connection-cache.js +1 -1
  89. package/dist/core/constants.js +1 -1
  90. package/dist/core/credential-cache.js +1 -1
  91. package/dist/core/global-context.d.ts +1 -0
  92. package/dist/core/global-context.d.ts.map +1 -1
  93. package/dist/core/global-context.js +1 -1
  94. package/dist/core/global-context.js.map +1 -1
  95. package/dist/core/keychain.js +1 -1
  96. package/dist/core/oauth-keychain.js +1 -1
  97. package/dist/core/oauth.js +1 -1
  98. package/dist/core/profile.js +1 -1
  99. package/dist/core/project-config.js +1 -1
  100. package/dist/core/session.d.ts +2 -1
  101. package/dist/core/session.d.ts.map +1 -1
  102. package/dist/core/session.js +1 -1
  103. package/dist/core/session.js.map +1 -1
  104. package/dist/core/site-mismatch.js +1 -1
  105. package/dist/core/user-cache.js +1 -1
  106. package/dist/core/version.js +1 -1
  107. package/dist/index.js +1 -1
  108. package/dist/mcp/server.js +1 -1
  109. package/dist/mcp/tools/index.js +1 -1
  110. package/dist/mcp/tools/tdx-run.d.ts +28 -0
  111. package/dist/mcp/tools/tdx-run.d.ts.map +1 -1
  112. package/dist/mcp/tools/tdx-run.js +1 -1
  113. package/dist/mcp/tools/tdx-run.js.map +1 -1
  114. package/dist/mcp/tools/tdx-search.js +1 -1
  115. package/dist/mcp/tools/work-create-item.js +1 -1
  116. package/dist/mcp/utils.js +1 -1
  117. package/dist/proxy/claude-usage-tracker.js +1 -1
  118. package/dist/proxy/passthrough-server.js +1 -1
  119. package/dist/proxy/sse-usage-parser.js +1 -1
  120. package/dist/sdk/agent/agent-config.js +1 -1
  121. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  122. package/dist/sdk/agent/agent-yaml.js +1 -1
  123. package/dist/sdk/agent/test/evaluator.js +1 -1
  124. package/dist/sdk/agent/test/executor.js +1 -1
  125. package/dist/sdk/agent/test/index.js +1 -1
  126. package/dist/sdk/agent/test/output.js +1 -1
  127. package/dist/sdk/agent/test/parser.js +1 -1
  128. package/dist/sdk/agent/tool-target-registry.js +1 -1
  129. package/dist/sdk/api.js +1 -1
  130. package/dist/sdk/auth-token.js +1 -1
  131. package/dist/sdk/cas/cas-api-client.js +1 -1
  132. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  133. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  134. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  135. package/dist/sdk/cas/cas-segment-schema.js +1 -1
  136. package/dist/sdk/cas/cas-segment-validator.js +1 -1
  137. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  138. package/dist/sdk/cas/index.js +1 -1
  139. package/dist/sdk/cas/pull-workflow.js +1 -1
  140. package/dist/sdk/cas/push-workflow.js +1 -1
  141. package/dist/sdk/cas/validate-files.js +1 -1
  142. package/dist/sdk/client/cdp-api-client.js +1 -1
  143. package/dist/sdk/client/delivery-api-client.js +1 -1
  144. package/dist/sdk/client/endpoints.js +1 -1
  145. package/dist/sdk/client/engage-api-client.d.ts +67 -2
  146. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  147. package/dist/sdk/client/engage-api-client.js +1 -1
  148. package/dist/sdk/client/engage-api-client.js.map +1 -1
  149. package/dist/sdk/client/http-client.js +1 -1
  150. package/dist/sdk/client/llm-api-client.js +1 -1
  151. package/dist/sdk/client/oauth-refresh.js +1 -1
  152. package/dist/sdk/client/p13n-studio-api-client.d.ts +65 -1
  153. package/dist/sdk/client/p13n-studio-api-client.d.ts.map +1 -1
  154. package/dist/sdk/client/p13n-studio-api-client.js +1 -1
  155. package/dist/sdk/client/p13n-studio-api-client.js.map +1 -1
  156. package/dist/sdk/client/rate-limiter.js +1 -1
  157. package/dist/sdk/client/td-api-client.js +1 -1
  158. package/dist/sdk/client/trino-api-client.js +1 -1
  159. package/dist/sdk/client/workflow-client.js +1 -1
  160. package/dist/sdk/connection-validator.js +1 -1
  161. package/dist/sdk/connection.js +1 -1
  162. package/dist/sdk/delivery.js +1 -1
  163. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  164. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  165. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  166. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  167. package/dist/sdk/engage/campaign-pull.js +1 -1
  168. package/dist/sdk/engage/campaign-push.js +1 -1
  169. package/dist/sdk/engage/campaign-validator.js +1 -1
  170. package/dist/sdk/engage/campaign-yaml.js +1 -1
  171. package/dist/sdk/engage/landing-page-init.d.ts +15 -0
  172. package/dist/sdk/engage/landing-page-init.d.ts.map +1 -0
  173. package/dist/sdk/engage/landing-page-init.js +1 -0
  174. package/dist/sdk/engage/landing-page-init.js.map +1 -0
  175. package/dist/sdk/engage/landing-page-public-asset.d.ts +16 -0
  176. package/dist/sdk/engage/landing-page-public-asset.d.ts.map +1 -0
  177. package/dist/sdk/engage/landing-page-public-asset.js +1 -0
  178. package/dist/sdk/engage/landing-page-public-asset.js.map +1 -0
  179. package/dist/sdk/engage/landing-page-pull.d.ts +42 -0
  180. package/dist/sdk/engage/landing-page-pull.d.ts.map +1 -0
  181. package/dist/sdk/engage/landing-page-pull.js +1 -0
  182. package/dist/sdk/engage/landing-page-pull.js.map +1 -0
  183. package/dist/sdk/engage/landing-page-push.d.ts +44 -0
  184. package/dist/sdk/engage/landing-page-push.d.ts.map +1 -0
  185. package/dist/sdk/engage/landing-page-push.js +1 -0
  186. package/dist/sdk/engage/landing-page-push.js.map +1 -0
  187. package/dist/sdk/engage/landing-page-static-site.d.ts +37 -0
  188. package/dist/sdk/engage/landing-page-static-site.d.ts.map +1 -0
  189. package/dist/sdk/engage/landing-page-static-site.js +1 -0
  190. package/dist/sdk/engage/landing-page-static-site.js.map +1 -0
  191. package/dist/sdk/engage/landing-page-validator.d.ts +17 -0
  192. package/dist/sdk/engage/landing-page-validator.d.ts.map +1 -0
  193. package/dist/sdk/engage/landing-page-validator.js +1 -0
  194. package/dist/sdk/engage/landing-page-validator.js.map +1 -0
  195. package/dist/sdk/engage/landing-page-workspace.d.ts +10 -0
  196. package/dist/sdk/engage/landing-page-workspace.d.ts.map +1 -0
  197. package/dist/sdk/engage/landing-page-workspace.js +1 -0
  198. package/dist/sdk/engage/landing-page-workspace.js.map +1 -0
  199. package/dist/sdk/engage/landing-page-yaml.d.ts +20 -0
  200. package/dist/sdk/engage/landing-page-yaml.d.ts.map +1 -0
  201. package/dist/sdk/engage/landing-page-yaml.js +1 -0
  202. package/dist/sdk/engage/landing-page-yaml.js.map +1 -0
  203. package/dist/sdk/engage/template-pull.js +1 -1
  204. package/dist/sdk/engage/template-push.js +1 -1
  205. package/dist/sdk/engage/template-validator.js +1 -1
  206. package/dist/sdk/engage/template-yaml.js +1 -1
  207. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  208. package/dist/sdk/engage/types/campaign-def.js +1 -1
  209. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  210. package/dist/sdk/engage/types/landing-page-schema.d.ts +21 -0
  211. package/dist/sdk/engage/types/landing-page-schema.d.ts.map +1 -0
  212. package/dist/sdk/engage/types/landing-page-schema.js +1 -0
  213. package/dist/sdk/engage/types/landing-page-schema.js.map +1 -0
  214. package/dist/sdk/engage/types/template-schema.js +1 -1
  215. package/dist/sdk/engage.d.ts +97 -2
  216. package/dist/sdk/engage.d.ts.map +1 -1
  217. package/dist/sdk/engage.js +1 -1
  218. package/dist/sdk/engage.js.map +1 -1
  219. package/dist/sdk/errors.js +1 -1
  220. package/dist/sdk/index.d.ts +6 -2
  221. package/dist/sdk/index.d.ts.map +1 -1
  222. package/dist/sdk/index.js +1 -1
  223. package/dist/sdk/index.js.map +1 -1
  224. package/dist/sdk/io/index.js +1 -1
  225. package/dist/sdk/io/node-filesystem.js +1 -1
  226. package/dist/sdk/job.js +1 -1
  227. package/dist/sdk/journey.js +1 -1
  228. package/dist/sdk/llm/chat-cache.js +1 -1
  229. package/dist/sdk/llm/index.js +1 -1
  230. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  231. package/dist/sdk/llm/model-factors.js +1 -1
  232. package/dist/sdk/llm/user-settings.js +1 -1
  233. package/dist/sdk/p13n-studio.d.ts +148 -1
  234. package/dist/sdk/p13n-studio.d.ts.map +1 -1
  235. package/dist/sdk/p13n-studio.js +1 -1
  236. package/dist/sdk/p13n-studio.js.map +1 -1
  237. package/dist/sdk/personalization.js +1 -1
  238. package/dist/sdk/policy.js +1 -1
  239. package/dist/sdk/query/deleted-table-validation.js +1 -1
  240. package/dist/sdk/query/index.js +1 -1
  241. package/dist/sdk/query/sql-parser.js +1 -1
  242. package/dist/sdk/realtime.js +1 -1
  243. package/dist/sdk/schedule.js +1 -1
  244. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  245. package/dist/sdk/segment/fields-display.js +1 -1
  246. package/dist/sdk/segment/file-discovery.js +1 -1
  247. package/dist/sdk/segment/journey-utils.js +1 -1
  248. package/dist/sdk/segment/journey-validator.js +1 -1
  249. package/dist/sdk/segment/journey-yaml.js +1 -1
  250. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  251. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  252. package/dist/sdk/segment/pull-workflow.js +1 -1
  253. package/dist/sdk/segment/push-recovery.js +1 -1
  254. package/dist/sdk/segment/push-workflow.js +1 -1
  255. package/dist/sdk/segment/resolution-context.js +1 -1
  256. package/dist/sdk/segment/segment-path-parser.js +1 -1
  257. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  258. package/dist/sdk/segment/segment-validator.js +1 -1
  259. package/dist/sdk/segment/target-resolution.js +1 -1
  260. package/dist/sdk/segment/tdx-config.js +1 -1
  261. package/dist/sdk/segment/types/activation-schema.js +1 -1
  262. package/dist/sdk/segment/types/journey-def.js +1 -1
  263. package/dist/sdk/segment/types/journey-schema.js +1 -1
  264. package/dist/sdk/segment/types/segment-def.js +1 -1
  265. package/dist/sdk/segment/types/segment-schema.js +1 -1
  266. package/dist/sdk/segment/validate-files.js +1 -1
  267. package/dist/sdk/segment/yaml-validator.d.ts +1 -1
  268. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  269. package/dist/sdk/segment/yaml-validator.js +1 -1
  270. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  271. package/dist/sdk/segment.js +1 -1
  272. package/dist/sdk/types/engage.d.ts +223 -0
  273. package/dist/sdk/types/engage.d.ts.map +1 -1
  274. package/dist/sdk/types/index.d.ts +3 -2
  275. package/dist/sdk/types/index.d.ts.map +1 -1
  276. package/dist/sdk/types/index.js +1 -1
  277. package/dist/sdk/types/index.js.map +1 -1
  278. package/dist/sdk/types/p13n-studio.d.ts +73 -0
  279. package/dist/sdk/types/p13n-studio.d.ts.map +1 -1
  280. package/dist/sdk/types/progress.js +1 -1
  281. package/dist/sdk/types/workspace.js +1 -1
  282. package/dist/sdk/user.js +1 -1
  283. package/dist/sdk/util/format-detector.js +1 -1
  284. package/dist/sdk/util/formatters.js +1 -1
  285. package/dist/sdk/util/index.js +1 -1
  286. package/dist/sdk/util/paginate.js +1 -1
  287. package/dist/sdk/util/tree-formatter.js +1 -1
  288. package/dist/sdk/util/tree-search.js +1 -1
  289. package/dist/sdk/workflow/archive-validation.js +1 -1
  290. package/dist/sdk/workflow/clone-workflow.js +1 -1
  291. package/dist/sdk/workflow/index.js +1 -1
  292. package/dist/sdk/workflow/pull-workflow.js +1 -1
  293. package/dist/sdk/workflow/push-workflow.js +1 -1
  294. package/dist/sdk/workflow/task-graph.js +1 -1
  295. package/dist/sdk/workflow/tdx-config.js +1 -1
  296. package/dist/sdk/workflow/workflow-utils.js +1 -1
  297. package/dist/sdk/workspace/access-tracker.js +1 -1
  298. package/dist/sdk/workspace/frontmatter.js +1 -1
  299. package/dist/sdk/workspace/git.js +1 -1
  300. package/dist/sdk/workspace/index.js +1 -1
  301. package/dist/sdk/workspace/templates.js +1 -1
  302. package/dist/sdk/workspace/weekly.js +1 -1
  303. package/dist/sdk/workspace/wikilinks.js +1 -1
  304. package/dist/test-utils/command-runner.js +1 -1
  305. package/dist/test-utils/factories.js +1 -1
  306. package/dist/test-utils/fixtures.js +1 -1
  307. package/dist/test-utils/http-mock.js +1 -1
  308. package/dist/test-utils/index.js +1 -1
  309. package/dist/utils/async.js +1 -1
  310. package/dist/utils/claude-code-state.js +1 -1
  311. package/dist/utils/colors.js +1 -1
  312. package/dist/utils/diff.js +1 -1
  313. package/dist/utils/file-permissions.js +1 -1
  314. package/dist/utils/file-reader.js +1 -1
  315. package/dist/utils/github-releases.js +1 -1
  316. package/dist/utils/global-cache.js +1 -1
  317. package/dist/utils/json-loader.js +1 -1
  318. package/dist/utils/local-cache.js +1 -1
  319. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  320. package/dist/utils/logger/formatters/index.js +1 -1
  321. package/dist/utils/logger/handlers/console-handler.js +1 -1
  322. package/dist/utils/logger/handlers/file-handler.js +1 -1
  323. package/dist/utils/logger/handlers/index.js +1 -1
  324. package/dist/utils/logger/handlers/null-handler.js +1 -1
  325. package/dist/utils/logger/index.js +1 -1
  326. package/dist/utils/logger/logger.js +1 -1
  327. package/dist/utils/logger/types.js +1 -1
  328. package/dist/utils/option-validation.js +1 -1
  329. package/dist/utils/process.js +1 -1
  330. package/dist/utils/prompt.js +1 -1
  331. package/dist/utils/proxy-fetch.js +1 -1
  332. package/dist/utils/spinner.js +1 -1
  333. package/dist/utils/sse-parser.js +1 -1
  334. package/dist/utils/string-utils.js +1 -1
  335. package/dist/utils/table-ref-parser.js +1 -1
  336. package/dist/utils/tdx-logger.js +1 -1
  337. package/dist/utils/version-check.js +1 -1
  338. package/package.json +1 -1
@@ -1 +1 @@
1
- const a45_0x42bbdd=a45_0x26c3;(function(_0x16623d,_0x285316){const _0x4b0b61=a45_0x26c3,_0x5588a5=_0x16623d();while(!![]){try{const _0x2c60c2=-parseInt(_0x4b0b61(0xf5))/0x1*(-parseInt(_0x4b0b61(0xd4))/0x2)+parseInt(_0x4b0b61(0xe1))/0x3+-parseInt(_0x4b0b61(0xe0))/0x4+-parseInt(_0x4b0b61(0x105))/0x5*(parseInt(_0x4b0b61(0xda))/0x6)+parseInt(_0x4b0b61(0xd0))/0x7*(parseInt(_0x4b0b61(0xf8))/0x8)+-parseInt(_0x4b0b61(0x10f))/0x9*(-parseInt(_0x4b0b61(0x112))/0xa)+-parseInt(_0x4b0b61(0x119))/0xb;if(_0x2c60c2===_0x285316)break;else _0x5588a5['push'](_0x5588a5['shift']());}catch(_0x364df1){_0x5588a5['push'](_0x5588a5['shift']());}}}(a45_0x2f10,0x4f7a0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';function a45_0x26c3(_0x346c7c,_0x2953d6){_0x346c7c=_0x346c7c-0xce;const _0x2f100e=a45_0x2f10();let _0x26c3c4=_0x2f100e[_0x346c7c];return _0x26c3c4;}function a45_0x2f10(){const _0x5722b6=['data','forEach','cyan','join','resolveEntitiesInParent','1715688rpyeQN','231426yRrkJq','dryRun','error','ruleConditionCount','path','segment:move','segment','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','some','segmentFolderId','filter','\x20segment(s)\x20would\x20be\x20moved.','\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:','preserved:','\x20\x20•\x20','\x20(verified\x20by\x20re-read)','type','folder','\x27\x20to\x20folder\x20\x27','20dxBopG','\x27\x20—\x20','\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','64uGKNup','push','Duplicate\x20segments\x20removed\x20(','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','rule\x20','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact','\x27...','folderId','\x20folder\x20\x27','\x20condition','Searching\x20folders\x20for\x20\x27','290WkrRpU','map','description','Segments:\x20','SEGMENT_NOT_FOUND','length','[dry-run]\x20No\x20changes\x20made.\x20','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','slot','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','819zwdcKP','Target\x20folder:\x20','explainAmbiguousName','56600rjgsJn','for\x20move\x20to','Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).','execute','parentId','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','get','1809170fDvtBK','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','red','moveSegments','includes','verbose','parentSegment','\x20\x20(id\x20','Examples:','listRecursive','set','384587sSegtK','Searching\x20the\x20tree...','resolvePathToResource','✔\x20Moved\x20segment\x20\x27','36622rmfOCK','code','name','test','toLowerCase','\x20→\x20','49554ndLkGs'];a45_0x2f10=function(){return _0x5722b6;};return a45_0x2f10();}import a45_0x4bcd3f from'chalk';export class SegmentMoveCommand extends BaseCommand{[a45_0x42bbdd(0xd6)]=a45_0x42bbdd(0xe6);[a45_0x42bbdd(0x107)]='Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder';async[a45_0x42bbdd(0x115)](_0x4e1528){const _0x2f9b01=a45_0x42bbdd,{options:_0xab77cc,args:_0x5b8040,tdx:_0x38edc0}=_0x4e1528,_0x3a7d3a=_0x5b8040,_0x4e38de=_0xab77cc[_0x2f9b01(0xf3)];if(_0x3a7d3a[_0x2f9b01(0x10a)]===0x0||!_0x4e38de)return console['error'](a45_0x4bcd3f[_0x2f9b01(0x11b)](_0x2f9b01(0x117))),console[_0x2f9b01(0xe3)](_0x2f9b01(0x10c)),console[_0x2f9b01(0xe3)](_0x2f9b01(0x121)),console[_0x2f9b01(0xe3)](_0x2f9b01(0xfe)),console[_0x2f9b01(0xe3)]('\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501'),console[_0x2f9b01(0xe3)](_0x2f9b01(0xf7)),console[_0x2f9b01(0xe3)](_0x2f9b01(0x10e)),0x1;_0xab77cc[_0x2f9b01(0x11e)]&&(console['error'](_0x2f9b01(0x108)+_0x3a7d3a[_0x2f9b01(0xde)](',\x20')),console['error'](_0x2f9b01(0x110)+_0x4e38de));const _0x230778=[...new Set(_0x3a7d3a)];_0x230778[_0x2f9b01(0x10a)]<_0x3a7d3a[_0x2f9b01(0x10a)]&&console['error'](a45_0x4bcd3f['yellow'](_0x2f9b01(0xfa)+_0x3a7d3a['length']+_0x2f9b01(0xd9)+_0x230778[_0x2f9b01(0x10a)]+').'));const _0x50dd7d=/^\d+$/,_0x5ecbd8=_0xab77cc[_0x2f9b01(0x11f)],_0x509758=[..._0x230778,_0x4e38de][_0x2f9b01(0xea)](_0x41def5=>!_0x50dd7d[_0x2f9b01(0xd7)](_0x41def5));if(_0x509758&&!_0x5ecbd8)return console[_0x2f9b01(0xe3)](a45_0x4bcd3f[_0x2f9b01(0x11b)](_0x2f9b01(0xfb))),console[_0x2f9b01(0xe3)](_0x2f9b01(0x11a)),console[_0x2f9b01(0xe3)](_0x2f9b01(0xe9)),console[_0x2f9b01(0xe3)]('Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)'),0x1;const _0x5b5d44=_0x230778[_0x2f9b01(0x10a)],_0x3260ca=_0xab77cc[_0x2f9b01(0xe2)]===!![];let _0x2f0ba3;try{const _0x1002f1=await withSpinner((_0x3260ca?'Checking':'Moving')+'\x20'+_0x5b5d44+'\x20segment'+(_0x5b5d44===0x1?'':'s')+'\x20'+((_0x3260ca?_0x2f9b01(0x113):'to')+_0x2f9b01(0x102)+_0x4e38de+'\x27...'),async()=>{const _0x940a64=_0x2f9b01,_0x2c1a10=[];_0x230778[_0x940a64(0xdc)]((_0x1a694f,_0x3970aa)=>{const _0x202c91=_0x940a64;if(!_0x50dd7d[_0x202c91(0xd7)](_0x1a694f))_0x2c1a10['push']({'name':_0x1a694f,'expectType':_0x202c91(0xe7),'slot':_0x3970aa});});if(!_0x50dd7d['test'](_0x4e38de))_0x2c1a10[_0x940a64(0xf9)]({'name':_0x4e38de,'expectType':_0x940a64(0xf3),'slot':-0x1});const _0x4d0b35=new Map();if(_0x2c1a10[_0x940a64(0x10a)]>0x0){const _0x390f67=await _0x38edc0['segment'][_0x940a64(0xdf)](_0x5ecbd8,_0x2c1a10[_0x940a64(0x106)](({name:_0x3df38a,expectType:_0x51e1b7})=>({'name':_0x3df38a,'expectType':_0x51e1b7})));_0x390f67[_0x940a64(0xdc)]((_0x3b8449,_0x1c12df)=>_0x4d0b35[_0x940a64(0xcf)](_0x2c1a10[_0x1c12df][_0x940a64(0x10d)],_0x3b8449['id']));}const _0x2ebe74=_0x230778[_0x940a64(0x106)]((_0xc3d856,_0x2e2e20)=>_0x50dd7d[_0x940a64(0xd7)](_0xc3d856)?_0xc3d856:_0x4d0b35[_0x940a64(0x118)](_0x2e2e20)),_0x19ee8c=_0x50dd7d[_0x940a64(0xd7)](_0x4e38de)?_0x4e38de:_0x4d0b35['get'](-0x1);return _0x38edc0[_0x940a64(0xe7)][_0x940a64(0x11c)](_0x2ebe74,_0x19ee8c,_0x3260ca);},{'verbose':_0xab77cc[_0x2f9b01(0x11e)]});_0x2f0ba3=_0x1002f1[_0x2f9b01(0xdb)];}catch(_0x6b2dce){if(_0x6b2dce instanceof SDKError&&_0x6b2dce[_0x2f9b01(0xd5)]===ErrorCode[_0x2f9b01(0x109)]&&_0x5ecbd8)try{if(await this[_0x2f9b01(0x111)](_0x38edc0,_0x5ecbd8,_0x230778,_0xab77cc))return 0x1;}catch{}throw _0x6b2dce;}for(const _0x1a97e3 of _0x2f0ba3){const _0x2fc161=_0x1a97e3[_0x2f9b01(0xe4)],_0x5c30ae=_0x2f9b01(0xfd)+(_0x3260ca?'has':_0x2f9b01(0xef))+'\x20'+_0x2fc161+_0x2f9b01(0x103)+(_0x2fc161===0x1?'':'s');console[_0x2f9b01(0xe3)](_0x3260ca?a45_0x4bcd3f[_0x2f9b01(0xdd)](_0x2f9b01(0xfc)+_0x1a97e3['id']+'\x27\x20to\x20folder\x20\x27'+_0x1a97e3[_0x2f9b01(0xeb)]+_0x2f9b01(0xf6)+_0x5c30ae):a45_0x4bcd3f['green'](_0x2f9b01(0xd3)+_0x1a97e3['id']+_0x2f9b01(0xf4)+_0x1a97e3[_0x2f9b01(0xeb)]+_0x2f9b01(0xf6)+_0x5c30ae+_0x2f9b01(0xf1)));}if(_0x3260ca)console[_0x2f9b01(0xe3)](a45_0x4bcd3f[_0x2f9b01(0xdd)](_0x2f9b01(0x10b)+_0x5b5d44+_0x2f9b01(0xed)));else _0x2f0ba3[_0x2f9b01(0x10a)]>0x1&&console[_0x2f9b01(0xe3)](a45_0x4bcd3f['green']('✔\x20'+_0x2f0ba3[_0x2f9b01(0x10a)]+_0x2f9b01(0xff)));return await handleSDKOutput(_0x2f0ba3,_0xab77cc),0x0;}async[a45_0x42bbdd(0x111)](_0x169bd0,_0x5cc8e0,_0x308e71,_0x56ef99){const _0x2cd553=a45_0x42bbdd,_0xa81515=_0x308e71['filter'](_0x1ee104=>!/^\d+$/['test'](_0x1ee104)&&!_0x1ee104[_0x2cd553(0x11d)]('/'));if(_0xa81515['length']===0x0)return![];const _0x4475db=await withSpinner(_0x2cd553(0x104)+_0xa81515[_0x2cd553(0xde)]('\x27,\x20\x27')+_0x2cd553(0x100),()=>_0x169bd0[_0x2cd553(0xe7)][_0x2cd553(0xd2)](_0x5cc8e0),{'verbose':_0x56ef99[_0x2cd553(0x11e)]}),_0xa98f6e=(await withSpinner(_0x2cd553(0xd1),()=>_0x169bd0[_0x2cd553(0xe7)][_0x2cd553(0xce)](_0x4475db[_0x2cd553(0xdb)][_0x2cd553(0x116)],_0x4475db[_0x2cd553(0xdb)][_0x2cd553(0x101)],0x0,0xa),{'verbose':_0x56ef99[_0x2cd553(0x11e)]}))[_0x2cd553(0xdb)];let _0x3c85e8=![];for(const _0x245c06 of _0xa81515){const _0x2431d1=searchTreeByName(_0xa98f6e,_0x245c06)[_0x2cd553(0xec)](_0xea482c=>_0xea482c[_0x2cd553(0xf2)]===_0x2cd553(0xe7)&&_0xea482c[_0x2cd553(0xd6)][_0x2cd553(0xd8)]()===_0x245c06['toLowerCase']());if(_0x2431d1[_0x2cd553(0x10a)]>0x1){_0x3c85e8=!![],console[_0x2cd553(0xe3)](a45_0x4bcd3f[_0x2cd553(0x11b)]('Error:\x20\x27'+_0x245c06+'\x27\x20matches\x20'+_0x2431d1[_0x2cd553(0x10a)]+_0x2cd553(0xee)));for(const _0x442c62 of _0x2431d1)console[_0x2cd553(0xe3)](_0x2cd553(0xf0)+_0x442c62['path']+_0x2cd553(0x120)+_0x442c62['id']+')');}else _0x2431d1[_0x2cd553(0x10a)]===0x1&&(_0x3c85e8=!![],console[_0x2cd553(0xe3)](a45_0x4bcd3f[_0x2cd553(0x11b)]('Error:\x20\x27'+_0x245c06+_0x2cd553(0xe8))),console[_0x2cd553(0xe3)]('\x20\x20'+_0x2431d1[0x0][_0x2cd553(0xe5)]+'\x20\x20(id\x20'+_0x2431d1[0x0]['id']+')'),console[_0x2cd553(0xe3)](_0x2cd553(0x114)));}return _0x3c85e8;}}
1
+ const a46_0x514e60=a46_0x47e5;(function(_0x50b60d,_0x25af86){const _0x43b4d4=a46_0x47e5,_0x314d2d=_0x50b60d();while(!![]){try{const _0xe53e77=-parseInt(_0x43b4d4(0x153))/0x1*(parseInt(_0x43b4d4(0x141))/0x2)+parseInt(_0x43b4d4(0x12c))/0x3*(parseInt(_0x43b4d4(0x129))/0x4)+parseInt(_0x43b4d4(0x126))/0x5*(parseInt(_0x43b4d4(0x142))/0x6)+parseInt(_0x43b4d4(0x151))/0x7*(parseInt(_0x43b4d4(0x127))/0x8)+parseInt(_0x43b4d4(0x131))/0x9*(parseInt(_0x43b4d4(0x166))/0xa)+parseInt(_0x43b4d4(0x13b))/0xb*(-parseInt(_0x43b4d4(0x11c))/0xc)+parseInt(_0x43b4d4(0x163))/0xd;if(_0xe53e77===_0x25af86)break;else _0x314d2d['push'](_0x314d2d['shift']());}catch(_0x117b20){_0x314d2d['push'](_0x314d2d['shift']());}}}(a46_0x2177,0xbabfc));function a46_0x2177(){const _0x5bf9c3=['parentId','\x20segment','5TXptEA','4327320eJbGuV','cyan','8VTgVMj','\x20→\x20','forEach','1367910hkAYsQ','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','join','\x20(verified\x20by\x20re-read)','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','711vtCyMR','dryRun','SEGMENT_NOT_FOUND','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:','execute','slot','explainAmbiguousName','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','path','segment','1221pQqvRS','\x20folder\x20\x27','has','Searching\x20the\x20tree...','Searching\x20folders\x20for\x20\x27','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','192646hgtdcl','522666NuOpys','test','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','listRecursive','\x20\x20•\x20','includes','Moving','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','\x27\x20to\x20folder\x20\x27','Target\x20folder:\x20','description','\x27,\x20\x27','red','parentSegment','Duplicate\x20segments\x20removed\x20(','7JFKdbx','name','8TEWwQn','filter','preserved:','\x27\x20—\x20','error','toLowerCase','data','\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','folder','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','[dry-run]\x20No\x20changes\x20made.\x20','\x27...','moveSegments','folderId','\x20condition','1137058sTEjoZ','✔\x20Moved\x20segment\x20\x27','map','12770SCIQXp','segment:move','Error:\x20\x27','push','\x20\x20(id\x20','length','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','20844ZtokNT','segmentFolderId','get','for\x20move\x20to','verbose','type','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','green'];a46_0x2177=function(){return _0x5bf9c3;};return a46_0x2177();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import a46_0x141047 from'chalk';function a46_0x47e5(_0x5ad709,_0x11844f){_0x5ad709=_0x5ad709-0x118;const _0x217716=a46_0x2177();let _0x47e5f2=_0x217716[_0x5ad709];return _0x47e5f2;}export class SegmentMoveCommand extends BaseCommand{['name']=a46_0x514e60(0x167);[a46_0x514e60(0x14c)]=a46_0x514e60(0x149);async[a46_0x514e60(0x135)](_0x48fb4b){const _0x1f79a2=a46_0x514e60,{options:_0x4a8476,args:_0x94c818,tdx:_0x42affd}=_0x48fb4b,_0x1bd0ab=_0x94c818,_0x1eb43e=_0x4a8476[_0x1f79a2(0x15b)];if(_0x1bd0ab[_0x1f79a2(0x11a)]===0x0||!_0x1eb43e)return console[_0x1f79a2(0x157)](a46_0x141047['red'](_0x1f79a2(0x12d))),console[_0x1f79a2(0x157)](_0x1f79a2(0x15d)),console[_0x1f79a2(0x157)]('Examples:'),console[_0x1f79a2(0x157)](_0x1f79a2(0x11b)),console[_0x1f79a2(0x157)](_0x1f79a2(0x122)),console['error'](_0x1f79a2(0x15a)),console['error'](_0x1f79a2(0x144)),0x1;_0x4a8476[_0x1f79a2(0x120)]&&(console[_0x1f79a2(0x157)]('Segments:\x20'+_0x1bd0ab[_0x1f79a2(0x12e)](',\x20')),console['error'](_0x1f79a2(0x14b)+_0x1eb43e));const _0x33b971=[...new Set(_0x1bd0ab)];_0x33b971['length']<_0x1bd0ab[_0x1f79a2(0x11a)]&&console[_0x1f79a2(0x157)](a46_0x141047['yellow'](_0x1f79a2(0x150)+_0x1bd0ab[_0x1f79a2(0x11a)]+_0x1f79a2(0x12a)+_0x33b971[_0x1f79a2(0x11a)]+').'));const _0x163190=/^\d+$/,_0x316c89=_0x4a8476[_0x1f79a2(0x14f)],_0xca93db=[..._0x33b971,_0x1eb43e]['some'](_0x3c452c=>!_0x163190[_0x1f79a2(0x143)](_0x3c452c));if(_0xca93db&&!_0x316c89)return console[_0x1f79a2(0x157)](a46_0x141047[_0x1f79a2(0x14e)]('Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a')),console[_0x1f79a2(0x157)](_0x1f79a2(0x130)),console[_0x1f79a2(0x157)](_0x1f79a2(0x140)),console[_0x1f79a2(0x157)](_0x1f79a2(0x15c)),0x1;const _0x27051e=_0x33b971['length'],_0x2fdb88=_0x4a8476[_0x1f79a2(0x132)]===!![];let _0x9b2c5f;try{const _0x875051=await withSpinner((_0x2fdb88?'Checking':_0x1f79a2(0x148))+'\x20'+_0x27051e+_0x1f79a2(0x125)+(_0x27051e===0x1?'':'s')+'\x20'+((_0x2fdb88?_0x1f79a2(0x11f):'to')+_0x1f79a2(0x13c)+_0x1eb43e+_0x1f79a2(0x15f)),async()=>{const _0x5af625=_0x1f79a2,_0x268678=[];_0x33b971[_0x5af625(0x12b)]((_0x5aa85f,_0x1339d4)=>{const _0x3c5a40=_0x5af625;if(!_0x163190[_0x3c5a40(0x143)](_0x5aa85f))_0x268678[_0x3c5a40(0x118)]({'name':_0x5aa85f,'expectType':'segment','slot':_0x1339d4});});if(!_0x163190[_0x5af625(0x143)](_0x1eb43e))_0x268678[_0x5af625(0x118)]({'name':_0x1eb43e,'expectType':'folder','slot':-0x1});const _0x6fbf89=new Map();if(_0x268678[_0x5af625(0x11a)]>0x0){const _0x247273=await _0x42affd[_0x5af625(0x13a)]['resolveEntitiesInParent'](_0x316c89,_0x268678[_0x5af625(0x165)](({name:_0x3eeedb,expectType:_0x26443b})=>({'name':_0x3eeedb,'expectType':_0x26443b})));_0x247273[_0x5af625(0x12b)]((_0x22d08f,_0x516b0d)=>_0x6fbf89['set'](_0x268678[_0x516b0d][_0x5af625(0x136)],_0x22d08f['id']));}const _0x1a4e1f=_0x33b971[_0x5af625(0x165)]((_0x2edbc9,_0x3b62c9)=>_0x163190['test'](_0x2edbc9)?_0x2edbc9:_0x6fbf89[_0x5af625(0x11e)](_0x3b62c9)),_0x44820f=_0x163190[_0x5af625(0x143)](_0x1eb43e)?_0x1eb43e:_0x6fbf89['get'](-0x1);return _0x42affd[_0x5af625(0x13a)][_0x5af625(0x160)](_0x1a4e1f,_0x44820f,_0x2fdb88);},{'verbose':_0x4a8476[_0x1f79a2(0x120)]});_0x9b2c5f=_0x875051['data'];}catch(_0xa6416){if(_0xa6416 instanceof SDKError&&_0xa6416['code']===ErrorCode[_0x1f79a2(0x133)]&&_0x316c89)try{if(await this['explainAmbiguousName'](_0x42affd,_0x316c89,_0x33b971,_0x4a8476))return 0x1;}catch{}throw _0xa6416;}for(const _0x22edd0 of _0x9b2c5f){const _0xc0eb0f=_0x22edd0['ruleConditionCount'],_0x32c0b6='rule\x20'+(_0x2fdb88?_0x1f79a2(0x13d):_0x1f79a2(0x155))+'\x20'+_0xc0eb0f+_0x1f79a2(0x162)+(_0xc0eb0f===0x1?'':'s');console['error'](_0x2fdb88?a46_0x141047[_0x1f79a2(0x128)](_0x1f79a2(0x138)+_0x22edd0['id']+_0x1f79a2(0x14a)+_0x22edd0['segmentFolderId']+_0x1f79a2(0x156)+_0x32c0b6):a46_0x141047[_0x1f79a2(0x123)](_0x1f79a2(0x164)+_0x22edd0['id']+'\x27\x20to\x20folder\x20\x27'+_0x22edd0[_0x1f79a2(0x11d)]+_0x1f79a2(0x156)+_0x32c0b6+_0x1f79a2(0x12f)));}if(_0x2fdb88)console['error'](a46_0x141047[_0x1f79a2(0x128)](_0x1f79a2(0x15e)+_0x27051e+'\x20segment(s)\x20would\x20be\x20moved.'));else _0x9b2c5f[_0x1f79a2(0x11a)]>0x1&&console[_0x1f79a2(0x157)](a46_0x141047[_0x1f79a2(0x123)]('✔\x20'+_0x9b2c5f[_0x1f79a2(0x11a)]+'\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact'));return await handleSDKOutput(_0x9b2c5f,_0x4a8476),0x0;}async[a46_0x514e60(0x137)](_0x3acadb,_0x36dbb3,_0x58ee77,_0x5cca3c){const _0x592d6d=a46_0x514e60,_0x5ee228=_0x58ee77[_0x592d6d(0x154)](_0x3e6ce3=>!/^\d+$/[_0x592d6d(0x143)](_0x3e6ce3)&&!_0x3e6ce3[_0x592d6d(0x147)]('/'));if(_0x5ee228[_0x592d6d(0x11a)]===0x0)return![];const _0x438e88=await withSpinner(_0x592d6d(0x13f)+_0x5ee228[_0x592d6d(0x12e)](_0x592d6d(0x14d))+_0x592d6d(0x15f),()=>_0x3acadb['segment']['resolvePathToResource'](_0x36dbb3),{'verbose':_0x5cca3c[_0x592d6d(0x120)]}),_0x3a9545=(await withSpinner(_0x592d6d(0x13e),()=>_0x3acadb['segment'][_0x592d6d(0x145)](_0x438e88[_0x592d6d(0x159)][_0x592d6d(0x124)],_0x438e88[_0x592d6d(0x159)][_0x592d6d(0x161)],0x0,0xa),{'verbose':_0x5cca3c[_0x592d6d(0x120)]}))[_0x592d6d(0x159)];let _0x53da3e=![];for(const _0x1ff699 of _0x5ee228){const _0x153a98=searchTreeByName(_0x3a9545,_0x1ff699)[_0x592d6d(0x154)](_0x28a662=>_0x28a662[_0x592d6d(0x121)]===_0x592d6d(0x13a)&&_0x28a662[_0x592d6d(0x152)][_0x592d6d(0x158)]()===_0x1ff699['toLowerCase']());if(_0x153a98[_0x592d6d(0x11a)]>0x1){_0x53da3e=!![],console[_0x592d6d(0x157)](a46_0x141047[_0x592d6d(0x14e)](_0x592d6d(0x168)+_0x1ff699+'\x27\x20matches\x20'+_0x153a98[_0x592d6d(0x11a)]+'\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:'));for(const _0x4ca2fa of _0x153a98)console[_0x592d6d(0x157)](_0x592d6d(0x146)+_0x4ca2fa[_0x592d6d(0x139)]+_0x592d6d(0x119)+_0x4ca2fa['id']+')');}else _0x153a98[_0x592d6d(0x11a)]===0x1&&(_0x53da3e=!![],console[_0x592d6d(0x157)](a46_0x141047[_0x592d6d(0x14e)]('Error:\x20\x27'+_0x1ff699+_0x592d6d(0x134))),console['error']('\x20\x20'+_0x153a98[0x0]['path']+_0x592d6d(0x119)+_0x153a98[0x0]['id']+')'),console[_0x592d6d(0x157)]('Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).'));}return _0x53da3e;}}
@@ -1 +1 @@
1
- const a46_0x1fd78f=a46_0x5c9d;(function(_0x24ed2d,_0x15e16a){const _0x235af2=a46_0x5c9d,_0xaedc6c=_0x24ed2d();while(!![]){try{const _0x281505=-parseInt(_0x235af2(0x14f))/0x1*(parseInt(_0x235af2(0x14e))/0x2)+parseInt(_0x235af2(0x11a))/0x3+parseInt(_0x235af2(0x151))/0x4*(-parseInt(_0x235af2(0x146))/0x5)+-parseInt(_0x235af2(0x158))/0x6+-parseInt(_0x235af2(0x115))/0x7+-parseInt(_0x235af2(0x124))/0x8*(parseInt(_0x235af2(0x13d))/0x9)+parseInt(_0x235af2(0x122))/0xa*(parseInt(_0x235af2(0x12b))/0xb);if(_0x281505===_0x15e16a)break;else _0xaedc6c['push'](_0xaedc6c['shift']());}catch(_0x28ffd8){_0xaedc6c['push'](_0xaedc6c['shift']());}}}(a46_0xb9b2,0x1f230));function a46_0x5c9d(_0x13b9aa,_0x1f2571){_0x13b9aa=_0x13b9aa-0x112;const _0xb9b2d8=a46_0xb9b2();let _0x5c9d85=_0xb9b2d8[_0x13b9aa];return _0x5c9d85;}import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a46_0x48c3a0 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a46_0x39e974 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a46_0xb9b2(){const _0x13375f=['journeyVersions','parent_segment','name','Aborted.','Error:\x20','message','994LzRdsq','55ydEDFd','helpText','92072vSSUyC','journeys','red','content','parentSegment','description','execute','1487544uWnhyx','length','\x20=\x20','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','-\x20no\x20files\x20written','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','dryRun','Site:\x20','verbose','dim','✔\x20Context\x20set:\x20','error','\x20unchanged\x20files','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','✔\x20All\x20files\x20are\x20up\x20to\x20date','relativePath','Target\x20resource:\x20','cwd','type','462833KjJAvy','\x20new\x20files','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Parent\x20segment:\x20','\x20segments','713277ewXesp','session','segment:pull','hasChanges','file','green','targetDir','yellow','50FSOMKs','Write\x20','744HfNMhy','dirname','diff','\x20\x20🗺️\x20\x20','files','segment','pullSegments','1030997yzoFBD','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x0aPull\x20summary\x20for\x20\x27','filter','\x20files\x20to\x20','utf-8','cyan','\x20files?','\x20\x20🎯\x20','\x20journeys','repeat','errorCode','absolutePath','activations','isNew','resourceName','\x20activations','counts','2934cODsUT','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','segments','data','site','\x20versions)','no_parent','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','45WdSljz','parentName'];a46_0xb9b2=function(){return _0x13375f;};return a46_0xb9b2();}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a46_0x1fd78f(0x14a)]=a46_0x1fd78f(0x11c);[a46_0x1fd78f(0x156)]=a46_0x1fd78f(0x15b);async[a46_0x1fd78f(0x157)](_0x15cbac){const _0x3ef8af=a46_0x1fd78f,{options:_0x114d3b,args:_0x2c1788,tdx:_0x46bfa9}=_0x15cbac,_0x17ad6c=_0x114d3b,_0x16cfdd=await resolveTarget({'arg':_0x2c1788[0x0],'contextParent':_0x114d3b[_0x3ef8af(0x155)],'cwd':process[_0x3ef8af(0x113)]()});if(!isSuccessfulResolution(_0x16cfdd))return _0x16cfdd[_0x3ef8af(0x136)]===_0x3ef8af(0x144)?(console['error'](a46_0x48c3a0['yellow'](_0x3ef8af(0x145))),console[_0x3ef8af(0x163)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console['error'](_0x3ef8af(0x13e)),console[_0x3ef8af(0x163)](_0x3ef8af(0x13f))):(console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x153)](_0x3ef8af(0x14c)+_0x16cfdd[_0x3ef8af(0x14d)]+'\x0a')),_0x16cfdd[_0x3ef8af(0x150)]&&console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x131)](_0x16cfdd[_0x3ef8af(0x150)]))),0x1;const _0x4ace41=_0x16cfdd[_0x3ef8af(0x147)],_0x5179b0=_0x16cfdd['targetDir'],_0x288b42=_0x16cfdd[_0x3ef8af(0x114)]===_0x3ef8af(0x11e)?_0x16cfdd[_0x3ef8af(0x13a)]:undefined;_0x17ad6c[_0x3ef8af(0x160)]&&(console[_0x3ef8af(0x163)](_0x3ef8af(0x15f)+_0x17ad6c[_0x3ef8af(0x142)]),console[_0x3ef8af(0x163)](_0x3ef8af(0x118)+_0x4ace41),_0x288b42&&console[_0x3ef8af(0x163)](_0x3ef8af(0x112)+_0x288b42));const _0x194de0=await withProgressSpinner('Pulling\x20segments\x20from\x20\x27'+_0x4ace41+'\x27...',_0x396c69=>_0x46bfa9[_0x3ef8af(0x129)][_0x3ef8af(0x12a)](_0x4ace41,{'targetDir':_0x5179b0,'targetResourceName':_0x288b42,'verbose':_0x17ad6c['verbose'],'progress':{'update':_0x19784e=>{const _0xf21c87=_0x3ef8af;_0x396c69['setPhase'](_0x19784e),_0x17ad6c['verbose']&&console[_0xf21c87(0x163)]('\x20\x20'+_0x19784e);}}}),{'verbose':_0x17ad6c['verbose']}),_0x3377cd=_0x194de0[_0x3ef8af(0x141)];if(_0x3377cd[_0x3ef8af(0x13c)][_0x3ef8af(0x140)]===0x0&&_0x3377cd['counts'][_0x3ef8af(0x152)]===0x0)return console[_0x3ef8af(0x163)](a46_0x48c3a0['yellow'](_0x3ef8af(0x165)+_0x3377cd[_0x3ef8af(0x147)]+'\x27')),0x0;const _0x1ac417=_0x3377cd['files'][_0x3ef8af(0x12e)](_0x2f9577=>_0x2f9577[_0x3ef8af(0x139)]),_0x47bf52=_0x3377cd[_0x3ef8af(0x128)]['filter'](_0x62243=>!_0x62243[_0x3ef8af(0x139)]&&_0x62243[_0x3ef8af(0x11d)]),_0x485f99=_0x3377cd[_0x3ef8af(0x128)][_0x3ef8af(0x12e)](_0x2709ea=>!_0x2709ea['isNew']&&!_0x2709ea[_0x3ef8af(0x11d)]);console[_0x3ef8af(0x163)](_0x3ef8af(0x12d)+_0x3377cd[_0x3ef8af(0x147)]+'\x27:'),console[_0x3ef8af(0x163)](_0x3ef8af(0x133)+a46_0x48c3a0[_0x3ef8af(0x131)](_0x3377cd[_0x3ef8af(0x13c)]['segments']+_0x3ef8af(0x119))+'\x20with\x20'+a46_0x48c3a0['cyan'](_0x3377cd[_0x3ef8af(0x13c)][_0x3ef8af(0x138)]+_0x3ef8af(0x13b)));if(_0x3377cd[_0x3ef8af(0x13c)][_0x3ef8af(0x152)]>0x0){const _0x4e7df9=_0x3377cd[_0x3ef8af(0x13c)][_0x3ef8af(0x148)]>_0x3377cd[_0x3ef8af(0x13c)][_0x3ef8af(0x152)]?'\x20('+_0x3377cd[_0x3ef8af(0x13c)]['journeyVersions']+_0x3ef8af(0x143):'';console['error'](_0x3ef8af(0x127)+a46_0x48c3a0[_0x3ef8af(0x131)](_0x3377cd[_0x3ef8af(0x13c)][_0x3ef8af(0x152)]+_0x3ef8af(0x134))+a46_0x48c3a0['dim'](_0x4e7df9));}console['error']('\x20\x20'+a46_0x48c3a0[_0x3ef8af(0x11f)]('+\x20'+_0x1ac417[_0x3ef8af(0x159)]+_0x3ef8af(0x116))),console['error']('\x20\x20'+a46_0x48c3a0[_0x3ef8af(0x121)]('~\x20'+_0x47bf52['length']+'\x20changed\x20files')),console[_0x3ef8af(0x163)]('\x20\x20'+a46_0x48c3a0[_0x3ef8af(0x161)]('=\x20'+_0x485f99['length']+_0x3ef8af(0x164))),console[_0x3ef8af(0x163)]('\x20\x20Target:\x20'+a46_0x48c3a0['cyan'](_0x3377cd['targetDir'])+'\x0a');if(_0x47bf52[_0x3ef8af(0x159)]>0x0)for(const _0x305915 of _0x47bf52){console[_0x3ef8af(0x163)]('\x0aChanges\x20to\x20\x27'+_0x305915[_0x3ef8af(0x167)]+'\x27:'),console['error']('─'[_0x3ef8af(0x135)](0x3c)),console[_0x3ef8af(0x163)](_0x305915[_0x3ef8af(0x126)]),console[_0x3ef8af(0x163)]('─'['repeat'](0x3c));}if(_0x17ad6c[_0x3ef8af(0x15e)])return console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x121)](_0x3ef8af(0x117))),0x0;if(_0x1ac417['length']===0x0&&_0x47bf52[_0x3ef8af(0x159)]===0x0)return console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x11f)](_0x3ef8af(0x166))),saveSessionContext({'parent_segment':_0x3377cd['parentName']},_0x17ad6c[_0x3ef8af(0x11b)]),console[_0x3ef8af(0x163)](a46_0x48c3a0['green'](_0x3ef8af(0x162)+a46_0x48c3a0[_0x3ef8af(0x161)](_0x3ef8af(0x149))+_0x3ef8af(0x15a)+a46_0x48c3a0['cyan'](_0x3377cd[_0x3ef8af(0x147)]))),0x0;if(!_0x17ad6c['yes']){if(!isInteractive())return console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x153)]('\x0aError:'),_0x3ef8af(0x12c)),console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x161)](_0x3ef8af(0x15d))),0x1;const _0x40e3f4=await confirmKey(_0x3ef8af(0x123)+(_0x1ac417['length']+_0x47bf52[_0x3ef8af(0x159)])+_0x3ef8af(0x132));if(!_0x40e3f4)return console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x121)](_0x3ef8af(0x14b)),_0x3ef8af(0x15c)),0x1;}for(const _0x506ab4 of _0x3377cd['files']){if(_0x506ab4[_0x3ef8af(0x139)]||_0x506ab4[_0x3ef8af(0x11d)]){const _0x5199a5=a46_0x39e974[_0x3ef8af(0x125)](_0x506ab4[_0x3ef8af(0x137)]);!existsSync(_0x5199a5)&&mkdirSync(_0x5199a5,{'recursive':!![]}),writeFileSync(_0x506ab4[_0x3ef8af(0x137)],_0x506ab4[_0x3ef8af(0x154)],_0x3ef8af(0x130));}}return console[_0x3ef8af(0x163)](a46_0x48c3a0[_0x3ef8af(0x11f)]('✔\x20Pulled\x20'+(_0x1ac417['length']+_0x47bf52[_0x3ef8af(0x159)])+_0x3ef8af(0x12f)+_0x3377cd[_0x3ef8af(0x120)])),saveSessionContext({'parent_segment':_0x3377cd['parentName']},_0x17ad6c[_0x3ef8af(0x11b)]),console[_0x3ef8af(0x163)](a46_0x48c3a0['green'](_0x3ef8af(0x162)+a46_0x48c3a0[_0x3ef8af(0x161)](_0x3ef8af(0x149))+_0x3ef8af(0x15a)+a46_0x48c3a0[_0x3ef8af(0x131)](_0x3377cd[_0x3ef8af(0x147)]))),0x0;}}
1
+ const a47_0x4f11c7=a47_0x1dce;function a47_0x1dce(_0x9c9ff2,_0xb7ec7d){_0x9c9ff2=_0x9c9ff2-0x13d;const _0x20017d=a47_0x2001();let _0x1dce44=_0x20017d[_0x9c9ff2];return _0x1dce44;}(function(_0x300a75,_0x5f30ca){const _0x1118c0=a47_0x1dce,_0x317a18=_0x300a75();while(!![]){try{const _0x59f93e=parseInt(_0x1118c0(0x153))/0x1+-parseInt(_0x1118c0(0x179))/0x2+parseInt(_0x1118c0(0x156))/0x3+-parseInt(_0x1118c0(0x180))/0x4+-parseInt(_0x1118c0(0x171))/0x5+-parseInt(_0x1118c0(0x155))/0x6+parseInt(_0x1118c0(0x16e))/0x7*(parseInt(_0x1118c0(0x184))/0x8);if(_0x59f93e===_0x5f30ca)break;else _0x317a18['push'](_0x317a18['shift']());}catch(_0x19ae9f){_0x317a18['push'](_0x317a18['shift']());}}}(a47_0x2001,0x8e988));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a47_0x2001(){const _0x38ca77=['description','5204766qufKlu','2688057lutsub','\x20changed\x20files','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20files\x20to\x20','\x20files?','✔\x20Context\x20set:\x20','verbose','message','error','Site:\x20','dryRun','filter','\x20=\x20','\x20\x20🎯\x20','diff','\x20\x20🗺️\x20\x20','setPhase','\x20segments','\x0aError:','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20\x20Target:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x0aPull\x20summary\x20for\x20\x27','repeat','5353481KgVKWK','helpText','\x20journeys','2870255uTtzbz','site','\x27...','parentName','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','parent_segment','\x20new\x20files','\x20activations','1014382xCTlPV','Write\x20','journeys','execute','targetDir','session','cyan','851976LRPgmB','Pulling\x20segments\x20from\x20\x27','absolutePath','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','16olABeF','✔\x20Pulled\x20','parentSegment','dim','\x0aChanges\x20to\x20\x27','✔\x20All\x20files\x20are\x20up\x20to\x20date','name','red','hasChanges','counts','journeyVersions','length','type','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','dirname','files','green','segment:pull','cwd','activations','data','\x20with\x20','no_parent','content','isNew','yellow','pullSegments','file','\x20unchanged\x20files','320184FGvlZt'];a47_0x2001=function(){return _0x38ca77;};return a47_0x2001();}import{saveSessionContext}from'../core/session.js';import a47_0x22d307 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a47_0x256d74 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a47_0x4f11c7(0x18a)]=a47_0x4f11c7(0x147);[a47_0x4f11c7(0x154)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a47_0x4f11c7(0x17c)](_0x138af6){const _0x6e8cc9=a47_0x4f11c7,{options:_0x263341,args:_0x33a513,tdx:_0x475789}=_0x138af6,_0x5d6fe1=_0x263341,_0x457f93=await resolveTarget({'arg':_0x33a513[0x0],'contextParent':_0x263341[_0x6e8cc9(0x186)],'cwd':process[_0x6e8cc9(0x148)]()});if(!isSuccessfulResolution(_0x457f93))return _0x457f93['errorCode']===_0x6e8cc9(0x14c)?(console[_0x6e8cc9(0x15e)](a47_0x22d307[_0x6e8cc9(0x14f)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x6e8cc9(0x15e)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x158)),console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x175))):(console[_0x6e8cc9(0x15e)](a47_0x22d307['red']('Error:\x20'+_0x457f93[_0x6e8cc9(0x15d)]+'\x0a')),_0x457f93[_0x6e8cc9(0x16f)]&&console['error'](a47_0x22d307[_0x6e8cc9(0x17f)](_0x457f93[_0x6e8cc9(0x16f)]))),0x1;const _0x137ac9=_0x457f93[_0x6e8cc9(0x174)],_0xf66c0e=_0x457f93[_0x6e8cc9(0x17d)],_0x1e70b4=_0x457f93[_0x6e8cc9(0x142)]===_0x6e8cc9(0x151)?_0x457f93['resourceName']:undefined;_0x5d6fe1[_0x6e8cc9(0x15c)]&&(console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x15f)+_0x5d6fe1[_0x6e8cc9(0x172)]),console[_0x6e8cc9(0x15e)]('Parent\x20segment:\x20'+_0x137ac9),_0x1e70b4&&console[_0x6e8cc9(0x15e)]('Target\x20resource:\x20'+_0x1e70b4));const _0x248bd7=await withProgressSpinner(_0x6e8cc9(0x181)+_0x137ac9+_0x6e8cc9(0x173),_0x60a0cb=>_0x475789['segment'][_0x6e8cc9(0x150)](_0x137ac9,{'targetDir':_0xf66c0e,'targetResourceName':_0x1e70b4,'verbose':_0x5d6fe1['verbose'],'progress':{'update':_0x103864=>{const _0x4f9e8c=_0x6e8cc9;_0x60a0cb[_0x4f9e8c(0x166)](_0x103864),_0x5d6fe1[_0x4f9e8c(0x15c)]&&console['error']('\x20\x20'+_0x103864);}}}),{'verbose':_0x5d6fe1[_0x6e8cc9(0x15c)]}),_0x49f35c=_0x248bd7[_0x6e8cc9(0x14a)];if(_0x49f35c[_0x6e8cc9(0x13f)]['segments']===0x0&&_0x49f35c[_0x6e8cc9(0x13f)][_0x6e8cc9(0x17b)]===0x0)return console[_0x6e8cc9(0x15e)](a47_0x22d307[_0x6e8cc9(0x14f)](_0x6e8cc9(0x169)+_0x49f35c[_0x6e8cc9(0x174)]+'\x27')),0x0;const _0x19f57f=_0x49f35c[_0x6e8cc9(0x145)][_0x6e8cc9(0x161)](_0x831000=>_0x831000[_0x6e8cc9(0x14e)]),_0x11212f=_0x49f35c[_0x6e8cc9(0x145)][_0x6e8cc9(0x161)](_0x105aa4=>!_0x105aa4['isNew']&&_0x105aa4['hasChanges']),_0x2110ac=_0x49f35c['files']['filter'](_0x1c6da9=>!_0x1c6da9[_0x6e8cc9(0x14e)]&&!_0x1c6da9[_0x6e8cc9(0x13e)]);console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x16c)+_0x49f35c['parentName']+'\x27:'),console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x163)+a47_0x22d307[_0x6e8cc9(0x17f)](_0x49f35c[_0x6e8cc9(0x13f)]['segments']+_0x6e8cc9(0x167))+_0x6e8cc9(0x14b)+a47_0x22d307[_0x6e8cc9(0x17f)](_0x49f35c[_0x6e8cc9(0x13f)][_0x6e8cc9(0x149)]+_0x6e8cc9(0x178)));if(_0x49f35c[_0x6e8cc9(0x13f)][_0x6e8cc9(0x17b)]>0x0){const _0x10ddf2=_0x49f35c[_0x6e8cc9(0x13f)][_0x6e8cc9(0x140)]>_0x49f35c[_0x6e8cc9(0x13f)][_0x6e8cc9(0x17b)]?'\x20('+_0x49f35c['counts'][_0x6e8cc9(0x140)]+'\x20versions)':'';console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x165)+a47_0x22d307[_0x6e8cc9(0x17f)](_0x49f35c[_0x6e8cc9(0x13f)]['journeys']+_0x6e8cc9(0x170))+a47_0x22d307[_0x6e8cc9(0x187)](_0x10ddf2));}console[_0x6e8cc9(0x15e)]('\x20\x20'+a47_0x22d307[_0x6e8cc9(0x146)]('+\x20'+_0x19f57f[_0x6e8cc9(0x141)]+_0x6e8cc9(0x177))),console['error']('\x20\x20'+a47_0x22d307[_0x6e8cc9(0x14f)]('~\x20'+_0x11212f[_0x6e8cc9(0x141)]+_0x6e8cc9(0x157))),console['error']('\x20\x20'+a47_0x22d307[_0x6e8cc9(0x187)]('=\x20'+_0x2110ac[_0x6e8cc9(0x141)]+_0x6e8cc9(0x152))),console['error'](_0x6e8cc9(0x16a)+a47_0x22d307['cyan'](_0x49f35c[_0x6e8cc9(0x17d)])+'\x0a');if(_0x11212f[_0x6e8cc9(0x141)]>0x0)for(const _0xd4dbbf of _0x11212f){console[_0x6e8cc9(0x15e)](_0x6e8cc9(0x188)+_0xd4dbbf['relativePath']+'\x27:'),console[_0x6e8cc9(0x15e)]('─'[_0x6e8cc9(0x16d)](0x3c)),console[_0x6e8cc9(0x15e)](_0xd4dbbf[_0x6e8cc9(0x164)]),console[_0x6e8cc9(0x15e)]('─'['repeat'](0x3c));}if(_0x5d6fe1[_0x6e8cc9(0x160)])return console[_0x6e8cc9(0x15e)](a47_0x22d307['yellow'](_0x6e8cc9(0x183))),0x0;if(_0x19f57f[_0x6e8cc9(0x141)]===0x0&&_0x11212f[_0x6e8cc9(0x141)]===0x0)return console[_0x6e8cc9(0x15e)](a47_0x22d307[_0x6e8cc9(0x146)](_0x6e8cc9(0x189))),saveSessionContext({'parent_segment':_0x49f35c[_0x6e8cc9(0x174)]},_0x5d6fe1[_0x6e8cc9(0x17e)]),console['error'](a47_0x22d307['green'](_0x6e8cc9(0x15b)+a47_0x22d307[_0x6e8cc9(0x187)]('parent_segment')+_0x6e8cc9(0x162)+a47_0x22d307['cyan'](_0x49f35c[_0x6e8cc9(0x174)]))),0x0;if(!_0x5d6fe1['yes']){if(!isInteractive())return console[_0x6e8cc9(0x15e)](a47_0x22d307[_0x6e8cc9(0x13d)](_0x6e8cc9(0x168)),_0x6e8cc9(0x143)),console[_0x6e8cc9(0x15e)](a47_0x22d307['dim'](_0x6e8cc9(0x16b))),0x1;const _0x5f51f4=await confirmKey(_0x6e8cc9(0x17a)+(_0x19f57f['length']+_0x11212f['length'])+_0x6e8cc9(0x15a));if(!_0x5f51f4)return console['error'](a47_0x22d307[_0x6e8cc9(0x14f)]('Aborted.'),'-\x20no\x20files\x20written'),0x1;}for(const _0x41aa0f of _0x49f35c[_0x6e8cc9(0x145)]){if(_0x41aa0f['isNew']||_0x41aa0f[_0x6e8cc9(0x13e)]){const _0x79e110=a47_0x256d74[_0x6e8cc9(0x144)](_0x41aa0f['absolutePath']);!existsSync(_0x79e110)&&mkdirSync(_0x79e110,{'recursive':!![]}),writeFileSync(_0x41aa0f[_0x6e8cc9(0x182)],_0x41aa0f[_0x6e8cc9(0x14d)],'utf-8');}}return console['error'](a47_0x22d307[_0x6e8cc9(0x146)](_0x6e8cc9(0x185)+(_0x19f57f['length']+_0x11212f[_0x6e8cc9(0x141)])+_0x6e8cc9(0x159)+_0x49f35c['targetDir'])),saveSessionContext({'parent_segment':_0x49f35c[_0x6e8cc9(0x174)]},_0x5d6fe1[_0x6e8cc9(0x17e)]),console['error'](a47_0x22d307['green'](_0x6e8cc9(0x15b)+a47_0x22d307['dim'](_0x6e8cc9(0x176))+'\x20=\x20'+a47_0x22d307[_0x6e8cc9(0x17f)](_0x49f35c[_0x6e8cc9(0x174)]))),0x0;}}
@@ -1 +1 @@
1
- const a47_0x7226c3=a47_0x2dc0;(function(_0x37a19e,_0x54e9dc){const _0x557d69=a47_0x2dc0,_0x4ca8d2=_0x37a19e();while(!![]){try{const _0x2336b3=parseInt(_0x557d69(0x165))/0x1*(-parseInt(_0x557d69(0x177))/0x2)+parseInt(_0x557d69(0x102))/0x3*(parseInt(_0x557d69(0xfe))/0x4)+parseInt(_0x557d69(0x170))/0x5*(-parseInt(_0x557d69(0x17e))/0x6)+-parseInt(_0x557d69(0x113))/0x7+parseInt(_0x557d69(0x135))/0x8+-parseInt(_0x557d69(0x126))/0x9*(-parseInt(_0x557d69(0x10a))/0xa)+-parseInt(_0x557d69(0xfc))/0xb;if(_0x2336b3===_0x54e9dc)break;else _0x4ca8d2['push'](_0x4ca8d2['shift']());}catch(_0x2fc784){_0x4ca8d2['push'](_0x4ca8d2['shift']());}}}(a47_0x44bb,0xadf0c));function a47_0x44bb(){const _0x1ec6a8=['Fetching\x20existing\x20activations...','listJourneysWithDetailsFromParentSegment','.yaml','journeyBundleName','changed','folderId','Fetching\x20existing\x20data...','description','yamlConfig','diff','scopedFolderPath','segment','toDelete','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','attributes','\x20to\x20delete','isNew','add','\x20\x20\x20\x20','\x20activations]','parentName','existingSegment','yellow','8430312LnmQpu','type','12YFtUBe','error','delete','journey','1031598HBZWHI','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','/e/','endsWith','\x20YAML\x20files\x20found','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x20folders\x20to\x20create','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','10rKfYfG','verbose','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','/sb/da/esr','New\x20journey:','length','\x20changes?','No\x20','Site:\x20','3450559ChhzuQ','parent_name','Aborted.','Folders\x20to\x20create:','push','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x0a✔\x20Push\x20complete','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','Parent\x20segment:\x20','unchanged','helpText','createdAt','map','listSegments','journeysOnly','then','Error\x20parsing\x20YAML:\x20','connection','file','5983272jyKuxL','parentFolder','\x20\x20📊\x20Segments:','idToName','filter','buildUserMaps','get','\x20\x20Activations:','results','existingJourney','data','no_parent','getJourney','Push\x20','Scoped\x20to\x20folder:\x20','7409280veWqHx','deleted','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','paused','isScoped','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','journeyId','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','site','/app/ps/','Changes\x20to\x20journey:','audienceId','yes','activations','versionNumber','\x20\x20Segments:\x20','getMetadataWithCache','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','New\x20segment:','dryRun','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','toCreate','folderPath','new','blue','all','set','journeyBundleId','\x20changed','name','\x20new','folders','nameToType','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x0aPush\x20summary\x20for\x20\x27','Error:\x20','message','dim','\x20\x20Source:\x20','created','segments','updated','execute','join','\x20created','segment\x20or\x20journey','5eqNUAq','toUpdate','\x0aError:','\x20\x20Journeys:\x20','red','cyan','\x20deleted','user','repeat','journeys','nameToId','120lGODcR','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','state','getParent','createdSegmentIds','list','targetDir','118682GCZezo','parentSegment','\x20\x20🗺️\x20\x20Journeys:','\x20to\x20create','segment:push','listFolders','setPhase','88518gCGoQA','/j/da/je','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','\x0aValidation\x20failed:'];a47_0x44bb=function(){return _0x1ec6a8;};return a47_0x44bb();}import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a47_0x3c0bcb from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a47_0x2dc0(_0x2546b8,_0x426645){_0x2546b8=_0x2546b8-0xf2;const _0x44bb69=a47_0x44bb();let _0x2dc020=_0x44bb69[_0x2546b8];return _0x2dc020;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a47_0x7226c3(0x154)]=a47_0x7226c3(0x17b);[a47_0x7226c3(0x189)]='Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments';async[a47_0x7226c3(0x161)](_0x22d5c1){const _0x52f567=a47_0x7226c3,{options:_0x3b6c92,args:_0x365a12,tdx:_0x312c60}=_0x22d5c1,_0x4bbee1=_0x3b6c92,_0x543771=await resolveTarget({'arg':_0x365a12[0x0],'contextParent':_0x3b6c92[_0x52f567(0x178)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x543771))return _0x543771['errorCode']===_0x52f567(0x131)?(console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0xfb)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x52f567(0x109)),console[_0x52f567(0xff)](_0x52f567(0x14a)),console['error'](_0x52f567(0xf2))):(console[_0x52f567(0xff)](a47_0x3c0bcb['red'](_0x52f567(0x15a)+_0x543771[_0x52f567(0x15b)]+'\x0a')),_0x543771[_0x52f567(0x11d)]&&console['error'](a47_0x3c0bcb['cyan'](_0x543771[_0x52f567(0x11d)]))),0x1;if(_0x543771[_0x52f567(0xfd)]===_0x52f567(0x114))return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)]('Error:\x20Directory\x20not\x20found:\x20'+_0x543771[_0x52f567(0x176)]+'\x0a')),console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x16a)](_0x52f567(0x13a))),0x1;const _0x1ab207=_0x543771[_0x52f567(0xf9)],_0x457eed=_0x543771['targetDir'],_0x464db7=_0x543771['type']===_0x52f567(0x125)?_0x543771['filePath']:undefined,_0x256ebd=getScopedDetails(_0x543771),_0x2a3033=_0x256ebd?.[_0x52f567(0x139)]??![],_0x299b84=_0x256ebd?.[_0x52f567(0x18c)]??'';if(!existsSync(_0x457eed))return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)]('Error:\x20Directory\x20not\x20found:\x20'+_0x457eed+'\x0a')),console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x16a)](_0x52f567(0x13a))),0x1;_0x4bbee1[_0x52f567(0x10b)]&&(console[_0x52f567(0xff)](_0x52f567(0x112)+_0x4bbee1[_0x52f567(0x13d)]),console[_0x52f567(0xff)](_0x52f567(0x11b)+_0x1ab207),console[_0x52f567(0xff)]('Source\x20directory:\x20'+_0x457eed),_0x2a3033&&console['error'](_0x52f567(0x134)+_0x299b84));const _0x4894ca=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1ab207+'\x27...',()=>_0x312c60['segment']['resolveParentId'](_0x1ab207),{'verbose':_0x4bbee1[_0x52f567(0x10b)]}),_0x5a9633=_0x4894ca['data'],{parentSegmentResult:_0x347610,segmentsResult:_0x465d2f,foldersResult:_0x2298c1,journeysWithDetailsResult:_0x37be0b,userMaps:_0x25bc3d}=await withSpinner(_0x52f567(0x188),async()=>{const _0x353f08=_0x52f567,[_0x162065,_0x1855d7,_0x20eff9,_0x45e8ad,_0x4e215f]=await Promise[_0x353f08(0x150)]([_0x312c60['segment'][_0x353f08(0x173)](_0x5a9633),_0x312c60[_0x353f08(0x18d)][_0x353f08(0x120)](_0x5a9633),_0x312c60['segment'][_0x353f08(0x17c)](_0x5a9633),_0x312c60[_0x353f08(0x101)][_0x353f08(0x183)](_0x5a9633,{'includeAllVersions':!![]}),_0x312c60[_0x353f08(0x16c)][_0x353f08(0x12b)]()]);return{'parentSegmentResult':_0x162065,'segmentsResult':_0x1855d7,'foldersResult':_0x20eff9,'journeysWithDetailsResult':_0x45e8ad,'userMaps':_0x4e215f};},{'verbose':_0x4bbee1[_0x52f567(0x10b)]})[_0x52f567(0x122)](_0x44a9c8=>_0x44a9c8[_0x52f567(0x130)]),_0x4f7e51=_0x347610,_0x3d3315=extractRootFolderId(_0x4f7e51),_0x3bb2a9=_0x465d2f,_0x468b5a=_0x2298c1,{journeys:_0x341990,activationStepsById:_0xecbd6b}=_0x37be0b,_0x551fc6=new Map(_0x341990[_0x52f567(0x11f)](_0x168dfc=>[_0x168dfc['id'],_0x168dfc])),_0x4c8f74=_0x341990[_0x52f567(0x11f)](_0x3028f0=>({'id':_0x3028f0['id'],'name':_0x3028f0['attributes'][_0x52f567(0x154)],'journeyBundleName':_0x3028f0[_0x52f567(0xf3)][_0x52f567(0x185)]||'','journeyBundleId':_0x3028f0['attributes'][_0x52f567(0x152)]||'','versionNumber':_0x3028f0[_0x52f567(0xf3)][_0x52f567(0x143)],'description':_0x3028f0[_0x52f567(0xf3)]['description'],'state':_0x3028f0['attributes'][_0x52f567(0x172)],'paused':_0x3028f0[_0x52f567(0xf3)][_0x52f567(0x138)],'audienceId':_0x3028f0[_0x52f567(0xf3)][_0x52f567(0x140)],'folderId':_0x3028f0['relationships']?.[_0x52f567(0x127)]?.[_0x52f567(0x130)]?.['id'],'createdAt':_0x3028f0[_0x52f567(0xf3)][_0x52f567(0x11e)],'updatedAt':_0x3028f0[_0x52f567(0xf3)]['updatedAt']})),{emailToId:_0x44131d,idToEmail:_0x5c8227}=_0x25bc3d,_0x5c2e5e=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x10f864=_0x52f567,_0xe652a0=await _0x312c60['connection'][_0x10f864(0x175)]();return buildConnectionMaps(_0xe652a0);},{'verbose':_0x4bbee1[_0x52f567(0x10b)]})[_0x52f567(0x122)](_0x40b491=>_0x40b491[_0x52f567(0x130)]),_0x20e730=_0x5c2e5e[_0x52f567(0x16f)],_0x2ac23f=_0x5c2e5e['idToName'],_0xb9eaf0=_0x5c2e5e[_0x52f567(0x157)],_0x5b03b4={'emailToIdMap':_0x44131d,'connectionNameToIdMap':_0x20e730,'connectionNameToTypeMap':_0xb9eaf0,'getSchema':_0x36381a=>_0x312c60[_0x52f567(0x124)]['getOutputSchemaWithCache'](_0x36381a),'getMetadata':_0x1f32ec=>_0x312c60['connection'][_0x52f567(0x145)](_0x1f32ec)};let {pathToId:_0x307917,idToPath:_0x7210d1}=buildFolderMaps(_0x468b5a);const _0x3cecf4=buildSegmentLookupMap(_0x3bb2a9,_0x7210d1),_0x2ad6a4=buildSegmentNameToIdMap(_0x3bb2a9),_0x9678a2=buildJourneyBundleLookupMap(_0x4c8f74,_0x7210d1);let _0x570cf4;if(_0x464db7){if(!_0x464db7[_0x52f567(0x105)]('.yml')&&!_0x464db7['endsWith'](_0x52f567(0x184)))return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)](_0x52f567(0x11a)+_0x464db7+'\x0a')),0x1;_0x570cf4=[_0x464db7];}else _0x570cf4=findYamlFiles(_0x457eed);if(_0x570cf4['length']===0x0)return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)](_0x52f567(0x118)+_0x457eed+'\x0a')),console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x16a)](_0x52f567(0x158))),0x1;let _0x4b2edf,_0x3498a5;try{const _0x1d77f4=parseAndClassifyYamlFiles(_0x570cf4,_0x457eed,{'skipSegments':_0x4bbee1[_0x52f567(0x121)]});_0x4b2edf=_0x1d77f4[_0x52f567(0x15f)],_0x3498a5=_0x1d77f4[_0x52f567(0x16e)];const _0xf647e7=validateParsedFiles(_0x1d77f4,_0x457eed);if(_0xf647e7[_0x52f567(0x10f)]>0x0)return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)](_0x52f567(0x181))),console['error'](formatValidationErrors(_0xf647e7)),console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0xfb)](_0x52f567(0x13c))),0x1;}catch(_0x1c78f0){return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)](_0x52f567(0x123)+(_0x1c78f0 instanceof Error?_0x1c78f0[_0x52f567(0x15b)]:_0x1c78f0))),0x1;}if(_0x4b2edf[_0x52f567(0x10f)]===0x0&&_0x3498a5[_0x52f567(0x10f)]===0x0){const _0x22041e=_0x4bbee1[_0x52f567(0x121)]?_0x52f567(0x101):_0x52f567(0x164);return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0xfb)](_0x52f567(0x111)+_0x22041e+_0x52f567(0x106))),0x0;}const _0x4e7eb2=new Map();_0x3bb2a9[_0x52f567(0x10f)]>0x0&&!_0x4bbee1[_0x52f567(0x121)]&&await withSpinner(_0x52f567(0x182),async()=>{await batchAsync(_0x3bb2a9,async _0x2139b8=>{const _0x15e589=a47_0x2dc0,_0x2d636d=await _0x312c60[_0x15e589(0x18d)]['listActivations'](_0x5a9633,_0x2139b8['id']);_0x4e7eb2[_0x15e589(0x151)](_0x2139b8['id'],_0x2d636d);});},{'verbose':_0x4bbee1[_0x52f567(0x10b)]});const {segmentFiles:_0x4e8f1b,foldersToCreate:_0x3a089d}=await prepareSegmentFiles(_0x4b2edf,{'segmentByFolderAndName':_0x3cecf4,'activationsBySegmentId':_0x4e7eb2,'folderPathToId':_0x307917,'idToEmailMap':_0x5c8227,'connectionIdToNameMap':_0x2ac23f},_0x5b03b4,_0x2a3033,_0x299b84),_0x5433ce=_0x464db7?[]:findSegmentsToDelete(_0x3bb2a9,_0x4b2edf[_0x52f567(0x11f)](({yamlConfig:_0x54415b,folderPath:_0x212f57})=>({'yamlConfig':_0x54415b,'folderPath':resolveTDFolderPath(_0x212f57,_0x2a3033,_0x299b84)})),_0x7210d1,_0x299b84,_0x2a3033),{journeyFiles:_0x4c1997,foldersToCreate:_0x496190}=await withProgressSpinner('Preparing\x20journeys...',async _0x1f3ffa=>prepareJourneyFiles(_0x3498a5,{'fetchJourney':async _0x2be486=>_0x312c60['journey'][_0x52f567(0x132)](_0x2be486[_0x52f567(0x13b)]),'journeyBundlesByFolderAndName':_0x9678a2,'folderPathToId':_0x307917,'idToEmailMap':_0x5c8227,'connectionIdToNameMap':_0x2ac23f,'existingSegments':_0x3bb2a9,'parentId':_0x5a9633,'deps':_0x312c60,'progress':{'update':_0xe152e2=>{const _0x45777d=_0x52f567;_0x1f3ffa[_0x45777d(0x17d)](_0xe152e2),_0x4bbee1[_0x45777d(0x10b)]&&console[_0x45777d(0xff)]('\x20\x20'+_0xe152e2);}},'journeyById':_0x551fc6,'activationStepsById':_0xecbd6b},_0x2a3033,_0x299b84),{'verbose':_0x4bbee1[_0x52f567(0x10b)]})[_0x52f567(0x122)](_0x5e4094=>_0x5e4094['data']);for(const _0x16df62 of _0x496190){_0x3a089d[_0x52f567(0xf6)](_0x16df62);}const _0x38447a=_0x464db7?[]:findJourneysToDelete(_0x4c8f74,_0x3498a5[_0x52f567(0x11f)](({yamlConfig:_0x1e974d,folderPath:_0x4c4f6b})=>({'yamlConfig':_0x1e974d,'folderPath':resolveTDFolderPath(_0x4c4f6b,_0x2a3033,_0x299b84)})),_0x7210d1,_0x299b84,_0x2a3033),_0x163943=calculatePushStats(_0x4e8f1b,_0x4c1997,_0x3a089d,_0x5433ce,_0x38447a,!!_0x4bbee1[_0x52f567(0x100)],!!_0x4bbee1[_0x52f567(0x121)]),_0x3cd1d2=_0x163943[_0x52f567(0x15f)]['new'],_0x316faa=_0x163943['segments'][_0x52f567(0x186)],_0x2b19d1=_0x163943[_0x52f567(0x15f)][_0x52f567(0x11c)],_0x2d23b1=_0x163943[_0x52f567(0x15f)][_0x52f567(0x18e)],_0x234a80=_0x163943[_0x52f567(0x156)][_0x52f567(0x14c)],_0x112aef=_0x163943['journeys'][_0x52f567(0x14e)],_0x105d12=_0x163943[_0x52f567(0x16e)][_0x52f567(0x186)],_0xe0b6a9=_0x163943['journeys'][_0x52f567(0x11c)],_0x155c96=_0x163943[_0x52f567(0x16e)][_0x52f567(0x18e)],_0xaa734b=_0x163943[_0x52f567(0x142)][_0x52f567(0x150)],_0x400d15=_0x163943['activations'][_0x52f567(0x14c)],_0x2e398a=_0x163943[_0x52f567(0x142)][_0x52f567(0x166)],_0x4eaf4a=_0x163943['activations'][_0x52f567(0x18e)];console[_0x52f567(0xff)](_0x52f567(0x159)+_0x1ab207+'\x27:');_0x234a80[_0x52f567(0x10f)]>0x0&&console['error']('\x20\x20'+a47_0x3c0bcb['blue']('📁\x20'+_0x234a80['length']+_0x52f567(0x108)));if(!_0x4bbee1[_0x52f567(0x121)]){console[_0x52f567(0xff)](_0x52f567(0x128)),console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb['green']('+\x20'+_0x3cd1d2['length']+_0x52f567(0x155))),console[_0x52f567(0xff)]('\x20\x20\x20\x20'+a47_0x3c0bcb[_0x52f567(0xfb)]('~\x20'+_0x316faa['length']+_0x52f567(0x153)));if(_0x2d23b1['length']>0x0)console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb[_0x52f567(0x169)]('-\x20'+_0x2d23b1[_0x52f567(0x10f)]+'\x20to\x20delete'));else _0x5433ce[_0x52f567(0x10f)]>0x0&&!_0x4bbee1['delete']&&console['error'](_0x52f567(0xf7)+a47_0x3c0bcb[_0x52f567(0x15c)](_0x5433ce[_0x52f567(0x10f)]+_0x52f567(0x107)));console['error'](_0x52f567(0xf7)+a47_0x3c0bcb[_0x52f567(0x15c)]('=\x20'+_0x2b19d1[_0x52f567(0x10f)]+'\x20unchanged'));}if(_0x4c1997[_0x52f567(0x10f)]>0x0||_0x38447a[_0x52f567(0x10f)]>0x0){console['error'](_0x52f567(0x179)),console[_0x52f567(0xff)]('\x20\x20\x20\x20'+a47_0x3c0bcb['green']('+\x20'+_0x112aef[_0x52f567(0x10f)]+_0x52f567(0x155))),console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb[_0x52f567(0xfb)]('~\x20'+_0x105d12[_0x52f567(0x10f)]+'\x20changed'));if(_0x155c96[_0x52f567(0x10f)]>0x0)console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb[_0x52f567(0x169)]('-\x20'+_0x155c96[_0x52f567(0x10f)]+_0x52f567(0xf4)));else _0x38447a[_0x52f567(0x10f)]>0x0&&!_0x4bbee1[_0x52f567(0x100)]&&console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb['dim'](_0x38447a[_0x52f567(0x10f)]+_0x52f567(0x107)));console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb['dim']('=\x20'+_0xe0b6a9[_0x52f567(0x10f)]+'\x20unchanged'));}_0xaa734b[_0x52f567(0x10f)]>0x0&&!_0x4bbee1['journeysOnly']&&(console[_0x52f567(0xff)](''),console[_0x52f567(0xff)](_0x52f567(0x12d)),_0x400d15[_0x52f567(0x10f)]>0x0&&console[_0x52f567(0xff)](_0x52f567(0xf7)+a47_0x3c0bcb[_0x52f567(0x149)]('+\x20'+_0x400d15[_0x52f567(0x10f)]+_0x52f567(0x17a))),_0x2e398a['length']>0x0&&console[_0x52f567(0xff)]('\x20\x20\x20\x20'+a47_0x3c0bcb['yellow']('~\x20'+_0x2e398a[_0x52f567(0x10f)]+'\x20to\x20update')),_0x4eaf4a[_0x52f567(0x10f)]>0x0&&console['error'](_0x52f567(0xf7)+a47_0x3c0bcb['red']('-\x20'+_0x4eaf4a['length']+_0x52f567(0xf4))));console[_0x52f567(0xff)](_0x52f567(0x15d)+a47_0x3c0bcb['cyan'](_0x457eed)+'\x0a');if(_0x234a80[_0x52f567(0x10f)]>0x0){console[_0x52f567(0xff)](_0x52f567(0x116));for(const _0x1dd29e of _0x234a80){console['error']('\x20\x20'+a47_0x3c0bcb[_0x52f567(0x14f)]('+')+'\x20'+_0x1dd29e);}console[_0x52f567(0xff)]('');}if(_0x3cd1d2[_0x52f567(0x10f)]>0x0&&!_0x4bbee1[_0x52f567(0x121)])for(const _0x303f3b of _0x3cd1d2){const _0x3c2c90=_0x303f3b[_0x52f567(0x14d)]?_0x303f3b[_0x52f567(0x14d)]+'/'+_0x303f3b['yamlConfig']['name']:_0x303f3b[_0x52f567(0x18a)]['name'],_0x4523c7=_0x303f3b[_0x52f567(0x18a)][_0x52f567(0x142)]?.[_0x52f567(0x10f)]||0x0,_0x150f07=_0x4523c7>0x0?a47_0x3c0bcb[_0x52f567(0x15c)]('\x20['+_0x4523c7+_0x52f567(0xf8)):'';console[_0x52f567(0xff)]('\x0a'+a47_0x3c0bcb['green'](_0x52f567(0x147))+'\x20'+_0x3c2c90+_0x150f07),console[_0x52f567(0xff)]('─'[_0x52f567(0x16d)](0x3c)),_0x303f3b[_0x52f567(0x18b)]&&console[_0x52f567(0xff)](_0x303f3b[_0x52f567(0x18b)]),console[_0x52f567(0xff)]('─'['repeat'](0x3c));}if(_0x2d23b1['length']>0x0&&!_0x4bbee1[_0x52f567(0x121)])for(const _0x51243b of _0x2d23b1){const _0x410157=_0x51243b['segmentFolderId']?_0x7210d1[_0x52f567(0x12c)](_0x51243b['segmentFolderId']['toString']())||'':'',_0x38fa00=_0x410157?_0x410157+'/'+_0x51243b[_0x52f567(0x154)]:_0x51243b['name'],_0x95c2bd=_0x4e7eb2[_0x52f567(0x12c)](_0x51243b['id'])||[],_0x2d3bca=_0x95c2bd['length']>0x0?a47_0x3c0bcb[_0x52f567(0x15c)]('\x20['+_0x95c2bd[_0x52f567(0x10f)]+_0x52f567(0xf8)):'';console[_0x52f567(0xff)]('\x0a'+a47_0x3c0bcb[_0x52f567(0x169)]('Delete\x20segment:')+'\x20'+_0x38fa00+_0x2d3bca),console['error']('─'[_0x52f567(0x16d)](0x3c));const _0x85c50=segmentWithActivationsToYaml(_0x51243b,_0x95c2bd,undefined,_0x5c8227,_0x2ac23f),_0x3543a1=segmentToYamlString(_0x85c50),_0x737d81=generateDiff(_0x3543a1,'');console[_0x52f567(0xff)](formatDiffWithColors(_0x737d81)),console['error']('─'[_0x52f567(0x16d)](0x3c));}const _0x4efb53=_0x4e8f1b[_0x52f567(0x12a)](_0x1b023d=>!_0x1b023d['isNew']&&_0x1b023d[_0x52f567(0x18b)]);if(_0x4efb53[_0x52f567(0x10f)]>0x0&&!_0x4bbee1[_0x52f567(0x121)])for(const _0x504e92 of _0x4efb53){const _0x4febbb=_0x504e92['folderPath']?_0x504e92[_0x52f567(0x14d)]+'/'+_0x504e92[_0x52f567(0x18a)][_0x52f567(0x154)]:_0x504e92[_0x52f567(0x18a)][_0x52f567(0x154)];console[_0x52f567(0xff)]('\x0a'+a47_0x3c0bcb[_0x52f567(0xfb)]('Changes\x20to:')+'\x20'+_0x4febbb),console[_0x52f567(0xff)]('─'[_0x52f567(0x16d)](0x3c)),console[_0x52f567(0xff)](_0x504e92[_0x52f567(0x18b)]),console['error']('─'['repeat'](0x3c));}if(_0x112aef[_0x52f567(0x10f)]>0x0)for(const _0x489115 of _0x112aef){const _0x4fa76f=_0x489115[_0x52f567(0x14d)]?_0x489115[_0x52f567(0x14d)]+'/'+_0x489115['yamlConfig']['name']:_0x489115['yamlConfig'][_0x52f567(0x154)];console[_0x52f567(0xff)]('\x0a'+a47_0x3c0bcb['green'](_0x52f567(0x10e))+'\x20'+_0x4fa76f),console['error']('─'['repeat'](0x3c)),_0x489115[_0x52f567(0x18b)]&&console[_0x52f567(0xff)](_0x489115[_0x52f567(0x18b)]),console[_0x52f567(0xff)]('─'[_0x52f567(0x16d)](0x3c));}const _0x286f52=_0x4c1997[_0x52f567(0x12a)](_0x1876de=>!_0x1876de[_0x52f567(0xf5)]&&_0x1876de['diff']);if(_0x286f52[_0x52f567(0x10f)]>0x0)for(const _0x5d03f6 of _0x286f52){const _0x587d21=_0x5d03f6[_0x52f567(0x14d)]?_0x5d03f6['folderPath']+'/'+_0x5d03f6[_0x52f567(0x18a)][_0x52f567(0x154)]:_0x5d03f6[_0x52f567(0x18a)][_0x52f567(0x154)];console[_0x52f567(0xff)]('\x0a'+a47_0x3c0bcb[_0x52f567(0xfb)](_0x52f567(0x13f))+'\x20'+_0x587d21),console[_0x52f567(0xff)]('─'[_0x52f567(0x16d)](0x3c)),console[_0x52f567(0xff)](_0x5d03f6[_0x52f567(0x18b)]),console[_0x52f567(0xff)]('─'[_0x52f567(0x16d)](0x3c));}if(_0x155c96[_0x52f567(0x10f)]>0x0)for(const _0x458fda of _0x155c96){const _0x5eccdd=_0x458fda[_0x52f567(0x187)]?_0x7210d1['get'](_0x458fda['folderId'])||'':'',_0x3cd2a5=_0x5eccdd?_0x5eccdd+'/'+_0x458fda['journeyBundleName']:_0x458fda['journeyBundleName'];console[_0x52f567(0xff)]('\x0a'+a47_0x3c0bcb[_0x52f567(0x169)]('Delete\x20journey:')+'\x20'+_0x3cd2a5),console['error']('─'['repeat'](0x3c)),console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)]('(Journey\x20will\x20be\x20deleted)')),console[_0x52f567(0xff)]('─'['repeat'](0x3c));}if(_0x4bbee1[_0x52f567(0x148)])return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0xfb)](_0x52f567(0x10c))),0x0;const _0x3d6580=_0x4bbee1['journeysOnly']?![]:_0x3cd1d2[_0x52f567(0x10f)]>0x0||_0x316faa['length']>0x0||_0x2d23b1['length']>0x0,_0x33151f=_0x112aef['length']>0x0||_0x105d12['length']>0x0||_0x155c96[_0x52f567(0x10f)]>0x0,_0x2dca23=_0x4bbee1[_0x52f567(0x121)]?![]:_0xaa734b[_0x52f567(0x10f)]>0x0,_0x1b536c=_0x234a80[_0x52f567(0x10f)]>0x0;if(!_0x3d6580&&!_0x33151f&&!_0x2dca23&&!_0x1b536c){const _0x134a2f=_0x4bbee1['journeysOnly']?_0x52f567(0x180):_0x52f567(0x146);console['error'](a47_0x3c0bcb['green'](_0x134a2f));if(_0x464db7&&_0x2b19d1[_0x52f567(0x10f)]===0x1){const _0x4ed5d3=_0x2b19d1[0x0];if(_0x4ed5d3['existingSegment']?.['id']){const _0x512857=getConsoleNextUrl(_0x4bbee1[_0x52f567(0x13d)],_0x52f567(0x13e)+_0x5a9633+_0x52f567(0x104)+_0x4ed5d3[_0x52f567(0xfa)]['id']+'/sb/da/esr');console[_0x52f567(0xff)](_0x52f567(0x137)+a47_0x3c0bcb[_0x52f567(0x16a)](_0x512857));}}if(_0x464db7&&_0xe0b6a9[_0x52f567(0x10f)]===0x1){const _0x340e81=_0xe0b6a9[0x0];if(_0x340e81[_0x52f567(0x12f)]?.['id']){const _0x4af24c=getConsoleNextUrl(_0x4bbee1[_0x52f567(0x13d)],'/app/ps/'+_0x5a9633+_0x52f567(0x104)+_0x340e81[_0x52f567(0x12f)]['id']+_0x52f567(0x17f));console['error']('\x20\x20'+a47_0x3c0bcb[_0x52f567(0x16a)](_0x4af24c));}}return 0x0;}const _0x450d4e=_0x4bbee1[_0x52f567(0x121)]?_0x112aef[_0x52f567(0x10f)]+_0x105d12['length']+_0x155c96[_0x52f567(0x10f)]+_0x234a80[_0x52f567(0x10f)]:_0x3cd1d2[_0x52f567(0x10f)]+_0x316faa['length']+_0x2d23b1[_0x52f567(0x10f)]+_0x112aef['length']+_0x105d12[_0x52f567(0x10f)]+_0x155c96[_0x52f567(0x10f)]+_0x234a80[_0x52f567(0x10f)]+_0xaa734b[_0x52f567(0x10f)];if(!_0x4bbee1[_0x52f567(0x141)]&&_0x450d4e>0x0){if(!isInteractive())return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0x169)](_0x52f567(0x167)),_0x52f567(0x14b)),console['error'](a47_0x3c0bcb[_0x52f567(0x15c)](_0x52f567(0x103))),0x1;const _0x379472=await confirmKey(_0x52f567(0x133)+_0x450d4e+_0x52f567(0x110));if(!_0x379472)return console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0xfb)](_0x52f567(0x115))),0x1;}const _0x1bf6c9={'withProgress':async(_0x3e2071,_0x463606)=>{const _0x426941=_0x52f567,_0x1ea6ae=await withSpinner(_0x3e2071,_0x463606,{'verbose':_0x4bbee1[_0x426941(0x10b)]});return{'data':_0x1ea6ae[_0x426941(0x130)]};},'logInfo':_0x48cb20=>console[_0x52f567(0xff)](a47_0x3c0bcb['blue']('✔\x20'+_0x48cb20)),'logSuccess':_0x153ba1=>console[_0x52f567(0xff)](a47_0x3c0bcb['green']('✔\x20'+_0x153ba1)),'logWarning':_0xd47a28=>console['error'](a47_0x3c0bcb[_0x52f567(0xfb)]('⚠\x20'+_0xd47a28)),'logDeleted':_0x31ffa4=>console[_0x52f567(0xff)](a47_0x3c0bcb['red']('✔\x20'+_0x31ffa4))},_0x17eb86={'segment':_0x312c60[_0x52f567(0x18d)],'journey':_0x312c60[_0x52f567(0x101)],'user':_0x312c60['user'],'connection':_0x312c60[_0x52f567(0x124)]};_0x234a80[_0x52f567(0x10f)]>0x0&&(_0x307917=await executePushFolders(_0x17eb86,_0x234a80,_0x307917,{'parentId':_0x5a9633},_0x1bf6c9));const _0x3a3e89={'rootFolderId':_0x3d3315,'folderPathToId':_0x307917,'folderIdToPath':_0x7210d1,'segmentNameToId':_0x2ad6a4,'activationsBySegmentId':_0x4e7eb2,'emailToIdMap':_0x44131d,'idToEmailMap':_0x5c8227,'connectionNameToIdMap':_0x5c2e5e['nameToId'],'connectionIdToNameMap':_0x5c2e5e[_0x52f567(0x129)],'connectionNameToTypeMap':_0xb9eaf0},_0x4b1333=await executePushSegments(_0x17eb86,_0x4bbee1[_0x52f567(0x121)]?[]:_0x4e8f1b,_0x3a3e89,{'parentId':_0x5a9633},_0x1bf6c9),_0x20cd59=_0x4b1333['created'],_0x212eda=_0x4b1333[_0x52f567(0x160)],_0xbbf30a=_0x4b1333['activations'][_0x52f567(0x15e)],_0x29e7b3=_0x4b1333['activations'][_0x52f567(0x160)],_0x187a6c=_0x4b1333[_0x52f567(0x142)][_0x52f567(0x136)];let _0xc8e9af;if(_0x464db7&&_0x4e8f1b[_0x52f567(0x10f)]===0x1){const _0x590471=_0x4e8f1b[0x0];_0xc8e9af=_0x590471['existingSegment']?.['id']??_0x4b1333['createdSegmentIds']['get'](_0x590471['yamlConfig'][_0x52f567(0x154)]);}const _0x52f082=await executePushSegmentDeletions(_0x17eb86,_0x4bbee1['journeysOnly']?[]:_0x2d23b1,_0x1bf6c9);let _0x58c7c8=0x0,_0x500e4b=0x0,_0x37fc96=0x0;const _0x52667b=new Map(_0x2ad6a4);for(const [_0x3eabc5,_0x2f5504]of _0x4b1333[_0x52f567(0x174)]){_0x52667b['set'](_0x3eabc5,_0x2f5504);}if(_0x4c1997[_0x52f567(0x10f)]>0x0){const _0x38b2f2={..._0x3a3e89,'segmentNameToId':_0x52667b,'existingSegments':_0x3bb2a9,'activationContext':_0x5b03b4},_0x287e4a=await executePushJourneys(_0x17eb86,_0x4c1997,_0x38b2f2,{'parentId':_0x5a9633,'rootFolderId':_0x3d3315,'verbose':_0x4bbee1[_0x52f567(0x10b)]},_0x1bf6c9);_0x58c7c8=_0x287e4a[_0x52f567(0x15e)],_0x500e4b=_0x287e4a['updated'];if(_0x464db7&&_0x287e4a[_0x52f567(0x12e)][_0x52f567(0x10f)]===0x1){const _0x62866a=_0x287e4a[_0x52f567(0x12e)][0x0];if(_0x62866a[_0x52f567(0x13b)]){const _0x470b59=getConsoleNextUrl(_0x4bbee1['site'],_0x52f567(0x13e)+_0x5a9633+_0x52f567(0x104)+_0x62866a['journeyId']+_0x52f567(0x17f));console[_0x52f567(0xff)]('\x20\x20'+a47_0x3c0bcb[_0x52f567(0x16a)](_0x470b59));}}}for(const _0x561074 of _0x155c96){console[_0x52f567(0xff)](a47_0x3c0bcb[_0x52f567(0xfb)](_0x52f567(0x171)+_0x561074[_0x52f567(0x185)])),_0x37fc96++;}const _0x2ddb3a=[];if(_0x20cd59>0x0)_0x2ddb3a['push'](_0x20cd59+'\x20created');if(_0x212eda>0x0)_0x2ddb3a[_0x52f567(0x117)](_0x212eda+'\x20updated');if(_0x52f082>0x0)_0x2ddb3a[_0x52f567(0x117)](_0x52f082+_0x52f567(0x16b));const _0x5cd980=[];if(_0x58c7c8>0x0)_0x5cd980[_0x52f567(0x117)](_0x58c7c8+_0x52f567(0x163));if(_0x500e4b>0x0)_0x5cd980['push'](_0x500e4b+'\x20updated');if(_0x37fc96>0x0)_0x5cd980[_0x52f567(0x117)](_0x37fc96+_0x52f567(0x16b));const _0x108a46=[];if(_0xbbf30a>0x0)_0x108a46[_0x52f567(0x117)](_0xbbf30a+_0x52f567(0x163));if(_0x29e7b3>0x0)_0x108a46['push'](_0x29e7b3+'\x20updated');if(_0x187a6c>0x0)_0x108a46['push'](_0x187a6c+_0x52f567(0x16b));console['error'](a47_0x3c0bcb['green'](_0x52f567(0x119)));_0x2ddb3a[_0x52f567(0x10f)]>0x0&&!_0x4bbee1[_0x52f567(0x121)]&&console[_0x52f567(0xff)](_0x52f567(0x144)+_0x2ddb3a[_0x52f567(0x162)](',\x20'));_0x5cd980[_0x52f567(0x10f)]>0x0&&console[_0x52f567(0xff)](_0x52f567(0x168)+_0x5cd980[_0x52f567(0x162)](',\x20'));_0x108a46[_0x52f567(0x10f)]>0x0&&!_0x4bbee1[_0x52f567(0x121)]&&console[_0x52f567(0xff)]('\x20\x20Activations:\x20'+_0x108a46['join'](',\x20'));if(_0xc8e9af){const _0x1115cb=getConsoleNextUrl(_0x4bbee1[_0x52f567(0x13d)],_0x52f567(0x13e)+_0x5a9633+'/e/'+_0xc8e9af+_0x52f567(0x10d));console['error'](_0x52f567(0x137)+a47_0x3c0bcb[_0x52f567(0x16a)](_0x1115cb));}return 0x0;}}
1
+ const a48_0x1609ad=a48_0x5d87;function a48_0x5d87(_0x569cb8,_0x13dfd5){_0x569cb8=_0x569cb8-0x1f0;const _0x44fc61=a48_0x44fc();let _0x5d87e5=_0x44fc61[_0x569cb8];return _0x5d87e5;}(function(_0xb0024a,_0x108ea8){const _0x2cb1bb=a48_0x5d87,_0x4a0b72=_0xb0024a();while(!![]){try{const _0x488d09=parseInt(_0x2cb1bb(0x201))/0x1*(-parseInt(_0x2cb1bb(0x276))/0x2)+parseInt(_0x2cb1bb(0x218))/0x3*(-parseInt(_0x2cb1bb(0x226))/0x4)+-parseInt(_0x2cb1bb(0x28b))/0x5+-parseInt(_0x2cb1bb(0x268))/0x6+parseInt(_0x2cb1bb(0x1f7))/0x7+parseInt(_0x2cb1bb(0x283))/0x8+parseInt(_0x2cb1bb(0x224))/0x9;if(_0x488d09===_0x108ea8)break;else _0x4a0b72['push'](_0x4a0b72['shift']());}catch(_0xf57467){_0x4a0b72['push'](_0x4a0b72['shift']());}}}(a48_0x44fc,0x8f0b0));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a48_0x38a609 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a48_0x44fc(){const _0x8948da=['yellow','attributes','toUpdate','join','.yml','Error:\x20Directory\x20not\x20found:\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','12351168hUSnyl','segment\x20or\x20journey','4433916lcFgdV','Delete\x20journey:','Scoped\x20to\x20folder:\x20','existingJourney','targetDir','\x20changes?','nameToType','helpText','/app/ps/','get','📁\x20','updatedAt','unchanged','green','/sb/da/esr','verbose','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','all','getOutputSchemaWithCache','\x20\x20Segments:\x20','red','journeys','scopedFolderPath','error','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error:\x20','connection','createdSegmentIds','/j/da/je','folderPath','segmentFolderId','.yaml','segment','\x20\x20Journeys:\x20','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','type','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Preparing\x20journeys...','execute','then','folders','listFolders','\x20\x20Activations:','getJourney','paused','\x20folders\x20to\x20create','journeysOnly','Aborted.','\x0a✔\x20Push\x20complete','journeyId','Resolving\x20parent\x20segment\x20\x27','audienceId','Folders\x20to\x20create:','Error\x20parsing\x20YAML:\x20','data','\x20\x20📊\x20Segments:','Parent\x20segment:\x20','/e/','\x20\x20🗺️\x20\x20Journeys:','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Fetching\x20connections\x20for\x20name\x20resolution...','diff','parent_name','journey','push','2727648aCXSGl','changed','results','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Delete\x20segment:','\x27...','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','Changes\x20to\x20journey:','listJourneysWithDetailsFromParentSegment','new','getMetadataWithCache','getParent','idToName','filter','262NeQoXy','\x20activations]','Fetching\x20existing\x20activations...','description','journeyBundleId','\x20to\x20create','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','updated','site','segments','file','name','isNew','5211648ZfHeEk','journeyBundleName','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','deleted','yamlConfig','length','Fetching\x20existing\x20data...','errorCode','3077910iPEfVH','New\x20journey:','created','yes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','New\x20segment:','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','listActivations','resolveParentId','\x20updated','6198640EYZbNp','\x20YAML\x20files\x20found','add','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','dim','existingSegment','\x20new','parentSegment','\x0aPush\x20summary\x20for\x20\x27','parentName','1105qOnunG','list','message','\x20unchanged','toDelete','dryRun','set','user','isScoped','\x20to\x20delete','buildUserMaps','\x20\x20\x20\x20','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','filePath','toString','\x0aValidation\x20failed:','\x20changed','toCreate','repeat','delete','blue','no_parent','map','3xGkwaP','No\x20','activations','\x20deleted','\x20\x20Activations:\x20'];a48_0x44fc=function(){return _0x8948da;};return a48_0x44fc();}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a48_0x1609ad(0x281)]='segment:push';[a48_0x1609ad(0x279)]=a48_0x1609ad(0x26e);async[a48_0x1609ad(0x24c)](_0x50ef36){const _0x3479f8=a48_0x1609ad,{options:_0xfa47b2,args:_0x554693,tdx:_0x2a6b6c}=_0x50ef36,_0x273058=_0xfa47b2,_0x2d5a44=await resolveTarget({'arg':_0x554693[0x0],'contextParent':_0xfa47b2[_0x3479f8(0x1fe)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2d5a44))return _0x2d5a44[_0x3479f8(0x28a)]===_0x3479f8(0x216)?(console['error'](a48_0x38a609['yellow'](_0x3479f8(0x1f0))),console[_0x3479f8(0x23d)](_0x3479f8(0x1f1)),console[_0x3479f8(0x23d)](_0x3479f8(0x27c)),console[_0x3479f8(0x23d)](_0x3479f8(0x262))):(console[_0x3479f8(0x23d)](a48_0x38a609['red'](_0x3479f8(0x23f)+_0x2d5a44['message']+'\x0a')),_0x2d5a44[_0x3479f8(0x22d)]&&console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x261)](_0x2d5a44[_0x3479f8(0x22d)]))),0x1;if(_0x2d5a44['type']===_0x3479f8(0x265))return console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x23a)](_0x3479f8(0x222)+_0x2d5a44[_0x3479f8(0x22a)]+'\x0a')),console['error'](a48_0x38a609[_0x3479f8(0x261)](_0x3479f8(0x285))),0x1;const _0x320cfb=_0x2d5a44[_0x3479f8(0x200)],_0x5826a9=_0x2d5a44[_0x3479f8(0x22a)],_0x684343=_0x2d5a44[_0x3479f8(0x249)]===_0x3479f8(0x280)?_0x2d5a44[_0x3479f8(0x20e)]:undefined,_0x2be775=getScopedDetails(_0x2d5a44),_0x3071cd=_0x2be775?.[_0x3479f8(0x209)]??![],_0x49fbec=_0x2be775?.[_0x3479f8(0x23c)]??'';if(!existsSync(_0x5826a9))return console[_0x3479f8(0x23d)](a48_0x38a609['red'](_0x3479f8(0x222)+_0x5826a9+'\x0a')),console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x261)](_0x3479f8(0x285))),0x1;_0x273058[_0x3479f8(0x235)]&&(console[_0x3479f8(0x23d)]('Site:\x20'+_0x273058[_0x3479f8(0x27e)]),console[_0x3479f8(0x23d)](_0x3479f8(0x25e)+_0x320cfb),console['error']('Source\x20directory:\x20'+_0x5826a9),_0x3071cd&&console[_0x3479f8(0x23d)](_0x3479f8(0x228)+_0x49fbec));const _0x14b2ae=await withSpinner(_0x3479f8(0x258)+_0x320cfb+_0x3479f8(0x26d),()=>_0x2a6b6c['segment'][_0x3479f8(0x1f5)](_0x320cfb),{'verbose':_0x273058[_0x3479f8(0x235)]}),_0x4282d6=_0x14b2ae[_0x3479f8(0x25c)],{parentSegmentResult:_0x38d6a1,segmentsResult:_0x416fac,foldersResult:_0x4ffa47,journeysWithDetailsResult:_0x15e9b1,userMaps:_0x5d4199}=await withSpinner(_0x3479f8(0x289),async()=>{const _0x709c8c=_0x3479f8,[_0x118ec6,_0x5cc0e2,_0x32c9a1,_0x371f9e,_0x15a2f0]=await Promise[_0x709c8c(0x237)]([_0x2a6b6c['segment'][_0x709c8c(0x273)](_0x4282d6),_0x2a6b6c['segment']['listSegments'](_0x4282d6),_0x2a6b6c[_0x709c8c(0x246)][_0x709c8c(0x24f)](_0x4282d6),_0x2a6b6c[_0x709c8c(0x266)][_0x709c8c(0x270)](_0x4282d6,{'includeAllVersions':!![]}),_0x2a6b6c[_0x709c8c(0x208)][_0x709c8c(0x20b)]()]);return{'parentSegmentResult':_0x118ec6,'segmentsResult':_0x5cc0e2,'foldersResult':_0x32c9a1,'journeysWithDetailsResult':_0x371f9e,'userMaps':_0x15a2f0};},{'verbose':_0x273058[_0x3479f8(0x235)]})[_0x3479f8(0x24d)](_0x3b91c2=>_0x3b91c2[_0x3479f8(0x25c)]),_0x4e60f0=_0x38d6a1,_0x59b1a3=extractRootFolderId(_0x4e60f0),_0x4db7d4=_0x416fac,_0xfa03d8=_0x4ffa47,{journeys:_0x1ea159,activationStepsById:_0x42d7c2}=_0x15e9b1,_0x276cc5=new Map(_0x1ea159[_0x3479f8(0x217)](_0x382d66=>[_0x382d66['id'],_0x382d66])),_0x9fd07=_0x1ea159[_0x3479f8(0x217)](_0x5cb629=>({'id':_0x5cb629['id'],'name':_0x5cb629[_0x3479f8(0x21e)][_0x3479f8(0x281)],'journeyBundleName':_0x5cb629['attributes']['journeyBundleName']||'','journeyBundleId':_0x5cb629[_0x3479f8(0x21e)][_0x3479f8(0x27a)]||'','versionNumber':_0x5cb629[_0x3479f8(0x21e)]['versionNumber'],'description':_0x5cb629['attributes']['description'],'state':_0x5cb629[_0x3479f8(0x21e)]['state'],'paused':_0x5cb629[_0x3479f8(0x21e)][_0x3479f8(0x252)],'audienceId':_0x5cb629[_0x3479f8(0x21e)][_0x3479f8(0x259)],'folderId':_0x5cb629['relationships']?.['parentFolder']?.[_0x3479f8(0x25c)]?.['id'],'createdAt':_0x5cb629['attributes']['createdAt'],'updatedAt':_0x5cb629[_0x3479f8(0x21e)][_0x3479f8(0x231)]})),{emailToId:_0x33e44d,idToEmail:_0x39245f}=_0x5d4199,_0xffa4e3=await withSpinner(_0x3479f8(0x263),async()=>{const _0x7f6b90=_0x3479f8,_0x2f07af=await _0x2a6b6c['connection'][_0x7f6b90(0x202)]();return buildConnectionMaps(_0x2f07af);},{'verbose':_0x273058[_0x3479f8(0x235)]})[_0x3479f8(0x24d)](_0x28b2b4=>_0x28b2b4[_0x3479f8(0x25c)]),_0x128dee=_0xffa4e3['nameToId'],_0x160cf2=_0xffa4e3[_0x3479f8(0x274)],_0x2e930b=_0xffa4e3[_0x3479f8(0x22c)],_0xeec34e={'emailToIdMap':_0x33e44d,'connectionNameToIdMap':_0x128dee,'connectionNameToTypeMap':_0x2e930b,'getSchema':_0x4a2169=>_0x2a6b6c['connection'][_0x3479f8(0x238)](_0x4a2169),'getMetadata':_0x5c9f76=>_0x2a6b6c[_0x3479f8(0x240)][_0x3479f8(0x272)](_0x5c9f76)};let {pathToId:_0x270ad0,idToPath:_0x31799f}=buildFolderMaps(_0xfa03d8);const _0x5a1495=buildSegmentLookupMap(_0x4db7d4,_0x31799f),_0x5b0b59=buildSegmentNameToIdMap(_0x4db7d4),_0x3a637c=buildJourneyBundleLookupMap(_0x9fd07,_0x31799f);let _0x31878d;if(_0x684343){if(!_0x684343['endsWith'](_0x3479f8(0x221))&&!_0x684343['endsWith'](_0x3479f8(0x245)))return console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x23a)](_0x3479f8(0x236)+_0x684343+'\x0a')),0x1;_0x31878d=[_0x684343];}else _0x31878d=findYamlFiles(_0x5826a9);if(_0x31878d[_0x3479f8(0x288)]===0x0)return console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x23a)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x5826a9+'\x0a')),console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x261)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x1653d4,_0x283eba;try{const _0x3fc0c4=parseAndClassifyYamlFiles(_0x31878d,_0x5826a9,{'skipSegments':_0x273058['journeysOnly']});_0x1653d4=_0x3fc0c4[_0x3479f8(0x27f)],_0x283eba=_0x3fc0c4[_0x3479f8(0x23b)];const _0x28f8e4=validateParsedFiles(_0x3fc0c4,_0x5826a9);if(_0x28f8e4[_0x3479f8(0x288)]>0x0)return console['error'](a48_0x38a609[_0x3479f8(0x23a)](_0x3479f8(0x210))),console[_0x3479f8(0x23d)](formatValidationErrors(_0x28f8e4)),console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x21d)](_0x3479f8(0x248))),0x1;}catch(_0x3179a2){return console['error'](a48_0x38a609['red'](_0x3479f8(0x25b)+(_0x3179a2 instanceof Error?_0x3179a2[_0x3479f8(0x203)]:_0x3179a2))),0x1;}if(_0x1653d4[_0x3479f8(0x288)]===0x0&&_0x283eba[_0x3479f8(0x288)]===0x0){const _0x5d9880=_0x273058['journeysOnly']?_0x3479f8(0x266):_0x3479f8(0x225);return console[_0x3479f8(0x23d)](a48_0x38a609['yellow'](_0x3479f8(0x219)+_0x5d9880+_0x3479f8(0x1f8))),0x0;}const _0x256c3e=new Map();_0x4db7d4[_0x3479f8(0x288)]>0x0&&!_0x273058[_0x3479f8(0x254)]&&await withSpinner(_0x3479f8(0x278),async()=>{await batchAsync(_0x4db7d4,async _0xad8e19=>{const _0x54075e=a48_0x5d87,_0x1f2ef2=await _0x2a6b6c[_0x54075e(0x246)][_0x54075e(0x1f4)](_0x4282d6,_0xad8e19['id']);_0x256c3e[_0x54075e(0x207)](_0xad8e19['id'],_0x1f2ef2);});},{'verbose':_0x273058[_0x3479f8(0x235)]});const {segmentFiles:_0x1b21ed,foldersToCreate:_0x267bf8}=await prepareSegmentFiles(_0x1653d4,{'segmentByFolderAndName':_0x5a1495,'activationsBySegmentId':_0x256c3e,'folderPathToId':_0x270ad0,'idToEmailMap':_0x39245f,'connectionIdToNameMap':_0x160cf2},_0xeec34e,_0x3071cd,_0x49fbec),_0x4b16f2=_0x684343?[]:findSegmentsToDelete(_0x4db7d4,_0x1653d4[_0x3479f8(0x217)](({yamlConfig:_0x6f1b9d,folderPath:_0x307765})=>({'yamlConfig':_0x6f1b9d,'folderPath':resolveTDFolderPath(_0x307765,_0x3071cd,_0x49fbec)})),_0x31799f,_0x49fbec,_0x3071cd),{journeyFiles:_0x2c7499,foldersToCreate:_0x340eae}=await withProgressSpinner(_0x3479f8(0x24b),async _0x3150f4=>prepareJourneyFiles(_0x283eba,{'fetchJourney':async _0x1b193f=>_0x2a6b6c[_0x3479f8(0x266)][_0x3479f8(0x251)](_0x1b193f[_0x3479f8(0x257)]),'journeyBundlesByFolderAndName':_0x3a637c,'folderPathToId':_0x270ad0,'idToEmailMap':_0x39245f,'connectionIdToNameMap':_0x160cf2,'existingSegments':_0x4db7d4,'parentId':_0x4282d6,'deps':_0x2a6b6c,'progress':{'update':_0x5d6f3b=>{const _0x57fb08=_0x3479f8;_0x3150f4['setPhase'](_0x5d6f3b),_0x273058[_0x57fb08(0x235)]&&console['error']('\x20\x20'+_0x5d6f3b);}},'journeyById':_0x276cc5,'activationStepsById':_0x42d7c2},_0x3071cd,_0x49fbec),{'verbose':_0x273058[_0x3479f8(0x235)]})[_0x3479f8(0x24d)](_0x4fb7e2=>_0x4fb7e2['data']);for(const _0x59fb04 of _0x340eae){_0x267bf8[_0x3479f8(0x1f9)](_0x59fb04);}const _0x126960=_0x684343?[]:findJourneysToDelete(_0x9fd07,_0x283eba[_0x3479f8(0x217)](({yamlConfig:_0x1bf006,folderPath:_0x4f359b})=>({'yamlConfig':_0x1bf006,'folderPath':resolveTDFolderPath(_0x4f359b,_0x3071cd,_0x49fbec)})),_0x31799f,_0x49fbec,_0x3071cd),_0x238df1=calculatePushStats(_0x1b21ed,_0x2c7499,_0x267bf8,_0x4b16f2,_0x126960,!!_0x273058['delete'],!!_0x273058[_0x3479f8(0x254)]),_0x51a3d3=_0x238df1[_0x3479f8(0x27f)][_0x3479f8(0x271)],_0x3ea1e5=_0x238df1['segments'][_0x3479f8(0x269)],_0x2442a=_0x238df1[_0x3479f8(0x27f)][_0x3479f8(0x232)],_0x38e043=_0x238df1[_0x3479f8(0x27f)][_0x3479f8(0x205)],_0x1ebb4f=_0x238df1[_0x3479f8(0x24e)][_0x3479f8(0x212)],_0x290e4c=_0x238df1[_0x3479f8(0x23b)][_0x3479f8(0x271)],_0x182b08=_0x238df1[_0x3479f8(0x23b)][_0x3479f8(0x269)],_0xea6bb9=_0x238df1[_0x3479f8(0x23b)]['unchanged'],_0x49dbc1=_0x238df1[_0x3479f8(0x23b)][_0x3479f8(0x205)],_0x17d423=_0x238df1[_0x3479f8(0x21a)][_0x3479f8(0x237)],_0x372104=_0x238df1[_0x3479f8(0x21a)]['toCreate'],_0x360c24=_0x238df1['activations'][_0x3479f8(0x21f)],_0x229ab6=_0x238df1[_0x3479f8(0x21a)][_0x3479f8(0x205)];console[_0x3479f8(0x23d)](_0x3479f8(0x1ff)+_0x320cfb+'\x27:');_0x1ebb4f[_0x3479f8(0x288)]>0x0&&console['error']('\x20\x20'+a48_0x38a609[_0x3479f8(0x215)](_0x3479f8(0x230)+_0x1ebb4f[_0x3479f8(0x288)]+_0x3479f8(0x253)));if(!_0x273058[_0x3479f8(0x254)]){console[_0x3479f8(0x23d)](_0x3479f8(0x25d)),console['error'](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x233)]('+\x20'+_0x51a3d3[_0x3479f8(0x288)]+_0x3479f8(0x1fd))),console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x21d)]('~\x20'+_0x3ea1e5[_0x3479f8(0x288)]+_0x3479f8(0x211)));if(_0x38e043[_0x3479f8(0x288)]>0x0)console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x23a)]('-\x20'+_0x38e043[_0x3479f8(0x288)]+_0x3479f8(0x20a)));else _0x4b16f2[_0x3479f8(0x288)]>0x0&&!_0x273058[_0x3479f8(0x214)]&&console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x1fb)](_0x4b16f2[_0x3479f8(0x288)]+_0x3479f8(0x26b)));console['error'](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x1fb)]('=\x20'+_0x2442a[_0x3479f8(0x288)]+_0x3479f8(0x204)));}if(_0x2c7499[_0x3479f8(0x288)]>0x0||_0x126960[_0x3479f8(0x288)]>0x0){console['error'](_0x3479f8(0x260)),console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x233)]('+\x20'+_0x290e4c[_0x3479f8(0x288)]+_0x3479f8(0x1fd))),console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x21d)]('~\x20'+_0x182b08[_0x3479f8(0x288)]+_0x3479f8(0x211)));if(_0x49dbc1['length']>0x0)console[_0x3479f8(0x23d)]('\x20\x20\x20\x20'+a48_0x38a609['red']('-\x20'+_0x49dbc1[_0x3479f8(0x288)]+_0x3479f8(0x20a)));else _0x126960['length']>0x0&&!_0x273058[_0x3479f8(0x214)]&&console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x1fb)](_0x126960['length']+_0x3479f8(0x26b)));console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x1fb)]('=\x20'+_0xea6bb9[_0x3479f8(0x288)]+'\x20unchanged'));}_0x17d423[_0x3479f8(0x288)]>0x0&&!_0x273058['journeysOnly']&&(console[_0x3479f8(0x23d)](''),console['error'](_0x3479f8(0x250)),_0x372104[_0x3479f8(0x288)]>0x0&&console['error'](_0x3479f8(0x20c)+a48_0x38a609['green']('+\x20'+_0x372104[_0x3479f8(0x288)]+_0x3479f8(0x27b))),_0x360c24[_0x3479f8(0x288)]>0x0&&console[_0x3479f8(0x23d)](_0x3479f8(0x20c)+a48_0x38a609[_0x3479f8(0x21d)]('~\x20'+_0x360c24[_0x3479f8(0x288)]+'\x20to\x20update')),_0x229ab6[_0x3479f8(0x288)]>0x0&&console['error']('\x20\x20\x20\x20'+a48_0x38a609[_0x3479f8(0x23a)]('-\x20'+_0x229ab6[_0x3479f8(0x288)]+_0x3479f8(0x20a))));console[_0x3479f8(0x23d)]('\x20\x20Source:\x20'+a48_0x38a609[_0x3479f8(0x261)](_0x5826a9)+'\x0a');if(_0x1ebb4f[_0x3479f8(0x288)]>0x0){console[_0x3479f8(0x23d)](_0x3479f8(0x25a));for(const _0x394623 of _0x1ebb4f){console['error']('\x20\x20'+a48_0x38a609['blue']('+')+'\x20'+_0x394623);}console[_0x3479f8(0x23d)]('');}if(_0x51a3d3[_0x3479f8(0x288)]>0x0&&!_0x273058[_0x3479f8(0x254)])for(const _0x5dbaa8 of _0x51a3d3){const _0x24899e=_0x5dbaa8['folderPath']?_0x5dbaa8['folderPath']+'/'+_0x5dbaa8[_0x3479f8(0x287)][_0x3479f8(0x281)]:_0x5dbaa8['yamlConfig']['name'],_0xedbb9f=_0x5dbaa8[_0x3479f8(0x287)][_0x3479f8(0x21a)]?.[_0x3479f8(0x288)]||0x0,_0x24c0d9=_0xedbb9f>0x0?a48_0x38a609[_0x3479f8(0x1fb)]('\x20['+_0xedbb9f+_0x3479f8(0x277)):'';console[_0x3479f8(0x23d)]('\x0a'+a48_0x38a609[_0x3479f8(0x233)](_0x3479f8(0x1f2))+'\x20'+_0x24899e+_0x24c0d9),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c)),_0x5dbaa8['diff']&&console[_0x3479f8(0x23d)](_0x5dbaa8[_0x3479f8(0x264)]),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c));}if(_0x38e043[_0x3479f8(0x288)]>0x0&&!_0x273058['journeysOnly'])for(const _0x102560 of _0x38e043){const _0x588534=_0x102560['segmentFolderId']?_0x31799f['get'](_0x102560[_0x3479f8(0x244)][_0x3479f8(0x20f)]())||'':'',_0x42c351=_0x588534?_0x588534+'/'+_0x102560[_0x3479f8(0x281)]:_0x102560[_0x3479f8(0x281)],_0x47c2ac=_0x256c3e[_0x3479f8(0x22f)](_0x102560['id'])||[],_0x99e051=_0x47c2ac[_0x3479f8(0x288)]>0x0?a48_0x38a609[_0x3479f8(0x1fb)]('\x20['+_0x47c2ac['length']+_0x3479f8(0x277)):'';console[_0x3479f8(0x23d)]('\x0a'+a48_0x38a609[_0x3479f8(0x23a)](_0x3479f8(0x26c))+'\x20'+_0x42c351+_0x99e051),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c));const _0x1c3666=segmentWithActivationsToYaml(_0x102560,_0x47c2ac,undefined,_0x39245f,_0x160cf2),_0xd6e730=segmentToYamlString(_0x1c3666),_0x42c34d=generateDiff(_0xd6e730,'');console[_0x3479f8(0x23d)](formatDiffWithColors(_0x42c34d)),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c));}const _0x19f9b3=_0x1b21ed[_0x3479f8(0x275)](_0x5ae17d=>!_0x5ae17d[_0x3479f8(0x282)]&&_0x5ae17d['diff']);if(_0x19f9b3[_0x3479f8(0x288)]>0x0&&!_0x273058['journeysOnly'])for(const _0x4e48e7 of _0x19f9b3){const _0x5beabf=_0x4e48e7[_0x3479f8(0x243)]?_0x4e48e7[_0x3479f8(0x243)]+'/'+_0x4e48e7[_0x3479f8(0x287)][_0x3479f8(0x281)]:_0x4e48e7[_0x3479f8(0x287)]['name'];console[_0x3479f8(0x23d)]('\x0a'+a48_0x38a609[_0x3479f8(0x21d)]('Changes\x20to:')+'\x20'+_0x5beabf),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c)),console[_0x3479f8(0x23d)](_0x4e48e7[_0x3479f8(0x264)]),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c));}if(_0x290e4c[_0x3479f8(0x288)]>0x0)for(const _0x7452d7 of _0x290e4c){const _0x59a5de=_0x7452d7[_0x3479f8(0x243)]?_0x7452d7[_0x3479f8(0x243)]+'/'+_0x7452d7[_0x3479f8(0x287)][_0x3479f8(0x281)]:_0x7452d7['yamlConfig'][_0x3479f8(0x281)];console[_0x3479f8(0x23d)]('\x0a'+a48_0x38a609[_0x3479f8(0x233)](_0x3479f8(0x28c))+'\x20'+_0x59a5de),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c)),_0x7452d7[_0x3479f8(0x264)]&&console[_0x3479f8(0x23d)](_0x7452d7[_0x3479f8(0x264)]),console[_0x3479f8(0x23d)]('─'['repeat'](0x3c));}const _0x2a08ad=_0x2c7499[_0x3479f8(0x275)](_0x2b9ae9=>!_0x2b9ae9['isNew']&&_0x2b9ae9[_0x3479f8(0x264)]);if(_0x2a08ad[_0x3479f8(0x288)]>0x0)for(const _0x1d8869 of _0x2a08ad){const _0x50e41d=_0x1d8869[_0x3479f8(0x243)]?_0x1d8869[_0x3479f8(0x243)]+'/'+_0x1d8869['yamlConfig']['name']:_0x1d8869['yamlConfig'][_0x3479f8(0x281)];console[_0x3479f8(0x23d)]('\x0a'+a48_0x38a609[_0x3479f8(0x21d)](_0x3479f8(0x26f))+'\x20'+_0x50e41d),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c)),console['error'](_0x1d8869[_0x3479f8(0x264)]),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c));}if(_0x49dbc1[_0x3479f8(0x288)]>0x0)for(const _0x35c594 of _0x49dbc1){const _0x30c57e=_0x35c594['folderId']?_0x31799f['get'](_0x35c594['folderId'])||'':'',_0xb8cf46=_0x30c57e?_0x30c57e+'/'+_0x35c594['journeyBundleName']:_0x35c594[_0x3479f8(0x284)];console[_0x3479f8(0x23d)]('\x0a'+a48_0x38a609[_0x3479f8(0x23a)](_0x3479f8(0x227))+'\x20'+_0xb8cf46),console[_0x3479f8(0x23d)]('─'['repeat'](0x3c)),console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x23a)]('(Journey\x20will\x20be\x20deleted)')),console[_0x3479f8(0x23d)]('─'[_0x3479f8(0x213)](0x3c));}if(_0x273058[_0x3479f8(0x206)])return console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x21d)](_0x3479f8(0x223))),0x0;const _0x586c3b=_0x273058['journeysOnly']?![]:_0x51a3d3['length']>0x0||_0x3ea1e5[_0x3479f8(0x288)]>0x0||_0x38e043['length']>0x0,_0x2d74c3=_0x290e4c['length']>0x0||_0x182b08[_0x3479f8(0x288)]>0x0||_0x49dbc1[_0x3479f8(0x288)]>0x0,_0x4b2bf7=_0x273058[_0x3479f8(0x254)]?![]:_0x17d423[_0x3479f8(0x288)]>0x0,_0x4381e5=_0x1ebb4f['length']>0x0;if(!_0x586c3b&&!_0x2d74c3&&!_0x4b2bf7&&!_0x4381e5){const _0x1d8108=_0x273058['journeysOnly']?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x3479f8(0x20d);console[_0x3479f8(0x23d)](a48_0x38a609['green'](_0x1d8108));if(_0x684343&&_0x2442a[_0x3479f8(0x288)]===0x1){const _0x415955=_0x2442a[0x0];if(_0x415955['existingSegment']?.['id']){const _0x483cdb=getConsoleNextUrl(_0x273058[_0x3479f8(0x27e)],_0x3479f8(0x22e)+_0x4282d6+_0x3479f8(0x25f)+_0x415955[_0x3479f8(0x1fc)]['id']+_0x3479f8(0x234));console[_0x3479f8(0x23d)]('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a48_0x38a609[_0x3479f8(0x261)](_0x483cdb));}}if(_0x684343&&_0xea6bb9[_0x3479f8(0x288)]===0x1){const _0x172673=_0xea6bb9[0x0];if(_0x172673['existingJourney']?.['id']){const _0x31e0fc=getConsoleNextUrl(_0x273058[_0x3479f8(0x27e)],_0x3479f8(0x22e)+_0x4282d6+'/e/'+_0x172673[_0x3479f8(0x229)]['id']+_0x3479f8(0x242));console[_0x3479f8(0x23d)]('\x20\x20'+a48_0x38a609['cyan'](_0x31e0fc));}}return 0x0;}const _0x34b0e4=_0x273058[_0x3479f8(0x254)]?_0x290e4c[_0x3479f8(0x288)]+_0x182b08[_0x3479f8(0x288)]+_0x49dbc1[_0x3479f8(0x288)]+_0x1ebb4f['length']:_0x51a3d3[_0x3479f8(0x288)]+_0x3ea1e5[_0x3479f8(0x288)]+_0x38e043[_0x3479f8(0x288)]+_0x290e4c['length']+_0x182b08['length']+_0x49dbc1[_0x3479f8(0x288)]+_0x1ebb4f['length']+_0x17d423[_0x3479f8(0x288)];if(!_0x273058[_0x3479f8(0x28e)]&&_0x34b0e4>0x0){if(!isInteractive())return console['error'](a48_0x38a609[_0x3479f8(0x23a)]('\x0aError:'),_0x3479f8(0x24a)),console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x1fb)](_0x3479f8(0x23e))),0x1;const _0x157d88=await confirmKey('Push\x20'+_0x34b0e4+_0x3479f8(0x22b));if(!_0x157d88)return console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x21d)](_0x3479f8(0x255))),0x1;}const _0x2dfd1a={'withProgress':async(_0x23b260,_0x252f5e)=>{const _0xaf183f=_0x3479f8,_0x579e2a=await withSpinner(_0x23b260,_0x252f5e,{'verbose':_0x273058[_0xaf183f(0x235)]});return{'data':_0x579e2a[_0xaf183f(0x25c)]};},'logInfo':_0xb16edb=>console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x215)]('✔\x20'+_0xb16edb)),'logSuccess':_0x5b9028=>console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x233)]('✔\x20'+_0x5b9028)),'logWarning':_0x3ec0e4=>console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x21d)]('⚠\x20'+_0x3ec0e4)),'logDeleted':_0x17c923=>console[_0x3479f8(0x23d)](a48_0x38a609['red']('✔\x20'+_0x17c923))},_0x188c9d={'segment':_0x2a6b6c['segment'],'journey':_0x2a6b6c[_0x3479f8(0x266)],'user':_0x2a6b6c['user'],'connection':_0x2a6b6c['connection']};_0x1ebb4f[_0x3479f8(0x288)]>0x0&&(_0x270ad0=await executePushFolders(_0x188c9d,_0x1ebb4f,_0x270ad0,{'parentId':_0x4282d6},_0x2dfd1a));const _0xd72fa4={'rootFolderId':_0x59b1a3,'folderPathToId':_0x270ad0,'folderIdToPath':_0x31799f,'segmentNameToId':_0x5b0b59,'activationsBySegmentId':_0x256c3e,'emailToIdMap':_0x33e44d,'idToEmailMap':_0x39245f,'connectionNameToIdMap':_0xffa4e3['nameToId'],'connectionIdToNameMap':_0xffa4e3[_0x3479f8(0x274)],'connectionNameToTypeMap':_0x2e930b},_0x363256=await executePushSegments(_0x188c9d,_0x273058[_0x3479f8(0x254)]?[]:_0x1b21ed,_0xd72fa4,{'parentId':_0x4282d6},_0x2dfd1a),_0x4ec0fb=_0x363256[_0x3479f8(0x28d)],_0xb50079=_0x363256['updated'],_0x1cef4c=_0x363256[_0x3479f8(0x21a)][_0x3479f8(0x28d)],_0x376dab=_0x363256[_0x3479f8(0x21a)][_0x3479f8(0x27d)],_0x4a6945=_0x363256[_0x3479f8(0x21a)][_0x3479f8(0x286)];let _0xd9d9b3;if(_0x684343&&_0x1b21ed[_0x3479f8(0x288)]===0x1){const _0x181b19=_0x1b21ed[0x0];_0xd9d9b3=_0x181b19['existingSegment']?.['id']??_0x363256[_0x3479f8(0x241)][_0x3479f8(0x22f)](_0x181b19['yamlConfig']['name']);}const _0x2cae69=await executePushSegmentDeletions(_0x188c9d,_0x273058[_0x3479f8(0x254)]?[]:_0x38e043,_0x2dfd1a);let _0x413303=0x0,_0x10e349=0x0,_0x55ddfa=0x0;const _0x1d38b7=new Map(_0x5b0b59);for(const [_0x46fa3a,_0x3aa98d]of _0x363256['createdSegmentIds']){_0x1d38b7['set'](_0x46fa3a,_0x3aa98d);}if(_0x2c7499[_0x3479f8(0x288)]>0x0){const _0x4866b2={..._0xd72fa4,'segmentNameToId':_0x1d38b7,'existingSegments':_0x4db7d4,'activationContext':_0xeec34e},_0x102a54=await executePushJourneys(_0x188c9d,_0x2c7499,_0x4866b2,{'parentId':_0x4282d6,'rootFolderId':_0x59b1a3,'verbose':_0x273058[_0x3479f8(0x235)]},_0x2dfd1a);_0x413303=_0x102a54[_0x3479f8(0x28d)],_0x10e349=_0x102a54[_0x3479f8(0x27d)];if(_0x684343&&_0x102a54[_0x3479f8(0x26a)][_0x3479f8(0x288)]===0x1){const _0x10711f=_0x102a54[_0x3479f8(0x26a)][0x0];if(_0x10711f[_0x3479f8(0x257)]){const _0x596803=getConsoleNextUrl(_0x273058['site'],'/app/ps/'+_0x4282d6+_0x3479f8(0x25f)+_0x10711f[_0x3479f8(0x257)]+_0x3479f8(0x242));console[_0x3479f8(0x23d)]('\x20\x20'+a48_0x38a609[_0x3479f8(0x261)](_0x596803));}}}for(const _0x294cc6 of _0x49dbc1){console['error'](a48_0x38a609[_0x3479f8(0x21d)](_0x3479f8(0x1f3)+_0x294cc6[_0x3479f8(0x284)])),_0x55ddfa++;}const _0x257af9=[];if(_0x4ec0fb>0x0)_0x257af9[_0x3479f8(0x267)](_0x4ec0fb+'\x20created');if(_0xb50079>0x0)_0x257af9[_0x3479f8(0x267)](_0xb50079+_0x3479f8(0x1f6));if(_0x2cae69>0x0)_0x257af9[_0x3479f8(0x267)](_0x2cae69+_0x3479f8(0x21b));const _0xf0873=[];if(_0x413303>0x0)_0xf0873[_0x3479f8(0x267)](_0x413303+'\x20created');if(_0x10e349>0x0)_0xf0873[_0x3479f8(0x267)](_0x10e349+_0x3479f8(0x1f6));if(_0x55ddfa>0x0)_0xf0873[_0x3479f8(0x267)](_0x55ddfa+'\x20deleted');const _0x39b536=[];if(_0x1cef4c>0x0)_0x39b536[_0x3479f8(0x267)](_0x1cef4c+'\x20created');if(_0x376dab>0x0)_0x39b536[_0x3479f8(0x267)](_0x376dab+_0x3479f8(0x1f6));if(_0x4a6945>0x0)_0x39b536[_0x3479f8(0x267)](_0x4a6945+_0x3479f8(0x21b));console[_0x3479f8(0x23d)](a48_0x38a609[_0x3479f8(0x233)](_0x3479f8(0x256)));_0x257af9['length']>0x0&&!_0x273058[_0x3479f8(0x254)]&&console[_0x3479f8(0x23d)](_0x3479f8(0x239)+_0x257af9['join'](',\x20'));_0xf0873['length']>0x0&&console['error'](_0x3479f8(0x247)+_0xf0873[_0x3479f8(0x220)](',\x20'));_0x39b536[_0x3479f8(0x288)]>0x0&&!_0x273058['journeysOnly']&&console[_0x3479f8(0x23d)](_0x3479f8(0x21c)+_0x39b536[_0x3479f8(0x220)](',\x20'));if(_0xd9d9b3){const _0x380636=getConsoleNextUrl(_0x273058['site'],_0x3479f8(0x22e)+_0x4282d6+_0x3479f8(0x25f)+_0xd9d9b3+_0x3479f8(0x234));console['error'](_0x3479f8(0x1fa)+a48_0x38a609[_0x3479f8(0x261)](_0x380636));}return 0x0;}}
@@ -1 +1 @@
1
- function a48_0x4109(){const _0x3ae26f=['segmentName','resolveFolderId','Resolving\x20folder\x20\x27','640DzCBRH','INTERNAL','3pLrJJJ','type','description','segmentId','715oZzZTz','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','1206692MAFRuM','260284bMkeLe','segment','5425632uVcRkE','1808pXknPn','Error:\x20Cannot\x20update\x20','yellow','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','error','name','data','Resolving\x20path\x20\x27','1970qqEwHS','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','kind','folder','resolvePathToResource','Resolved\x20relative\x20path\x20to:\x20','\x27...','parentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','verbose','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','43841JUUfPy','segmentPath','Resolved\x20folder\x20ID:\x20','5167845nUwdzA','\x20\x20\x20Path:\x20','285700nAJQyp','Examples:','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','includes','updateSegmentById','Updating\x20segment\x20\x27'];a48_0x4109=function(){return _0x3ae26f;};return a48_0x4109();}function a48_0x50cf(_0x339ae0,_0x297ea7){_0x339ae0=_0x339ae0-0xa4;const _0x410953=a48_0x4109();let _0x50cf4f=_0x410953[_0x339ae0];return _0x50cf4f;}const a48_0x420180=a48_0x50cf;(function(_0x48cf4a,_0x3a8354){const _0x168bfc=a48_0x50cf,_0x59cf19=_0x48cf4a();while(!![]){try{const _0x33f235=parseInt(_0x168bfc(0xa7))/0x1+-parseInt(_0x168bfc(0xa6))/0x2*(parseInt(_0x168bfc(0xce))/0x3)+parseInt(_0x168bfc(0xaa))/0x4*(-parseInt(_0x168bfc(0xb3))/0x5)+-parseInt(_0x168bfc(0xa9))/0x6+-parseInt(_0x168bfc(0xbe))/0x7*(parseInt(_0x168bfc(0xcc))/0x8)+parseInt(_0x168bfc(0xc1))/0x9+-parseInt(_0x168bfc(0xc3))/0xa*(-parseInt(_0x168bfc(0xa4))/0xb);if(_0x33f235===_0x3a8354)break;else _0x59cf19['push'](_0x59cf19['shift']());}catch(_0x3faf23){_0x59cf19['push'](_0x59cf19['shift']());}}}(a48_0x4109,0x7b3d9));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a48_0x3183ad from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']='segment:update';[a48_0x420180(0xd0)]='Update\x20existing\x20child\x20segment';async['execute'](_0x3f6f30){const _0x3043c4=a48_0x420180;console[_0x3043c4(0xaf)](a48_0x3183ad[_0x3043c4(0xac)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console['error'](a48_0x3183ad['yellow'](_0x3043c4(0xbd)));const {options:_0x3cf53e,args:_0x2cc779,tdx:_0x425808}=_0x3f6f30,_0x307093=_0x3cf53e;if(_0x2cc779['length']===0x0)return console[_0x3043c4(0xaf)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x3043c4(0xaf)](_0x3043c4(0xc5)),console[_0x3043c4(0xaf)](_0x3043c4(0xc4)),console[_0x3043c4(0xaf)](_0x3043c4(0xbb)),console['error'](_0x3043c4(0xae)),0x1;const _0x27b0b4=_0x2cc779[0x0],_0x567137=_0x3cf53e[_0x3043c4(0xbf)];let _0x119c5d=_0x27b0b4;_0x567137&&!_0x27b0b4[_0x3043c4(0xc6)]('/')&&(_0x119c5d=_0x567137+'/'+_0x27b0b4,_0x307093[_0x3043c4(0xbc)]&&console[_0x3043c4(0xaf)](_0x3043c4(0xb8)+_0x119c5d));const _0x553981=await withSpinner(_0x3043c4(0xb2)+_0x119c5d+_0x3043c4(0xb9),()=>_0x425808[_0x3043c4(0xa8)][_0x3043c4(0xb7)](_0x119c5d),{'verbose':_0x307093['verbose']}),_0x1c49fe=_0x553981[_0x3043c4(0xb1)];_0x307093[_0x3043c4(0xbc)]&&console[_0x3043c4(0xaf)]('Resolved\x20type:\x20'+_0x1c49fe[_0x3043c4(0xcf)]);if(_0x1c49fe[_0x3043c4(0xcf)]!=='segment')return console[_0x3043c4(0xaf)](_0x3043c4(0xab)+_0x1c49fe[_0x3043c4(0xcf)]+_0x3043c4(0xa5)),console[_0x3043c4(0xaf)](_0x3043c4(0xb4)),0x1;if(!_0x1c49fe[_0x3043c4(0xd1)])throw new SDKError(ErrorCode[_0x3043c4(0xcd)],_0x3043c4(0xad));const _0x2db328=_0x1c49fe[_0x3043c4(0xba)],_0x3ed13d=_0x1c49fe[_0x3043c4(0xd1)];_0x307093[_0x3043c4(0xbc)]&&(console[_0x3043c4(0xaf)]('Parent\x20ID:\x20'+_0x2db328),console[_0x3043c4(0xaf)]('Segment\x20ID:\x20'+_0x3ed13d));let _0x441d34;if(_0x307093[_0x3043c4(0xb6)]){const _0x3efeb1=_0x307093[_0x3043c4(0xb6)],_0x124f98=await withSpinner(_0x3043c4(0xcb)+_0x3efeb1+_0x3043c4(0xb9),()=>_0x425808['segment'][_0x3043c4(0xca)](_0x2db328,_0x3efeb1),{'verbose':_0x307093['verbose']});_0x441d34=parseInt(_0x124f98[_0x3043c4(0xb1)],0xa),_0x307093[_0x3043c4(0xbc)]&&console[_0x3043c4(0xaf)](_0x3043c4(0xc0)+_0x441d34);}const _0x22bd14=await loadJSONFromOptions(_0x307093['rule'],_0x307093['ruleFile']),_0x2f68d4={'name':_0x307093['name'],'description':_0x307093['description'],'rule':_0x22bd14,'kind':_0x307093[_0x3043c4(0xb5)]!==undefined?parseInt(_0x307093[_0x3043c4(0xb5)],0xa):undefined,'segmentFolderId':_0x441d34},_0x23b589=await withSpinner(_0x3043c4(0xc8)+_0x1c49fe[_0x3043c4(0xc9)]+_0x3043c4(0xb9),()=>_0x425808[_0x3043c4(0xa8)][_0x3043c4(0xc7)](_0x2db328,_0x3ed13d,_0x2f68d4),{'verbose':_0x307093[_0x3043c4(0xbc)]}),_0x388cbc=_0x23b589['data'];return console[_0x3043c4(0xaf)]('✔\x20Updated\x20segment\x20\x27'+_0x388cbc[_0x3043c4(0xb0)]+'\x27'),_0x119c5d!==_0x27b0b4&&console[_0x3043c4(0xaf)](_0x3043c4(0xc2)+_0x119c5d),await handleSDKOutput([_0x388cbc],_0x307093),0x0;}}
1
+ const a49_0x41d85b=a49_0x5d46;(function(_0x4dbdeb,_0x5a911b){const _0x258962=a49_0x5d46,_0x122857=_0x4dbdeb();while(!![]){try{const _0xb179e8=-parseInt(_0x258962(0x8f))/0x1+-parseInt(_0x258962(0x8b))/0x2+parseInt(_0x258962(0x82))/0x3+parseInt(_0x258962(0x6a))/0x4+-parseInt(_0x258962(0x76))/0x5*(parseInt(_0x258962(0x87))/0x6)+-parseInt(_0x258962(0x95))/0x7*(parseInt(_0x258962(0x90))/0x8)+parseInt(_0x258962(0x6c))/0x9;if(_0xb179e8===_0x5a911b)break;else _0x122857['push'](_0x122857['shift']());}catch(_0x9fc7bd){_0x122857['push'](_0x122857['shift']());}}}(a49_0x47c0,0xbd341));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a49_0x5d46(_0x4e20e7,_0x52ebd1){_0x4e20e7=_0x4e20e7-0x6a;const _0x47c09b=a49_0x47c0();let _0x5d469a=_0x47c09b[_0x4e20e7];return _0x5d469a;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a49_0x47c0(){const _0x23a8b9=['segmentId','ruleFile','\x27...','1880772yZtlMe','Error:\x20Cannot\x20update\x20','Examples:','segment:update','95756xHomnc','1396640TKKjIe','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Segment\x20ID:\x20','execute','35VbKztY','Updating\x20segment\x20\x27','1326844fKWsqz','kind','15444144SIOphz','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20Path:\x20','Resolving\x20path\x20\x27','includes','folder','parentId','length','description','rule','10qilxOI','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Resolving\x20folder\x20\x27','Update\x20existing\x20child\x20segment','segment','✔\x20Updated\x20segment\x20\x27','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','data','name','Resolved\x20type:\x20','error','verbose','4229748lTawNq','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','updateSegmentById','type','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','2320872iHIzJa'];a49_0x47c0=function(){return _0x23a8b9;};return a49_0x47c0();}import a49_0x5228d6 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a49_0x41d85b(0x7e)]=a49_0x41d85b(0x8e);[a49_0x41d85b(0x74)]=a49_0x41d85b(0x79);async[a49_0x41d85b(0x94)](_0x5a4d5d){const _0x53e0fd=a49_0x41d85b;console[_0x53e0fd(0x80)](a49_0x5228d6['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x53e0fd(0x80)](a49_0x5228d6['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x5e6972,args:_0x43a3e7,tdx:_0x3b958f}=_0x5a4d5d,_0x2181a1=_0x5e6972;if(_0x43a3e7[_0x53e0fd(0x73)]===0x0)return console[_0x53e0fd(0x80)](_0x53e0fd(0x83)),console[_0x53e0fd(0x80)](_0x53e0fd(0x91)),console[_0x53e0fd(0x80)](_0x53e0fd(0x8d)),console[_0x53e0fd(0x80)](_0x53e0fd(0x86)),console[_0x53e0fd(0x80)](_0x53e0fd(0x92)),0x1;const _0xa2a14a=_0x43a3e7[0x0],_0x304902=_0x5e6972['segmentPath'];let _0x186f0f=_0xa2a14a;_0x304902&&!_0xa2a14a[_0x53e0fd(0x70)]('/')&&(_0x186f0f=_0x304902+'/'+_0xa2a14a,_0x2181a1['verbose']&&console[_0x53e0fd(0x80)](_0x53e0fd(0x6d)+_0x186f0f));const _0x5a91fd=await withSpinner(_0x53e0fd(0x6f)+_0x186f0f+'\x27...',()=>_0x3b958f['segment']['resolvePathToResource'](_0x186f0f),{'verbose':_0x2181a1['verbose']}),_0x869fde=_0x5a91fd[_0x53e0fd(0x7d)];_0x2181a1[_0x53e0fd(0x81)]&&console[_0x53e0fd(0x80)](_0x53e0fd(0x7f)+_0x869fde[_0x53e0fd(0x85)]);if(_0x869fde['type']!=='segment')return console[_0x53e0fd(0x80)](_0x53e0fd(0x8c)+_0x869fde[_0x53e0fd(0x85)]+_0x53e0fd(0x7c)),console[_0x53e0fd(0x80)](_0x53e0fd(0x77)),0x1;if(!_0x869fde[_0x53e0fd(0x88)])throw new SDKError(ErrorCode['INTERNAL'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x46cf7d=_0x869fde[_0x53e0fd(0x72)],_0x4aa143=_0x869fde[_0x53e0fd(0x88)];_0x2181a1[_0x53e0fd(0x81)]&&(console[_0x53e0fd(0x80)]('Parent\x20ID:\x20'+_0x46cf7d),console['error'](_0x53e0fd(0x93)+_0x4aa143));let _0xc340c0;if(_0x2181a1[_0x53e0fd(0x71)]){const _0x173fda=_0x2181a1[_0x53e0fd(0x71)],_0x863423=await withSpinner(_0x53e0fd(0x78)+_0x173fda+_0x53e0fd(0x8a),()=>_0x3b958f[_0x53e0fd(0x7a)]['resolveFolderId'](_0x46cf7d,_0x173fda),{'verbose':_0x2181a1[_0x53e0fd(0x81)]});_0xc340c0=parseInt(_0x863423[_0x53e0fd(0x7d)],0xa),_0x2181a1['verbose']&&console[_0x53e0fd(0x80)]('Resolved\x20folder\x20ID:\x20'+_0xc340c0);}const _0x162168=await loadJSONFromOptions(_0x2181a1[_0x53e0fd(0x75)],_0x2181a1[_0x53e0fd(0x89)]),_0x51ecca={'name':_0x2181a1['name'],'description':_0x2181a1[_0x53e0fd(0x74)],'rule':_0x162168,'kind':_0x2181a1[_0x53e0fd(0x6b)]!==undefined?parseInt(_0x2181a1[_0x53e0fd(0x6b)],0xa):undefined,'segmentFolderId':_0xc340c0},_0x4169b0=await withSpinner(_0x53e0fd(0x96)+_0x869fde['segmentName']+_0x53e0fd(0x8a),()=>_0x3b958f[_0x53e0fd(0x7a)][_0x53e0fd(0x84)](_0x46cf7d,_0x4aa143,_0x51ecca),{'verbose':_0x2181a1[_0x53e0fd(0x81)]}),_0x3a1adf=_0x4169b0['data'];return console[_0x53e0fd(0x80)](_0x53e0fd(0x7b)+_0x3a1adf[_0x53e0fd(0x7e)]+'\x27'),_0x186f0f!==_0xa2a14a&&console[_0x53e0fd(0x80)](_0x53e0fd(0x6e)+_0x186f0f),await handleSDKOutput([_0x3a1adf],_0x2181a1),0x0;}}
@@ -1 +1 @@
1
- const a49_0x248271=a49_0x219e;(function(_0x25cd1e,_0x1d57d5){const _0x9a3e97=a49_0x219e,_0x445d13=_0x25cd1e();while(!![]){try{const _0xcd87f1=-parseInt(_0x9a3e97(0x13f))/0x1*(parseInt(_0x9a3e97(0x142))/0x2)+-parseInt(_0x9a3e97(0x144))/0x3+-parseInt(_0x9a3e97(0x13c))/0x4*(parseInt(_0x9a3e97(0x123))/0x5)+parseInt(_0x9a3e97(0x134))/0x6+-parseInt(_0x9a3e97(0x124))/0x7*(-parseInt(_0x9a3e97(0x132))/0x8)+parseInt(_0x9a3e97(0x11e))/0x9+parseInt(_0x9a3e97(0x120))/0xa;if(_0xcd87f1===_0x1d57d5)break;else _0x445d13['push'](_0x445d13['shift']());}catch(_0x4e295c){_0x445d13['push'](_0x445d13['shift']());}}}(a49_0x3086,0xcae4a));import{existsSync,statSync}from'fs';import a49_0x410188 from'chalk';function a49_0x219e(_0x266256,_0x326e7d){_0x266256=_0x266256-0x11d;const _0x30864f=a49_0x3086();let _0x219e3d=_0x30864f[_0x266256];return _0x219e3d;}function a49_0x3086(){const _0x38e5a9=['Examples:','length','parentId','dim','green','Folder\x20ID:\x20','Parent\x20ID:\x20','cyan','2368QIeSrs','Error:\x20Path\x20is\x20required\x0a','7855542UVErfg','segments','\x27...','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','Usage:\x20tdx\x20segment\x20use\x20<path>','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Resolved\x20relative\x20path\x20to:\x20','fullPath','12DimOSp','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','segmentPath','18933yMJRaA','session','data','58jqToQF','error','1353315RklfTj','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','description','segment','Resolving\x20path\x20\x27','Target\x20path:\x20','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','type','verbose','Site:\x20','config','Resolved\x20path\x20type:\x20','execute','parentName','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','slice','4319073kbPpjh','✔\x20Context\x20set\x20to:\x20','10450430xSarBy','red','folderId','2092455iQCGgZ','5971xiykfA','name','site','resolvePathToResource','isDirectory','log'];a49_0x3086=function(){return _0x38e5a9;};return a49_0x3086();}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a49_0x248271(0x125)]='segment:use';[a49_0x248271(0x147)]='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async[a49_0x248271(0x151)](_0x998dd9){const _0x43d29d=a49_0x248271,{options:_0x1b0d03,args:_0x1f6c5b,tdx:_0x4e3718}=_0x998dd9;if(_0x1f6c5b[_0x43d29d(0x12b)]===0x0)return console[_0x43d29d(0x143)](a49_0x410188['red'](_0x43d29d(0x133))),console['error'](_0x43d29d(0x138)),console[_0x43d29d(0x143)](_0x43d29d(0x12a)),console[_0x43d29d(0x143)](_0x43d29d(0x13d)),console[_0x43d29d(0x143)](_0x43d29d(0x145)),console[_0x43d29d(0x143)](_0x43d29d(0x139)),console['error'](_0x43d29d(0x153)),0x1;const _0x5a8e6c=_0x1f6c5b[0x0],_0x49e3ca=_0x1b0d03[_0x43d29d(0x140)];try{if(_0x5a8e6c==='/')return saveSessionContext({'segment_path':undefined},_0x49e3ca),console['log'](a49_0x410188[_0x43d29d(0x12e)](_0x43d29d(0x14b))),0x0;if(existsSync(_0x5a8e6c)&&statSync(_0x5a8e6c)[_0x43d29d(0x128)]()){let _0x45c837;try{_0x45c837=findTdxConfig(_0x5a8e6c);}catch{return console['error'](a49_0x410188['red']('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x5a8e6c)),console[_0x43d29d(0x143)](a49_0x410188[_0x43d29d(0x131)](_0x43d29d(0x146))),0x1;}const _0x11c9e5=_0x45c837[_0x43d29d(0x14f)]['parent_segment'];return saveSessionContext({'segment_path':_0x11c9e5,'parent_segment':_0x11c9e5},_0x49e3ca),console[_0x43d29d(0x129)](a49_0x410188[_0x43d29d(0x12e)](_0x43d29d(0x11f)+a49_0x410188[_0x43d29d(0x131)](_0x11c9e5))),0x0;}const _0x41f6f4=_0x1b0d03[_0x43d29d(0x13e)];let _0x100ce7=_0x5a8e6c;const _0x4f63fe=parsePath(_0x5a8e6c);if(!_0x4f63fe['isAbsolute']){if(!_0x41f6f4)return console[_0x43d29d(0x143)](a49_0x410188['red']('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x43d29d(0x143)](a49_0x410188[_0x43d29d(0x131)]('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x5a8e6c==='..'){const _0x5c364f=_0x41f6f4['split']('/')[_0x43d29d(0x11d)](0x0,-0x1)['join']('/');_0x100ce7=_0x5c364f||'/';}else _0x5a8e6c==='.'?_0x100ce7=_0x41f6f4:_0x100ce7=_0x41f6f4+'/'+_0x5a8e6c;_0x1b0d03[_0x43d29d(0x14d)]&&console[_0x43d29d(0x143)](_0x43d29d(0x13a)+_0x100ce7);}if(_0x100ce7==='/'||_0x100ce7==='')return saveSessionContext({'segment_path':undefined},_0x49e3ca),console[_0x43d29d(0x129)](a49_0x410188[_0x43d29d(0x12e)](_0x43d29d(0x14b))),0x0;_0x100ce7=normalizePath(_0x100ce7);const _0x1c5c39=parsePath(_0x100ce7)[_0x43d29d(0x135)];if(_0x1c5c39[_0x43d29d(0x12b)]===0x0)return saveSessionContext({'segment_path':undefined},_0x49e3ca),console[_0x43d29d(0x129)](a49_0x410188[_0x43d29d(0x12e)](_0x43d29d(0x14b))),0x0;_0x1b0d03['verbose']&&(console[_0x43d29d(0x143)](_0x43d29d(0x14e)+_0x1b0d03[_0x43d29d(0x126)]),console[_0x43d29d(0x143)](_0x43d29d(0x14a)+_0x100ce7));const _0x5e66da=await withSpinner(_0x43d29d(0x149)+_0x100ce7+_0x43d29d(0x136),()=>_0x4e3718[_0x43d29d(0x148)][_0x43d29d(0x127)](_0x100ce7),{'verbose':_0x1b0d03[_0x43d29d(0x14d)]}),_0x47fd00=_0x5e66da[_0x43d29d(0x141)];_0x1b0d03[_0x43d29d(0x14d)]&&(console[_0x43d29d(0x143)](_0x43d29d(0x150)+_0x47fd00[_0x43d29d(0x14c)]),console['error'](_0x43d29d(0x130)+_0x47fd00[_0x43d29d(0x12c)]),_0x47fd00[_0x43d29d(0x122)]&&console[_0x43d29d(0x143)](_0x43d29d(0x12f)+_0x47fd00[_0x43d29d(0x122)]));if(_0x47fd00[_0x43d29d(0x14c)]===_0x43d29d(0x148))return console[_0x43d29d(0x143)](a49_0x410188[_0x43d29d(0x121)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x43d29d(0x143)]('Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.'),console[_0x43d29d(0x143)](a49_0x410188[_0x43d29d(0x131)]('Use:\x20tdx\x20segment\x20use\x20'+_0x47fd00[_0x43d29d(0x152)]+(_0x47fd00['folderPath']?'/'+_0x47fd00['folderPath']['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x47fd00[_0x43d29d(0x13b)],'parent_segment':_0x47fd00['parentName']},_0x49e3ca),console[_0x43d29d(0x129)](a49_0x410188[_0x43d29d(0x12e)](_0x43d29d(0x11f)+a49_0x410188[_0x43d29d(0x131)](_0x47fd00[_0x43d29d(0x13b)]))),_0x1b0d03['verbose']&&(console['error'](a49_0x410188[_0x43d29d(0x12d)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x43d29d(0x143)](a49_0x410188[_0x43d29d(0x12d)](_0x43d29d(0x137)))),0x0;}catch(_0x3d5487){throw _0x3d5487;}}}
1
+ function a50_0x28be(_0x46a583,_0x5541e5){_0x46a583=_0x46a583-0x1d9;const _0x424fcf=a50_0x424f();let _0x28becb=_0x424fcf[_0x46a583];return _0x28becb;}function a50_0x424f(){const _0x1ff4fe=['parentId','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','slice','Use:\x20tdx\x20segment\x20use\x20','error','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','349608rfojVQ','folderId','1205cygrmx','cyan','parentName','1532kKHLng','name','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','496888nqSQbc','18AikPiz','description','763968KFjrlu','Folder\x20ID:\x20','green','Site:\x20','Target\x20path:\x20','length','segmentPath','4xpmKat','join','segment','session','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','201612jkXTPr','segment:use','resolvePathToResource','folderPath','isDirectory','213554yWrozh','verbose','execute','\x27...','945140umqEKA','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','fullPath','log','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','Usage:\x20tdx\x20segment\x20use\x20<path>','parent_segment','isAbsolute','type','Parent\x20ID:\x20','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','site','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','red','✔\x20Context\x20set\x20to:\x20','dim','config','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.'];a50_0x424f=function(){return _0x1ff4fe;};return a50_0x424f();}const a50_0x2d07b8=a50_0x28be;(function(_0x4be880,_0x1bc9be){const _0xd7b01b=a50_0x28be,_0x4bcf01=_0x4be880();while(!![]){try{const _0x355b3e=-parseInt(_0xd7b01b(0x1e7))/0x1+-parseInt(_0xd7b01b(0x1dd))/0x2*(parseInt(_0xd7b01b(0x1e2))/0x3)+-parseInt(_0xd7b01b(0x20a))/0x4*(-parseInt(_0xd7b01b(0x207))/0x5)+parseInt(_0xd7b01b(0x210))/0x6+parseInt(_0xd7b01b(0x205))/0x7+-parseInt(_0xd7b01b(0x20d))/0x8*(-parseInt(_0xd7b01b(0x20e))/0x9)+parseInt(_0xd7b01b(0x1eb))/0xa;if(_0x355b3e===_0x1bc9be)break;else _0x4bcf01['push'](_0x4bcf01['shift']());}catch(_0x111072){_0x4bcf01['push'](_0x4bcf01['shift']());}}}(a50_0x424f,0x2243d));import{existsSync,statSync}from'fs';import a50_0x1f4af2 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a50_0x2d07b8(0x20b)]=a50_0x2d07b8(0x1e3);[a50_0x2d07b8(0x20f)]='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async[a50_0x2d07b8(0x1e9)](_0x398931){const _0x1c84b1=a50_0x2d07b8,{options:_0x1e5933,args:_0x96f8e2,tdx:_0x3498a3}=_0x398931;if(_0x96f8e2[_0x1c84b1(0x1db)]===0x0)return console['error'](a50_0x1f4af2[_0x1c84b1(0x1f9)]('Error:\x20Path\x20is\x20required\x0a')),console[_0x1c84b1(0x202)](_0x1c84b1(0x1f1)),console[_0x1c84b1(0x202)]('Examples:'),console[_0x1c84b1(0x202)](_0x1c84b1(0x1f8)),console[_0x1c84b1(0x202)](_0x1c84b1(0x1f0)),console[_0x1c84b1(0x202)](_0x1c84b1(0x203)),console['error'](_0x1c84b1(0x1e1)),0x1;const _0x37c66c=_0x96f8e2[0x0],_0x27f4db=_0x1e5933[_0x1c84b1(0x1e0)];try{if(_0x37c66c==='/')return saveSessionContext({'segment_path':undefined},_0x27f4db),console[_0x1c84b1(0x1ee)](a50_0x1f4af2['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x37c66c)&&statSync(_0x37c66c)[_0x1c84b1(0x1e6)]()){let _0x269ec7;try{_0x269ec7=findTdxConfig(_0x37c66c);}catch{return console[_0x1c84b1(0x202)](a50_0x1f4af2['red'](_0x1c84b1(0x1ec)+_0x37c66c)),console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x208)](_0x1c84b1(0x1ff))),0x1;}const _0x1bd854=_0x269ec7[_0x1c84b1(0x1fc)][_0x1c84b1(0x1f2)];return saveSessionContext({'segment_path':_0x1bd854,'parent_segment':_0x1bd854},_0x27f4db),console['log'](a50_0x1f4af2[_0x1c84b1(0x212)](_0x1c84b1(0x1fa)+a50_0x1f4af2[_0x1c84b1(0x208)](_0x1bd854))),0x0;}const _0x442f5f=_0x1e5933[_0x1c84b1(0x1dc)];let _0x604ac9=_0x37c66c;const _0x4986a0=parsePath(_0x37c66c);if(!_0x4986a0[_0x1c84b1(0x1f3)]){if(!_0x442f5f)return console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x1f9)](_0x1c84b1(0x1ef))),console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x208)]('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x37c66c==='..'){const _0x1e0c77=_0x442f5f['split']('/')[_0x1c84b1(0x200)](0x0,-0x1)[_0x1c84b1(0x1de)]('/');_0x604ac9=_0x1e0c77||'/';}else _0x37c66c==='.'?_0x604ac9=_0x442f5f:_0x604ac9=_0x442f5f+'/'+_0x37c66c;_0x1e5933[_0x1c84b1(0x1e8)]&&console[_0x1c84b1(0x202)]('Resolved\x20relative\x20path\x20to:\x20'+_0x604ac9);}if(_0x604ac9==='/'||_0x604ac9==='')return saveSessionContext({'segment_path':undefined},_0x27f4db),console['log'](a50_0x1f4af2[_0x1c84b1(0x212)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x604ac9=normalizePath(_0x604ac9);const _0x25e6b7=parsePath(_0x604ac9)['segments'];if(_0x25e6b7[_0x1c84b1(0x1db)]===0x0)return saveSessionContext({'segment_path':undefined},_0x27f4db),console[_0x1c84b1(0x1ee)](a50_0x1f4af2[_0x1c84b1(0x212)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x1e5933['verbose']&&(console['error'](_0x1c84b1(0x1d9)+_0x1e5933[_0x1c84b1(0x1f7)]),console[_0x1c84b1(0x202)](_0x1c84b1(0x1da)+_0x604ac9));const _0x2d9f5e=await withSpinner('Resolving\x20path\x20\x27'+_0x604ac9+_0x1c84b1(0x1ea),()=>_0x3498a3[_0x1c84b1(0x1df)][_0x1c84b1(0x1e4)](_0x604ac9),{'verbose':_0x1e5933[_0x1c84b1(0x1e8)]}),_0x2ffb8f=_0x2d9f5e['data'];_0x1e5933['verbose']&&(console[_0x1c84b1(0x202)]('Resolved\x20path\x20type:\x20'+_0x2ffb8f[_0x1c84b1(0x1f4)]),console[_0x1c84b1(0x202)](_0x1c84b1(0x1f5)+_0x2ffb8f[_0x1c84b1(0x1fe)]),_0x2ffb8f[_0x1c84b1(0x206)]&&console[_0x1c84b1(0x202)](_0x1c84b1(0x211)+_0x2ffb8f['folderId']));if(_0x2ffb8f[_0x1c84b1(0x1f4)]===_0x1c84b1(0x1df))return console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x1f9)](_0x1c84b1(0x1f6))),console['error'](_0x1c84b1(0x1fd)),console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x208)](_0x1c84b1(0x201)+_0x2ffb8f[_0x1c84b1(0x209)]+(_0x2ffb8f['folderPath']?'/'+_0x2ffb8f[_0x1c84b1(0x1e5)][_0x1c84b1(0x1de)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x2ffb8f[_0x1c84b1(0x1ed)],'parent_segment':_0x2ffb8f[_0x1c84b1(0x209)]},_0x27f4db),console[_0x1c84b1(0x1ee)](a50_0x1f4af2[_0x1c84b1(0x212)](_0x1c84b1(0x1fa)+a50_0x1f4af2['cyan'](_0x2ffb8f[_0x1c84b1(0x1ed)]))),_0x1e5933[_0x1c84b1(0x1e8)]&&(console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x1fb)](_0x1c84b1(0x20c))),console[_0x1c84b1(0x202)](a50_0x1f4af2[_0x1c84b1(0x1fb)](_0x1c84b1(0x204)))),0x0;}catch(_0x32b6eb){throw _0x32b6eb;}}}
@@ -1 +1 @@
1
- function a50_0x2d48(_0x1063c2,_0x9ad822){_0x1063c2=_0x1063c2-0x129;const _0xb2f038=a50_0xb2f0();let _0x2d4878=_0xb2f038[_0x1063c2];return _0x2d4878;}const a50_0x6f7779=a50_0x2d48;(function(_0x12c9ea,_0x5b1946){const _0x4dae40=a50_0x2d48,_0x3fc91e=_0x12c9ea();while(!![]){try{const _0x4ff1f0=-parseInt(_0x4dae40(0x134))/0x1+-parseInt(_0x4dae40(0x13d))/0x2+-parseInt(_0x4dae40(0x13f))/0x3+parseInt(_0x4dae40(0x149))/0x4+-parseInt(_0x4dae40(0x139))/0x5+parseInt(_0x4dae40(0x138))/0x6*(-parseInt(_0x4dae40(0x14a))/0x7)+parseInt(_0x4dae40(0x15b))/0x8*(parseInt(_0x4dae40(0x12a))/0x9);if(_0x4ff1f0===_0x5b1946)break;else _0x3fc91e['push'](_0x3fc91e['shift']());}catch(_0x31e7a2){_0x3fc91e['push'](_0x3fc91e['shift']());}}}(a50_0xb2f0,0x810ff));import{BaseCommand}from'./command.js';function a50_0xb2f0(){const _0x1de86e=['invalidCount','hasErrors','verbose','file','\x20file(s)\x20valid','parentSegment','type','yellow','4114248zmRzjS','):\x20','errorCode','\x20error(s)','Validation\x20failed:\x20','36eKOiGi','cwd','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','length','✔\x20All\x20','\x20warning(s)','\x20warning(s)\x20found','red','green','description','358540vEsQry','\x20valid','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','.yaml','6ocxdQW','297425tyStnF','message','errors','filePath','1922508izAzKJ','helpText','1556664JQNAup','validCount','warnings','\x20file(s)\x20with\x20errors,\x20','no_parent','valid','dim','Validate\x20segment\x20and\x20journey\x20YAML\x20files','log','.yml','1724384rMgGEn','429898PjfOPQ','targetDir','cyan','segment:validate','Error:\x20Directory\x20not\x20found:\x20','warningCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','name','error'];a50_0xb2f0=function(){return _0x1de86e;};return a50_0xb2f0();}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a50_0xdb39db from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{[a50_0x6f7779(0x151)]=a50_0x6f7779(0x14d);[a50_0x6f7779(0x133)]=a50_0x6f7779(0x146);async['execute'](_0x3075af){const _0x6769c=a50_0x6f7779,{options:_0x112f72,args:_0x4583a1}=_0x3075af,_0x5dbb96=_0x112f72,_0x4ebf3b=await resolveTarget({'arg':_0x4583a1[0x0],'contextParent':_0x112f72[_0x6769c(0x158)],'cwd':process[_0x6769c(0x12b)]()});if(!isSuccessfulResolution(_0x4ebf3b))return _0x4ebf3b[_0x6769c(0x15d)]===_0x6769c(0x143)?(console[_0x6769c(0x152)](a50_0xdb39db['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x6769c(0x152)]('Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console[_0x6769c(0x152)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console[_0x6769c(0x152)](_0x6769c(0x150))):(console['error'](a50_0xdb39db[_0x6769c(0x131)]('Error:\x20'+_0x4ebf3b[_0x6769c(0x13a)]+'\x0a')),_0x4ebf3b[_0x6769c(0x13e)]&&console[_0x6769c(0x152)](a50_0xdb39db[_0x6769c(0x14c)](_0x4ebf3b[_0x6769c(0x13e)]))),0x1;const _0x4af0dd=_0x4ebf3b[_0x6769c(0x14b)],_0x424c30=_0x4ebf3b[_0x6769c(0x159)]===_0x6769c(0x156)?_0x4ebf3b[_0x6769c(0x13c)]:undefined;if(!_0x424c30&&!existsSync(_0x4af0dd))return console['error'](a50_0xdb39db[_0x6769c(0x131)](_0x6769c(0x14e)+_0x4af0dd+'\x0a')),0x1;let _0x3b4d06;if(_0x424c30){if(!_0x424c30['endsWith'](_0x6769c(0x148))&&!_0x424c30['endsWith'](_0x6769c(0x137)))return console[_0x6769c(0x152)](a50_0xdb39db[_0x6769c(0x131)](_0x6769c(0x12c)+_0x424c30+'\x0a')),0x1;_0x3b4d06=[_0x424c30];}else _0x3b4d06=findYamlFiles(_0x4af0dd);if(_0x3b4d06['length']===0x0)return console[_0x6769c(0x152)](a50_0xdb39db[_0x6769c(0x131)](_0x6769c(0x136)+_0x4af0dd+'\x0a')),0x1;const _0x10e9f6=validateYamlFiles(_0x3b4d06,_0x4af0dd),_0x4bb958=calculateSummary(_0x10e9f6);for(const _0x5b174f of _0x10e9f6){if(!isValidationResult(_0x5b174f))continue;const {relativePath:_0x37a79d,source:_0x225bb3,result:_0x10846b,fileType:_0x35c420}=_0x5b174f,_0x1c77fe=_0x35c420;if(_0x10846b['valid']&&_0x10846b[_0x6769c(0x141)][_0x6769c(0x12d)]===0x0)_0x5dbb96[_0x6769c(0x155)]&&console['log'](a50_0xdb39db[_0x6769c(0x132)]('✔\x20'+_0x37a79d)+a50_0xdb39db[_0x6769c(0x145)]('\x20('+_0x1c77fe+')'));else _0x10846b[_0x6769c(0x144)]?(console[_0x6769c(0x147)](a50_0xdb39db[_0x6769c(0x15a)]('⚠\x20'+_0x37a79d)+a50_0xdb39db[_0x6769c(0x145)]('\x20('+_0x1c77fe+_0x6769c(0x15c)+_0x10846b['warnings']['length']+_0x6769c(0x12f))),console[_0x6769c(0x147)](formatValidationResult(_0x10846b,_0x225bb3,_0x37a79d))):(console[_0x6769c(0x147)](a50_0xdb39db[_0x6769c(0x131)]('✖\x20'+_0x37a79d)+a50_0xdb39db[_0x6769c(0x145)]('\x20('+_0x1c77fe+_0x6769c(0x15c)+_0x10846b[_0x6769c(0x13b)]['length']+_0x6769c(0x15e))),console[_0x6769c(0x147)](formatValidationResult(_0x10846b,_0x225bb3,_0x37a79d)));}return console[_0x6769c(0x147)](''),_0x4bb958[_0x6769c(0x154)]?(console[_0x6769c(0x147)](a50_0xdb39db[_0x6769c(0x131)](_0x6769c(0x129)+_0x4bb958[_0x6769c(0x153)]+_0x6769c(0x142)+_0x4bb958[_0x6769c(0x140)]+_0x6769c(0x135))),_0x4bb958[_0x6769c(0x14f)]>0x0&&console['log'](a50_0xdb39db[_0x6769c(0x15a)](_0x4bb958[_0x6769c(0x14f)]+'\x20warning(s)\x20found')),0x1):(console['log'](a50_0xdb39db[_0x6769c(0x132)](_0x6769c(0x12e)+_0x4bb958[_0x6769c(0x140)]+_0x6769c(0x157))),_0x4bb958['warningCount']>0x0&&console[_0x6769c(0x147)](a50_0xdb39db[_0x6769c(0x15a)](_0x4bb958[_0x6769c(0x14f)]+_0x6769c(0x130))),0x0);}}
1
+ const a51_0x4d5725=a51_0x4c27;(function(_0x3ead1f,_0x2c35f6){const _0x1dcec9=a51_0x4c27,_0x417767=_0x3ead1f();while(!![]){try{const _0x355236=parseInt(_0x1dcec9(0xe7))/0x1+parseInt(_0x1dcec9(0xf2))/0x2+-parseInt(_0x1dcec9(0xfc))/0x3+-parseInt(_0x1dcec9(0xf7))/0x4*(parseInt(_0x1dcec9(0xde))/0x5)+parseInt(_0x1dcec9(0xf5))/0x6*(parseInt(_0x1dcec9(0xcd))/0x7)+parseInt(_0x1dcec9(0xe3))/0x8*(parseInt(_0x1dcec9(0xea))/0x9)+-parseInt(_0x1dcec9(0xec))/0xa;if(_0x355236===_0x2c35f6)break;else _0x417767['push'](_0x417767['shift']());}catch(_0x4f9bf4){_0x417767['push'](_0x417767['shift']());}}}(a51_0x50cd,0x1a8b2));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a51_0x50cd(){const _0x2804c7=['no_parent','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','201078oFampw','\x20file(s)\x20with\x20errors,\x20','green','513LHQXbs','errors','4070490ddGKOV','targetDir','validCount','):\x20','\x20valid','red','375310RREbTf','valid','name','78iNDBSL','Validation\x20failed:\x20','268vozgNd','type','log','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','description','72564iNgpzT','dim','57631GrQGYJ','yellow','error','Validate\x20segment\x20and\x20journey\x20YAML\x20files','\x20file(s)\x20valid','Error:\x20Directory\x20not\x20found:\x20','segment:validate','invalidCount','\x20warning(s)\x20found','.yaml','cyan','\x20error(s)','helpText','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','length','verbose','warningCount','10990GqCzSX','endsWith','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','Error:\x20','hasErrors','26872VhBfZU','\x20warning(s)'];a51_0x50cd=function(){return _0x2804c7;};return a51_0x50cd();}import a51_0x3c8dc0 from'chalk';function a51_0x4c27(_0x5157a7,_0x3ac3a9){_0x5157a7=_0x5157a7-0xcd;const _0x50cd25=a51_0x50cd();let _0x4c27a4=_0x50cd25[_0x5157a7];return _0x4c27a4;}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{[a51_0x4d5725(0xf4)]=a51_0x4d5725(0xd3);[a51_0x4d5725(0xfb)]=a51_0x4d5725(0xd0);async['execute'](_0x2210ac){const _0xf148e3=a51_0x4d5725,{options:_0x51ba70,args:_0x567d76}=_0x2210ac,_0x3fb8e8=_0x51ba70,_0x48774b=await resolveTarget({'arg':_0x567d76[0x0],'contextParent':_0x51ba70['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x48774b))return _0x48774b['errorCode']===_0xf148e3(0xe5)?(console[_0xf148e3(0xcf)](a51_0x3c8dc0[_0xf148e3(0xce)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0xf148e3(0xcf)](_0xf148e3(0xe0)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console['error'](_0xf148e3(0xfa))):(console['error'](a51_0x3c8dc0['red'](_0xf148e3(0xe1)+_0x48774b['message']+'\x0a')),_0x48774b[_0xf148e3(0xd9)]&&console[_0xf148e3(0xcf)](a51_0x3c8dc0[_0xf148e3(0xd7)](_0x48774b[_0xf148e3(0xd9)]))),0x1;const _0x38fbc0=_0x48774b[_0xf148e3(0xed)],_0x54bba5=_0x48774b[_0xf148e3(0xf8)]==='file'?_0x48774b['filePath']:undefined;if(!_0x54bba5&&!existsSync(_0x38fbc0))return console[_0xf148e3(0xcf)](a51_0x3c8dc0['red'](_0xf148e3(0xd2)+_0x38fbc0+'\x0a')),0x1;let _0x7761f9;if(_0x54bba5){if(!_0x54bba5[_0xf148e3(0xdf)]('.yml')&&!_0x54bba5[_0xf148e3(0xdf)](_0xf148e3(0xd6)))return console[_0xf148e3(0xcf)](a51_0x3c8dc0[_0xf148e3(0xf1)](_0xf148e3(0xe6)+_0x54bba5+'\x0a')),0x1;_0x7761f9=[_0x54bba5];}else _0x7761f9=findYamlFiles(_0x38fbc0);if(_0x7761f9[_0xf148e3(0xdb)]===0x0)return console['error'](a51_0x3c8dc0[_0xf148e3(0xf1)](_0xf148e3(0xda)+_0x38fbc0+'\x0a')),0x1;const _0x390fd3=validateYamlFiles(_0x7761f9,_0x38fbc0),_0x1f8ffd=calculateSummary(_0x390fd3);for(const _0x1f2cdb of _0x390fd3){if(!isValidationResult(_0x1f2cdb))continue;const {relativePath:_0x2a2db0,source:_0x33b740,result:_0x2c6916,fileType:_0x214f2f}=_0x1f2cdb,_0x508f37=_0x214f2f;if(_0x2c6916[_0xf148e3(0xf3)]&&_0x2c6916['warnings'][_0xf148e3(0xdb)]===0x0)_0x3fb8e8[_0xf148e3(0xdc)]&&console['log'](a51_0x3c8dc0[_0xf148e3(0xe9)]('✔\x20'+_0x2a2db0)+a51_0x3c8dc0[_0xf148e3(0xfd)]('\x20('+_0x508f37+')'));else _0x2c6916[_0xf148e3(0xf3)]?(console[_0xf148e3(0xf9)](a51_0x3c8dc0[_0xf148e3(0xce)]('⚠\x20'+_0x2a2db0)+a51_0x3c8dc0[_0xf148e3(0xfd)]('\x20('+_0x508f37+_0xf148e3(0xef)+_0x2c6916['warnings']['length']+_0xf148e3(0xe4))),console['log'](formatValidationResult(_0x2c6916,_0x33b740,_0x2a2db0))):(console[_0xf148e3(0xf9)](a51_0x3c8dc0[_0xf148e3(0xf1)]('✖\x20'+_0x2a2db0)+a51_0x3c8dc0[_0xf148e3(0xfd)]('\x20('+_0x508f37+_0xf148e3(0xef)+_0x2c6916[_0xf148e3(0xeb)]['length']+_0xf148e3(0xd8))),console['log'](formatValidationResult(_0x2c6916,_0x33b740,_0x2a2db0)));}return console[_0xf148e3(0xf9)](''),_0x1f8ffd[_0xf148e3(0xe2)]?(console[_0xf148e3(0xf9)](a51_0x3c8dc0[_0xf148e3(0xf1)](_0xf148e3(0xf6)+_0x1f8ffd[_0xf148e3(0xd4)]+_0xf148e3(0xe8)+_0x1f8ffd[_0xf148e3(0xee)]+_0xf148e3(0xf0))),_0x1f8ffd[_0xf148e3(0xdd)]>0x0&&console['log'](a51_0x3c8dc0[_0xf148e3(0xce)](_0x1f8ffd[_0xf148e3(0xdd)]+'\x20warning(s)\x20found')),0x1):(console['log'](a51_0x3c8dc0['green']('✔\x20All\x20'+_0x1f8ffd[_0xf148e3(0xee)]+_0xf148e3(0xd1))),_0x1f8ffd[_0xf148e3(0xdd)]>0x0&&console['log'](a51_0x3c8dc0[_0xf148e3(0xce)](_0x1f8ffd[_0xf148e3(0xdd)]+_0xf148e3(0xd5))),0x0);}}
@@ -1 +1 @@
1
- const a51_0x59499d=a51_0x12c3;(function(_0x171c06,_0x423e2f){const _0x19d281=a51_0x12c3,_0x9f20e3=_0x171c06();while(!![]){try{const _0x3d7ff1=parseInt(_0x19d281(0x1c7))/0x1+parseInt(_0x19d281(0x1f2))/0x2*(-parseInt(_0x19d281(0x1c9))/0x3)+-parseInt(_0x19d281(0x1eb))/0x4*(-parseInt(_0x19d281(0x1d1))/0x5)+-parseInt(_0x19d281(0x1ba))/0x6*(-parseInt(_0x19d281(0x1bc))/0x7)+-parseInt(_0x19d281(0x1ef))/0x8+-parseInt(_0x19d281(0x1ff))/0x9+parseInt(_0x19d281(0x1bb))/0xa*(parseInt(_0x19d281(0x1c8))/0xb);if(_0x3d7ff1===_0x423e2f)break;else _0x9f20e3['push'](_0x9f20e3['shift']());}catch(_0x2fb4ab){_0x9f20e3['push'](_0x9f20e3['shift']());}}}(a51_0x2416,0xf0b8d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';function a51_0x12c3(_0x3fc61b,_0x498f46){_0x3fc61b=_0x3fc61b-0x1a9;const _0x241608=a51_0x2416();let _0x12c305=_0x241608[_0x3fc61b];return _0x12c305;}import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a51_0x3f6433 from'chalk';function a51_0x2416(){const _0x291e41=['folderId','Site:\x20','\x20folder','1295079LqHkTu','2343869veSIWb','5090937zzkKrl','dim','localeCompare','map','padEnd','journeyBundleName','Parent\x20ID:\x20','sort','5XLxRym','description',',\x20and\x20','Listing\x20folders,\x20segments,\x20and\x20journeys...','\x27...','path','listUnifiedWithJourneys','error','segments','message','folders','...','format','Set\x20a\x20parent\x20segment\x20context\x20first:','site','size','Found\x20','toLowerCase','searchByName','parentId','verbose','Building\x20hierarchy\x20tree...','Folder\x20ID:\x20','includes','folder','(empty)','1703816vvjCpQ','\x20segment','parentSegment','name','11530848RXKPCm','/e/','maxDepth','2tkpwFL','Error:\x20','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','listWithPattern','cause','No\x20items\x20match\x20pattern:\x20','✔\x20Found\x20','execute','No\x20folders\x20or\x20segments\x20match\x20','Resolving\x20parent\x20segment\x20\x27','\x5c$&','replace','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','17712981GsdxYs','/app/ps/','Parent\x20segment\x20context:\x20','length','test','(id\x20','Resolving\x20path\x20\x27','List\x20folders\x20and\x20child\x20segments','filter','recursive','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','(not\x20set)','resolvePathToResource','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','segment','/j/da','listRecursive','journeys','data','Error:\x20No\x20parent\x20segment\x20context\x20set.','Recursive\x20mode:\x20enabled','1110BcUoUX','170DwUNmS','28343lejfYa','json','journey','log','\x20journey','type','jsonl','✔\x20Built\x20tree\x20with\x20'];a51_0x2416=function(){return _0x291e41;};return a51_0x2416();}export class SegmentsCommand extends BaseCommand{[a51_0x59499d(0x1ee)]='segments';[a51_0x59499d(0x1d2)]=a51_0x59499d(0x1ac);async[a51_0x59499d(0x1f9)](_0x95fb75){const _0x4398b8=a51_0x59499d,{options:_0x5b25cb,args:_0x33f015}=_0x95fb75,_0x2920ed=_0x5b25cb[_0x4398b8(0x1ae)],_0x4b99ef=_0x33f015[0x0];try{const _0x3bd16d=_0x5b25cb[_0x4398b8(0x1ed)];_0x5b25cb[_0x4398b8(0x1e5)]&&(console[_0x4398b8(0x1d8)](_0x4398b8(0x1c5)+_0x5b25cb['site']),console['error'](_0x4398b8(0x201)+(_0x3bd16d||_0x4398b8(0x1b0))),_0x4b99ef&&console[_0x4398b8(0x1d8)]('Folder/pattern\x20arg:\x20'+_0x4b99ef),_0x2920ed&&console[_0x4398b8(0x1d8)](_0x4398b8(0x1b9)));if(!_0x3bd16d)return console[_0x4398b8(0x1d8)](_0x4398b8(0x1b8)),console[_0x4398b8(0x1d8)](''),console['error'](_0x4398b8(0x1de)),console[_0x4398b8(0x1d8)](_0x4398b8(0x1fe)),console[_0x4398b8(0x1d8)](_0x4398b8(0x1f4)),console['error'](''),console['error'](_0x4398b8(0x1af)),0x1;if(_0x4b99ef&&_0x2920ed)return await this[_0x4398b8(0x1e3)](_0x95fb75,_0x3bd16d,_0x4b99ef);const _0x303221=_0x4b99ef&&(_0x4b99ef['includes']('*')||_0x4b99ef[_0x4398b8(0x1e8)]('?'));if(_0x303221)return await this[_0x4398b8(0x1f5)](_0x95fb75,_0x3bd16d,_0x4b99ef);const _0x5226f7=_0x4b99ef?_0x3bd16d+'/'+_0x4b99ef:_0x3bd16d;return _0x2920ed?await this[_0x4398b8(0x1b5)](_0x95fb75,_0x5226f7):await this['listUnified'](_0x95fb75,_0x5226f7);}catch(_0x749070){if(_0x749070 instanceof SDKError)return console[_0x4398b8(0x1d8)](_0x4398b8(0x1f3)+_0x749070[_0x4398b8(0x1da)]),_0x749070[_0x4398b8(0x1f6)]&&console['error']('\x20\x20Cause:\x20'+_0x749070['cause']),0x1;throw _0x749070;}}async[a51_0x59499d(0x1e3)](_0x47679e,_0x293a8c,_0x1c94be){const _0x54e7da=a51_0x59499d,{options:_0x5d371f,tdx:_0xec1188}=_0x47679e,_0x1b3dc4='\x22'+_0x1c94be+'\x22',_0x160f7c=await withSpinner(_0x54e7da(0x1ab)+_0x293a8c+_0x54e7da(0x1d5),()=>_0xec1188[_0x54e7da(0x1b3)][_0x54e7da(0x1b1)](_0x293a8c),{'verbose':_0x5d371f[_0x54e7da(0x1e5)]}),_0x3cee0f=_0x160f7c[_0x54e7da(0x1b7)],_0x50c01c=_0x5d371f[_0x54e7da(0x1f1)]||0xa,_0x16b738=await withSpinner('Searching\x20the\x20tree\x20for\x20names\x20matching\x20'+_0x1b3dc4+_0x54e7da(0x1dc),()=>_0xec1188[_0x54e7da(0x1b3)][_0x54e7da(0x1b5)](_0x3cee0f[_0x54e7da(0x1e4)],_0x3cee0f[_0x54e7da(0x1c4)],0x0,_0x50c01c),{'verbose':_0x5d371f[_0x54e7da(0x1e5)]}),_0x37443c=searchTreeByName(_0x16b738['data'],_0x1c94be),_0x499d73=_0x70fd0d=>getConsoleNextUrl(_0x5d371f[_0x54e7da(0x1df)],_0x54e7da(0x200)+_0x3cee0f[_0x54e7da(0x1e4)]+'/e/'+_0x70fd0d),_0x39df00=[..._0x37443c][_0x54e7da(0x1d0)]((_0x2d16e6,_0xd14bd0)=>_0x2d16e6[_0x54e7da(0x1d6)]['localeCompare'](_0xd14bd0[_0x54e7da(0x1d6)])),_0x4a01ab=0x32,_0x5571bd=_0x54e7da(0x1e1)+_0x37443c[_0x54e7da(0x202)]+'\x20match'+(_0x37443c[_0x54e7da(0x202)]!==0x1?'es':'');console[_0x54e7da(0x1d8)](_0x37443c[_0x54e7da(0x202)]>_0x4a01ab?'✔\x20'+_0x5571bd+'\x20—\x20that\x27s\x20a\x20lot\x20to\x20eyeball.\x20Narrow\x20the\x20pattern\x20(add\x20more\x20of\x20the\x20name,\x20or\x20use\x20*\x20/\x20?),\x20or\x20use\x20--format\x20json\x20and\x20filter\x20with\x20jq/grep.':'✔\x20'+_0x5571bd);if(_0x5d371f['format']===_0x54e7da(0x1bd)||_0x5d371f[_0x54e7da(0x1dd)]===_0x54e7da(0x1c2)){const _0x31ca90=_0x39df00[_0x54e7da(0x1cc)](_0x157151=>({..._0x157151,..._0x157151[_0x54e7da(0x1c1)]===_0x54e7da(0x1b3)?{'url':_0x499d73(_0x157151['id'])}:{}}));return await handleSDKOutput(_0x31ca90,_0x5d371f),0x0;}if(_0x37443c[_0x54e7da(0x202)]===0x0)return console[_0x54e7da(0x1bf)](_0x54e7da(0x1fa)+_0x1b3dc4),0x0;for(const _0x128144 of _0x39df00){console[_0x54e7da(0x1bf)](_0x128144[_0x54e7da(0x1c1)][_0x54e7da(0x1cd)](0x8)+'\x20'+_0x128144[_0x54e7da(0x1d6)]+'\x20\x20'+a51_0x3f6433[_0x54e7da(0x1ca)](_0x54e7da(0x1aa)+_0x128144['id']+')'));}const _0x562126=_0x37443c[_0x54e7da(0x1ad)](_0x34a684=>_0x34a684[_0x54e7da(0x1c1)]==='segment'),_0x4601c7=new Set(_0x562126['map'](_0x3b126c=>_0x3b126c['name'][_0x54e7da(0x1e2)]()))[_0x54e7da(0x1e0)]===0x1;return _0x562126[_0x54e7da(0x202)]>0x1&&_0x4601c7&&console[_0x54e7da(0x1bf)](a51_0x3f6433[_0x54e7da(0x1ca)]('\x0a'+_0x562126[_0x54e7da(0x202)]+_0x54e7da(0x1b2))),0x0;}async['listWithPattern'](_0x338203,_0x527879,_0x564157){const _0x7d81f2=a51_0x59499d,{options:_0x4587c1,tdx:_0x142601}=_0x338203,_0x5e2920=await withSpinner(_0x7d81f2(0x1fb)+_0x527879+_0x7d81f2(0x1d5),()=>_0x142601['segment'][_0x7d81f2(0x1b1)](_0x527879),{'verbose':_0x4587c1[_0x7d81f2(0x1e5)]}),_0x1150e5=_0x5e2920[_0x7d81f2(0x1b7)],_0x456483=await withSpinner(_0x7d81f2(0x1d4),()=>_0x142601['segment']['listUnifiedWithJourneys'](_0x1150e5[_0x7d81f2(0x1e4)],_0x1150e5[_0x7d81f2(0x1c4)]),{'verbose':_0x4587c1[_0x7d81f2(0x1e5)]}),{folders:_0x2f86d6,segments:_0x2c0833,journeys:_0x1237d4}=_0x456483['data'],_0x49e97a=_0x564157['replace'](/[.+^${}()|[\]\\]/g,_0x7d81f2(0x1fc))[_0x7d81f2(0x1fd)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x282191=new RegExp('^'+_0x49e97a+'$','i'),_0x2598d4=_0x2f86d6[_0x7d81f2(0x1ad)](_0x3592ad=>_0x282191[_0x7d81f2(0x1a9)](_0x3592ad[_0x7d81f2(0x1ee)])),_0x55a7f2=_0x2c0833['filter'](_0x490ee9=>_0x282191[_0x7d81f2(0x1a9)](_0x490ee9[_0x7d81f2(0x1ee)])),_0x5aaac7=_0x1237d4[_0x7d81f2(0x1ad)](_0xe69285=>_0x282191[_0x7d81f2(0x1a9)](_0xe69285['journeyBundleName'])),_0x300bbd=_0x2598d4[_0x7d81f2(0x202)]+_0x55a7f2[_0x7d81f2(0x202)]+_0x5aaac7['length'];console[_0x7d81f2(0x1d8)](_0x7d81f2(0x1f8)+_0x2598d4[_0x7d81f2(0x202)]+_0x7d81f2(0x1c6)+(_0x2598d4[_0x7d81f2(0x202)]!==0x1?'s':'')+',\x20'+_0x55a7f2['length']+_0x7d81f2(0x1ec)+(_0x55a7f2['length']!==0x1?'s':'')+',\x20and\x20'+_0x5aaac7[_0x7d81f2(0x202)]+'\x20journey'+(_0x5aaac7[_0x7d81f2(0x202)]!==0x1?'s':'')+'\x20matching\x20\x27'+_0x564157+'\x27');const _0x1f870c=_0x4a2dbd=>{const _0x10727a=_0x7d81f2;return getConsoleNextUrl(_0x4587c1[_0x10727a(0x1df)],_0x10727a(0x200)+_0x1150e5['parentId']+_0x10727a(0x1f0)+_0x4a2dbd);},_0x3c8b39=_0x4587c1[_0x7d81f2(0x1dd)]==='json'||_0x4587c1[_0x7d81f2(0x1dd)]===_0x7d81f2(0x1c2);if(_0x3c8b39){const _0x5c2c89=[..._0x2598d4['map'](_0x2e45d4=>({..._0x2e45d4,'type':_0x7d81f2(0x1e9)})),..._0x55a7f2[_0x7d81f2(0x1cc)](_0x478d06=>({..._0x478d06,'type':_0x7d81f2(0x1b3),'url':_0x1f870c(_0x478d06['id'])})),..._0x5aaac7[_0x7d81f2(0x1cc)](_0x1bf08e=>({..._0x1bf08e,'name':_0x1bf08e[_0x7d81f2(0x1ce)],'type':_0x7d81f2(0x1be)}))][_0x7d81f2(0x1d0)]((_0xb99323,_0x4c8f08)=>_0xb99323['name'][_0x7d81f2(0x1cb)](_0x4c8f08[_0x7d81f2(0x1ee)]));await handleSDKOutput(_0x5c2c89,_0x4587c1);}else{if(_0x300bbd===0x0)console[_0x7d81f2(0x1bf)](_0x7d81f2(0x1f7)+_0x564157);else{console[_0x7d81f2(0x1bf)](a51_0x3f6433['dim']('['+_0x527879+']\x20matching\x20\x27'+_0x564157+'\x27'));const _0x3ee043=formatFlatList(_0x2598d4,_0x55a7f2,{'showMetadata':!![],'getSegmentUrl':_0x1f870c},_0x5aaac7);console[_0x7d81f2(0x1bf)](_0x3ee043);}}return 0x0;}async['listUnified'](_0x16f835,_0x35f80c){const _0x2708b2=a51_0x59499d,{options:_0x3f5b40,tdx:_0x53e578}=_0x16f835,_0x3cb9f1=await withSpinner(_0x2708b2(0x1ab)+_0x35f80c+'\x27...',()=>_0x53e578[_0x2708b2(0x1b3)][_0x2708b2(0x1b1)](_0x35f80c),{'verbose':_0x3f5b40[_0x2708b2(0x1e5)]}),_0x4b8e60=_0x3cb9f1[_0x2708b2(0x1b7)];_0x3f5b40[_0x2708b2(0x1e5)]&&(console[_0x2708b2(0x1d8)](_0x2708b2(0x1cf)+_0x4b8e60[_0x2708b2(0x1e4)]),_0x4b8e60[_0x2708b2(0x1c4)]&&console['error'](_0x2708b2(0x1e7)+_0x4b8e60['folderId']));const _0x3521fe=await withSpinner(_0x2708b2(0x1d4),()=>_0x53e578[_0x2708b2(0x1b3)][_0x2708b2(0x1d7)](_0x4b8e60[_0x2708b2(0x1e4)],_0x4b8e60['folderId']),{'verbose':_0x3f5b40[_0x2708b2(0x1e5)]}),{folders:_0x426393,segments:_0x5a1de9,journeys:_0x4c4cb4}=_0x3521fe[_0x2708b2(0x1b7)],_0x286617=_0x426393[_0x2708b2(0x202)]+_0x5a1de9[_0x2708b2(0x202)]+_0x4c4cb4[_0x2708b2(0x202)];console[_0x2708b2(0x1d8)](_0x2708b2(0x1f8)+_0x426393[_0x2708b2(0x202)]+'\x20folder'+(_0x426393[_0x2708b2(0x202)]!==0x1?'s':'')+',\x20'+_0x5a1de9['length']+_0x2708b2(0x1ec)+(_0x5a1de9[_0x2708b2(0x202)]!==0x1?'s':'')+_0x2708b2(0x1d3)+_0x4c4cb4[_0x2708b2(0x202)]+_0x2708b2(0x1c0)+(_0x4c4cb4['length']!==0x1?'s':''));const _0x44550c=_0x542d2f=>{const _0xe50c20=_0x2708b2;return getConsoleNextUrl(_0x3f5b40[_0xe50c20(0x1df)],_0xe50c20(0x200)+_0x4b8e60[_0xe50c20(0x1e4)]+_0xe50c20(0x1f0)+_0x542d2f);},_0x1a6eef=_0x313e97=>{const _0x30a5e0=_0x2708b2;return getConsoleNextUrl(_0x3f5b40[_0x30a5e0(0x1df)],_0x30a5e0(0x200)+_0x4b8e60[_0x30a5e0(0x1e4)]+'/e/'+_0x313e97+_0x30a5e0(0x1b4));},_0x350d6e=_0x3f5b40[_0x2708b2(0x1dd)]===_0x2708b2(0x1bd)||_0x3f5b40['format']===_0x2708b2(0x1c2);if(_0x350d6e){const _0x19fa65=[..._0x426393[_0x2708b2(0x1cc)](_0xb23dea=>({..._0xb23dea,'type':_0x2708b2(0x1e9)})),..._0x5a1de9[_0x2708b2(0x1cc)](_0x5bbb03=>({..._0x5bbb03,'type':_0x2708b2(0x1b3),'url':_0x44550c(_0x5bbb03['id'])})),..._0x4c4cb4[_0x2708b2(0x1cc)](_0x3f5e73=>({..._0x3f5e73,'name':_0x3f5e73['journeyBundleName'],'type':_0x2708b2(0x1be),'url':_0x1a6eef(_0x3f5e73['id'])}))][_0x2708b2(0x1d0)]((_0x47b3a6,_0x2cf8f9)=>_0x47b3a6['name'][_0x2708b2(0x1cb)](_0x2cf8f9[_0x2708b2(0x1ee)]));await handleSDKOutput(_0x19fa65,_0x3f5b40);}else{if(_0x286617===0x0)console[_0x2708b2(0x1bf)](a51_0x3f6433[_0x2708b2(0x1ca)]('['+_0x35f80c+']')),console[_0x2708b2(0x1bf)](_0x2708b2(0x1ea));else{console[_0x2708b2(0x1bf)](a51_0x3f6433[_0x2708b2(0x1ca)]('['+_0x35f80c+']'));const _0xb9f60c=formatFlatList(_0x426393,_0x5a1de9,{'showMetadata':!![],'getSegmentUrl':_0x44550c,'getJourneyUrl':_0x1a6eef},_0x4c4cb4);console[_0x2708b2(0x1bf)](_0xb9f60c);}}return 0x0;}async[a51_0x59499d(0x1b5)](_0x2d4066,_0x55be95){const _0x5cdcb7=a51_0x59499d,{options:_0x219cb8,tdx:_0x485b88}=_0x2d4066,_0x1dfb9a=await withSpinner(_0x5cdcb7(0x1ab)+_0x55be95+_0x5cdcb7(0x1d5),()=>_0x485b88[_0x5cdcb7(0x1b3)][_0x5cdcb7(0x1b1)](_0x55be95),{'verbose':_0x219cb8[_0x5cdcb7(0x1e5)]}),_0x139c7b=_0x1dfb9a[_0x5cdcb7(0x1b7)];_0x219cb8[_0x5cdcb7(0x1e5)]&&(console[_0x5cdcb7(0x1d8)]('Parent\x20ID:\x20'+_0x139c7b['parentId']),_0x139c7b[_0x5cdcb7(0x1c4)]&&console[_0x5cdcb7(0x1d8)](_0x5cdcb7(0x1e7)+_0x139c7b['folderId']));const _0xe70307=_0x219cb8[_0x5cdcb7(0x1f1)]||0xa,_0x344aee=await withSpinner(_0x5cdcb7(0x1e6),()=>_0x485b88[_0x5cdcb7(0x1b3)]['listRecursive'](_0x139c7b[_0x5cdcb7(0x1e4)],_0x139c7b[_0x5cdcb7(0x1c4)],0x0,_0xe70307),{'verbose':_0x219cb8[_0x5cdcb7(0x1e5)]}),_0x50b547=_0x344aee['data'],_0x593f97=_0x3ab504=>{const _0x2827b4=_0x5cdcb7;let _0x40ff79=0x0,_0x554f2e=0x0,_0x1a94ad=0x0;for(const _0x2ce3da of _0x3ab504){if(_0x2ce3da[_0x2827b4(0x1c1)]===_0x2827b4(0x1e9))_0x40ff79++;else{if(_0x2ce3da[_0x2827b4(0x1c1)]===_0x2827b4(0x1b3))_0x554f2e++;else{if(_0x2ce3da[_0x2827b4(0x1c1)]===_0x2827b4(0x1be))_0x1a94ad++;}}if(_0x2ce3da['children']){const _0x4d70af=_0x593f97(_0x2ce3da['children']);_0x40ff79+=_0x4d70af[_0x2827b4(0x1db)],_0x554f2e+=_0x4d70af[_0x2827b4(0x1d9)],_0x1a94ad+=_0x4d70af[_0x2827b4(0x1b6)];}}return{'folders':_0x40ff79,'segments':_0x554f2e,'journeys':_0x1a94ad};},_0x33c5dc=_0x593f97(_0x50b547);console[_0x5cdcb7(0x1d8)](_0x5cdcb7(0x1c3)+_0x33c5dc[_0x5cdcb7(0x1db)]+_0x5cdcb7(0x1c6)+(_0x33c5dc[_0x5cdcb7(0x1db)]!==0x1?'s':'')+',\x20'+_0x33c5dc[_0x5cdcb7(0x1d9)]+_0x5cdcb7(0x1ec)+(_0x33c5dc[_0x5cdcb7(0x1d9)]!==0x1?'s':'')+_0x5cdcb7(0x1d3)+_0x33c5dc[_0x5cdcb7(0x1b6)]+_0x5cdcb7(0x1c0)+(_0x33c5dc[_0x5cdcb7(0x1b6)]!==0x1?'s':''));const _0x1e208e=_0x1e9e29=>{const _0x39191a=_0x5cdcb7;return getConsoleNextUrl(_0x219cb8['site'],_0x39191a(0x200)+_0x139c7b['parentId']+'/e/'+_0x1e9e29);},_0x1354e5=_0x55193=>{const _0xfa8dd5=_0x5cdcb7;return getConsoleNextUrl(_0x219cb8['site'],_0xfa8dd5(0x200)+_0x139c7b[_0xfa8dd5(0x1e4)]+_0xfa8dd5(0x1f0)+_0x55193+_0xfa8dd5(0x1b4));};if(_0x219cb8[_0x5cdcb7(0x1dd)]===_0x5cdcb7(0x1bd)||_0x219cb8[_0x5cdcb7(0x1dd)]===_0x5cdcb7(0x1c2))await handleSDKOutput(_0x50b547,_0x219cb8);else{console[_0x5cdcb7(0x1bf)](a51_0x3f6433['dim']('['+_0x55be95+']'));const _0x5a7b60=formatTree(_0x50b547,{'showMetadata':!![],'getSegmentUrl':_0x1e208e,'getJourneyUrl':_0x1354e5});console['log'](_0x5a7b60);}return 0x0;}}
1
+ function a52_0x584a(_0x176968,_0x8beb8d){_0x176968=_0x176968-0x1b5;const _0x21a63e=a52_0x21a6();let _0x584a9b=_0x21a63e[_0x176968];return _0x584a9b;}const a52_0x4d558d=a52_0x584a;(function(_0x891351,_0x1603ef){const _0x5413a6=a52_0x584a,_0x5501d6=_0x891351();while(!![]){try{const _0x1d63ca=parseInt(_0x5413a6(0x1ce))/0x1+-parseInt(_0x5413a6(0x1ea))/0x2+-parseInt(_0x5413a6(0x1bd))/0x3*(parseInt(_0x5413a6(0x1fb))/0x4)+-parseInt(_0x5413a6(0x1e3))/0x5+parseInt(_0x5413a6(0x1d5))/0x6*(parseInt(_0x5413a6(0x1fa))/0x7)+parseInt(_0x5413a6(0x1c0))/0x8+parseInt(_0x5413a6(0x203))/0x9;if(_0x1d63ca===_0x1603ef)break;else _0x5501d6['push'](_0x5501d6['shift']());}catch(_0x20039b){_0x5501d6['push'](_0x5501d6['shift']());}}}(a52_0x21a6,0x7338b));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a52_0x3f0ca0 from'chalk';export class SegmentsCommand extends BaseCommand{[a52_0x4d558d(0x1c3)]=a52_0x4d558d(0x1d8);[a52_0x4d558d(0x1b7)]='List\x20folders\x20and\x20child\x20segments';async[a52_0x4d558d(0x1e0)](_0xfe132f){const _0xe82d97=a52_0x4d558d,{options:_0x50e56c,args:_0x462017}=_0xfe132f,_0x1cadeb=_0x50e56c[_0xe82d97(0x1b9)],_0x39a78a=_0x462017[0x0];try{const _0x54c646=_0x50e56c[_0xe82d97(0x1c4)];_0x50e56c[_0xe82d97(0x1b8)]&&(console['error'](_0xe82d97(0x1da)+_0x50e56c['site']),console[_0xe82d97(0x1f5)](_0xe82d97(0x1de)+(_0x54c646||_0xe82d97(0x1f6))),_0x39a78a&&console[_0xe82d97(0x1f5)]('Folder/pattern\x20arg:\x20'+_0x39a78a),_0x1cadeb&&console[_0xe82d97(0x1f5)](_0xe82d97(0x1d4)));if(!_0x54c646)return console[_0xe82d97(0x1f5)](_0xe82d97(0x1e8)),console['error'](''),console[_0xe82d97(0x1f5)](_0xe82d97(0x1d3)),console['error'](_0xe82d97(0x1be)),console[_0xe82d97(0x1f5)](_0xe82d97(0x1f3)),console[_0xe82d97(0x1f5)](''),console[_0xe82d97(0x1f5)]('Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.'),0x1;if(_0x39a78a&&_0x1cadeb)return await this['searchByName'](_0xfe132f,_0x54c646,_0x39a78a);const _0x4fcdf9=_0x39a78a&&(_0x39a78a[_0xe82d97(0x20c)]('*')||_0x39a78a[_0xe82d97(0x20c)]('?'));if(_0x4fcdf9)return await this[_0xe82d97(0x1cd)](_0xfe132f,_0x54c646,_0x39a78a);const _0x5a6662=_0x39a78a?_0x54c646+'/'+_0x39a78a:_0x54c646;return _0x1cadeb?await this[_0xe82d97(0x1c2)](_0xfe132f,_0x5a6662):await this['listUnified'](_0xfe132f,_0x5a6662);}catch(_0x2a95c7){if(_0x2a95c7 instanceof SDKError)return console['error'](_0xe82d97(0x1d6)+_0x2a95c7[_0xe82d97(0x1b6)]),_0x2a95c7[_0xe82d97(0x1ec)]&&console[_0xe82d97(0x1f5)](_0xe82d97(0x200)+_0x2a95c7[_0xe82d97(0x1ec)]),0x1;throw _0x2a95c7;}}async[a52_0x4d558d(0x1d2)](_0x2c9852,_0x562679,_0x23db2d){const _0x577c9b=a52_0x4d558d,{options:_0x57f85c,tdx:_0x3dce4a}=_0x2c9852,_0x54922a='\x22'+_0x23db2d+'\x22',_0x3d7ce6=await withSpinner(_0x577c9b(0x1d9)+_0x562679+_0x577c9b(0x1bb),()=>_0x3dce4a[_0x577c9b(0x1f2)][_0x577c9b(0x1e6)](_0x562679),{'verbose':_0x57f85c['verbose']}),_0x28156b=_0x3d7ce6['data'],_0x36ac9b=_0x57f85c[_0x577c9b(0x1e5)]||0xa,_0x11bade=await withSpinner(_0x577c9b(0x1cc)+_0x54922a+_0x577c9b(0x1c6),()=>_0x3dce4a[_0x577c9b(0x1f2)][_0x577c9b(0x1c2)](_0x28156b[_0x577c9b(0x1f1)],_0x28156b[_0x577c9b(0x1e1)],0x0,_0x36ac9b),{'verbose':_0x57f85c['verbose']}),_0x4016d0=searchTreeByName(_0x11bade[_0x577c9b(0x1ff)],_0x23db2d),_0x53c6aa=_0x4bb9ef=>getConsoleNextUrl(_0x57f85c['site'],_0x577c9b(0x1f9)+_0x28156b['parentId']+_0x577c9b(0x206)+_0x4bb9ef),_0x282c57=[..._0x4016d0][_0x577c9b(0x20a)]((_0x3533a5,_0x74204f)=>_0x3533a5[_0x577c9b(0x1d0)][_0x577c9b(0x1c7)](_0x74204f[_0x577c9b(0x1d0)])),_0xf760e8=0x32,_0x51f7f5=_0x577c9b(0x1cb)+_0x4016d0['length']+_0x577c9b(0x1e9)+(_0x4016d0[_0x577c9b(0x209)]!==0x1?'es':'');console[_0x577c9b(0x1f5)](_0x4016d0[_0x577c9b(0x209)]>_0xf760e8?'✔\x20'+_0x51f7f5+_0x577c9b(0x1d7):'✔\x20'+_0x51f7f5);if(_0x57f85c[_0x577c9b(0x20d)]===_0x577c9b(0x1f4)||_0x57f85c[_0x577c9b(0x20d)]===_0x577c9b(0x1fc)){const _0x923f33=_0x282c57[_0x577c9b(0x202)](_0x475567=>({..._0x475567,..._0x475567[_0x577c9b(0x1c1)]===_0x577c9b(0x1f2)?{'url':_0x53c6aa(_0x475567['id'])}:{}}));return await handleSDKOutput(_0x923f33,_0x57f85c),0x0;}if(_0x4016d0['length']===0x0)return console[_0x577c9b(0x1e7)](_0x577c9b(0x1c9)+_0x54922a),0x0;for(const _0x342a03 of _0x282c57){console['log'](_0x342a03[_0x577c9b(0x1c1)][_0x577c9b(0x1dd)](0x8)+'\x20'+_0x342a03[_0x577c9b(0x1d0)]+'\x20\x20'+a52_0x3f0ca0['dim'](_0x577c9b(0x1eb)+_0x342a03['id']+')'));}const _0x151a0a=_0x4016d0[_0x577c9b(0x208)](_0x49db5b=>_0x49db5b[_0x577c9b(0x1c1)]===_0x577c9b(0x1f2)),_0x241fad=new Set(_0x151a0a[_0x577c9b(0x202)](_0x43b11c=>_0x43b11c['name'][_0x577c9b(0x20b)]()))[_0x577c9b(0x1e4)]===0x1;return _0x151a0a[_0x577c9b(0x209)]>0x1&&_0x241fad&&console[_0x577c9b(0x1e7)](a52_0x3f0ca0[_0x577c9b(0x1db)]('\x0a'+_0x151a0a['length']+'\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.')),0x0;}async['listWithPattern'](_0x1cd9a8,_0x390af1,_0x35f9fe){const _0x11cd8f=a52_0x4d558d,{options:_0x5815cb,tdx:_0x1b4398}=_0x1cd9a8,_0x3c0ba0=await withSpinner(_0x11cd8f(0x1f0)+_0x390af1+_0x11cd8f(0x1bb),()=>_0x1b4398['segment'][_0x11cd8f(0x1e6)](_0x390af1),{'verbose':_0x5815cb['verbose']}),_0xf4ac81=_0x3c0ba0[_0x11cd8f(0x1ff)],_0x285465=await withSpinner(_0x11cd8f(0x205),()=>_0x1b4398['segment']['listUnifiedWithJourneys'](_0xf4ac81[_0x11cd8f(0x1f1)],_0xf4ac81[_0x11cd8f(0x1e1)]),{'verbose':_0x5815cb[_0x11cd8f(0x1b8)]}),{folders:_0x5b6a17,segments:_0x31c319,journeys:_0xc12c61}=_0x285465[_0x11cd8f(0x1ff)],_0x422ab6=_0x35f9fe['replace'](/[.+^${}()|[\]\\]/g,_0x11cd8f(0x1bf))[_0x11cd8f(0x1f8)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x673797=new RegExp('^'+_0x422ab6+'$','i'),_0x53ae15=_0x5b6a17[_0x11cd8f(0x208)](_0x4bbbaa=>_0x673797[_0x11cd8f(0x1dc)](_0x4bbbaa[_0x11cd8f(0x1c3)])),_0x340c61=_0x31c319[_0x11cd8f(0x208)](_0x11b32b=>_0x673797[_0x11cd8f(0x1dc)](_0x11b32b[_0x11cd8f(0x1c3)])),_0xcb7454=_0xc12c61[_0x11cd8f(0x208)](_0x4390ef=>_0x673797[_0x11cd8f(0x1dc)](_0x4390ef[_0x11cd8f(0x1ef)])),_0x5f2cff=_0x53ae15['length']+_0x340c61[_0x11cd8f(0x209)]+_0xcb7454[_0x11cd8f(0x209)];console[_0x11cd8f(0x1f5)](_0x11cd8f(0x201)+_0x53ae15['length']+_0x11cd8f(0x1ca)+(_0x53ae15['length']!==0x1?'s':'')+',\x20'+_0x340c61[_0x11cd8f(0x209)]+_0x11cd8f(0x1b5)+(_0x340c61['length']!==0x1?'s':'')+_0x11cd8f(0x204)+_0xcb7454[_0x11cd8f(0x209)]+'\x20journey'+(_0xcb7454['length']!==0x1?'s':'')+_0x11cd8f(0x1ed)+_0x35f9fe+'\x27');const _0xa2b53d=_0x3fd957=>{const _0x308aee=_0x11cd8f;return getConsoleNextUrl(_0x5815cb['site'],_0x308aee(0x1f9)+_0xf4ac81[_0x308aee(0x1f1)]+'/e/'+_0x3fd957);},_0x5d96ad=_0x5815cb[_0x11cd8f(0x20d)]===_0x11cd8f(0x1f4)||_0x5815cb[_0x11cd8f(0x20d)]===_0x11cd8f(0x1fc);if(_0x5d96ad){const _0xfb5d5b=[..._0x53ae15[_0x11cd8f(0x202)](_0x1cb5d8=>({..._0x1cb5d8,'type':_0x11cd8f(0x20e)})),..._0x340c61['map'](_0x38e9cf=>({..._0x38e9cf,'type':_0x11cd8f(0x1f2),'url':_0xa2b53d(_0x38e9cf['id'])})),..._0xcb7454[_0x11cd8f(0x202)](_0x153fd4=>({..._0x153fd4,'name':_0x153fd4[_0x11cd8f(0x1ef)],'type':_0x11cd8f(0x1bc)}))][_0x11cd8f(0x20a)]((_0x149a58,_0x393a52)=>_0x149a58[_0x11cd8f(0x1c3)][_0x11cd8f(0x1c7)](_0x393a52[_0x11cd8f(0x1c3)]));await handleSDKOutput(_0xfb5d5b,_0x5815cb);}else{if(_0x5f2cff===0x0)console[_0x11cd8f(0x1e7)]('No\x20items\x20match\x20pattern:\x20'+_0x35f9fe);else{console[_0x11cd8f(0x1e7)](a52_0x3f0ca0['dim']('['+_0x390af1+_0x11cd8f(0x1df)+_0x35f9fe+'\x27'));const _0x56bad9=formatFlatList(_0x53ae15,_0x340c61,{'showMetadata':!![],'getSegmentUrl':_0xa2b53d},_0xcb7454);console[_0x11cd8f(0x1e7)](_0x56bad9);}}return 0x0;}async['listUnified'](_0x45bf98,_0x1cc3ab){const _0x30d6fc=a52_0x4d558d,{options:_0x3923cf,tdx:_0xf12caf}=_0x45bf98,_0x3c68b2=await withSpinner(_0x30d6fc(0x1d9)+_0x1cc3ab+'\x27...',()=>_0xf12caf[_0x30d6fc(0x1f2)][_0x30d6fc(0x1e6)](_0x1cc3ab),{'verbose':_0x3923cf[_0x30d6fc(0x1b8)]}),_0x5d4045=_0x3c68b2['data'];_0x3923cf[_0x30d6fc(0x1b8)]&&(console[_0x30d6fc(0x1f5)](_0x30d6fc(0x1f7)+_0x5d4045[_0x30d6fc(0x1f1)]),_0x5d4045[_0x30d6fc(0x1e1)]&&console[_0x30d6fc(0x1f5)](_0x30d6fc(0x1fd)+_0x5d4045[_0x30d6fc(0x1e1)]));const _0x22240a=await withSpinner('Listing\x20folders,\x20segments,\x20and\x20journeys...',()=>_0xf12caf[_0x30d6fc(0x1f2)][_0x30d6fc(0x1fe)](_0x5d4045['parentId'],_0x5d4045[_0x30d6fc(0x1e1)]),{'verbose':_0x3923cf[_0x30d6fc(0x1b8)]}),{folders:_0x5089b6,segments:_0x217067,journeys:_0x1eda24}=_0x22240a['data'],_0x5bee65=_0x5089b6['length']+_0x217067[_0x30d6fc(0x209)]+_0x1eda24[_0x30d6fc(0x209)];console[_0x30d6fc(0x1f5)](_0x30d6fc(0x201)+_0x5089b6[_0x30d6fc(0x209)]+_0x30d6fc(0x1ca)+(_0x5089b6[_0x30d6fc(0x209)]!==0x1?'s':'')+',\x20'+_0x217067[_0x30d6fc(0x209)]+_0x30d6fc(0x1b5)+(_0x217067[_0x30d6fc(0x209)]!==0x1?'s':'')+_0x30d6fc(0x204)+_0x1eda24['length']+_0x30d6fc(0x1c8)+(_0x1eda24[_0x30d6fc(0x209)]!==0x1?'s':''));const _0x297ab6=_0x412c18=>{const _0x4fd5ca=_0x30d6fc;return getConsoleNextUrl(_0x3923cf[_0x4fd5ca(0x1c5)],_0x4fd5ca(0x1f9)+_0x5d4045[_0x4fd5ca(0x1f1)]+_0x4fd5ca(0x206)+_0x412c18);},_0x43f208=_0x1805df=>{const _0x412e47=_0x30d6fc;return getConsoleNextUrl(_0x3923cf[_0x412e47(0x1c5)],_0x412e47(0x1f9)+_0x5d4045[_0x412e47(0x1f1)]+_0x412e47(0x206)+_0x1805df+_0x412e47(0x1d1));},_0x298436=_0x3923cf['format']===_0x30d6fc(0x1f4)||_0x3923cf['format']===_0x30d6fc(0x1fc);if(_0x298436){const _0x4403f1=[..._0x5089b6[_0x30d6fc(0x202)](_0x3e139b=>({..._0x3e139b,'type':_0x30d6fc(0x20e)})),..._0x217067['map'](_0x3b87af=>({..._0x3b87af,'type':'segment','url':_0x297ab6(_0x3b87af['id'])})),..._0x1eda24[_0x30d6fc(0x202)](_0x2cb38d=>({..._0x2cb38d,'name':_0x2cb38d[_0x30d6fc(0x1ef)],'type':_0x30d6fc(0x1bc),'url':_0x43f208(_0x2cb38d['id'])}))]['sort']((_0xf543e2,_0x43d653)=>_0xf543e2[_0x30d6fc(0x1c3)][_0x30d6fc(0x1c7)](_0x43d653['name']));await handleSDKOutput(_0x4403f1,_0x3923cf);}else{if(_0x5bee65===0x0)console[_0x30d6fc(0x1e7)](a52_0x3f0ca0[_0x30d6fc(0x1db)]('['+_0x1cc3ab+']')),console[_0x30d6fc(0x1e7)](_0x30d6fc(0x1ba));else{console['log'](a52_0x3f0ca0[_0x30d6fc(0x1db)]('['+_0x1cc3ab+']'));const _0x3daa45=formatFlatList(_0x5089b6,_0x217067,{'showMetadata':!![],'getSegmentUrl':_0x297ab6,'getJourneyUrl':_0x43f208},_0x1eda24);console[_0x30d6fc(0x1e7)](_0x3daa45);}}return 0x0;}async[a52_0x4d558d(0x1c2)](_0x2b3ca6,_0x40ff39){const _0x32988b=a52_0x4d558d,{options:_0x237598,tdx:_0x10423e}=_0x2b3ca6,_0x27c131=await withSpinner(_0x32988b(0x1d9)+_0x40ff39+_0x32988b(0x1bb),()=>_0x10423e['segment'][_0x32988b(0x1e6)](_0x40ff39),{'verbose':_0x237598[_0x32988b(0x1b8)]}),_0x388989=_0x27c131['data'];_0x237598['verbose']&&(console[_0x32988b(0x1f5)](_0x32988b(0x1f7)+_0x388989[_0x32988b(0x1f1)]),_0x388989[_0x32988b(0x1e1)]&&console[_0x32988b(0x1f5)](_0x32988b(0x1fd)+_0x388989['folderId']));const _0x5755b0=_0x237598[_0x32988b(0x1e5)]||0xa,_0x43426a=await withSpinner(_0x32988b(0x1ee),()=>_0x10423e[_0x32988b(0x1f2)][_0x32988b(0x1c2)](_0x388989[_0x32988b(0x1f1)],_0x388989[_0x32988b(0x1e1)],0x0,_0x5755b0),{'verbose':_0x237598[_0x32988b(0x1b8)]}),_0x620045=_0x43426a[_0x32988b(0x1ff)],_0x223b46=_0x36c091=>{const _0xd855f4=_0x32988b;let _0x3ae58f=0x0,_0x1d15dc=0x0,_0x485098=0x0;for(const _0x55c01b of _0x36c091){if(_0x55c01b[_0xd855f4(0x1c1)]===_0xd855f4(0x20e))_0x3ae58f++;else{if(_0x55c01b[_0xd855f4(0x1c1)]===_0xd855f4(0x1f2))_0x1d15dc++;else{if(_0x55c01b[_0xd855f4(0x1c1)]==='journey')_0x485098++;}}if(_0x55c01b[_0xd855f4(0x1e2)]){const _0x1e35ed=_0x223b46(_0x55c01b[_0xd855f4(0x1e2)]);_0x3ae58f+=_0x1e35ed[_0xd855f4(0x207)],_0x1d15dc+=_0x1e35ed[_0xd855f4(0x1d8)],_0x485098+=_0x1e35ed[_0xd855f4(0x1cf)];}}return{'folders':_0x3ae58f,'segments':_0x1d15dc,'journeys':_0x485098};},_0x35dd22=_0x223b46(_0x620045);console['error']('✔\x20Built\x20tree\x20with\x20'+_0x35dd22['folders']+_0x32988b(0x1ca)+(_0x35dd22[_0x32988b(0x207)]!==0x1?'s':'')+',\x20'+_0x35dd22[_0x32988b(0x1d8)]+'\x20segment'+(_0x35dd22[_0x32988b(0x1d8)]!==0x1?'s':'')+_0x32988b(0x204)+_0x35dd22['journeys']+_0x32988b(0x1c8)+(_0x35dd22['journeys']!==0x1?'s':''));const _0x3fc2a7=_0x2fae23=>{const _0x17efd8=_0x32988b;return getConsoleNextUrl(_0x237598['site'],_0x17efd8(0x1f9)+_0x388989['parentId']+_0x17efd8(0x206)+_0x2fae23);},_0xf4866e=_0x3c3ffa=>{const _0x7a2f95=_0x32988b;return getConsoleNextUrl(_0x237598[_0x7a2f95(0x1c5)],_0x7a2f95(0x1f9)+_0x388989[_0x7a2f95(0x1f1)]+'/e/'+_0x3c3ffa+_0x7a2f95(0x1d1));};if(_0x237598[_0x32988b(0x20d)]==='json'||_0x237598[_0x32988b(0x20d)]===_0x32988b(0x1fc))await handleSDKOutput(_0x620045,_0x237598);else{console[_0x32988b(0x1e7)](a52_0x3f0ca0[_0x32988b(0x1db)]('['+_0x40ff39+']'));const _0x2d0556=formatTree(_0x620045,{'showMetadata':!![],'getSegmentUrl':_0x3fc2a7,'getJourneyUrl':_0xf4866e});console[_0x32988b(0x1e7)](_0x2d0556);}return 0x0;}}function a52_0x21a6(){const _0x38f041=['Found\x20','Searching\x20the\x20tree\x20for\x20names\x20matching\x20','listWithPattern','906145oEBVxA','journeys','path','/j/da','searchByName','Set\x20a\x20parent\x20segment\x20context\x20first:','Recursive\x20mode:\x20enabled','2756604tBAYeu','Error:\x20','\x20—\x20that\x27s\x20a\x20lot\x20to\x20eyeball.\x20Narrow\x20the\x20pattern\x20(add\x20more\x20of\x20the\x20name,\x20or\x20use\x20*\x20/\x20?),\x20or\x20use\x20--format\x20json\x20and\x20filter\x20with\x20jq/grep.','segments','Resolving\x20path\x20\x27','Site:\x20','dim','test','padEnd','Parent\x20segment\x20context:\x20',']\x20matching\x20\x27','execute','folderId','children','434595coUdSI','size','maxDepth','resolvePathToResource','log','Error:\x20No\x20parent\x20segment\x20context\x20set.','\x20match','1857036VdAAZH','(id\x20','cause','\x20matching\x20\x27','Building\x20hierarchy\x20tree...','journeyBundleName','Resolving\x20parent\x20segment\x20\x27','parentId','segment','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','json','error','(not\x20set)','Parent\x20ID:\x20','replace','/app/ps/','7OcFipc','3577156rMDOIf','jsonl','Folder\x20ID:\x20','listUnifiedWithJourneys','data','\x20\x20Cause:\x20','✔\x20Found\x20','map','2242116AHUDOn',',\x20and\x20','Listing\x20folders,\x20segments,\x20and\x20journeys...','/e/','folders','filter','length','sort','toLowerCase','includes','format','folder','\x20segment','message','description','verbose','recursive','(empty)','\x27...','journey','3FIUUMI','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','\x5c$&','6135760tCBaiG','type','listRecursive','name','parentSegment','site','...','localeCompare','\x20journey','No\x20folders\x20or\x20segments\x20match\x20','\x20folder'];a52_0x21a6=function(){return _0x38f041;};return a52_0x21a6();}