@treasuredata/tdx 2026.3.9 → 2026.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-login-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.d.ts.map +1 -1
  55. package/dist/commands/workflow-command.js +1 -1
  56. package/dist/commands/workflow-command.js.map +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/utils.js +1 -1
  78. package/dist/proxy/claude-usage-tracker.js +1 -1
  79. package/dist/proxy/passthrough-server.js +1 -1
  80. package/dist/proxy/sse-usage-parser.js +1 -1
  81. package/dist/sdk/agent/agent-config.js +1 -1
  82. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/agent/test/evaluator.js +1 -1
  85. package/dist/sdk/agent/test/executor.js +1 -1
  86. package/dist/sdk/agent/test/index.js +1 -1
  87. package/dist/sdk/agent/test/output.js +1 -1
  88. package/dist/sdk/agent/test/parser.js +1 -1
  89. package/dist/sdk/agent/tool-target-registry.js +1 -1
  90. package/dist/sdk/api.js +1 -1
  91. package/dist/sdk/client/cdp-api-client.js +1 -1
  92. package/dist/sdk/client/delivery-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/oauth-refresh.js +1 -1
  98. package/dist/sdk/client/rate-limiter.js +1 -1
  99. package/dist/sdk/client/td-api-client.js +1 -1
  100. package/dist/sdk/client/trino-api-client.js +1 -1
  101. package/dist/sdk/client/workflow-client.js +1 -1
  102. package/dist/sdk/connection-validator.js +1 -1
  103. package/dist/sdk/connection.js +1 -1
  104. package/dist/sdk/delivery.js +1 -1
  105. package/dist/sdk/engage/campaign-pull.js +1 -1
  106. package/dist/sdk/engage/campaign-push.js +1 -1
  107. package/dist/sdk/engage/campaign-validator.js +1 -1
  108. package/dist/sdk/engage/campaign-yaml.js +1 -1
  109. package/dist/sdk/engage/template-pull.js +1 -1
  110. package/dist/sdk/engage/template-push.js +1 -1
  111. package/dist/sdk/engage/template-validator.js +1 -1
  112. package/dist/sdk/engage/template-yaml.js +1 -1
  113. package/dist/sdk/engage/types/campaign-def.js +1 -1
  114. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  115. package/dist/sdk/engage/types/template-schema.js +1 -1
  116. package/dist/sdk/engage.js +1 -1
  117. package/dist/sdk/errors.d.ts +2 -0
  118. package/dist/sdk/errors.d.ts.map +1 -1
  119. package/dist/sdk/errors.js +1 -1
  120. package/dist/sdk/errors.js.map +1 -1
  121. package/dist/sdk/index.js +1 -1
  122. package/dist/sdk/io/index.js +1 -1
  123. package/dist/sdk/io/node-filesystem.js +1 -1
  124. package/dist/sdk/job.js +1 -1
  125. package/dist/sdk/journey.js +1 -1
  126. package/dist/sdk/llm/chat-cache.js +1 -1
  127. package/dist/sdk/llm/index.js +1 -1
  128. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  129. package/dist/sdk/llm/model-factors.js +1 -1
  130. package/dist/sdk/personalization.js +1 -1
  131. package/dist/sdk/query/index.js +1 -1
  132. package/dist/sdk/query/sql-parser.js +1 -1
  133. package/dist/sdk/realtime.js +1 -1
  134. package/dist/sdk/schedule.js +1 -1
  135. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  136. package/dist/sdk/segment/fields-display.js +1 -1
  137. package/dist/sdk/segment/file-discovery.js +1 -1
  138. package/dist/sdk/segment/journey-utils.js +1 -1
  139. package/dist/sdk/segment/journey-validator.js +1 -1
  140. package/dist/sdk/segment/journey-yaml.js +1 -1
  141. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  142. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/pull-workflow.js +1 -1
  144. package/dist/sdk/segment/push-recovery.js +1 -1
  145. package/dist/sdk/segment/push-workflow.js +1 -1
  146. package/dist/sdk/segment/resolution-context.js +1 -1
  147. package/dist/sdk/segment/segment-path-parser.js +1 -1
  148. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  149. package/dist/sdk/segment/segment-validator.js +1 -1
  150. package/dist/sdk/segment/target-resolution.js +1 -1
  151. package/dist/sdk/segment/tdx-config.js +1 -1
  152. package/dist/sdk/segment/types/activation-schema.js +1 -1
  153. package/dist/sdk/segment/types/journey-def.js +1 -1
  154. package/dist/sdk/segment/types/journey-schema.js +1 -1
  155. package/dist/sdk/segment/types/segment-def.js +1 -1
  156. package/dist/sdk/segment/types/segment-schema.js +1 -1
  157. package/dist/sdk/segment/validate-files.js +1 -1
  158. package/dist/sdk/segment/yaml-validator.js +1 -1
  159. package/dist/sdk/segment.js +1 -1
  160. package/dist/sdk/types/index.js +1 -1
  161. package/dist/sdk/types/progress.js +1 -1
  162. package/dist/sdk/user.js +1 -1
  163. package/dist/sdk/util/format-detector.js +1 -1
  164. package/dist/sdk/util/formatters.js +1 -1
  165. package/dist/sdk/util/index.js +1 -1
  166. package/dist/sdk/util/paginate.js +1 -1
  167. package/dist/sdk/util/tree-formatter.js +1 -1
  168. package/dist/sdk/workflow/archive-validation.js +1 -1
  169. package/dist/sdk/workflow/clone-workflow.js +1 -1
  170. package/dist/sdk/workflow/index.d.ts +12 -0
  171. package/dist/sdk/workflow/index.d.ts.map +1 -1
  172. package/dist/sdk/workflow/index.js +1 -1
  173. package/dist/sdk/workflow/index.js.map +1 -1
  174. package/dist/sdk/workflow/pull-workflow.js +1 -1
  175. package/dist/sdk/workflow/push-workflow.js +1 -1
  176. package/dist/sdk/workflow/tdx-config.js +1 -1
  177. package/dist/sdk/workflow/workflow-utils.js +1 -1
  178. package/dist/test-utils/command-runner.js +1 -1
  179. package/dist/test-utils/factories.js +1 -1
  180. package/dist/test-utils/fixtures.js +1 -1
  181. package/dist/test-utils/http-mock.js +1 -1
  182. package/dist/test-utils/index.js +1 -1
  183. package/dist/utils/async.js +1 -1
  184. package/dist/utils/colors.js +1 -1
  185. package/dist/utils/diff.js +1 -1
  186. package/dist/utils/file-permissions.js +1 -1
  187. package/dist/utils/file-reader.js +1 -1
  188. package/dist/utils/github-releases.js +1 -1
  189. package/dist/utils/global-cache.js +1 -1
  190. package/dist/utils/json-loader.js +1 -1
  191. package/dist/utils/local-cache.js +1 -1
  192. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  193. package/dist/utils/logger/formatters/index.js +1 -1
  194. package/dist/utils/logger/handlers/console-handler.js +1 -1
  195. package/dist/utils/logger/handlers/file-handler.js +1 -1
  196. package/dist/utils/logger/handlers/index.js +1 -1
  197. package/dist/utils/logger/handlers/null-handler.js +1 -1
  198. package/dist/utils/logger/index.js +1 -1
  199. package/dist/utils/logger/logger.js +1 -1
  200. package/dist/utils/logger/types.js +1 -1
  201. package/dist/utils/option-validation.js +1 -1
  202. package/dist/utils/process.js +1 -1
  203. package/dist/utils/prompt.js +1 -1
  204. package/dist/utils/spinner.js +1 -1
  205. package/dist/utils/sse-parser.js +1 -1
  206. package/dist/utils/string-utils.js +1 -1
  207. package/dist/utils/table-ref-parser.js +1 -1
  208. package/dist/utils/tdx-logger.js +1 -1
  209. package/dist/utils/version-check.js +1 -1
  210. package/package.json +1 -1
@@ -1 +1 @@
1
- const a30_0x266c7f=a30_0x442f;(function(_0x27420a,_0x2d422d){const _0x24cbd6=a30_0x442f,_0x3a47cd=_0x27420a();while(!![]){try{const _0x57ab86=parseInt(_0x24cbd6(0x124))/0x1+-parseInt(_0x24cbd6(0x7d))/0x2*(parseInt(_0x24cbd6(0x1f7))/0x3)+parseInt(_0x24cbd6(0xb1))/0x4+parseInt(_0x24cbd6(0x1fa))/0x5+parseInt(_0x24cbd6(0x8c))/0x6+-parseInt(_0x24cbd6(0x1b9))/0x7*(-parseInt(_0x24cbd6(0xfd))/0x8)+parseInt(_0x24cbd6(0x91))/0x9*(-parseInt(_0x24cbd6(0xbe))/0xa);if(_0x57ab86===_0x2d422d)break;else _0x3a47cd['push'](_0x3a47cd['shift']());}catch(_0x51ff53){_0x3a47cd['push'](_0x3a47cd['shift']());}}}(a30_0x33c8,0xeafa9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x41b2d2 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a30_0x442f(_0x2059f0,_0x1fcf59){_0x2059f0=_0x2059f0-0x75;const _0x33c895=a30_0x33c8();let _0x442fa6=_0x33c895[_0x2059f0];return _0x442fa6;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x1b0436 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x266c7f(0xc1),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x2b7151){const _0x16a7f8=a30_0x266c7f,_0x14236e=process[_0x16a7f8(0x133)],_0x442254=_0x14236e==='darwin'?'open':_0x14236e===_0x16a7f8(0x18e)?_0x16a7f8(0x192):_0x16a7f8(0x80);spawn(_0x442254,[_0x2b7151],{'detached':!![],'stdio':_0x16a7f8(0xe2)})[_0x16a7f8(0x1c1)]();}function migrateLegacyDirectory(){const _0x22461b=a30_0x266c7f;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x186fc1=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x186fc1[_0x22461b(0x1a5)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x22461b(0x127)](a30_0x1b0436[_0x22461b(0xb2)](_0x22461b(0x19b)+LEGACY_PARENT_SEGMENT_DIR+_0x22461b(0xc2)+PARENT_SEGMENT_DIR+_0x22461b(0x12c))),console['error'](a30_0x1b0436[_0x22461b(0x116)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x22461b(0x182))),![];console[_0x22461b(0x127)](a30_0x1b0436[_0x22461b(0xb2)](_0x22461b(0x16d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x1b0436[_0x22461b(0x1dc)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4b40c7){const _0x5b2c02=_0x4b40c7 instanceof Error?_0x4b40c7[_0x22461b(0xa4)]:String(_0x4b40c7);return console[_0x22461b(0x127)](a30_0x1b0436[_0x22461b(0x181)](_0x22461b(0x1e8)+_0x5b2c02+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x3de85e){const _0xdf0cbf=a30_0x266c7f;return migrateLegacyDirectory(),super[_0xdf0cbf(0x1e3)](_0x3de85e);}}function resolveYamlFile(_0x168147){const _0x4a47a7=a30_0x266c7f;if(_0x168147['endsWith'](_0x4a47a7(0x158))||_0x168147[_0x4a47a7(0x9e)]('.yaml'))return _0x168147;return a30_0x41b2d2[_0x4a47a7(0xed)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x168147)+_0x4a47a7(0x158));}function formatProgressMessage(_0x445505){const _0x5a3d09=a30_0x266c7f,_0x50e88d=_0x445505['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x50e88d){const [,_0x2c0297,_0xd349c6,_0x5020bd='']=_0x50e88d;return a30_0x1b0436[_0x5a3d09(0x116)](_0x2c0297+':')+'\x20'+_0xd349c6+a30_0x1b0436[_0x5a3d09(0x116)](_0x5020bd);}return a30_0x1b0436[_0x5a3d09(0x116)](_0x445505);}function showFileNotFoundError(_0x4e4ae2,_0x5f36e1){const _0x51c54a=a30_0x266c7f;console['error'](a30_0x1b0436[_0x51c54a(0x181)](_0x51c54a(0xc3)+_0x4e4ae2+'\x0a')),console[_0x51c54a(0x127)](a30_0x1b0436[_0x51c54a(0x1ba)](_0x51c54a(0xd6)+_0x5f36e1+_0x51c54a(0xfe)));}function displayRealtimeValidation(_0x31fee9){const _0x320c92=a30_0x266c7f;if(!_0x31fee9[_0x320c92(0x7c)])return;const _0x4edda8=_0x31fee9[_0x320c92(0x7c)],_0x511336=_0x4edda8[_0x320c92(0x17f)]?a30_0x1b0436[_0x320c92(0x1dc)](_0x320c92(0x1d8)):a30_0x1b0436[_0x320c92(0xb2)](_0x320c92(0x11c));console['error']('\x0a'+a30_0x1b0436['dim']('RT\x202.0:')+'\x20'+_0x511336);if(_0x4edda8[_0x320c92(0xdb)]&&_0x4edda8[_0x320c92(0xdb)]['length']>0x0){console['error']('\x20\x20'+a30_0x1b0436[_0x320c92(0x116)]('Events:')+'\x20'+_0x4edda8[_0x320c92(0xdb)][_0x320c92(0xa8)]+'\x20configured');for(const _0x430b6f of _0x4edda8[_0x320c92(0xdb)]){const _0x198f5e=_0x430b6f[_0x320c92(0xcc)]===![]?a30_0x1b0436[_0x320c92(0x181)]('✘'):a30_0x1b0436['green']('✔');console['error'](_0x320c92(0x1ca)+_0x198f5e+'\x20'+_0x430b6f[_0x320c92(0x199)]),_0x430b6f[_0x320c92(0x15c)]&&console[_0x320c92(0x127)](_0x320c92(0x1be)+a30_0x1b0436[_0x320c92(0x181)](_0x430b6f['sourceTableError']));}}if(_0x4edda8[_0x320c92(0xc4)]&&_0x4edda8[_0x320c92(0xc4)][_0x320c92(0xa8)]>0x0){console['error']('\x20\x20'+a30_0x1b0436['dim']('Attributes:')+'\x20'+_0x4edda8[_0x320c92(0xc4)][_0x320c92(0xa8)]+_0x320c92(0x123));for(const _0x3ef7a2 of _0x4edda8[_0x320c92(0xc4)]){const _0x76d5f=_0x3ef7a2[_0x320c92(0x16b)]?a30_0x1b0436[_0x320c92(0x1dc)]('✔'):a30_0x1b0436[_0x320c92(0x181)]('✘');console[_0x320c92(0x127)](_0x320c92(0x1ca)+_0x76d5f+'\x20'+_0x3ef7a2[_0x320c92(0x199)]+'\x20'+a30_0x1b0436[_0x320c92(0x116)]('('+_0x3ef7a2[_0x320c92(0x1aa)]+')'));}}if(_0x4edda8[_0x320c92(0x143)]){const _0x14aae9=_0x4edda8[_0x320c92(0x143)][_0x320c92(0x87)]?.[_0x320c92(0xa8)]?'\x20+\x20['+_0x4edda8[_0x320c92(0x143)][_0x320c92(0x87)][_0x320c92(0xed)](',\x20')+']':'';console['error']('\x20\x20'+a30_0x1b0436[_0x320c92(0x116)](_0x320c92(0xc8))+'\x20'+_0x4edda8[_0x320c92(0x143)][_0x320c92(0x141)]+_0x14aae9);}if(_0x4edda8[_0x320c92(0x1ad)]&&_0x4edda8['personalizationServices']['length']>0x0){console[_0x320c92(0x127)]('\x20\x20'+a30_0x1b0436[_0x320c92(0x116)](_0x320c92(0x1d3))+'\x20'+_0x4edda8[_0x320c92(0x1ad)]['length']+_0x320c92(0x12a)+(_0x4edda8[_0x320c92(0x1ad)][_0x320c92(0xa8)]!==0x1?'s':''));for(const _0x2d67d6 of _0x4edda8['personalizationServices']){console['error'](_0x320c92(0x122)+_0x2d67d6[_0x320c92(0x199)]);}}}function showParentSegmentNotSetError(_0x632a98){const _0x3df88c=a30_0x266c7f;console[_0x3df88c(0x127)](a30_0x1b0436[_0x3df88c(0xb2)](_0x3df88c(0x82))),console[_0x3df88c(0x127)](_0x632a98);}export class ParentSegmentListCommand extends BaseCommand{['name']=a30_0x266c7f(0x99);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xeb);async['execute'](_0x21e4b6){const _0x247d6a=a30_0x266c7f,{options:_0x1144e4,args:_0x447e16,tdx:_0x31a3ae}=_0x21e4b6,_0x5b3bd7=_0x447e16[0x0];_0x1144e4[_0x247d6a(0xb5)]&&(console[_0x247d6a(0x127)](_0x247d6a(0x108)+_0x1144e4[_0x247d6a(0x175)]),_0x5b3bd7&&console[_0x247d6a(0x127)](_0x247d6a(0x162)+_0x5b3bd7));const _0x132840=await withSpinner(_0x5b3bd7?_0x247d6a(0x117)+_0x5b3bd7+_0x247d6a(0x76):_0x247d6a(0x1bd),()=>_0x31a3ae[_0x247d6a(0x105)][_0x247d6a(0xc7)](),{'verbose':_0x1144e4[_0x247d6a(0xb5)]});let _0x4f7f95=_0x132840[_0x247d6a(0xe8)];if(_0x5b3bd7){const _0x33004a=_0x5b3bd7[_0x247d6a(0x14d)](/[.+^${}()|[\]\\]/g,_0x247d6a(0x161))['replace'](/\*/g,'.*')[_0x247d6a(0x14d)](/\?/g,'.'),_0xaee835=new RegExp('^'+_0x33004a+'$','i');_0x4f7f95=_0x4f7f95['filter'](_0x4bb0d7=>_0xaee835[_0x247d6a(0x137)](_0x4bb0d7[_0x247d6a(0xc4)]['name']));}_0x4f7f95['sort']((_0x3d36e2,_0x28ba99)=>_0x3d36e2[_0x247d6a(0xc4)][_0x247d6a(0x199)][_0x247d6a(0x166)](_0x28ba99[_0x247d6a(0xc4)][_0x247d6a(0x199)])),console[_0x247d6a(0x127)]('✔\x20Found\x20'+_0x4f7f95[_0x247d6a(0xa8)]+_0x247d6a(0x134)+(_0x4f7f95['length']!==0x1?'s':''));const _0x9bf1f9=_0x58f00f=>{const _0x2f430d=_0x247d6a;return getConsoleNextUrl(_0x1144e4[_0x2f430d(0x175)],_0x2f430d(0x1e1)+_0x58f00f);};if(_0x1144e4['format']===_0x247d6a(0xae)||_0x1144e4[_0x247d6a(0xd2)]===_0x247d6a(0x140)){const _0x3713af=_0x4f7f95[_0x247d6a(0x178)](_0x555a73=>({..._0x555a73,'url':_0x9bf1f9(_0x555a73['id'])}));await handleSDKOutput(_0x3713af,_0x1144e4);}else{if(_0x4f7f95['length']===0x0)_0x5b3bd7?console['log'](_0x247d6a(0x194)+_0x5b3bd7):console[_0x247d6a(0x1a7)](_0x247d6a(0x1ff));else for(const _0x2b11a3 of _0x4f7f95){const _0x5d2059=_0x2b11a3[_0x247d6a(0xc4)][_0x247d6a(0x1c7)]?a30_0x1b0436[_0x247d6a(0x116)]('\x20('+formatRows(_0x2b11a3[_0x247d6a(0xc4)][_0x247d6a(0x1c7)])+')'):'',_0x36394f=hyperlink(_0x2b11a3['attributes'][_0x247d6a(0x199)],_0x9bf1f9(_0x2b11a3['id']));console[_0x247d6a(0x1a7)](_0x247d6a(0x1cf)+_0x36394f+_0x5d2059);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x266c7f(0x199)]='segment:parent:create';[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x1d7);async[a30_0x266c7f(0xd5)](_0x2cae5e){const _0x31dbfe=a30_0x266c7f,{options:_0x2f350b,args:_0x4f5d91,tdx:_0x400f43}=_0x2cae5e;console[_0x31dbfe(0x127)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x31dbfe(0x153));const _0x2e8f47=_0x2f350b;if(_0x4f5d91[_0x31dbfe(0xa8)]===0x0)return console[_0x31dbfe(0x127)](a30_0x1b0436[_0x31dbfe(0x181)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x31dbfe(0x127)](_0x31dbfe(0x1ed)),0x1;const _0x375b57=_0x4f5d91[0x0];if(!_0x2e8f47[_0x31dbfe(0x11d)]||!_0x2e8f47[_0x31dbfe(0xd3)])return console[_0x31dbfe(0x127)](_0x31dbfe(0x1f4)),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x2e8f47['verbose']&&(console[_0x31dbfe(0x127)](_0x31dbfe(0x108)+_0x2e8f47['site']),console[_0x31dbfe(0x127)](_0x31dbfe(0x18d)+_0x375b57),console[_0x31dbfe(0x127)](_0x31dbfe(0x10f)+_0x2e8f47[_0x31dbfe(0x11d)]),console[_0x31dbfe(0x127)](_0x31dbfe(0x169)+_0x2e8f47[_0x31dbfe(0xd3)]));const _0x1f4781=await loadJSONFromOptions(_0x2e8f47[_0x31dbfe(0xc4)],_0x2e8f47[_0x31dbfe(0xef)]),_0x1391f2=await loadJSONFromOptions(_0x2e8f47['behaviors'],_0x2e8f47[_0x31dbfe(0x102)]),_0x3c2ee7=await loadJSONFromOptions(_0x2e8f47[_0x31dbfe(0xaa)],_0x2e8f47[_0x31dbfe(0x14a)]),_0x34befb={'name':_0x375b57,'description':_0x2e8f47[_0x31dbfe(0xe0)],'scheduleType':_0x2e8f47[_0x31dbfe(0xd8)],'scheduleOption':_0x2e8f47[_0x31dbfe(0x19c)],'timezone':_0x2e8f47[_0x31dbfe(0x118)],'master':{'parentDatabaseName':_0x2e8f47['database'],'parentTableName':_0x2e8f47[_0x31dbfe(0xd3)]},'attributes':_0x1f4781,'behaviors':_0x1391f2,'customerGroup':_0x3c2ee7},_0x1081ea=await withSpinner(_0x31dbfe(0xab)+_0x375b57+'\x27...',()=>_0x400f43[_0x31dbfe(0x105)]['createParent'](_0x34befb),{'verbose':_0x2f350b[_0x31dbfe(0xb5)]}),_0x50fe74=_0x1081ea[_0x31dbfe(0xe8)];return console[_0x31dbfe(0x127)](_0x31dbfe(0x1c5)+_0x50fe74[_0x31dbfe(0x199)]+_0x31dbfe(0x101)+_0x50fe74['id']),await handleSDKOutput([_0x50fe74],_0x2f350b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x266c7f(0xa9);['description']=a30_0x266c7f(0x1a8);async['execute'](_0x2768bf){const _0x3b6dcf=a30_0x266c7f,{options:_0x32137f,args:_0x3df690,tdx:_0xbc77ee}=_0x2768bf;console[_0x3b6dcf(0x127)](_0x3b6dcf(0x179)+_0x3b6dcf(0x1ea)+_0x3b6dcf(0x153));const _0xcbfd38=_0x32137f;if(_0x3df690['length']===0x0)return console[_0x3b6dcf(0x127)](a30_0x1b0436[_0x3b6dcf(0x181)](_0x3b6dcf(0x17d))),console[_0x3b6dcf(0x127)](_0x3b6dcf(0x12d)),0x1;const _0x43fe5a=_0x3df690[0x0];_0xcbfd38[_0x3b6dcf(0xb5)]&&(console[_0x3b6dcf(0x127)]('Site:\x20'+_0xcbfd38[_0x3b6dcf(0x175)]),console['error'](_0x3b6dcf(0x1e4)+_0x43fe5a));const _0x5d7728=await withSpinner(_0x3b6dcf(0x160)+_0x43fe5a+_0x3b6dcf(0x76),()=>_0xbc77ee['segment'][_0x3b6dcf(0x1ee)](_0x43fe5a),{'verbose':_0xcbfd38['verbose']}),_0x2961eb=_0x5d7728[_0x3b6dcf(0xe8)],_0xd986f3=await loadJSONFromOptions(_0xcbfd38['addAttributes'],_0xcbfd38[_0x3b6dcf(0x19a)]),_0x540d70=await loadJSONFromOptions(_0xcbfd38[_0x3b6dcf(0x17e)],_0xcbfd38[_0x3b6dcf(0x11a)]),_0x187924={'name':_0x2961eb[_0x3b6dcf(0x199)],'description':_0xcbfd38[_0x3b6dcf(0xe0)]!==undefined?_0xcbfd38['description']:_0x2961eb[_0x3b6dcf(0xe0)],'scheduleType':_0xcbfd38[_0x3b6dcf(0xd8)]!==undefined?_0xcbfd38[_0x3b6dcf(0xd8)]:_0x2961eb[_0x3b6dcf(0xd8)],'scheduleOption':_0xcbfd38[_0x3b6dcf(0x19c)]!==undefined?_0xcbfd38['scheduleOption']:_0x2961eb[_0x3b6dcf(0x19c)],'timezone':_0xcbfd38[_0x3b6dcf(0x118)]!==undefined?_0xcbfd38[_0x3b6dcf(0x118)]:_0x2961eb['timezone'],'master':_0x2961eb['master'],'attributes':_0xd986f3?[..._0x2961eb['attributes']||[],..._0xd986f3]:_0x2961eb[_0x3b6dcf(0xc4)],'behaviors':_0x540d70?[..._0x2961eb[_0x3b6dcf(0x16c)]||[],..._0x540d70]:_0x2961eb[_0x3b6dcf(0x16c)],'customerGroup':_0x2961eb['customerGroup']},_0x3a7b82=await withSpinner(_0x3b6dcf(0x1c8)+_0x43fe5a+_0x3b6dcf(0x76),()=>_0xbc77ee[_0x3b6dcf(0x105)][_0x3b6dcf(0xfb)](_0x43fe5a,_0x187924),{'verbose':_0xcbfd38[_0x3b6dcf(0xb5)]}),_0x2a1502=_0x3a7b82[_0x3b6dcf(0xe8)];return console['error'](_0x3b6dcf(0x1ce)+_0x2a1502[_0x3b6dcf(0x199)]+'\x27'),await handleSDKOutput([_0x2a1502],_0xcbfd38),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x154);['description']=a30_0x266c7f(0x1b3);async[a30_0x266c7f(0xd5)](_0x3bcee9){const _0x61cdbf=a30_0x266c7f,{options:_0x13150b,args:_0x2cbfac,tdx:_0x3989c8}=_0x3bcee9,_0x3046fc=_0x13150b,_0x52a821=_0x2cbfac[0x0]||_0x13150b['parentSegment'];if(!_0x52a821)return showParentSegmentNotSetError(_0x61cdbf(0xb9)+_0x61cdbf(0x106)),0x1;if(_0x3046fc['use']&&_0x3046fc[_0x61cdbf(0xe7)])return console['error'](a30_0x1b0436[_0x61cdbf(0x181)](_0x61cdbf(0x1ef))),console['error'](a30_0x1b0436['dim'](_0x61cdbf(0xc6))),console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x116)](_0x61cdbf(0x180)+PARENT_SEGMENT_DIR+_0x61cdbf(0x1fe))),console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x1ba)](_0x61cdbf(0x77))),0x1;const _0x5cfe7d=_0x3046fc[_0x61cdbf(0xe7)]||a30_0x41b2d2['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x52a821)+_0x61cdbf(0x158));_0x3046fc[_0x61cdbf(0xb5)]&&(console['error'](_0x61cdbf(0x108)+_0x3046fc[_0x61cdbf(0x175)]),console[_0x61cdbf(0x127)](_0x61cdbf(0x1e4)+_0x52a821),console['error'](_0x61cdbf(0x1a2)+_0x5cfe7d));const _0x514b06=await withSpinner(_0x61cdbf(0xca)+_0x52a821+_0x61cdbf(0x76),()=>_0x3989c8[_0x61cdbf(0x105)][_0x61cdbf(0xa6)](_0x52a821),{'verbose':_0x3046fc[_0x61cdbf(0xb5)]}),_0x39b674=_0x514b06[_0x61cdbf(0xe8)];if(existsSync(_0x5cfe7d)){const _0x480640=readFileSync(_0x5cfe7d,_0x61cdbf(0x90)),_0x54373f=generateDiff(_0x480640,_0x39b674);if(!hasChanges(_0x54373f))console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x1dc)]('✔')+_0x61cdbf(0xd1)+a30_0x1b0436[_0x61cdbf(0x1ba)](_0x5cfe7d)+_0x61cdbf(0x1b4));else{console['error'](_0x61cdbf(0x17c)+_0x5cfe7d+'\x27:'),console[_0x61cdbf(0x127)]('─'[_0x61cdbf(0x145)](0x3c)),console[_0x61cdbf(0x127)](formatDiffWithColors(_0x54373f)),console[_0x61cdbf(0x127)]('─'[_0x61cdbf(0x145)](0x3c));if(!_0x3046fc[_0x61cdbf(0x190)]){if(!isInteractive())return console[_0x61cdbf(0x127)](a30_0x1b0436['red'](_0x61cdbf(0xff)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x61cdbf(0x127)](a30_0x1b0436['dim'](_0x61cdbf(0x1d9))),0x1;const _0x3a0007=await confirmKey(_0x61cdbf(0x1f1)+_0x5cfe7d+'\x27?');if(!_0x3a0007)return console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0xb2)]('Aborted.')),0x1;}writeFileSync(_0x5cfe7d,_0x39b674,_0x61cdbf(0x90)),console['error'](a30_0x1b0436[_0x61cdbf(0x1dc)]('✔')+_0x61cdbf(0x13e)+a30_0x1b0436['cyan'](_0x5cfe7d));}}else{const _0x2b0db4=a30_0x41b2d2[_0x61cdbf(0x164)](_0x5cfe7d);!existsSync(_0x2b0db4)&&mkdirSync(_0x2b0db4,{'recursive':!![]}),writeFileSync(_0x5cfe7d,_0x39b674,_0x61cdbf(0x90)),console[_0x61cdbf(0x127)](a30_0x1b0436['green']('✔')+_0x61cdbf(0x13e)+a30_0x1b0436['cyan'](_0x5cfe7d));}return saveSessionContext({'parent_segment':_0x52a821},_0x3046fc[_0x61cdbf(0xce)]),console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x1dc)]('✔')+_0x61cdbf(0x1c6)+a30_0x1b0436['dim']('parent_segment')+_0x61cdbf(0x17a)+a30_0x1b0436[_0x61cdbf(0x1ba)](_0x52a821)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x1d0);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x89);async[a30_0x266c7f(0xd5)](_0x4f4730){const _0x5d0abc=a30_0x266c7f,{options:_0x5c3e1a,args:_0x5f2616,tdx:_0x25e5e0}=_0x4f4730,_0x1149e9=_0x5c3e1a,_0x14ab99=_0x5f2616[0x0]||_0x5c3e1a[_0x5d0abc(0xe6)];if(!_0x14ab99)return showParentSegmentNotSetError(_0x5d0abc(0x13a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x4b8b8a=resolveYamlFile(_0x14ab99);if(!existsSync(_0x4b8b8a))return showFileNotFoundError(_0x4b8b8a,_0x14ab99),0x1;_0x1149e9[_0x5d0abc(0xb5)]&&(console[_0x5d0abc(0x127)](_0x5d0abc(0x108)+_0x1149e9[_0x5d0abc(0x175)]),console[_0x5d0abc(0x127)](_0x5d0abc(0xdf)+_0x4b8b8a));let _0x5ace9a;try{_0x5ace9a=readFileSync(_0x4b8b8a,_0x5d0abc(0x90));}catch(_0x559fb8){const _0xa11510=_0x559fb8 instanceof Error?_0x559fb8[_0x5d0abc(0xa4)]:String(_0x559fb8);return console[_0x5d0abc(0x127)]('Error\x20reading\x20file:\x20'+_0xa11510),0x1;}const _0xe91bf5=await withSpinner(_0x5d0abc(0xcd),()=>_0x25e5e0[_0x5d0abc(0x105)][_0x5d0abc(0x14b)](_0x5ace9a),{'verbose':_0x1149e9['verbose']}),_0x53e87d=_0xe91bf5['data'],{isNew:_0x4cf8c0,name:_0x210b6f,hasChanges:_0x1fa8a5,diffFormatted:_0xde2e53}=_0x53e87d;if(!_0x1fa8a5)return console['error'](_0x5d0abc(0xd4)+_0x210b6f+_0x5d0abc(0x119)),0x0;_0x4cf8c0?console[_0x5d0abc(0x127)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x210b6f+'\x27:'):console[_0x5d0abc(0x127)](_0x5d0abc(0x9d)+_0x210b6f+'\x27:');console['error']('─'[_0x5d0abc(0x145)](0x3c)),console[_0x5d0abc(0x127)](_0xde2e53),console[_0x5d0abc(0x127)]('─'[_0x5d0abc(0x145)](0x3c));const _0x5677d3=_0x4cf8c0?'Create\x20parent\x20segment\x20\x27'+_0x210b6f+'\x27?':_0x5d0abc(0x86)+_0x210b6f+'\x27?';if(!_0x1149e9[_0x5d0abc(0x190)]){if(!isInteractive())return console[_0x5d0abc(0x127)](a30_0x1b0436[_0x5d0abc(0x181)]('\x0aError:'),_0x5d0abc(0x10c)),console[_0x5d0abc(0x127)](a30_0x1b0436['dim'](_0x5d0abc(0x1d9))),0x1;const _0x3bd4af=await confirmKey(_0x5677d3);if(!_0x3bd4af)return console[_0x5d0abc(0x127)](a30_0x1b0436['yellow'](_0x5d0abc(0x186))),0x1;}const _0x544c23=_0x4cf8c0?_0x5d0abc(0x12b):_0x5d0abc(0x193),_0x1692e4=await withSpinner(_0x544c23+'\x20parent\x20segment\x20\x27'+_0x210b6f+'\x27...',()=>_0x53e87d['apply'](),{'verbose':_0x1149e9['verbose']}),_0x1ade1a=_0x1692e4['data'],_0x359a52=getConsoleNextUrl(_0x1149e9[_0x5d0abc(0x175)],'/app/dw/parentSegments/'+_0x1ade1a['id']),_0x13f02d=_0x4cf8c0?_0x5d0abc(0x14c):_0x5d0abc(0x9b);return console[_0x5d0abc(0x127)]('✔\x20'+_0x13f02d+_0x5d0abc(0xd7)+_0x1ade1a[_0x5d0abc(0x199)]+'\x27'),console[_0x5d0abc(0x127)]('\x20\x20'+_0x359a52),0x0;}}function a30_0x33c8(){const _0x17c07c=['\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','workflowSessionId','dim','Listing\x20parent\x20segments\x20matching\x20\x27','timezone','\x27\x20is\x20already\x20up\x20to\x20date','addBehaviorsFile','/sessions/','⚡\x20Not\x20enabled','database','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20--attribute\x20\x22','\x0a\x20\x20\x20\x20}','\x20\x20\x20\x20-\x20','\x20configured','1257481lSmwhR','Status:','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','error','\x20RT\x20configuration\x20is\x20valid','list','\x20service','Creating','/\x20directories\x20exist.','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','segment:parent:preview','in\x20','double','foreignKey','Listing\x20RT-enabled\x20parent\x20segments...','platform','\x20parent\x20segment','page_view','Fetching\x20SQL\x20for\x20\x27','test','\x20\x20No\x20sample\x20data\x20available','Validate:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','segment:parent:show','ps:rt:list','joinKey','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','personalization','jsonl','primaryKey','Rows:','idStitching','listFields','repeat','RT\x202.0\x20Validate:','Columns:','parent_segment','Fetching\x20sample\x20data...','customerGroupFile','pushParentYaml','Created','replace','Schema\x20saved\x20to\x20','apply','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','stats','all','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','segment:parent:pull','Next\x20steps:','keys','Attribute:','.yml','\x20\x202.\x20Run\x20','Fetching\x20behavior\x20list...','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','sourceTableError','Options:','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','filter','Fetching\x20current\x20configuration\x20for\x20\x27','\x5c$&','Pattern:\x20','preview','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','localeCompare','Customers:','validateParentYaml','Table:\x20','Master\x20Table','valid','behaviors','\x0a⚠️\x20\x20Migrating:\x20','customerPercent','getBehaviorNames','My\x20Service','customersWithEvents','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','trigger_event','site','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Error\x20reading\x20file:\x20','map','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20=\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0aChanges\x20to\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','addBehaviors','enabled','using\x20the\x20default\x20path:\x20','red','/\x20directory.\x0a','Join\x20on:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','master','Aborted.','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x27\x20is\x20up\x20to\x20date','\x22,\x20\x22type\x22:\x20\x22','\x0aUsage:\x20tdx\x20ps\x20preview\x20','ps:pz:list','columns','Name:\x20','win32','\x20Added\x20personalization\x20template\x20to\x20','yes','Errors:','start','Updating','No\x20parent\x20segments\x20match\x20pattern:\x20','label','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x201.\x20Edit\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','name','addAttributesFile','\x0a⚠️\x20\x20Both\x20','scheduleOption','\x20section','elapsedTimeMillis','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','interval','Output\x20file:\x20','column_type','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','isDirectory','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','log','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','type','\x20tdx\x20wf\x20attempt\x20','collectSchema','personalizationServices','segment:parent:view','ps:pz:init','schemaValid','indexOf','query','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20is\x20already\x20up\x20to\x20date','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','toFixed','toLowerCase','SQL\x20query:\x0a','385VPHkyO','cyan','\x22\x20}','attribute','Listing\x20parent\x20segments...','\x20\x20\x20\x20\x20\x20','No\x20RT-enabled\x20parent\x20segments\x20found','totalEvents','unref','SELECT\x20*\x20FROM\x20(\x0a','td_client_id','Preview:','✔\x20Created\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','population','Updating\x20parent\x20segment\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','To\x20cancel:','audienceId','✔\x20Updated\x20parent\x20segment\x20\x27','👥\x20','segment:parent:push','schemaError','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Personalization:','%)\x20','behavior','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','⚡\x20Enabled','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','column','formatSchemaJson','green','\x20RT-enabled\x20parent\x20segment','column_name','Error\x20parsing\x20YAML:\x20','displayPreviewHints','/app/dw/parentSegments/','\x20behaviors','run','Parent\x20segment:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayColumns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','✘\x20Failed\x20to\x20rename\x20directory:\x20','previewParentYaml','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','errors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','getParentFull','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:fields','Overwrite\x20\x27','Coverage:','\x20--behavior\x20\x22<name>\x22','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Events:','4103721kvopJC','trim','text','3997285zsAHaM','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','status','\x0a\x20\x20\x20\x20]','/{name}.yml\x0a','No\x20parent\x20segments\x20found','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x27...','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Create\x20parent\x20segment\x20\x27','/attempt/','rowCount','displayRealtimeInfo','realtime','2yIVPPq','Source:','enriched','xdg-open','customers','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','sort','\x27\x20and\x20run\x20workflow?','behavior_','Apply\x20changes\x20to\x20\x27','stitchingKeys','Attempt:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','✔\x20Query\x20completed:\x20Processed\x20','number','6469176UZdzTr','allValid','segment:parent:desc','\x20kill','utf-8','9ArVpJq','displayPreviewResults','.customers)','Behavior:','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','displaySampleData','Behaviors','displayBehaviorsStats','segment:parent:list','displaySummary','Updated','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','endsWith','string','\x20to\x20push\x20the\x20configuration','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Fetching\x20customers\x20schema...','tdx\x20ps\x20preview\x20','message','<database>.<table>','pullParentYaml','displayValidateResults','length','segment:parent:update','customerGroup','Creating\x20parent\x20segment\x20\x27','{\x0a\x20\x20\x22database\x22:\x20\x22','realtime:','json','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','5258736zfRKZC','yellow','coveragePercent','Resolving\x20parent\x20segment\x20\x27','verbose','✔\x20Found\x20','displayMasterInfo','Enriched:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20trigger=','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','25679630OXnXTQ','last_page_viewed','No\x20personalization\x20services\x20configured','parent_segments','/\x20and\x20','Error:\x20File\x20not\x20found:\x20','attributes','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','listParents','ID\x20Stitching:','Validating\x20configuration...','Fetching\x20parent\x20segment\x20\x27','Found\x20YAML\x20file:\x20','sourceTableValid','Analyzing\x20changes...','session','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','runParent','\x20No\x20changes\x20-\x20','format','table','✔\x20No\x20changes\x20-\x20\x27','execute','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20parent\x20segment\x20\x27','scheduleType','Show\x20parent\x20segment\x20details','personalization_services','events','workflowAttemptId','matchedCount','\x20rows\x20','YAML\x20file:\x20','description','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','ignore','getParentSQL','Master:','varchar','parentSegment','output','data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','reduce','List\x20parent\x20segments','\x20Opening\x20','join','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','attributesFile','Available\x20behaviors:','Output\x20Database:','SELECT\x20*\x20FROM\x20','push','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20--attribute\x20\x22<name>\x22','stop','Error:','bold','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:validate','updateParent','\x0a\x20\x20]\x0a}\x0a','65240ibSgRh','`\x20to\x20download\x20the\x20configuration\x20first','\x0aError:','displayAttributesStats','\x27\x20with\x20ID:\x20','behaviorsFile','true','tdx\x20ps\x20push\x20','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','getOutputDatabaseName','Site:\x20','resolveParentId','\x20--behavior\x20\x22','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20--enriched','\x20field','Database:\x20','\x20personalization\x20service','Options:\x0a','Default','Listing\x20fields\x20for\x20\x27'];a30_0x33c8=function(){return _0x17c07c;};return a30_0x33c8();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0xfa);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a30_0x266c7f(0xd5)](_0x22df18){const _0xae6da5=a30_0x266c7f,{options:_0x5dcf49,args:_0x1fbace,tdx:_0x4c6b5f}=_0x22df18,_0x95f9b9=_0x5dcf49,_0x20d258=_0x1fbace[0x0]||_0x5dcf49[_0xae6da5(0xe6)];if(!_0x20d258)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0xae6da5(0x9c)+_0xae6da5(0x111)+_0xae6da5(0xba)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0xae6da5(0x1e5)),0x1;const _0x1d2c15=resolveYamlFile(_0x20d258);if(!existsSync(_0x1d2c15))return showFileNotFoundError(_0x1d2c15,_0x20d258),0x1;_0x95f9b9[_0xae6da5(0xb5)]&&(console[_0xae6da5(0x127)](_0xae6da5(0x108)+_0x95f9b9[_0xae6da5(0x175)]),console[_0xae6da5(0x127)](_0xae6da5(0xdf)+_0x1d2c15));let _0x1b050e;try{_0x1b050e=readFileSync(_0x1d2c15,_0xae6da5(0x90));}catch(_0x59335e){const _0x26767c=_0x59335e instanceof Error?_0x59335e[_0xae6da5(0xa4)]:String(_0x59335e);return console[_0xae6da5(0x127)]('Error\x20reading\x20file:\x20'+_0x26767c),0x1;}const _0x5cd7be=createCommandSpinner(a30_0x1b0436[_0xae6da5(0x116)](_0xae6da5(0xc9)),{'verbose':_0x95f9b9['verbose']});_0x5cd7be[_0xae6da5(0x192)]();const _0x3f4efa={'onProgress':_0x3ddd7e=>{const _0x562e51=_0xae6da5;_0x5cd7be[_0x562e51(0x1f9)]=formatProgressMessage(_0x3ddd7e);}};if(_0x95f9b9['master'])_0x3f4efa['master']=!![];if(_0x95f9b9['enriched'])_0x3f4efa[_0xae6da5(0x7f)]=!![];_0x95f9b9[_0xae6da5(0x1bc)]&&(_0x3f4efa[_0xae6da5(0x1bc)]=_0x95f9b9['attribute']);_0x95f9b9[_0xae6da5(0x1d5)]&&(_0x3f4efa[_0xae6da5(0x1d5)]=_0x95f9b9['behavior']);if(_0x95f9b9[_0xae6da5(0x1a1)])_0x3f4efa[_0xae6da5(0x1a1)]=_0x95f9b9[_0xae6da5(0x1a1)];let _0x37080a;try{_0x37080a=await _0x4c6b5f[_0xae6da5(0x105)][_0xae6da5(0x168)](_0x1b050e,_0x3f4efa),_0x5cd7be[_0xae6da5(0xf6)]();}catch(_0x554945){_0x5cd7be[_0xae6da5(0xf6)]();throw _0x554945;}const _0x20ecb5=_0x95f9b9[_0xae6da5(0x1a1)]||'-1d';return this[_0xae6da5(0xa7)](_0x37080a,_0x3f4efa,_0x1d2c15,_0x20ecb5),_0x37080a[_0xae6da5(0x8d)]?0x0:0x1;}[a30_0x266c7f(0xa7)](_0x7221f6,_0xc82361,_0xc0e7c6,_0x11c0b8){const _0x5a4318=a30_0x266c7f;console[_0x5a4318(0x127)]('\x0a'+a30_0x1b0436[_0x5a4318(0xf8)](_0x5a4318(0x139))+'\x20'+_0x7221f6[_0x5a4318(0x199)]),console[_0x5a4318(0x127)]('═'[_0x5a4318(0x145)](0x3c)),this[_0x5a4318(0xb7)](_0x7221f6);if(typeof _0xc82361[_0x5a4318(0x1bc)]==='string'){this[_0x5a4318(0x100)](_0x7221f6),this[_0x5a4318(0x9a)](_0x7221f6),this['displayPreviewHints'](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x1bc),_0xc82361[_0x5a4318(0x1bc)]);return;}if(_0xc82361[_0x5a4318(0x1bc)]===!![]){this[_0x5a4318(0x100)](_0x7221f6),this[_0x5a4318(0x9a)](_0x7221f6),this[_0x5a4318(0x1e0)](_0xc0e7c6,_0x11c0b8,_0x5a4318(0xc4));return;}if(typeof _0xc82361['behavior']==='string'){this[_0x5a4318(0x98)](_0x7221f6,_0x11c0b8),this[_0x5a4318(0x9a)](_0x7221f6),this[_0x5a4318(0x1e0)](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x1d5),_0xc82361[_0x5a4318(0x1d5)]);return;}if(_0xc82361[_0x5a4318(0x1d5)]===!![]){this['displayBehaviorsStats'](_0x7221f6,_0x11c0b8),this[_0x5a4318(0x9a)](_0x7221f6),this[_0x5a4318(0x1e0)](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x16c));return;}this[_0x5a4318(0x100)](_0x7221f6),this[_0x5a4318(0x98)](_0x7221f6,_0x11c0b8),this[_0x5a4318(0x7b)](_0x7221f6),this[_0x5a4318(0x9a)](_0x7221f6),this['displayPreviewHints'](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x152));}[a30_0x266c7f(0x7b)](_0x4bb8fc){displayRealtimeValidation(_0x4bb8fc);}[a30_0x266c7f(0x1e0)](_0x5bb6ab,_0x2dde21,_0xda2cd9,_0x1c879d){const _0x28f32a=a30_0x266c7f;console[_0x28f32a(0x127)]('\x0a'+a30_0x1b0436[_0x28f32a(0x116)]('To\x20view\x20sample\x20data:'));const _0x28f098=_0x2dde21!=='-1d'?'\x20--interval\x20'+_0x2dde21:'';if(_0xda2cd9===_0x28f32a(0x1bc)&&_0x1c879d)console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)](_0x28f32a(0xa3)+_0x5bb6ab+_0x28f32a(0x120)+_0x1c879d+'\x22'+_0x28f098));else{if(_0xda2cd9==='behavior'&&_0x1c879d)console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)](_0x28f32a(0xa3)+_0x5bb6ab+'\x20--behavior\x20\x22'+_0x1c879d+'\x22'+_0x28f098));else(_0xda2cd9===_0x28f32a(0xc4)||_0xda2cd9==='all')&&console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)](_0x28f32a(0xa3)+_0x5bb6ab+_0x28f32a(0xf5)+_0x28f098));}(_0xda2cd9===_0x28f32a(0x16c)||_0xda2cd9===_0x28f32a(0x152))&&console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)]('tdx\x20ps\x20preview\x20'+_0x5bb6ab+_0x28f32a(0x1f3)+_0x28f098)),_0xda2cd9===_0x28f32a(0x152)&&console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)]('tdx\x20ps\x20preview\x20'+_0x5bb6ab+_0x28f32a(0x10d)+_0x28f098));}[a30_0x266c7f(0xb7)](_0x2b8493){const _0xa8e50=a30_0x266c7f,{master:_0x33c90e}=_0x2b8493,_0x55c070=_0x33c90e['schemaValid']?a30_0x1b0436[_0xa8e50(0x1dc)]('✔'):a30_0x1b0436[_0xa8e50(0x181)]('✘');console[_0xa8e50(0x127)]('\x0a'+a30_0x1b0436[_0xa8e50(0x116)](_0xa8e50(0x16a))),console['error'](_0x55c070+'\x20'+a30_0x1b0436[_0xa8e50(0xf8)](_0x33c90e[_0xa8e50(0x11d)]+'.'+_0x33c90e[_0xa8e50(0xd3)])),_0x33c90e[_0xa8e50(0x1b0)]?_0x33c90e[_0xa8e50(0x7a)]!==undefined&&console[_0xa8e50(0x127)]('\x20\x20'+a30_0x1b0436[_0xa8e50(0x116)](_0xa8e50(0x142))+'\x20'+a30_0x1b0436[_0xa8e50(0x1ba)](formatRows(_0x33c90e['rowCount']))):console[_0xa8e50(0x127)]('\x20\x20'+a30_0x1b0436[_0xa8e50(0x181)]('Error:')+'\x20'+_0x33c90e[_0xa8e50(0x1d1)]);}['displayAttributesStats'](_0x13b229){const _0x4587b0=a30_0x266c7f;if(_0x13b229['attributes'][_0x4587b0(0xa8)]===0x0)return;console[_0x4587b0(0x127)]('\x0a'+a30_0x1b0436['dim']('Attributes'));for(const _0x4dd7d7 of _0x13b229[_0x4587b0(0xc4)]){const _0x7ad7c4=_0x4dd7d7[_0x4587b0(0x1b0)]?a30_0x1b0436[_0x4587b0(0x1dc)]('✔'):a30_0x1b0436[_0x4587b0(0x181)]('✘');let _0x59732c='';if(_0x4dd7d7[_0x4587b0(0x1b0)]&&_0x4dd7d7['matchedCount']!==undefined&&_0x4dd7d7['coveragePercent']!==undefined){const _0x4898b0=_0x4dd7d7['coveragePercent'][_0x4587b0(0x1b6)](0x1),_0x5e5e27=_0x4dd7d7[_0x4587b0(0xb3)]>=0x50?a30_0x1b0436[_0x4587b0(0x1dc)]:_0x4dd7d7[_0x4587b0(0xb3)]>=0x32?a30_0x1b0436[_0x4587b0(0xb2)]:a30_0x1b0436[_0x4587b0(0x181)];_0x59732c='\x20'+a30_0x1b0436['dim'](_0x4587b0(0x1f2))+'\x20'+_0x5e5e27(_0x4898b0+'%')+'\x20('+formatRows(_0x4dd7d7[_0x4587b0(0xdd)])+'\x20rows)';}console['error'](_0x7ad7c4+'\x20'+a30_0x1b0436[_0x4587b0(0xf8)](_0x4dd7d7['name'])+_0x59732c),console[_0x4587b0(0x127)]('\x20\x20'+a30_0x1b0436[_0x4587b0(0x116)](_0x4587b0(0x7e))+'\x20'+a30_0x1b0436['bold'](_0x4dd7d7[_0x4587b0(0x11d)]+'.'+_0x4dd7d7[_0x4587b0(0xd3)]));const _0x3afe4e=_0x4dd7d7['joinKey']===_0x4dd7d7[_0x4587b0(0x131)]?a30_0x1b0436['dim']('Join\x20on:')+'\x20'+_0x4dd7d7[_0x4587b0(0x13d)]:a30_0x1b0436[_0x4587b0(0x116)]('Join:')+'\x20'+_0x4dd7d7[_0x4587b0(0x13d)]+_0x4587b0(0x17a)+_0x4dd7d7[_0x4587b0(0x131)];console[_0x4587b0(0x127)]('\x20\x20'+_0x3afe4e),console[_0x4587b0(0x127)]('\x20\x20'+a30_0x1b0436['dim']('Columns:')),this[_0x4587b0(0x1e6)](_0x4dd7d7[_0x4587b0(0x18c)]),!_0x4dd7d7[_0x4587b0(0x1b0)]&&console[_0x4587b0(0x127)]('\x20\x20'+a30_0x1b0436['red']('Error:')+'\x20'+_0x4dd7d7[_0x4587b0(0x1d1)]);}}[a30_0x266c7f(0x98)](_0x21f123,_0x26792c){const _0x30a6a8=a30_0x266c7f;if(_0x21f123[_0x30a6a8(0x16c)][_0x30a6a8(0xa8)]===0x0)return;console['error']('\x0a'+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x97))+'\x20'+a30_0x1b0436[_0x30a6a8(0x116)]('('+_0x26792c+')'));for(const _0x46b8c4 of _0x21f123[_0x30a6a8(0x16c)]){const _0xeb023b=_0x46b8c4['schemaValid']?a30_0x1b0436[_0x30a6a8(0x1dc)]('✔'):a30_0x1b0436['red']('✘');let _0x46cc48='';if(_0x46b8c4[_0x30a6a8(0x1b0)]&&_0x46b8c4[_0x30a6a8(0x171)]!==undefined&&_0x46b8c4[_0x30a6a8(0x1c0)]!==undefined){const _0x189fab=_0x46b8c4[_0x30a6a8(0x16e)]?.['toFixed'](0x1)||'?',_0x3318b5=(_0x46b8c4[_0x30a6a8(0x16e)]??0x0)>=0x32?a30_0x1b0436['green']:(_0x46b8c4['customerPercent']??0x0)>=0x14?a30_0x1b0436[_0x30a6a8(0xb2)]:a30_0x1b0436[_0x30a6a8(0x181)];_0x46cc48='\x20'+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x167))+'\x20'+_0x3318b5(formatRows(_0x46b8c4[_0x30a6a8(0x171)]))+'\x20('+_0x189fab+_0x30a6a8(0x1d4)+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x1f6))+'\x20'+a30_0x1b0436[_0x30a6a8(0x1ba)](formatRows(_0x46b8c4[_0x30a6a8(0x1c0)]));}console[_0x30a6a8(0x127)](_0xeb023b+'\x20'+a30_0x1b0436['bold'](_0x46b8c4[_0x30a6a8(0x199)])+_0x46cc48),console['error']('\x20\x20'+a30_0x1b0436[_0x30a6a8(0x116)]('Source:')+'\x20'+a30_0x1b0436[_0x30a6a8(0xf8)](_0x46b8c4[_0x30a6a8(0x11d)]+'.'+_0x46b8c4[_0x30a6a8(0xd3)]));const _0x3127fe=_0x46b8c4['joinKey']===_0x46b8c4[_0x30a6a8(0x131)]?a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x183))+'\x20'+_0x46b8c4[_0x30a6a8(0x13d)]:a30_0x1b0436[_0x30a6a8(0x116)]('Join:')+'\x20'+_0x46b8c4['joinKey']+_0x30a6a8(0x17a)+_0x46b8c4[_0x30a6a8(0x131)];console[_0x30a6a8(0x127)]('\x20\x20'+_0x3127fe),console[_0x30a6a8(0x127)]('\x20\x20'+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x147))),this[_0x30a6a8(0x1e6)](_0x46b8c4['columns']),!_0x46b8c4[_0x30a6a8(0x1b0)]&&console[_0x30a6a8(0x127)]('\x20\x20'+a30_0x1b0436[_0x30a6a8(0x181)](_0x30a6a8(0xf7))+'\x20'+_0x46b8c4['schemaError']);}}[a30_0x266c7f(0x1e6)](_0x4a2fd6){const _0x33c621=a30_0x266c7f;for(const _0x361d57 of _0x4a2fd6){_0x361d57[_0x33c621(0x195)]===_0x361d57[_0x33c621(0x1da)]||_0x361d57['column']==='*'?console['error'](_0x33c621(0x122)+_0x361d57[_0x33c621(0x195)]):console[_0x33c621(0x127)](_0x33c621(0x122)+_0x361d57[_0x33c621(0x195)]+'\x20'+a30_0x1b0436['dim']('('+_0x361d57[_0x33c621(0x1da)]+')'));}}[a30_0x266c7f(0x9a)](_0x407e26){const _0x5e0c7d=a30_0x266c7f;console[_0x5e0c7d(0x127)]('─'[_0x5e0c7d(0x145)](0x3c));if(_0x407e26[_0x5e0c7d(0x1eb)]['length']>0x0){console[_0x5e0c7d(0x127)]('\x0a'+a30_0x1b0436[_0x5e0c7d(0x181)](_0x5e0c7d(0x191)));for(const _0x14453d of _0x407e26[_0x5e0c7d(0x1eb)]){console[_0x5e0c7d(0x127)]('\x20\x20'+a30_0x1b0436[_0x5e0c7d(0x181)]('•')+'\x20'+_0x14453d);}}_0x407e26[_0x5e0c7d(0x8d)]&&console[_0x5e0c7d(0x127)]('\x0a'+a30_0x1b0436['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x12e);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xbc);async[a30_0x266c7f(0xd5)](_0x555a87){const _0x2409d1=a30_0x266c7f,{options:_0x5c4e1d,args:_0x1dc7f7,tdx:_0x10bdbc}=_0x555a87,_0x5989b3=_0x5c4e1d,_0x3bd5e1=_0x1dc7f7[0x0]||_0x5c4e1d[_0x2409d1(0xe6)];if(!_0x3bd5e1)return showParentSegmentNotSetError(_0x2409d1(0x173)+_0x2409d1(0x184)+'Options\x20(one\x20required):\x0a'+_0x2409d1(0x1f5)+_0x2409d1(0x1a4)+_0x2409d1(0x17b)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x2409d1(0x1e5)),0x1;if(!_0x5989b3['master']&&!_0x5989b3[_0x2409d1(0x1bc)]&&!_0x5989b3[_0x2409d1(0x1d5)]&&!_0x5989b3[_0x2409d1(0x7f)])return console['error'](a30_0x1b0436['red'](_0x2409d1(0xa1))),console[_0x2409d1(0x127)](_0x2409d1(0xb0)),console[_0x2409d1(0x127)](_0x2409d1(0x15d)),console[_0x2409d1(0x127)](_0x2409d1(0x1d6)),console['error'](_0x2409d1(0x75)),console[_0x2409d1(0x127)](_0x2409d1(0x1d2)),console[_0x2409d1(0x127)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x291b06=resolveYamlFile(_0x3bd5e1);if(!existsSync(_0x291b06))return showFileNotFoundError(_0x291b06,_0x3bd5e1),0x1;_0x5989b3[_0x2409d1(0xb5)]&&(console[_0x2409d1(0x127)](_0x2409d1(0x108)+_0x5989b3[_0x2409d1(0x175)]),console[_0x2409d1(0x127)](_0x2409d1(0xdf)+_0x291b06));let _0x3d689a;try{_0x3d689a=readFileSync(_0x291b06,_0x2409d1(0x90));}catch(_0xd9fdfd){const _0x1e6e2a=_0xd9fdfd instanceof Error?_0xd9fdfd[_0x2409d1(0xa4)]:String(_0xd9fdfd);return console[_0x2409d1(0x127)]('Error\x20reading\x20file:\x20'+_0x1e6e2a),0x1;}let _0x14ac93;try{_0x14ac93=parseDef(_0x3d689a);}catch(_0x4fac9c){const _0x39dc26=_0x4fac9c instanceof Error?_0x4fac9c[_0x2409d1(0xa4)]:String(_0x4fac9c);return console[_0x2409d1(0x127)](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0x1df)+_0x39dc26)),0x1;}if(_0x5989b3[_0x2409d1(0x1bc)]===!![]||_0x5989b3['attribute']===''){const _0x37ceae=_0x14ac93[_0x2409d1(0xc4)]?.[_0x2409d1(0x178)](_0x3ff6b7=>_0x3ff6b7[_0x2409d1(0x199)])||[];if(_0x37ceae[_0x2409d1(0xa8)]===0x0)console[_0x2409d1(0x127)](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0x11e)));else{console[_0x2409d1(0x127)](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0xf4))),console['error']('Available\x20attributes:');for(const _0x27961d of _0x37ceae){console['error']('\x20\x20'+a30_0x1b0436[_0x2409d1(0x1ba)](_0x27961d));}console[_0x2409d1(0x127)](_0x2409d1(0x18a)+_0x3bd5e1+'\x20--attribute\x20\x22'+_0x37ceae[0x0]+'\x22');}return 0x1;}if(_0x5989b3[_0x2409d1(0x1d5)]===!![]||_0x5989b3['behavior']===''){const _0x2805df=_0x14ac93[_0x2409d1(0x16c)]?.['map'](_0x2863f4=>_0x2863f4['name'])||[];if(_0x2805df[_0x2409d1(0xa8)]===0x0)console['error'](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0xf9)));else{console['error'](a30_0x1b0436['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x2409d1(0x127)](_0x2409d1(0xf0));for(const _0x33cf45 of _0x2805df){console[_0x2409d1(0x127)]('\x20\x20'+a30_0x1b0436[_0x2409d1(0x1ba)](_0x33cf45));}console['error'](_0x2409d1(0x18a)+_0x3bd5e1+_0x2409d1(0x10a)+_0x2805df[0x0]+'\x22');}return 0x1;}const _0x30e78d=createCommandSpinner(a30_0x1b0436[_0x2409d1(0x116)](_0x2409d1(0x149)),{'verbose':_0x5989b3[_0x2409d1(0xb5)]});_0x30e78d[_0x2409d1(0x192)]();const _0x396760={'onProgress':_0x10cd46=>{_0x30e78d['text']=formatProgressMessage(_0x10cd46);}};if(_0x5989b3[_0x2409d1(0x185)])_0x396760[_0x2409d1(0x185)]=!![];if(_0x5989b3[_0x2409d1(0x1bc)]&&typeof _0x5989b3[_0x2409d1(0x1bc)]==='string')_0x396760['attribute']=_0x5989b3[_0x2409d1(0x1bc)];if(_0x5989b3[_0x2409d1(0x1d5)]&&typeof _0x5989b3[_0x2409d1(0x1d5)]==='string')_0x396760[_0x2409d1(0x1d5)]=_0x5989b3['behavior'];if(_0x5989b3['enriched'])_0x396760[_0x2409d1(0x7f)]=!![];if(_0x5989b3['interval'])_0x396760[_0x2409d1(0x1a1)]=_0x5989b3[_0x2409d1(0x1a1)];let _0x199bf2;try{_0x199bf2=await _0x10bdbc[_0x2409d1(0x105)][_0x2409d1(0x1e9)](_0x3d689a,_0x396760),_0x30e78d['stop']();}catch(_0x1b8c41){_0x30e78d[_0x2409d1(0xf6)]();throw _0x1b8c41;}return await this[_0x2409d1(0x92)](_0x199bf2,{'master':_0x5989b3[_0x2409d1(0x185)],'attribute':typeof _0x5989b3[_0x2409d1(0x1bc)]==='string'?_0x5989b3['attribute']:undefined,'behavior':typeof _0x5989b3[_0x2409d1(0x1d5)]===_0x2409d1(0x9f)?_0x5989b3['behavior']:undefined,'enriched':_0x5989b3[_0x2409d1(0x7f)]}),_0x199bf2['allValid']?0x0:0x1;}async[a30_0x266c7f(0x92)](_0x4b842a,_0x51b590){const _0x396e7f=a30_0x266c7f;console[_0x396e7f(0x127)]('\x0a'+a30_0x1b0436[_0x396e7f(0xf8)](_0x396e7f(0x1c4))+'\x20'+_0x4b842a['name']),console['error']('═'['repeat'](0x3c));if(_0x51b590['master']&&_0x4b842a[_0x396e7f(0x19f)]){const _0x204e9e=a30_0x1b0436['dim'](_0x396e7f(0xe4))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)](_0x4b842a[_0x396e7f(0x185)][_0x396e7f(0x11d)]+'.'+_0x4b842a[_0x396e7f(0x185)][_0x396e7f(0xd3)]);await this[_0x396e7f(0x96)](_0x204e9e,_0x4b842a['sampleData']);}else{if(_0x51b590[_0x396e7f(0x1bc)]&&_0x4b842a[_0x396e7f(0x19f)]){const _0x264bde=a30_0x1b0436[_0x396e7f(0x116)](_0x396e7f(0x157))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)](_0x51b590[_0x396e7f(0x1bc)]);await this[_0x396e7f(0x96)](_0x264bde,_0x4b842a[_0x396e7f(0x19f)]);}else{if(_0x51b590['behavior']&&_0x4b842a[_0x396e7f(0x19f)]){const _0xfd580f=a30_0x1b0436[_0x396e7f(0x116)](_0x396e7f(0x94))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)](_0x51b590[_0x396e7f(0x1d5)]);await this[_0x396e7f(0x96)](_0xfd580f,_0x4b842a[_0x396e7f(0x19f)]);}else{if(_0x51b590[_0x396e7f(0x7f)]&&_0x4b842a[_0x396e7f(0x19f)]){const _0x46c3aa=a30_0x1b0436['dim'](_0x396e7f(0xb8))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x46c3aa,_0x4b842a[_0x396e7f(0x19f)]);}else!_0x4b842a[_0x396e7f(0x19f)]&&console[_0x396e7f(0x127)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x4b842a[_0x396e7f(0x1eb)][_0x396e7f(0xa8)]>0x0){console[_0x396e7f(0x127)]('─'[_0x396e7f(0x145)](0x3c)),console['error']('\x0a'+a30_0x1b0436['red'](_0x396e7f(0x191)));for(const _0x3f41f9 of _0x4b842a['errors']){console[_0x396e7f(0x127)]('\x20\x20'+a30_0x1b0436[_0x396e7f(0x181)]('•')+'\x20'+_0x3f41f9);}}}async['displaySampleData'](_0x1ecc43,_0x529ba8){const _0x5754ee=a30_0x266c7f;if(_0x529ba8[_0x5754ee(0xa8)]===0x0){console['error']('\x0a'+_0x1ecc43),console[_0x5754ee(0x127)](_0x5754ee(0x138));return;}console[_0x5754ee(0x127)]('\x0a'+_0x1ecc43);const _0x524560=Object[_0x5754ee(0x156)](_0x529ba8[0x0])[_0x5754ee(0x178)](_0x5e48e9=>({'name':_0x5e48e9,'type':typeof _0x529ba8[0x0][_0x5e48e9]===_0x5754ee(0x8b)?_0x5754ee(0x130):_0x5754ee(0xe5)})),_0x2594f6={'queryId':_0x5754ee(0x163),'columns':_0x524560,'data':_0x529ba8,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x529ba8[_0x5754ee(0xa8)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x34aa8a=formatAsTable(_0x2594f6,_0x529ba8['length'],!![]);await writeOutput(_0x34aa8a,undefined,_0x5754ee(0xd3));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]='segment:parent:run';['description']=a30_0x266c7f(0x126);async[a30_0x266c7f(0xd5)](_0x4396fb){const _0x1238ad=a30_0x266c7f,{options:_0x689bbd,args:_0x4db3cc,tdx:_0x22c48a}=_0x4396fb,_0x26700e=_0x689bbd,_0x1b0fc1=_0x4db3cc[0x0]||_0x689bbd[_0x1238ad(0xe6)];if(!_0x1b0fc1)return showParentSegmentNotSetError(_0x1238ad(0x15e)+_0x1238ad(0x165)),0x1;const _0x46c829=resolveYamlFile(_0x1b0fc1);if(existsSync(_0x46c829)){_0x26700e['verbose']&&console[_0x1238ad(0x127)](_0x1238ad(0xcb)+_0x46c829);let _0x58c001;try{_0x58c001=readFileSync(_0x46c829,_0x1238ad(0x90));}catch(_0x5c3db7){const _0x2e2e85=_0x5c3db7 instanceof Error?_0x5c3db7[_0x1238ad(0xa4)]:String(_0x5c3db7);return console[_0x1238ad(0x127)](_0x1238ad(0x177)+_0x2e2e85),0x1;}const _0x415196=await withSpinner('Analyzing\x20changes...',()=>_0x22c48a[_0x1238ad(0x105)][_0x1238ad(0x14b)](_0x58c001),{'verbose':_0x26700e[_0x1238ad(0xb5)]}),_0x480bd5=_0x415196[_0x1238ad(0xe8)],{isNew:_0x193ad9,name:_0x900375,hasChanges:_0xcaafbf,diffFormatted:_0xe147d4}=_0x480bd5;if(_0xcaafbf){_0x193ad9?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x900375+'\x27:'):console[_0x1238ad(0x127)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x900375+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x1238ad(0x127)](_0xe147d4),console[_0x1238ad(0x127)]('─'[_0x1238ad(0x145)](0x3c));const _0x22844f=_0x193ad9?_0x1238ad(0x78)+_0x900375+_0x1238ad(0x84):_0x1238ad(0x86)+_0x900375+_0x1238ad(0x84);if(!_0x26700e[_0x1238ad(0x190)]){if(!isInteractive())return console[_0x1238ad(0x127)](a30_0x1b0436[_0x1238ad(0x181)]('\x0aError:'),_0x1238ad(0x10c)),console['error'](a30_0x1b0436[_0x1238ad(0x116)](_0x1238ad(0x1d9))),0x1;const _0x4d3e66=await confirmKey(_0x22844f);if(!_0x4d3e66)return console[_0x1238ad(0x127)](a30_0x1b0436[_0x1238ad(0xb2)](_0x1238ad(0x186))),0x1;}const _0x1cd1db=_0x193ad9?'Creating':_0x1238ad(0x193);await withSpinner(_0x1cd1db+_0x1238ad(0xd7)+_0x900375+_0x1238ad(0x76),()=>_0x480bd5[_0x1238ad(0x14f)](),{'verbose':_0x26700e[_0x1238ad(0xb5)]});const _0x3497c8=_0x193ad9?_0x1238ad(0x14c):_0x1238ad(0x9b);console[_0x1238ad(0x127)]('✔\x20'+_0x3497c8+'\x20parent\x20segment\x20\x27'+_0x900375+'\x27');}else console[_0x1238ad(0x127)](_0x1238ad(0xd4)+_0x900375+_0x1238ad(0x188));}const _0x31a4b5=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x1b0fc1+_0x1238ad(0x76),()=>_0x22c48a[_0x1238ad(0x105)][_0x1238ad(0xd0)](_0x1b0fc1),{'verbose':_0x26700e[_0x1238ad(0xb5)]}),_0x276e=_0x31a4b5[_0x1238ad(0xe8)],_0x110f2d=getConsoleUrl(_0x26700e[_0x1238ad(0x175)],'/app/workflows/'+_0x276e['workflowId']+_0x1238ad(0x11b)+_0x276e[_0x1238ad(0x115)]+_0x1238ad(0x79)+_0x276e[_0x1238ad(0xdc)]);return console[_0x1238ad(0x127)]('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a30_0x1b0436[_0x1238ad(0x116)]('Audience\x20ID:')+'\x20'+_0x276e[_0x1238ad(0x1cd)]),console[_0x1238ad(0x127)]('\x20\x20'+a30_0x1b0436[_0x1238ad(0x116)](_0x1238ad(0x125))+'\x20'+_0x276e[_0x1238ad(0x1fc)]),console[_0x1238ad(0x127)]('\x20\x20'+a30_0x1b0436['dim']('Session:')+'\x20'+_0x276e['workflowSessionId']),console[_0x1238ad(0x127)]('\x20\x20'+a30_0x1b0436['dim'](_0x1238ad(0x88))+'\x20'+_0x276e[_0x1238ad(0xdc)]),console[_0x1238ad(0x127)]('\x20\x20'+_0x110f2d),console[_0x1238ad(0x127)]('\x0a'+a30_0x1b0436[_0x1238ad(0x116)](_0x1238ad(0x1cc))+_0x1238ad(0x1ab)+_0x276e[_0x1238ad(0xdc)]+_0x1238ad(0x8f)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x1f0);[a30_0x266c7f(0xe0)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x567359){const _0x819de0=a30_0x266c7f,{options:_0xad82b6,args:_0x3e9c71,tdx:_0x5c8a2b}=_0x567359,_0x15d7d3=_0x3e9c71[0x0]||_0xad82b6[_0x819de0(0xe6)];if(!_0x15d7d3)return showParentSegmentNotSetError(_0x819de0(0x10b)+_0x819de0(0x1e7)),0x1;_0xad82b6['verbose']&&(console[_0x819de0(0x127)](_0x819de0(0x108)+_0xad82b6[_0x819de0(0x175)]),console[_0x819de0(0x127)]('Parent\x20segment:\x20'+_0x15d7d3));const _0x157015=await withSpinner(_0x819de0(0x113)+_0x15d7d3+'\x27...',()=>_0x5c8a2b[_0x819de0(0x105)][_0x819de0(0x144)](_0x15d7d3),{'verbose':_0xad82b6['verbose']}),_0x4fee4b=_0x157015[_0x819de0(0xe8)];console[_0x819de0(0x127)](_0x819de0(0xb6)+_0x4fee4b[_0x819de0(0xa8)]+_0x819de0(0x10e)+(_0x4fee4b[_0x819de0(0xa8)]!==0x1?'s':''));if(_0xad82b6['json']||_0xad82b6[_0x819de0(0x140)])return await handleSDKOutput(_0x4fee4b,_0xad82b6),0x0;return displayFieldsHumanReadable(_0x4fee4b,_0x15d7d3),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x1ae);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xd9);async[a30_0x266c7f(0xd5)](_0x2fecac){const _0x267c72=a30_0x266c7f,{options:_0x48abde,args:_0x283582,tdx:_0x5ec967}=_0x2fecac,_0x496920=_0x48abde,_0x18c330=_0x283582[0x0]||_0x48abde[_0x267c72(0xe6)];if(!_0x18c330)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x267c72(0x11f)+_0x267c72(0x111)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x48abde[_0x267c72(0xb5)]&&(console[_0x267c72(0x127)](_0x267c72(0x108)+_0x48abde['site']),console[_0x267c72(0x127)](_0x267c72(0x1e4)+_0x18c330));const _0x63e97e=await withSpinner(_0x267c72(0xca)+_0x18c330+_0x267c72(0x76),()=>_0x5ec967[_0x267c72(0x105)][_0x267c72(0x1ee)](_0x18c330),{'verbose':_0x48abde[_0x267c72(0xb5)]}),_0x19fd3e=_0x63e97e[_0x267c72(0xe8)];if(_0x496920['web']){const _0x195268=getConsoleNextUrl(_0x496920[_0x267c72(0x175)],'/app/dw/parentSegments/'+_0x19fd3e['id']);return console[_0x267c72(0x127)](a30_0x1b0436[_0x267c72(0x1dc)]('✔')+_0x267c72(0xec)+a30_0x1b0436[_0x267c72(0x1ba)](_0x195268)),openBrowser(_0x195268),0x0;}return await handleSingleObjectOutput(_0x19fd3e,_0x48abde),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a30_0x266c7f(0x8e);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x198);async[a30_0x266c7f(0xd5)](_0x2cd73a){const _0x347875=a30_0x266c7f,{options:_0x1ec9dc,args:_0x283c9d,tdx:_0xce0632}=_0x2cd73a,_0x5563c0=_0x1ec9dc,_0x210199=_0x283c9d[0x0]||_0x1ec9dc[_0x347875(0xe6)];if(!_0x210199)return showParentSegmentNotSetError(_0x347875(0x1a6)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+_0x347875(0x111)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x1ec9dc[_0x347875(0xb5)]&&(console['error'](_0x347875(0x108)+_0x1ec9dc['site']),console['error'](_0x347875(0x1e4)+_0x210199));const _0x2e1025=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x210199+_0x347875(0x76),()=>_0xce0632['segment'][_0x347875(0x109)](_0x210199),{'verbose':_0x1ec9dc[_0x347875(0xb5)]}),_0x5510d3=_0x2e1025[_0x347875(0xe8)],_0x10c721=_0xce0632['segment'][_0x347875(0x107)](_0x5510d3);if(_0x5563c0[_0x347875(0xe7)]){const _0x497d2a=await this['collectSchema'](_0x2cd73a,_0x210199,_0x5510d3,_0x10c721),_0x4b12bb=this[_0x347875(0x1db)](_0x497d2a);writeFileSync(_0x5563c0['output'],_0x4b12bb);const _0x90bc57=_0x497d2a['customers'][_0x347875(0x18c)][_0x347875(0xa8)]+_0x497d2a[_0x347875(0x16c)][_0x347875(0xea)]((_0x43c718,_0x3328c0)=>_0x43c718+_0x3328c0[_0x347875(0x18c)][_0x347875(0xa8)],0x0),_0x40f24a=_0x497d2a[_0x347875(0x16c)][_0x347875(0x15f)](_0x23ec6e=>_0x23ec6e[_0x347875(0x18c)][_0x347875(0xa8)]===0x0)[_0x347875(0xa8)];return console['log'](_0x347875(0x14e)+_0x5563c0[_0x347875(0xe7)]),console[_0x347875(0x1a7)]('\x20\x20Database:\x20'+_0x10c721),console[_0x347875(0x1a7)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x497d2a[_0x347875(0x16c)][_0x347875(0xa8)]+_0x347875(0x1e2)),console[_0x347875(0x1a7)]('\x20\x20Columns:\x20'+_0x90bc57+'\x20total'),_0x40f24a>0x0&&console[_0x347875(0x1a7)]('\x20\x20Note:\x20'+_0x40f24a+_0x347875(0x1b5)),0x0;}console['error']('\x0a'+a30_0x1b0436[_0x347875(0xf8)](_0x347875(0xf1))+'\x20'+a30_0x1b0436[_0x347875(0x1ba)](_0x10c721));const _0x3b6a79=await withSpinner(_0x347875(0xa2),()=>_0xce0632[_0x347875(0x105)][_0x347875(0xe3)](_0x5510d3),{'verbose':_0x1ec9dc[_0x347875(0xb5)]});console['error']('\x0a'+a30_0x1b0436[_0x347875(0xf8)]('customers')+'\x20'+a30_0x1b0436[_0x347875(0x116)]('('+_0x10c721+_0x347875(0x93)));const _0x14528b=await executeSchemaQuery(_0x3b6a79[_0x347875(0xe8)],_0xce0632,_0x1ec9dc);await handleQueryOutput(_0x14528b,_0x1ec9dc);const _0x1ad9f4=await withSpinner('Fetching\x20behavior\x20list...',()=>_0xce0632['segment'][_0x347875(0x16f)](_0x5510d3),{'verbose':_0x1ec9dc[_0x347875(0xb5)]});for(const _0x39f887 of _0x1ad9f4[_0x347875(0xe8)]){const _0x416856=_0x347875(0x85)+_0x39f887[_0x347875(0x1b7)]()[_0x347875(0x14d)](/\s+/g,'_'),_0x408433=_0x347875(0xf2)+_0x10c721+'.'+_0x416856;console[_0x347875(0x127)]('\x0a'+a30_0x1b0436[_0x347875(0xf8)](_0x39f887)+'\x20'+a30_0x1b0436[_0x347875(0x116)]('('+_0x10c721+'.'+_0x416856+')'));try{const _0x9f9c1a=await executeSchemaQuery(_0x408433,_0xce0632,_0x1ec9dc);await handleQueryOutput(_0x9f9c1a,_0x1ec9dc);}catch{console[_0x347875(0x127)](a30_0x1b0436[_0x347875(0xb2)](_0x347875(0x114)));}}return 0x0;}async[a30_0x266c7f(0x1ac)](_0x51d7e7,_0x2de6ef,_0x8f0cf5,_0x56bd53){const _0x2a5115=a30_0x266c7f,{options:_0x4faaaa,tdx:_0x583c49}=_0x51d7e7,_0x5abb76=await withSpinner(_0x2a5115(0xa2),()=>_0x583c49[_0x2a5115(0x105)][_0x2a5115(0xe3)](_0x8f0cf5),{'verbose':_0x4faaaa[_0x2a5115(0xb5)]}),_0x826b70=await executeSchemaQuery(_0x5abb76[_0x2a5115(0xe8)],_0x583c49,_0x4faaaa),_0x5ae383=_0x826b70[_0x2a5115(0xe8)][_0x2a5115(0x178)](_0xc90c66=>({'name':_0xc90c66[_0x2a5115(0x1de)],'type':_0xc90c66[_0x2a5115(0x1a3)]})),_0x26a06a=await withSpinner(_0x2a5115(0x15a),()=>_0x583c49[_0x2a5115(0x105)][_0x2a5115(0x16f)](_0x8f0cf5),{'verbose':_0x4faaaa[_0x2a5115(0xb5)]}),_0x405f81=[];for(const _0x123a42 of _0x26a06a[_0x2a5115(0xe8)]){const _0x1019b5=_0x2a5115(0x85)+_0x123a42['toLowerCase']()['replace'](/\s+/g,'_'),_0x1d9c43=_0x2a5115(0xf2)+_0x56bd53+'.'+_0x1019b5;let _0x47f2b9=[];try{const _0x2fa752=await executeSchemaQuery(_0x1d9c43,_0x583c49,_0x4faaaa);_0x47f2b9=_0x2fa752['data'][_0x2a5115(0x178)](_0x33675f=>({'name':_0x33675f[_0x2a5115(0x1de)],'type':_0x33675f[_0x2a5115(0x1a3)]}));}catch{}_0x405f81[_0x2a5115(0xf3)]({'table':_0x1019b5,'columns':_0x47f2b9});}return{'database':_0x56bd53,'parent_segment':_0x2de6ef,'parent_id':_0x8f0cf5,'customers':{'table':_0x2a5115(0x81),'columns':_0x5ae383},'behaviors':_0x405f81};}[a30_0x266c7f(0x1db)](_0x5dc1ab){const _0x4b9af0=a30_0x266c7f,_0x49dd68=_0x5931d1=>{const _0x14f713=a30_0x442f;if(_0x5931d1['length']===0x0)return'[]';const _0x3c8c46=_0x5931d1['map'](_0x10140c=>_0x14f713(0xcf)+_0x10140c[_0x14f713(0x199)]+_0x14f713(0x189)+_0x10140c[_0x14f713(0x1aa)]+_0x14f713(0x1bb));return'[\x0a'+_0x3c8c46[_0x14f713(0xed)](',\x0a')+_0x14f713(0x1fd);},_0x2c304f=_0x5dc1ab['behaviors'][_0x4b9af0(0x178)](_0x5f04b=>{const _0x367786=_0x4b9af0;return _0x367786(0x172)+_0x5f04b[_0x367786(0xd3)]+_0x367786(0x95)+_0x49dd68(_0x5f04b[_0x367786(0x18c)])[_0x367786(0x14d)](/^/gm,'\x20\x20')[_0x367786(0x1f8)]()+_0x367786(0x121);})['join'](',\x0a');return _0x4b9af0(0xac)+_0x5dc1ab[_0x4b9af0(0x11d)]+_0x4b9af0(0x1fb)+_0x5dc1ab[_0x4b9af0(0x148)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x5dc1ab['parent_id']+_0x4b9af0(0xbd)+_0x5dc1ab['customers'][_0x4b9af0(0xd3)]+_0x4b9af0(0xee)+_0x49dd68(_0x5dc1ab[_0x4b9af0(0x81)]['columns'])[_0x4b9af0(0x14d)](/^/gm,'\x20\x20')[_0x4b9af0(0x1f8)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x2c304f+_0x4b9af0(0xfc);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']='segment:parent:sql';[a30_0x266c7f(0xe0)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x266c7f(0xd5)](_0x2a2f7e){const _0x1db330=a30_0x266c7f,{options:_0x15b129,args:_0x383149,tdx:_0x11cd28}=_0x2a2f7e,_0x289ff3=_0x383149[0x0]||_0x15b129[_0x1db330(0xe6)];if(!_0x289ff3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x1db330(0x1a0)),0x1;_0x15b129[_0x1db330(0xb5)]&&(console['error'](_0x1db330(0x108)+_0x15b129[_0x1db330(0x175)]),console[_0x1db330(0x127)](_0x1db330(0x1e4)+_0x289ff3));const _0x568454=await withSpinner(_0x1db330(0xb4)+_0x289ff3+_0x1db330(0x76),()=>_0x11cd28[_0x1db330(0x105)][_0x1db330(0x109)](_0x289ff3),{'verbose':_0x15b129[_0x1db330(0xb5)]}),_0x382e2d=_0x568454['data'],_0x3229f6=await withSpinner(_0x1db330(0x136)+_0x289ff3+_0x1db330(0x76),()=>_0x11cd28[_0x1db330(0x105)][_0x1db330(0xe3)](_0x382e2d),{'verbose':_0x15b129[_0x1db330(0xb5)]}),_0x113d1e=_0x3229f6[_0x1db330(0xe8)];return _0x15b129['format']==='json'||_0x15b129[_0x1db330(0xd2)]===_0x1db330(0x140)?await handleSDKOutput([{'sql':_0x113d1e}],_0x15b129):console[_0x1db330(0x1a7)](_0x113d1e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x13b);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x150);async[a30_0x266c7f(0xd5)](_0x427b03){const _0x3a0193=a30_0x266c7f,{options:_0x300dc0,args:_0x328920,tdx:_0x3af15c}=_0x427b03,_0x563a4c=_0x328920[0x0]||_0x300dc0[_0x3a0193(0xe6)];if(!_0x563a4c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x3a0193(0xe9)),0x1;_0x300dc0[_0x3a0193(0xb5)]&&(console[_0x3a0193(0x127)](_0x3a0193(0x108)+_0x300dc0[_0x3a0193(0x175)]),console[_0x3a0193(0x127)]('Parent\x20segment:\x20'+_0x563a4c));const _0x2cd36a=await withSpinner(_0x3a0193(0xb4)+_0x563a4c+'\x27...',()=>_0x3af15c[_0x3a0193(0x105)]['resolveParentId'](_0x563a4c),{'verbose':_0x300dc0[_0x3a0193(0xb5)]}),_0x1563b4=_0x2cd36a[_0x3a0193(0xe8)],_0x5bac5b=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x563a4c+_0x3a0193(0x76),()=>_0x3af15c[_0x3a0193(0x105)]['getParentSQL'](_0x1563b4),{'verbose':_0x300dc0[_0x3a0193(0xb5)]});let _0x2e4ee5=_0x5bac5b[_0x3a0193(0xe8)];const _0xb135f1=resolveLimit(_0x300dc0['limit'],DEFAULT_DISPLAY_LIMIT),_0x1567d4=/\bLIMIT\s+\d+/i[_0x3a0193(0x137)](_0x2e4ee5);!_0x1567d4&&(_0x2e4ee5=_0x2e4ee5['trim']()['replace'](/;+$/,''),_0x2e4ee5=_0x3a0193(0x1c2)+_0x2e4ee5+_0x3a0193(0x1c9)+_0xb135f1);_0x300dc0[_0x3a0193(0xb5)]&&console[_0x3a0193(0x127)](_0x3a0193(0x1b8)+_0x2e4ee5);const _0xe47744=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x2a8239=>{const _0x5e33b4=_0x3a0193,_0x4644e0=await _0x3af15c[_0x5e33b4(0x1b2)][_0x5e33b4(0xd5)](_0x2e4ee5,{'catalog':'td','schema':'information_schema','onJobId':_0x3d15e1=>{_0x2a8239['setJobId'](_0x3d15e1);}});return _0x4644e0;},{'verbose':_0x300dc0[_0x3a0193(0xb5)]}),_0xced3e=_0xe47744[_0x3a0193(0xe8)],_0x106379=_0xced3e['jobId']?_0x3a0193(0xaf)+_0xced3e['jobId']+']':'';return console[_0x3a0193(0x127)](_0x3a0193(0x8a)+_0xced3e['stats']['processedRows']['toLocaleString']()+_0x3a0193(0xde)+(_0x3a0193(0x12f)+formatElapsed(_0xced3e[_0x3a0193(0x151)][_0x3a0193(0x19e)])+_0x106379)),await handleQueryOutput(_0xced3e,_0x300dc0),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x266c7f(0x13c);[a30_0x266c7f(0xe0)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a30_0x266c7f(0xd5)](_0x3f5014){const _0x3918cb=a30_0x266c7f,{options:_0x31625a,args:_0x1d1f77,tdx:_0x3eb7f8}=_0x3f5014,_0x5471b5=_0x1d1f77[0x0],_0x136c60=await withSpinner(_0x5471b5?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x5471b5+_0x3918cb(0x76):_0x3918cb(0x132),()=>_0x3eb7f8[_0x3918cb(0x7c)]['list'](),{'verbose':_0x31625a[_0x3918cb(0xb5)]});let _0x5910fe=_0x136c60[_0x3918cb(0xe8)][_0x3918cb(0x15f)](_0x186313=>_0x186313['realtime_enabled']);if(_0x5471b5){const _0x340f7a=_0x5471b5[_0x3918cb(0x14d)](/[.+^${}()|[\]\\]/g,_0x3918cb(0x161))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x197225=new RegExp('^'+_0x340f7a+'$','i');_0x5910fe=_0x5910fe[_0x3918cb(0x15f)](_0x8b4c46=>_0x197225['test'](_0x8b4c46['name']));}_0x5910fe[_0x3918cb(0x83)]((_0x223ea1,_0x1dd85a)=>_0x223ea1[_0x3918cb(0x199)][_0x3918cb(0x166)](_0x1dd85a['name'])),console['error'](_0x3918cb(0xb6)+_0x5910fe[_0x3918cb(0xa8)]+_0x3918cb(0x1dd)+(_0x5910fe[_0x3918cb(0xa8)]!==0x1?'s':''));const _0x191ccc=_0x29dac5=>{const _0x2a33f0=_0x3918cb;return getConsoleNextUrl(_0x31625a[_0x2a33f0(0x175)],'/app/dw/parentSegments/'+_0x29dac5);};if(_0x31625a[_0x3918cb(0xd2)]===_0x3918cb(0xae)||_0x31625a[_0x3918cb(0xd2)]===_0x3918cb(0x140)){const _0x1c32c7=_0x5910fe[_0x3918cb(0x178)](_0x431618=>({..._0x431618,'url':_0x191ccc(_0x431618['id'])}));await handleSDKOutput(_0x1c32c7,_0x31625a);}else{if(_0x5910fe[_0x3918cb(0xa8)]===0x0)console[_0x3918cb(0x1a7)](_0x3918cb(0x1bf));else for(const _0x2404b8 of _0x5910fe){const _0x534e1e=_0x2404b8['population']?a30_0x1b0436[_0x3918cb(0x116)]('\x20('+formatRows(_0x2404b8['population'])+')'):'',_0x302246=hyperlink(_0x2404b8['name'],_0x191ccc(_0x2404b8['id']));console['log']('⚡\x20'+_0x302246+_0x534e1e);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']='ps:rt:validate';[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x187);async['execute'](_0x47e75f){const _0x137d0b=a30_0x266c7f,{options:_0x2ae378,args:_0x1ce852,tdx:_0x2506bd}=_0x47e75f,_0x1a2a13=_0x1ce852[0x0]||_0x2ae378[_0x137d0b(0xe6)];if(!_0x1a2a13)return showParentSegmentNotSetError(_0x137d0b(0x1a9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x299f4e=resolveYamlFile(_0x1a2a13);if(!existsSync(_0x299f4e))return showFileNotFoundError(_0x299f4e,_0x1a2a13),0x1;let _0x3cf7b5;try{_0x3cf7b5=readFileSync(_0x299f4e,'utf-8');}catch(_0x1d5ee5){const _0x559384=_0x1d5ee5 instanceof Error?_0x1d5ee5[_0x137d0b(0xa4)]:String(_0x1d5ee5);return console['error'](_0x137d0b(0x177)+_0x559384),0x1;}const _0x3f3623=createCommandSpinner(a30_0x1b0436[_0x137d0b(0x116)]('Validating\x20RT\x20configuration...'),{'verbose':_0x2ae378['verbose']});_0x3f3623[_0x137d0b(0x192)]();const _0x5e60e5={'realtime':!![],'onProgress':_0x22abd0=>{_0x3f3623['text']=formatProgressMessage(_0x22abd0);}};let _0x145f01;try{_0x145f01=await _0x2506bd[_0x137d0b(0x105)][_0x137d0b(0x168)](_0x3cf7b5,_0x5e60e5),_0x3f3623[_0x137d0b(0xf6)]();}catch(_0x1c0203){_0x3f3623['stop']();throw _0x1c0203;}console['error']('\x0a'+a30_0x1b0436[_0x137d0b(0xf8)](_0x137d0b(0x146))+'\x20'+_0x145f01[_0x137d0b(0x199)]),console[_0x137d0b(0x127)]('═'[_0x137d0b(0x145)](0x3c)),displayRealtimeValidation(_0x145f01),console[_0x137d0b(0x127)]('─'[_0x137d0b(0x145)](0x3c));if(_0x145f01[_0x137d0b(0x1eb)][_0x137d0b(0xa8)]>0x0){console[_0x137d0b(0x127)]('\x0a'+a30_0x1b0436[_0x137d0b(0x181)](_0x137d0b(0x191)));for(const _0x5bdd5e of _0x145f01[_0x137d0b(0x1eb)]){console[_0x137d0b(0x127)]('\x20\x20'+a30_0x1b0436[_0x137d0b(0x181)]('•')+'\x20'+_0x5bdd5e);}}return _0x145f01['allValid']&&console[_0x137d0b(0x127)]('\x0a'+a30_0x1b0436[_0x137d0b(0x1dc)]('✔')+_0x137d0b(0x128)),_0x145f01['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x18b);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xe1);async[a30_0x266c7f(0xd5)](_0x396c15){const _0x2908a0=a30_0x266c7f,{options:_0x23d63f,args:_0x3d491b,tdx:_0x2bfd61}=_0x396c15,_0x7ee574=_0x3d491b[0x0]||_0x23d63f[_0x2908a0(0xe6)];if(!_0x7ee574)return showParentSegmentNotSetError(_0x2908a0(0x1cb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x9c68a9=await withSpinner(_0x2908a0(0xb4)+_0x7ee574+_0x2908a0(0x76),()=>_0x2bfd61[_0x2908a0(0x105)][_0x2908a0(0x109)](_0x7ee574),{'verbose':_0x23d63f[_0x2908a0(0xb5)]}),_0x821aee=_0x9c68a9['data'],_0x5cf8a0=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x7ee574+'\x27...',()=>_0x2bfd61[_0x2908a0(0x13f)][_0x2908a0(0x129)](_0x821aee),{'verbose':_0x23d63f[_0x2908a0(0xb5)]}),_0x560a64=_0x5cf8a0[_0x2908a0(0xe8)];console[_0x2908a0(0x127)](_0x2908a0(0xb6)+_0x560a64[_0x2908a0(0xa8)]+_0x2908a0(0x110)+(_0x560a64[_0x2908a0(0xa8)]!==0x1?'s':''));if(_0x23d63f[_0x2908a0(0xd2)]===_0x2908a0(0xae)||_0x23d63f[_0x2908a0(0xd2)]===_0x2908a0(0x140))await handleSDKOutput(_0x560a64,_0x23d63f);else{if(_0x560a64[_0x2908a0(0xa8)]===0x0)console[_0x2908a0(0x1a7)](_0x2908a0(0xc0)),console[_0x2908a0(0x127)](a30_0x1b0436['cyan'](_0x2908a0(0x196)));else for(const _0x5ede97 of _0x560a64){const _0x20e724=_0x5ede97['sections']?.[_0x2908a0(0xa8)]||0x0,_0x144625=_0x5ede97[_0x2908a0(0x174)]?a30_0x1b0436[_0x2908a0(0x116)](_0x2908a0(0xbb)+_0x5ede97[_0x2908a0(0x174)]):'',_0x2fb10b=a30_0x1b0436['dim']('\x20('+_0x20e724+_0x2908a0(0x19d)+(_0x20e724!==0x1?'s':'')+')');console[_0x2908a0(0x1a7)]('\x20\x20'+_0x5ede97[_0x2908a0(0x199)]+_0x144625+_0x2fb10b),_0x5ede97['description']&&console[_0x2908a0(0x1a7)]('\x20\x20\x20\x20'+a30_0x1b0436[_0x2908a0(0x116)](_0x5ede97[_0x2908a0(0xe0)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x266c7f(0x1af);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x15b);async[a30_0x266c7f(0xd5)](_0x481464){const _0x16981f=a30_0x266c7f,{options:_0x47a097,args:_0x2c1d32}=_0x481464,_0x1410ce=_0x2c1d32[0x0]||_0x47a097[_0x16981f(0xe6)];if(!_0x1410ce)return showParentSegmentNotSetError(_0x16981f(0xc5)+_0x16981f(0x1ec)),0x1;const _0x1a5110=resolveYamlFile(_0x1410ce);if(!existsSync(_0x1a5110))return showFileNotFoundError(_0x1a5110,_0x1410ce),0x1;let _0xcd4737;try{_0xcd4737=readFileSync(_0x1a5110,_0x16981f(0x90));}catch(_0xea1036){const _0x4eca16=_0xea1036 instanceof Error?_0xea1036[_0x16981f(0xa4)]:String(_0xea1036);return console[_0x16981f(0x127)]('Error\x20reading\x20file:\x20'+_0x4eca16),0x1;}let _0x419855;try{_0x419855=parseDef(_0xcd4737);}catch(_0xde8b0e){const _0x9abf37=_0xde8b0e instanceof Error?_0xde8b0e['message']:String(_0xde8b0e);return console[_0x16981f(0x127)](a30_0x1b0436['red'](_0x16981f(0x1df)+_0x9abf37)),0x1;}if(_0x419855[_0x16981f(0xda)]&&_0x419855[_0x16981f(0xda)][_0x16981f(0xa8)]>0x0)return console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0xb2)](_0x16981f(0x176)+_0x1a5110)),console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0x116)]('\x20\x20\x20'+_0x419855[_0x16981f(0xda)][_0x16981f(0xa8)]+'\x20service(s)\x20configured')),0x1;!_0x419855[_0x16981f(0x7c)]&&(_0x419855[_0x16981f(0x7c)]={'events':[{'name':_0x16981f(0x135),'source_table':_0x16981f(0xa5)}],'attributes':[{'name':_0x16981f(0xbf),'type':'single'}],'id_stitching':{'primary_key':_0x419855['master'][_0x16981f(0xd3)]==='customers'?_0x16981f(0x1c3):'user_id'}});_0x419855[_0x16981f(0xda)]=[{'name':_0x16981f(0x170),'description':'Personalization\x20service\x20description','trigger_event':_0x16981f(0x135),'sections':[{'name':_0x16981f(0x112),'criteria':_0x16981f(0x103),'attributes':[_0x16981f(0xbf)]}]}];const _0xc4476f=serializeDef(_0x419855);return writeFileSync(_0x1a5110,_0xc4476f,_0x16981f(0x90)),console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0x1dc)]('✔')+_0x16981f(0x18f)+a30_0x1b0436[_0x16981f(0x1ba)](_0x1a5110)),(!_0x419855['realtime']||_0xcd4737[_0x16981f(0x1b1)](_0x16981f(0xad))===-0x1)&&console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0x1dc)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console['error']('\x0a'+a30_0x1b0436['dim'](_0x16981f(0x155))),console[_0x16981f(0x127)](_0x16981f(0x197)+_0x1a5110+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x16981f(0x127)](_0x16981f(0x159)+a30_0x1b0436[_0x16981f(0x116)](_0x16981f(0x104)+_0x1410ce)+_0x16981f(0xa0)),0x0;}}
1
+ function a30_0x3684(_0x448ab3,_0x4ed0b6){_0x448ab3=_0x448ab3-0xc7;const _0x5ab8c4=a30_0x5ab8();let _0x368492=_0x5ab8c4[_0x448ab3];return _0x368492;}const a30_0x197ce3=a30_0x3684;(function(_0x279dbf,_0x2e58f8){const _0xc2034b=a30_0x3684,_0x946a8=_0x279dbf();while(!![]){try{const _0x3c1242=-parseInt(_0xc2034b(0x157))/0x1*(-parseInt(_0xc2034b(0x19d))/0x2)+-parseInt(_0xc2034b(0xf4))/0x3+parseInt(_0xc2034b(0x1ce))/0x4+-parseInt(_0xc2034b(0x1e9))/0x5*(-parseInt(_0xc2034b(0x21b))/0x6)+-parseInt(_0xc2034b(0x252))/0x7*(-parseInt(_0xc2034b(0x12c))/0x8)+-parseInt(_0xc2034b(0xcc))/0x9*(-parseInt(_0xc2034b(0xe1))/0xa)+parseInt(_0xc2034b(0x177))/0xb*(-parseInt(_0xc2034b(0x1bf))/0xc);if(_0x3c1242===_0x2e58f8)break;else _0x946a8['push'](_0x946a8['shift']());}catch(_0x41fe87){_0x946a8['push'](_0x946a8['shift']());}}}(a30_0x5ab8,0xcb0af));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x8d852a from'path';import{BaseCommand}from'./command.js';function a30_0x5ab8(){const _0x57988c=['customersWithEvents','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','To\x20view\x20sample\x20data:','Fetching\x20parent\x20segment\x20\x27','\x20No\x20changes\x20-\x20','\x20=\x20','status','132dcunzo','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Validating\x20RT\x20configuration...','Show\x20parent\x20segment\x20details','master','realtime_enabled','Overwrite\x20\x27','segment:parent:run','\x20\x20Tables:\x201\x20customers\x20+\x20','foreignKey','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','length','page_view','Available\x20attributes:','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','displayAttributesStats','run','\x0a\x20\x20\x20\x20]','verbose','Creating','\x0aChanges\x20to\x20apply\x20to\x20\x27','Attribute:','Output\x20file:\x20','endsWith','Schema\x20saved\x20to\x20','Personalization:','getParentSQL','\x20+\x20[','Error:','\x20trigger=','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Master:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Master\x20Table','\x20--attribute\x20\x22<name>\x22','attribute','Error\x20parsing\x20YAML:\x20','enriched','Pattern:\x20','timezone','error','\x20Configuration\x20is\x20valid','using\x20the\x20default\x20path:\x20','segment:parent:sql','Updating','Table:\x20','displaySummary','%)\x20','session','match','\x20[Job\x20ID:\x20','customers','Updating\x20parent\x20segment\x20\x27','start','6951esyCbZ','all','trigger_event','enabled','output','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','819rJMttM','win32','No\x20RT-enabled\x20parent\x20segments\x20found','\x20\x201.\x20Edit\x20','listParents','last_page_viewed','Parent\x20segment:\x20','personalization_services','\x27...','collectSchema','/app/workflows/','realtime:','Coverage:','validateParentYaml','rowCount','events','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Error:\x20Parent\x20segment\x20name\x20is\x20required','information_schema','formatSchemaJson','\x20RT-enabled\x20parent\x20segment','23900LfvyJx','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Listing\x20fields\x20for\x20\x27','\x20\x202.\x20Run\x20','replace','Fetching\x20SQL\x20for\x20\x27','Enriched:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Analyzing\x20changes...','label','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','filter','Join\x20on:','scheduleOption','SELECT\x20*\x20FROM\x20','\x27\x20and\x20run\x20workflow?','Fetching\x20customers\x20schema...','Attributes','4301304aiVBNs','displayPreviewHints','primaryKey','Behaviors','displayBehaviorsStats','tdx\x20ps\x20preview\x20','updateParent','realtime','Attempt:','text','segment:parent:list','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','displayPreviewResults','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','sections','Aborted.','attributesFile','No\x20parent\x20segments\x20match\x20pattern:\x20','map','Fetching\x20sample\x20data...','segment:parent:fields','Status:','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','use','ID\x20Stitching:','✔\x20Query\x20completed:\x20Processed\x20','message','✔\x20Found\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','darwin','customerPercent','interval','utf-8','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x27\x20with\x20ID:\x20','\x0aNew\x20parent\x20segment\x20\x27','ignore','indexOf','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20parent\x20segment','Validate:','Errors:','\x20service','test','segment:parent:pull','Listing\x20RT-enabled\x20parent\x20segments...','repeat','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','My\x20Service','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','12704DRSQBN','\x0a✔\x20Workflow\x20started','Site:\x20','displayValidateResults','jsonl','getOutputDatabaseName','/sessions/','toFixed','column','xdg-open','errors','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Columns:','\x20\x20Columns:\x20','sourceTableError','\x20--attribute\x20\x22','\x20\x20\x20\x20-\x20','population','Error:\x20File\x20not\x20found:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','matchedCount','RT\x202.0\x20Validate:','.yml','⚡\x20Not\x20enabled','isDirectory','pullParentYaml','Resolving\x20parent\x20segment\x20\x27','site','/\x20directory.\x0a','open','cyan','-1d','preview','Source:','log','processedRows','stitchingKeys','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','string','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','attributes','parent_id','segment','237FHuMbC','Behavior:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','List\x20parent\x20segments','behavior_','SELECT\x20*\x20FROM\x20(\x0a','execute','Updated','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','Creating\x20parent\x20segment\x20\x27','displayColumns','keys','Create\x20parent\x20segment\x20\x27','getParentFull','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','segment:parent:validate','audienceId','createParent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','td_client_id','yellow','dim','trim','allValid','\x22,\x20\x22type\x22:\x20\x22','personalizationServices','addAttributes','red','\x20is\x20already\x20up\x20to\x20date','✔\x20Created\x20parent\x20segment\x20\x27','22ImENBQ','/app/dw/parentSegments/','toLowerCase','\x27\x20is\x20up\x20to\x20date','segment:parent:show','\x5c$&','Found\x20YAML\x20file:\x20','FINISHED','Preview:','pushParentYaml','\x20behaviors','workflowAttemptId','\x0aError:','\x0a⚠️\x20\x20Migrating:\x20','Events:','\x20\x20\x20','customerGroup','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','Error\x20reading\x20file:\x20','Rows:','totalEvents','Listing\x20personalization\x20services\x20for\x20\x27','Options:','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','idStitching','✘\x20Failed\x20to\x20rename\x20directory:\x20','yes','Audience\x20ID:','previewParentYaml','Attributes:','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','parent_segments','\x20--enriched','Next\x20steps:','Error:\x20--behavior\x20requires\x20a\x20name\x0a','sampleData','json','\x0a\x20\x20]\x0a}\x0a','2206gXiXjC','stop','user_id','database','description','sort','Error:\x20--attribute\x20requires\x20a\x20name\x0a','join','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','localeCompare','<database>.<table>','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','column_type','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','true','✔\x20Renamed\x20directory\x20to\x20','\x20parent\x20segment\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','coveragePercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Session:','\x20section','elapsedTimeMillis','segment:parent:push','resolveParentId','schemaValid','green','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','format','Fetching\x20behavior\x20list...','number','6665112fycxsP','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20field','\x20tdx\x20wf\x20attempt\x20','behaviors','Available\x20behaviors:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20Note:\x20','Executing\x20parent\x20segment\x20query...','toLocaleString','sourceTableValid','parentSegment','List\x20available\x20fields\x20for\x20segmentation','656536GLaYvf','tdx\x20ps\x20push\x20','stats','No\x20personalization\x20services\x20configured','column_name','workflowSessionId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','.yaml','limit','runParent','\x20configured','Apply\x20changes\x20to\x20\x27','\x20Opening\x20','Created','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','ps:rt:validate','/\x20directories\x20exist.','query','workflowId','\x20--behavior\x20\x22','displayRealtimeInfo','\x20Added\x20personalization\x20template\x20to\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','name','⚡\x20Enabled','data','\x0a\x20\x20\x20\x20}','262810EefFdB','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','type','personalization','YAML\x20file:\x20','joinKey','parent_segment','/\x20→\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','setJobId','unref','\x0aChanges\x20to\x20\x27','segment:parent:desc','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','bold','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','displaySampleData','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x0aNo\x20sample\x20data\x20available','Options:\x0a','\x0a⚠️\x20\x20Both\x20','columns','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','displayMasterInfo','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','behavior','customerGroupFile','scheduleType','getBehaviorNames','schemaError','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','apply','\x20\x20\x20\x20','RT\x202.0:','\x20Context\x20set:\x20','table','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','varchar','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:view'];a30_0x5ab8=function(){return _0x57988c;};return a30_0x5ab8();}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x31827d from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x197ce3(0x196),LEGACY_PARENT_SEGMENT_DIR=a30_0x197ce3(0x1ef);function openBrowser(_0xeafa86){const _0x2ede00=a30_0x197ce3,_0x1b2039=process['platform'],_0x1c7609=_0x1b2039===_0x2ede00(0x117)?_0x2ede00(0x149):_0x1b2039===_0x2ede00(0xcd)?'start':_0x2ede00(0x135);spawn(_0x1c7609,[_0xeafa86],{'detached':!![],'stdio':_0x2ede00(0x11e)})[_0x2ede00(0x1f3)]();}function migrateLegacyDirectory(){const _0x2d527e=a30_0x197ce3;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1ad5de=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1ad5de[_0x2d527e(0x144)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2d527e(0x244)](a30_0x31827d[_0x2d527e(0x16d)](_0x2d527e(0x1fe)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x2d527e(0x1de))),console[_0x2d527e(0x244)](a30_0x31827d['dim'](_0x2d527e(0x1f6)+LEGACY_PARENT_SEGMENT_DIR+_0x2d527e(0x148))),![];console[_0x2d527e(0x244)](a30_0x31827d[_0x2d527e(0x16d)](_0x2d527e(0x184)+LEGACY_PARENT_SEGMENT_DIR+_0x2d527e(0x1f0)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2d527e(0x244)](a30_0x31827d[_0x2d527e(0x1ba)](_0x2d527e(0x1ac)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2a6146){const _0x2cbad2=_0x2a6146 instanceof Error?_0x2a6146[_0x2d527e(0x111)]:String(_0x2a6146);return console[_0x2d527e(0x244)](a30_0x31827d['red'](_0x2d527e(0x190)+_0x2cbad2+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x197ce3(0x22b)](_0x1d491e){return migrateLegacyDirectory(),super['run'](_0x1d491e);}}function resolveYamlFile(_0xb4b7a9){const _0x5e879c=a30_0x197ce3;if(_0xb4b7a9['endsWith'](_0x5e879c(0x142))||_0xb4b7a9[_0x5e879c(0x232)](_0x5e879c(0x1d5)))return _0xb4b7a9;return a30_0x8d852a[_0x5e879c(0x1a4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xb4b7a9)+_0x5e879c(0x142));}function formatProgressMessage(_0x36dfc7){const _0x49888a=a30_0x197ce3,_0x4d14a1=_0x36dfc7[_0x49888a(0x24d)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4d14a1){const [,_0x3f6f46,_0x1bfa35,_0x2a181e='']=_0x4d14a1;return a30_0x31827d['dim'](_0x3f6f46+':')+'\x20'+_0x1bfa35+a30_0x31827d['dim'](_0x2a181e);}return a30_0x31827d[_0x49888a(0x16e)](_0x36dfc7);}function showFileNotFoundError(_0x2316b8,_0x273eb3){const _0x5015e3=a30_0x197ce3;console['error'](a30_0x31827d[_0x5015e3(0x174)](_0x5015e3(0x13e)+_0x2316b8+'\x0a')),console[_0x5015e3(0x244)](a30_0x31827d[_0x5015e3(0x14a)](_0x5015e3(0x1fb)+_0x273eb3+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x1fbc8d){const _0x13af4d=a30_0x197ce3;if(!_0x1fbc8d[_0x13af4d(0xfb)])return;const _0x534129=_0x1fbc8d['realtime'],_0x5f40e9=_0x534129[_0x13af4d(0xc8)]?a30_0x31827d[_0x13af4d(0x1ba)](_0x13af4d(0x1e6)):a30_0x31827d['yellow'](_0x13af4d(0x143));console[_0x13af4d(0x244)]('\x0a'+a30_0x31827d[_0x13af4d(0x16e)](_0x13af4d(0x20b))+'\x20'+_0x5f40e9);if(_0x534129[_0x13af4d(0xdb)]&&_0x534129[_0x13af4d(0xdb)][_0x13af4d(0x226)]>0x0){console[_0x13af4d(0x244)]('\x20\x20'+a30_0x31827d[_0x13af4d(0x16e)](_0x13af4d(0x185))+'\x20'+_0x534129['events'][_0x13af4d(0x226)]+_0x13af4d(0x1d8));for(const _0x2d3ac4 of _0x534129[_0x13af4d(0xdb)]){const _0x424b0b=_0x2d3ac4[_0x13af4d(0x1cb)]===![]?a30_0x31827d[_0x13af4d(0x174)]('✘'):a30_0x31827d[_0x13af4d(0x1ba)]('✔');console[_0x13af4d(0x244)]('\x20\x20\x20\x20'+_0x424b0b+'\x20'+_0x2d3ac4[_0x13af4d(0x1e5)]),_0x2d3ac4[_0x13af4d(0x13a)]&&console['error']('\x20\x20\x20\x20\x20\x20'+a30_0x31827d[_0x13af4d(0x174)](_0x2d3ac4[_0x13af4d(0x13a)]));}}if(_0x534129[_0x13af4d(0x154)]&&_0x534129[_0x13af4d(0x154)][_0x13af4d(0x226)]>0x0){console['error']('\x20\x20'+a30_0x31827d[_0x13af4d(0x16e)](_0x13af4d(0x194))+'\x20'+_0x534129[_0x13af4d(0x154)][_0x13af4d(0x226)]+_0x13af4d(0x1d8));for(const _0x4fcbab of _0x534129[_0x13af4d(0x154)]){const _0x169b2a=_0x4fcbab['valid']?a30_0x31827d[_0x13af4d(0x1ba)]('✔'):a30_0x31827d[_0x13af4d(0x174)]('✘');console[_0x13af4d(0x244)](_0x13af4d(0x20a)+_0x169b2a+'\x20'+_0x4fcbab[_0x13af4d(0x1e5)]+'\x20'+a30_0x31827d[_0x13af4d(0x16e)]('('+_0x4fcbab[_0x13af4d(0x1eb)]+')'));}}if(_0x534129[_0x13af4d(0x18f)]){const _0x7dceea=_0x534129[_0x13af4d(0x18f)][_0x13af4d(0x150)]?.['length']?_0x13af4d(0x236)+_0x534129[_0x13af4d(0x18f)][_0x13af4d(0x150)][_0x13af4d(0x1a4)](',\x20')+']':'';console[_0x13af4d(0x244)]('\x20\x20'+a30_0x31827d[_0x13af4d(0x16e)](_0x13af4d(0x10f))+'\x20'+_0x534129[_0x13af4d(0x18f)][_0x13af4d(0xf6)]+_0x7dceea);}if(_0x534129[_0x13af4d(0x172)]&&_0x534129[_0x13af4d(0x172)][_0x13af4d(0x226)]>0x0){console[_0x13af4d(0x244)]('\x20\x20'+a30_0x31827d[_0x13af4d(0x16e)](_0x13af4d(0x234))+'\x20'+_0x534129[_0x13af4d(0x172)][_0x13af4d(0x226)]+_0x13af4d(0x124)+(_0x534129[_0x13af4d(0x172)][_0x13af4d(0x226)]!==0x1?'s':''));for(const _0x5c635e of _0x534129[_0x13af4d(0x172)]){console['error']('\x20\x20\x20\x20-\x20'+_0x5c635e[_0x13af4d(0x1e5)]);}}}function showParentSegmentNotSetError(_0x457368){const _0x415d5e=a30_0x197ce3;console['error'](a30_0x31827d[_0x415d5e(0x16d)](_0x415d5e(0x208))),console[_0x415d5e(0x244)](_0x457368);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0xfe);[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0x15a);async['execute'](_0x56ad6d){const _0x50a4eb=a30_0x197ce3,{options:_0x19d654,args:_0xb22853,tdx:_0xf54003}=_0x56ad6d,_0x18770a=_0xb22853[0x0];_0x19d654[_0x50a4eb(0x22d)]&&(console[_0x50a4eb(0x244)](_0x50a4eb(0x12e)+_0x19d654[_0x50a4eb(0x147)]),_0x18770a&&console['error'](_0x50a4eb(0x242)+_0x18770a));const _0x1d3a2b=await withSpinner(_0x18770a?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x18770a+'\x27...':'Listing\x20parent\x20segments...',()=>_0xf54003[_0x50a4eb(0x156)][_0x50a4eb(0xd0)](),{'verbose':_0x19d654[_0x50a4eb(0x22d)]});let _0x4e03a3=_0x1d3a2b[_0x50a4eb(0x1e7)];if(_0x18770a){const _0x563a74=_0x18770a['replace'](/[.+^${}()|[\]\\]/g,_0x50a4eb(0x17c))[_0x50a4eb(0xe5)](/\*/g,'.*')[_0x50a4eb(0xe5)](/\?/g,'.'),_0x20874f=new RegExp('^'+_0x563a74+'$','i');_0x4e03a3=_0x4e03a3[_0x50a4eb(0xed)](_0x3180dc=>_0x20874f['test'](_0x3180dc[_0x50a4eb(0x154)]['name']));}_0x4e03a3['sort']((_0x12c148,_0x3cb8a3)=>_0x12c148['attributes'][_0x50a4eb(0x1e5)][_0x50a4eb(0x1a6)](_0x3cb8a3['attributes'][_0x50a4eb(0x1e5)])),console[_0x50a4eb(0x244)]('✔\x20Found\x20'+_0x4e03a3['length']+_0x50a4eb(0x121)+(_0x4e03a3[_0x50a4eb(0x226)]!==0x1?'s':''));const _0x195a69=_0x30e3b2=>{const _0x247642=_0x50a4eb;return getConsoleNextUrl(_0x19d654[_0x247642(0x147)],_0x247642(0x178)+_0x30e3b2);};if(_0x19d654[_0x50a4eb(0x1bc)]===_0x50a4eb(0x19b)||_0x19d654['format']===_0x50a4eb(0x130)){const _0x538231=_0x4e03a3[_0x50a4eb(0x108)](_0x111b35=>({..._0x111b35,'url':_0x195a69(_0x111b35['id'])}));await handleSDKOutput(_0x538231,_0x19d654);}else{if(_0x4e03a3[_0x50a4eb(0x226)]===0x0)_0x18770a?console[_0x50a4eb(0x14e)](_0x50a4eb(0x107)+_0x18770a):console[_0x50a4eb(0x14e)]('No\x20parent\x20segments\x20found');else for(const _0x352e05 of _0x4e03a3){const _0xa7fa5b=_0x352e05[_0x50a4eb(0x154)][_0x50a4eb(0x13d)]?a30_0x31827d['dim']('\x20('+formatRows(_0x352e05[_0x50a4eb(0x154)][_0x50a4eb(0x13d)])+')'):'',_0x1b5840=hyperlink(_0x352e05[_0x50a4eb(0x154)][_0x50a4eb(0x1e5)],_0x195a69(_0x352e05['id']));console[_0x50a4eb(0x14e)]('👥\x20'+_0x1b5840+_0xa7fa5b);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']='segment:parent:create';['description']=a30_0x197ce3(0x225);async['execute'](_0x592819){const _0x981247=a30_0x197ce3,{options:_0x1a04b6,args:_0x4cb89f,tdx:_0x4f7e9b}=_0x592819;console[_0x981247(0x244)](_0x981247(0x1af)+_0x981247(0x16b)+_0x981247(0x11b));const _0x237b9c=_0x1a04b6;if(_0x4cb89f[_0x981247(0x226)]===0x0)return console['error'](a30_0x31827d[_0x981247(0x174)](_0x981247(0xdd))),console[_0x981247(0x244)](_0x981247(0x151)),0x1;const _0x9344fc=_0x4cb89f[0x0];if(!_0x237b9c['database']||!_0x237b9c['table'])return console[_0x981247(0x244)](_0x981247(0x1e4)),console['error'](_0x981247(0x151)),0x1;_0x237b9c[_0x981247(0x22d)]&&(console[_0x981247(0x244)](_0x981247(0x12e)+_0x237b9c['site']),console[_0x981247(0x244)]('Name:\x20'+_0x9344fc),console[_0x981247(0x244)]('Database:\x20'+_0x237b9c['database']),console['error'](_0x981247(0x249)+_0x237b9c['table']));const _0x52ce2e=await loadJSONFromOptions(_0x237b9c['attributes'],_0x237b9c[_0x981247(0x106)]),_0x136d08=await loadJSONFromOptions(_0x237b9c[_0x981247(0x1c4)],_0x237b9c['behaviorsFile']),_0x370fb8=await loadJSONFromOptions(_0x237b9c[_0x981247(0x187)],_0x237b9c[_0x981247(0x204)]),_0xefb5a6={'name':_0x9344fc,'description':_0x237b9c[_0x981247(0x1a1)],'scheduleType':_0x237b9c[_0x981247(0x205)],'scheduleOption':_0x237b9c['scheduleOption'],'timezone':_0x237b9c[_0x981247(0x243)],'master':{'parentDatabaseName':_0x237b9c[_0x981247(0x1a0)],'parentTableName':_0x237b9c[_0x981247(0x20d)]},'attributes':_0x52ce2e,'behaviors':_0x136d08,'customerGroup':_0x370fb8},_0x597d49=await withSpinner(_0x981247(0x160)+_0x9344fc+_0x981247(0xd4),()=>_0x4f7e9b[_0x981247(0x156)][_0x981247(0x169)](_0xefb5a6),{'verbose':_0x1a04b6['verbose']}),_0x53c6b1=_0x597d49[_0x981247(0x1e7)];return console[_0x981247(0x244)](_0x981247(0x176)+_0x53c6b1[_0x981247(0x1e5)]+_0x981247(0x11c)+_0x53c6b1['id']),await handleSDKOutput([_0x53c6b1],_0x1a04b6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x197ce3(0x1e5)]='segment:parent:update';[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0x1c6);async[a30_0x197ce3(0x15d)](_0x3b0605){const _0x4f35dd=a30_0x197ce3,{options:_0x146acd,args:_0x18540f,tdx:_0x5962da}=_0x3b0605;console[_0x4f35dd(0x244)](_0x4f35dd(0x12b)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4f35dd(0x11b));const _0x5a705e=_0x146acd;if(_0x18540f[_0x4f35dd(0x226)]===0x0)return console['error'](a30_0x31827d[_0x4f35dd(0x174)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x4f35dd(0x244)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x50b332=_0x18540f[0x0];_0x5a705e['verbose']&&(console[_0x4f35dd(0x244)](_0x4f35dd(0x12e)+_0x5a705e[_0x4f35dd(0x147)]),console[_0x4f35dd(0x244)](_0x4f35dd(0xd2)+_0x50b332));const _0x10f8cf=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x50b332+_0x4f35dd(0xd4),()=>_0x5962da[_0x4f35dd(0x156)][_0x4f35dd(0x164)](_0x50b332),{'verbose':_0x5a705e[_0x4f35dd(0x22d)]}),_0x1556e6=_0x10f8cf['data'],_0x35dd18=await loadJSONFromOptions(_0x5a705e[_0x4f35dd(0x173)],_0x5a705e['addAttributesFile']),_0x2ef50e=await loadJSONFromOptions(_0x5a705e['addBehaviors'],_0x5a705e['addBehaviorsFile']),_0xedead2={'name':_0x1556e6[_0x4f35dd(0x1e5)],'description':_0x5a705e['description']!==undefined?_0x5a705e[_0x4f35dd(0x1a1)]:_0x1556e6[_0x4f35dd(0x1a1)],'scheduleType':_0x5a705e[_0x4f35dd(0x205)]!==undefined?_0x5a705e['scheduleType']:_0x1556e6[_0x4f35dd(0x205)],'scheduleOption':_0x5a705e[_0x4f35dd(0xef)]!==undefined?_0x5a705e[_0x4f35dd(0xef)]:_0x1556e6[_0x4f35dd(0xef)],'timezone':_0x5a705e[_0x4f35dd(0x243)]!==undefined?_0x5a705e[_0x4f35dd(0x243)]:_0x1556e6[_0x4f35dd(0x243)],'master':_0x1556e6['master'],'attributes':_0x35dd18?[..._0x1556e6[_0x4f35dd(0x154)]||[],..._0x35dd18]:_0x1556e6[_0x4f35dd(0x154)],'behaviors':_0x2ef50e?[..._0x1556e6[_0x4f35dd(0x1c4)]||[],..._0x2ef50e]:_0x1556e6[_0x4f35dd(0x1c4)],'customerGroup':_0x1556e6[_0x4f35dd(0x187)]},_0x2929cf=await withSpinner(_0x4f35dd(0x250)+_0x50b332+_0x4f35dd(0xd4),()=>_0x5962da[_0x4f35dd(0x156)][_0x4f35dd(0xfa)](_0x50b332,_0xedead2),{'verbose':_0x5a705e['verbose']}),_0x4c51f1=_0x2929cf[_0x4f35dd(0x1e7)];return console[_0x4f35dd(0x244)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x4c51f1[_0x4f35dd(0x1e5)]+'\x27'),await handleSDKOutput([_0x4c51f1],_0x5a705e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a30_0x197ce3(0x126);['description']=a30_0x197ce3(0x202);async['execute'](_0x503a71){const _0x2127d0=a30_0x197ce3,{options:_0x301618,args:_0x3c2a3f,tdx:_0x476480}=_0x503a71,_0x105600=_0x301618,_0x255c38=_0x3c2a3f[0x0]||_0x301618[_0x2127d0(0x1cc)];if(!_0x255c38)return showParentSegmentNotSetError(_0x2127d0(0x1f7)+_0x2127d0(0x129)),0x1;if(_0x105600[_0x2127d0(0x10e)]&&_0x105600['output'])return console['error'](a30_0x31827d['red'](_0x2127d0(0x200))),console[_0x2127d0(0x244)](a30_0x31827d[_0x2127d0(0x16e)](_0x2127d0(0x1f1))),console['error'](a30_0x31827d['dim'](_0x2127d0(0x246)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x2127d0(0x244)](a30_0x31827d[_0x2127d0(0x14a)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x4c37d4=_0x105600[_0x2127d0(0xc9)]||a30_0x8d852a[_0x2127d0(0x1a4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x255c38)+'.yml');_0x105600[_0x2127d0(0x22d)]&&(console[_0x2127d0(0x244)](_0x2127d0(0x12e)+_0x105600[_0x2127d0(0x147)]),console['error'](_0x2127d0(0xd2)+_0x255c38),console[_0x2127d0(0x244)](_0x2127d0(0x231)+_0x4c37d4));const _0x32e477=await withSpinner(_0x2127d0(0x217)+_0x255c38+_0x2127d0(0xd4),()=>_0x476480[_0x2127d0(0x156)][_0x2127d0(0x145)](_0x255c38),{'verbose':_0x105600[_0x2127d0(0x22d)]}),_0x5e72ed=_0x32e477[_0x2127d0(0x1e7)];if(existsSync(_0x4c37d4)){const _0x36f422=readFileSync(_0x4c37d4,_0x2127d0(0x11a)),_0x50effa=generateDiff(_0x36f422,_0x5e72ed);if(!hasChanges(_0x50effa))console['error'](a30_0x31827d['green']('✔')+_0x2127d0(0x218)+a30_0x31827d['cyan'](_0x4c37d4)+_0x2127d0(0x175));else{console[_0x2127d0(0x244)](_0x2127d0(0x1f4)+_0x4c37d4+'\x27:'),console['error']('─'[_0x2127d0(0x128)](0x3c)),console[_0x2127d0(0x244)](formatDiffWithColors(_0x50effa)),console[_0x2127d0(0x244)]('─'['repeat'](0x3c));if(!_0x105600[_0x2127d0(0x191)]){if(!isInteractive())return console['error'](a30_0x31827d[_0x2127d0(0x174)](_0x2127d0(0x183)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x2127d0(0x244)](a30_0x31827d[_0x2127d0(0x16e)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x3df0ae=await confirmKey(_0x2127d0(0x221)+_0x4c37d4+'\x27?');if(!_0x3df0ae)return console[_0x2127d0(0x244)](a30_0x31827d[_0x2127d0(0x16d)](_0x2127d0(0x105))),0x1;}writeFileSync(_0x4c37d4,_0x5e72ed,'utf-8'),console['error'](a30_0x31827d['green']('✔')+_0x2127d0(0x23b)+a30_0x31827d[_0x2127d0(0x14a)](_0x4c37d4));}}else{const _0x118121=a30_0x8d852a[_0x2127d0(0xff)](_0x4c37d4);!existsSync(_0x118121)&&mkdirSync(_0x118121,{'recursive':!![]}),writeFileSync(_0x4c37d4,_0x5e72ed,_0x2127d0(0x11a)),console[_0x2127d0(0x244)](a30_0x31827d[_0x2127d0(0x1ba)]('✔')+_0x2127d0(0x23b)+a30_0x31827d[_0x2127d0(0x14a)](_0x4c37d4));}return saveSessionContext({'parent_segment':_0x255c38},_0x105600[_0x2127d0(0x24c)]),console[_0x2127d0(0x244)](a30_0x31827d[_0x2127d0(0x1ba)]('✔')+_0x2127d0(0x20c)+a30_0x31827d[_0x2127d0(0x16e)](_0x2127d0(0x1ef))+_0x2127d0(0x219)+a30_0x31827d[_0x2127d0(0x14a)](_0x255c38)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x1b7);[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0x137);async[a30_0x197ce3(0x15d)](_0x260936){const _0x4628bc=a30_0x197ce3,{options:_0x1ac561,args:_0x805d64,tdx:_0x3e4527}=_0x260936,_0x49b647=_0x1ac561,_0x24884c=_0x805d64[0x0]||_0x1ac561[_0x4628bc(0x1cc)];if(!_0x24884c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x4628bc(0x239)),0x1;const _0x4ebcd9=resolveYamlFile(_0x24884c);if(!existsSync(_0x4ebcd9))return showFileNotFoundError(_0x4ebcd9,_0x24884c),0x1;_0x49b647['verbose']&&(console[_0x4628bc(0x244)](_0x4628bc(0x12e)+_0x49b647['site']),console[_0x4628bc(0x244)](_0x4628bc(0x1ed)+_0x4ebcd9));let _0x4887a4;try{_0x4887a4=readFileSync(_0x4ebcd9,'utf-8');}catch(_0x27376a){const _0x394e0b=_0x27376a instanceof Error?_0x27376a[_0x4628bc(0x111)]:String(_0x27376a);return console['error']('Error\x20reading\x20file:\x20'+_0x394e0b),0x1;}const _0x45637e=await withSpinner(_0x4628bc(0xe9),()=>_0x3e4527[_0x4628bc(0x156)]['pushParentYaml'](_0x4887a4),{'verbose':_0x49b647[_0x4628bc(0x22d)]}),_0xf98fb1=_0x45637e[_0x4628bc(0x1e7)],{isNew:_0x2312c4,name:_0x536ff7,hasChanges:_0x1286f1,diffFormatted:_0x159086}=_0xf98fb1;if(!_0x1286f1)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x536ff7+_0x4628bc(0x1c7)),0x0;_0x2312c4?console[_0x4628bc(0x244)](_0x4628bc(0x11d)+_0x536ff7+'\x27:'):console['error'](_0x4628bc(0x22f)+_0x536ff7+'\x27:');console[_0x4628bc(0x244)]('─'['repeat'](0x3c)),console[_0x4628bc(0x244)](_0x159086),console['error']('─'['repeat'](0x3c));const _0x58b4c1=_0x2312c4?_0x4628bc(0x163)+_0x536ff7+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x536ff7+'\x27?';if(!_0x49b647['yes']){if(!isInteractive())return console[_0x4628bc(0x244)](a30_0x31827d[_0x4628bc(0x174)]('\x0aError:'),_0x4628bc(0x1dc)),console[_0x4628bc(0x244)](a30_0x31827d[_0x4628bc(0x16e)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x15767a=await confirmKey(_0x58b4c1);if(!_0x15767a)return console['error'](a30_0x31827d[_0x4628bc(0x16d)]('Aborted.')),0x1;}const _0x1870e1=_0x2312c4?'Creating':_0x4628bc(0x248),_0x547d5e=await withSpinner(_0x1870e1+_0x4628bc(0x1ad)+_0x536ff7+_0x4628bc(0xd4),()=>_0xf98fb1['apply'](),{'verbose':_0x49b647[_0x4628bc(0x22d)]}),_0xc4a8e0=_0x547d5e[_0x4628bc(0x1e7)],_0xb6d7be=getConsoleNextUrl(_0x49b647['site'],_0x4628bc(0x178)+_0xc4a8e0['id']),_0x1ea0b3=_0x2312c4?_0x4628bc(0x1db):'Updated';return console[_0x4628bc(0x244)]('✔\x20'+_0x1ea0b3+_0x4628bc(0x1ad)+_0xc4a8e0['name']+'\x27'),console['error']('\x20\x20'+_0xb6d7be),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x167);[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0x1ea);async['execute'](_0x460b67){const _0x283a63=a30_0x197ce3,{options:_0x3825f4,args:_0x2a30ec,tdx:_0x3d3386}=_0x460b67,_0x35ec7d=_0x3825f4,_0x3d4293=_0x2a30ec[0x0]||_0x3825f4[_0x283a63(0x1cc)];if(!_0x3d4293)return showParentSegmentNotSetError(_0x283a63(0x195)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x283a63(0x1a8)+_0x283a63(0x210)+_0x283a63(0xe8)),0x1;const _0x354f06=resolveYamlFile(_0x3d4293);if(!existsSync(_0x354f06))return showFileNotFoundError(_0x354f06,_0x3d4293),0x1;_0x35ec7d[_0x283a63(0x22d)]&&(console[_0x283a63(0x244)](_0x283a63(0x12e)+_0x35ec7d['site']),console['error'](_0x283a63(0x1ed)+_0x354f06));let _0x452c10;try{_0x452c10=readFileSync(_0x354f06,'utf-8');}catch(_0x5e7b88){const _0x14b61f=_0x5e7b88 instanceof Error?_0x5e7b88[_0x283a63(0x111)]:String(_0x5e7b88);return console[_0x283a63(0x244)](_0x283a63(0x189)+_0x14b61f),0x1;}const _0x3d75a8=createCommandSpinner(a30_0x31827d[_0x283a63(0x16e)]('Validating\x20configuration...'),{'verbose':_0x35ec7d[_0x283a63(0x22d)]});_0x3d75a8[_0x283a63(0x251)]();const _0x5962bc={'onProgress':_0x32a056=>{const _0x4f3e2e=_0x283a63;_0x3d75a8[_0x4f3e2e(0xfd)]=formatProgressMessage(_0x32a056);}};if(_0x35ec7d['master'])_0x5962bc[_0x283a63(0x21f)]=!![];if(_0x35ec7d['enriched'])_0x5962bc[_0x283a63(0x241)]=!![];_0x35ec7d[_0x283a63(0x23f)]&&(_0x5962bc[_0x283a63(0x23f)]=_0x35ec7d['attribute']);_0x35ec7d['behavior']&&(_0x5962bc['behavior']=_0x35ec7d[_0x283a63(0x203)]);if(_0x35ec7d[_0x283a63(0x119)])_0x5962bc[_0x283a63(0x119)]=_0x35ec7d[_0x283a63(0x119)];let _0x19d718;try{_0x19d718=await _0x3d3386['segment'][_0x283a63(0xd9)](_0x452c10,_0x5962bc),_0x3d75a8[_0x283a63(0x19e)]();}catch(_0x4c98ca){_0x3d75a8[_0x283a63(0x19e)]();throw _0x4c98ca;}const _0x139823=_0x35ec7d[_0x283a63(0x119)]||'-1d';return this[_0x283a63(0x12f)](_0x19d718,_0x5962bc,_0x354f06,_0x139823),_0x19d718[_0x283a63(0x170)]?0x0:0x1;}[a30_0x197ce3(0x12f)](_0x328dad,_0x1c5e35,_0x53c3fc,_0x12ea6b){const _0x1da66a=a30_0x197ce3;console[_0x1da66a(0x244)]('\x0a'+a30_0x31827d[_0x1da66a(0x1f8)](_0x1da66a(0x122))+'\x20'+_0x328dad[_0x1da66a(0x1e5)]),console[_0x1da66a(0x244)]('═'[_0x1da66a(0x128)](0x3c)),this[_0x1da66a(0x201)](_0x328dad);if(typeof _0x1c5e35[_0x1da66a(0x23f)]===_0x1da66a(0x152)){this[_0x1da66a(0x22a)](_0x328dad),this[_0x1da66a(0x24a)](_0x328dad),this[_0x1da66a(0xf5)](_0x53c3fc,_0x12ea6b,'attribute',_0x1c5e35[_0x1da66a(0x23f)]);return;}if(_0x1c5e35[_0x1da66a(0x23f)]===!![]){this[_0x1da66a(0x22a)](_0x328dad),this['displaySummary'](_0x328dad),this[_0x1da66a(0xf5)](_0x53c3fc,_0x12ea6b,_0x1da66a(0x154));return;}if(typeof _0x1c5e35['behavior']===_0x1da66a(0x152)){this[_0x1da66a(0xf8)](_0x328dad,_0x12ea6b),this[_0x1da66a(0x24a)](_0x328dad),this['displayPreviewHints'](_0x53c3fc,_0x12ea6b,'behavior',_0x1c5e35[_0x1da66a(0x203)]);return;}if(_0x1c5e35['behavior']===!![]){this['displayBehaviorsStats'](_0x328dad,_0x12ea6b),this['displaySummary'](_0x328dad),this[_0x1da66a(0xf5)](_0x53c3fc,_0x12ea6b,_0x1da66a(0x1c4));return;}this['displayAttributesStats'](_0x328dad),this[_0x1da66a(0xf8)](_0x328dad,_0x12ea6b),this[_0x1da66a(0x1e2)](_0x328dad),this[_0x1da66a(0x24a)](_0x328dad),this[_0x1da66a(0xf5)](_0x53c3fc,_0x12ea6b,_0x1da66a(0x253));}['displayRealtimeInfo'](_0x49e194){displayRealtimeValidation(_0x49e194);}[a30_0x197ce3(0xf5)](_0x3ffab9,_0x22e7c8,_0x14491b,_0x5447c7){const _0x2e6a26=a30_0x197ce3;console[_0x2e6a26(0x244)]('\x0a'+a30_0x31827d['dim'](_0x2e6a26(0x216)));const _0x988f53=_0x22e7c8!==_0x2e6a26(0x14b)?'\x20--interval\x20'+_0x22e7c8:'';if(_0x14491b===_0x2e6a26(0x23f)&&_0x5447c7)console[_0x2e6a26(0x244)]('\x20\x20'+a30_0x31827d[_0x2e6a26(0x16e)](_0x2e6a26(0xf9)+_0x3ffab9+_0x2e6a26(0x13b)+_0x5447c7+'\x22'+_0x988f53));else{if(_0x14491b===_0x2e6a26(0x203)&&_0x5447c7)console[_0x2e6a26(0x244)]('\x20\x20'+a30_0x31827d['dim'](_0x2e6a26(0xf9)+_0x3ffab9+_0x2e6a26(0x1e1)+_0x5447c7+'\x22'+_0x988f53));else(_0x14491b==='attributes'||_0x14491b===_0x2e6a26(0x253))&&console[_0x2e6a26(0x244)]('\x20\x20'+a30_0x31827d['dim'](_0x2e6a26(0xf9)+_0x3ffab9+_0x2e6a26(0x23e)+_0x988f53));}(_0x14491b===_0x2e6a26(0x1c4)||_0x14491b===_0x2e6a26(0x253))&&console[_0x2e6a26(0x244)]('\x20\x20'+a30_0x31827d[_0x2e6a26(0x16e)](_0x2e6a26(0xf9)+_0x3ffab9+'\x20--behavior\x20\x22<name>\x22'+_0x988f53)),_0x14491b===_0x2e6a26(0x253)&&console[_0x2e6a26(0x244)]('\x20\x20'+a30_0x31827d['dim'](_0x2e6a26(0xf9)+_0x3ffab9+_0x2e6a26(0x197)+_0x988f53));}[a30_0x197ce3(0x201)](_0xc3298a){const _0x454673=a30_0x197ce3,{master:_0x375e3a}=_0xc3298a,_0x2399ce=_0x375e3a[_0x454673(0x1b9)]?a30_0x31827d[_0x454673(0x1ba)]('✔'):a30_0x31827d[_0x454673(0x174)]('✘');console[_0x454673(0x244)]('\x0a'+a30_0x31827d[_0x454673(0x16e)](_0x454673(0x23d))),console[_0x454673(0x244)](_0x2399ce+'\x20'+a30_0x31827d[_0x454673(0x1f8)](_0x375e3a[_0x454673(0x1a0)]+'.'+_0x375e3a[_0x454673(0x20d)])),_0x375e3a[_0x454673(0x1b9)]?_0x375e3a['rowCount']!==undefined&&console[_0x454673(0x244)]('\x20\x20'+a30_0x31827d[_0x454673(0x16e)](_0x454673(0x18a))+'\x20'+a30_0x31827d[_0x454673(0x14a)](formatRows(_0x375e3a[_0x454673(0xda)]))):console[_0x454673(0x244)]('\x20\x20'+a30_0x31827d[_0x454673(0x174)]('Error:')+'\x20'+_0x375e3a[_0x454673(0x207)]);}[a30_0x197ce3(0x22a)](_0x5a777e){const _0x5380a=a30_0x197ce3;if(_0x5a777e[_0x5380a(0x154)][_0x5380a(0x226)]===0x0)return;console[_0x5380a(0x244)]('\x0a'+a30_0x31827d[_0x5380a(0x16e)](_0x5380a(0xf3)));for(const _0x147106 of _0x5a777e[_0x5380a(0x154)]){const _0x5e1549=_0x147106[_0x5380a(0x1b9)]?a30_0x31827d[_0x5380a(0x1ba)]('✔'):a30_0x31827d['red']('✘');let _0x28f18f='';if(_0x147106[_0x5380a(0x1b9)]&&_0x147106[_0x5380a(0x140)]!==undefined&&_0x147106[_0x5380a(0x1b1)]!==undefined){const _0x547e11=_0x147106[_0x5380a(0x1b1)][_0x5380a(0x133)](0x1),_0x404641=_0x147106[_0x5380a(0x1b1)]>=0x50?a30_0x31827d['green']:_0x147106[_0x5380a(0x1b1)]>=0x32?a30_0x31827d[_0x5380a(0x16d)]:a30_0x31827d[_0x5380a(0x174)];_0x28f18f='\x20'+a30_0x31827d[_0x5380a(0x16e)](_0x5380a(0xd8))+'\x20'+_0x404641(_0x547e11+'%')+'\x20('+formatRows(_0x147106[_0x5380a(0x140)])+'\x20rows)';}console['error'](_0x5e1549+'\x20'+a30_0x31827d[_0x5380a(0x1f8)](_0x147106['name'])+_0x28f18f),console[_0x5380a(0x244)]('\x20\x20'+a30_0x31827d[_0x5380a(0x16e)]('Source:')+'\x20'+a30_0x31827d[_0x5380a(0x1f8)](_0x147106[_0x5380a(0x1a0)]+'.'+_0x147106[_0x5380a(0x20d)]));const _0x3c261d=_0x147106[_0x5380a(0x1ee)]===_0x147106[_0x5380a(0x224)]?a30_0x31827d[_0x5380a(0x16e)]('Join\x20on:')+'\x20'+_0x147106[_0x5380a(0x1ee)]:a30_0x31827d[_0x5380a(0x16e)]('Join:')+'\x20'+_0x147106[_0x5380a(0x1ee)]+_0x5380a(0x219)+_0x147106['foreignKey'];console[_0x5380a(0x244)]('\x20\x20'+_0x3c261d),console[_0x5380a(0x244)]('\x20\x20'+a30_0x31827d[_0x5380a(0x16e)]('Columns:')),this[_0x5380a(0x161)](_0x147106['columns']),!_0x147106[_0x5380a(0x1b9)]&&console[_0x5380a(0x244)]('\x20\x20'+a30_0x31827d[_0x5380a(0x174)](_0x5380a(0x237))+'\x20'+_0x147106[_0x5380a(0x207)]);}}['displayBehaviorsStats'](_0x95ba90,_0x3d8a00){const _0x4c6c05=a30_0x197ce3;if(_0x95ba90[_0x4c6c05(0x1c4)][_0x4c6c05(0x226)]===0x0)return;console['error']('\x0a'+a30_0x31827d['dim'](_0x4c6c05(0xf7))+'\x20'+a30_0x31827d['dim']('('+_0x3d8a00+')'));for(const _0x1330ad of _0x95ba90['behaviors']){const _0x4c2068=_0x1330ad[_0x4c6c05(0x1b9)]?a30_0x31827d[_0x4c6c05(0x1ba)]('✔'):a30_0x31827d[_0x4c6c05(0x174)]('✘');let _0x285909='';if(_0x1330ad[_0x4c6c05(0x1b9)]&&_0x1330ad[_0x4c6c05(0x214)]!==undefined&&_0x1330ad[_0x4c6c05(0x18b)]!==undefined){const _0xc04159=_0x1330ad['customerPercent']?.[_0x4c6c05(0x133)](0x1)||'?',_0x57af13=(_0x1330ad[_0x4c6c05(0x118)]??0x0)>=0x32?a30_0x31827d['green']:(_0x1330ad[_0x4c6c05(0x118)]??0x0)>=0x14?a30_0x31827d[_0x4c6c05(0x16d)]:a30_0x31827d[_0x4c6c05(0x174)];_0x285909='\x20'+a30_0x31827d[_0x4c6c05(0x16e)]('Customers:')+'\x20'+_0x57af13(formatRows(_0x1330ad[_0x4c6c05(0x214)]))+'\x20('+_0xc04159+_0x4c6c05(0x24b)+a30_0x31827d[_0x4c6c05(0x16e)](_0x4c6c05(0x185))+'\x20'+a30_0x31827d['cyan'](formatRows(_0x1330ad['totalEvents']));}console[_0x4c6c05(0x244)](_0x4c2068+'\x20'+a30_0x31827d[_0x4c6c05(0x1f8)](_0x1330ad[_0x4c6c05(0x1e5)])+_0x285909),console[_0x4c6c05(0x244)]('\x20\x20'+a30_0x31827d['dim'](_0x4c6c05(0x14d))+'\x20'+a30_0x31827d[_0x4c6c05(0x1f8)](_0x1330ad[_0x4c6c05(0x1a0)]+'.'+_0x1330ad[_0x4c6c05(0x20d)]));const _0x4e662c=_0x1330ad[_0x4c6c05(0x1ee)]===_0x1330ad[_0x4c6c05(0x224)]?a30_0x31827d[_0x4c6c05(0x16e)](_0x4c6c05(0xee))+'\x20'+_0x1330ad[_0x4c6c05(0x1ee)]:a30_0x31827d[_0x4c6c05(0x16e)]('Join:')+'\x20'+_0x1330ad['joinKey']+_0x4c6c05(0x219)+_0x1330ad[_0x4c6c05(0x224)];console[_0x4c6c05(0x244)]('\x20\x20'+_0x4e662c),console[_0x4c6c05(0x244)]('\x20\x20'+a30_0x31827d[_0x4c6c05(0x16e)](_0x4c6c05(0x138))),this[_0x4c6c05(0x161)](_0x1330ad[_0x4c6c05(0x1ff)]),!_0x1330ad['schemaValid']&&console['error']('\x20\x20'+a30_0x31827d['red'](_0x4c6c05(0x237))+'\x20'+_0x1330ad['schemaError']);}}['displayColumns'](_0x4da6dc){const _0x4ca8c2=a30_0x197ce3;for(const _0x139f4a of _0x4da6dc){_0x139f4a[_0x4ca8c2(0xea)]===_0x139f4a[_0x4ca8c2(0x134)]||_0x139f4a['column']==='*'?console[_0x4ca8c2(0x244)](_0x4ca8c2(0x13c)+_0x139f4a[_0x4ca8c2(0xea)]):console[_0x4ca8c2(0x244)](_0x4ca8c2(0x13c)+_0x139f4a[_0x4ca8c2(0xea)]+'\x20'+a30_0x31827d[_0x4ca8c2(0x16e)]('('+_0x139f4a[_0x4ca8c2(0x134)]+')'));}}['displaySummary'](_0x249f87){const _0x383f79=a30_0x197ce3;console['error']('─'[_0x383f79(0x128)](0x3c));if(_0x249f87[_0x383f79(0x136)][_0x383f79(0x226)]>0x0){console[_0x383f79(0x244)]('\x0a'+a30_0x31827d[_0x383f79(0x174)](_0x383f79(0x123)));for(const _0x387e4e of _0x249f87['errors']){console[_0x383f79(0x244)]('\x20\x20'+a30_0x31827d[_0x383f79(0x174)]('•')+'\x20'+_0x387e4e);}}_0x249f87[_0x383f79(0x170)]&&console[_0x383f79(0x244)]('\x0a'+a30_0x31827d[_0x383f79(0x1ba)]('✔')+_0x383f79(0x245));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x197ce3(0x1e5)]='segment:parent:preview';[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0x1a5);async[a30_0x197ce3(0x15d)](_0x2165b7){const _0x4096e2=a30_0x197ce3,{options:_0x41105e,args:_0x382cd9,tdx:_0x5481bb}=_0x2165b7,_0x10127b=_0x41105e,_0x43a7a5=_0x382cd9[0x0]||_0x41105e['parentSegment'];if(!_0x43a7a5)return showParentSegmentNotSetError(_0x4096e2(0xec)+_0x4096e2(0x1b3)+'Options\x20(one\x20required):\x0a'+_0x4096e2(0x1b2)+_0x4096e2(0x1bb)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x4096e2(0xcb)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x10127b[_0x4096e2(0x21f)]&&!_0x10127b[_0x4096e2(0x23f)]&&!_0x10127b[_0x4096e2(0x203)]&&!_0x10127b['enriched'])return console[_0x4096e2(0x244)](a30_0x31827d[_0x4096e2(0x174)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x4096e2(0x244)](_0x4096e2(0x18e)),console[_0x4096e2(0x244)](_0x4096e2(0x18d)),console[_0x4096e2(0x244)](_0x4096e2(0x16a)),console[_0x4096e2(0x244)](_0x4096e2(0x115)),console[_0x4096e2(0x244)](_0x4096e2(0x120)),console[_0x4096e2(0x244)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x1768b1=resolveYamlFile(_0x43a7a5);if(!existsSync(_0x1768b1))return showFileNotFoundError(_0x1768b1,_0x43a7a5),0x1;_0x10127b[_0x4096e2(0x22d)]&&(console[_0x4096e2(0x244)](_0x4096e2(0x12e)+_0x10127b['site']),console['error']('YAML\x20file:\x20'+_0x1768b1));let _0x4a43d6;try{_0x4a43d6=readFileSync(_0x1768b1,_0x4096e2(0x11a));}catch(_0x5226e5){const _0x5c7591=_0x5226e5 instanceof Error?_0x5226e5[_0x4096e2(0x111)]:String(_0x5226e5);return console[_0x4096e2(0x244)]('Error\x20reading\x20file:\x20'+_0x5c7591),0x1;}let _0x706636;try{_0x706636=parseDef(_0x4a43d6);}catch(_0x58eaed){const _0x5787da=_0x58eaed instanceof Error?_0x58eaed['message']:String(_0x58eaed);return console[_0x4096e2(0x244)](a30_0x31827d[_0x4096e2(0x174)](_0x4096e2(0x240)+_0x5787da)),0x1;}if(_0x10127b[_0x4096e2(0x23f)]===!![]||_0x10127b[_0x4096e2(0x23f)]===''){const _0x5c7212=_0x706636[_0x4096e2(0x154)]?.['map'](_0x3835e8=>_0x3835e8[_0x4096e2(0x1e5)])||[];if(_0x5c7212[_0x4096e2(0x226)]===0x0)console[_0x4096e2(0x244)](a30_0x31827d[_0x4096e2(0x174)](_0x4096e2(0x13f)));else{console[_0x4096e2(0x244)](a30_0x31827d[_0x4096e2(0x174)](_0x4096e2(0x1a3))),console[_0x4096e2(0x244)](_0x4096e2(0x228));for(const _0x87f0ea of _0x5c7212){console[_0x4096e2(0x244)]('\x20\x20'+a30_0x31827d[_0x4096e2(0x14a)](_0x87f0ea));}console[_0x4096e2(0x244)](_0x4096e2(0x113)+_0x43a7a5+_0x4096e2(0x13b)+_0x5c7212[0x0]+'\x22');}return 0x1;}if(_0x10127b[_0x4096e2(0x203)]===!![]||_0x10127b['behavior']===''){const _0x545a5d=_0x706636[_0x4096e2(0x1c4)]?.[_0x4096e2(0x108)](_0x4890f3=>_0x4890f3[_0x4096e2(0x1e5)])||[];if(_0x545a5d[_0x4096e2(0x226)]===0x0)console[_0x4096e2(0x244)](a30_0x31827d[_0x4096e2(0x174)](_0x4096e2(0x212)));else{console[_0x4096e2(0x244)](a30_0x31827d['red'](_0x4096e2(0x199))),console['error'](_0x4096e2(0x1c5));for(const _0x451566 of _0x545a5d){console[_0x4096e2(0x244)]('\x20\x20'+a30_0x31827d[_0x4096e2(0x14a)](_0x451566));}console[_0x4096e2(0x244)](_0x4096e2(0x113)+_0x43a7a5+'\x20--behavior\x20\x22'+_0x545a5d[0x0]+'\x22');}return 0x1;}const _0x204172=createCommandSpinner(a30_0x31827d['dim'](_0x4096e2(0x109)),{'verbose':_0x10127b[_0x4096e2(0x22d)]});_0x204172[_0x4096e2(0x251)]();const _0x3a80a3={'onProgress':_0xdd059=>{const _0x45bedb=_0x4096e2;_0x204172[_0x45bedb(0xfd)]=formatProgressMessage(_0xdd059);}};if(_0x10127b[_0x4096e2(0x21f)])_0x3a80a3[_0x4096e2(0x21f)]=!![];if(_0x10127b['attribute']&&typeof _0x10127b[_0x4096e2(0x23f)]===_0x4096e2(0x152))_0x3a80a3['attribute']=_0x10127b['attribute'];if(_0x10127b[_0x4096e2(0x203)]&&typeof _0x10127b[_0x4096e2(0x203)]===_0x4096e2(0x152))_0x3a80a3[_0x4096e2(0x203)]=_0x10127b[_0x4096e2(0x203)];if(_0x10127b[_0x4096e2(0x241)])_0x3a80a3['enriched']=!![];if(_0x10127b[_0x4096e2(0x119)])_0x3a80a3['interval']=_0x10127b[_0x4096e2(0x119)];let _0x343d9f;try{_0x343d9f=await _0x5481bb[_0x4096e2(0x156)][_0x4096e2(0x193)](_0x4a43d6,_0x3a80a3),_0x204172['stop']();}catch(_0x437d93){_0x204172[_0x4096e2(0x19e)]();throw _0x437d93;}return await this[_0x4096e2(0x102)](_0x343d9f,{'master':_0x10127b[_0x4096e2(0x21f)],'attribute':typeof _0x10127b['attribute']===_0x4096e2(0x152)?_0x10127b[_0x4096e2(0x23f)]:undefined,'behavior':typeof _0x10127b[_0x4096e2(0x203)]===_0x4096e2(0x152)?_0x10127b['behavior']:undefined,'enriched':_0x10127b[_0x4096e2(0x241)]}),_0x343d9f[_0x4096e2(0x170)]?0x0:0x1;}async[a30_0x197ce3(0x102)](_0x210e19,_0x4b4d74){const _0x318c3c=a30_0x197ce3;console['error']('\x0a'+a30_0x31827d['bold'](_0x318c3c(0x17f))+'\x20'+_0x210e19[_0x318c3c(0x1e5)]),console[_0x318c3c(0x244)]('═'[_0x318c3c(0x128)](0x3c));if(_0x4b4d74[_0x318c3c(0x21f)]&&_0x210e19[_0x318c3c(0x19a)]){const _0x43fdf7=a30_0x31827d[_0x318c3c(0x16e)](_0x318c3c(0x23a))+'\x20'+a30_0x31827d['bold'](_0x210e19[_0x318c3c(0x21f)][_0x318c3c(0x1a0)]+'.'+_0x210e19[_0x318c3c(0x21f)]['table']);await this['displaySampleData'](_0x43fdf7,_0x210e19[_0x318c3c(0x19a)]);}else{if(_0x4b4d74[_0x318c3c(0x23f)]&&_0x210e19[_0x318c3c(0x19a)]){const _0x51a0c5=a30_0x31827d[_0x318c3c(0x16e)](_0x318c3c(0x230))+'\x20'+a30_0x31827d[_0x318c3c(0x1f8)](_0x4b4d74[_0x318c3c(0x23f)]);await this['displaySampleData'](_0x51a0c5,_0x210e19['sampleData']);}else{if(_0x4b4d74[_0x318c3c(0x203)]&&_0x210e19['sampleData']){const _0x592ab2=a30_0x31827d[_0x318c3c(0x16e)](_0x318c3c(0x158))+'\x20'+a30_0x31827d[_0x318c3c(0x1f8)](_0x4b4d74['behavior']);await this['displaySampleData'](_0x592ab2,_0x210e19['sampleData']);}else{if(_0x4b4d74[_0x318c3c(0x241)]&&_0x210e19[_0x318c3c(0x19a)]){const _0x2af524=a30_0x31827d[_0x318c3c(0x16e)](_0x318c3c(0xe7))+'\x20'+a30_0x31827d[_0x318c3c(0x1f8)]('Master\x20+\x20Attributes');await this[_0x318c3c(0x1fa)](_0x2af524,_0x210e19[_0x318c3c(0x19a)]);}else!_0x210e19[_0x318c3c(0x19a)]&&console[_0x318c3c(0x244)](_0x318c3c(0x1fc));}}}if(_0x210e19['errors'][_0x318c3c(0x226)]>0x0){console[_0x318c3c(0x244)]('─'[_0x318c3c(0x128)](0x3c)),console[_0x318c3c(0x244)]('\x0a'+a30_0x31827d[_0x318c3c(0x174)]('Errors:'));for(const _0x4b09e0 of _0x210e19[_0x318c3c(0x136)]){console[_0x318c3c(0x244)]('\x20\x20'+a30_0x31827d[_0x318c3c(0x174)]('•')+'\x20'+_0x4b09e0);}}}async[a30_0x197ce3(0x1fa)](_0x4834ef,_0x5b43ce){const _0x346114=a30_0x197ce3;if(_0x5b43ce[_0x346114(0x226)]===0x0){console['error']('\x0a'+_0x4834ef),console['error']('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x346114(0x244)]('\x0a'+_0x4834ef);const _0x54fbcc=Object[_0x346114(0x162)](_0x5b43ce[0x0])[_0x346114(0x108)](_0x1bb914=>({'name':_0x1bb914,'type':typeof _0x5b43ce[0x0][_0x1bb914]===_0x346114(0x1be)?'double':_0x346114(0x20f)})),_0x353735={'queryId':_0x346114(0x14c),'columns':_0x54fbcc,'data':_0x5b43ce,'stats':{'state':_0x346114(0x17e),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5b43ce[_0x346114(0x226)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x518bc9=formatAsTable(_0x353735,_0x5b43ce['length'],!![]);await writeOutput(_0x518bc9,undefined,_0x346114(0x20d));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x222);[a30_0x197ce3(0x1a1)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0xc3a2a){const _0x381ec7=a30_0x197ce3,{options:_0x18fe3e,args:_0x13dc22,tdx:_0x21e404}=_0xc3a2a,_0x1a2dd0=_0x18fe3e,_0x599c60=_0x13dc22[0x0]||_0x18fe3e['parentSegment'];if(!_0x599c60)return showParentSegmentNotSetError(_0x381ec7(0x153)+_0x381ec7(0x116)),0x1;const _0x13ea31=resolveYamlFile(_0x599c60);if(existsSync(_0x13ea31)){_0x1a2dd0['verbose']&&console[_0x381ec7(0x244)](_0x381ec7(0x17d)+_0x13ea31);let _0x326f7d;try{_0x326f7d=readFileSync(_0x13ea31,'utf-8');}catch(_0x1e6d2d){const _0x1ccbc3=_0x1e6d2d instanceof Error?_0x1e6d2d['message']:String(_0x1e6d2d);return console[_0x381ec7(0x244)](_0x381ec7(0x189)+_0x1ccbc3),0x1;}const _0x4f6524=await withSpinner(_0x381ec7(0xe9),()=>_0x21e404['segment'][_0x381ec7(0x180)](_0x326f7d),{'verbose':_0x1a2dd0[_0x381ec7(0x22d)]}),_0x519fd2=_0x4f6524[_0x381ec7(0x1e7)],{isNew:_0x4ede09,name:_0x26d3b4,hasChanges:_0x2460a2,diffFormatted:_0x4cbdaa}=_0x519fd2;if(_0x2460a2){_0x4ede09?console[_0x381ec7(0x244)](_0x381ec7(0x11d)+_0x26d3b4+'\x27:'):console[_0x381ec7(0x244)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x26d3b4+'\x27:');console['error']('─'[_0x381ec7(0x128)](0x3c)),console[_0x381ec7(0x244)](_0x4cbdaa),console[_0x381ec7(0x244)]('─'[_0x381ec7(0x128)](0x3c));const _0xc0b9cf=_0x4ede09?_0x381ec7(0x163)+_0x26d3b4+_0x381ec7(0xf1):_0x381ec7(0x1d9)+_0x26d3b4+'\x27\x20and\x20run\x20workflow?';if(!_0x1a2dd0[_0x381ec7(0x191)]){if(!isInteractive())return console[_0x381ec7(0x244)](a30_0x31827d[_0x381ec7(0x174)](_0x381ec7(0x183)),_0x381ec7(0x1dc)),console[_0x381ec7(0x244)](a30_0x31827d[_0x381ec7(0x16e)](_0x381ec7(0x23c))),0x1;const _0x5ce9ae=await confirmKey(_0xc0b9cf);if(!_0x5ce9ae)return console['error'](a30_0x31827d[_0x381ec7(0x16d)](_0x381ec7(0x105))),0x1;}const _0x292c68=_0x4ede09?_0x381ec7(0x22e):_0x381ec7(0x248);await withSpinner(_0x292c68+_0x381ec7(0x1ad)+_0x26d3b4+'\x27...',()=>_0x519fd2[_0x381ec7(0x209)](),{'verbose':_0x1a2dd0[_0x381ec7(0x22d)]});const _0xc44565=_0x4ede09?_0x381ec7(0x1db):_0x381ec7(0x15e);console[_0x381ec7(0x244)]('✔\x20'+_0xc44565+_0x381ec7(0x1ad)+_0x26d3b4+'\x27');}else console[_0x381ec7(0x244)]('✔\x20No\x20changes\x20-\x20\x27'+_0x26d3b4+_0x381ec7(0x17a));}const _0x37fff6=await withSpinner(_0x381ec7(0x1c0)+_0x599c60+_0x381ec7(0xd4),()=>_0x21e404[_0x381ec7(0x156)][_0x381ec7(0x1d7)](_0x599c60),{'verbose':_0x1a2dd0['verbose']}),_0x19e314=_0x37fff6[_0x381ec7(0x1e7)],_0x5310da=getConsoleUrl(_0x1a2dd0[_0x381ec7(0x147)],_0x381ec7(0xd6)+_0x19e314[_0x381ec7(0x1e0)]+_0x381ec7(0x132)+_0x19e314[_0x381ec7(0x1d3)]+'/attempt/'+_0x19e314[_0x381ec7(0x182)]);return console['error'](_0x381ec7(0x12d)),console[_0x381ec7(0x244)]('\x20\x20'+a30_0x31827d['dim'](_0x381ec7(0x192))+'\x20'+_0x19e314[_0x381ec7(0x168)]),console[_0x381ec7(0x244)]('\x20\x20'+a30_0x31827d[_0x381ec7(0x16e)](_0x381ec7(0x10b))+'\x20'+_0x19e314[_0x381ec7(0x21a)]),console['error']('\x20\x20'+a30_0x31827d[_0x381ec7(0x16e)](_0x381ec7(0x1b4))+'\x20'+_0x19e314[_0x381ec7(0x1d3)]),console[_0x381ec7(0x244)]('\x20\x20'+a30_0x31827d[_0x381ec7(0x16e)](_0x381ec7(0xfc))+'\x20'+_0x19e314[_0x381ec7(0x182)]),console[_0x381ec7(0x244)]('\x20\x20'+_0x5310da),console['error']('\x0a'+a30_0x31827d['dim']('To\x20cancel:')+_0x381ec7(0x1c3)+_0x19e314[_0x381ec7(0x182)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x10a);['description']=a30_0x197ce3(0x1cd);async[a30_0x197ce3(0x15d)](_0x2a6452){const _0x289dde=a30_0x197ce3,{options:_0x3c5637,args:_0x1fa7b4,tdx:_0x2ca137}=_0x2a6452,_0x2438f0=_0x1fa7b4[0x0]||_0x3c5637['parentSegment'];if(!_0x2438f0)return showParentSegmentNotSetError(_0x289dde(0x21c)+_0x289dde(0x1d4)),0x1;_0x3c5637[_0x289dde(0x22d)]&&(console[_0x289dde(0x244)](_0x289dde(0x12e)+_0x3c5637[_0x289dde(0x147)]),console[_0x289dde(0x244)](_0x289dde(0xd2)+_0x2438f0));const _0x1238c7=await withSpinner(_0x289dde(0xe3)+_0x2438f0+_0x289dde(0xd4),()=>_0x2ca137[_0x289dde(0x156)]['listFields'](_0x2438f0),{'verbose':_0x3c5637[_0x289dde(0x22d)]}),_0x2dfce4=_0x1238c7[_0x289dde(0x1e7)];console[_0x289dde(0x244)](_0x289dde(0x112)+_0x2dfce4[_0x289dde(0x226)]+_0x289dde(0x1c2)+(_0x2dfce4[_0x289dde(0x226)]!==0x1?'s':''));if(_0x3c5637[_0x289dde(0x19b)]||_0x3c5637['jsonl'])return await handleSDKOutput(_0x2dfce4,_0x3c5637),0x0;return displayFieldsHumanReadable(_0x2dfce4,_0x2438f0),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x213);[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0x21e);async[a30_0x197ce3(0x15d)](_0x53dacb){const _0x39d5b9=a30_0x197ce3,{options:_0x57b195,args:_0x48219d,tdx:_0x1a8cd4}=_0x53dacb,_0x4a67b6=_0x57b195,_0x52ed14=_0x48219d[0x0]||_0x57b195[_0x39d5b9(0x1cc)];if(!_0x52ed14)return showParentSegmentNotSetError(_0x39d5b9(0x101)+_0x39d5b9(0xe2)+'Options:\x0a'+_0x39d5b9(0x1c1)),0x1;_0x57b195[_0x39d5b9(0x22d)]&&(console[_0x39d5b9(0x244)](_0x39d5b9(0x12e)+_0x57b195[_0x39d5b9(0x147)]),console[_0x39d5b9(0x244)](_0x39d5b9(0xd2)+_0x52ed14));const _0x1d6c2e=await withSpinner(_0x39d5b9(0x217)+_0x52ed14+_0x39d5b9(0xd4),()=>_0x1a8cd4[_0x39d5b9(0x156)][_0x39d5b9(0x164)](_0x52ed14),{'verbose':_0x57b195[_0x39d5b9(0x22d)]}),_0x24b393=_0x1d6c2e[_0x39d5b9(0x1e7)];if(_0x4a67b6['web']){const _0x364ae1=getConsoleNextUrl(_0x4a67b6[_0x39d5b9(0x147)],_0x39d5b9(0x178)+_0x24b393['id']);return console[_0x39d5b9(0x244)](a30_0x31827d['green']('✔')+_0x39d5b9(0x1da)+a30_0x31827d[_0x39d5b9(0x14a)](_0x364ae1)),openBrowser(_0x364ae1),0x0;}return await handleSingleObjectOutput(_0x24b393,_0x57b195),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x1f5);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a30_0x197ce3(0x15d)](_0x36b97f){const _0x4bf05f=a30_0x197ce3,{options:_0x494c4c,args:_0x5be2fc,tdx:_0x466860}=_0x36b97f,_0x18f79e=_0x494c4c,_0x426df7=_0x5be2fc[0x0]||_0x494c4c[_0x4bf05f(0x1cc)];if(!_0x426df7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+_0x4bf05f(0x211)+_0x4bf05f(0x1fd)+_0x4bf05f(0x215)),0x1;_0x494c4c['verbose']&&(console[_0x4bf05f(0x244)](_0x4bf05f(0x12e)+_0x494c4c['site']),console[_0x4bf05f(0x244)](_0x4bf05f(0xd2)+_0x426df7));const _0x4fd8c3=await withSpinner(_0x4bf05f(0x146)+_0x426df7+_0x4bf05f(0xd4),()=>_0x466860[_0x4bf05f(0x156)][_0x4bf05f(0x1b8)](_0x426df7),{'verbose':_0x494c4c[_0x4bf05f(0x22d)]}),_0x1d065a=_0x4fd8c3[_0x4bf05f(0x1e7)],_0x3ce372=_0x466860['segment'][_0x4bf05f(0x131)](_0x1d065a);if(_0x18f79e[_0x4bf05f(0xc9)]){const _0x5837e3=await this[_0x4bf05f(0xd5)](_0x36b97f,_0x426df7,_0x1d065a,_0x3ce372),_0x5920cb=this[_0x4bf05f(0xdf)](_0x5837e3);writeFileSync(_0x18f79e[_0x4bf05f(0xc9)],_0x5920cb);const _0x7fa39a=_0x5837e3[_0x4bf05f(0x24f)]['columns'][_0x4bf05f(0x226)]+_0x5837e3[_0x4bf05f(0x1c4)]['reduce']((_0x4f8da5,_0x4c8a63)=>_0x4f8da5+_0x4c8a63[_0x4bf05f(0x1ff)]['length'],0x0),_0x5f3e15=_0x5837e3[_0x4bf05f(0x1c4)][_0x4bf05f(0xed)](_0x276a16=>_0x276a16[_0x4bf05f(0x1ff)][_0x4bf05f(0x226)]===0x0)[_0x4bf05f(0x226)];return console['log'](_0x4bf05f(0x233)+_0x18f79e[_0x4bf05f(0xc9)]),console['log']('\x20\x20Database:\x20'+_0x3ce372),console[_0x4bf05f(0x14e)](_0x4bf05f(0x223)+_0x5837e3[_0x4bf05f(0x1c4)]['length']+_0x4bf05f(0x181)),console[_0x4bf05f(0x14e)](_0x4bf05f(0x139)+_0x7fa39a+'\x20total'),_0x5f3e15>0x0&&console['log'](_0x4bf05f(0x1c8)+_0x5f3e15+_0x4bf05f(0xdc)),0x0;}console['error']('\x0a'+a30_0x31827d['bold']('Output\x20Database:')+'\x20'+a30_0x31827d[_0x4bf05f(0x14a)](_0x3ce372));const _0x24fe5c=await withSpinner(_0x4bf05f(0xf2),()=>_0x466860[_0x4bf05f(0x156)]['getParentSQL'](_0x1d065a),{'verbose':_0x494c4c[_0x4bf05f(0x22d)]});console['error']('\x0a'+a30_0x31827d[_0x4bf05f(0x1f8)]('customers')+'\x20'+a30_0x31827d[_0x4bf05f(0x16e)]('('+_0x3ce372+'.customers)'));const _0xb14e40=await executeSchemaQuery(_0x24fe5c[_0x4bf05f(0x1e7)],_0x466860,_0x494c4c);await handleQueryOutput(_0xb14e40,_0x494c4c);const _0x11f025=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x466860[_0x4bf05f(0x156)][_0x4bf05f(0x206)](_0x1d065a),{'verbose':_0x494c4c[_0x4bf05f(0x22d)]});for(const _0x263753 of _0x11f025[_0x4bf05f(0x1e7)]){const _0x2c8da8=_0x4bf05f(0x15b)+_0x263753[_0x4bf05f(0x179)]()[_0x4bf05f(0xe5)](/\s+/g,'_'),_0x29712c=_0x4bf05f(0xf0)+_0x3ce372+'.'+_0x2c8da8;console[_0x4bf05f(0x244)]('\x0a'+a30_0x31827d['bold'](_0x263753)+'\x20'+a30_0x31827d['dim']('('+_0x3ce372+'.'+_0x2c8da8+')'));try{const _0x354ba9=await executeSchemaQuery(_0x29712c,_0x466860,_0x494c4c);await handleQueryOutput(_0x354ba9,_0x494c4c);}catch{console[_0x4bf05f(0x244)](a30_0x31827d[_0x4bf05f(0x16d)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async['collectSchema'](_0x2554c3,_0x1f3973,_0x4cdb1d,_0x1736ac){const _0x146eda=a30_0x197ce3,{options:_0x40c5ed,tdx:_0x51793a}=_0x2554c3,_0x47d8c8=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x51793a[_0x146eda(0x156)][_0x146eda(0x235)](_0x4cdb1d),{'verbose':_0x40c5ed['verbose']}),_0x829d15=await executeSchemaQuery(_0x47d8c8[_0x146eda(0x1e7)],_0x51793a,_0x40c5ed),_0x1abad9=_0x829d15[_0x146eda(0x1e7)][_0x146eda(0x108)](_0x5e18e6=>({'name':_0x5e18e6[_0x146eda(0x1d2)],'type':_0x5e18e6[_0x146eda(0x1a9)]})),_0xae4350=await withSpinner(_0x146eda(0x1bd),()=>_0x51793a[_0x146eda(0x156)][_0x146eda(0x206)](_0x4cdb1d),{'verbose':_0x40c5ed['verbose']}),_0x16c30a=[];for(const _0x538654 of _0xae4350[_0x146eda(0x1e7)]){const _0x18d50e=_0x146eda(0x15b)+_0x538654['toLowerCase']()[_0x146eda(0xe5)](/\s+/g,'_'),_0x3b207c='SELECT\x20*\x20FROM\x20'+_0x1736ac+'.'+_0x18d50e;let _0x1d2902=[];try{const _0x30fe8f=await executeSchemaQuery(_0x3b207c,_0x51793a,_0x40c5ed);_0x1d2902=_0x30fe8f[_0x146eda(0x1e7)][_0x146eda(0x108)](_0x35b6f5=>({'name':_0x35b6f5[_0x146eda(0x1d2)],'type':_0x35b6f5[_0x146eda(0x1a9)]}));}catch{}_0x16c30a['push']({'table':_0x18d50e,'columns':_0x1d2902});}return{'database':_0x1736ac,'parent_segment':_0x1f3973,'parent_id':_0x4cdb1d,'customers':{'table':_0x146eda(0x24f),'columns':_0x1abad9},'behaviors':_0x16c30a};}[a30_0x197ce3(0xdf)](_0x47b981){const _0x85b916=a30_0x197ce3,_0x59ebcd=_0x33cf64=>{const _0x1df722=a30_0x3684;if(_0x33cf64['length']===0x0)return'[]';const _0x3968e6=_0x33cf64[_0x1df722(0x108)](_0x2158c9=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x2158c9['name']+_0x1df722(0x171)+_0x2158c9[_0x1df722(0x1eb)]+'\x22\x20}');return'[\x0a'+_0x3968e6[_0x1df722(0x1a4)](',\x0a')+_0x1df722(0x22c);},_0x574f65=_0x47b981[_0x85b916(0x1c4)]['map'](_0x2adf39=>{const _0xd7439f=_0x85b916;return _0xd7439f(0x1f9)+_0x2adf39[_0xd7439f(0x20d)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x59ebcd(_0x2adf39[_0xd7439f(0x1ff)])[_0xd7439f(0xe5)](/^/gm,'\x20\x20')[_0xd7439f(0x16f)]()+_0xd7439f(0x1e8);})['join'](',\x0a');return _0x85b916(0x114)+_0x47b981[_0x85b916(0x1a0)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x47b981['parent_segment']+_0x85b916(0x165)+_0x47b981[_0x85b916(0x155)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x47b981[_0x85b916(0x24f)][_0x85b916(0x20d)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x59ebcd(_0x47b981[_0x85b916(0x24f)][_0x85b916(0x1ff)])['replace'](/^/gm,'\x20\x20')[_0x85b916(0x16f)]()+_0x85b916(0x1aa)+_0x574f65+_0x85b916(0x19c);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a30_0x197ce3(0x247);[a30_0x197ce3(0x1a1)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x197ce3(0x15d)](_0x3b21f0){const _0x2303b1=a30_0x197ce3,{options:_0x46ac18,args:_0x52373,tdx:_0x20548c}=_0x3b21f0,_0x2aa7c7=_0x52373[0x0]||_0x46ac18[_0x2303b1(0x1cc)];if(!_0x2aa7c7)return showParentSegmentNotSetError(_0x2303b1(0xca)+_0x2303b1(0x159)),0x1;_0x46ac18[_0x2303b1(0x22d)]&&(console[_0x2303b1(0x244)](_0x2303b1(0x12e)+_0x46ac18[_0x2303b1(0x147)]),console[_0x2303b1(0x244)](_0x2303b1(0xd2)+_0x2aa7c7));const _0x1b2608=await withSpinner(_0x2303b1(0x146)+_0x2aa7c7+'\x27...',()=>_0x20548c[_0x2303b1(0x156)]['resolveParentId'](_0x2aa7c7),{'verbose':_0x46ac18[_0x2303b1(0x22d)]}),_0x2591c4=_0x1b2608[_0x2303b1(0x1e7)],_0x38f66b=await withSpinner(_0x2303b1(0xe6)+_0x2aa7c7+_0x2303b1(0xd4),()=>_0x20548c['segment'][_0x2303b1(0x235)](_0x2591c4),{'verbose':_0x46ac18[_0x2303b1(0x22d)]}),_0xb0b58c=_0x38f66b[_0x2303b1(0x1e7)];return _0x46ac18[_0x2303b1(0x1bc)]==='json'||_0x46ac18[_0x2303b1(0x1bc)]===_0x2303b1(0x130)?await handleSDKOutput([{'sql':_0xb0b58c}],_0x46ac18):console[_0x2303b1(0x14e)](_0xb0b58c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a30_0x197ce3(0x17b);[a30_0x197ce3(0x1a1)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x41f28a){const _0x2a2c75=a30_0x197ce3,{options:_0x50d375,args:_0x5b5fec,tdx:_0x90267b}=_0x41f28a,_0xf92b5a=_0x5b5fec[0x0]||_0x50d375['parentSegment'];if(!_0xf92b5a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x2a2c75(0x100)),0x1;_0x50d375[_0x2a2c75(0x22d)]&&(console[_0x2a2c75(0x244)](_0x2a2c75(0x12e)+_0x50d375['site']),console[_0x2a2c75(0x244)](_0x2a2c75(0xd2)+_0xf92b5a));const _0x38ca43=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xf92b5a+_0x2a2c75(0xd4),()=>_0x90267b[_0x2a2c75(0x156)][_0x2a2c75(0x1b8)](_0xf92b5a),{'verbose':_0x50d375[_0x2a2c75(0x22d)]}),_0x2ff712=_0x38ca43[_0x2a2c75(0x1e7)],_0x18b027=await withSpinner(_0x2a2c75(0xe6)+_0xf92b5a+_0x2a2c75(0xd4),()=>_0x90267b[_0x2a2c75(0x156)]['getParentSQL'](_0x2ff712),{'verbose':_0x50d375[_0x2a2c75(0x22d)]});let _0x4557f8=_0x18b027['data'];const _0x45d434=resolveLimit(_0x50d375[_0x2a2c75(0x1d6)],DEFAULT_DISPLAY_LIMIT),_0x138e89=/\bLIMIT\s+\d+/i['test'](_0x4557f8);!_0x138e89&&(_0x4557f8=_0x4557f8[_0x2a2c75(0x16f)]()[_0x2a2c75(0xe5)](/;+$/,''),_0x4557f8=_0x2a2c75(0x15c)+_0x4557f8+_0x2a2c75(0x1ae)+_0x45d434);_0x50d375[_0x2a2c75(0x22d)]&&console['error']('SQL\x20query:\x0a'+_0x4557f8);const _0x5c3e54=await withProgressSpinner(_0x2a2c75(0x1c9),async _0x315ef1=>{const _0x508890=_0x2a2c75,_0x3aff7b=await _0x90267b[_0x508890(0x1df)][_0x508890(0x15d)](_0x4557f8,{'catalog':'td','schema':_0x508890(0xde),'onJobId':_0xc505d8=>{const _0x250b3e=_0x508890;_0x315ef1[_0x250b3e(0x1f2)](_0xc505d8);}});return _0x3aff7b;},{'verbose':_0x50d375[_0x2a2c75(0x22d)]}),_0x3ea474=_0x5c3e54['data'],_0xc90293=_0x3ea474['jobId']?_0x2a2c75(0x24e)+_0x3ea474['jobId']+']':'';return console[_0x2a2c75(0x244)](_0x2a2c75(0x110)+_0x3ea474[_0x2a2c75(0x1d0)][_0x2a2c75(0x14f)][_0x2a2c75(0x1ca)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x3ea474[_0x2a2c75(0x1d0)][_0x2a2c75(0x1b6)])+_0xc90293)),await handleQueryOutput(_0x3ea474,_0x50d375),0x0;}}export class PSRtListCommand extends BaseCommand{['name']='ps:rt:list';['description']=a30_0x197ce3(0x10d);async[a30_0x197ce3(0x15d)](_0x5393da){const _0x4c4681=a30_0x197ce3,{options:_0x217588,args:_0x200a3f,tdx:_0x40173f}=_0x5393da,_0x2a19ab=_0x200a3f[0x0],_0x3a5121=await withSpinner(_0x2a19ab?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x2a19ab+_0x4c4681(0xd4):_0x4c4681(0x127),()=>_0x40173f[_0x4c4681(0xfb)]['list'](),{'verbose':_0x217588[_0x4c4681(0x22d)]});let _0x343ad9=_0x3a5121[_0x4c4681(0x1e7)][_0x4c4681(0xed)](_0x2b4bc8=>_0x2b4bc8[_0x4c4681(0x220)]);if(_0x2a19ab){const _0x1301a4=_0x2a19ab[_0x4c4681(0xe5)](/[.+^${}()|[\]\\]/g,_0x4c4681(0x17c))[_0x4c4681(0xe5)](/\*/g,'.*')[_0x4c4681(0xe5)](/\?/g,'.'),_0x2668e1=new RegExp('^'+_0x1301a4+'$','i');_0x343ad9=_0x343ad9[_0x4c4681(0xed)](_0x29b13d=>_0x2668e1[_0x4c4681(0x125)](_0x29b13d[_0x4c4681(0x1e5)]));}_0x343ad9[_0x4c4681(0x1a2)]((_0x3e5beb,_0x105a7e)=>_0x3e5beb[_0x4c4681(0x1e5)][_0x4c4681(0x1a6)](_0x105a7e['name'])),console[_0x4c4681(0x244)](_0x4c4681(0x112)+_0x343ad9[_0x4c4681(0x226)]+_0x4c4681(0xe0)+(_0x343ad9['length']!==0x1?'s':''));const _0x38a1c7=_0x130530=>{const _0x5062fe=_0x4c4681;return getConsoleNextUrl(_0x217588[_0x5062fe(0x147)],_0x5062fe(0x178)+_0x130530);};if(_0x217588[_0x4c4681(0x1bc)]==='json'||_0x217588['format']===_0x4c4681(0x130)){const _0x49ffa3=_0x343ad9[_0x4c4681(0x108)](_0x1b5657=>({..._0x1b5657,'url':_0x38a1c7(_0x1b5657['id'])}));await handleSDKOutput(_0x49ffa3,_0x217588);}else{if(_0x343ad9['length']===0x0)console['log'](_0x4c4681(0xce));else for(const _0x4ee60f of _0x343ad9){const _0x4cde0b=_0x4ee60f[_0x4c4681(0x13d)]?a30_0x31827d[_0x4c4681(0x16e)]('\x20('+formatRows(_0x4ee60f['population'])+')'):'',_0x3a6d93=hyperlink(_0x4ee60f['name'],_0x38a1c7(_0x4ee60f['id']));console[_0x4c4681(0x14e)]('⚡\x20'+_0x3a6d93+_0x4cde0b);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x197ce3(0x1e5)]=a30_0x197ce3(0x1dd);['description']=a30_0x197ce3(0x229);async[a30_0x197ce3(0x15d)](_0x3318fa){const _0x4c3a15=a30_0x197ce3,{options:_0x5a9d6f,args:_0x5ca3b0,tdx:_0x4d1714}=_0x3318fa,_0x420d0b=_0x5ca3b0[0x0]||_0x5a9d6f[_0x4c3a15(0x1cc)];if(!_0x420d0b)return showParentSegmentNotSetError(_0x4c3a15(0x15f)+_0x4c3a15(0x188)),0x1;const _0x4d45f3=resolveYamlFile(_0x420d0b);if(!existsSync(_0x4d45f3))return showFileNotFoundError(_0x4d45f3,_0x420d0b),0x1;let _0x18a818;try{_0x18a818=readFileSync(_0x4d45f3,_0x4c3a15(0x11a));}catch(_0x54425d){const _0x2ca989=_0x54425d instanceof Error?_0x54425d[_0x4c3a15(0x111)]:String(_0x54425d);return console[_0x4c3a15(0x244)](_0x4c3a15(0x189)+_0x2ca989),0x1;}const _0x131304=createCommandSpinner(a30_0x31827d['dim'](_0x4c3a15(0x21d)),{'verbose':_0x5a9d6f[_0x4c3a15(0x22d)]});_0x131304['start']();const _0x3131ed={'realtime':!![],'onProgress':_0x2daaf9=>{const _0x2e578b=_0x4c3a15;_0x131304[_0x2e578b(0xfd)]=formatProgressMessage(_0x2daaf9);}};let _0xb16ac0;try{_0xb16ac0=await _0x4d1714[_0x4c3a15(0x156)][_0x4c3a15(0xd9)](_0x18a818,_0x3131ed),_0x131304[_0x4c3a15(0x19e)]();}catch(_0x2aa059){_0x131304[_0x4c3a15(0x19e)]();throw _0x2aa059;}console['error']('\x0a'+a30_0x31827d[_0x4c3a15(0x1f8)](_0x4c3a15(0x141))+'\x20'+_0xb16ac0[_0x4c3a15(0x1e5)]),console[_0x4c3a15(0x244)]('═'[_0x4c3a15(0x128)](0x3c)),displayRealtimeValidation(_0xb16ac0),console[_0x4c3a15(0x244)]('─'['repeat'](0x3c));if(_0xb16ac0['errors'][_0x4c3a15(0x226)]>0x0){console['error']('\x0a'+a30_0x31827d[_0x4c3a15(0x174)](_0x4c3a15(0x123)));for(const _0x57e654 of _0xb16ac0['errors']){console[_0x4c3a15(0x244)]('\x20\x20'+a30_0x31827d['red']('•')+'\x20'+_0x57e654);}}return _0xb16ac0[_0x4c3a15(0x170)]&&console['error']('\x0a'+a30_0x31827d[_0x4c3a15(0x1ba)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0xb16ac0[_0x4c3a15(0x170)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x197ce3(0x1e5)]='ps:pz:list';['description']='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a30_0x197ce3(0x15d)](_0x4d2476){const _0x2897d1=a30_0x197ce3,{options:_0x37ebe3,args:_0x2db7a2,tdx:_0x3478f4}=_0x4d2476,_0x4f08e0=_0x2db7a2[0x0]||_0x37ebe3[_0x2897d1(0x1cc)];if(!_0x4f08e0)return showParentSegmentNotSetError(_0x2897d1(0x103)+_0x2897d1(0x1b0)),0x1;const _0x4177d5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4f08e0+_0x2897d1(0xd4),()=>_0x3478f4['segment'][_0x2897d1(0x1b8)](_0x4f08e0),{'verbose':_0x37ebe3['verbose']}),_0x530303=_0x4177d5[_0x2897d1(0x1e7)],_0x299f30=await withSpinner(_0x2897d1(0x18c)+_0x4f08e0+_0x2897d1(0xd4),()=>_0x3478f4[_0x2897d1(0x1ec)]['list'](_0x530303),{'verbose':_0x37ebe3[_0x2897d1(0x22d)]}),_0x346c66=_0x299f30[_0x2897d1(0x1e7)];console[_0x2897d1(0x244)](_0x2897d1(0x112)+_0x346c66[_0x2897d1(0x226)]+'\x20personalization\x20service'+(_0x346c66[_0x2897d1(0x226)]!==0x1?'s':''));if(_0x37ebe3['format']===_0x2897d1(0x19b)||_0x37ebe3[_0x2897d1(0x1bc)]===_0x2897d1(0x130))await handleSDKOutput(_0x346c66,_0x37ebe3);else{if(_0x346c66[_0x2897d1(0x226)]===0x0)console[_0x2897d1(0x14e)](_0x2897d1(0x1d1)),console[_0x2897d1(0x244)](a30_0x31827d[_0x2897d1(0x14a)](_0x2897d1(0x166)));else for(const _0x28d150 of _0x346c66){const _0x149910=_0x28d150[_0x2897d1(0x104)]?.['length']||0x0,_0x1cfefa=_0x28d150['trigger_event']?a30_0x31827d['dim'](_0x2897d1(0x238)+_0x28d150[_0x2897d1(0xc7)]):'',_0x38cc91=a30_0x31827d[_0x2897d1(0x16e)]('\x20('+_0x149910+_0x2897d1(0x1b5)+(_0x149910!==0x1?'s':'')+')');console[_0x2897d1(0x14e)]('\x20\x20'+_0x28d150[_0x2897d1(0x1e5)]+_0x1cfefa+_0x38cc91),_0x28d150[_0x2897d1(0x1a1)]&&console[_0x2897d1(0x14e)]('\x20\x20\x20\x20'+a30_0x31827d[_0x2897d1(0x16e)](_0x28d150[_0x2897d1(0x1a1)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x197ce3(0x1e5)]='ps:pz:init';[a30_0x197ce3(0x1a1)]=a30_0x197ce3(0xeb);async[a30_0x197ce3(0x15d)](_0x194de4){const _0x19235d=a30_0x197ce3,{options:_0x31f8c2,args:_0x3c4120}=_0x194de4,_0x3bcd42=_0x3c4120[0x0]||_0x31f8c2['parentSegment'];if(!_0x3bcd42)return showParentSegmentNotSetError(_0x19235d(0x10c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x47acdf=resolveYamlFile(_0x3bcd42);if(!existsSync(_0x47acdf))return showFileNotFoundError(_0x47acdf,_0x3bcd42),0x1;let _0x555ebd;try{_0x555ebd=readFileSync(_0x47acdf,_0x19235d(0x11a));}catch(_0x2d1620){const _0xa38fd=_0x2d1620 instanceof Error?_0x2d1620[_0x19235d(0x111)]:String(_0x2d1620);return console[_0x19235d(0x244)](_0x19235d(0x189)+_0xa38fd),0x1;}let _0x5d99c6;try{_0x5d99c6=parseDef(_0x555ebd);}catch(_0x2fe93b){const _0x1d84e4=_0x2fe93b instanceof Error?_0x2fe93b[_0x19235d(0x111)]:String(_0x2fe93b);return console['error'](a30_0x31827d[_0x19235d(0x174)](_0x19235d(0x240)+_0x1d84e4)),0x1;}if(_0x5d99c6[_0x19235d(0xd3)]&&_0x5d99c6[_0x19235d(0xd3)][_0x19235d(0x226)]>0x0)return console[_0x19235d(0x244)](a30_0x31827d[_0x19235d(0x16d)](_0x19235d(0x20e)+_0x47acdf)),console[_0x19235d(0x244)](a30_0x31827d[_0x19235d(0x16e)](_0x19235d(0x186)+_0x5d99c6[_0x19235d(0xd3)][_0x19235d(0x226)]+'\x20service(s)\x20configured')),0x1;!_0x5d99c6[_0x19235d(0xfb)]&&(_0x5d99c6['realtime']={'events':[{'name':'page_view','source_table':_0x19235d(0x1a7)}],'attributes':[{'name':_0x19235d(0xd1),'type':'single'}],'id_stitching':{'primary_key':_0x5d99c6['master']['table']===_0x19235d(0x24f)?_0x19235d(0x16c):_0x19235d(0x19f)}});_0x5d99c6['personalization_services']=[{'name':_0x19235d(0x12a),'description':'Personalization\x20service\x20description','trigger_event':_0x19235d(0x227),'sections':[{'name':'Default','criteria':_0x19235d(0x1ab),'attributes':['last_page_viewed']}]}];const _0xdef84f=serializeDef(_0x5d99c6);return writeFileSync(_0x47acdf,_0xdef84f,_0x19235d(0x11a)),console[_0x19235d(0x244)](a30_0x31827d[_0x19235d(0x1ba)]('✔')+_0x19235d(0x1e3)+a30_0x31827d[_0x19235d(0x14a)](_0x47acdf)),(!_0x5d99c6['realtime']||_0x555ebd[_0x19235d(0x11f)](_0x19235d(0xd7))===-0x1)&&console[_0x19235d(0x244)](a30_0x31827d[_0x19235d(0x1ba)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console[_0x19235d(0x244)]('\x0a'+a30_0x31827d[_0x19235d(0x16e)](_0x19235d(0x198))),console[_0x19235d(0x244)](_0x19235d(0xcf)+_0x47acdf+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x19235d(0x244)](_0x19235d(0xe4)+a30_0x31827d['dim'](_0x19235d(0x1cf)+_0x3bcd42)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
@@ -1 +1 @@
1
- const a31_0x5308d9=a31_0x218f;(function(_0x18d3ee,_0x18d24c){const _0x156e54=a31_0x218f,_0x1d8782=_0x18d3ee();while(!![]){try{const _0x11d51d=-parseInt(_0x156e54(0xe8))/0x1*(parseInt(_0x156e54(0xec))/0x2)+parseInt(_0x156e54(0xf1))/0x3+-parseInt(_0x156e54(0xc7))/0x4*(-parseInt(_0x156e54(0xcc))/0x5)+parseInt(_0x156e54(0x89))/0x6+parseInt(_0x156e54(0x94))/0x7*(-parseInt(_0x156e54(0xef))/0x8)+-parseInt(_0x156e54(0x7f))/0x9+parseInt(_0x156e54(0xe2))/0xa*(parseInt(_0x156e54(0x91))/0xb);if(_0x11d51d===_0x18d24c)break;else _0x1d8782['push'](_0x1d8782['shift']());}catch(_0x1ef393){_0x1d8782['push'](_0x1d8782['shift']());}}}(a31_0x1c2e,0x77f6a));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x1c6f0d from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a31_0x1c2e(){const _0x411e13=['\x27\x20created','Profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x27\x20requires\x20API\x20key\x20validation.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','create','profile:remove','/app/mp/ak','\x20API\x20key\x20saved\x20to\x20system\x20keychain','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:set','session','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20remove','password','Setup\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20(no\x20profiles\x20found)','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Default\x20profile\x20set\x20to:\x20','validate','red','log','join','ERROR','\x0aSetup\x20cancelled','logLevel','jobs','\x20API\x20key\x20removed\x20from\x20system\x20keychain','llm_project','tdx.json','OAuth\x20(browser\x20login)','tdx:\x20profile\x20create','\x27\x20does\x20not\x20exist.','\x20API\x20key\x20is\x20valid\x20(User:\x20','split','includes','message','length','execute','Session\x20profile\x20set\x20to:\x20','getUserInfo','name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','API\x20Key','error','Operation\x20cancelled','\x27\x20does\x20not\x20exist.\x20Create\x20it?','3700yEDiim','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','You\x20can\x20find\x20your\x20API\x20key\x20at:','llm_agent','profileName','4495sGvepq','Enter\x20description\x20(optional):','profile','API\x20key\x20cannot\x20be\x20empty','Choose\x20authentication\x20method:','VALID_KEYS','Unknown\x20key\x20\x27','yellow','parent_segment','Failed\x20to\x20remove\x20profile:\x20','Remove\x20a\x20profile','apiKey','Validating\x20API\x20key...','confirm','\x27\x20updated:\x20','select','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','text','warn','site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','test','410hFkYUJ','trim','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Set\x20a\x20profile\x20configuration\x20value','122pvxCsl','green','method','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','10592VYZXLD','Enter\x20profile\x20name:','Set\x20session\x20profile','24otNPhE','Profile\x20name\x20cannot\x20be\x20empty','33183cBhgFt','\x27.\x0a\x0aValid\x20keys:\x20','default','8621829VtErGb','Site\x20was\x20not\x20changed.','✗\x20Validation\x20failed:\x20','description','profile:create','bold','profile:use','Removal\x20cancelled','oauth','email','764616XKmuHT','\x0aAvailable\x20profiles:','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','apikey','\x0aOperation\x20cancelled','dim','\x20\x20-\x20','config','350515lkyTyL','Enter\x20your\x20TD\x20API\x20key:','\x20Profile\x20\x27','422506HyJtCb'];a31_0x1c2e=function(){return _0x411e13;};return a31_0x1c2e();}import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x1dea08 from'prompts';import a31_0x5021cd from'chalk';function validateProfileName(_0x217988){const _0x2be375=a31_0x218f;if(!_0x217988||!_0x217988[_0x2be375(0xe3)]())return _0x2be375(0xf0);const _0x3ad839=_0x217988['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x2be375(0xe1)](_0x3ad839))return _0x2be375(0xeb);if(profileExists(_0x3ad839))return _0x2be375(0x96)+_0x3ad839+_0x2be375(0xe4);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a31_0x5308d9(0x83);[a31_0x5308d9(0x82)]='Create\x20a\x20new\x20profile';async[a31_0x5308d9(0xbe)](_0x11945b){const _0x18520f=a31_0x5308d9,{options:_0x42811a,args:_0x22e8fe}=_0x11945b;console[_0x18520f(0xad)](a31_0x5021cd['bold'](_0x18520f(0xb7)));let _0x36da8c;if(_0x22e8fe['length']>0x0&&_0x22e8fe[0x0]){const _0x21e37b=_0x22e8fe[0x0][_0x18520f(0xe3)](),_0x363794=validateProfileName(_0x21e37b);if(_0x363794!==!![])return console[_0x18520f(0xc4)](a31_0x5021cd[_0x18520f(0xac)](_0x363794)),0x1;_0x36da8c=_0x21e37b;}else{const _0xa80655=await a31_0x1dea08({'type':_0x18520f(0xdd),'name':'profileName','message':_0x18520f(0xed),'validate':validateProfileName});if(!_0xa80655['profileName'])return console[_0x18520f(0xad)](_0x18520f(0xb0)),0x1;_0x36da8c=_0xa80655[_0x18520f(0xcb)][_0x18520f(0xe3)]();}const _0x266371=await a31_0x1dea08({'type':_0x18520f(0xdd),'name':'description','message':_0x18520f(0xcd)}),_0xd99d00=_0x266371[_0x18520f(0x82)]?.[_0x18520f(0xe3)]()||undefined,_0x5278fc=_0x42811a[_0x18520f(0xdf)]||'us01',_0x21f522=await promptSiteSelection(_0x5278fc,_0x36da8c,_0x18520f(0xa5));if(!_0x21f522)return 0x1;const _0x5850f8=resolveSite(_0x21f522);if(isOAuthSupported(_0x5850f8)){const _0xcaf03f=await a31_0x1dea08({'type':_0x18520f(0xdb),'name':_0x18520f(0xea),'message':_0x18520f(0xd0),'choices':[{'title':_0x18520f(0xb6),'value':_0x18520f(0x87)},{'title':_0x18520f(0xc3),'value':_0x18520f(0x8c)}]});if(!_0xcaf03f[_0x18520f(0xea)])return console['log'](_0x18520f(0xb0)),0x1;if(_0xcaf03f[_0x18520f(0xea)]==='oauth'){if(_0xd99d00){const _0x5b56bf={'site':_0x5850f8,'description':_0xd99d00};saveProfileToUserConfig(_0x36da8c,_0x5b56bf);}return await runOAuthLoginFlow(_0x5850f8,_0x36da8c,_0x42811a['logLevel']??LogLevel[_0x18520f(0xaf)]),0x0;}}console[_0x18520f(0xad)](_0x18520f(0xdc)+_0x5850f8),console[_0x18520f(0xad)](_0x18520f(0xc9)),console[_0x18520f(0xad)]('\x20\x20'+getConsoleUrl(_0x5850f8,_0x18520f(0x9c)));const _0x1a42d6=await a31_0x1dea08({'type':_0x18520f(0xa4),'name':_0x18520f(0xd7),'message':_0x18520f(0x92),'validate':_0x3fdab9=>{const _0x2bc954=_0x18520f;if(!_0x3fdab9||!_0x3fdab9[_0x2bc954(0xe3)]())return _0x2bc954(0xcf);return!![];}});if(!_0x1a42d6[_0x18520f(0xd7)])return console['log'](_0x18520f(0xb0)),0x1;const _0x3a4785=_0x1a42d6[_0x18520f(0xd7)];console[_0x18520f(0xad)](_0x18520f(0xd8));try{const _0x5ceae8=TDX['create']({'site':_0x5850f8,'apiKey':_0x3a4785[_0x18520f(0xe3)](),'logLevel':_0x42811a[_0x18520f(0xb1)]??LogLevel[_0x18520f(0xaf)]}),_0x325358=await _0x5ceae8[_0x18520f(0xb2)]['getUserInfo']();console[_0x18520f(0xad)](a31_0x5021cd['green']('✓')+_0x18520f(0xb9)+_0x325358[_0x18520f(0x88)]+')');const _0x1aeffe=await isKeychainAvailable();_0x1aeffe?(await saveAPIKeyAsync(_0x3a4785[_0x18520f(0xe3)](),_0x5850f8,_0x36da8c),console['log'](a31_0x5021cd[_0x18520f(0xe9)]('✓')+_0x18520f(0xa1)+_0x36da8c+')')):(console['warn'](a31_0x5021cd['yellow'](_0x18520f(0xa7))),console['warn'](a31_0x5021cd[_0x18520f(0xd3)](_0x18520f(0xe0))));const _0x2b29a3={'site':_0x5850f8,..._0xd99d00&&{'description':_0xd99d00}};return saveProfileToUserConfig(_0x36da8c,_0x2b29a3),console[_0x18520f(0xad)](a31_0x5021cd[_0x18520f(0xe9)]('✓')+_0x18520f(0x93)+_0x36da8c+_0x18520f(0x95)),console[_0x18520f(0xad)](),console[_0x18520f(0xad)](_0x18520f(0x9e)),console['log'](_0x18520f(0x97)+_0x36da8c+_0x18520f(0xe6)),console[_0x18520f(0xad)]('\x20\x20tdx\x20--profile\x20'+_0x36da8c+_0x18520f(0xc2)),0x0;}catch(_0x4fb05d){if(_0x4fb05d instanceof HTTPClientError&&_0x4fb05d['status']===0x191)return printAuthError(_0x4fb05d),0x1;return console['error'](a31_0x5021cd[_0x18520f(0xac)](_0x18520f(0x81)+(_0x4fb05d instanceof Error?_0x4fb05d['message']:String(_0x4fb05d)))),console[_0x18520f(0xc4)](_0x18520f(0xa9)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x5308d9(0xc1)]=a31_0x5308d9(0x9b);[a31_0x5308d9(0x82)]=a31_0x5308d9(0xd6);[a31_0x5308d9(0xab)](_0x3f2daa){const _0x5bf14b=a31_0x5308d9,{args:_0x4df116}=_0x3f2daa;if(_0x4df116['length']===0x0)return _0x5bf14b(0xe5);return undefined;}async[a31_0x5308d9(0xbe)](_0x36df09){const _0x129418=a31_0x5308d9,{args:_0x415c93}=_0x36df09,_0xbca90=_0x415c93[0x0];console['log'](a31_0x5021cd[_0x129418(0x84)](_0x129418(0xa3)));if(!profileExists(_0xbca90)){console[_0x129418(0xc4)](a31_0x5021cd[_0x129418(0xac)](_0x129418(0x96)+_0xbca90+'\x27\x20does\x20not\x20exist.')),console[_0x129418(0xad)](_0x129418(0x8a));const _0x179f96=listProfiles();if(_0x179f96[_0x129418(0xbd)]===0x0)console[_0x129418(0xad)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x39ca04 of _0x179f96){console[_0x129418(0xad)](_0x129418(0x8f)+_0x39ca04[_0x129418(0xc1)]);}return 0x1;}const _0x1b9354=await a31_0x1dea08({'type':_0x129418(0xd9),'name':_0x129418(0xd9),'message':_0x129418(0x8b)+_0xbca90+'\x27?','initial':![]});if(!_0x1b9354[_0x129418(0xd9)])return console['log'](_0x129418(0x86)),0x0;try{removeProfileFromUserConfig(_0xbca90),console['log'](a31_0x5021cd[_0x129418(0xe9)]('✓')+_0x129418(0x93)+_0xbca90+_0x129418(0xa2));}catch(_0x114ffe){return console[_0x129418(0xc4)](a31_0x5021cd[_0x129418(0xac)](_0x129418(0xd5)+(_0x114ffe instanceof Error?_0x114ffe[_0x129418(0xbc)]:String(_0x114ffe)))),0x1;}const _0x300132=await isKeychainAvailable();if(_0x300132){const _0xab7aaf=await deleteKeychainAPIKey(_0xbca90);_0xab7aaf&&console['log'](a31_0x5021cd[_0x129418(0xe9)]('✓')+_0x129418(0xb3));}return 0x0;}}function a31_0x218f(_0x4a12b1,_0x1ac7e1){_0x4a12b1=_0x4a12b1-0x7f;const _0x1c2e1a=a31_0x1c2e();let _0x218f72=_0x1c2e1a[_0x4a12b1];return _0x218f72;}export class ProfileSetCommand extends BaseCommand{[a31_0x5308d9(0xc1)]=a31_0x5308d9(0x9f);[a31_0x5308d9(0x82)]=a31_0x5308d9(0xe7);static [a31_0x5308d9(0xd1)]=[a31_0x5308d9(0xdf),'database',a31_0x5308d9(0xd4),a31_0x5308d9(0xb4),a31_0x5308d9(0xca),a31_0x5308d9(0x82)];[a31_0x5308d9(0xab)](_0x48c5c8){const _0x56f51e=a31_0x5308d9,{args:_0x2fe7f3,options:_0x520ce6}=_0x48c5c8,_0x491163=_0x520ce6[_0x56f51e(0xce)]||getActiveProfile();if(!_0x491163)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2fe7f3[_0x56f51e(0xbd)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x56f51e(0xd1)][_0x56f51e(0xae)](',\x20');const _0x29fc6e=_0x2fe7f3[0x0];if(!_0x29fc6e[_0x56f51e(0xbb)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x56f51e(0xd1)][_0x56f51e(0xae)](',\x20');const [_0x247c38]=_0x29fc6e[_0x56f51e(0xba)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x56f51e(0xbb)](_0x247c38))return _0x56f51e(0xd2)+_0x247c38+_0x56f51e(0xf2)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a31_0x5308d9(0xbe)](_0x2ef26f){const _0x459581=a31_0x5308d9,{args:_0x40e902,options:_0xd52e6c}=_0x2ef26f,_0x466184=_0xd52e6c[_0x459581(0xce)]||getActiveProfile(),[_0x450c8f,..._0x166313]=_0x40e902[0x0][_0x459581(0xba)]('='),_0x49084b=_0x166313['join']('=');console[_0x459581(0xad)](a31_0x5021cd['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x466184)){const _0x584d8f=await a31_0x1dea08({'type':_0x459581(0xd9),'name':_0x459581(0x9a),'message':_0x459581(0x96)+_0x466184+_0x459581(0xc6),'initial':!![]});if(!_0x584d8f[_0x459581(0x9a)])return console[_0x459581(0xad)](_0x459581(0xc5)),0x1;}const _0x29bf5c=loadProfile(_0x466184),_0x181bba=_0x29bf5c?.[_0x459581(0x90)]||{};if(_0x450c8f===_0x459581(0xdf)){const _0x585a00=resolveSite(_0x49084b);console[_0x459581(0xad)]('Changing\x20site\x20to\x20\x27'+_0x585a00+_0x459581(0x98)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x459581(0xad)]('\x20\x20'+getConsoleUrl(_0x585a00,_0x459581(0x9c)));const _0x452fcd=await a31_0x1dea08({'type':_0x459581(0xa4),'name':_0x459581(0xd7),'message':_0x459581(0xc8),'validate':_0x2c7a04=>{const _0x432b41=_0x459581;if(!_0x2c7a04||!_0x2c7a04[_0x432b41(0xe3)]())return _0x432b41(0xcf);return!![];}});if(!_0x452fcd[_0x459581(0xd7)])return console[_0x459581(0xad)](_0x459581(0x8d)),0x1;console['log'](_0x459581(0xd8));try{const _0x209d03=TDX[_0x459581(0x9a)]({'site':_0x585a00,'apiKey':_0x452fcd[_0x459581(0xd7)][_0x459581(0xe3)](),'logLevel':_0xd52e6c[_0x459581(0xb1)]??LogLevel[_0x459581(0xaf)]}),_0x7d6ac1=await _0x209d03[_0x459581(0xb2)][_0x459581(0xc0)]();console[_0x459581(0xad)](a31_0x5021cd[_0x459581(0xe9)]('✓')+_0x459581(0xb9)+_0x7d6ac1[_0x459581(0x88)]+')');const _0x3e406c=await isKeychainAvailable();_0x3e406c?(await saveAPIKeyAsync(_0x452fcd['apiKey'][_0x459581(0xe3)](),_0x585a00,_0x466184),console[_0x459581(0xad)](a31_0x5021cd[_0x459581(0xe9)]('✓')+_0x459581(0x9d))):console[_0x459581(0xde)](a31_0x5021cd[_0x459581(0xd3)](_0x459581(0xa7))),_0x181bba[_0x459581(0xdf)]=_0x585a00;}catch(_0x5a86a0){if(_0x5a86a0 instanceof HTTPClientError&&_0x5a86a0['status']===0x191)return printAuthError(_0x5a86a0),0x1;return console['error'](a31_0x5021cd['red'](_0x459581(0x81)+(_0x5a86a0 instanceof Error?_0x5a86a0[_0x459581(0xbc)]:String(_0x5a86a0)))),console['error'](_0x459581(0x80)),0x1;}}else _0x181bba[_0x450c8f]=_0x49084b||undefined;return saveProfileToUserConfig(_0x466184,_0x181bba),console[_0x459581(0xad)](a31_0x5021cd[_0x459581(0xe9)]('✓')+_0x459581(0x93)+_0x466184+_0x459581(0xda)+_0x450c8f+'='+(_0x49084b||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x5308d9(0xc1)]=a31_0x5308d9(0x85);[a31_0x5308d9(0x82)]=a31_0x5308d9(0xee);['validate'](_0x9e11d8){const {args:_0x5ab2d2}=_0x9e11d8;if(_0x5ab2d2['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a31_0x5308d9(0xbe)](_0x4a3186){const _0xe5446e=a31_0x5308d9,{args:_0xa99820,options:_0x213a8c}=_0x4a3186,_0x2f03b7=_0xa99820[0x0],_0x5a279e=_0x213a8c[_0xe5446e(0xf3)];cleanExpiredSessions();if(!profileExists(_0x2f03b7)){console[_0xe5446e(0xc4)](a31_0x5021cd[_0xe5446e(0xac)]('Profile\x20\x27'+_0x2f03b7+_0xe5446e(0xb8))),console[_0xe5446e(0xad)](_0xe5446e(0x8a));const _0x201f55=listProfiles();if(_0x201f55[_0xe5446e(0xbd)]===0x0)console[_0xe5446e(0xad)](_0xe5446e(0xa8));else for(const _0x3a1cfd of _0x201f55){console[_0xe5446e(0xad)](_0xe5446e(0x8f)+_0x3a1cfd['name']);}return 0x1;}if(_0x5a279e){const _0x5716a5=a31_0x1c6f0d[_0xe5446e(0xae)](getConfigDir(),_0xe5446e(0xb5));return saveActiveProfileToUserConfig(_0x2f03b7),console['log'](_0xe5446e(0xaa)+a31_0x5021cd['green'](_0x2f03b7)),console[_0xe5446e(0xad)](a31_0x5021cd[_0xe5446e(0x8e)]('\x0aSaved\x20to:\x20'+_0x5716a5)),0x0;}const _0x334d7a=getSessionID(_0x213a8c[_0xe5446e(0xa0)]);return saveSessionContext({'profile':_0x2f03b7},_0x213a8c[_0xe5446e(0xa0)]),console[_0xe5446e(0xad)](_0xe5446e(0xbf)+a31_0x5021cd[_0xe5446e(0xe9)](_0x2f03b7)+'\x20'+a31_0x5021cd[_0xe5446e(0x8e)]('(session:\x20'+_0x334d7a+')')),console[_0xe5446e(0xad)](a31_0x5021cd[_0xe5446e(0x8e)](_0xe5446e(0x99)+_0x2f03b7+_0xe5446e(0xa6))),0x0;}}
1
+ function a31_0x16d2(){const _0x165e61=['\x27\x20does\x20not\x20exist.','execute','message','95807AbJNOB','\x27.\x0a\x0aValid\x20keys:\x20','logLevel','\x20API\x20key\x20removed\x20from\x20system\x20keychain','validate','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Profile\x20name\x20cannot\x20be\x20empty','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','6148698sEeDLV','Unknown\x20key\x20\x27','llm_project','green','Set\x20session\x20profile','Choose\x20authentication\x20method:','\x0aAvailable\x20profiles:','3407994uCGMkC','Session\x20profile\x20set\x20to:\x20','jobs','tdx:\x20profile\x20remove','parent_segment','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x20API\x20key\x20is\x20valid\x20(User:\x20','length','split','confirm','6911380tfDGOF','default','Create\x20a\x20new\x20profile','14yPCvoZ','method','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20--default\x27\x20to\x20save\x20permanently','us01','error','profileName','database','Site\x20was\x20not\x20changed.','\x20Profile\x20\x27','Set\x20a\x20profile\x20configuration\x20value','\x27\x20does\x20not\x20exist.\x20Create\x20it?','41225965rGnrcq','Removal\x20cancelled','\x0aSaved\x20to:\x20','\x27\x20removed\x20from\x20configuration','Failed\x20to\x20remove\x20profile:\x20','5ltosRX','select','name','\x20\x20(no\x20profiles\x20found)','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','12fdPPIb','ERROR','password','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','description','profile','email','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','(cleared)','site','\x0aOperation\x20cancelled','apikey','✗\x20Validation\x20failed:\x20','API\x20key\x20cannot\x20be\x20empty','join','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Enter\x20description\x20(optional):','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Changing\x20site\x20to\x20\x27','API\x20Key','apiKey','3980132dlgkTy','oauth','yellow','Validating\x20API\x20key...','trim','config','Profile\x20\x27','getUserInfo','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','status','5789dmSdHI','includes','warn','\x20\x20tdx\x20--profile\x20','\x20\x20-\x20','profile:use','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','You\x20can\x20find\x20your\x20API\x20key\x20at:','log','dim','llm_agent','8128CdJMgx','3HETycb','session','bold','tdx:\x20profile\x20create','text','VALID_KEYS','tdx:\x20profile\x20set','OAuth\x20(browser\x20login)','test','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:create'];a31_0x16d2=function(){return _0x165e61;};return a31_0x16d2();}const a31_0x5b84e8=a31_0x2955;(function(_0x152fa3,_0x10bcc0){const _0x15c4c6=a31_0x2955,_0x138201=_0x152fa3();while(!![]){try{const _0x520a80=-parseInt(_0x15c4c6(0x16a))/0x1*(parseInt(_0x15c4c6(0x186))/0x2)+parseInt(_0x15c4c6(0x1c9))/0x3*(-parseInt(_0x15c4c6(0x1b2))/0x4)+parseInt(_0x15c4c6(0x197))/0x5*(-parseInt(_0x15c4c6(0x172))/0x6)+parseInt(_0x15c4c6(0x1bd))/0x7*(-parseInt(_0x15c4c6(0x1c8))/0x8)+-parseInt(_0x15c4c6(0x179))/0x9+parseInt(_0x15c4c6(0x183))/0xa+-parseInt(_0x15c4c6(0x192))/0xb*(-parseInt(_0x15c4c6(0x19c))/0xc);if(_0x520a80===_0x10bcc0)break;else _0x138201['push'](_0x138201['shift']());}catch(_0x27f3c2){_0x138201['push'](_0x138201['shift']());}}}(a31_0x16d2,0x814b6));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x5b0987 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x5c684a from'prompts';import a31_0x4e1e5d from'chalk';function validateProfileName(_0x4a2239){const _0x10b991=a31_0x2955;if(!_0x4a2239||!_0x4a2239[_0x10b991(0x1b6)]())return _0x10b991(0x170);const _0x14ed07=_0x4a2239[_0x10b991(0x1b6)]();if(!/^[a-zA-Z0-9_-]+$/[_0x10b991(0x1d1)](_0x14ed07))return _0x10b991(0x1d2);if(profileExists(_0x14ed07))return _0x10b991(0x1b8)+_0x14ed07+_0x10b991(0x17e);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a31_0x5b84e8(0x1d3);[a31_0x5b84e8(0x1a0)]=a31_0x5b84e8(0x185);async[a31_0x5b84e8(0x168)](_0x151aec){const _0x321315=a31_0x5b84e8,{options:_0xe2e6c,args:_0x3a4d63}=_0x151aec;console[_0x321315(0x1c5)](a31_0x4e1e5d[_0x321315(0x1cb)](_0x321315(0x1cc)));let _0x1d5a7b;if(_0x3a4d63[_0x321315(0x180)]>0x0&&_0x3a4d63[0x0]){const _0xf5abe9=_0x3a4d63[0x0]['trim'](),_0x8fdb4=validateProfileName(_0xf5abe9);if(_0x8fdb4!==!![])return console[_0x321315(0x18b)](a31_0x4e1e5d[_0x321315(0x1bb)](_0x8fdb4)),0x1;_0x1d5a7b=_0xf5abe9;}else{const _0x1c9c2e=await a31_0x5c684a({'type':_0x321315(0x1cd),'name':'profileName','message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x1c9c2e['profileName'])return console[_0x321315(0x1c5)]('\x0aSetup\x20cancelled'),0x1;_0x1d5a7b=_0x1c9c2e[_0x321315(0x18c)]['trim']();}const _0x2606d9=await a31_0x5c684a({'type':_0x321315(0x1cd),'name':_0x321315(0x1a0),'message':_0x321315(0x1ad)}),_0x1868c8=_0x2606d9[_0x321315(0x1a0)]?.[_0x321315(0x1b6)]()||undefined,_0x5c59f3=_0xe2e6c[_0x321315(0x1a5)]||_0x321315(0x18a),_0x75367f=await promptSiteSelection(_0x5c59f3,_0x1d5a7b,'Setup\x20cancelled');if(!_0x75367f)return 0x1;const _0x551207=resolveSite(_0x75367f);if(isOAuthSupported(_0x551207)){const _0x484173=await a31_0x5c684a({'type':_0x321315(0x198),'name':_0x321315(0x187),'message':_0x321315(0x177),'choices':[{'title':_0x321315(0x1d0),'value':_0x321315(0x1b3)},{'title':_0x321315(0x1b0),'value':_0x321315(0x1a7)}]});if(!_0x484173[_0x321315(0x187)])return console[_0x321315(0x1c5)]('\x0aSetup\x20cancelled'),0x1;if(_0x484173['method']===_0x321315(0x1b3)){if(_0x1868c8){const _0x393833={'site':_0x551207,'description':_0x1868c8};saveProfileToUserConfig(_0x1d5a7b,_0x393833);}return await runOAuthLoginFlow(_0x551207,_0x1d5a7b,_0xe2e6c['logLevel']??LogLevel[_0x321315(0x19d)]),0x0;}}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x551207),console[_0x321315(0x1c5)](_0x321315(0x1c4)),console[_0x321315(0x1c5)]('\x20\x20'+getConsoleUrl(_0x551207,'/app/mp/ak'));const _0x8137f8=await a31_0x5c684a({'type':_0x321315(0x19e),'name':_0x321315(0x1b1),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5894b3=>{const _0x304233=_0x321315;if(!_0x5894b3||!_0x5894b3[_0x304233(0x1b6)]())return _0x304233(0x1a9);return!![];}});if(!_0x8137f8[_0x321315(0x1b1)])return console[_0x321315(0x1c5)]('\x0aSetup\x20cancelled'),0x1;const _0x93724b=_0x8137f8[_0x321315(0x1b1)];console[_0x321315(0x1c5)]('Validating\x20API\x20key...');try{const _0x37e930=TDX['create']({'site':_0x551207,'apiKey':_0x93724b[_0x321315(0x1b6)](),'logLevel':_0xe2e6c[_0x321315(0x16c)]??LogLevel[_0x321315(0x19d)]}),_0x5e1025=await _0x37e930[_0x321315(0x17b)]['getUserInfo']();console['log'](a31_0x4e1e5d['green']('✓')+_0x321315(0x17f)+_0x5e1025['email']+')');const _0x11ffb5=await isKeychainAvailable();_0x11ffb5?(await saveAPIKeyAsync(_0x93724b[_0x321315(0x1b6)](),_0x551207,_0x1d5a7b),console[_0x321315(0x1c5)](a31_0x4e1e5d[_0x321315(0x175)]('✓')+_0x321315(0x19b)+_0x1d5a7b+')')):(console[_0x321315(0x1bf)](a31_0x4e1e5d['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a31_0x4e1e5d['yellow'](_0x321315(0x1c3))));const _0x2db671={'site':_0x551207,..._0x1868c8&&{'description':_0x1868c8}};return saveProfileToUserConfig(_0x1d5a7b,_0x2db671),console[_0x321315(0x1c5)](a31_0x4e1e5d[_0x321315(0x175)]('✓')+'\x20Profile\x20\x27'+_0x1d5a7b+'\x27\x20created'),console[_0x321315(0x1c5)](),console['log'](_0x321315(0x19f)),console[_0x321315(0x1c5)](_0x321315(0x1c0)+_0x1d5a7b+_0x321315(0x188)),console[_0x321315(0x1c5)](_0x321315(0x1c0)+_0x1d5a7b+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x33b945){if(_0x33b945 instanceof HTTPClientError&&_0x33b945[_0x321315(0x1bc)]===0x191)return printAuthError(_0x33b945),0x1;return console[_0x321315(0x18b)](a31_0x4e1e5d[_0x321315(0x1bb)](_0x321315(0x1a8)+(_0x33b945 instanceof Error?_0x33b945['message']:String(_0x33b945)))),console[_0x321315(0x18b)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a31_0x2955(_0xc7e047,_0x2cfb84){_0xc7e047=_0xc7e047-0x167;const _0x16d2f9=a31_0x16d2();let _0x2955c1=_0x16d2f9[_0xc7e047];return _0x2955c1;}export class ProfileRemoveCommand extends BaseCommand{[a31_0x5b84e8(0x199)]='profile:remove';[a31_0x5b84e8(0x1a0)]='Remove\x20a\x20profile';['validate'](_0xcb5c5){const _0x56d216=a31_0x5b84e8,{args:_0x4f80f0}=_0xcb5c5;if(_0x4f80f0[_0x56d216(0x180)]===0x0)return _0x56d216(0x1ae);return undefined;}async[a31_0x5b84e8(0x168)](_0x47d991){const _0x58f9c1=a31_0x5b84e8,{args:_0xd6454f}=_0x47d991,_0x33ccf8=_0xd6454f[0x0];console[_0x58f9c1(0x1c5)](a31_0x4e1e5d['bold'](_0x58f9c1(0x17c)));if(!profileExists(_0x33ccf8)){console[_0x58f9c1(0x18b)](a31_0x4e1e5d[_0x58f9c1(0x1bb)]('Profile\x20\x27'+_0x33ccf8+_0x58f9c1(0x167))),console[_0x58f9c1(0x1c5)](_0x58f9c1(0x178));const _0x527e58=listProfiles();if(_0x527e58[_0x58f9c1(0x180)]===0x0)console[_0x58f9c1(0x1c5)](_0x58f9c1(0x19a));else for(const _0x1234d7 of _0x527e58){console[_0x58f9c1(0x1c5)](_0x58f9c1(0x1c1)+_0x1234d7[_0x58f9c1(0x199)]);}return 0x1;}const _0x22928e=await a31_0x5c684a({'type':_0x58f9c1(0x182),'name':_0x58f9c1(0x182),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x33ccf8+'\x27?','initial':![]});if(!_0x22928e[_0x58f9c1(0x182)])return console['log'](_0x58f9c1(0x193)),0x0;try{removeProfileFromUserConfig(_0x33ccf8),console[_0x58f9c1(0x1c5)](a31_0x4e1e5d[_0x58f9c1(0x175)]('✓')+'\x20Profile\x20\x27'+_0x33ccf8+_0x58f9c1(0x195));}catch(_0x33f991){return console[_0x58f9c1(0x18b)](a31_0x4e1e5d['red'](_0x58f9c1(0x196)+(_0x33f991 instanceof Error?_0x33f991[_0x58f9c1(0x169)]:String(_0x33f991)))),0x1;}const _0x15b254=await isKeychainAvailable();if(_0x15b254){const _0x405c4b=await deleteKeychainAPIKey(_0x33ccf8);_0x405c4b&&console[_0x58f9c1(0x1c5)](a31_0x4e1e5d[_0x58f9c1(0x175)]('✓')+_0x58f9c1(0x16d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0x5b84e8(0x199)]='profile:set';[a31_0x5b84e8(0x1a0)]=a31_0x5b84e8(0x190);static [a31_0x5b84e8(0x1ce)]=[a31_0x5b84e8(0x1a5),a31_0x5b84e8(0x18d),a31_0x5b84e8(0x17d),a31_0x5b84e8(0x174),a31_0x5b84e8(0x1c7),a31_0x5b84e8(0x1a0)];[a31_0x5b84e8(0x16e)](_0x27cd17){const _0x3e81da=a31_0x5b84e8,{args:_0x50a21c,options:_0x28b644}=_0x27cd17,_0x3d2a61=_0x28b644[_0x3e81da(0x1a1)]||getActiveProfile();if(!_0x3d2a61)return _0x3e81da(0x171);if(_0x50a21c[_0x3e81da(0x180)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3e81da(0x1ce)][_0x3e81da(0x1aa)](',\x20');const _0x1d20b2=_0x50a21c[0x0];if(!_0x1d20b2['includes']('='))return _0x3e81da(0x1ba)+ProfileSetCommand[_0x3e81da(0x1ce)][_0x3e81da(0x1aa)](',\x20');const [_0x180682]=_0x1d20b2[_0x3e81da(0x181)]('=',0x2);if(!ProfileSetCommand[_0x3e81da(0x1ce)][_0x3e81da(0x1be)](_0x180682))return _0x3e81da(0x173)+_0x180682+_0x3e81da(0x16b)+ProfileSetCommand[_0x3e81da(0x1ce)][_0x3e81da(0x1aa)](',\x20');return undefined;}async[a31_0x5b84e8(0x168)](_0x1c6ec5){const _0x1bfc7e=a31_0x5b84e8,{args:_0x5cab4c,options:_0x39877b}=_0x1c6ec5,_0x330205=_0x39877b[_0x1bfc7e(0x1a1)]||getActiveProfile(),[_0x22a20a,..._0x3e0812]=_0x5cab4c[0x0][_0x1bfc7e(0x181)]('='),_0x4a78ba=_0x3e0812[_0x1bfc7e(0x1aa)]('=');console[_0x1bfc7e(0x1c5)](a31_0x4e1e5d[_0x1bfc7e(0x1cb)](_0x1bfc7e(0x1cf)));if(!profileExists(_0x330205)){const _0x1ee84c=await a31_0x5c684a({'type':'confirm','name':_0x1bfc7e(0x1ab),'message':_0x1bfc7e(0x1b8)+_0x330205+_0x1bfc7e(0x191),'initial':!![]});if(!_0x1ee84c['create'])return console[_0x1bfc7e(0x1c5)]('Operation\x20cancelled'),0x1;}const _0x539a95=loadProfile(_0x330205),_0x10b19d=_0x539a95?.[_0x1bfc7e(0x1b7)]||{};if(_0x22a20a===_0x1bfc7e(0x1a5)){const _0xe2cc5e=resolveSite(_0x4a78ba);console[_0x1bfc7e(0x1c5)](_0x1bfc7e(0x1af)+_0xe2cc5e+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x1bfc7e(0x1c5)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1bfc7e(0x1c5)]('\x20\x20'+getConsoleUrl(_0xe2cc5e,'/app/mp/ak'));const _0x163b56=await a31_0x5c684a({'type':_0x1bfc7e(0x19e),'name':_0x1bfc7e(0x1b1),'message':_0x1bfc7e(0x16f),'validate':_0x424f69=>{if(!_0x424f69||!_0x424f69['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x163b56[_0x1bfc7e(0x1b1)])return console['log'](_0x1bfc7e(0x1a6)),0x1;console[_0x1bfc7e(0x1c5)](_0x1bfc7e(0x1b5));try{const _0x29e118=TDX[_0x1bfc7e(0x1ab)]({'site':_0xe2cc5e,'apiKey':_0x163b56['apiKey'][_0x1bfc7e(0x1b6)](),'logLevel':_0x39877b[_0x1bfc7e(0x16c)]??LogLevel['ERROR']}),_0x5cd4d2=await _0x29e118[_0x1bfc7e(0x17b)][_0x1bfc7e(0x1b9)]();console[_0x1bfc7e(0x1c5)](a31_0x4e1e5d[_0x1bfc7e(0x175)]('✓')+_0x1bfc7e(0x17f)+_0x5cd4d2[_0x1bfc7e(0x1a2)]+')');const _0x3d67fe=await isKeychainAvailable();_0x3d67fe?(await saveAPIKeyAsync(_0x163b56[_0x1bfc7e(0x1b1)][_0x1bfc7e(0x1b6)](),_0xe2cc5e,_0x330205),console[_0x1bfc7e(0x1c5)](a31_0x4e1e5d[_0x1bfc7e(0x175)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x1bfc7e(0x1bf)](a31_0x4e1e5d[_0x1bfc7e(0x1b4)](_0x1bfc7e(0x1a3))),_0x10b19d[_0x1bfc7e(0x1a5)]=_0xe2cc5e;}catch(_0x159842){if(_0x159842 instanceof HTTPClientError&&_0x159842['status']===0x191)return printAuthError(_0x159842),0x1;return console[_0x1bfc7e(0x18b)](a31_0x4e1e5d[_0x1bfc7e(0x1bb)]('✗\x20Validation\x20failed:\x20'+(_0x159842 instanceof Error?_0x159842[_0x1bfc7e(0x169)]:String(_0x159842)))),console[_0x1bfc7e(0x18b)](_0x1bfc7e(0x18e)),0x1;}}else _0x10b19d[_0x22a20a]=_0x4a78ba||undefined;return saveProfileToUserConfig(_0x330205,_0x10b19d),console[_0x1bfc7e(0x1c5)](a31_0x4e1e5d['green']('✓')+_0x1bfc7e(0x18f)+_0x330205+'\x27\x20updated:\x20'+_0x22a20a+'='+(_0x4a78ba||_0x1bfc7e(0x1a4))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x5b84e8(0x199)]=a31_0x5b84e8(0x1c2);['description']=a31_0x5b84e8(0x176);[a31_0x5b84e8(0x16e)](_0x1e0858){const _0x5bd082=a31_0x5b84e8,{args:_0x35dc8d}=_0x1e0858;if(_0x35dc8d[_0x5bd082(0x180)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x10200f){const _0x5dd30c=a31_0x5b84e8,{args:_0x16269d,options:_0x1ef2c5}=_0x10200f,_0x38bcbc=_0x16269d[0x0],_0x4c2c99=_0x1ef2c5[_0x5dd30c(0x184)];cleanExpiredSessions();if(!profileExists(_0x38bcbc)){console[_0x5dd30c(0x18b)](a31_0x4e1e5d[_0x5dd30c(0x1bb)](_0x5dd30c(0x1b8)+_0x38bcbc+_0x5dd30c(0x167))),console[_0x5dd30c(0x1c5)](_0x5dd30c(0x178));const _0x34f9d0=listProfiles();if(_0x34f9d0['length']===0x0)console['log'](_0x5dd30c(0x19a));else for(const _0x2a1d8c of _0x34f9d0){console[_0x5dd30c(0x1c5)](_0x5dd30c(0x1c1)+_0x2a1d8c['name']);}return 0x1;}if(_0x4c2c99){const _0x5967b3=a31_0x5b0987[_0x5dd30c(0x1aa)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x38bcbc),console[_0x5dd30c(0x1c5)]('Default\x20profile\x20set\x20to:\x20'+a31_0x4e1e5d['green'](_0x38bcbc)),console[_0x5dd30c(0x1c5)](a31_0x4e1e5d[_0x5dd30c(0x1c6)](_0x5dd30c(0x194)+_0x5967b3)),0x0;}const _0xc899fe=getSessionID(_0x1ef2c5[_0x5dd30c(0x1ca)]);return saveSessionContext({'profile':_0x38bcbc},_0x1ef2c5[_0x5dd30c(0x1ca)]),console['log'](_0x5dd30c(0x17a)+a31_0x4e1e5d[_0x5dd30c(0x175)](_0x38bcbc)+'\x20'+a31_0x4e1e5d[_0x5dd30c(0x1c6)]('(session:\x20'+_0xc899fe+')')),console[_0x5dd30c(0x1c5)](a31_0x4e1e5d[_0x5dd30c(0x1c6)](_0x5dd30c(0x1ac)+_0x38bcbc+_0x5dd30c(0x189))),0x0;}}
@@ -1 +1 @@
1
- function a32_0xfb87(){const _0x25f45f=['name','4XPJmED','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','7204616gqWIlV','52956boAnhh','👤\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1293537fykoso','config','12dEGvkr','map','scope','site','25ymBmdS','1273233sDbYQL','Error:\x20','profiles','3420290rJTmtt','log','description','13276989jZbaUq','error','45YSMMuF','2822810qBOUPZ'];a32_0xfb87=function(){return _0x25f45f;};return a32_0xfb87();}const a32_0xa41afa=a32_0x1221;(function(_0x5e0108,_0x211918){const _0x32b862=a32_0x1221,_0x5c5da6=_0x5e0108();while(!![]){try{const _0x257fc5=parseInt(_0x32b862(0x1bc))/0x1*(-parseInt(_0x32b862(0x1b3))/0x2)+-parseInt(_0x32b862(0x1bd))/0x3*(-parseInt(_0x32b862(0x1af))/0x4)+parseInt(_0x32b862(0x1a7))/0x5+parseInt(_0x32b862(0x1b8))/0x6*(-parseInt(_0x32b862(0x1b6))/0x7)+parseInt(_0x32b862(0x1b2))/0x8+-parseInt(_0x32b862(0x1ac))/0x9*(parseInt(_0x32b862(0x1ad))/0xa)+parseInt(_0x32b862(0x1aa))/0xb;if(_0x257fc5===_0x211918)break;else _0x5c5da6['push'](_0x5c5da6['shift']());}catch(_0x119a7){_0x5c5da6['push'](_0x5c5da6['shift']());}}}(a32_0xfb87,0xbcbf4));function a32_0x1221(_0x4edaf5,_0x102bd9){_0x4edaf5=_0x4edaf5-0x1a6;const _0xfb870b=a32_0xfb87();let _0x1221f8=_0xfb870b[_0x4edaf5];return _0x1221f8;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0xaccab5 from'chalk';export class ProfilesCommand extends BaseCommand{[a32_0xa41afa(0x1ae)]=a32_0xa41afa(0x1a6);['description']='List\x20all\x20available\x20profiles';async['execute'](_0x444451){const _0x40c148=a32_0xa41afa,{options:_0x1adda2}=_0x444451;try{const _0x109dd8=listProfiles(),_0x4c2acc=getActiveProfile();if(_0x109dd8[_0x40c148(0x1b0)]===0x0)return console[_0x40c148(0x1a8)](_0x40c148(0x1b1)),console[_0x40c148(0x1a8)](_0x40c148(0x1b5)),console[_0x40c148(0x1a8)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x613e26=_0x109dd8[_0x40c148(0x1b9)](_0x5d4bd8=>{const _0x411abc=_0x40c148,_0x52a041=_0x5d4bd8[_0x411abc(0x1ae)]===_0x4c2acc,_0x2829e3=getProfileParams(_0x5d4bd8[_0x411abc(0x1b7)]);return{'name':_0x5d4bd8[_0x411abc(0x1ae)],'active':_0x52a041,'scope':_0x5d4bd8[_0x411abc(0x1ba)],'description':_0x5d4bd8[_0x411abc(0x1b7)][_0x411abc(0x1a9)]||'','params':_0x2829e3};});if(isStructuredFormat(_0x1adda2))await handleSDKOutput(_0x613e26,_0x1adda2);else for(const _0xc7fed0 of _0x109dd8){const _0x552f21=_0xc7fed0['name']===_0x4c2acc?a32_0xaccab5['green']('\x20✓'):'',_0x58d46e=_0xc7fed0['config'][_0x40c148(0x1bb)]?a32_0xaccab5['dim']('\x20'+_0xc7fed0[_0x40c148(0x1b7)]['site']):'',_0x29936c=_0xc7fed0[_0x40c148(0x1b7)]['description']?a32_0xaccab5['dim']('\x20\x20'+_0xc7fed0[_0x40c148(0x1b7)][_0x40c148(0x1a9)]):'';console[_0x40c148(0x1a8)](_0x40c148(0x1b4)+_0xc7fed0[_0x40c148(0x1ae)]+_0x552f21+_0x58d46e+_0x29936c);}return 0x0;}catch(_0x1cd4e4){return _0x1cd4e4 instanceof Error&&console[_0x40c148(0x1ab)](_0x40c148(0x1be)+_0x1cd4e4['message']),0x1;}}}
1
+ function a32_0x3532(_0xcbfbdf,_0x2dda9a){_0xcbfbdf=_0xcbfbdf-0x1df;const _0x35fefc=a32_0x35fe();let _0x353245=_0x35fefc[_0xcbfbdf];return _0x353245;}const a32_0x5dafc7=a32_0x3532;(function(_0x205f53,_0x3d021e){const _0x475fd7=a32_0x3532,_0x270598=_0x205f53();while(!![]){try{const _0x10012=-parseInt(_0x475fd7(0x1ef))/0x1*(parseInt(_0x475fd7(0x1ea))/0x2)+parseInt(_0x475fd7(0x1e1))/0x3+-parseInt(_0x475fd7(0x1ed))/0x4*(-parseInt(_0x475fd7(0x1f5))/0x5)+-parseInt(_0x475fd7(0x1df))/0x6+-parseInt(_0x475fd7(0x1f1))/0x7+parseInt(_0x475fd7(0x1f4))/0x8+parseInt(_0x475fd7(0x1f0))/0x9*(parseInt(_0x475fd7(0x1e5))/0xa);if(_0x10012===_0x3d021e)break;else _0x270598['push'](_0x270598['shift']());}catch(_0x4dd34d){_0x270598['push'](_0x270598['shift']());}}}(a32_0x35fe,0x7aa88));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a32_0x35fe(){const _0x4677aa=['\x20\x20Global:\x20~/.config/tdx/tdx.json','length','error','7437310NcSeEX','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','List\x20all\x20available\x20profiles','👤\x20','description','32WvjTLW','green','name','7468KCBtBB','log','4177kzUMtT','9wESKbY','5012945PKhYnh','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','message','3210280sAiBVL','285XxLbsz','5209566odWlVf','config','2706603cMPDep'];a32_0x35fe=function(){return _0x4677aa;};return a32_0x35fe();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0x2433d8 from'chalk';export class ProfilesCommand extends BaseCommand{[a32_0x5dafc7(0x1ec)]='profiles';['description']=a32_0x5dafc7(0x1e7);async['execute'](_0x1a1088){const _0x2bedf6=a32_0x5dafc7,{options:_0xabfa5d}=_0x1a1088;try{const _0x53f334=listProfiles(),_0x5d82fc=getActiveProfile();if(_0x53f334[_0x2bedf6(0x1e3)]===0x0)return console[_0x2bedf6(0x1ee)](_0x2bedf6(0x1e6)),console[_0x2bedf6(0x1ee)](_0x2bedf6(0x1f2)),console['log'](_0x2bedf6(0x1e2)),0x0;const _0x516102=_0x53f334['map'](_0x1ee3aa=>{const _0x549369=_0x2bedf6,_0x9981e3=_0x1ee3aa['name']===_0x5d82fc,_0x21a7e7=getProfileParams(_0x1ee3aa[_0x549369(0x1e0)]);return{'name':_0x1ee3aa['name'],'active':_0x9981e3,'scope':_0x1ee3aa['scope'],'description':_0x1ee3aa['config'][_0x549369(0x1e9)]||'','params':_0x21a7e7};});if(isStructuredFormat(_0xabfa5d))await handleSDKOutput(_0x516102,_0xabfa5d);else for(const _0x273ee0 of _0x53f334){const _0x2b0ebc=_0x273ee0[_0x2bedf6(0x1ec)]===_0x5d82fc?a32_0x2433d8[_0x2bedf6(0x1eb)]('\x20✓'):'',_0x3df18c=_0x273ee0['config']['site']?a32_0x2433d8['dim']('\x20'+_0x273ee0['config']['site']):'',_0x21f649=_0x273ee0[_0x2bedf6(0x1e0)]['description']?a32_0x2433d8['dim']('\x20\x20'+_0x273ee0[_0x2bedf6(0x1e0)]['description']):'';console[_0x2bedf6(0x1ee)](_0x2bedf6(0x1e8)+_0x273ee0['name']+_0x2b0ebc+_0x3df18c+_0x21f649);}return 0x0;}catch(_0x495e9c){return _0x495e9c instanceof Error&&console[_0x2bedf6(0x1e4)]('Error:\x20'+_0x495e9c[_0x2bedf6(0x1f3)]),0x1;}}}
@@ -1 +1 @@
1
- const a33_0x2e40c9=a33_0x3f62;(function(_0x43a028,_0x178ea2){const _0x144a47=a33_0x3f62,_0x3ac2ca=_0x43a028();while(!![]){try{const _0x3c2eb8=parseInt(_0x144a47(0xf5))/0x1*(parseInt(_0x144a47(0x10f))/0x2)+parseInt(_0x144a47(0x10a))/0x3*(parseInt(_0x144a47(0xf6))/0x4)+-parseInt(_0x144a47(0xe3))/0x5*(parseInt(_0x144a47(0xea))/0x6)+-parseInt(_0x144a47(0x101))/0x7*(-parseInt(_0x144a47(0xf7))/0x8)+parseInt(_0x144a47(0x103))/0x9+-parseInt(_0x144a47(0xe5))/0xa*(-parseInt(_0x144a47(0x10d))/0xb)+parseInt(_0x144a47(0xf9))/0xc*(-parseInt(_0x144a47(0xe2))/0xd);if(_0x3c2eb8===_0x178ea2)break;else _0x3ac2ca['push'](_0x3ac2ca['shift']());}catch(_0x527b8b){_0x3ac2ca['push'](_0x3ac2ca['shift']());}}}(a33_0x539e,0x4d0cd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x2e40c9(0xeb)]='query';[a33_0x2e40c9(0xe7)]=a33_0x2e40c9(0x108);async[a33_0x2e40c9(0x10c)](_0x1d0e4e){const _0x28dace=a33_0x2e40c9,{options:_0x4a9eb5,args:_0x4475c4,tdx:_0x222f68}=_0x1d0e4e,_0x27fe37={..._0x4a9eb5,'limitStructuredFormats':!![]},_0x404889=_0x4475c4[0x0],_0x12c44a=_0x4a9eb5['file'];let _0x464c78;try{if(_0x12c44a)_0x464c78=readSqlStatementsFromFile(_0x12c44a);else{if(_0x404889==='-')_0x464c78=await readSqlStatementsFromStdin();else{if(_0x404889&&isSqlFilePath(_0x404889))_0x464c78=readSqlStatementsFromFile(_0x404889);else{if(_0x404889)_0x464c78=splitSqlStatements(_0x404889);else throw new Error(_0x28dace(0xf8));}}}}catch(_0x376733){return console[_0x28dace(0x10b)](_0x28dace(0xf3)+_0x376733[_0x28dace(0x107)]),0x1;}const _0x4c77cf=_0x4a9eb5['database']||_0x28dace(0xe9),_0x2facdd=_0x4a9eb5[_0x28dace(0xec)];try{const _0x43af52=[],_0x1c8b55=!!_0x4a9eb5[_0x28dace(0xe1)];for(let _0x187dae=0x0;_0x187dae<_0x464c78[_0x28dace(0x104)];_0x187dae++){const _0x540783=_0x464c78[_0x187dae],_0xe5bc5d=_0x187dae+0x1,_0x1131a7=_0x464c78['length'],_0x4c3628=_0x1131a7>0x1;_0x4a9eb5['verbose']&&(console['error']('\x0a'+(_0x4c3628?_0x28dace(0x105)+_0xe5bc5d+'/'+_0x1131a7+':':'')),console[_0x28dace(0x10b)](_0x28dace(0x118)+_0x4a9eb5[_0x28dace(0xe6)]),console[_0x28dace(0x10b)](_0x28dace(0xee)+(_0x2facdd||'td')),console[_0x28dace(0x10b)](_0x28dace(0x116)+_0x4c77cf),console['error'](_0x28dace(0x113)+_0x540783));const _0x4f2e60=_0x4c3628?_0x28dace(0xfb)+_0xe5bc5d+'/'+_0x1131a7+_0x28dace(0x10e):_0x28dace(0xe8);try{const _0x526e45=await withProgressSpinner(_0x4f2e60,async _0x47f551=>{const _0x5255cc=_0x28dace,_0x369539=await _0x222f68[_0x5255cc(0xfd)]['execute'](_0x540783,{'catalog':_0x2facdd,'schema':_0x4c77cf,'onJobId':_0x19a42e=>{const _0x2e03fd=_0x5255cc;_0x47f551[_0x2e03fd(0xfa)](_0x19a42e);},'onProgress':_0x4a30af=>{const _0x49a1f5=_0x5255cc;_0x47f551[_0x49a1f5(0xfe)]('Executing\x20query\x20['+_0x4a30af[_0x49a1f5(0x102)]+']'),_0x47f551[_0x49a1f5(0x111)](formatRows(_0x4a30af[_0x49a1f5(0x109)])+'\x20rows\x20'+_0x4a30af[_0x49a1f5(0xf0)]+'/'+_0x4a30af[_0x49a1f5(0xf1)]+'\x20splits');}});return _0x369539;},{'verbose':_0x4a9eb5['verbose']}),_0x9cfe81=_0x526e45[_0x28dace(0x110)],_0x44f558=_0x9cfe81[_0x28dace(0x115)]?'\x20[Job\x20ID:\x20'+_0x9cfe81[_0x28dace(0x115)]+']':'',_0x4046bf=_0x4c3628?'Statement\x20'+_0xe5bc5d+'/'+_0x1131a7+_0x28dace(0xfc):'';console['error']('✔\x20'+_0x4046bf+'Query\x20completed:\x20Processed\x20'+formatRows(_0x9cfe81[_0x28dace(0xe4)]['processedRows'])+_0x28dace(0xf2)+('in\x20'+formatElapsed(_0x9cfe81[_0x28dace(0xe4)][_0x28dace(0xef)])+_0x44f558));if(_0x4c3628&&_0x1c8b55){const _0x403c5e=resolveOutputOptions(_0x27fe37),_0x2cda85=await formatQueryOutput(_0x9cfe81,_0x403c5e);_0x43af52[_0x28dace(0xff)](_0x2cda85);}else await handleQueryOutput(_0x9cfe81,_0x27fe37);}catch(_0xdd0739){const _0x26d229=_0x4c3628?'Statement\x20'+_0xe5bc5d+'/'+_0x1131a7+':\x0a':'',_0x28aabb=_0xdd0739 instanceof SDKError?_0xdd0739[_0x28dace(0xf4)]:_0xdd0739[_0x28dace(0x107)];return console['error'](''+_0x26d229+_0x28aabb),0x1;}}if(_0x464c78[_0x28dace(0x104)]>0x1&&_0x1c8b55&&_0x43af52['length']>0x0){const _0x193a46=_0x43af52['join']('\x0a');writeFileSync(_0x4a9eb5[_0x28dace(0xe1)],_0x193a46),console[_0x28dace(0x10b)](_0x28dace(0xed)+_0x4a9eb5[_0x28dace(0xe1)]);}return 0x0;}catch(_0x3a52b8){throw _0x3a52b8;}}[a33_0x2e40c9(0x112)](_0x3c43ad){const _0x1ca24f=a33_0x2e40c9,_0x564c22=_0x3c43ad[_0x1ca24f(0x114)][0x0],_0x14fa67=_0x3c43ad[_0x1ca24f(0x100)]['file'];if(!_0x564c22&&!_0x14fa67)return _0x1ca24f(0x117);if(_0x564c22&&_0x14fa67)return _0x1ca24f(0x106);return undefined;}}function a33_0x3f62(_0x1892a5,_0x27f568){_0x1892a5=_0x1892a5-0xe1;const _0x539e9e=a33_0x539e();let _0x3f624e=_0x539e9e[_0x1892a5];return _0x3f624e;}function a33_0x539e(){const _0x1c02c5=['length','Statement\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','message','Run\x20Trino\x20queries\x20(streaming)','processedRows','57966KZPRAW','error','execute','1518GFoMLD','...','26RoeyHy','data','setExtra','validate','SQL:\x20','args','jobId','Schema:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','Site:\x20','output','13ePdUfB','94175Zilvzg','stats','19160iDFReF','site','description','Executing\x20query...','information_schema','150pouwZa','name','catalog','\x0aAll\x20results\x20saved\x20to\x20','Catalog:\x20','elapsedTimeMillis','completedSplits','totalSplits','\x20rows\x20','Error:\x20','originalMessage','17771KYoSuu','32KLUIoK','8csrXDo','No\x20SQL\x20provided','3167460rBGqjm','setJobId','Executing\x20statement\x20','\x20-\x20','query','setPhase','push','options','2567278hscGrz','state','302994UlgaZT'];a33_0x539e=function(){return _0x1c02c5;};return a33_0x539e();}
1
+ const a33_0x243ee6=a33_0x2e4e;function a33_0x22ce(){const _0x5e9133=['elapsedTimeMillis','file','19131jxvmJQ','error','processedRows','length','297530YnOlfX','2643000ZksMhn','push','jobId','Catalog:\x20','name','state','Statement\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','\x20splits','data','No\x20SQL\x20provided','Run\x20Trino\x20queries\x20(streaming)','1113196xZOscS','execute','message','Executing\x20query\x20[','Schema:\x20','verbose','1554FusEUv','SQL:\x20','completedSplits','\x20rows\x20','6BoexFC','setPhase','stats','args','Error:\x20','11871eJihyi','2930arrDsq','257976dXqBeP','2946060CTUPLy','site','Executing\x20statement\x20','Site:\x20','information_schema','options','output','\x0aAll\x20results\x20saved\x20to\x20','setJobId','originalMessage','\x20[Job\x20ID:\x20'];a33_0x22ce=function(){return _0x5e9133;};return a33_0x22ce();}(function(_0x5e174b,_0x48f8a6){const _0x80320c=a33_0x2e4e,_0x177b53=_0x5e174b();while(!![]){try{const _0x503812=-parseInt(_0x80320c(0x6a))/0x1*(-parseInt(_0x80320c(0x81))/0x2)+parseInt(_0x80320c(0x89))/0x3+parseInt(_0x80320c(0x77))/0x4+-parseInt(_0x80320c(0x6b))/0x5+parseInt(_0x80320c(0x7d))/0x6*(-parseInt(_0x80320c(0x96))/0x7)+-parseInt(_0x80320c(0x88))/0x8+parseInt(_0x80320c(0x86))/0x9*(-parseInt(_0x80320c(0x87))/0xa);if(_0x503812===_0x48f8a6)break;else _0x177b53['push'](_0x177b53['shift']());}catch(_0x41bf25){_0x177b53['push'](_0x177b53['shift']());}}}(a33_0x22ce,0x79854));import{BaseCommand}from'./command.js';function a33_0x2e4e(_0x46a5cc,_0x41602b){_0x46a5cc=_0x46a5cc-0x67;const _0x22cea8=a33_0x22ce();let _0x2e4e52=_0x22cea8[_0x46a5cc];return _0x2e4e52;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x243ee6(0x6f)]='query';['description']=a33_0x243ee6(0x76);async[a33_0x243ee6(0x78)](_0x56439f){const _0x56df7f=a33_0x243ee6,{options:_0x2ced2d,args:_0x3971c3,tdx:_0x387023}=_0x56439f,_0x3cf736={..._0x2ced2d,'limitStructuredFormats':!![]},_0x52d30e=_0x3971c3[0x0],_0x19bb9b=_0x2ced2d[_0x56df7f(0x95)];let _0x1989f3;try{if(_0x19bb9b)_0x1989f3=readSqlStatementsFromFile(_0x19bb9b);else{if(_0x52d30e==='-')_0x1989f3=await readSqlStatementsFromStdin();else{if(_0x52d30e&&isSqlFilePath(_0x52d30e))_0x1989f3=readSqlStatementsFromFile(_0x52d30e);else{if(_0x52d30e)_0x1989f3=splitSqlStatements(_0x52d30e);else throw new Error(_0x56df7f(0x75));}}}}catch(_0x36405a){return console['error'](_0x56df7f(0x85)+_0x36405a[_0x56df7f(0x79)]),0x1;}const _0x58fabf=_0x2ced2d['database']||_0x56df7f(0x8d),_0x2fad79=_0x2ced2d['catalog'];try{const _0x4f0f86=[],_0x2e9e43=!!_0x2ced2d['output'];for(let _0x7de549=0x0;_0x7de549<_0x1989f3[_0x56df7f(0x69)];_0x7de549++){const _0x32e516=_0x1989f3[_0x7de549],_0x5b8f8d=_0x7de549+0x1,_0x21bebb=_0x1989f3[_0x56df7f(0x69)],_0x2eaa43=_0x21bebb>0x1;_0x2ced2d[_0x56df7f(0x7c)]&&(console['error']('\x0a'+(_0x2eaa43?_0x56df7f(0x71)+_0x5b8f8d+'/'+_0x21bebb+':':'')),console[_0x56df7f(0x67)](_0x56df7f(0x8c)+_0x2ced2d[_0x56df7f(0x8a)]),console['error'](_0x56df7f(0x6e)+(_0x2fad79||'td')),console[_0x56df7f(0x67)](_0x56df7f(0x7b)+_0x58fabf),console['error'](_0x56df7f(0x7e)+_0x32e516));const _0x20aafd=_0x2eaa43?_0x56df7f(0x8b)+_0x5b8f8d+'/'+_0x21bebb+'...':'Executing\x20query...';try{const _0x43168d=await withProgressSpinner(_0x20aafd,async _0x5a07ea=>{const _0x549816=_0x56df7f,_0x406c53=await _0x387023['query'][_0x549816(0x78)](_0x32e516,{'catalog':_0x2fad79,'schema':_0x58fabf,'onJobId':_0x5368f1=>{const _0x453c67=_0x549816;_0x5a07ea[_0x453c67(0x91)](_0x5368f1);},'onProgress':_0x5770d2=>{const _0x43adce=_0x549816;_0x5a07ea[_0x43adce(0x82)](_0x43adce(0x7a)+_0x5770d2[_0x43adce(0x70)]+']'),_0x5a07ea['setExtra'](formatRows(_0x5770d2[_0x43adce(0x68)])+_0x43adce(0x80)+_0x5770d2[_0x43adce(0x7f)]+'/'+_0x5770d2['totalSplits']+_0x43adce(0x73));}});return _0x406c53;},{'verbose':_0x2ced2d[_0x56df7f(0x7c)]}),_0x2eb91c=_0x43168d[_0x56df7f(0x74)],_0x2e7358=_0x2eb91c[_0x56df7f(0x6d)]?_0x56df7f(0x93)+_0x2eb91c[_0x56df7f(0x6d)]+']':'',_0x3d5d7a=_0x2eaa43?_0x56df7f(0x71)+_0x5b8f8d+'/'+_0x21bebb+'\x20-\x20':'';console[_0x56df7f(0x67)]('✔\x20'+_0x3d5d7a+'Query\x20completed:\x20Processed\x20'+formatRows(_0x2eb91c[_0x56df7f(0x83)][_0x56df7f(0x68)])+_0x56df7f(0x80)+('in\x20'+formatElapsed(_0x2eb91c[_0x56df7f(0x83)][_0x56df7f(0x94)])+_0x2e7358));if(_0x2eaa43&&_0x2e9e43){const _0x374610=resolveOutputOptions(_0x3cf736),_0x31788f=await formatQueryOutput(_0x2eb91c,_0x374610);_0x4f0f86[_0x56df7f(0x6c)](_0x31788f);}else await handleQueryOutput(_0x2eb91c,_0x3cf736);}catch(_0x1795fc){const _0x23a944=_0x2eaa43?_0x56df7f(0x71)+_0x5b8f8d+'/'+_0x21bebb+':\x0a':'',_0x3967a9=_0x1795fc instanceof SDKError?_0x1795fc[_0x56df7f(0x92)]:_0x1795fc[_0x56df7f(0x79)];return console[_0x56df7f(0x67)](''+_0x23a944+_0x3967a9),0x1;}}if(_0x1989f3[_0x56df7f(0x69)]>0x1&&_0x2e9e43&&_0x4f0f86[_0x56df7f(0x69)]>0x0){const _0x28bdf2=_0x4f0f86['join']('\x0a');writeFileSync(_0x2ced2d['output'],_0x28bdf2),console[_0x56df7f(0x67)](_0x56df7f(0x90)+_0x2ced2d[_0x56df7f(0x8f)]);}return 0x0;}catch(_0x44800d){throw _0x44800d;}}['validate'](_0xacdb49){const _0x27d8ea=a33_0x243ee6,_0x4a1f88=_0xacdb49[_0x27d8ea(0x84)][0x0],_0x597e64=_0xacdb49[_0x27d8ea(0x8e)]['file'];if(!_0x4a1f88&&!_0x597e64)return _0x27d8ea(0x72);if(_0x4a1f88&&_0x597e64)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}