@treasuredata/tdx 0.8.7 → 0.8.8

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 (114) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.d.ts.map +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-command.js.map +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/context-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-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/llm-command.js +1 -1
  31. package/dist/commands/llm-proxy.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/segment-command.js +1 -1
  36. package/dist/commands/segment-create-command.js +1 -1
  37. package/dist/commands/segment-fields-command.js +1 -1
  38. package/dist/commands/segment-pull-command.js +1 -1
  39. package/dist/commands/segment-push-command.js +1 -1
  40. package/dist/commands/segment-update-command.js +1 -1
  41. package/dist/commands/segment-use-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/use-command.js +1 -1
  46. package/dist/commands/user-command.js +1 -1
  47. package/dist/commands/workflow-command.js +1 -1
  48. package/dist/core/auth.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/credential-cache.js +1 -1
  52. package/dist/core/global-context.js +1 -1
  53. package/dist/core/keychain.js +1 -1
  54. package/dist/core/profile.js +1 -1
  55. package/dist/core/project-config.js +1 -1
  56. package/dist/core/session.js +1 -1
  57. package/dist/core/user-cache.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/proxy/anthropic-adapter.js +1 -1
  60. package/dist/proxy/claude-usage-tracker.js +1 -1
  61. package/dist/proxy/context-signature.js +1 -1
  62. package/dist/proxy/conversation-utils.js +1 -1
  63. package/dist/proxy/server.js +1 -1
  64. package/dist/proxy/session-cache.js +1 -1
  65. package/dist/sdk/api.js +1 -1
  66. package/dist/sdk/connection.js +1 -1
  67. package/dist/sdk/engage.js +1 -1
  68. package/dist/sdk/errors.js +1 -1
  69. package/dist/sdk/index.js +1 -1
  70. package/dist/sdk/job.js +1 -1
  71. package/dist/sdk/journey.js +1 -1
  72. package/dist/sdk/llm.js +1 -1
  73. package/dist/sdk/query.js +1 -1
  74. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  75. package/dist/sdk/segment/journey-yaml.js +1 -1
  76. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  77. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  78. package/dist/sdk/segment.js +1 -1
  79. package/dist/sdk/user.js +1 -1
  80. package/dist/sdk/workflow.js +1 -1
  81. package/dist/types/endpoints.js +1 -1
  82. package/dist/types/index.js +1 -1
  83. package/dist/utils/agent-ref-parser.js +1 -1
  84. package/dist/utils/async.js +1 -1
  85. package/dist/utils/chat-cache.js +1 -1
  86. package/dist/utils/colors.js +1 -1
  87. package/dist/utils/command-output.js +1 -1
  88. package/dist/utils/constants.js +1 -1
  89. package/dist/utils/diff.js +1 -1
  90. package/dist/utils/fields-display.js +1 -1
  91. package/dist/utils/file-permissions.js +1 -1
  92. package/dist/utils/format-detector.js +1 -1
  93. package/dist/utils/formatters.js +1 -1
  94. package/dist/utils/json-loader.js +1 -1
  95. package/dist/utils/llm-backup-utils.js +1 -1
  96. package/dist/utils/model-aliases.js +1 -1
  97. package/dist/utils/model-factors.js +1 -1
  98. package/dist/utils/option-validation.js +1 -1
  99. package/dist/utils/port.js +1 -1
  100. package/dist/utils/process.js +1 -1
  101. package/dist/utils/prompt.js +1 -1
  102. package/dist/utils/segment-path-parser.js +1 -1
  103. package/dist/utils/segment-ref-parser.js +1 -1
  104. package/dist/utils/spinner.js +1 -1
  105. package/dist/utils/sql-parser.js +1 -1
  106. package/dist/utils/sse-parser.js +1 -1
  107. package/dist/utils/string-utils.js +1 -1
  108. package/dist/utils/table-ref-parser.js +1 -1
  109. package/dist/utils/tdx-config.js +1 -1
  110. package/dist/utils/tdx-logger.js +1 -1
  111. package/dist/utils/tree-formatter.js +1 -1
  112. package/dist/utils/version-check.js +1 -1
  113. package/dist/utils/workflow-utils.js +1 -1
  114. package/package.json +1 -1
@@ -1 +1 @@
1
- const a27_0x9e025=a27_0x2b91;(function(_0x1a5bf1,_0x36c3a4){const _0xc932e2=a27_0x2b91,_0x28f923=_0x1a5bf1();while(!![]){try{const _0x57ecd4=parseInt(_0xc932e2(0x130))/0x1+parseInt(_0xc932e2(0x12c))/0x2*(-parseInt(_0xc932e2(0x12f))/0x3)+-parseInt(_0xc932e2(0x115))/0x4*(-parseInt(_0xc932e2(0xfb))/0x5)+-parseInt(_0xc932e2(0x119))/0x6+-parseInt(_0xc932e2(0x132))/0x7*(parseInt(_0xc932e2(0x126))/0x8)+-parseInt(_0xc932e2(0x124))/0x9*(parseInt(_0xc932e2(0x105))/0xa)+-parseInt(_0xc932e2(0x10f))/0xb*(-parseInt(_0xc932e2(0x10a))/0xc);if(_0x57ecd4===_0x36c3a4)break;else _0x28f923['push'](_0x28f923['shift']());}catch(_0x39f25d){_0x28f923['push'](_0x28f923['shift']());}}}(a27_0x6977,0xe992b));import a27_0xadf910 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x39b25b,_0x5dcbf0){const _0x4921d1=a27_0x2b91,{tdx:_0x1a48c8,options:_0x425f28}=_0x39b25b,_0x21e1e9=_0x5dcbf0||_0x425f28[_0x4921d1(0x107)];if(_0x21e1e9){const _0x520f0a=await _0x1a48c8[_0x4921d1(0x113)]['projects'](),_0x22633f=_0x520f0a[_0x4921d1(0x134)](_0x4ade76=>_0x4ade76[_0x4921d1(0x110)][_0x4921d1(0x114)]===_0x21e1e9);if(!_0x22633f)throw new SDKError(ErrorCode[_0x4921d1(0xfc)],_0x4921d1(0x121)+_0x21e1e9+_0x4921d1(0x10d),undefined,{'helpText':_0x4921d1(0x116)});return _0x22633f['id'];}const _0x5e0834=await _0x1a48c8[_0x4921d1(0x113)][_0x4921d1(0x109)]();return _0x5e0834['id'];}function a27_0x2b91(_0xa5beb,_0x1e45e6){_0xa5beb=_0xa5beb-0xfa;const _0x69772=a27_0x6977();let _0x2b91a7=_0x69772[_0xa5beb];return _0x2b91a7;}function a27_0x6977(){const _0x2f013e=['exit','\x20\x20Agents:','http://0.0.0.0:','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','Project\x20\x27','yellow','dim','9vlOrmf','\x20\x20\x20\x20\x22env\x22:\x20{','8KSEuvd','white','SIGTERM','description','Starting\x20proxy\x20server...','\x20\x20}','166598DBKUbV','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20Site:','12etDYiU','839070GqZCeu','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','8644069NgKdzF','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','find','init','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','15WquYkT','NOT_FOUND','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','SIGINT','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','execute','server','log','llm:proxy','port','2668060pWhbTF','green','llmProject','stop','getOrCreateDefaultProject','12UxWReR','close','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x27\x20not\x20found','cyan','26337905eaFNDY','attributes','created\x20on-demand\x20per\x20model','Resolving\x20project...','llm','name','899188oKGJvk','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','logger','bold','6697392SBbtzu','\x20\x20{','project','\x0aClaude\x20Code\x20Configuration:'];a27_0x6977=function(){return _0x2f013e;};return a27_0x6977();}export class LLMProxyCommand extends BaseCommand{['name']=a27_0x9e025(0x103);[a27_0x9e025(0x129)]=a27_0x9e025(0xfa);[a27_0x9e025(0x101)];[a27_0x9e025(0x117)];async[a27_0x9e025(0x100)](_0x1a8862){const _0x9dea30=a27_0x9e025,{tdx:_0x775307,options:_0x5a624d}=_0x1a8862;try{const _0x3f4982=_0x5a624d,_0x4de675=_0x3f4982[_0x9dea30(0x104)]||0xfa0,_0x299ac8=_0x3f4982[_0x9dea30(0x11b)],_0x53adad=await findAvailablePort(_0x4de675);console['log'](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x112)));const _0x51da61=await getProjectIdOrDefault(_0x1a8862,_0x299ac8),_0x3debe2=await _0x775307[_0x9dea30(0x113)]['projects'](),_0x27fad6=_0x3debe2[_0x9dea30(0x134)](_0x41acca=>_0x41acca['id']===_0x51da61);this['logger']=new TDXLogger(_0x5a624d['logLevel']),await this[_0x9dea30(0x117)][_0x9dea30(0x135)](),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x12a)));_0x53adad!==_0x4de675&&console[_0x9dea30(0x102)](a27_0xadf910['yellow']('Port\x20'+_0x4de675+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x53adad));this[_0x9dea30(0x101)]=new ProxyServer({'port':_0x53adad,'projectId':_0x51da61,'tdx':_0x775307,'logger':this[_0x9dea30(0x117)],'site':_0x5a624d['site']}),await this['server']['start'](),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x122)]['bold']('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0x9dea30(0x102)](a27_0xadf910['yellow'](_0x9dea30(0x133))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x122)](_0x9dea30(0x131))),console[_0x9dea30(0x102)](a27_0xadf910['green'][_0x9dea30(0x118)](_0x9dea30(0xfd))),console['log'](a27_0xadf910[_0x9dea30(0x10e)]('Server\x20Configuration:')),console[_0x9dea30(0x102)](a27_0xadf910['dim']('\x20\x20Address:'),a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x11f)+_0x53adad)),console[_0x9dea30(0x102)](a27_0xadf910['dim']('\x20\x20Project:'),a27_0xadf910['white'](_0x27fad6?.[_0x9dea30(0x110)]['name']||_0x51da61)),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x11e)),a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x111))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x12e)),a27_0xadf910[_0x9dea30(0x127)](_0x5a624d['site'])),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x10e)](_0x9dea30(0x11c))),console['log'](a27_0xadf910['dim']('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console['log'](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x11a))),console['log'](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x125))),console['log'](a27_0xadf910[_0x9dea30(0x127)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x53adad+'\x22,')),console[_0x9dea30(0x102)](a27_0xadf910['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console['log'](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0xff))),console['log'](a27_0xadf910[_0x9dea30(0x127)]('\x20\x20\x20\x20}')),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x127)](_0x9dea30(0x12b))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x10e)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a27_0xadf910['dim']('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x12d))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x123)](_0x9dea30(0x120))),console[_0x9dea30(0x102)](a27_0xadf910[_0x9dea30(0x122)](_0x9dea30(0x10c)));const _0x212ee8=async()=>{const _0x2b89ae=_0x9dea30;console[_0x2b89ae(0x102)](a27_0xadf910[_0x2b89ae(0x123)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x2b89ae(0x101)]&&await this[_0x2b89ae(0x101)][_0x2b89ae(0x108)](),this[_0x2b89ae(0x117)]&&await this[_0x2b89ae(0x117)][_0x2b89ae(0x10b)](),console[_0x2b89ae(0x102)](a27_0xadf910[_0x2b89ae(0x106)]('✓\x20Proxy\x20server\x20stopped')),process[_0x2b89ae(0x11d)](0x0);};return process['on'](_0x9dea30(0xfe),_0x212ee8),process['on'](_0x9dea30(0x128),_0x212ee8),await new Promise(()=>{}),0x0;}catch(_0x2a0b7f){this[_0x9dea30(0x101)]&&await this[_0x9dea30(0x101)]['stop']();this[_0x9dea30(0x117)]&&await this[_0x9dea30(0x117)][_0x9dea30(0x10b)]();throw _0x2a0b7f;}}}
1
+ const a27_0x413c8e=a27_0x2a3e;function a27_0x21eb(){const _0x545a6a=['projects','\x20\x20\x20\x20}','llm:proxy','logLevel','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','bold','port','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','log','execute','SIGINT','server','\x20\x20\x20\x20\x22env\x22:\x20{','1476580vJUNIc','\x20\x20Agents:','yellow','project','Resolving\x20project...','15kWgRSa','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','cyan','description','\x20\x20Site:','init','\x0aClaude\x20Code\x20Configuration:','\x20\x20Address:','Port\x20','3248172XpOHpS','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','http://0.0.0.0:','stop','llm','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','✓\x20Proxy\x20server\x20stopped','green','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','NOT_FOUND','3054828AAJSlk','\x20\x20}','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','white','created\x20on-demand\x20per\x20model','111764FtPcIV','360505OMPrrd','\x20\x20Project:','attributes','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','start','find','exit','22368264rbLGoC','10186799SvoLtu','llmProject','dim','name','close','logger','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','\x20\x20{'];a27_0x21eb=function(){return _0x545a6a;};return a27_0x21eb();}(function(_0x28228c,_0x1f60d1){const _0x1996f1=a27_0x2a3e,_0x53e558=_0x28228c();while(!![]){try{const _0xb65d27=parseInt(_0x1996f1(0x147))/0x1+parseInt(_0x1996f1(0x164))/0x2+-parseInt(_0x1996f1(0x137))/0x3+parseInt(_0x1996f1(0x146))/0x4*(-parseInt(_0x1996f1(0x12e))/0x5)+-parseInt(_0x1996f1(0x141))/0x6+-parseInt(_0x1996f1(0x14f))/0x7+parseInt(_0x1996f1(0x14e))/0x8;if(_0xb65d27===_0x1f60d1)break;else _0x53e558['push'](_0x53e558['shift']());}catch(_0x2e7a8e){_0x53e558['push'](_0x53e558['shift']());}}}(a27_0x21eb,0xba7ee));import a27_0x55f31c from'chalk';import{BaseCommand}from'./command.js';function a27_0x2a3e(_0x4bb9aa,_0x549012){_0x4bb9aa=_0x4bb9aa-0x12c;const _0x21ebe9=a27_0x21eb();let _0x2a3ee6=_0x21ebe9[_0x4bb9aa];return _0x2a3ee6;}import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x5be1eb,_0x32e1ad){const _0x428cdc=a27_0x2a3e,{tdx:_0x55bfbf,options:_0x11c665}=_0x5be1eb,_0x11f1e1=_0x32e1ad||_0x11c665[_0x428cdc(0x150)];if(_0x11f1e1){const _0x4ce8b5=await _0x55bfbf[_0x428cdc(0x13b)][_0x428cdc(0x157)](),_0x25c578=_0x4ce8b5[_0x428cdc(0x14c)](_0x463e0e=>_0x463e0e[_0x428cdc(0x149)][_0x428cdc(0x152)]===_0x11f1e1);if(!_0x25c578)throw new SDKError(ErrorCode[_0x428cdc(0x140)],'Project\x20\x27'+_0x11f1e1+'\x27\x20not\x20found',undefined,{'helpText':_0x428cdc(0x138)});return _0x25c578['id'];}const _0x1c0ea5=await _0x55bfbf[_0x428cdc(0x13b)]['getOrCreateDefaultProject']();return _0x1c0ea5['id'];}export class LLMProxyCommand extends BaseCommand{[a27_0x413c8e(0x152)]=a27_0x413c8e(0x159);[a27_0x413c8e(0x131)]=a27_0x413c8e(0x14a);[a27_0x413c8e(0x162)];[a27_0x413c8e(0x154)];async[a27_0x413c8e(0x160)](_0x24aa8d){const _0x4aad1f=a27_0x413c8e,{tdx:_0x9f9283,options:_0x567b7e}=_0x24aa8d;try{const _0x54fe76=_0x567b7e,_0x93e0ba=_0x54fe76[_0x4aad1f(0x15d)]||0xfa0,_0x41584b=_0x54fe76[_0x4aad1f(0x12c)],_0x2d7577=await findAvailablePort(_0x93e0ba);console[_0x4aad1f(0x15f)](a27_0x55f31c['dim'](_0x4aad1f(0x12d)));const _0x41989b=await getProjectIdOrDefault(_0x24aa8d,_0x41584b),_0x90b312=await _0x9f9283[_0x4aad1f(0x13b)][_0x4aad1f(0x157)](),_0x2692e2=_0x90b312[_0x4aad1f(0x14c)](_0x303630=>_0x303630['id']===_0x41989b);this[_0x4aad1f(0x154)]=new TDXLogger(_0x567b7e[_0x4aad1f(0x15a)]),await this['logger'][_0x4aad1f(0x133)](),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x151)]('Starting\x20proxy\x20server...'));_0x2d7577!==_0x93e0ba&&console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x166)](_0x4aad1f(0x136)+_0x93e0ba+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x2d7577));this['server']=new ProxyServer({'port':_0x2d7577,'projectId':_0x41989b,'tdx':_0x9f9283,'logger':this['logger'],'site':_0x567b7e['site']}),await this[_0x4aad1f(0x162)][_0x4aad1f(0x14b)](),console[_0x4aad1f(0x15f)](a27_0x55f31c['yellow'][_0x4aad1f(0x15c)](_0x4aad1f(0x13f))),console[_0x4aad1f(0x15f)](a27_0x55f31c['yellow']('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x166)](_0x4aad1f(0x12f))),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x13e)][_0x4aad1f(0x15c)](_0x4aad1f(0x13c))),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x130)]('Server\x20Configuration:')),console['log'](a27_0x55f31c[_0x4aad1f(0x151)](_0x4aad1f(0x135)),a27_0x55f31c[_0x4aad1f(0x144)](_0x4aad1f(0x139)+_0x2d7577)),console[_0x4aad1f(0x15f)](a27_0x55f31c['dim'](_0x4aad1f(0x148)),a27_0x55f31c[_0x4aad1f(0x144)](_0x2692e2?.[_0x4aad1f(0x149)][_0x4aad1f(0x152)]||_0x41989b)),console['log'](a27_0x55f31c['dim'](_0x4aad1f(0x165)),a27_0x55f31c[_0x4aad1f(0x144)](_0x4aad1f(0x145))),console['log'](a27_0x55f31c[_0x4aad1f(0x151)](_0x4aad1f(0x132)),a27_0x55f31c['white'](_0x567b7e['site'])),console['log'](a27_0x55f31c[_0x4aad1f(0x130)](_0x4aad1f(0x134))),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x151)](_0x4aad1f(0x15e))),console[_0x4aad1f(0x15f)](a27_0x55f31c['white'](_0x4aad1f(0x156))),console['log'](a27_0x55f31c[_0x4aad1f(0x144)](_0x4aad1f(0x163))),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x144)](_0x4aad1f(0x143)+_0x2d7577+'\x22,')),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x144)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x144)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22')),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x144)](_0x4aad1f(0x158))),console[_0x4aad1f(0x15f)](a27_0x55f31c['white'](_0x4aad1f(0x142))),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x130)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x151)](_0x4aad1f(0x155))),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x151)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x4aad1f(0x15f)](a27_0x55f31c[_0x4aad1f(0x151)](_0x4aad1f(0x15b))),console['log'](a27_0x55f31c['yellow']('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x923661=async()=>{const _0x2ceae6=_0x4aad1f;console['log'](a27_0x55f31c[_0x2ceae6(0x151)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x2ceae6(0x162)]&&await this[_0x2ceae6(0x162)][_0x2ceae6(0x13a)](),this[_0x2ceae6(0x154)]&&await this[_0x2ceae6(0x154)][_0x2ceae6(0x153)](),console[_0x2ceae6(0x15f)](a27_0x55f31c[_0x2ceae6(0x13e)](_0x2ceae6(0x13d))),process[_0x2ceae6(0x14d)](0x0);};return process['on'](_0x4aad1f(0x161),_0x923661),process['on']('SIGTERM',_0x923661),await new Promise(()=>{}),0x0;}catch(_0x220265){this[_0x4aad1f(0x162)]&&await this['server'][_0x4aad1f(0x13a)]();this[_0x4aad1f(0x154)]&&await this[_0x4aad1f(0x154)][_0x4aad1f(0x153)]();throw _0x220265;}}}
@@ -1 +1 @@
1
- const a28_0x169315=a28_0x4084;function a28_0xe269(){const _0x189ffb=['elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','segment:parent:push','\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','behavior','Show\x20parent\x20segment\x20details','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','24IsgMVv','\x0aChanges\x20to\x20apply\x20to\x20\x27','No\x20parent\x20segments\x20match\x20pattern:\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','Errors:','parentSegment','enriched','Resolving\x20parent\x20segment\x20\x27','Pattern:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Creating\x20parent\x20segment\x20\x27','table','Session:','using\x20the\x20default\x20path:\x20','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20--attribute\x20\x22','joinKey','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','328gEAmsL','apply','/\x20directories\x20exist.','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','database','/app/dw/parentSegments/','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','jobId','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','updateParent','displaySummary','previewParentYaml','length','Error:','displayValidateResults','%)\x20','Listing\x20fields\x20for\x20\x27','✔\x20Renamed\x20directory\x20to\x20','\x20Configuration\x20is\x20valid','limit','master','runParent','format','scheduleOption','/sessions/','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','number','Preview:','site','filter','Join:','yes','sampleData','map','354669GzYTNb','Name:\x20','rowCount','error','\x20=\x20','Error\x20reading\x20file:\x20','Updating','open','segment:parent:fields','workflowAttemptId','localeCompare','timezone','displayColumns','pushParentYaml','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','message','.yml','status','platform','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Enriched:','\x20tdx\x20wf\x20attempt\x20','segment:parent:desc','pullParentYaml','Create\x20parent\x20segment\x20\x27','customerPercent','\x20Opening\x20','endsWith','start','Apply\x20changes\x20to\x20\x27','segment:parent:pull','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x0a✔\x20Workflow\x20started','bold','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','sort','✔\x20Created\x20parent\x20segment\x20\x27','string','\x20--behavior\x20\x22','dim','displayBehaviorsStats','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Options:\x0a','segment:parent:sql','test','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20rows)','\x0a⚠️\x20\x20Both\x20','No\x20parent\x20segments\x20found','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:create','information_schema','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','979236mSTwxk','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','column','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Source:','segment:parent:run','green','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','keys','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','List\x20available\x20fields\x20for\x20segmentation','session','parent_segment','\x20--behavior\x20\x22<name>\x22','Options:','Behavior:','/\x20directory.\x0a','Columns:','isDirectory','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','addAttributes','scheduleType','dirname','\x20[Job\x20ID:\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','errors','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Error:\x20File\x20not\x20found:\x20','stop','Updating\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','✔\x20No\x20changes\x20-\x20\x27','displayAttributesStats','in\x20','Validate:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','execute','89028EavVRg','displayPreviewResults','Attempt:','toLocaleString','resolveParentId','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Options\x20(one\x20required):\x0a','Status:','segment:parent:view','5420630HsnefL','Events:','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','behaviors','darwin','output','totalEvents','/app/workflows/','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20--enriched','\x20--interval\x20','\x20rows\x20','tdx\x20segment\x20parent\x20preview\x20','getParentFull','\x0aNo\x20sample\x20data\x20available','description','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','displayMasterInfo','Aborted.','parent_segments','\x0aNew\x20parent\x20segment\x20\x27','/{name}.yml\x0a','use','Fetching\x20sample\x20data...','addBehaviorsFile','displayPreviewHints','foreignKey','Error:\x20--behavior\x20requires\x20a\x20name\x0a','2579286vsKMRt','log','setJobId','👥\x20','/\x20→\x20','customersWithEvents','behaviorsFile','Output\x20file:\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','segment:parent:show','getParentSQL','\x20\x20\x20\x20-\x20','run','double','Behaviors','audienceId','all','preview','610309KiDZQl','Error\x20parsing\x20YAML:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20is\x20already\x20up\x20to\x20date','name','replace','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','segment:parent:validate','Analyzing\x20changes...','SQL\x20query:\x0a','2KMoSDV','join','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20kill','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','coveragePercent','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','data','columns','schemaError','\x27...','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','yellow','segment:parent:list','Found\x20YAML\x20file:\x20','schemaValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','`\x20to\x20download\x20the\x20configuration\x20first','647185MHEpCZ','\x27\x20and\x20run\x20workflow?','Available\x20behaviors:','\x0aUsage:\x20tdx\x20ps\x20preview\x20','workflowSessionId','verbose','\x20Context\x20set:\x20','label','web','population','red','jsonl','Creating','json','attributes','interval','Overwrite\x20\x27','\x20No\x20changes\x20-\x20','Master:','utf-8','displaySampleData','✔\x20Found\x20','cyan','Fetching\x20SQL\x20for\x20\x27','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Rows:','text','toFixed','Site:\x20','ignore','validateParentYaml','Parent\x20segment:\x20','Created','matchedCount','\x20--attribute\x20\x22<name>\x22','Coverage:','segment:parent:preview','xdg-open','listParents','-1d','varchar','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Updated','allValid','attribute','repeat','Table:\x20','addBehaviors','\x27\x20is\x20up\x20to\x20date','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x5c$&','Fetching\x20parent\x20segment\x20\x27','Attribute:','/\x20and\x20'];a28_0xe269=function(){return _0x189ffb;};return a28_0xe269();}(function(_0x4ef002,_0x4ef4fa){const _0x2df15f=a28_0x4084,_0x23ecc5=_0x4ef002();while(!![]){try{const _0x4cbc65=parseInt(_0x2df15f(0x1e3))/0x1*(-parseInt(_0x2df15f(0xc3))/0x2)+parseInt(_0x2df15f(0x1d0))/0x3+parseInt(_0x2df15f(0x183))/0x4+-parseInt(_0x2df15f(0xd8))/0x5+-parseInt(_0x2df15f(0x118))/0x6*(-parseInt(_0x2df15f(0x14d))/0x7)+-parseInt(_0x2df15f(0x12a))/0x8*(-parseInt(_0x2df15f(0x1ab))/0x9)+-parseInt(_0x2df15f(0x1b4))/0xa;if(_0x4cbc65===_0x4ef4fa)break;else _0x23ecc5['push'](_0x23ecc5['shift']());}catch(_0x6c5ba3){_0x23ecc5['push'](_0x23ecc5['shift']());}}}(a28_0xe269,0x6939a));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a28_0x221ccd from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a28_0x478b4a from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';function a28_0x4084(_0x42e6e3,_0x250092){_0x42e6e3=_0x42e6e3-0xc1;const _0xe2693=a28_0xe269();let _0x4084c8=_0xe2693[_0x42e6e3];return _0x4084c8;}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a28_0x169315(0x1c7),LEGACY_PARENT_SEGMENT_DIR=a28_0x169315(0x190);function openBrowser(_0x18d3a3){const _0x557262=a28_0x169315,_0x1ffb01=process[_0x557262(0x160)],_0x216e1b=_0x1ffb01===_0x557262(0x1b8)?_0x557262(0x154):_0x1ffb01==='win32'?'start':_0x557262(0xfd);spawn(_0x216e1b,[_0x18d3a3],{'detached':!![],'stdio':_0x557262(0xf5)})['unref']();}function migrateLegacyDirectory(){const _0x4a611e=a28_0x169315;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58b81b=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58b81b[_0x4a611e(0x196)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x4a611e(0x150)](a28_0x478b4a[_0x4a611e(0xd2)](_0x4a611e(0x17d)+LEGACY_PARENT_SEGMENT_DIR+_0x4a611e(0x10d)+PARENT_SEGMENT_DIR+_0x4a611e(0x12c))),console[_0x4a611e(0x150)](a28_0x478b4a['dim'](_0x4a611e(0x1d9)+LEGACY_PARENT_SEGMENT_DIR+_0x4a611e(0x194))),![];console['error'](a28_0x478b4a[_0x4a611e(0xd2)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x4a611e(0x1d4)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x4a611e(0x150)](a28_0x478b4a[_0x4a611e(0x18a)](_0x4a611e(0x13c)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x59468b){const _0x36a616=_0x59468b instanceof Error?_0x59468b[_0x4a611e(0x15d)]:String(_0x59468b);return console[_0x4a611e(0x150)](a28_0x478b4a[_0x4a611e(0xe2)](_0x4a611e(0x131)+_0x36a616+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a28_0x169315(0x1dd)](_0x5f11ac){return migrateLegacyDirectory(),super['run'](_0x5f11ac);}}function resolveYamlFile(_0x45228){const _0x405e1e=a28_0x169315;if(_0x45228[_0x405e1e(0x169)](_0x405e1e(0x15e))||_0x45228['endsWith']('.yaml'))return _0x45228;return a28_0x221ccd[_0x405e1e(0xc4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x45228)+_0x405e1e(0x15e));}function formatProgressMessage(_0x4ed14c){const _0x1e7d6d=a28_0x169315,_0x5b665a=_0x4ed14c['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5b665a){const [,_0x4a1b61,_0x2e5c87,_0x1771c0='']=_0x5b665a;return a28_0x478b4a[_0x1e7d6d(0x175)](_0x4a1b61+':')+'\x20'+_0x2e5c87+a28_0x478b4a[_0x1e7d6d(0x175)](_0x1771c0);}return a28_0x478b4a['dim'](_0x4ed14c);}function showFileNotFoundError(_0x4e61b3,_0x939ac7){const _0x4349da=a28_0x169315;console[_0x4349da(0x150)](a28_0x478b4a[_0x4349da(0xe2)](_0x4349da(0x1a1)+_0x4e61b3+'\x0a')),console['error'](a28_0x478b4a['cyan'](_0x4349da(0x1c4)+_0x939ac7+_0x4349da(0xd7)));}function showParentSegmentNotSetError(_0x315996){const _0x2a7f0c=a28_0x169315;console[_0x2a7f0c(0x150)](a28_0x478b4a['yellow'](_0x2a7f0c(0x170))),console[_0x2a7f0c(0x150)](_0x315996);}export class ParentSegmentListCommand extends BaseCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0xd3);[a28_0x169315(0x1c3)]='List\x20parent\x20segments';async['execute'](_0x21acaa){const _0x3aa2b8=a28_0x169315,{options:_0x3073eb,args:_0x1df368,tdx:_0x968fb8}=_0x21acaa,_0x43378f=_0x1df368[0x0];_0x3073eb[_0x3aa2b8(0xdd)]&&(console[_0x3aa2b8(0x150)](_0x3aa2b8(0xf4)+_0x3073eb['site']),_0x43378f&&console[_0x3aa2b8(0x150)](_0x3aa2b8(0x120)+_0x43378f));const _0x32953f=await withSpinner(_0x43378f?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x43378f+_0x3aa2b8(0xd0):'Listing\x20parent\x20segments...',()=>_0x968fb8[_0x3aa2b8(0x15b)][_0x3aa2b8(0xfe)](),{'verbose':_0x3073eb[_0x3aa2b8(0xdd)]});let _0x4fa632=_0x32953f[_0x3aa2b8(0xcd)];if(_0x43378f){const _0x11c00b=_0x43378f[_0x3aa2b8(0x1e9)](/[.+^${}()|[\]\\]/g,_0x3aa2b8(0x10a))[_0x3aa2b8(0x1e9)](/\*/g,'.*')[_0x3aa2b8(0x1e9)](/\?/g,'.'),_0x2d105f=new RegExp('^'+_0x11c00b+'$','i');_0x4fa632=_0x4fa632[_0x3aa2b8(0x148)](_0x2cc8d2=>_0x2d105f['test'](_0x2cc8d2[_0x3aa2b8(0xe6)]['name']));}_0x4fa632[_0x3aa2b8(0x171)]((_0x30fd67,_0x36d2cd)=>_0x30fd67['attributes'][_0x3aa2b8(0x1e8)][_0x3aa2b8(0x157)](_0x36d2cd[_0x3aa2b8(0xe6)][_0x3aa2b8(0x1e8)])),console[_0x3aa2b8(0x150)](_0x3aa2b8(0xed)+_0x4fa632['length']+'\x20parent\x20segment'+(_0x4fa632['length']!==0x1?'s':''));if(_0x3073eb[_0x3aa2b8(0x141)]===_0x3aa2b8(0xe5)||_0x3073eb[_0x3aa2b8(0x141)]==='jsonl')await handleSDKOutput(_0x4fa632,_0x3073eb);else{if(_0x4fa632[_0x3aa2b8(0x137)]===0x0)_0x43378f?console[_0x3aa2b8(0x1d1)](_0x3aa2b8(0x11a)+_0x43378f):console['log'](_0x3aa2b8(0x17e));else for(const _0x8ef5d0 of _0x4fa632){const _0x2dc9ed=_0x8ef5d0[_0x3aa2b8(0xe6)][_0x3aa2b8(0xe1)]?a28_0x478b4a[_0x3aa2b8(0x175)]('\x20('+formatRows(_0x8ef5d0[_0x3aa2b8(0xe6)][_0x3aa2b8(0xe1)])+')'):'';console[_0x3aa2b8(0x1d1)](_0x3aa2b8(0x1d3)+_0x8ef5d0[_0x3aa2b8(0xe6)]['name']+_0x2dc9ed);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a28_0x169315(0x180);[a28_0x169315(0x1c3)]=a28_0x169315(0x1b6);async['execute'](_0x10942a){const _0x2960e4=a28_0x169315,{options:_0x43002e,args:_0x13e649,tdx:_0x4af694}=_0x10942a;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x2960e4(0x18b)+_0x2960e4(0x198));const _0x2a30e8=_0x43002e;if(_0x13e649[_0x2960e4(0x137)]===0x0)return console['error'](a28_0x478b4a[_0x2960e4(0xe2)](_0x2960e4(0x10f))),console[_0x2960e4(0x150)](_0x2960e4(0x121)),0x1;const _0x2cbaac=_0x13e649[0x0];if(!_0x2a30e8[_0x2960e4(0x12e)]||!_0x2a30e8[_0x2960e4(0x123)])return console[_0x2960e4(0x150)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x2960e4(0x150)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x2a30e8[_0x2960e4(0xdd)]&&(console['error'](_0x2960e4(0xf4)+_0x2a30e8['site']),console[_0x2960e4(0x150)](_0x2960e4(0x14e)+_0x2cbaac),console[_0x2960e4(0x150)]('Database:\x20'+_0x2a30e8[_0x2960e4(0x12e)]),console[_0x2960e4(0x150)](_0x2960e4(0x106)+_0x2a30e8[_0x2960e4(0x123)]));const _0x499f7e=await loadJSONFromOptions(_0x2a30e8['attributes'],_0x2a30e8['attributesFile']),_0x30558d=await loadJSONFromOptions(_0x2a30e8[_0x2960e4(0x1b7)],_0x2a30e8[_0x2960e4(0x1d6)]),_0x2753a6=await loadJSONFromOptions(_0x2a30e8['customerGroup'],_0x2a30e8['customerGroupFile']),_0x4a06b8={'name':_0x2cbaac,'description':_0x2a30e8[_0x2960e4(0x1c3)],'scheduleType':_0x2a30e8[_0x2960e4(0x19a)],'scheduleOption':_0x2a30e8[_0x2960e4(0x142)],'timezone':_0x2a30e8[_0x2960e4(0x158)],'master':{'parentDatabaseName':_0x2a30e8[_0x2960e4(0x12e)],'parentTableName':_0x2a30e8[_0x2960e4(0x123)]},'attributes':_0x499f7e,'behaviors':_0x30558d,'customerGroup':_0x2753a6},_0xa35fe=await withSpinner(_0x2960e4(0x122)+_0x2cbaac+_0x2960e4(0xd0),()=>_0x4af694[_0x2960e4(0x15b)]['createParent'](_0x4a06b8),{'verbose':_0x43002e[_0x2960e4(0xdd)]}),_0x4ef8d1=_0xa35fe[_0x2960e4(0xcd)];return console['error'](_0x2960e4(0x172)+_0x4ef8d1['name']+'\x27\x20with\x20ID:\x20'+_0x4ef8d1['id']),await handleSDKOutput([_0x4ef8d1],_0x43002e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a28_0x169315(0x1e8)]='segment:parent:update';[a28_0x169315(0x1c3)]=a28_0x169315(0x133);async[a28_0x169315(0x1aa)](_0x4636f1){const _0x2f4ce3=a28_0x169315,{options:_0x14dae4,args:_0x39dfc3,tdx:_0x3dba79}=_0x4636f1;console[_0x2f4ce3(0x150)](_0x2f4ce3(0x130)+_0x2f4ce3(0x18b)+_0x2f4ce3(0x198));const _0x98801c=_0x14dae4;if(_0x39dfc3['length']===0x0)return console[_0x2f4ce3(0x150)](a28_0x478b4a[_0x2f4ce3(0xe2)](_0x2f4ce3(0x10f))),console[_0x2f4ce3(0x150)](_0x2f4ce3(0xc7)),0x1;const _0x3d8c2a=_0x39dfc3[0x0];_0x98801c[_0x2f4ce3(0xdd)]&&(console['error'](_0x2f4ce3(0xf4)+_0x98801c[_0x2f4ce3(0x147)]),console[_0x2f4ce3(0x150)]('Parent\x20segment:\x20'+_0x3d8c2a));const _0xf4c38c=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x3d8c2a+_0x2f4ce3(0xd0),()=>_0x3dba79[_0x2f4ce3(0x15b)][_0x2f4ce3(0x1c1)](_0x3d8c2a),{'verbose':_0x98801c[_0x2f4ce3(0xdd)]}),_0xe93ab5=_0xf4c38c['data'],_0x5ee48e=await loadJSONFromOptions(_0x98801c[_0x2f4ce3(0x199)],_0x98801c['addAttributesFile']),_0x523855=await loadJSONFromOptions(_0x98801c[_0x2f4ce3(0x107)],_0x98801c[_0x2f4ce3(0x1cc)]),_0x4809b0={'name':_0xe93ab5[_0x2f4ce3(0x1e8)],'description':_0x98801c[_0x2f4ce3(0x1c3)]!==undefined?_0x98801c[_0x2f4ce3(0x1c3)]:_0xe93ab5['description'],'scheduleType':_0x98801c[_0x2f4ce3(0x19a)]!==undefined?_0x98801c[_0x2f4ce3(0x19a)]:_0xe93ab5['scheduleType'],'scheduleOption':_0x98801c[_0x2f4ce3(0x142)]!==undefined?_0x98801c[_0x2f4ce3(0x142)]:_0xe93ab5[_0x2f4ce3(0x142)],'timezone':_0x98801c[_0x2f4ce3(0x158)]!==undefined?_0x98801c[_0x2f4ce3(0x158)]:_0xe93ab5[_0x2f4ce3(0x158)],'master':_0xe93ab5['master'],'attributes':_0x5ee48e?[..._0xe93ab5['attributes']||[],..._0x5ee48e]:_0xe93ab5[_0x2f4ce3(0xe6)],'behaviors':_0x523855?[..._0xe93ab5[_0x2f4ce3(0x1b7)]||[],..._0x523855]:_0xe93ab5['behaviors'],'customerGroup':_0xe93ab5['customerGroup']},_0x1f279f=await withSpinner(_0x2f4ce3(0x1a3)+_0x3d8c2a+_0x2f4ce3(0xd0),()=>_0x3dba79[_0x2f4ce3(0x15b)][_0x2f4ce3(0x134)](_0x3d8c2a,_0x4809b0),{'verbose':_0x98801c[_0x2f4ce3(0xdd)]}),_0xf5fc48=_0x1f279f[_0x2f4ce3(0xcd)];return console[_0x2f4ce3(0x150)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0xf5fc48[_0x2f4ce3(0x1e8)]+'\x27'),await handleSDKOutput([_0xf5fc48],_0x98801c),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a28_0x169315(0x16c);[a28_0x169315(0x1c3)]=a28_0x169315(0x17b);async[a28_0x169315(0x1aa)](_0x29f68f){const _0x22432a=a28_0x169315,{options:_0x5baedc,args:_0xb48c3d,tdx:_0x898e5f}=_0x29f68f,_0x50f382=_0x5baedc,_0x2e6272=_0xb48c3d[0x0]||_0x5baedc[_0x22432a(0x11d)];if(!_0x2e6272)return showParentSegmentNotSetError(_0x22432a(0xc9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x50f382[_0x22432a(0x1ca)]&&_0x50f382[_0x22432a(0x1b9)])return console[_0x22432a(0x150)](a28_0x478b4a[_0x22432a(0xe2)](_0x22432a(0x1bc))),console[_0x22432a(0x150)](a28_0x478b4a[_0x22432a(0x175)](_0x22432a(0xcc))),console[_0x22432a(0x150)](a28_0x478b4a[_0x22432a(0x175)](_0x22432a(0x125)+PARENT_SEGMENT_DIR+_0x22432a(0x1c9))),console['error'](a28_0x478b4a[_0x22432a(0xee)](_0x22432a(0x182))),0x1;const _0x2f562f=_0x50f382['output']||a28_0x221ccd[_0x22432a(0xc4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2e6272)+'.yml');_0x50f382[_0x22432a(0xdd)]&&(console[_0x22432a(0x150)](_0x22432a(0xf4)+_0x50f382['site']),console[_0x22432a(0x150)]('Parent\x20segment:\x20'+_0x2e6272),console[_0x22432a(0x150)](_0x22432a(0x1d7)+_0x2f562f));const _0x4e8a38=await withSpinner(_0x22432a(0x10b)+_0x2e6272+_0x22432a(0xd0),()=>_0x898e5f['segment'][_0x22432a(0x165)](_0x2e6272),{'verbose':_0x50f382[_0x22432a(0xdd)]}),_0x4e7933=_0x4e8a38['data'];if(existsSync(_0x2f562f)){const _0x43d689=readFileSync(_0x2f562f,'utf-8'),_0x516d68=generateDiff(_0x43d689,_0x4e7933);if(!hasChanges(_0x516d68))console[_0x22432a(0x150)](a28_0x478b4a['green']('✔')+_0x22432a(0xe9)+a28_0x478b4a[_0x22432a(0xee)](_0x2f562f)+_0x22432a(0x1e7));else{console['error']('\x0aChanges\x20to\x20\x27'+_0x2f562f+'\x27:'),console[_0x22432a(0x150)]('─'[_0x22432a(0x105)](0x3c)),console['error'](formatDiffWithColors(_0x516d68)),console[_0x22432a(0x150)]('─'[_0x22432a(0x105)](0x3c));if(!_0x50f382[_0x22432a(0x14a)]){const _0x520be5=await confirmKey(_0x22432a(0xe8)+_0x2f562f+'\x27?');if(!_0x520be5)return console['error']('Aborted.'),0x1;}writeFileSync(_0x2f562f,_0x4e7933,_0x22432a(0xeb)),console[_0x22432a(0x150)](a28_0x478b4a[_0x22432a(0x18a)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a28_0x478b4a[_0x22432a(0xee)](_0x2f562f));}}else{const _0x5e186b=a28_0x221ccd[_0x22432a(0x19b)](_0x2f562f);!existsSync(_0x5e186b)&&mkdirSync(_0x5e186b,{'recursive':!![]}),writeFileSync(_0x2f562f,_0x4e7933,_0x22432a(0xeb)),console[_0x22432a(0x150)](a28_0x478b4a[_0x22432a(0x18a)]('✔')+_0x22432a(0x19d)+a28_0x478b4a['cyan'](_0x2f562f));}return saveSessionContext({'parent_segment':_0x2e6272},_0x50f382[_0x22432a(0x18f)]),console['error'](a28_0x478b4a[_0x22432a(0x18a)]('✔')+_0x22432a(0xde)+a28_0x478b4a[_0x22432a(0x175)]('parent_segment')+_0x22432a(0x151)+a28_0x478b4a[_0x22432a(0xee)](_0x2e6272)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x111);[a28_0x169315(0x1c3)]=a28_0x169315(0x1a9);async[a28_0x169315(0x1aa)](_0x8bb9ed){const _0x1bb743=a28_0x169315,{options:_0x4d17cb,args:_0x40e113,tdx:_0xc9597d}=_0x8bb9ed,_0x3e6f22=_0x4d17cb,_0x2f480f=_0x40e113[0x0]||_0x4d17cb[_0x1bb743(0x11d)];if(!_0x2f480f)return showParentSegmentNotSetError(_0x1bb743(0x19e)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x4f9426=resolveYamlFile(_0x2f480f);if(!existsSync(_0x4f9426))return showFileNotFoundError(_0x4f9426,_0x2f480f),0x1;_0x3e6f22[_0x1bb743(0xdd)]&&(console[_0x1bb743(0x150)]('Site:\x20'+_0x3e6f22['site']),console[_0x1bb743(0x150)]('YAML\x20file:\x20'+_0x4f9426));let _0x3ecc93;try{_0x3ecc93=readFileSync(_0x4f9426,_0x1bb743(0xeb));}catch(_0x49b207){const _0x223638=_0x49b207 instanceof Error?_0x49b207[_0x1bb743(0x15d)]:String(_0x49b207);return console['error'](_0x1bb743(0x152)+_0x223638),0x1;}const _0x2bf3e4=await withSpinner(_0x1bb743(0xc1),()=>_0xc9597d[_0x1bb743(0x15b)][_0x1bb743(0x15a)](_0x3ecc93),{'verbose':_0x3e6f22['verbose']}),_0x48e467=_0x2bf3e4[_0x1bb743(0xcd)],{isNew:_0xa2455d,name:_0x2a4437,hasChanges:_0x3ae7e5,diffFormatted:_0x22fbd3}=_0x48e467;if(!_0x3ae7e5)return console[_0x1bb743(0x150)]('✔\x20No\x20changes\x20-\x20\x27'+_0x2a4437+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0xa2455d?console[_0x1bb743(0x150)](_0x1bb743(0x1c8)+_0x2a4437+'\x27:'):console['error'](_0x1bb743(0x119)+_0x2a4437+'\x27:');console[_0x1bb743(0x150)]('─'['repeat'](0x3c)),console[_0x1bb743(0x150)](_0x22fbd3),console[_0x1bb743(0x150)]('─'[_0x1bb743(0x105)](0x3c));const _0x3183a9=_0xa2455d?_0x1bb743(0x166)+_0x2a4437+'\x27?':_0x1bb743(0x16b)+_0x2a4437+'\x27?';if(!_0x3e6f22[_0x1bb743(0x14a)]){const _0x5e393f=await confirmKey(_0x3183a9);if(!_0x5e393f)return console[_0x1bb743(0x150)](_0x1bb743(0x1c6)),0x1;}const _0x3dbd12=_0xa2455d?_0x1bb743(0xe4):_0x1bb743(0x153),_0x584a32=await withSpinner(_0x3dbd12+_0x1bb743(0x112)+_0x2a4437+'\x27...',()=>_0x48e467['apply'](),{'verbose':_0x3e6f22[_0x1bb743(0xdd)]}),_0x1d642d=_0x584a32[_0x1bb743(0xcd)],_0x2b51b6=getConsoleNextUrl(_0x3e6f22[_0x1bb743(0x147)],_0x1bb743(0x12f)+_0x1d642d['id']),_0x4f691a=_0xa2455d?_0x1bb743(0xf8):'Updated';return console[_0x1bb743(0x150)]('✔\x20'+_0x4f691a+_0x1bb743(0x112)+_0x1d642d[_0x1bb743(0x1e8)]+'\x27'),console[_0x1bb743(0x150)]('\x20\x20'+_0x2b51b6),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a28_0x169315(0x1ec);[a28_0x169315(0x1c3)]=a28_0x169315(0x161);async[a28_0x169315(0x1aa)](_0x278edf){const _0x194832=a28_0x169315,{options:_0x355c5c,args:_0x52af83,tdx:_0x2ead45}=_0x278edf,_0x3a3e52=_0x355c5c,_0x770705=_0x52af83[0x0]||_0x355c5c[_0x194832(0x11d)];if(!_0x770705)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'+_0x194832(0x16d)+_0x194832(0x178)+_0x194832(0x129)+_0x194832(0x101)+_0x194832(0x1b0)),0x1;const _0x4320f5=resolveYamlFile(_0x770705);if(!existsSync(_0x4320f5))return showFileNotFoundError(_0x4320f5,_0x770705),0x1;_0x3a3e52[_0x194832(0xdd)]&&(console[_0x194832(0x150)](_0x194832(0xf4)+_0x3a3e52[_0x194832(0x147)]),console[_0x194832(0x150)](_0x194832(0x186)+_0x4320f5));let _0x114560;try{_0x114560=readFileSync(_0x4320f5,_0x194832(0xeb));}catch(_0x506041){const _0x42ac6a=_0x506041 instanceof Error?_0x506041[_0x194832(0x15d)]:String(_0x506041);return console['error'](_0x194832(0x152)+_0x42ac6a),0x1;}const _0x56aeb0=createCommandSpinner(a28_0x478b4a[_0x194832(0x175)]('Validating\x20configuration...'),{'verbose':_0x3a3e52[_0x194832(0xdd)]});_0x56aeb0[_0x194832(0x16a)]();const _0xc668db={'onProgress':_0x494a8a=>{const _0x9a5076=_0x194832;_0x56aeb0[_0x9a5076(0xf2)]=formatProgressMessage(_0x494a8a);}};if(_0x3a3e52[_0x194832(0x13f)])_0xc668db[_0x194832(0x13f)]=!![];if(_0x3a3e52[_0x194832(0x11e)])_0xc668db[_0x194832(0x11e)]=!![];_0x3a3e52[_0x194832(0x104)]&&(_0xc668db[_0x194832(0x104)]=_0x3a3e52['attribute']);_0x3a3e52[_0x194832(0x115)]&&(_0xc668db[_0x194832(0x115)]=_0x3a3e52[_0x194832(0x115)]);if(_0x3a3e52[_0x194832(0xe7)])_0xc668db[_0x194832(0xe7)]=_0x3a3e52[_0x194832(0xe7)];let _0xc93af0;try{_0xc93af0=await _0x2ead45[_0x194832(0x15b)][_0x194832(0xf6)](_0x114560,_0xc668db),_0x56aeb0[_0x194832(0x1a2)]();}catch(_0x414175){_0x56aeb0[_0x194832(0x1a2)]();throw _0x414175;}const _0x3113f5=_0x3a3e52[_0x194832(0xe7)]||'-1d';return this[_0x194832(0x139)](_0xc93af0,_0xc668db,_0x4320f5,_0x3113f5),_0xc93af0[_0x194832(0x103)]?0x0:0x1;}[a28_0x169315(0x139)](_0x16c276,_0xa27e04,_0x27a7c7,_0x51931f){const _0x597224=a28_0x169315;console[_0x597224(0x150)]('\x0a'+a28_0x478b4a[_0x597224(0x16f)](_0x597224(0x1a8))+'\x20'+_0x16c276[_0x597224(0x1e8)]),console[_0x597224(0x150)]('═'[_0x597224(0x105)](0x3c)),this[_0x597224(0x1c5)](_0x16c276);if(typeof _0xa27e04[_0x597224(0x104)]===_0x597224(0x173)){this[_0x597224(0x1a6)](_0x16c276),this[_0x597224(0x135)](_0x16c276),this[_0x597224(0x1cd)](_0x27a7c7,_0x51931f,_0x597224(0x104),_0xa27e04[_0x597224(0x104)]);return;}if(_0xa27e04[_0x597224(0x104)]===!![]){this[_0x597224(0x1a6)](_0x16c276),this[_0x597224(0x135)](_0x16c276),this[_0x597224(0x1cd)](_0x27a7c7,_0x51931f,_0x597224(0xe6));return;}if(typeof _0xa27e04[_0x597224(0x115)]===_0x597224(0x173)){this[_0x597224(0x176)](_0x16c276,_0x51931f),this['displaySummary'](_0x16c276),this[_0x597224(0x1cd)](_0x27a7c7,_0x51931f,_0x597224(0x115),_0xa27e04[_0x597224(0x115)]);return;}if(_0xa27e04[_0x597224(0x115)]===!![]){this[_0x597224(0x176)](_0x16c276,_0x51931f),this[_0x597224(0x135)](_0x16c276),this[_0x597224(0x1cd)](_0x27a7c7,_0x51931f,_0x597224(0x1b7));return;}this[_0x597224(0x1a6)](_0x16c276),this['displayBehaviorsStats'](_0x16c276,_0x51931f),this[_0x597224(0x135)](_0x16c276),this[_0x597224(0x1cd)](_0x27a7c7,_0x51931f,_0x597224(0x1e1));}[a28_0x169315(0x1cd)](_0x147a0b,_0x1f24fb,_0x424d7e,_0x197eb7){const _0x4ee98f=a28_0x169315;console['error']('\x0a'+a28_0x478b4a[_0x4ee98f(0x175)]('To\x20view\x20sample\x20data:'));const _0x2f8fa4=_0x1f24fb!==_0x4ee98f(0xff)?_0x4ee98f(0x1be)+_0x1f24fb:'';if(_0x424d7e===_0x4ee98f(0x104)&&_0x197eb7)console[_0x4ee98f(0x150)]('\x20\x20'+a28_0x478b4a[_0x4ee98f(0x175)]('tdx\x20segment\x20parent\x20preview\x20'+_0x147a0b+_0x4ee98f(0x127)+_0x197eb7+'\x22'+_0x2f8fa4));else{if(_0x424d7e===_0x4ee98f(0x115)&&_0x197eb7)console[_0x4ee98f(0x150)]('\x20\x20'+a28_0x478b4a['dim'](_0x4ee98f(0x1c0)+_0x147a0b+_0x4ee98f(0x174)+_0x197eb7+'\x22'+_0x2f8fa4));else(_0x424d7e==='attributes'||_0x424d7e===_0x4ee98f(0x1e1))&&console[_0x4ee98f(0x150)]('\x20\x20'+a28_0x478b4a['dim'](_0x4ee98f(0x1c0)+_0x147a0b+_0x4ee98f(0xfa)+_0x2f8fa4));}(_0x424d7e===_0x4ee98f(0x1b7)||_0x424d7e==='all')&&console[_0x4ee98f(0x150)]('\x20\x20'+a28_0x478b4a[_0x4ee98f(0x175)](_0x4ee98f(0x1c0)+_0x147a0b+_0x4ee98f(0x191)+_0x2f8fa4)),_0x424d7e===_0x4ee98f(0x1e1)&&console[_0x4ee98f(0x150)]('\x20\x20'+a28_0x478b4a[_0x4ee98f(0x175)]('tdx\x20segment\x20parent\x20preview\x20'+_0x147a0b+_0x4ee98f(0x1bd)+_0x2f8fa4));}[a28_0x169315(0x1c5)](_0x2a0739){const _0x2abec9=a28_0x169315,{master:_0x54cce6}=_0x2a0739,_0x19f648=_0x54cce6['schemaValid']?a28_0x478b4a['green']('✔'):a28_0x478b4a[_0x2abec9(0xe2)]('✘');console[_0x2abec9(0x150)]('\x0a'+a28_0x478b4a['dim']('Master\x20Table')),console[_0x2abec9(0x150)](_0x19f648+'\x20'+a28_0x478b4a[_0x2abec9(0x16f)](_0x54cce6[_0x2abec9(0x12e)]+'.'+_0x54cce6['table'])),_0x54cce6['schemaValid']?_0x54cce6[_0x2abec9(0x14f)]!==undefined&&console[_0x2abec9(0x150)]('\x20\x20'+a28_0x478b4a[_0x2abec9(0x175)](_0x2abec9(0xf1))+'\x20'+a28_0x478b4a[_0x2abec9(0xee)](formatRows(_0x54cce6['rowCount']))):console[_0x2abec9(0x150)]('\x20\x20'+a28_0x478b4a['red']('Error:')+'\x20'+_0x54cce6[_0x2abec9(0xcf)]);}[a28_0x169315(0x1a6)](_0x2255d0){const _0x4b44ce=a28_0x169315;if(_0x2255d0[_0x4b44ce(0xe6)]['length']===0x0)return;console['error']('\x0a'+a28_0x478b4a[_0x4b44ce(0x175)]('Attributes'));for(const _0x71cbe1 of _0x2255d0[_0x4b44ce(0xe6)]){const _0x1d4a7c=_0x71cbe1['schemaValid']?a28_0x478b4a[_0x4b44ce(0x18a)]('✔'):a28_0x478b4a['red']('✘');let _0x1c4b99='';if(_0x71cbe1[_0x4b44ce(0xd5)]&&_0x71cbe1[_0x4b44ce(0xf9)]!==undefined&&_0x71cbe1[_0x4b44ce(0xca)]!==undefined){const _0x187caa=_0x71cbe1[_0x4b44ce(0xca)][_0x4b44ce(0xf3)](0x1),_0x498eda=_0x71cbe1[_0x4b44ce(0xca)]>=0x50?a28_0x478b4a['green']:_0x71cbe1[_0x4b44ce(0xca)]>=0x32?a28_0x478b4a[_0x4b44ce(0xd2)]:a28_0x478b4a[_0x4b44ce(0xe2)];_0x1c4b99='\x20'+a28_0x478b4a['dim'](_0x4b44ce(0xfb))+'\x20'+_0x498eda(_0x187caa+'%')+'\x20('+formatRows(_0x71cbe1[_0x4b44ce(0xf9)])+_0x4b44ce(0x17c);}console['error'](_0x1d4a7c+'\x20'+a28_0x478b4a[_0x4b44ce(0x16f)](_0x71cbe1['name'])+_0x1c4b99),console[_0x4b44ce(0x150)]('\x20\x20'+a28_0x478b4a['dim'](_0x4b44ce(0x188))+'\x20'+a28_0x478b4a[_0x4b44ce(0x16f)](_0x71cbe1['database']+'.'+_0x71cbe1[_0x4b44ce(0x123)]));const _0x5e2616=_0x71cbe1[_0x4b44ce(0x128)]===_0x71cbe1['foreignKey']?a28_0x478b4a[_0x4b44ce(0x175)]('Join\x20on:')+'\x20'+_0x71cbe1[_0x4b44ce(0x128)]:a28_0x478b4a['dim'](_0x4b44ce(0x149))+'\x20'+_0x71cbe1[_0x4b44ce(0x128)]+_0x4b44ce(0x151)+_0x71cbe1[_0x4b44ce(0x1ce)];console[_0x4b44ce(0x150)]('\x20\x20'+_0x5e2616),console[_0x4b44ce(0x150)]('\x20\x20'+a28_0x478b4a[_0x4b44ce(0x175)](_0x4b44ce(0x195))),this[_0x4b44ce(0x159)](_0x71cbe1[_0x4b44ce(0xce)]),!_0x71cbe1[_0x4b44ce(0xd5)]&&console[_0x4b44ce(0x150)]('\x20\x20'+a28_0x478b4a[_0x4b44ce(0xe2)](_0x4b44ce(0x138))+'\x20'+_0x71cbe1[_0x4b44ce(0xcf)]);}}[a28_0x169315(0x176)](_0x30f88f,_0xf25f4c){const _0x155efc=a28_0x169315;if(_0x30f88f[_0x155efc(0x1b7)][_0x155efc(0x137)]===0x0)return;console['error']('\x0a'+a28_0x478b4a[_0x155efc(0x175)](_0x155efc(0x1df))+'\x20'+a28_0x478b4a[_0x155efc(0x175)]('('+_0xf25f4c+')'));for(const _0x29a554 of _0x30f88f['behaviors']){const _0xf868d0=_0x29a554[_0x155efc(0xd5)]?a28_0x478b4a[_0x155efc(0x18a)]('✔'):a28_0x478b4a[_0x155efc(0xe2)]('✘');let _0x520c2b='';if(_0x29a554[_0x155efc(0xd5)]&&_0x29a554[_0x155efc(0x1d5)]!==undefined&&_0x29a554[_0x155efc(0x1ba)]!==undefined){const _0x28ed10=_0x29a554['customerPercent']?.[_0x155efc(0xf3)](0x1)||'?',_0x362fd3=(_0x29a554['customerPercent']??0x0)>=0x32?a28_0x478b4a[_0x155efc(0x18a)]:(_0x29a554[_0x155efc(0x167)]??0x0)>=0x14?a28_0x478b4a[_0x155efc(0xd2)]:a28_0x478b4a[_0x155efc(0xe2)];_0x520c2b='\x20'+a28_0x478b4a[_0x155efc(0x175)]('Customers:')+'\x20'+_0x362fd3(formatRows(_0x29a554[_0x155efc(0x1d5)]))+'\x20('+_0x28ed10+_0x155efc(0x13a)+a28_0x478b4a[_0x155efc(0x175)](_0x155efc(0x1b5))+'\x20'+a28_0x478b4a['cyan'](formatRows(_0x29a554[_0x155efc(0x1ba)]));}console[_0x155efc(0x150)](_0xf868d0+'\x20'+a28_0x478b4a['bold'](_0x29a554[_0x155efc(0x1e8)])+_0x520c2b),console[_0x155efc(0x150)]('\x20\x20'+a28_0x478b4a[_0x155efc(0x175)]('Source:')+'\x20'+a28_0x478b4a[_0x155efc(0x16f)](_0x29a554[_0x155efc(0x12e)]+'.'+_0x29a554[_0x155efc(0x123)]));const _0x35cec7=_0x29a554[_0x155efc(0x128)]===_0x29a554[_0x155efc(0x1ce)]?a28_0x478b4a['dim']('Join\x20on:')+'\x20'+_0x29a554[_0x155efc(0x128)]:a28_0x478b4a['dim'](_0x155efc(0x149))+'\x20'+_0x29a554[_0x155efc(0x128)]+'\x20=\x20'+_0x29a554[_0x155efc(0x1ce)];console[_0x155efc(0x150)]('\x20\x20'+_0x35cec7),console[_0x155efc(0x150)]('\x20\x20'+a28_0x478b4a[_0x155efc(0x175)](_0x155efc(0x195))),this[_0x155efc(0x159)](_0x29a554[_0x155efc(0xce)]),!_0x29a554['schemaValid']&&console['error']('\x20\x20'+a28_0x478b4a[_0x155efc(0xe2)](_0x155efc(0x138))+'\x20'+_0x29a554[_0x155efc(0xcf)]);}}['displayColumns'](_0x1c2865){const _0xdafbf4=a28_0x169315;for(const _0x338079 of _0x1c2865){_0x338079[_0xdafbf4(0xdf)]===_0x338079[_0xdafbf4(0x185)]||_0x338079[_0xdafbf4(0x185)]==='*'?console[_0xdafbf4(0x150)](_0xdafbf4(0x1dc)+_0x338079['label']):console[_0xdafbf4(0x150)](_0xdafbf4(0x1dc)+_0x338079['label']+'\x20'+a28_0x478b4a[_0xdafbf4(0x175)]('('+_0x338079[_0xdafbf4(0x185)]+')'));}}[a28_0x169315(0x135)](_0x35d795){const _0x1df9fb=a28_0x169315;console[_0x1df9fb(0x150)]('─'[_0x1df9fb(0x105)](0x3c));if(_0x35d795[_0x1df9fb(0x19f)][_0x1df9fb(0x137)]>0x0){console[_0x1df9fb(0x150)]('\x0a'+a28_0x478b4a[_0x1df9fb(0xe2)](_0x1df9fb(0x11c)));for(const _0x3ec6f1 of _0x35d795[_0x1df9fb(0x19f)]){console[_0x1df9fb(0x150)]('\x20\x20'+a28_0x478b4a['red']('•')+'\x20'+_0x3ec6f1);}}_0x35d795[_0x1df9fb(0x103)]&&console[_0x1df9fb(0x150)]('\x0a'+a28_0x478b4a[_0x1df9fb(0x18a)]('✔')+_0x1df9fb(0x13d));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0xfc);[a28_0x169315(0x1c3)]=a28_0x169315(0x1d8);async[a28_0x169315(0x1aa)](_0x3acdf0){const _0x2b4eb5=a28_0x169315,{options:_0x1a6644,args:_0x5b4de0,tdx:_0xc13dea}=_0x3acdf0,_0x591357=_0x1a6644,_0x1eff99=_0x5b4de0[0x0]||_0x1a6644[_0x2b4eb5(0x11d)];if(!_0x1eff99)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\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'+_0x2b4eb5(0x1b1)+_0x2b4eb5(0x12d)+_0x2b4eb5(0x184)+_0x2b4eb5(0x1eb)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x2b4eb5(0x1b0)),0x1;if(!_0x591357[_0x2b4eb5(0x13f)]&&!_0x591357[_0x2b4eb5(0x104)]&&!_0x591357[_0x2b4eb5(0x115)]&&!_0x591357['enriched'])return console[_0x2b4eb5(0x150)](a28_0x478b4a[_0x2b4eb5(0xe2)](_0x2b4eb5(0xcb))),console[_0x2b4eb5(0x150)](_0x2b4eb5(0x110)),console['error'](_0x2b4eb5(0x192)),console[_0x2b4eb5(0x150)](_0x2b4eb5(0x109)),console['error'](_0x2b4eb5(0x177)),console[_0x2b4eb5(0x150)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x2b4eb5(0xc8)),0x1;const _0xd6dd21=resolveYamlFile(_0x1eff99);if(!existsSync(_0xd6dd21))return showFileNotFoundError(_0xd6dd21,_0x1eff99),0x1;_0x591357[_0x2b4eb5(0xdd)]&&(console['error']('Site:\x20'+_0x591357[_0x2b4eb5(0x147)]),console['error']('YAML\x20file:\x20'+_0xd6dd21));let _0x1641f7;try{_0x1641f7=readFileSync(_0xd6dd21,'utf-8');}catch(_0x54e5f2){const _0x9e8e23=_0x54e5f2 instanceof Error?_0x54e5f2[_0x2b4eb5(0x15d)]:String(_0x54e5f2);return console['error']('Error\x20reading\x20file:\x20'+_0x9e8e23),0x1;}let _0x4ca3d5;try{_0x4ca3d5=parseYamlString(_0x1641f7);}catch(_0x4985fe){const _0x5324f4=_0x4985fe instanceof Error?_0x4985fe[_0x2b4eb5(0x15d)]:String(_0x4985fe);return console[_0x2b4eb5(0x150)](a28_0x478b4a['red'](_0x2b4eb5(0x1e4)+_0x5324f4)),0x1;}if(_0x591357['attribute']===!![]||_0x591357[_0x2b4eb5(0x104)]===''){const _0x1bbbd3=_0x4ca3d5['attributes']?.[_0x2b4eb5(0x14c)](_0x22b8cb=>_0x22b8cb[_0x2b4eb5(0x1e8)])||[];if(_0x1bbbd3[_0x2b4eb5(0x137)]===0x0)console[_0x2b4eb5(0x150)](a28_0x478b4a[_0x2b4eb5(0xe2)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x2b4eb5(0x150)](a28_0x478b4a['red'](_0x2b4eb5(0x1a0))),console[_0x2b4eb5(0x150)]('Available\x20attributes:');for(const _0x3e20ee of _0x1bbbd3){console[_0x2b4eb5(0x150)]('\x20\x20'+a28_0x478b4a[_0x2b4eb5(0xee)](_0x3e20ee));}console['error'](_0x2b4eb5(0xdb)+_0x1eff99+_0x2b4eb5(0x127)+_0x1bbbd3[0x0]+'\x22');}return 0x1;}if(_0x591357[_0x2b4eb5(0x115)]===!![]||_0x591357[_0x2b4eb5(0x115)]===''){const _0x4ebf18=_0x4ca3d5[_0x2b4eb5(0x1b7)]?.['map'](_0x3d43ef=>_0x3d43ef[_0x2b4eb5(0x1e8)])||[];if(_0x4ebf18[_0x2b4eb5(0x137)]===0x0)console[_0x2b4eb5(0x150)](a28_0x478b4a[_0x2b4eb5(0xe2)](_0x2b4eb5(0x126)));else{console[_0x2b4eb5(0x150)](a28_0x478b4a[_0x2b4eb5(0xe2)](_0x2b4eb5(0x1cf))),console[_0x2b4eb5(0x150)](_0x2b4eb5(0xda));for(const _0x5ea230 of _0x4ebf18){console[_0x2b4eb5(0x150)]('\x20\x20'+a28_0x478b4a[_0x2b4eb5(0xee)](_0x5ea230));}console[_0x2b4eb5(0x150)](_0x2b4eb5(0xdb)+_0x1eff99+_0x2b4eb5(0x174)+_0x4ebf18[0x0]+'\x22');}return 0x1;}const _0x29724b=createCommandSpinner(a28_0x478b4a[_0x2b4eb5(0x175)](_0x2b4eb5(0x1cb)),{'verbose':_0x591357[_0x2b4eb5(0xdd)]});_0x29724b[_0x2b4eb5(0x16a)]();const _0x3be1e5={'onProgress':_0x1a9597=>{const _0x3015c9=_0x2b4eb5;_0x29724b[_0x3015c9(0xf2)]=formatProgressMessage(_0x1a9597);}};if(_0x591357[_0x2b4eb5(0x13f)])_0x3be1e5[_0x2b4eb5(0x13f)]=!![];if(_0x591357[_0x2b4eb5(0x104)]&&typeof _0x591357[_0x2b4eb5(0x104)]==='string')_0x3be1e5[_0x2b4eb5(0x104)]=_0x591357[_0x2b4eb5(0x104)];if(_0x591357['behavior']&&typeof _0x591357['behavior']===_0x2b4eb5(0x173))_0x3be1e5[_0x2b4eb5(0x115)]=_0x591357[_0x2b4eb5(0x115)];if(_0x591357[_0x2b4eb5(0x11e)])_0x3be1e5[_0x2b4eb5(0x11e)]=!![];if(_0x591357[_0x2b4eb5(0xe7)])_0x3be1e5[_0x2b4eb5(0xe7)]=_0x591357[_0x2b4eb5(0xe7)];let _0x2e6e72;try{_0x2e6e72=await _0xc13dea['segment'][_0x2b4eb5(0x136)](_0x1641f7,_0x3be1e5),_0x29724b['stop']();}catch(_0x574ee3){_0x29724b[_0x2b4eb5(0x1a2)]();throw _0x574ee3;}return await this[_0x2b4eb5(0x1ac)](_0x2e6e72,{'master':_0x591357[_0x2b4eb5(0x13f)],'attribute':typeof _0x591357['attribute']===_0x2b4eb5(0x173)?_0x591357[_0x2b4eb5(0x104)]:undefined,'behavior':typeof _0x591357[_0x2b4eb5(0x115)]===_0x2b4eb5(0x173)?_0x591357['behavior']:undefined,'enriched':_0x591357[_0x2b4eb5(0x11e)]}),_0x2e6e72[_0x2b4eb5(0x103)]?0x0:0x1;}async['displayPreviewResults'](_0x503223,_0x1fb455){const _0x496f74=a28_0x169315;console[_0x496f74(0x150)]('\x0a'+a28_0x478b4a['bold'](_0x496f74(0x146))+'\x20'+_0x503223['name']),console['error']('═'[_0x496f74(0x105)](0x3c));if(_0x1fb455[_0x496f74(0x13f)]&&_0x503223[_0x496f74(0x14b)]){const _0x137c1e=a28_0x478b4a[_0x496f74(0x175)](_0x496f74(0xea))+'\x20'+a28_0x478b4a[_0x496f74(0x16f)](_0x503223[_0x496f74(0x13f)][_0x496f74(0x12e)]+'.'+_0x503223[_0x496f74(0x13f)]['table']);await this[_0x496f74(0xec)](_0x137c1e,_0x503223[_0x496f74(0x14b)]);}else{if(_0x1fb455[_0x496f74(0x104)]&&_0x503223[_0x496f74(0x14b)]){const _0x4a86c9=a28_0x478b4a[_0x496f74(0x175)](_0x496f74(0x10c))+'\x20'+a28_0x478b4a[_0x496f74(0x16f)](_0x1fb455[_0x496f74(0x104)]);await this['displaySampleData'](_0x4a86c9,_0x503223[_0x496f74(0x14b)]);}else{if(_0x1fb455[_0x496f74(0x115)]&&_0x503223[_0x496f74(0x14b)]){const _0x3f583a=a28_0x478b4a[_0x496f74(0x175)](_0x496f74(0x193))+'\x20'+a28_0x478b4a[_0x496f74(0x16f)](_0x1fb455['behavior']);await this[_0x496f74(0xec)](_0x3f583a,_0x503223['sampleData']);}else{if(_0x1fb455['enriched']&&_0x503223[_0x496f74(0x14b)]){const _0x1ab8e1=a28_0x478b4a[_0x496f74(0x175)](_0x496f74(0x162))+'\x20'+a28_0x478b4a[_0x496f74(0x16f)]('Master\x20+\x20Attributes');await this[_0x496f74(0xec)](_0x1ab8e1,_0x503223[_0x496f74(0x14b)]);}else!_0x503223[_0x496f74(0x14b)]&&console[_0x496f74(0x150)](_0x496f74(0x1c2));}}}if(_0x503223['errors'][_0x496f74(0x137)]>0x0){console[_0x496f74(0x150)]('─'[_0x496f74(0x105)](0x3c)),console['error']('\x0a'+a28_0x478b4a['red'](_0x496f74(0x11c)));for(const _0x3b6e3d of _0x503223[_0x496f74(0x19f)]){console['error']('\x20\x20'+a28_0x478b4a[_0x496f74(0xe2)]('•')+'\x20'+_0x3b6e3d);}}}async[a28_0x169315(0xec)](_0x3a0eaf,_0x2baed2){const _0x2c555d=a28_0x169315;if(_0x2baed2[_0x2c555d(0x137)]===0x0){console[_0x2c555d(0x150)]('\x0a'+_0x3a0eaf),console[_0x2c555d(0x150)](_0x2c555d(0x1a4));return;}console[_0x2c555d(0x150)]('\x0a'+_0x3a0eaf);const _0x30514e=Object[_0x2c555d(0x18c)](_0x2baed2[0x0])[_0x2c555d(0x14c)](_0x11c0f2=>({'name':_0x11c0f2,'type':typeof _0x2baed2[0x0][_0x11c0f2]===_0x2c555d(0x145)?_0x2c555d(0x1de):_0x2c555d(0x100)})),_0x5648a1={'queryId':_0x2c555d(0x1e2),'columns':_0x30514e,'data':_0x2baed2,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2baed2[_0x2c555d(0x137)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x527c1c=formatAsTable(_0x5648a1,_0x2baed2[_0x2c555d(0x137)],!![]);await writeOutput(_0x527c1c,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x189);[a28_0x169315(0x1c3)]=a28_0x169315(0x1ea);async['execute'](_0x30f477){const _0x261017=a28_0x169315,{options:_0x422f93,args:_0x2eba45,tdx:_0xc26d9c}=_0x30f477,_0x224051=_0x422f93,_0x389171=_0x2eba45[0x0]||_0x422f93[_0x261017(0x11d)];if(!_0x389171)return showParentSegmentNotSetError(_0x261017(0xd1)+_0x261017(0x113)),0x1;const _0x341e09=resolveYamlFile(_0x389171);if(existsSync(_0x341e09)){_0x224051[_0x261017(0xdd)]&&console[_0x261017(0x150)](_0x261017(0xd4)+_0x341e09);let _0x8af603;try{_0x8af603=readFileSync(_0x341e09,_0x261017(0xeb));}catch(_0x422401){const _0x3f82d5=_0x422401 instanceof Error?_0x422401['message']:String(_0x422401);return console[_0x261017(0x150)](_0x261017(0x152)+_0x3f82d5),0x1;}const _0x471872=await withSpinner('Analyzing\x20changes...',()=>_0xc26d9c[_0x261017(0x15b)][_0x261017(0x15a)](_0x8af603),{'verbose':_0x224051[_0x261017(0xdd)]}),_0xbfc3c2=_0x471872[_0x261017(0xcd)],{isNew:_0x4ef05c,name:_0x5eb0d7,hasChanges:_0x126f01,diffFormatted:_0x2db943}=_0xbfc3c2;if(_0x126f01){_0x4ef05c?console['error'](_0x261017(0x1c8)+_0x5eb0d7+'\x27:'):console[_0x261017(0x150)](_0x261017(0x119)+_0x5eb0d7+'\x27:');console[_0x261017(0x150)]('─'[_0x261017(0x105)](0x3c)),console['error'](_0x2db943),console['error']('─'[_0x261017(0x105)](0x3c));const _0x3fec20=_0x4ef05c?'Create\x20parent\x20segment\x20\x27'+_0x5eb0d7+_0x261017(0xd9):_0x261017(0x16b)+_0x5eb0d7+_0x261017(0xd9);if(!_0x224051[_0x261017(0x14a)]){const _0x3afcc8=await confirmKey(_0x3fec20);if(!_0x3afcc8)return console['error'](_0x261017(0x1c6)),0x1;}const _0x5ac4ea=_0x4ef05c?_0x261017(0xe4):_0x261017(0x153);await withSpinner(_0x5ac4ea+_0x261017(0x112)+_0x5eb0d7+_0x261017(0xd0),()=>_0xbfc3c2[_0x261017(0x12b)](),{'verbose':_0x224051['verbose']});const _0x15417d=_0x4ef05c?'Created':_0x261017(0x102);console[_0x261017(0x150)]('✔\x20'+_0x15417d+'\x20parent\x20segment\x20\x27'+_0x5eb0d7+'\x27');}else console[_0x261017(0x150)](_0x261017(0x1a5)+_0x5eb0d7+_0x261017(0x108));}const _0x7d48b8=await withSpinner(_0x261017(0x197)+_0x389171+_0x261017(0xd0),()=>_0xc26d9c[_0x261017(0x15b)][_0x261017(0x140)](_0x389171),{'verbose':_0x224051[_0x261017(0xdd)]}),_0xa6bd8c=_0x7d48b8[_0x261017(0xcd)],_0x121d7a=getConsoleUrl(_0x224051[_0x261017(0x147)],_0x261017(0x1bb)+_0xa6bd8c['workflowId']+_0x261017(0x143)+_0xa6bd8c['workflowSessionId']+'/attempt/'+_0xa6bd8c['workflowAttemptId']);return console[_0x261017(0x150)](_0x261017(0x16e)),console[_0x261017(0x150)]('\x20\x20'+a28_0x478b4a['dim']('Audience\x20ID:')+'\x20'+_0xa6bd8c[_0x261017(0x1e0)]),console[_0x261017(0x150)]('\x20\x20'+a28_0x478b4a['dim'](_0x261017(0x1b2))+'\x20'+_0xa6bd8c[_0x261017(0x15f)]),console['error']('\x20\x20'+a28_0x478b4a[_0x261017(0x175)](_0x261017(0x124))+'\x20'+_0xa6bd8c[_0x261017(0xdc)]),console[_0x261017(0x150)]('\x20\x20'+a28_0x478b4a['dim'](_0x261017(0x1ad))+'\x20'+_0xa6bd8c[_0x261017(0x156)]),console['error']('\x20\x20'+_0x121d7a),console[_0x261017(0x150)]('\x0a'+a28_0x478b4a[_0x261017(0x175)]('To\x20cancel:')+_0x261017(0x163)+_0xa6bd8c[_0x261017(0x156)]+_0x261017(0xc6)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x155);['description']=a28_0x169315(0x18e);async[a28_0x169315(0x1aa)](_0x36dd1c){const _0x3a4754=a28_0x169315,{options:_0x288ec3,args:_0x2da82c,tdx:_0xe70573}=_0x36dd1c,_0x26a1ca=_0x2da82c[0x0]||_0x288ec3[_0x3a4754(0x11d)];if(!_0x26a1ca)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x3a4754(0x1e6)),0x1;_0x288ec3[_0x3a4754(0xdd)]&&(console['error'](_0x3a4754(0xf4)+_0x288ec3[_0x3a4754(0x147)]),console['error'](_0x3a4754(0xf7)+_0x26a1ca));const _0x45e0e3=await withSpinner(_0x3a4754(0x13b)+_0x26a1ca+'\x27...',()=>_0xe70573[_0x3a4754(0x15b)]['listFields'](_0x26a1ca),{'verbose':_0x288ec3[_0x3a4754(0xdd)]}),_0x5643e1=_0x45e0e3['data'];console[_0x3a4754(0x150)]('✔\x20Found\x20'+_0x5643e1[_0x3a4754(0x137)]+'\x20field'+(_0x5643e1[_0x3a4754(0x137)]!==0x1?'s':''));if(_0x288ec3['json']||_0x288ec3[_0x3a4754(0xe3)])return await handleSDKOutput(_0x5643e1,_0x288ec3),0x0;return displayFieldsHumanReadable(_0x5643e1,_0x26a1ca),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x1b3);[a28_0x169315(0x1c3)]=a28_0x169315(0x116);async[a28_0x169315(0x1aa)](_0x4e47ab){const _0x4986bf=a28_0x169315,{options:_0x5cfab0,args:_0x173329,tdx:_0x186210}=_0x4e47ab,_0x544103=_0x5cfab0,_0x322d44=_0x173329[0x0]||_0x5cfab0['parentSegment'];if(!_0x322d44)return showParentSegmentNotSetError(_0x4986bf(0x187)+_0x4986bf(0xd6)+_0x4986bf(0x178)+_0x4986bf(0x18d)),0x1;_0x5cfab0[_0x4986bf(0xdd)]&&(console[_0x4986bf(0x150)](_0x4986bf(0xf4)+_0x5cfab0['site']),console[_0x4986bf(0x150)](_0x4986bf(0xf7)+_0x322d44));const _0x3a22d3=await withSpinner(_0x4986bf(0x10b)+_0x322d44+_0x4986bf(0xd0),()=>_0x186210[_0x4986bf(0x15b)][_0x4986bf(0x1c1)](_0x322d44),{'verbose':_0x5cfab0[_0x4986bf(0xdd)]}),_0x57c139=_0x3a22d3[_0x4986bf(0xcd)];if(_0x544103[_0x4986bf(0xe0)]){const _0x41e999=getConsoleNextUrl(_0x544103[_0x4986bf(0x147)],_0x4986bf(0x12f)+_0x57c139['id']);return console[_0x4986bf(0x150)](a28_0x478b4a['green']('✔')+_0x4986bf(0x168)+a28_0x478b4a[_0x4986bf(0xee)](_0x41e999)),openBrowser(_0x41e999),0x0;}return await handleSingleObjectOutput(_0x57c139,_0x5cfab0),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x164);[a28_0x169315(0x1c3)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a28_0x169315(0x1aa)](_0x51cca3){const _0x31db03=a28_0x169315,{options:_0x414edd,args:_0x2a29fd,tdx:_0x25b08e}=_0x51cca3,_0x40edfc=_0x2a29fd[0x0]||_0x414edd[_0x31db03(0x11d)];if(!_0x40edfc)return showParentSegmentNotSetError(_0x31db03(0x144)+_0x31db03(0x1e5)),0x1;_0x414edd[_0x31db03(0xdd)]&&(console[_0x31db03(0x150)](_0x31db03(0xf4)+_0x414edd['site']),console[_0x31db03(0x150)]('Parent\x20segment:\x20'+_0x40edfc));const _0x3a8fe0=await withSpinner(_0x31db03(0x11f)+_0x40edfc+'\x27...',()=>_0x25b08e['segment']['resolveParentId'](_0x40edfc),{'verbose':_0x414edd[_0x31db03(0xdd)]}),_0x1aca50=_0x3a8fe0[_0x31db03(0xcd)],_0x156f18=await withSpinner(_0x31db03(0xef)+_0x40edfc+'\x27...',()=>_0x25b08e[_0x31db03(0x15b)][_0x31db03(0x1db)](_0x1aca50),{'verbose':_0x414edd[_0x31db03(0xdd)]}),_0x24eb49=await executeSchemaQuery(_0x156f18[_0x31db03(0xcd)],_0x25b08e,_0x414edd);return await handleQueryOutput(_0x24eb49,_0x414edd),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x179);[a28_0x169315(0x1c3)]=a28_0x169315(0x11b);async[a28_0x169315(0x1aa)](_0x39bceb){const _0x26435d=a28_0x169315,{options:_0x2b0bb1,args:_0xbd1dfe,tdx:_0x5180b7}=_0x39bceb,_0x34bfd7=_0xbd1dfe[0x0]||_0x2b0bb1[_0x26435d(0x11d)];if(!_0x34bfd7)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'+_0x26435d(0x15c)),0x1;_0x2b0bb1['verbose']&&(console[_0x26435d(0x150)](_0x26435d(0xf4)+_0x2b0bb1[_0x26435d(0x147)]),console[_0x26435d(0x150)]('Parent\x20segment:\x20'+_0x34bfd7));const _0x573909=await withSpinner(_0x26435d(0x11f)+_0x34bfd7+_0x26435d(0xd0),()=>_0x5180b7[_0x26435d(0x15b)][_0x26435d(0x1af)](_0x34bfd7),{'verbose':_0x2b0bb1[_0x26435d(0xdd)]}),_0x31bc6c=_0x573909[_0x26435d(0xcd)],_0x1a7a30=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x34bfd7+'\x27...',()=>_0x5180b7['segment'][_0x26435d(0x1db)](_0x31bc6c),{'verbose':_0x2b0bb1[_0x26435d(0xdd)]}),_0x46898b=_0x1a7a30[_0x26435d(0xcd)];return _0x2b0bb1[_0x26435d(0x141)]===_0x26435d(0xe5)||_0x2b0bb1[_0x26435d(0x141)]===_0x26435d(0xe3)?await handleSDKOutput([{'sql':_0x46898b}],_0x2b0bb1):console[_0x26435d(0x1d1)](_0x46898b),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a28_0x169315(0x1e8)]=a28_0x169315(0x1da);['description']=a28_0x169315(0xf0);async[a28_0x169315(0x1aa)](_0x548c1f){const _0x26167f=a28_0x169315,{options:_0xd798a,args:_0x10629d,tdx:_0x3147ae}=_0x548c1f,_0x21c1bd=_0x10629d[0x0]||_0xd798a[_0x26167f(0x11d)];if(!_0x21c1bd)return showParentSegmentNotSetError(_0x26167f(0x114)+_0x26167f(0xc5)),0x1;_0xd798a[_0x26167f(0xdd)]&&(console[_0x26167f(0x150)](_0x26167f(0xf4)+_0xd798a['site']),console['error']('Parent\x20segment:\x20'+_0x21c1bd));const _0xb284bd=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x21c1bd+'\x27...',()=>_0x3147ae[_0x26167f(0x15b)]['resolveParentId'](_0x21c1bd),{'verbose':_0xd798a[_0x26167f(0xdd)]}),_0x4c8abd=_0xb284bd[_0x26167f(0xcd)],_0x4e55df=await withSpinner(_0x26167f(0xef)+_0x21c1bd+'\x27...',()=>_0x3147ae[_0x26167f(0x15b)][_0x26167f(0x1db)](_0x4c8abd),{'verbose':_0xd798a[_0x26167f(0xdd)]});let _0x5341dd=_0x4e55df[_0x26167f(0xcd)];const _0x4511b7=resolveLimit(_0xd798a[_0x26167f(0x13e)],DEFAULT_DISPLAY_LIMIT),_0xe58f1b=/\bLIMIT\s+\d+/i[_0x26167f(0x17a)](_0x5341dd);!_0xe58f1b&&(_0x5341dd=_0x5341dd['trim']()['replace'](/;+$/,''),_0x5341dd=_0x26167f(0x17f)+_0x5341dd+_0x26167f(0x117)+_0x4511b7);_0xd798a[_0x26167f(0xdd)]&&console[_0x26167f(0x150)](_0x26167f(0xc2)+_0x5341dd);const _0x18dd01=await withQuerySpinner('Executing\x20parent\x20segment\x20query...',async _0x1c113b=>{const _0x85fb81=_0x26167f,_0x3b5c69=await _0x3147ae['query'][_0x85fb81(0x1aa)](_0x5341dd,{'catalog':'td','schema':_0x85fb81(0x181),'onJobId':_0x2a802f=>{const _0x2b7237=_0x85fb81;_0x1c113b[_0x2b7237(0x1d2)](_0x2a802f);}});return _0x3b5c69;},{'verbose':_0xd798a['verbose']}),_0x4d5af4=_0x18dd01[_0x26167f(0xcd)],_0x1cdae1=_0x4d5af4[_0x26167f(0x132)]?_0x26167f(0x19c)+_0x4d5af4[_0x26167f(0x132)]+']':'';return console[_0x26167f(0x150)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x4d5af4['stats']['processedRows'][_0x26167f(0x1ae)]()+_0x26167f(0x1bf)+(_0x26167f(0x1a7)+formatElapsed(_0x4d5af4['stats'][_0x26167f(0x10e)])+_0x1cdae1)),await handleQueryOutput(_0x4d5af4,_0xd798a),0x0;}}
1
+ const a28_0x2abed2=a28_0x1b8f;(function(_0x21d090,_0x7adf50){const _0xe792d6=a28_0x1b8f,_0xbfa133=_0x21d090();while(!![]){try{const _0x4dbc2e=-parseInt(_0xe792d6(0x201))/0x1*(parseInt(_0xe792d6(0x196))/0x2)+-parseInt(_0xe792d6(0x213))/0x3+-parseInt(_0xe792d6(0x28d))/0x4*(-parseInt(_0xe792d6(0x2b6))/0x5)+-parseInt(_0xe792d6(0x20f))/0x6+-parseInt(_0xe792d6(0x231))/0x7+-parseInt(_0xe792d6(0x2a3))/0x8*(-parseInt(_0xe792d6(0x24c))/0x9)+parseInt(_0xe792d6(0x2b4))/0xa;if(_0x4dbc2e===_0x7adf50)break;else _0xbfa133['push'](_0xbfa133['shift']());}catch(_0x44b77a){_0xbfa133['push'](_0xbfa133['shift']());}}}(a28_0x2e2c,0x81ef9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a28_0x55bf65 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a28_0x595089 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a28_0x2abed2(0x292);function openBrowser(_0x45cd8e){const _0x17841f=a28_0x2abed2,_0x3c98ee=process[_0x17841f(0x1e5)],_0x457203=_0x3c98ee===_0x17841f(0x1b0)?_0x17841f(0x1fb):_0x3c98ee==='win32'?'start':_0x17841f(0x1b1);spawn(_0x457203,[_0x45cd8e],{'detached':!![],'stdio':_0x17841f(0x1be)})[_0x17841f(0x288)]();}function migrateLegacyDirectory(){const _0x31ea28=a28_0x2abed2;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x573c4c=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x573c4c['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x31ea28(0x29e)](a28_0x595089[_0x31ea28(0x19a)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x31ea28(0x216)+PARENT_SEGMENT_DIR+_0x31ea28(0x223))),console[_0x31ea28(0x29e)](a28_0x595089[_0x31ea28(0x2af)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x31ea28(0x241))),![];console[_0x31ea28(0x29e)](a28_0x595089['yellow'](_0x31ea28(0x258)+LEGACY_PARENT_SEGMENT_DIR+_0x31ea28(0x195)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x31ea28(0x29e)](a28_0x595089['green'](_0x31ea28(0x1a7)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x230157){const _0x1550f5=_0x230157 instanceof Error?_0x230157[_0x31ea28(0x1c6)]:String(_0x230157);return console[_0x31ea28(0x29e)](a28_0x595089[_0x31ea28(0x205)](_0x31ea28(0x28b)+_0x1550f5+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a28_0x2abed2(0x22e)](_0x3be120){const _0x4624f4=a28_0x2abed2;return migrateLegacyDirectory(),super[_0x4624f4(0x22e)](_0x3be120);}}function resolveYamlFile(_0x3067e6){const _0xde926d=a28_0x2abed2;if(_0x3067e6['endsWith'](_0xde926d(0x1d4))||_0x3067e6[_0xde926d(0x1e2)](_0xde926d(0x1a1)))return _0x3067e6;return a28_0x55bf65[_0xde926d(0x29c)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3067e6)+_0xde926d(0x1d4));}function formatProgressMessage(_0x287e79){const _0x1ff917=a28_0x2abed2,_0x5ed7f5=_0x287e79['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5ed7f5){const [,_0x2c5f15,_0x1f6e6c,_0xd0624='']=_0x5ed7f5;return a28_0x595089[_0x1ff917(0x2af)](_0x2c5f15+':')+'\x20'+_0x1f6e6c+a28_0x595089['dim'](_0xd0624);}return a28_0x595089[_0x1ff917(0x2af)](_0x287e79);}function showFileNotFoundError(_0x36d4ba,_0x29a21c){const _0x31bee9=a28_0x2abed2;console['error'](a28_0x595089[_0x31bee9(0x205)](_0x31bee9(0x1e3)+_0x36d4ba+'\x0a')),console[_0x31bee9(0x29e)](a28_0x595089['cyan'](_0x31bee9(0x254)+_0x29a21c+_0x31bee9(0x194)));}function showParentSegmentNotSetError(_0x3cf70c){const _0x11381d=a28_0x2abed2;console[_0x11381d(0x29e)](a28_0x595089['yellow'](_0x11381d(0x261))),console[_0x11381d(0x29e)](_0x3cf70c);}export class ParentSegmentListCommand extends BaseCommand{['name']=a28_0x2abed2(0x19d);[a28_0x2abed2(0x1f3)]='List\x20parent\x20segments';async[a28_0x2abed2(0x1e1)](_0x16606c){const _0x5f555f=a28_0x2abed2,{options:_0x41bc06,args:_0x17af1f,tdx:_0x48f99b}=_0x16606c,_0x4894c7=_0x17af1f[0x0];_0x41bc06['verbose']&&(console[_0x5f555f(0x29e)]('Site:\x20'+_0x41bc06[_0x5f555f(0x1ec)]),_0x4894c7&&console[_0x5f555f(0x29e)](_0x5f555f(0x262)+_0x4894c7));const _0x228562=await withSpinner(_0x4894c7?_0x5f555f(0x26c)+_0x4894c7+_0x5f555f(0x26d):_0x5f555f(0x2a9),()=>_0x48f99b['segment'][_0x5f555f(0x24b)](),{'verbose':_0x41bc06[_0x5f555f(0x1e7)]});let _0x5a0450=_0x228562['data'];if(_0x4894c7){const _0x4246ec=_0x4894c7[_0x5f555f(0x25b)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x5f555f(0x25b)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x477cb6=new RegExp('^'+_0x4246ec+'$','i');_0x5a0450=_0x5a0450[_0x5f555f(0x285)](_0x32de5c=>_0x477cb6[_0x5f555f(0x299)](_0x32de5c[_0x5f555f(0x198)][_0x5f555f(0x1fe)]));}_0x5a0450[_0x5f555f(0x1ca)]((_0x326e7e,_0xae00ec)=>_0x326e7e['attributes'][_0x5f555f(0x1fe)][_0x5f555f(0x1c7)](_0xae00ec[_0x5f555f(0x198)][_0x5f555f(0x1fe)])),console['error'](_0x5f555f(0x1d7)+_0x5a0450[_0x5f555f(0x19c)]+'\x20parent\x20segment'+(_0x5a0450[_0x5f555f(0x19c)]!==0x1?'s':''));if(_0x41bc06[_0x5f555f(0x1fd)]===_0x5f555f(0x273)||_0x41bc06[_0x5f555f(0x1fd)]===_0x5f555f(0x234))await handleSDKOutput(_0x5a0450,_0x41bc06);else{if(_0x5a0450[_0x5f555f(0x19c)]===0x0)_0x4894c7?console[_0x5f555f(0x1cd)](_0x5f555f(0x1ac)+_0x4894c7):console['log'](_0x5f555f(0x192));else for(const _0x1d4ded of _0x5a0450){const _0x488aa1=_0x1d4ded[_0x5f555f(0x198)][_0x5f555f(0x29b)]?a28_0x595089[_0x5f555f(0x2af)]('\x20('+formatRows(_0x1d4ded[_0x5f555f(0x198)]['population'])+')'):'';console[_0x5f555f(0x1cd)](_0x5f555f(0x1ab)+_0x1d4ded[_0x5f555f(0x198)][_0x5f555f(0x1fe)]+_0x488aa1);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x1f2);[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x202);async[a28_0x2abed2(0x1e1)](_0x279bbd){const _0x578b4f=a28_0x2abed2,{options:_0x3baddf,args:_0x2a15c3,tdx:_0x1efc96}=_0x279bbd;console[_0x578b4f(0x29e)]('\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'+_0x578b4f(0x214));const _0x344e94=_0x3baddf;if(_0x2a15c3[_0x578b4f(0x19c)]===0x0)return console[_0x578b4f(0x29e)](a28_0x595089[_0x578b4f(0x205)](_0x578b4f(0x245))),console[_0x578b4f(0x29e)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x397cb6=_0x2a15c3[0x0];if(!_0x344e94[_0x578b4f(0x1b5)]||!_0x344e94[_0x578b4f(0x22a)])return console[_0x578b4f(0x29e)](_0x578b4f(0x219)),console[_0x578b4f(0x29e)](_0x578b4f(0x1f6)),0x1;_0x344e94[_0x578b4f(0x1e7)]&&(console[_0x578b4f(0x29e)](_0x578b4f(0x244)+_0x344e94['site']),console[_0x578b4f(0x29e)](_0x578b4f(0x1b8)+_0x397cb6),console[_0x578b4f(0x29e)](_0x578b4f(0x1a8)+_0x344e94[_0x578b4f(0x1b5)]),console[_0x578b4f(0x29e)]('Table:\x20'+_0x344e94[_0x578b4f(0x22a)]));const _0x3a45cc=await loadJSONFromOptions(_0x344e94[_0x578b4f(0x198)],_0x344e94['attributesFile']),_0x514b08=await loadJSONFromOptions(_0x344e94['behaviors'],_0x344e94['behaviorsFile']),_0x47e5a9=await loadJSONFromOptions(_0x344e94[_0x578b4f(0x210)],_0x344e94[_0x578b4f(0x1b7)]),_0x2b1987={'name':_0x397cb6,'description':_0x344e94[_0x578b4f(0x1f3)],'scheduleType':_0x344e94[_0x578b4f(0x291)],'scheduleOption':_0x344e94['scheduleOption'],'timezone':_0x344e94[_0x578b4f(0x215)],'master':{'parentDatabaseName':_0x344e94[_0x578b4f(0x1b5)],'parentTableName':_0x344e94[_0x578b4f(0x22a)]},'attributes':_0x3a45cc,'behaviors':_0x514b08,'customerGroup':_0x47e5a9},_0x2c6a12=await withSpinner(_0x578b4f(0x27b)+_0x397cb6+_0x578b4f(0x26d),()=>_0x1efc96[_0x578b4f(0x1bb)][_0x578b4f(0x1e8)](_0x2b1987),{'verbose':_0x3baddf[_0x578b4f(0x1e7)]}),_0x39e18a=_0x2c6a12[_0x578b4f(0x1e0)];return console[_0x578b4f(0x29e)](_0x578b4f(0x270)+_0x39e18a[_0x578b4f(0x1fe)]+'\x27\x20with\x20ID:\x20'+_0x39e18a['id']),await handleSDKOutput([_0x39e18a],_0x3baddf),0x0;}}function a28_0x2e2c(){const _0x44d887=['label','format','name','workflowSessionId','Validate:','3IsEVmJ','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Events:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','red','YAML\x20file:\x20','\x0a✔\x20Workflow\x20started','\x20Context\x20set:\x20','Master:','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x0aNo\x20sample\x20data\x20available','workflowId','Columns:','schemaValid','4210302TXRmwX','customerGroup','Options\x20(one\x20required):\x0a','\x27\x20is\x20already\x20up\x20to\x20date','575259lyhArB','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','timezone','/\x20and\x20','totalEvents','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Master\x20+\x20Attributes','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','toFixed','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','text','✔\x20Query\x20completed:\x20Processed\x20','/\x20directories\x20exist.','/sessions/','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','getParentSQL','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','processedRows','start','table','Fetching\x20sample\x20data...','\x20parent\x20segment\x20\x27','/attempt/','run','Join\x20on:','Updated','7126371cypzgr','displaySummary','Source:','jsonl','segment:parent:sql','joinKey','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Attributes','sampleData','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Options:\x0a','workflowAttemptId','Error:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','/\x20directory.\x0a','Available\x20attributes:','resolveParentId','Site:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20SQL\x20for\x20\x27','Customers:','segment:parent:fields','repeat','stats','listParents','63nfKMWd','schemaError','output','\x20\x20\x20\x20-\x20','Found\x20YAML\x20file:\x20','\x20No\x20changes\x20-\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','displayAttributesStats','segment:parent:view','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20Migrating:\x20','dirname','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','replace','customersWithEvents','\x20tdx\x20wf\x20attempt\x20','apply','segment:parent:pull','in\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Pattern:\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20--behavior\x20\x22','enriched','all','Updating\x20parent\x20segment\x20\x27','yes','SQL\x20query:\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','status','Listing\x20parent\x20segments\x20matching\x20\x27','\x27...','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20--enriched','✔\x20Created\x20parent\x20segment\x20\x27','foreignKey','session','json','/app/workflows/','segment:parent:push','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','scheduleOption','addBehaviors','Analyzing\x20changes...','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Creating\x20parent\x20segment\x20\x27','\x20--behavior\x20\x22<name>\x22','segment:parent:update','matchedCount','Audience\x20ID:','interval','addAttributes','Apply\x20changes\x20to\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','filter','errors','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','unref','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','pushParentYaml','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20field','40fqSUXY','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','segment:parent:preview','map','scheduleType','parent_segment','Attribute:','allValid','\x20is\x20already\x20up\x20to\x20date','use','Validating\x20configuration...','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','test','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','population','join','customerPercent','error','Creating','Status:','segment:parent:show','setJobId','1075592qPtbua','✔\x20No\x20changes\x20-\x20\x27','behavior','trim','displayPreviewHints','displayValidateResults','Listing\x20parent\x20segments...','Master\x20Table','green','displayColumns','Options:','Errors:','dim','limit','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','varchar','stop','12620090IBkZVm','number','417405WremEQ','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20[Job\x20ID:\x20','Join:','rowCount','Created','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Opening\x20','No\x20parent\x20segments\x20found','Parent\x20segment:\x20','`\x20to\x20download\x20the\x20configuration\x20first','/\x20→\x20','396148QoApuu','Fetching\x20parent\x20segment\x20\x27','attributes','displayBehaviorsStats','yellow','toLocaleString','length','segment:parent:list','-1d','updateParent','getParentFull','.yaml','parentSegment','displaySampleData','segment:parent:validate','Executing\x20parent\x20segment\x20query...','preview','✔\x20Renamed\x20directory\x20to\x20','Database:\x20','string','cyan','👥\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20kill','information_schema','/{name}.yml\x0a','darwin','xdg-open','Updating','Create\x20parent\x20segment\x20\x27','previewParentYaml','database','Attempt:','customerGroupFile','Name:\x20','SELECT\x20*\x20FROM\x20(\x0a','Error\x20reading\x20file:\x20','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x0aUsage:\x20tdx\x20ps\x20preview\x20','ignore','jobId','columns','addBehaviorsFile','tdx\x20segment\x20parent\x20preview\x20','\x20=\x20','displayMasterInfo','/app/dw/parentSegments/','message','localeCompare','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','behaviors','sort','Available\x20behaviors:','column','log','utf-8','Rows:','audienceId','Show\x20parent\x20segment\x20details','web','bold','.yml','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Output\x20file:\x20','✔\x20Found\x20','%)\x20','Listing\x20fields\x20for\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x27\x20is\x20up\x20to\x20date','To\x20view\x20sample\x20data:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','coveragePercent','Behaviors','data','execute','endsWith','Error:\x20File\x20not\x20found:\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','platform','Enriched:','verbose','createParent','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','displayPreviewResults','validateParentYaml','site','attribute','\x20rows)','\x0aNew\x20parent\x20segment\x20\x27','addAttributesFile','Session:','segment:parent:create','description','master','\x27\x20and\x20run\x20workflow?','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20rows\x20','\x20\x20No\x20sample\x20data\x20available','Resolving\x20parent\x20segment\x20\x27','Aborted.','open'];a28_0x2e2c=function(){return _0x44d887;};return a28_0x2e2c();}export class ParentSegmentUpdateCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x27d);[a28_0x2abed2(0x1f3)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a28_0x2abed2(0x1e1)](_0x24fc67){const _0x3c1f4d=a28_0x2abed2,{options:_0x49db73,args:_0x422aaf,tdx:_0x4756fb}=_0x24fc67;console[_0x3c1f4d(0x29e)](_0x3c1f4d(0x21e)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x47c9de=_0x49db73;if(_0x422aaf['length']===0x0)return console[_0x3c1f4d(0x29e)](a28_0x595089['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x3c1f4d(0x29e)](_0x3c1f4d(0x263)),0x1;const _0x38ef89=_0x422aaf[0x0];_0x47c9de['verbose']&&(console[_0x3c1f4d(0x29e)](_0x3c1f4d(0x244)+_0x47c9de[_0x3c1f4d(0x1ec)]),console[_0x3c1f4d(0x29e)](_0x3c1f4d(0x193)+_0x38ef89));const _0x50ef7a=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x38ef89+_0x3c1f4d(0x26d),()=>_0x4756fb['segment'][_0x3c1f4d(0x1a0)](_0x38ef89),{'verbose':_0x47c9de[_0x3c1f4d(0x1e7)]}),_0x66e5c5=_0x50ef7a[_0x3c1f4d(0x1e0)],_0x39e55b=await loadJSONFromOptions(_0x47c9de[_0x3c1f4d(0x281)],_0x47c9de[_0x3c1f4d(0x1f0)]),_0x387507=await loadJSONFromOptions(_0x47c9de[_0x3c1f4d(0x278)],_0x47c9de[_0x3c1f4d(0x1c1)]),_0x3c059b={'name':_0x66e5c5[_0x3c1f4d(0x1fe)],'description':_0x47c9de[_0x3c1f4d(0x1f3)]!==undefined?_0x47c9de['description']:_0x66e5c5[_0x3c1f4d(0x1f3)],'scheduleType':_0x47c9de['scheduleType']!==undefined?_0x47c9de[_0x3c1f4d(0x291)]:_0x66e5c5['scheduleType'],'scheduleOption':_0x47c9de['scheduleOption']!==undefined?_0x47c9de[_0x3c1f4d(0x277)]:_0x66e5c5[_0x3c1f4d(0x277)],'timezone':_0x47c9de[_0x3c1f4d(0x215)]!==undefined?_0x47c9de[_0x3c1f4d(0x215)]:_0x66e5c5[_0x3c1f4d(0x215)],'master':_0x66e5c5[_0x3c1f4d(0x1f4)],'attributes':_0x39e55b?[..._0x66e5c5[_0x3c1f4d(0x198)]||[],..._0x39e55b]:_0x66e5c5[_0x3c1f4d(0x198)],'behaviors':_0x387507?[..._0x66e5c5['behaviors']||[],..._0x387507]:_0x66e5c5[_0x3c1f4d(0x1c9)],'customerGroup':_0x66e5c5[_0x3c1f4d(0x210)]},_0x1dc335=await withSpinner(_0x3c1f4d(0x267)+_0x38ef89+_0x3c1f4d(0x26d),()=>_0x4756fb['segment'][_0x3c1f4d(0x19f)](_0x38ef89,_0x3c059b),{'verbose':_0x47c9de[_0x3c1f4d(0x1e7)]}),_0x322d9d=_0x1dc335[_0x3c1f4d(0x1e0)];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x322d9d[_0x3c1f4d(0x1fe)]+'\x27'),await handleSDKOutput([_0x322d9d],_0x47c9de),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a28_0x2abed2(0x25f);[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x20a);async[a28_0x2abed2(0x1e1)](_0x525fdf){const _0x8c1167=a28_0x2abed2,{options:_0x2ef19d,args:_0x12853d,tdx:_0x49500e}=_0x525fdf,_0x242383=_0x2ef19d,_0xa6aca6=_0x12853d[0x0]||_0x2ef19d[_0x8c1167(0x1a2)];if(!_0xa6aca6)return showParentSegmentNotSetError(_0x8c1167(0x204)+_0x8c1167(0x238)),0x1;if(_0x242383[_0x8c1167(0x296)]&&_0x242383['output'])return console[_0x8c1167(0x29e)](a28_0x595089[_0x8c1167(0x205)](_0x8c1167(0x1da))),console[_0x8c1167(0x29e)](a28_0x595089['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x8c1167(0x29e)](a28_0x595089[_0x8c1167(0x2af)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x8c1167(0x1af))),console[_0x8c1167(0x29e)](a28_0x595089['cyan'](_0x8c1167(0x252))),0x1;const _0x3761af=_0x242383[_0x8c1167(0x24e)]||a28_0x55bf65[_0x8c1167(0x29c)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xa6aca6)+_0x8c1167(0x1d4));_0x242383[_0x8c1167(0x1e7)]&&(console['error'](_0x8c1167(0x244)+_0x242383[_0x8c1167(0x1ec)]),console['error'](_0x8c1167(0x193)+_0xa6aca6),console[_0x8c1167(0x29e)](_0x8c1167(0x1d6)+_0x3761af));const _0x28e728=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xa6aca6+_0x8c1167(0x26d),()=>_0x49500e['segment']['pullParentYaml'](_0xa6aca6),{'verbose':_0x242383['verbose']}),_0x42de1c=_0x28e728[_0x8c1167(0x1e0)];if(existsSync(_0x3761af)){const _0x295374=readFileSync(_0x3761af,_0x8c1167(0x1ce)),_0x45227c=generateDiff(_0x295374,_0x42de1c);if(!hasChanges(_0x45227c))console[_0x8c1167(0x29e)](a28_0x595089[_0x8c1167(0x2ab)]('✔')+_0x8c1167(0x251)+a28_0x595089[_0x8c1167(0x1aa)](_0x3761af)+_0x8c1167(0x295));else{console[_0x8c1167(0x29e)]('\x0aChanges\x20to\x20\x27'+_0x3761af+'\x27:'),console['error']('─'[_0x8c1167(0x249)](0x3c)),console['error'](formatDiffWithColors(_0x45227c)),console[_0x8c1167(0x29e)]('─'[_0x8c1167(0x249)](0x3c));if(!_0x242383[_0x8c1167(0x268)]){const _0x16f2ae=await confirmKey('Overwrite\x20\x27'+_0x3761af+'\x27?');if(!_0x16f2ae)return console[_0x8c1167(0x29e)](_0x8c1167(0x1fa)),0x1;}writeFileSync(_0x3761af,_0x42de1c,_0x8c1167(0x1ce)),console[_0x8c1167(0x29e)](a28_0x595089[_0x8c1167(0x2ab)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a28_0x595089[_0x8c1167(0x1aa)](_0x3761af));}}else{const _0x36f0c4=a28_0x55bf65[_0x8c1167(0x259)](_0x3761af);!existsSync(_0x36f0c4)&&mkdirSync(_0x36f0c4,{'recursive':!![]}),writeFileSync(_0x3761af,_0x42de1c,_0x8c1167(0x1ce)),console['error'](a28_0x595089[_0x8c1167(0x2ab)]('✔')+_0x8c1167(0x1e9)+a28_0x595089[_0x8c1167(0x1aa)](_0x3761af));}return saveSessionContext({'parent_segment':_0xa6aca6},_0x242383[_0x8c1167(0x272)]),console[_0x8c1167(0x29e)](a28_0x595089[_0x8c1167(0x2ab)]('✔')+_0x8c1167(0x208)+a28_0x595089[_0x8c1167(0x2af)](_0x8c1167(0x292))+_0x8c1167(0x1c3)+a28_0x595089['cyan'](_0xa6aca6)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x275);['description']=a28_0x2abed2(0x253);async[a28_0x2abed2(0x1e1)](_0x4b1e45){const _0x39f1b8=a28_0x2abed2,{options:_0x455cbd,args:_0xeb3a57,tdx:_0x407e0b}=_0x4b1e45,_0x30c0f0=_0x455cbd,_0x24bc94=_0xeb3a57[0x0]||_0x455cbd[_0x39f1b8(0x1a2)];if(!_0x24bc94)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x13b471=resolveYamlFile(_0x24bc94);if(!existsSync(_0x13b471))return showFileNotFoundError(_0x13b471,_0x24bc94),0x1;_0x30c0f0[_0x39f1b8(0x1e7)]&&(console[_0x39f1b8(0x29e)](_0x39f1b8(0x244)+_0x30c0f0['site']),console[_0x39f1b8(0x29e)](_0x39f1b8(0x206)+_0x13b471));let _0x24d7cd;try{_0x24d7cd=readFileSync(_0x13b471,_0x39f1b8(0x1ce));}catch(_0x4e2baa){const _0x17e5b3=_0x4e2baa instanceof Error?_0x4e2baa[_0x39f1b8(0x1c6)]:String(_0x4e2baa);return console[_0x39f1b8(0x29e)]('Error\x20reading\x20file:\x20'+_0x17e5b3),0x1;}const _0x1c2eda=await withSpinner(_0x39f1b8(0x279),()=>_0x407e0b[_0x39f1b8(0x1bb)][_0x39f1b8(0x28a)](_0x24d7cd),{'verbose':_0x30c0f0[_0x39f1b8(0x1e7)]}),_0x61184e=_0x1c2eda[_0x39f1b8(0x1e0)],{isNew:_0x197fd1,name:_0x45d430,hasChanges:_0x1a42eb,diffFormatted:_0x11b819}=_0x61184e;if(!_0x1a42eb)return console[_0x39f1b8(0x29e)](_0x39f1b8(0x2a4)+_0x45d430+_0x39f1b8(0x212)),0x0;_0x197fd1?console[_0x39f1b8(0x29e)](_0x39f1b8(0x1ef)+_0x45d430+'\x27:'):console[_0x39f1b8(0x29e)](_0x39f1b8(0x23b)+_0x45d430+'\x27:');console['error']('─'[_0x39f1b8(0x249)](0x3c)),console[_0x39f1b8(0x29e)](_0x11b819),console[_0x39f1b8(0x29e)]('─'[_0x39f1b8(0x249)](0x3c));const _0x2e2ff7=_0x197fd1?_0x39f1b8(0x1b3)+_0x45d430+'\x27?':_0x39f1b8(0x282)+_0x45d430+'\x27?';if(!_0x30c0f0[_0x39f1b8(0x268)]){const _0x4b5150=await confirmKey(_0x2e2ff7);if(!_0x4b5150)return console[_0x39f1b8(0x29e)](_0x39f1b8(0x1fa)),0x1;}const _0x5819bd=_0x197fd1?_0x39f1b8(0x29f):_0x39f1b8(0x1b2),_0x509ce8=await withSpinner(_0x5819bd+'\x20parent\x20segment\x20\x27'+_0x45d430+_0x39f1b8(0x26d),()=>_0x61184e[_0x39f1b8(0x25e)](),{'verbose':_0x30c0f0[_0x39f1b8(0x1e7)]}),_0x21d3fc=_0x509ce8['data'],_0x4c891d=getConsoleNextUrl(_0x30c0f0[_0x39f1b8(0x1ec)],_0x39f1b8(0x1c5)+_0x21d3fc['id']),_0x27cbc4=_0x197fd1?'Created':_0x39f1b8(0x230);return console['error']('✔\x20'+_0x27cbc4+_0x39f1b8(0x22c)+_0x21d3fc[_0x39f1b8(0x1fe)]+'\x27'),console['error']('\x20\x20'+_0x4c891d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x1a4);['description']=a28_0x2abed2(0x21a);async[a28_0x2abed2(0x1e1)](_0x907df8){const _0x363723=a28_0x2abed2,{options:_0xa00cd6,args:_0xcd38bd,tdx:_0x290bf8}=_0x907df8,_0x2f5e26=_0xa00cd6,_0x24bce0=_0xcd38bd[0x0]||_0xa00cd6[_0x363723(0x1a2)];if(!_0x24bce0)return showParentSegmentNotSetError(_0x363723(0x26a)+_0x363723(0x18f)+_0x363723(0x23d)+_0x363723(0x289)+_0x363723(0x21d)+_0x363723(0x240)),0x1;const _0x17de0f=resolveYamlFile(_0x24bce0);if(!existsSync(_0x17de0f))return showFileNotFoundError(_0x17de0f,_0x24bce0),0x1;_0x2f5e26[_0x363723(0x1e7)]&&(console[_0x363723(0x29e)](_0x363723(0x244)+_0x2f5e26['site']),console['error'](_0x363723(0x206)+_0x17de0f));let _0x1871cd;try{_0x1871cd=readFileSync(_0x17de0f,_0x363723(0x1ce));}catch(_0x76d07b){const _0x2f34ad=_0x76d07b instanceof Error?_0x76d07b[_0x363723(0x1c6)]:String(_0x76d07b);return console['error'](_0x363723(0x1ba)+_0x2f34ad),0x1;}const _0x503f0d=createCommandSpinner(a28_0x595089[_0x363723(0x2af)](_0x363723(0x297)),{'verbose':_0x2f5e26[_0x363723(0x1e7)]});_0x503f0d[_0x363723(0x229)]();const _0x10c16f={'onProgress':_0x3ae526=>{const _0x5e6cdc=_0x363723;_0x503f0d[_0x5e6cdc(0x221)]=formatProgressMessage(_0x3ae526);}};if(_0x2f5e26[_0x363723(0x1f4)])_0x10c16f[_0x363723(0x1f4)]=!![];if(_0x2f5e26[_0x363723(0x265)])_0x10c16f['enriched']=!![];_0x2f5e26[_0x363723(0x1ed)]&&(_0x10c16f[_0x363723(0x1ed)]=_0x2f5e26[_0x363723(0x1ed)]);_0x2f5e26[_0x363723(0x2a5)]&&(_0x10c16f[_0x363723(0x2a5)]=_0x2f5e26[_0x363723(0x2a5)]);if(_0x2f5e26[_0x363723(0x280)])_0x10c16f[_0x363723(0x280)]=_0x2f5e26[_0x363723(0x280)];let _0x41f402;try{_0x41f402=await _0x290bf8[_0x363723(0x1bb)][_0x363723(0x1eb)](_0x1871cd,_0x10c16f),_0x503f0d[_0x363723(0x2b3)]();}catch(_0x5643e0){_0x503f0d[_0x363723(0x2b3)]();throw _0x5643e0;}const _0x407728=_0x2f5e26[_0x363723(0x280)]||_0x363723(0x19e);return this[_0x363723(0x2a8)](_0x41f402,_0x10c16f,_0x17de0f,_0x407728),_0x41f402[_0x363723(0x294)]?0x0:0x1;}[a28_0x2abed2(0x2a8)](_0x4d250d,_0x4d16e0,_0x448fd3,_0x3d6924){const _0x3d3310=a28_0x2abed2;console['error']('\x0a'+a28_0x595089[_0x3d3310(0x1d3)](_0x3d3310(0x200))+'\x20'+_0x4d250d['name']),console[_0x3d3310(0x29e)]('═'['repeat'](0x3c)),this[_0x3d3310(0x1c4)](_0x4d250d);if(typeof _0x4d16e0[_0x3d3310(0x1ed)]===_0x3d3310(0x1a9)){this['displayAttributesStats'](_0x4d250d),this[_0x3d3310(0x232)](_0x4d250d),this[_0x3d3310(0x2a7)](_0x448fd3,_0x3d6924,_0x3d3310(0x1ed),_0x4d16e0[_0x3d3310(0x1ed)]);return;}if(_0x4d16e0['attribute']===!![]){this[_0x3d3310(0x255)](_0x4d250d),this[_0x3d3310(0x232)](_0x4d250d),this[_0x3d3310(0x2a7)](_0x448fd3,_0x3d6924,_0x3d3310(0x198));return;}if(typeof _0x4d16e0[_0x3d3310(0x2a5)]===_0x3d3310(0x1a9)){this[_0x3d3310(0x199)](_0x4d250d,_0x3d6924),this[_0x3d3310(0x232)](_0x4d250d),this['displayPreviewHints'](_0x448fd3,_0x3d6924,_0x3d3310(0x2a5),_0x4d16e0[_0x3d3310(0x2a5)]);return;}if(_0x4d16e0[_0x3d3310(0x2a5)]===!![]){this[_0x3d3310(0x199)](_0x4d250d,_0x3d6924),this['displaySummary'](_0x4d250d),this[_0x3d3310(0x2a7)](_0x448fd3,_0x3d6924,_0x3d3310(0x1c9));return;}this[_0x3d3310(0x255)](_0x4d250d),this[_0x3d3310(0x199)](_0x4d250d,_0x3d6924),this[_0x3d3310(0x232)](_0x4d250d),this[_0x3d3310(0x2a7)](_0x448fd3,_0x3d6924,_0x3d3310(0x266));}['displayPreviewHints'](_0xb02950,_0x2beab5,_0x14c509,_0x46a61c){const _0x3db931=a28_0x2abed2;console[_0x3db931(0x29e)]('\x0a'+a28_0x595089[_0x3db931(0x2af)](_0x3db931(0x1dc)));const _0x2feb57=_0x2beab5!==_0x3db931(0x19e)?'\x20--interval\x20'+_0x2beab5:'';if(_0x14c509==='attribute'&&_0x46a61c)console[_0x3db931(0x29e)]('\x20\x20'+a28_0x595089[_0x3db931(0x2af)](_0x3db931(0x1c2)+_0xb02950+'\x20--attribute\x20\x22'+_0x46a61c+'\x22'+_0x2feb57));else{if(_0x14c509===_0x3db931(0x2a5)&&_0x46a61c)console[_0x3db931(0x29e)]('\x20\x20'+a28_0x595089[_0x3db931(0x2af)](_0x3db931(0x1c2)+_0xb02950+_0x3db931(0x264)+_0x46a61c+'\x22'+_0x2feb57));else(_0x14c509===_0x3db931(0x198)||_0x14c509==='all')&&console[_0x3db931(0x29e)]('\x20\x20'+a28_0x595089['dim'](_0x3db931(0x1c2)+_0xb02950+'\x20--attribute\x20\x22<name>\x22'+_0x2feb57));}(_0x14c509===_0x3db931(0x1c9)||_0x14c509===_0x3db931(0x266))&&console[_0x3db931(0x29e)]('\x20\x20'+a28_0x595089[_0x3db931(0x2af)](_0x3db931(0x1c2)+_0xb02950+_0x3db931(0x27c)+_0x2feb57)),_0x14c509===_0x3db931(0x266)&&console[_0x3db931(0x29e)]('\x20\x20'+a28_0x595089[_0x3db931(0x2af)]('tdx\x20segment\x20parent\x20preview\x20'+_0xb02950+_0x3db931(0x26f)+_0x2feb57));}[a28_0x2abed2(0x1c4)](_0x54caf9){const _0x4ff881=a28_0x2abed2,{master:_0x133e5a}=_0x54caf9,_0x5b036e=_0x133e5a[_0x4ff881(0x20e)]?a28_0x595089[_0x4ff881(0x2ab)]('✔'):a28_0x595089[_0x4ff881(0x205)]('✘');console[_0x4ff881(0x29e)]('\x0a'+a28_0x595089[_0x4ff881(0x2af)](_0x4ff881(0x2aa))),console['error'](_0x5b036e+'\x20'+a28_0x595089[_0x4ff881(0x1d3)](_0x133e5a[_0x4ff881(0x1b5)]+'.'+_0x133e5a[_0x4ff881(0x22a)])),_0x133e5a['schemaValid']?_0x133e5a[_0x4ff881(0x2ba)]!==undefined&&console['error']('\x20\x20'+a28_0x595089['dim'](_0x4ff881(0x1cf))+'\x20'+a28_0x595089[_0x4ff881(0x1aa)](formatRows(_0x133e5a['rowCount']))):console[_0x4ff881(0x29e)]('\x20\x20'+a28_0x595089[_0x4ff881(0x205)](_0x4ff881(0x23f))+'\x20'+_0x133e5a['schemaError']);}['displayAttributesStats'](_0x1c554b){const _0x145352=a28_0x2abed2;if(_0x1c554b[_0x145352(0x198)]['length']===0x0)return;console['error']('\x0a'+a28_0x595089['dim'](_0x145352(0x239)));for(const _0x32ce88 of _0x1c554b[_0x145352(0x198)]){const _0x25d05f=_0x32ce88[_0x145352(0x20e)]?a28_0x595089[_0x145352(0x2ab)]('✔'):a28_0x595089[_0x145352(0x205)]('✘');let _0x4b8534='';if(_0x32ce88[_0x145352(0x20e)]&&_0x32ce88[_0x145352(0x27e)]!==undefined&&_0x32ce88[_0x145352(0x1de)]!==undefined){const _0x4dffd9=_0x32ce88['coveragePercent'][_0x145352(0x21f)](0x1),_0x151a41=_0x32ce88[_0x145352(0x1de)]>=0x50?a28_0x595089[_0x145352(0x2ab)]:_0x32ce88[_0x145352(0x1de)]>=0x32?a28_0x595089[_0x145352(0x19a)]:a28_0x595089['red'];_0x4b8534='\x20'+a28_0x595089['dim']('Coverage:')+'\x20'+_0x151a41(_0x4dffd9+'%')+'\x20('+formatRows(_0x32ce88[_0x145352(0x27e)])+_0x145352(0x1ee);}console[_0x145352(0x29e)](_0x25d05f+'\x20'+a28_0x595089[_0x145352(0x1d3)](_0x32ce88[_0x145352(0x1fe)])+_0x4b8534),console[_0x145352(0x29e)]('\x20\x20'+a28_0x595089[_0x145352(0x2af)]('Source:')+'\x20'+a28_0x595089[_0x145352(0x1d3)](_0x32ce88['database']+'.'+_0x32ce88[_0x145352(0x22a)]));const _0x1e8876=_0x32ce88[_0x145352(0x236)]===_0x32ce88['foreignKey']?a28_0x595089[_0x145352(0x2af)](_0x145352(0x22f))+'\x20'+_0x32ce88[_0x145352(0x236)]:a28_0x595089[_0x145352(0x2af)](_0x145352(0x2b9))+'\x20'+_0x32ce88[_0x145352(0x236)]+'\x20=\x20'+_0x32ce88['foreignKey'];console[_0x145352(0x29e)]('\x20\x20'+_0x1e8876),console[_0x145352(0x29e)]('\x20\x20'+a28_0x595089[_0x145352(0x2af)]('Columns:')),this['displayColumns'](_0x32ce88[_0x145352(0x1c0)]),!_0x32ce88[_0x145352(0x20e)]&&console[_0x145352(0x29e)]('\x20\x20'+a28_0x595089[_0x145352(0x205)](_0x145352(0x23f))+'\x20'+_0x32ce88[_0x145352(0x24d)]);}}['displayBehaviorsStats'](_0x4c4869,_0x2e8277){const _0x320931=a28_0x2abed2;if(_0x4c4869['behaviors'][_0x320931(0x19c)]===0x0)return;console[_0x320931(0x29e)]('\x0a'+a28_0x595089[_0x320931(0x2af)](_0x320931(0x1df))+'\x20'+a28_0x595089[_0x320931(0x2af)]('('+_0x2e8277+')'));for(const _0x555800 of _0x4c4869['behaviors']){const _0x429eb6=_0x555800[_0x320931(0x20e)]?a28_0x595089['green']('✔'):a28_0x595089[_0x320931(0x205)]('✘');let _0xac41dc='';if(_0x555800[_0x320931(0x20e)]&&_0x555800[_0x320931(0x25c)]!==undefined&&_0x555800[_0x320931(0x217)]!==undefined){const _0x1cd6c7=_0x555800[_0x320931(0x29d)]?.[_0x320931(0x21f)](0x1)||'?',_0x42e6a5=(_0x555800[_0x320931(0x29d)]??0x0)>=0x32?a28_0x595089[_0x320931(0x2ab)]:(_0x555800[_0x320931(0x29d)]??0x0)>=0x14?a28_0x595089[_0x320931(0x19a)]:a28_0x595089[_0x320931(0x205)];_0xac41dc='\x20'+a28_0x595089[_0x320931(0x2af)](_0x320931(0x247))+'\x20'+_0x42e6a5(formatRows(_0x555800[_0x320931(0x25c)]))+'\x20('+_0x1cd6c7+_0x320931(0x1d8)+a28_0x595089[_0x320931(0x2af)](_0x320931(0x203))+'\x20'+a28_0x595089[_0x320931(0x1aa)](formatRows(_0x555800['totalEvents']));}console['error'](_0x429eb6+'\x20'+a28_0x595089[_0x320931(0x1d3)](_0x555800[_0x320931(0x1fe)])+_0xac41dc),console['error']('\x20\x20'+a28_0x595089[_0x320931(0x2af)](_0x320931(0x233))+'\x20'+a28_0x595089[_0x320931(0x1d3)](_0x555800[_0x320931(0x1b5)]+'.'+_0x555800[_0x320931(0x22a)]));const _0x18727a=_0x555800[_0x320931(0x236)]===_0x555800[_0x320931(0x271)]?a28_0x595089['dim']('Join\x20on:')+'\x20'+_0x555800['joinKey']:a28_0x595089[_0x320931(0x2af)]('Join:')+'\x20'+_0x555800[_0x320931(0x236)]+_0x320931(0x1c3)+_0x555800[_0x320931(0x271)];console[_0x320931(0x29e)]('\x20\x20'+_0x18727a),console['error']('\x20\x20'+a28_0x595089[_0x320931(0x2af)](_0x320931(0x20d))),this['displayColumns'](_0x555800['columns']),!_0x555800[_0x320931(0x20e)]&&console['error']('\x20\x20'+a28_0x595089[_0x320931(0x205)]('Error:')+'\x20'+_0x555800[_0x320931(0x24d)]);}}[a28_0x2abed2(0x2ac)](_0x5d27b6){const _0x563c92=a28_0x2abed2;for(const _0x57e330 of _0x5d27b6){_0x57e330['label']===_0x57e330[_0x563c92(0x1cc)]||_0x57e330[_0x563c92(0x1cc)]==='*'?console[_0x563c92(0x29e)](_0x563c92(0x24f)+_0x57e330['label']):console['error'](_0x563c92(0x24f)+_0x57e330[_0x563c92(0x1fc)]+'\x20'+a28_0x595089[_0x563c92(0x2af)]('('+_0x57e330[_0x563c92(0x1cc)]+')'));}}[a28_0x2abed2(0x232)](_0x256898){const _0x29f81b=a28_0x2abed2;console[_0x29f81b(0x29e)]('─'[_0x29f81b(0x249)](0x3c));if(_0x256898[_0x29f81b(0x286)][_0x29f81b(0x19c)]>0x0){console[_0x29f81b(0x29e)]('\x0a'+a28_0x595089[_0x29f81b(0x205)](_0x29f81b(0x2ae)));for(const _0x6356a of _0x256898[_0x29f81b(0x286)]){console[_0x29f81b(0x29e)]('\x20\x20'+a28_0x595089[_0x29f81b(0x205)]('•')+'\x20'+_0x6356a);}}_0x256898['allValid']&&console[_0x29f81b(0x29e)]('\x0a'+a28_0x595089[_0x29f81b(0x2ab)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a28_0x2abed2(0x28f);[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x28e);async[a28_0x2abed2(0x1e1)](_0x445fd2){const _0x40fbf4=a28_0x2abed2,{options:_0x211dfe,args:_0x50d69d,tdx:_0x4f28cd}=_0x445fd2,_0x156505=_0x211dfe,_0x5435a7=_0x50d69d[0x0]||_0x211dfe['parentSegment'];if(!_0x5435a7)return showParentSegmentNotSetError(_0x40fbf4(0x257)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x40fbf4(0x211)+_0x40fbf4(0x225)+_0x40fbf4(0x1e4)+_0x40fbf4(0x26e)+_0x40fbf4(0x25a)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x156505[_0x40fbf4(0x1f4)]&&!_0x156505['attribute']&&!_0x156505[_0x40fbf4(0x2a5)]&&!_0x156505[_0x40fbf4(0x265)])return console[_0x40fbf4(0x29e)](a28_0x595089['red'](_0x40fbf4(0x227))),console[_0x40fbf4(0x29e)](_0x40fbf4(0x23c)),console[_0x40fbf4(0x29e)](_0x40fbf4(0x2ad)),console[_0x40fbf4(0x29e)](_0x40fbf4(0x287)),console['error'](_0x40fbf4(0x1dd)),console['error'](_0x40fbf4(0x27a)),console[_0x40fbf4(0x29e)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x28976f=resolveYamlFile(_0x5435a7);if(!existsSync(_0x28976f))return showFileNotFoundError(_0x28976f,_0x5435a7),0x1;_0x156505['verbose']&&(console[_0x40fbf4(0x29e)]('Site:\x20'+_0x156505['site']),console[_0x40fbf4(0x29e)]('YAML\x20file:\x20'+_0x28976f));let _0x502f42;try{_0x502f42=readFileSync(_0x28976f,_0x40fbf4(0x1ce));}catch(_0x209e93){const _0x39f5b5=_0x209e93 instanceof Error?_0x209e93['message']:String(_0x209e93);return console[_0x40fbf4(0x29e)](_0x40fbf4(0x1ba)+_0x39f5b5),0x1;}let _0x1d7b3d;try{_0x1d7b3d=parseYamlString(_0x502f42);}catch(_0x3bca2c){const _0x52d97d=_0x3bca2c instanceof Error?_0x3bca2c[_0x40fbf4(0x1c6)]:String(_0x3bca2c);return console[_0x40fbf4(0x29e)](a28_0x595089[_0x40fbf4(0x205)]('Error\x20parsing\x20YAML:\x20'+_0x52d97d)),0x1;}if(_0x156505[_0x40fbf4(0x1ed)]===!![]||_0x156505[_0x40fbf4(0x1ed)]===''){const _0x1660d5=_0x1d7b3d[_0x40fbf4(0x198)]?.['map'](_0x1b7c81=>_0x1b7c81[_0x40fbf4(0x1fe)])||[];if(_0x1660d5['length']===0x0)console[_0x40fbf4(0x29e)](a28_0x595089[_0x40fbf4(0x205)](_0x40fbf4(0x284)));else{console[_0x40fbf4(0x29e)](a28_0x595089[_0x40fbf4(0x205)](_0x40fbf4(0x237))),console['error'](_0x40fbf4(0x242));for(const _0xb9d3e6 of _0x1660d5){console[_0x40fbf4(0x29e)]('\x20\x20'+a28_0x595089[_0x40fbf4(0x1aa)](_0xb9d3e6));}console['error'](_0x40fbf4(0x1bd)+_0x5435a7+'\x20--attribute\x20\x22'+_0x1660d5[0x0]+'\x22');}return 0x1;}if(_0x156505[_0x40fbf4(0x2a5)]===!![]||_0x156505[_0x40fbf4(0x2a5)]===''){const _0x19861d=_0x1d7b3d[_0x40fbf4(0x1c9)]?.[_0x40fbf4(0x290)](_0x159045=>_0x159045['name'])||[];if(_0x19861d[_0x40fbf4(0x19c)]===0x0)console[_0x40fbf4(0x29e)](a28_0x595089['red'](_0x40fbf4(0x1d5)));else{console[_0x40fbf4(0x29e)](a28_0x595089[_0x40fbf4(0x205)](_0x40fbf4(0x218))),console[_0x40fbf4(0x29e)](_0x40fbf4(0x1cb));for(const _0x3b9a93 of _0x19861d){console[_0x40fbf4(0x29e)]('\x20\x20'+a28_0x595089['cyan'](_0x3b9a93));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5435a7+_0x40fbf4(0x264)+_0x19861d[0x0]+'\x22');}return 0x1;}const _0x4fc674=createCommandSpinner(a28_0x595089[_0x40fbf4(0x2af)](_0x40fbf4(0x22b)),{'verbose':_0x156505[_0x40fbf4(0x1e7)]});_0x4fc674[_0x40fbf4(0x229)]();const _0x19c8c0={'onProgress':_0x392bc8=>{_0x4fc674['text']=formatProgressMessage(_0x392bc8);}};if(_0x156505[_0x40fbf4(0x1f4)])_0x19c8c0[_0x40fbf4(0x1f4)]=!![];if(_0x156505[_0x40fbf4(0x1ed)]&&typeof _0x156505[_0x40fbf4(0x1ed)]===_0x40fbf4(0x1a9))_0x19c8c0[_0x40fbf4(0x1ed)]=_0x156505[_0x40fbf4(0x1ed)];if(_0x156505[_0x40fbf4(0x2a5)]&&typeof _0x156505[_0x40fbf4(0x2a5)]===_0x40fbf4(0x1a9))_0x19c8c0['behavior']=_0x156505[_0x40fbf4(0x2a5)];if(_0x156505[_0x40fbf4(0x265)])_0x19c8c0[_0x40fbf4(0x265)]=!![];if(_0x156505[_0x40fbf4(0x280)])_0x19c8c0[_0x40fbf4(0x280)]=_0x156505[_0x40fbf4(0x280)];let _0x2f374a;try{_0x2f374a=await _0x4f28cd['segment'][_0x40fbf4(0x1b4)](_0x502f42,_0x19c8c0),_0x4fc674[_0x40fbf4(0x2b3)]();}catch(_0x109261){_0x4fc674[_0x40fbf4(0x2b3)]();throw _0x109261;}return await this[_0x40fbf4(0x1ea)](_0x2f374a,{'master':_0x156505['master'],'attribute':typeof _0x156505[_0x40fbf4(0x1ed)]===_0x40fbf4(0x1a9)?_0x156505[_0x40fbf4(0x1ed)]:undefined,'behavior':typeof _0x156505['behavior']===_0x40fbf4(0x1a9)?_0x156505[_0x40fbf4(0x2a5)]:undefined,'enriched':_0x156505[_0x40fbf4(0x265)]}),_0x2f374a[_0x40fbf4(0x294)]?0x0:0x1;}async[a28_0x2abed2(0x1ea)](_0x5103f4,_0x1e5413){const _0x538c37=a28_0x2abed2;console['error']('\x0a'+a28_0x595089[_0x538c37(0x1d3)]('Preview:')+'\x20'+_0x5103f4[_0x538c37(0x1fe)]),console[_0x538c37(0x29e)]('═'[_0x538c37(0x249)](0x3c));if(_0x1e5413['master']&&_0x5103f4[_0x538c37(0x23a)]){const _0x2f51bf=a28_0x595089[_0x538c37(0x2af)](_0x538c37(0x209))+'\x20'+a28_0x595089[_0x538c37(0x1d3)](_0x5103f4['master'][_0x538c37(0x1b5)]+'.'+_0x5103f4[_0x538c37(0x1f4)][_0x538c37(0x22a)]);await this[_0x538c37(0x1a3)](_0x2f51bf,_0x5103f4[_0x538c37(0x23a)]);}else{if(_0x1e5413[_0x538c37(0x1ed)]&&_0x5103f4['sampleData']){const _0x5ea206=a28_0x595089[_0x538c37(0x2af)](_0x538c37(0x293))+'\x20'+a28_0x595089[_0x538c37(0x1d3)](_0x1e5413[_0x538c37(0x1ed)]);await this[_0x538c37(0x1a3)](_0x5ea206,_0x5103f4[_0x538c37(0x23a)]);}else{if(_0x1e5413[_0x538c37(0x2a5)]&&_0x5103f4[_0x538c37(0x23a)]){const _0x35b0a5=a28_0x595089[_0x538c37(0x2af)]('Behavior:')+'\x20'+a28_0x595089[_0x538c37(0x1d3)](_0x1e5413[_0x538c37(0x2a5)]);await this[_0x538c37(0x1a3)](_0x35b0a5,_0x5103f4[_0x538c37(0x23a)]);}else{if(_0x1e5413[_0x538c37(0x265)]&&_0x5103f4['sampleData']){const _0x5bab01=a28_0x595089['dim'](_0x538c37(0x1e6))+'\x20'+a28_0x595089[_0x538c37(0x1d3)](_0x538c37(0x21c));await this[_0x538c37(0x1a3)](_0x5bab01,_0x5103f4[_0x538c37(0x23a)]);}else!_0x5103f4['sampleData']&&console[_0x538c37(0x29e)](_0x538c37(0x20b));}}}if(_0x5103f4[_0x538c37(0x286)][_0x538c37(0x19c)]>0x0){console[_0x538c37(0x29e)]('─'[_0x538c37(0x249)](0x3c)),console[_0x538c37(0x29e)]('\x0a'+a28_0x595089[_0x538c37(0x205)]('Errors:'));for(const _0x500f7f of _0x5103f4['errors']){console[_0x538c37(0x29e)]('\x20\x20'+a28_0x595089[_0x538c37(0x205)]('•')+'\x20'+_0x500f7f);}}}async[a28_0x2abed2(0x1a3)](_0x4d0af6,_0x336ead){const _0x46c077=a28_0x2abed2;if(_0x336ead[_0x46c077(0x19c)]===0x0){console['error']('\x0a'+_0x4d0af6),console['error'](_0x46c077(0x1f8));return;}console[_0x46c077(0x29e)]('\x0a'+_0x4d0af6);const _0x3d14c7=Object['keys'](_0x336ead[0x0])[_0x46c077(0x290)](_0x458c6c=>({'name':_0x458c6c,'type':typeof _0x336ead[0x0][_0x458c6c]===_0x46c077(0x2b5)?'double':_0x46c077(0x2b2)})),_0x5b8a2c={'queryId':_0x46c077(0x1a6),'columns':_0x3d14c7,'data':_0x336ead,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x336ead[_0x46c077(0x19c)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1d0703=formatAsTable(_0x5b8a2c,_0x336ead[_0x46c077(0x19c)],!![]);await writeOutput(_0x1d0703,undefined,'table');}}function a28_0x1b8f(_0x3a5dfa,_0xaa2a64){_0x3a5dfa=_0x3a5dfa-0x18e;const _0x2e2cd6=a28_0x2e2c();let _0x1b8f96=_0x2e2cd6[_0x3a5dfa];return _0x1b8f96;}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a28_0x2abed2(0x1fe)]='segment:parent:run';[a28_0x2abed2(0x1f3)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a28_0x2abed2(0x1e1)](_0x30a0f4){const _0x372c2c=a28_0x2abed2,{options:_0x5c5c4c,args:_0xd628ac,tdx:_0x81c31e}=_0x30a0f4,_0x4cec14=_0x5c5c4c,_0x17f257=_0xd628ac[0x0]||_0x5c5c4c[_0x372c2c(0x1a2)];if(!_0x17f257)return showParentSegmentNotSetError(_0x372c2c(0x2b7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x190477=resolveYamlFile(_0x17f257);if(existsSync(_0x190477)){_0x4cec14[_0x372c2c(0x1e7)]&&console[_0x372c2c(0x29e)](_0x372c2c(0x250)+_0x190477);let _0x1af19e;try{_0x1af19e=readFileSync(_0x190477,'utf-8');}catch(_0x4ef73b){const _0x5abfd7=_0x4ef73b instanceof Error?_0x4ef73b['message']:String(_0x4ef73b);return console[_0x372c2c(0x29e)](_0x372c2c(0x1ba)+_0x5abfd7),0x1;}const _0x41814c=await withSpinner(_0x372c2c(0x279),()=>_0x81c31e[_0x372c2c(0x1bb)][_0x372c2c(0x28a)](_0x1af19e),{'verbose':_0x4cec14[_0x372c2c(0x1e7)]}),_0x516ab0=_0x41814c[_0x372c2c(0x1e0)],{isNew:_0x9f04ed,name:_0x3968dc,hasChanges:_0x9cc665,diffFormatted:_0x11718c}=_0x516ab0;if(_0x9cc665){_0x9f04ed?console[_0x372c2c(0x29e)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x3968dc+'\x27:'):console['error'](_0x372c2c(0x23b)+_0x3968dc+'\x27:');console[_0x372c2c(0x29e)]('─'[_0x372c2c(0x249)](0x3c)),console['error'](_0x11718c),console[_0x372c2c(0x29e)]('─'[_0x372c2c(0x249)](0x3c));const _0x302052=_0x9f04ed?_0x372c2c(0x1b3)+_0x3968dc+_0x372c2c(0x1f5):'Apply\x20changes\x20to\x20\x27'+_0x3968dc+_0x372c2c(0x1f5);if(!_0x4cec14[_0x372c2c(0x268)]){const _0x327cb1=await confirmKey(_0x302052);if(!_0x327cb1)return console[_0x372c2c(0x29e)](_0x372c2c(0x1fa)),0x1;}const _0x1248f9=_0x9f04ed?_0x372c2c(0x29f):_0x372c2c(0x1b2);await withSpinner(_0x1248f9+_0x372c2c(0x22c)+_0x3968dc+'\x27...',()=>_0x516ab0[_0x372c2c(0x25e)](),{'verbose':_0x4cec14[_0x372c2c(0x1e7)]});const _0x29b1b9=_0x9f04ed?_0x372c2c(0x2bb):'Updated';console['error']('✔\x20'+_0x29b1b9+_0x372c2c(0x22c)+_0x3968dc+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x3968dc+_0x372c2c(0x1db));}const _0xa10f06=await withSpinner(_0x372c2c(0x298)+_0x17f257+_0x372c2c(0x26d),()=>_0x81c31e['segment']['runParent'](_0x17f257),{'verbose':_0x4cec14[_0x372c2c(0x1e7)]}),_0x2dbbf7=_0xa10f06['data'],_0x367aff=getConsoleUrl(_0x4cec14[_0x372c2c(0x1ec)],_0x372c2c(0x274)+_0x2dbbf7[_0x372c2c(0x20c)]+_0x372c2c(0x224)+_0x2dbbf7[_0x372c2c(0x1ff)]+_0x372c2c(0x22d)+_0x2dbbf7['workflowAttemptId']);return console['error'](_0x372c2c(0x207)),console[_0x372c2c(0x29e)]('\x20\x20'+a28_0x595089[_0x372c2c(0x2af)](_0x372c2c(0x27f))+'\x20'+_0x2dbbf7[_0x372c2c(0x1d0)]),console[_0x372c2c(0x29e)]('\x20\x20'+a28_0x595089[_0x372c2c(0x2af)](_0x372c2c(0x2a0))+'\x20'+_0x2dbbf7[_0x372c2c(0x26b)]),console[_0x372c2c(0x29e)]('\x20\x20'+a28_0x595089[_0x372c2c(0x2af)](_0x372c2c(0x1f1))+'\x20'+_0x2dbbf7[_0x372c2c(0x1ff)]),console[_0x372c2c(0x29e)]('\x20\x20'+a28_0x595089[_0x372c2c(0x2af)](_0x372c2c(0x1b6))+'\x20'+_0x2dbbf7[_0x372c2c(0x23e)]),console['error']('\x20\x20'+_0x367aff),console[_0x372c2c(0x29e)]('\x0a'+a28_0x595089[_0x372c2c(0x2af)]('To\x20cancel:')+_0x372c2c(0x25d)+_0x2dbbf7[_0x372c2c(0x23e)]+_0x372c2c(0x1ad)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x248);['description']='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x374e4d){const _0x308749=a28_0x2abed2,{options:_0x27a126,args:_0x91c650,tdx:_0x231b8d}=_0x374e4d,_0x37d0ab=_0x91c650[0x0]||_0x27a126[_0x308749(0x1a2)];if(!_0x37d0ab)return showParentSegmentNotSetError(_0x308749(0x1c8)+_0x308749(0x1bc)),0x1;_0x27a126[_0x308749(0x1e7)]&&(console[_0x308749(0x29e)](_0x308749(0x244)+_0x27a126[_0x308749(0x1ec)]),console[_0x308749(0x29e)](_0x308749(0x193)+_0x37d0ab));const _0x25bc9a=await withSpinner(_0x308749(0x1d9)+_0x37d0ab+_0x308749(0x26d),()=>_0x231b8d[_0x308749(0x1bb)]['listFields'](_0x37d0ab),{'verbose':_0x27a126[_0x308749(0x1e7)]}),_0x1f101d=_0x25bc9a[_0x308749(0x1e0)];console[_0x308749(0x29e)](_0x308749(0x1d7)+_0x1f101d[_0x308749(0x19c)]+_0x308749(0x28c)+(_0x1f101d[_0x308749(0x19c)]!==0x1?'s':''));if(_0x27a126['json']||_0x27a126[_0x308749(0x234)])return await handleSDKOutput(_0x1f101d,_0x27a126),0x0;return displayFieldsHumanReadable(_0x1f101d,_0x37d0ab),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x256);[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x1d1);async['execute'](_0x29aeb1){const _0x2c75da=a28_0x2abed2,{options:_0xe630de,args:_0x417a55,tdx:_0x58ee89}=_0x29aeb1,_0x2ccdd3=_0xe630de,_0x538a6c=_0x417a55[0x0]||_0xe630de[_0x2c75da(0x1a2)];if(!_0x538a6c)return showParentSegmentNotSetError(_0x2c75da(0x21b)+_0x2c75da(0x276)+_0x2c75da(0x23d)+_0x2c75da(0x2b1)),0x1;_0xe630de['verbose']&&(console[_0x2c75da(0x29e)]('Site:\x20'+_0xe630de[_0x2c75da(0x1ec)]),console[_0x2c75da(0x29e)](_0x2c75da(0x193)+_0x538a6c));const _0x1f61a0=await withSpinner(_0x2c75da(0x197)+_0x538a6c+'\x27...',()=>_0x58ee89['segment'][_0x2c75da(0x1a0)](_0x538a6c),{'verbose':_0xe630de[_0x2c75da(0x1e7)]}),_0x440d48=_0x1f61a0[_0x2c75da(0x1e0)];if(_0x2ccdd3[_0x2c75da(0x1d2)]){const _0x51dfeb=getConsoleNextUrl(_0x2ccdd3[_0x2c75da(0x1ec)],_0x2c75da(0x1c5)+_0x440d48['id']);return console[_0x2c75da(0x29e)](a28_0x595089[_0x2c75da(0x2ab)]('✔')+_0x2c75da(0x191)+a28_0x595089[_0x2c75da(0x1aa)](_0x51dfeb)),openBrowser(_0x51dfeb),0x0;}return await handleSingleObjectOutput(_0x440d48,_0xe630de),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]='segment:parent:desc';[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x283);async[a28_0x2abed2(0x1e1)](_0x4d5160){const _0x28170c=a28_0x2abed2,{options:_0x1db9e1,args:_0x69630d,tdx:_0xefd907}=_0x4d5160,_0xf1f6f5=_0x69630d[0x0]||_0x1db9e1[_0x28170c(0x1a2)];if(!_0xf1f6f5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x1db9e1[_0x28170c(0x1e7)]&&(console[_0x28170c(0x29e)](_0x28170c(0x244)+_0x1db9e1['site']),console['error'](_0x28170c(0x193)+_0xf1f6f5));const _0x25cd02=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xf1f6f5+_0x28170c(0x26d),()=>_0xefd907[_0x28170c(0x1bb)]['resolveParentId'](_0xf1f6f5),{'verbose':_0x1db9e1[_0x28170c(0x1e7)]}),_0xb7c028=_0x25cd02[_0x28170c(0x1e0)],_0x24fa08=await withSpinner(_0x28170c(0x246)+_0xf1f6f5+_0x28170c(0x26d),()=>_0xefd907[_0x28170c(0x1bb)][_0x28170c(0x226)](_0xb7c028),{'verbose':_0x1db9e1[_0x28170c(0x1e7)]}),_0x2ba9cd=await executeSchemaQuery(_0x24fa08[_0x28170c(0x1e0)],_0xefd907,_0x1db9e1);return await handleQueryOutput(_0x2ba9cd,_0x1db9e1),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x235);[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x18e);async[a28_0x2abed2(0x1e1)](_0x32beb0){const _0x5cba56=a28_0x2abed2,{options:_0x5dc7c2,args:_0x4c187f,tdx:_0x2b0ee9}=_0x32beb0,_0x52699c=_0x4c187f[0x0]||_0x5dc7c2[_0x5cba56(0x1a2)];if(!_0x52699c)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'+_0x5cba56(0x190)),0x1;_0x5dc7c2[_0x5cba56(0x1e7)]&&(console[_0x5cba56(0x29e)](_0x5cba56(0x244)+_0x5dc7c2[_0x5cba56(0x1ec)]),console[_0x5cba56(0x29e)](_0x5cba56(0x193)+_0x52699c));const _0x47e48e=await withSpinner(_0x5cba56(0x1f9)+_0x52699c+'\x27...',()=>_0x2b0ee9['segment'][_0x5cba56(0x243)](_0x52699c),{'verbose':_0x5dc7c2[_0x5cba56(0x1e7)]}),_0x5b848b=_0x47e48e['data'],_0x40728d=await withSpinner(_0x5cba56(0x246)+_0x52699c+_0x5cba56(0x26d),()=>_0x2b0ee9[_0x5cba56(0x1bb)][_0x5cba56(0x226)](_0x5b848b),{'verbose':_0x5dc7c2[_0x5cba56(0x1e7)]}),_0x541d5e=_0x40728d[_0x5cba56(0x1e0)];return _0x5dc7c2[_0x5cba56(0x1fd)]===_0x5cba56(0x273)||_0x5dc7c2[_0x5cba56(0x1fd)]==='jsonl'?await handleSDKOutput([{'sql':_0x541d5e}],_0x5dc7c2):console[_0x5cba56(0x1cd)](_0x541d5e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a28_0x2abed2(0x1fe)]=a28_0x2abed2(0x2a1);[a28_0x2abed2(0x1f3)]=a28_0x2abed2(0x220);async[a28_0x2abed2(0x1e1)](_0x21df33){const _0x550bde=a28_0x2abed2,{options:_0x8d73d2,args:_0x201d97,tdx:_0x4f008d}=_0x21df33,_0x1cad7e=_0x201d97[0x0]||_0x8d73d2[_0x550bde(0x1a2)];if(!_0x1cad7e)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'+_0x550bde(0x29a)),0x1;_0x8d73d2[_0x550bde(0x1e7)]&&(console[_0x550bde(0x29e)](_0x550bde(0x244)+_0x8d73d2[_0x550bde(0x1ec)]),console[_0x550bde(0x29e)](_0x550bde(0x193)+_0x1cad7e));const _0x1133b3=await withSpinner(_0x550bde(0x1f9)+_0x1cad7e+_0x550bde(0x26d),()=>_0x4f008d[_0x550bde(0x1bb)][_0x550bde(0x243)](_0x1cad7e),{'verbose':_0x8d73d2[_0x550bde(0x1e7)]}),_0x5e5b1c=_0x1133b3[_0x550bde(0x1e0)],_0x419639=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x1cad7e+'\x27...',()=>_0x4f008d[_0x550bde(0x1bb)]['getParentSQL'](_0x5e5b1c),{'verbose':_0x8d73d2['verbose']});let _0x582595=_0x419639[_0x550bde(0x1e0)];const _0x2841ef=resolveLimit(_0x8d73d2[_0x550bde(0x2b0)],DEFAULT_DISPLAY_LIMIT),_0x47425e=/\bLIMIT\s+\d+/i[_0x550bde(0x299)](_0x582595);!_0x47425e&&(_0x582595=_0x582595[_0x550bde(0x2a6)]()[_0x550bde(0x25b)](/;+$/,''),_0x582595=_0x550bde(0x1b9)+_0x582595+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x2841ef);_0x8d73d2[_0x550bde(0x1e7)]&&console[_0x550bde(0x29e)](_0x550bde(0x269)+_0x582595);const _0x2388ff=await withQuerySpinner(_0x550bde(0x1a5),async _0xbba617=>{const _0x3a9875=_0x550bde,_0x1629f3=await _0x4f008d['query'][_0x3a9875(0x1e1)](_0x582595,{'catalog':'td','schema':_0x3a9875(0x1ae),'onJobId':_0x41a873=>{const _0x4f18f6=_0x3a9875;_0xbba617[_0x4f18f6(0x2a2)](_0x41a873);}});return _0x1629f3;},{'verbose':_0x8d73d2[_0x550bde(0x1e7)]}),_0x47d857=_0x2388ff['data'],_0x4fc116=_0x47d857[_0x550bde(0x1bf)]?_0x550bde(0x2b8)+_0x47d857[_0x550bde(0x1bf)]+']':'';return console[_0x550bde(0x29e)](_0x550bde(0x222)+_0x47d857[_0x550bde(0x24a)][_0x550bde(0x228)][_0x550bde(0x19b)]()+_0x550bde(0x1f7)+(_0x550bde(0x260)+formatElapsed(_0x47d857['stats']['elapsedTimeMillis'])+_0x4fc116)),await handleQueryOutput(_0x47d857,_0x8d73d2),0x0;}}
@@ -1 +1 @@
1
- const a29_0x47310a=a29_0x310b;(function(_0x53ac54,_0x5d308a){const _0x8a6c7d=a29_0x310b,_0x2f07f7=_0x53ac54();while(!![]){try{const _0x3254dc=-parseInt(_0x8a6c7d(0x1fb))/0x1*(-parseInt(_0x8a6c7d(0x1ed))/0x2)+parseInt(_0x8a6c7d(0x1f0))/0x3*(-parseInt(_0x8a6c7d(0x1fd))/0x4)+parseInt(_0x8a6c7d(0x1e9))/0x5+-parseInt(_0x8a6c7d(0x1e7))/0x6*(parseInt(_0x8a6c7d(0x1e5))/0x7)+parseInt(_0x8a6c7d(0x1ee))/0x8+-parseInt(_0x8a6c7d(0x1e4))/0x9*(parseInt(_0x8a6c7d(0x1f5))/0xa)+-parseInt(_0x8a6c7d(0x1f2))/0xb*(parseInt(_0x8a6c7d(0x1f8))/0xc);if(_0x3254dc===_0x5d308a)break;else _0x2f07f7['push'](_0x2f07f7['shift']());}catch(_0x404027){_0x2f07f7['push'](_0x2f07f7['shift']());}}}(a29_0x282c,0x7d420));function a29_0x282c(){const _0x4a57ac=['1kIJXUP','error','2906156ejvGLz','profiles','755127XzURdk','14YbBdCr','config','694104QACBuz','log','2096335OlMztr','length','\x20\x20Global:\x20~/.config/tdx/tdx.json','description','2030998WfCyZw','5083712GTPiaY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','3JzgyuZ','execute','11gDKnvj','map','name','30skeaGh','message','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','4170696murYXM','scope','Error:\x20'];a29_0x282c=function(){return _0x4a57ac;};return a29_0x282c();}function a29_0x310b(_0x5d7d13,_0x3bcbc5){_0x5d7d13=_0x5d7d13-0x1e3;const _0x282cfc=a29_0x282c();let _0x310b92=_0x282cfc[_0x5d7d13];return _0x310b92;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{['name']=a29_0x47310a(0x1e3);['description']='List\x20all\x20available\x20profiles';async[a29_0x47310a(0x1f1)](_0x403674){const _0x3e8adf=a29_0x47310a,{options:_0x33038b}=_0x403674;try{const _0x4f0102=listProfiles(),_0x24deaf=getActiveProfile();if(_0x4f0102[_0x3e8adf(0x1ea)]===0x0)return console[_0x3e8adf(0x1e8)](_0x3e8adf(0x1ef)),console['log'](_0x3e8adf(0x1f7)),console['log'](_0x3e8adf(0x1eb)),0x0;const _0x2990bd=_0x4f0102[_0x3e8adf(0x1f3)](_0x13ce1e=>{const _0x4b91b9=_0x3e8adf,_0x3d8f97=_0x13ce1e[_0x4b91b9(0x1f4)]===_0x24deaf,_0x3f351d=getProfileParams(_0x13ce1e[_0x4b91b9(0x1e6)]);return{'name':_0x13ce1e[_0x4b91b9(0x1f4)],'active':_0x3d8f97,'scope':_0x13ce1e[_0x4b91b9(0x1f9)],'description':_0x13ce1e[_0x4b91b9(0x1e6)][_0x4b91b9(0x1ec)]||'','params':_0x3f351d};});return await handleSDKOutput(_0x2990bd,_0x33038b),0x0;}catch(_0x309fbc){return _0x309fbc instanceof Error&&console[_0x3e8adf(0x1fc)](_0x3e8adf(0x1fa)+_0x309fbc[_0x3e8adf(0x1f6)]),0x1;}}}
1
+ const a29_0x78c2=a29_0x586a;(function(_0xf31d33,_0x541e76){const _0x46b3e4=a29_0x586a,_0x1b07c3=_0xf31d33();while(!![]){try{const _0x54ad52=parseInt(_0x46b3e4(0x180))/0x1+parseInt(_0x46b3e4(0x176))/0x2+parseInt(_0x46b3e4(0x185))/0x3*(-parseInt(_0x46b3e4(0x17d))/0x4)+parseInt(_0x46b3e4(0x177))/0x5+parseInt(_0x46b3e4(0x170))/0x6*(-parseInt(_0x46b3e4(0x172))/0x7)+-parseInt(_0x46b3e4(0x17c))/0x8+parseInt(_0x46b3e4(0x183))/0x9;if(_0x54ad52===_0x541e76)break;else _0x1b07c3['push'](_0x1b07c3['shift']());}catch(_0x28017d){_0x1b07c3['push'](_0x1b07c3['shift']());}}}(a29_0x2839,0x579a9));import{BaseCommand}from'./command.js';function a29_0x586a(_0x48a0b0,_0x1c8efd){_0x48a0b0=_0x48a0b0-0x16e;const _0x283914=a29_0x2839();let _0x586abf=_0x283914[_0x48a0b0];return _0x586abf;}function a29_0x2839(){const _0x5c2a52=['547190SErHHx','config','map','Error:\x20','653068BtjbhX','2420615GTYsWX','\x20\x20Global:\x20~/.config/tdx/tdx.json','error','List\x20all\x20available\x20profiles','description','5672896NnhZus','20QLNknZ','scope','name','586295dDXuPG','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','732555wJgvue','length','58638Uocujq','message','profiles','24MLjcBz','log'];a29_0x2839=function(){return _0x5c2a52;};return a29_0x2839();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a29_0x78c2(0x17f)]=a29_0x78c2(0x16f);[a29_0x78c2(0x17b)]=a29_0x78c2(0x17a);async['execute'](_0x4b701a){const _0x25cda7=a29_0x78c2,{options:_0x54cb10}=_0x4b701a;try{const _0xfa88b8=listProfiles(),_0x1507d5=getActiveProfile();if(_0xfa88b8[_0x25cda7(0x184)]===0x0)return console['log'](_0x25cda7(0x182)),console[_0x25cda7(0x171)](_0x25cda7(0x181)),console[_0x25cda7(0x171)](_0x25cda7(0x178)),0x0;const _0x334c66=_0xfa88b8[_0x25cda7(0x174)](_0x3f7e7d=>{const _0x3d37dd=_0x25cda7,_0x31ac10=_0x3f7e7d['name']===_0x1507d5,_0x2d1012=getProfileParams(_0x3f7e7d['config']);return{'name':_0x3f7e7d[_0x3d37dd(0x17f)],'active':_0x31ac10,'scope':_0x3f7e7d[_0x3d37dd(0x17e)],'description':_0x3f7e7d[_0x3d37dd(0x173)][_0x3d37dd(0x17b)]||'','params':_0x2d1012};});return await handleSDKOutput(_0x334c66,_0x54cb10),0x0;}catch(_0x3a14a6){return _0x3a14a6 instanceof Error&&console[_0x25cda7(0x179)](_0x25cda7(0x175)+_0x3a14a6[_0x25cda7(0x16e)]),0x1;}}}
@@ -1 +1 @@
1
- function a30_0x2734(_0xf5f708,_0x6d3255){_0xf5f708=_0xf5f708-0x1bc;const _0x5bf942=a30_0x5bf9();let _0x2734fa=_0x5bf942[_0xf5f708];return _0x2734fa;}const a30_0xf57f76=a30_0x2734;(function(_0x340a83,_0x11a569){const _0x2bb98d=a30_0x2734,_0x4a7485=_0x340a83();while(!![]){try{const _0x2d60be=-parseInt(_0x2bb98d(0x1e4))/0x1*(-parseInt(_0x2bb98d(0x1c2))/0x2)+parseInt(_0x2bb98d(0x1dc))/0x3*(-parseInt(_0x2bb98d(0x1d8))/0x4)+parseInt(_0x2bb98d(0x1be))/0x5*(-parseInt(_0x2bb98d(0x1bc))/0x6)+-parseInt(_0x2bb98d(0x1e1))/0x7*(parseInt(_0x2bb98d(0x1f1))/0x8)+-parseInt(_0x2bb98d(0x1d1))/0x9*(parseInt(_0x2bb98d(0x1e7))/0xa)+-parseInt(_0x2bb98d(0x1ed))/0xb+parseInt(_0x2bb98d(0x1c8))/0xc;if(_0x2d60be===_0x11a569)break;else _0x4a7485['push'](_0x4a7485['shift']());}catch(_0x4155d1){_0x4a7485['push'](_0x4a7485['shift']());}}}(a30_0x5bf9,0x2b4b9));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a30_0x5bf9(){const _0x2ed428=['execute','verbose','99lSydSN','Schema:\x20','\x20[Job\x20ID:\x20','push','\x20rows\x20','error','No\x20SQL\x20provided','4HQwxXW','validate','site','completedSplits','469401ZikfCP','stats','\x0aAll\x20results\x20saved\x20to\x20','processedRows','originalMessage','91XPByIT','SQL:\x20','join','11pziArL','database','Run\x20Trino\x20queries\x20(streaming)','128560IdRkHD','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','in\x20','elapsedTimeMillis','state','Executing\x20query\x20[','1726857zAZjHl','data','setJobId','query','16120UxcYul','Executing\x20query...','length','26496NqjRIP','\x20-\x20','255xddLxK','catalog','Statement\x20','message','62216dHxHzC','setPhase','totalSplits','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','jobId','options','6497160wvPNVT','file','information_schema','output','Executing\x20statement\x20','Site:\x20','Query\x20completed:\x20Processed\x20'];a30_0x5bf9=function(){return _0x2ed428;};return a30_0x5bf9();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{['name']=a30_0xf57f76(0x1f0);['description']=a30_0xf57f76(0x1e6);async[a30_0xf57f76(0x1cf)](_0x442bf8){const _0x469190=a30_0xf57f76,{options:_0x5944e0,args:_0x1a5afe,tdx:_0x50b8f7}=_0x442bf8,_0x2426c5=_0x1a5afe[0x0],_0x4a1155=_0x5944e0['file'];let _0x246b05;try{if(_0x4a1155)_0x246b05=readSqlStatementsFromFile(_0x4a1155);else{if(_0x2426c5==='-')_0x246b05=await readSqlStatementsFromStdin();else{if(_0x2426c5&&isSqlFilePath(_0x2426c5))_0x246b05=readSqlStatementsFromFile(_0x2426c5);else{if(_0x2426c5)_0x246b05=splitSqlStatements(_0x2426c5);else throw new Error(_0x469190(0x1d7));}}}}catch(_0x4af56b){return console[_0x469190(0x1d6)]('Error:\x20'+_0x4af56b[_0x469190(0x1c1)]),0x1;}const _0x58188a=_0x5944e0[_0x469190(0x1e5)]||_0x469190(0x1ca),_0x5e6d17=_0x5944e0[_0x469190(0x1bf)];try{const _0x241354=[],_0x4b3b7a=!!_0x5944e0[_0x469190(0x1cb)];for(let _0x52a967=0x0;_0x52a967<_0x246b05[_0x469190(0x1f3)];_0x52a967++){const _0x472264=_0x246b05[_0x52a967],_0x20c41f=_0x52a967+0x1,_0x413602=_0x246b05[_0x469190(0x1f3)],_0x2ff95a=_0x413602>0x1;_0x5944e0[_0x469190(0x1d0)]&&(console[_0x469190(0x1d6)]('\x0a'+(_0x2ff95a?_0x469190(0x1c0)+_0x20c41f+'/'+_0x413602+':':'')),console[_0x469190(0x1d6)](_0x469190(0x1cd)+_0x5944e0[_0x469190(0x1da)]),console[_0x469190(0x1d6)]('Catalog:\x20'+(_0x5e6d17||'td')),console['error'](_0x469190(0x1d2)+_0x58188a),console['error'](_0x469190(0x1e2)+_0x472264));const _0x558d65=_0x2ff95a?_0x469190(0x1cc)+_0x20c41f+'/'+_0x413602+'...':_0x469190(0x1f2);try{const _0x1af471=await withQuerySpinner(_0x558d65,async _0x13d96e=>{const _0xed5656=_0x469190,_0x4e064c=await _0x50b8f7[_0xed5656(0x1f0)]['execute'](_0x472264,{'catalog':_0x5e6d17,'schema':_0x58188a,'onJobId':_0xf0e8d2=>{const _0x50969c=_0xed5656;_0x13d96e[_0x50969c(0x1ef)](_0xf0e8d2);},'onProgress':_0x14f113=>{const _0x483df1=_0xed5656;_0x13d96e[_0x483df1(0x1c3)](_0x483df1(0x1ec)+_0x14f113[_0x483df1(0x1eb)]+']'),_0x13d96e['setExtra'](formatRows(_0x14f113['processedRows'])+_0x483df1(0x1d5)+_0x14f113[_0x483df1(0x1db)]+'/'+_0x14f113[_0x483df1(0x1c4)]+'\x20splits');}});return _0x4e064c;},{'verbose':_0x5944e0[_0x469190(0x1d0)]}),_0x44f180=_0x1af471[_0x469190(0x1ee)],_0x58bdcf=_0x44f180[_0x469190(0x1c6)]?_0x469190(0x1d3)+_0x44f180[_0x469190(0x1c6)]+']':'',_0x34d5e9=_0x2ff95a?_0x469190(0x1c0)+_0x20c41f+'/'+_0x413602+_0x469190(0x1bd):'';console[_0x469190(0x1d6)]('✔\x20'+_0x34d5e9+_0x469190(0x1ce)+formatRows(_0x44f180[_0x469190(0x1dd)][_0x469190(0x1df)])+_0x469190(0x1d5)+(_0x469190(0x1e9)+formatElapsed(_0x44f180[_0x469190(0x1dd)][_0x469190(0x1ea)])+_0x58bdcf));if(_0x2ff95a&&_0x4b3b7a){const _0x214036=resolveOutputOptions(_0x5944e0),_0x40907d=await formatQueryOutput(_0x44f180,_0x214036);_0x241354[_0x469190(0x1d4)](_0x40907d);}else await handleQueryOutput(_0x44f180,_0x5944e0);}catch(_0x54edc8){const _0x2d18ca=_0x2ff95a?'Statement\x20'+_0x20c41f+'/'+_0x413602+':\x0a':'',_0x220637=_0x54edc8 instanceof SDKError?_0x54edc8[_0x469190(0x1e0)]:_0x54edc8['message'];return console['error'](''+_0x2d18ca+_0x220637),0x1;}}if(_0x246b05[_0x469190(0x1f3)]>0x1&&_0x4b3b7a&&_0x241354[_0x469190(0x1f3)]>0x0){const _0xd2df7=_0x241354[_0x469190(0x1e3)]('\x0a');writeFileSync(_0x5944e0['output'],_0xd2df7),console[_0x469190(0x1d6)](_0x469190(0x1de)+_0x5944e0[_0x469190(0x1cb)]);}return 0x0;}catch(_0x2bed7b){throw _0x2bed7b;}}[a30_0xf57f76(0x1d9)](_0x1b044f){const _0x286d3b=a30_0xf57f76,_0x5a755e=_0x1b044f['args'][0x0],_0x357454=_0x1b044f[_0x286d3b(0x1c7)][_0x286d3b(0x1c9)];if(!_0x5a755e&&!_0x357454)return _0x286d3b(0x1c5);if(_0x5a755e&&_0x357454)return _0x286d3b(0x1e8);return undefined;}}
1
+ const a30_0x248d80=a30_0x51a1;(function(_0x32e67b,_0x4a7a75){const _0x40eefe=a30_0x51a1,_0x2fe076=_0x32e67b();while(!![]){try{const _0x522b41=-parseInt(_0x40eefe(0x215))/0x1*(parseInt(_0x40eefe(0x1f2))/0x2)+parseInt(_0x40eefe(0x1fd))/0x3*(-parseInt(_0x40eefe(0x201))/0x4)+-parseInt(_0x40eefe(0x20a))/0x5*(parseInt(_0x40eefe(0x208))/0x6)+-parseInt(_0x40eefe(0x200))/0x7*(parseInt(_0x40eefe(0x1fb))/0x8)+-parseInt(_0x40eefe(0x1ea))/0x9*(parseInt(_0x40eefe(0x1f8))/0xa)+parseInt(_0x40eefe(0x205))/0xb*(parseInt(_0x40eefe(0x1f1))/0xc)+parseInt(_0x40eefe(0x1f4))/0xd*(parseInt(_0x40eefe(0x1ee))/0xe);if(_0x522b41===_0x4a7a75)break;else _0x2fe076['push'](_0x2fe076['shift']());}catch(_0x5c75ab){_0x2fe076['push'](_0x2fe076['shift']());}}}(a30_0x1e9f,0x3f686));import{BaseCommand}from'./command.js';function a30_0x1e9f(){const _0x24b876=['database','validate','query','file','\x20-\x20','135RhPrCh','description','push','options','14oAwxdg','elapsedTimeMillis','\x20splits','10752lPWkLr','2lcLmLo','information_schema','13299247zdlYgC','verbose','Query\x20completed:\x20Processed\x20','Statement\x20','250piEEcs','Catalog:\x20','output','8XJjvvf','SQL:\x20','16026aycFZP','in\x20','jobId','932337QcaVtd','88KbfMjX','\x20rows\x20','site','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','2695tgyxNP','message','Run\x20Trino\x20queries\x20(streaming)','30882YDQRhI','No\x20SQL\x20provided','335WlfAMO','name','\x20[Job\x20ID:\x20','state','Site:\x20','join','args','processedRows','Schema:\x20','length','setJobId','386882FDSnVL','error','Error:\x20','totalSplits','completedSplits','stats','...','setExtra','execute'];a30_0x1e9f=function(){return _0x24b876;};return a30_0x1e9f();}function a30_0x51a1(_0x38f013,_0x3ef88b){_0x38f013=_0x38f013-0x1de;const _0x1e9fbe=a30_0x1e9f();let _0x51a1a5=_0x1e9fbe[_0x38f013];return _0x51a1a5;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a30_0x248d80(0x20b)]=a30_0x248d80(0x1e7);[a30_0x248d80(0x1eb)]=a30_0x248d80(0x207);async[a30_0x248d80(0x1e4)](_0x5e0e40){const _0x5e38d5=a30_0x248d80,{options:_0x18259f,args:_0x258823,tdx:_0x1636a2}=_0x5e0e40,_0x4aa2f2=_0x258823[0x0],_0x5a0323=_0x18259f[_0x5e38d5(0x1e8)];let _0x84d31e;try{if(_0x5a0323)_0x84d31e=readSqlStatementsFromFile(_0x5a0323);else{if(_0x4aa2f2==='-')_0x84d31e=await readSqlStatementsFromStdin();else{if(_0x4aa2f2&&isSqlFilePath(_0x4aa2f2))_0x84d31e=readSqlStatementsFromFile(_0x4aa2f2);else{if(_0x4aa2f2)_0x84d31e=splitSqlStatements(_0x4aa2f2);else throw new Error(_0x5e38d5(0x209));}}}}catch(_0x32a705){return console[_0x5e38d5(0x216)](_0x5e38d5(0x1de)+_0x32a705[_0x5e38d5(0x206)]),0x1;}const _0x3ddc59=_0x18259f[_0x5e38d5(0x1e5)]||_0x5e38d5(0x1f3),_0x1b4726=_0x18259f['catalog'];try{const _0x17da82=[],_0x43358c=!!_0x18259f[_0x5e38d5(0x1fa)];for(let _0x43f5c8=0x0;_0x43f5c8<_0x84d31e[_0x5e38d5(0x213)];_0x43f5c8++){const _0x5d36b5=_0x84d31e[_0x43f5c8],_0xeada8=_0x43f5c8+0x1,_0x4ee970=_0x84d31e[_0x5e38d5(0x213)],_0x20f64a=_0x4ee970>0x1;_0x18259f['verbose']&&(console['error']('\x0a'+(_0x20f64a?'Statement\x20'+_0xeada8+'/'+_0x4ee970+':':'')),console[_0x5e38d5(0x216)](_0x5e38d5(0x20e)+_0x18259f[_0x5e38d5(0x203)]),console[_0x5e38d5(0x216)](_0x5e38d5(0x1f9)+(_0x1b4726||'td')),console[_0x5e38d5(0x216)](_0x5e38d5(0x212)+_0x3ddc59),console[_0x5e38d5(0x216)](_0x5e38d5(0x1fc)+_0x5d36b5));const _0x120bf8=_0x20f64a?'Executing\x20statement\x20'+_0xeada8+'/'+_0x4ee970+_0x5e38d5(0x1e2):'Executing\x20query...';try{const _0x2634f7=await withQuerySpinner(_0x120bf8,async _0x2697ce=>{const _0x71a9b2=_0x5e38d5,_0x6eb82e=await _0x1636a2[_0x71a9b2(0x1e7)][_0x71a9b2(0x1e4)](_0x5d36b5,{'catalog':_0x1b4726,'schema':_0x3ddc59,'onJobId':_0x2d9a50=>{const _0x523131=_0x71a9b2;_0x2697ce[_0x523131(0x214)](_0x2d9a50);},'onProgress':_0x526356=>{const _0x4e725b=_0x71a9b2;_0x2697ce['setPhase']('Executing\x20query\x20['+_0x526356[_0x4e725b(0x20d)]+']'),_0x2697ce[_0x4e725b(0x1e3)](formatRows(_0x526356[_0x4e725b(0x211)])+'\x20rows\x20'+_0x526356[_0x4e725b(0x1e0)]+'/'+_0x526356[_0x4e725b(0x1df)]+_0x4e725b(0x1f0));}});return _0x6eb82e;},{'verbose':_0x18259f[_0x5e38d5(0x1f5)]}),_0x3aa299=_0x2634f7['data'],_0x19e015=_0x3aa299[_0x5e38d5(0x1ff)]?_0x5e38d5(0x20c)+_0x3aa299[_0x5e38d5(0x1ff)]+']':'',_0xbd7547=_0x20f64a?_0x5e38d5(0x1f7)+_0xeada8+'/'+_0x4ee970+_0x5e38d5(0x1e9):'';console['error']('✔\x20'+_0xbd7547+_0x5e38d5(0x1f6)+formatRows(_0x3aa299[_0x5e38d5(0x1e1)][_0x5e38d5(0x211)])+_0x5e38d5(0x202)+(_0x5e38d5(0x1fe)+formatElapsed(_0x3aa299[_0x5e38d5(0x1e1)][_0x5e38d5(0x1ef)])+_0x19e015));if(_0x20f64a&&_0x43358c){const _0x4e0ac0=resolveOutputOptions(_0x18259f),_0x27f42d=await formatQueryOutput(_0x3aa299,_0x4e0ac0);_0x17da82[_0x5e38d5(0x1ec)](_0x27f42d);}else await handleQueryOutput(_0x3aa299,_0x18259f);}catch(_0x35d8e5){const _0x5c7f77=_0x20f64a?_0x5e38d5(0x1f7)+_0xeada8+'/'+_0x4ee970+':\x0a':'',_0x52c5e5=_0x35d8e5 instanceof SDKError?_0x35d8e5['originalMessage']:_0x35d8e5[_0x5e38d5(0x206)];return console[_0x5e38d5(0x216)](''+_0x5c7f77+_0x52c5e5),0x1;}}if(_0x84d31e[_0x5e38d5(0x213)]>0x1&&_0x43358c&&_0x17da82[_0x5e38d5(0x213)]>0x0){const _0x22e602=_0x17da82[_0x5e38d5(0x20f)]('\x0a');writeFileSync(_0x18259f[_0x5e38d5(0x1fa)],_0x22e602),console[_0x5e38d5(0x216)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x18259f[_0x5e38d5(0x1fa)]);}return 0x0;}catch(_0x55a083){throw _0x55a083;}}[a30_0x248d80(0x1e6)](_0x33535c){const _0x55a6d0=a30_0x248d80,_0xdb7044=_0x33535c[_0x55a6d0(0x210)][0x0],_0x38f300=_0x33535c[_0x55a6d0(0x1ed)][_0x55a6d0(0x1e8)];if(!_0xdb7044&&!_0x38f300)return _0x55a6d0(0x204);if(_0xdb7044&&_0x38f300)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a31_0x5cf2c2=a31_0x3fec;(function(_0x590e82,_0x30134d){const _0x19673e=a31_0x3fec,_0x2f6b8d=_0x590e82();while(!![]){try{const _0x4e7c0c=parseInt(_0x19673e(0xf3))/0x1*(-parseInt(_0x19673e(0x136))/0x2)+-parseInt(_0x19673e(0x102))/0x3+-parseInt(_0x19673e(0xf4))/0x4+parseInt(_0x19673e(0x140))/0x5*(-parseInt(_0x19673e(0xed))/0x6)+-parseInt(_0x19673e(0x129))/0x7+parseInt(_0x19673e(0x15d))/0x8+parseInt(_0x19673e(0x115))/0x9;if(_0x4e7c0c===_0x30134d)break;else _0x2f6b8d['push'](_0x2f6b8d['shift']());}catch(_0x3eef79){_0x2f6b8d['push'](_0x2f6b8d['shift']());}}}(a31_0x46b2,0xb702c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a31_0xb205ff from'chalk';function resolveSegmentTarget(_0x4b32d9,_0x4dbda7,_0x476ea1){const _0x3c6dbc=a31_0x3fec;if(isYamlFilePath(_0x4b32d9))try{const _0x2b0b61=resolveYamlFilePath(_0x4b32d9);return _0x476ea1&&(console[_0x3c6dbc(0x168)](_0x3c6dbc(0x104)+_0x4b32d9),console[_0x3c6dbc(0x168)](_0x3c6dbc(0x142)+_0x2b0b61['parentSegment']),console['error'](_0x3c6dbc(0x164)+_0x2b0b61[_0x3c6dbc(0x13b)]),console[_0x3c6dbc(0x168)]('\x20\x20Folder\x20path:\x20'+(_0x2b0b61[_0x3c6dbc(0x160)]||_0x3c6dbc(0x152))),console['error'](_0x3c6dbc(0x135)+_0x2b0b61[_0x3c6dbc(0x112)])),_0x2b0b61[_0x3c6dbc(0x112)];}catch(_0x4484e1){throw new SDKError(ErrorCode[_0x3c6dbc(0x17a)],_0x3c6dbc(0xee)+_0x4484e1['message']);}if(!_0x4dbda7)throw new SDKError(ErrorCode[_0x3c6dbc(0x17a)],_0x3c6dbc(0x131));return _0x4dbda7+'/'+_0x4b32d9;}function a31_0x3fec(_0x4503f7,_0x3e3215){_0x4503f7=_0x4503f7-0xe1;const _0x46b2cf=a31_0x46b2();let _0x3fecef=_0x46b2cf[_0x4503f7];return _0x3fecef;}export class SegmentDescribeCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]=a31_0x5cf2c2(0x101);[a31_0x5cf2c2(0x170)]=a31_0x5cf2c2(0x16c);async[a31_0x5cf2c2(0x174)](_0xb2630){const _0x6cefae=a31_0x5cf2c2,{options:_0x37957a,args:_0x4dcbb5,tdx:_0x36640d}=_0xb2630,_0x14b15b=_0x4dcbb5[0x0],_0x5e5936=!_0x14b15b&&!!_0x37957a[_0x6cefae(0x128)],_0x1bff6d=_0x14b15b||_0x37957a[_0x6cefae(0x128)];if(!_0x1bff6d)return console[_0x6cefae(0x168)](_0x6cefae(0xe5)),console['error'](_0x6cefae(0x127)),console[_0x6cefae(0x168)](_0x6cefae(0x132)),console[_0x6cefae(0x168)](_0x6cefae(0x100)),console['error'](_0x6cefae(0x11f)),console[_0x6cefae(0x168)](_0x6cefae(0x124)),console[_0x6cefae(0x168)](_0x6cefae(0x137)),0x1;try{const _0x9afd4f=_0x37957a[_0x6cefae(0xf9)];let _0x498947=_0x1bff6d;!_0x5e5936&&_0x9afd4f&&!_0x1bff6d['includes']('/')&&(_0x498947=_0x9afd4f+'/'+_0x1bff6d,_0x37957a['verbose']&&console[_0x6cefae(0x168)]('Resolved\x20relative\x20path\x20to:\x20'+_0x498947));const _0x2488ef=await withSpinner(_0x6cefae(0x10d)+_0x498947+_0x6cefae(0x14c),()=>_0x36640d[_0x6cefae(0xf2)][_0x6cefae(0xeb)](_0x498947),{'verbose':_0x37957a[_0x6cefae(0x153)]}),_0x103d00=_0x2488ef[_0x6cefae(0x10e)];_0x37957a[_0x6cefae(0x153)]&&(console[_0x6cefae(0x168)]('Resolved\x20type:\x20'+_0x103d00['type']),console[_0x6cefae(0x168)]('Parent\x20ID:\x20'+_0x103d00[_0x6cefae(0x15e)]),_0x103d00[_0x6cefae(0xe8)]&&console[_0x6cefae(0x168)](_0x6cefae(0x16a)+_0x103d00[_0x6cefae(0xe8)]),_0x103d00[_0x6cefae(0x114)]&&console[_0x6cefae(0x168)]('Segment\x20ID:\x20'+_0x103d00[_0x6cefae(0x114)]));if(_0x103d00[_0x6cefae(0x12e)]==='parent'){const _0x5d2e54=await withSpinner(_0x6cefae(0x10f),()=>_0x36640d[_0x6cefae(0xf2)][_0x6cefae(0x133)](_0x103d00[_0x6cefae(0x15e)]),{'verbose':_0x37957a['verbose']});await handleSingleObjectOutput(_0x5d2e54[_0x6cefae(0x10e)],_0x37957a);}else{if(_0x103d00[_0x6cefae(0x12e)]==='folder'){if(!_0x103d00['folderId'])throw new SDKError(ErrorCode[_0x6cefae(0xf8)],_0x6cefae(0x109));const _0x434221=await withSpinner(_0x6cefae(0xe3),()=>_0x36640d[_0x6cefae(0xf2)][_0x6cefae(0xe2)](_0x103d00['folderId']),{'verbose':_0x37957a[_0x6cefae(0x153)]});await handleSingleObjectOutput(_0x434221[_0x6cefae(0x10e)],_0x37957a);}else{if(_0x103d00['type']==='segment'){if(!_0x103d00[_0x6cefae(0x114)])throw new SDKError(ErrorCode[_0x6cefae(0x14d)],_0x6cefae(0x167));const _0x10e3d6=await withSpinner(_0x6cefae(0xec),()=>_0x36640d[_0x6cefae(0xf2)][_0x6cefae(0xea)](_0x103d00['parentId'],_0x103d00['segmentId']),{'verbose':_0x37957a['verbose']});await handleSingleObjectOutput(_0x10e3d6[_0x6cefae(0x10e)],_0x37957a);}}}return 0x0;}catch(_0x5f5287){if(_0x5f5287 instanceof SDKError)return console[_0x6cefae(0x168)](_0x6cefae(0x113)+_0x5f5287[_0x6cefae(0x158)]),_0x5f5287[_0x6cefae(0x139)]&&console[_0x6cefae(0x168)](_0x6cefae(0x141)+_0x5f5287[_0x6cefae(0x139)]),0x1;throw _0x5f5287;}}}export class SegmentShowCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]='segment:show';[a31_0x5cf2c2(0x170)]=a31_0x5cf2c2(0x175);async[a31_0x5cf2c2(0x174)](_0x377d82){const _0x3851b1=a31_0x5cf2c2,{options:_0xb01003,args:_0x25bbdf,tdx:_0x17671c}=_0x377d82,_0x2169c1=_0x25bbdf[0x0];if(!_0x2169c1)return console[_0x3851b1(0x168)](_0x3851b1(0x161)),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x3851b1(0x168)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x3851b1(0x168)]('Examples:'),console[_0x3851b1(0x168)](_0x3851b1(0x11b)),console[_0x3851b1(0x168)](_0x3851b1(0x105)),0x1;try{const _0x1e5c27=_0xb01003[_0x3851b1(0x128)],_0x3c1068=resolveSegmentTarget(_0x2169c1,_0x1e5c27,_0xb01003[_0x3851b1(0x153)]);_0xb01003[_0x3851b1(0x153)]&&console[_0x3851b1(0x168)](_0x3851b1(0x17d)+_0x3c1068);const _0x38170e=await withSpinner(_0x3851b1(0x17b)+_0x2169c1+_0x3851b1(0x14c),()=>_0x17671c['segment'][_0x3851b1(0xeb)](_0x3c1068),{'verbose':_0xb01003[_0x3851b1(0x153)]}),_0x58ea48=_0x38170e[_0x3851b1(0x10e)];_0xb01003[_0x3851b1(0x153)]&&(console[_0x3851b1(0x168)](_0x3851b1(0x130)+_0x58ea48[_0x3851b1(0x12e)]),console[_0x3851b1(0x168)]('Parent\x20ID:\x20'+_0x58ea48[_0x3851b1(0x15e)]));if(_0x58ea48[_0x3851b1(0x12e)]===_0x3851b1(0x150))return console[_0x3851b1(0x168)](_0x3851b1(0x15b)),console[_0x3851b1(0x168)](_0x3851b1(0x126)),0x1;if(_0x58ea48['type']===_0x3851b1(0x120))return console[_0x3851b1(0x168)](_0x3851b1(0xe6)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x58ea48['segmentId'])throw new SDKError(ErrorCode[_0x3851b1(0x14d)],_0x3851b1(0x167));const _0x5e6d51=await withSpinner(_0x3851b1(0x14a),()=>_0x17671c[_0x3851b1(0xf2)][_0x3851b1(0x17c)](_0x58ea48[_0x3851b1(0x15e)],_0x58ea48['segmentId']),{'verbose':_0xb01003[_0x3851b1(0x153)]});let _0x22bd87=_0x5e6d51[_0x3851b1(0x10e)];const _0x5306f9=resolveLimit(_0xb01003[_0x3851b1(0x145)],DEFAULT_DISPLAY_LIMIT),_0x1bdfc5=/\bLIMIT\s+\d+/i[_0x3851b1(0x147)](_0x22bd87);!_0x1bdfc5&&(_0x22bd87=_0x22bd87[_0x3851b1(0x14e)]()[_0x3851b1(0x156)](/;+$/,''),_0x22bd87=_0x3851b1(0x151)+_0x22bd87+_0x3851b1(0xe4)+_0x5306f9);_0xb01003['verbose']&&console[_0x3851b1(0x168)](_0x3851b1(0x157)+_0x22bd87);const _0x36d4bb=await withQuerySpinner(_0x3851b1(0x12a),async _0x415196=>{const _0x5c2123=_0x3851b1,_0x5572fa=await _0x17671c[_0x5c2123(0x107)][_0x5c2123(0x174)](_0x22bd87,{'catalog':'td','schema':_0x5c2123(0x179),'onJobId':_0x27f409=>{const _0x1ffacb=_0x5c2123;_0x415196[_0x1ffacb(0xe9)](_0x27f409);}});return _0x5572fa;},{'verbose':_0xb01003[_0x3851b1(0x153)]}),_0x4b82a0=_0x36d4bb[_0x3851b1(0x10e)],_0xb519d2=_0x4b82a0[_0x3851b1(0xef)]?_0x3851b1(0x15c)+_0x4b82a0[_0x3851b1(0xef)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x4b82a0[_0x3851b1(0x176)][_0x3851b1(0x111)][_0x3851b1(0x117)]()+_0x3851b1(0xff)+(_0x3851b1(0x149)+formatElapsed(_0x4b82a0[_0x3851b1(0x176)]['elapsedTimeMillis'])+_0xb519d2)),await handleQueryOutput(_0x4b82a0,_0xb01003),0x0;}catch(_0x30ee09){if(_0x30ee09 instanceof SDKError)return console[_0x3851b1(0x168)](_0x3851b1(0x166)+_0x30ee09[_0x3851b1(0x14b)]+']'),console['error']('\x0a'+_0x30ee09[_0x3851b1(0x158)]),0x1;throw _0x30ee09;}}}export class SegmentFolderListCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]=a31_0x5cf2c2(0xe1);[a31_0x5cf2c2(0x170)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a31_0x5cf2c2(0x174)](_0x1555cd){const _0x2c18a7=a31_0x5cf2c2,{options:_0x1a35d1,args:_0xef71b2,tdx:_0x11bdd5}=_0x1555cd;if(_0xef71b2['length']===0x0)return console[_0x2c18a7(0x168)](_0x2c18a7(0x11c)),console['error'](_0x2c18a7(0x16d)),0x1;const _0x72aca3=_0xef71b2[0x0];try{_0x1a35d1[_0x2c18a7(0x153)]&&(console[_0x2c18a7(0x168)]('Site:\x20'+_0x1a35d1['site']),console[_0x2c18a7(0x168)]('Parent\x20name:\x20'+_0x72aca3));const _0x5b4b47=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x72aca3+_0x2c18a7(0x14c),()=>_0x11bdd5[_0x2c18a7(0xf2)][_0x2c18a7(0x154)](_0x72aca3),{'verbose':_0x1a35d1[_0x2c18a7(0x153)]}),_0x13edac=_0x5b4b47[_0x2c18a7(0x10e)];_0x1a35d1[_0x2c18a7(0x153)]&&console[_0x2c18a7(0x168)]('Resolved\x20parent\x20ID:\x20'+_0x13edac);const _0x5e770a=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x72aca3+_0x2c18a7(0x14c),()=>_0x11bdd5[_0x2c18a7(0xf2)][_0x2c18a7(0xf0)](_0x13edac),{'verbose':_0x1a35d1[_0x2c18a7(0x153)]}),_0x512e19=_0x5e770a[_0x2c18a7(0x10e)];return console[_0x2c18a7(0x168)](_0x2c18a7(0xfe)+_0x512e19[_0x2c18a7(0x121)]+_0x2c18a7(0x13c)+(_0x512e19[_0x2c18a7(0x121)]!==0x1?'s':'')),await handleSDKOutput(_0x512e19,_0x1a35d1),0x0;}catch(_0x300278){if(_0x300278 instanceof SDKError)return console[_0x2c18a7(0x168)](_0x2c18a7(0x113)+_0x300278[_0x2c18a7(0x158)]),_0x300278[_0x2c18a7(0x139)]&&console['error'](_0x2c18a7(0x141)+_0x300278[_0x2c18a7(0x139)]),0x1;throw _0x300278;}}}export class SegmentFolderShowCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]=a31_0x5cf2c2(0x11e);[a31_0x5cf2c2(0x170)]='Show\x20segment\x20folder\x20details';async[a31_0x5cf2c2(0x174)](_0x589dff){const _0x3b4821=a31_0x5cf2c2,{options:_0x3cd23f,args:_0x14dd1a,tdx:_0x3eac3a}=_0x589dff;if(_0x14dd1a['length']===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x3b4821(0x168)](_0x3b4821(0x177)),0x1;try{const {parentId:_0x1b4d6b,childId:_0x417c75}=parseSegmentRef(_0x14dd1a[0x0]);_0x3cd23f[_0x3b4821(0x153)]&&(console['error'](_0x3b4821(0x172)+_0x3cd23f[_0x3b4821(0x12d)]),console[_0x3b4821(0x168)](_0x3b4821(0x15f)+_0x1b4d6b),_0x417c75&&console[_0x3b4821(0x168)](_0x3b4821(0x138)+_0x417c75));if(!_0x417c75)return console['error'](_0x3b4821(0xe7)),0x1;const _0x112009=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1b4d6b+_0x3b4821(0x14c),()=>_0x3eac3a[_0x3b4821(0xf2)][_0x3b4821(0x154)](_0x1b4d6b),{'verbose':_0x3cd23f['verbose']}),_0x5852f7=_0x112009[_0x3b4821(0x10e)];_0x3cd23f[_0x3b4821(0x153)]&&console[_0x3b4821(0x168)](_0x3b4821(0x106)+_0x5852f7);const _0xc5ba99=await withSpinner(_0x3b4821(0x13a)+_0x417c75+_0x3b4821(0x14c),()=>_0x3eac3a[_0x3b4821(0xf2)]['resolveFolderId'](_0x5852f7,_0x417c75),{'verbose':_0x3cd23f['verbose']}),_0x528eb7=_0xc5ba99['data'];_0x3cd23f[_0x3b4821(0x153)]&&console[_0x3b4821(0x168)](_0x3b4821(0x119)+_0x528eb7);const _0x5d3a92=await withSpinner('Fetching\x20folder\x20\x27'+_0x417c75+_0x3b4821(0x14c),()=>_0x3eac3a['segment'][_0x3b4821(0xe2)](_0x528eb7),{'verbose':_0x3cd23f['verbose']});return await handleSDKOutput([_0x5d3a92[_0x3b4821(0x10e)]],_0x3cd23f),0x0;}catch(_0x5dc7eb){if(_0x5dc7eb instanceof SDKError)return console[_0x3b4821(0x168)](_0x3b4821(0x113)+_0x5dc7eb['message']),_0x5dc7eb[_0x3b4821(0x139)]&&console[_0x3b4821(0x168)](_0x3b4821(0x141)+_0x5dc7eb[_0x3b4821(0x139)]),0x1;throw _0x5dc7eb;}}}export class SegmentSQLCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]=a31_0x5cf2c2(0x10b);[a31_0x5cf2c2(0x170)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a31_0x5cf2c2(0x174)](_0x15d996){const _0x5a2fec=a31_0x5cf2c2,{options:_0x3992a0,args:_0x1b2d7a,tdx:_0x59bf4f}=_0x15d996,_0x195fa9=_0x1b2d7a[0x0];if(!_0x195fa9)return console[_0x5a2fec(0x168)](_0x5a2fec(0x161)),console[_0x5a2fec(0x168)](_0x5a2fec(0x103)),console['error'](_0x5a2fec(0x143)),console[_0x5a2fec(0x168)](_0x5a2fec(0x132)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x52e813=_0x3992a0[_0x5a2fec(0x128)],_0xd1728e=resolveSegmentTarget(_0x195fa9,_0x52e813,_0x3992a0[_0x5a2fec(0x153)]);_0x3992a0[_0x5a2fec(0x153)]&&console['error'](_0x5a2fec(0x17d)+_0xd1728e);const _0x12d09c=await withSpinner(_0x5a2fec(0x17b)+_0x195fa9+'\x27...',()=>_0x59bf4f[_0x5a2fec(0xf2)][_0x5a2fec(0xeb)](_0xd1728e),{'verbose':_0x3992a0['verbose']}),_0x3d9fbe=_0x12d09c['data'];_0x3992a0[_0x5a2fec(0x153)]&&(console[_0x5a2fec(0x168)]('Resolved\x20type:\x20'+_0x3d9fbe[_0x5a2fec(0x12e)]),console['error'](_0x5a2fec(0x12b)+_0x3d9fbe[_0x5a2fec(0x15e)]));if(_0x3d9fbe[_0x5a2fec(0x12e)]==='folder')return console[_0x5a2fec(0x168)](_0x5a2fec(0xf7)),console[_0x5a2fec(0x168)](_0x5a2fec(0x159)),0x1;if(_0x3d9fbe[_0x5a2fec(0x12e)]===_0x5a2fec(0x120))return console[_0x5a2fec(0x168)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5a2fec(0x168)](_0x5a2fec(0x125)),0x1;if(!_0x3d9fbe[_0x5a2fec(0x114)])throw new SDKError(ErrorCode[_0x5a2fec(0x14d)],_0x5a2fec(0x167));const _0x46de48=await withSpinner(_0x5a2fec(0x14a),()=>_0x59bf4f[_0x5a2fec(0xf2)][_0x5a2fec(0x17c)](_0x3d9fbe[_0x5a2fec(0x15e)],_0x3d9fbe[_0x5a2fec(0x114)]),{'verbose':_0x3992a0['verbose']}),_0x4faf42=_0x46de48['data'];return _0x3992a0[_0x5a2fec(0x146)]===_0x5a2fec(0x11a)||_0x3992a0[_0x5a2fec(0x146)]===_0x5a2fec(0x15a)?await handleSDKOutput([{'sql':_0x4faf42}],_0x3992a0):console[_0x5a2fec(0xfb)](_0x4faf42),0x0;}catch(_0x51b928){if(_0x51b928 instanceof SDKError)return console[_0x5a2fec(0x168)](_0x5a2fec(0x113)+_0x51b928['message']),_0x51b928[_0x5a2fec(0x139)]&&console[_0x5a2fec(0x168)](_0x5a2fec(0x141)+_0x51b928[_0x5a2fec(0x139)]),0x1;throw _0x51b928;}}}function a31_0x46b2(){const _0x55e1a0=['36880461TLXGhu','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','Use:\x20tdx\x20ps\x20view\x20-w','Resolved\x20folder\x20ID:\x20','json','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment:folder:show','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','parent','length','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Use:\x20tdx\x20ps\x20sql','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Usage:\x20tdx\x20segment\x20describe\x20<path>','parentSegment','5258400rtIWDv','Executing\x20segment\x20query...','Parent\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','site','type','resolveFolderId','Resolved\x20type:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Examples:','getParent','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Full\x20path:\x20','877136MTUWCG','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Folder\x20name:\x20','cause','Resolving\x20folder\x20\x27','segmentName','\x20folder','parentFolder','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolving\x20parent\x20segment\x20\x27','3565GXRrWH','\x20\x20Cause:\x20','\x20\x20Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Options:','limit','format','test','cyan','in\x20','Fetching\x20SQL\x20for\x20segment...','code','\x27...','SEGMENT_NOT_FOUND','trim','/app/ps/','folder','SELECT\x20*\x20FROM\x20(\x0a','(root)','verbose','resolveParentId','Parent\x20segment:\x20','replace','SQL\x20query:\x0a','message','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','jsonl','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20[Job\x20ID:\x20','5167008uESukm','parentId','Parent\x20name:\x20','folderPath','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20Segment\x20name:\x20','web','✖\x20Query\x20failed\x20[','Segment\x20ID\x20missing\x20from\x20resolved\x20path','error','segment:view','Folder\x20ID:\x20','Use:\x20tdx\x20ps\x20desc','Show\x20segment\x20or\x20folder\x20details','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','✔\x20Created\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','description','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Site:\x20','Resolving\x20parent\x20folder\x20\x27','execute','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','stats','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','information_schema','INVALID_ARGUMENT','Resolving\x20\x27','getSegmentSQL','Target\x20path:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','segment:folder:list','getFolder','Fetching\x20folder\x20details...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','folderId','setJobId','getSegment','resolvePathToResource','Fetching\x20segment\x20details...','4458ASvzkO','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','jobId','listFolders','green','segment','1jIXWTb','3892036QiinjL','name','/e/','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','SEGMENT_FOLDER_NOT_FOUND','segmentPath','Resolved\x20parent\x20folder\x20ID:\x20','log','Use:\x20tdx\x20ps\x20view','\x27\x20with\x20ID:\x20','✔\x20Found\x20','\x20rows\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','segment:describe','3904671uNFjuc','Usage:\x20tdx\x20sg\x20sql\x20<name>','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Resolved\x20parent\x20ID:\x20','query','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment:sql','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolving\x20path\x20\x27','data','Fetching\x20parent\x20segment\x20details...','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','processedRows','fullPath','Error:\x20','segmentId'];a31_0x46b2=function(){return _0x55e1a0;};return a31_0x46b2();}export class SegmentFolderCreateCommand extends BaseCommand{['name']='segment:folder:create';[a31_0x5cf2c2(0x170)]='Create\x20segment\x20folder\x20for\x20organization';async[a31_0x5cf2c2(0x174)](_0x2b09e5){const _0x1090ec=a31_0x5cf2c2,{options:_0x23c89b,args:_0x5a7a5e,tdx:_0xbc85da}=_0x2b09e5,_0x51faf4=_0x23c89b;if(_0x5a7a5e['length']<0x2)return console['error'](_0x1090ec(0x162)),console['error'](_0x1090ec(0x13e)),0x1;const _0x121ac=_0x5a7a5e[0x0],_0x50492a=_0x5a7a5e[0x1];_0x51faf4['verbose']&&(console[_0x1090ec(0x168)](_0x1090ec(0x172)+_0x51faf4[_0x1090ec(0x12d)]),console[_0x1090ec(0x168)](_0x1090ec(0x155)+_0x121ac),console[_0x1090ec(0x168)](_0x1090ec(0x138)+_0x50492a));let _0x453867;if(_0x51faf4[_0x1090ec(0x13d)]){const _0x3c47aa=_0x51faf4[_0x1090ec(0x13d)],_0x4f2ca0=await withSpinner(_0x1090ec(0x13f)+_0x121ac+_0x1090ec(0x14c),()=>_0xbc85da[_0x1090ec(0xf2)]['resolveParentId'](_0x121ac),{'verbose':_0x51faf4[_0x1090ec(0x153)]}),_0x470e28=_0x4f2ca0[_0x1090ec(0x10e)],_0x3e7fea=await withSpinner(_0x1090ec(0x173)+_0x3c47aa+'\x27...',()=>_0xbc85da[_0x1090ec(0xf2)][_0x1090ec(0x12f)](_0x470e28,_0x3c47aa),{'verbose':_0x51faf4[_0x1090ec(0x153)]});_0x453867=_0x3e7fea[_0x1090ec(0x10e)],_0x51faf4['verbose']&&console[_0x1090ec(0x168)](_0x1090ec(0xfa)+_0x453867);}const _0x1f6d3e={'name':_0x50492a,'description':_0x51faf4[_0x1090ec(0x170)],'parentFolderId':_0x453867},_0x4f91aa=await withSpinner('Creating\x20folder\x20\x27'+_0x50492a+'\x27...',()=>_0xbc85da['segment']['createFolder'](_0x121ac,_0x1f6d3e),{'verbose':_0x51faf4[_0x1090ec(0x153)]}),_0x468ee6=_0x4f91aa[_0x1090ec(0x10e)];return console[_0x1090ec(0x168)](_0x1090ec(0x16e)+_0x468ee6[_0x1090ec(0xf5)]+_0x1090ec(0xfd)+_0x468ee6['id']),await handleSDKOutput([_0x468ee6],_0x51faf4),0x0;}}export class SegmentViewCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]=a31_0x5cf2c2(0x169);[a31_0x5cf2c2(0x170)]=a31_0x5cf2c2(0x17e);async[a31_0x5cf2c2(0x174)](_0x45f8a9){const _0x4b6435=a31_0x5cf2c2,{options:_0x2d1f0e,args:_0x2d25bc,tdx:_0x80bf4c}=_0x45f8a9,_0x33c37b=_0x2d25bc[0x0];if(!_0x33c37b)return console[_0x4b6435(0x168)](_0x4b6435(0x171)),console['error'](_0x4b6435(0x11d)),console[_0x4b6435(0x168)](_0x4b6435(0x123)),console[_0x4b6435(0x168)](_0x4b6435(0x144)),console[_0x4b6435(0x168)](_0x4b6435(0x12c)),console[_0x4b6435(0x168)](_0x4b6435(0x132)),console[_0x4b6435(0x168)](_0x4b6435(0x110)),console[_0x4b6435(0x168)](_0x4b6435(0x108)),console[_0x4b6435(0x168)](_0x4b6435(0x10a)),console[_0x4b6435(0x168)](_0x4b6435(0x10c)),0x1;try{const _0x1c23bd=_0x2d1f0e[_0x4b6435(0x128)],_0x22c23e=resolveSegmentTarget(_0x33c37b,_0x1c23bd,_0x2d1f0e['verbose']);_0x2d1f0e[_0x4b6435(0x153)]&&console[_0x4b6435(0x168)](_0x4b6435(0x17d)+_0x22c23e);const _0x4d87b5=await withSpinner('Resolving\x20\x27'+_0x33c37b+_0x4b6435(0x14c),()=>_0x80bf4c[_0x4b6435(0xf2)][_0x4b6435(0xeb)](_0x22c23e),{'verbose':_0x2d1f0e['verbose']}),_0x20d62b=_0x4d87b5['data'];_0x2d1f0e[_0x4b6435(0x153)]&&(console[_0x4b6435(0x168)]('Resolved\x20type:\x20'+_0x20d62b[_0x4b6435(0x12e)]),console['error']('Parent\x20ID:\x20'+_0x20d62b[_0x4b6435(0x15e)]),_0x20d62b['folderId']&&console[_0x4b6435(0x168)](_0x4b6435(0x16a)+_0x20d62b['folderId']),_0x20d62b[_0x4b6435(0x114)]&&console[_0x4b6435(0x168)]('Segment\x20ID:\x20'+_0x20d62b[_0x4b6435(0x114)]));if(_0x2d1f0e[_0x4b6435(0x165)]){if(_0x20d62b['type']===_0x4b6435(0x150))return console['error'](_0x4b6435(0x134)),0x1;if(_0x20d62b[_0x4b6435(0x12e)]===_0x4b6435(0x120))return console[_0x4b6435(0x168)](_0x4b6435(0x122)),console[_0x4b6435(0x168)](_0x4b6435(0x118)),0x1;if(!_0x20d62b[_0x4b6435(0x114)])throw new SDKError(ErrorCode[_0x4b6435(0x14d)],_0x4b6435(0x167));const _0x55adc7=getConsoleNextUrl(_0x2d1f0e[_0x4b6435(0x12d)],_0x4b6435(0x14f)+_0x20d62b['parentId']+'/e/'+_0x20d62b['segmentId']);return console['error'](a31_0xb205ff[_0x4b6435(0xf1)]('✔')+'\x20Opening\x20'+a31_0xb205ff[_0x4b6435(0x148)](_0x55adc7)),openBrowser(_0x55adc7),0x0;}if(_0x20d62b[_0x4b6435(0x12e)]==='folder'){if(!_0x20d62b[_0x4b6435(0xe8)])throw new SDKError(ErrorCode[_0x4b6435(0xf8)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x147aad=await withSpinner(_0x4b6435(0xe3),()=>_0x80bf4c[_0x4b6435(0xf2)][_0x4b6435(0xe2)](_0x20d62b['folderId']),{'verbose':_0x2d1f0e['verbose']});await handleSingleObjectOutput(_0x147aad[_0x4b6435(0x10e)],_0x2d1f0e);}else{if(_0x20d62b[_0x4b6435(0x12e)]===_0x4b6435(0xf2)){if(!_0x20d62b[_0x4b6435(0x114)])throw new SDKError(ErrorCode[_0x4b6435(0x14d)],_0x4b6435(0x167));const _0x1dd2f4=await withSpinner(_0x4b6435(0xec),()=>_0x80bf4c['segment'][_0x4b6435(0xea)](_0x20d62b['parentId'],_0x20d62b[_0x4b6435(0x114)]),{'verbose':_0x2d1f0e[_0x4b6435(0x153)]}),_0x2911e8=getConsoleNextUrl(_0x2d1f0e[_0x4b6435(0x12d)],_0x4b6435(0x14f)+_0x20d62b[_0x4b6435(0x15e)]+_0x4b6435(0xf6)+_0x20d62b[_0x4b6435(0x114)]),_0x31f936=_0x1dd2f4['data'];_0x31f936['url']=_0x2911e8,await handleSingleObjectOutput(_0x31f936,_0x2d1f0e);}else return console[_0x4b6435(0x168)](_0x4b6435(0x178)),console[_0x4b6435(0x168)](_0x4b6435(0xfc)),0x1;}return 0x0;}catch(_0x12897b){if(_0x12897b instanceof SDKError)return console['error'](_0x4b6435(0x113)+_0x12897b[_0x4b6435(0x158)]),_0x12897b[_0x4b6435(0x139)]&&console[_0x4b6435(0x168)](_0x4b6435(0x141)+_0x12897b['cause']),0x1;throw _0x12897b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a31_0x5cf2c2(0xf5)]='segment:desc';['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a31_0x5cf2c2(0x174)](_0x3fd599){const _0x2e65f0=a31_0x5cf2c2,{options:_0x55e9ea,args:_0x28f363,tdx:_0x514c64}=_0x3fd599,_0xdd700d=_0x28f363[0x0];if(!_0xdd700d)return console['error'](_0x2e65f0(0x161)),console[_0x2e65f0(0x168)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x2e65f0(0x168)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x2e65f0(0x168)](_0x2e65f0(0x132)),console[_0x2e65f0(0x168)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x2e65f0(0x168)](_0x2e65f0(0x163)),0x1;try{const _0x4f6097=_0x55e9ea[_0x2e65f0(0x128)],_0x7994d4=resolveSegmentTarget(_0xdd700d,_0x4f6097,_0x55e9ea['verbose']);_0x55e9ea['verbose']&&console['error'](_0x2e65f0(0x17d)+_0x7994d4);const _0x565406=await withSpinner(_0x2e65f0(0x17b)+_0xdd700d+'\x27...',()=>_0x514c64['segment'][_0x2e65f0(0xeb)](_0x7994d4),{'verbose':_0x55e9ea['verbose']}),_0x505c5e=_0x565406[_0x2e65f0(0x10e)];_0x55e9ea[_0x2e65f0(0x153)]&&(console[_0x2e65f0(0x168)](_0x2e65f0(0x130)+_0x505c5e[_0x2e65f0(0x12e)]),console[_0x2e65f0(0x168)](_0x2e65f0(0x12b)+_0x505c5e['parentId']));if(_0x505c5e[_0x2e65f0(0x12e)]==='folder')return console[_0x2e65f0(0x168)](_0x2e65f0(0x16f)),console[_0x2e65f0(0x168)](_0x2e65f0(0x159)),0x1;if(_0x505c5e[_0x2e65f0(0x12e)]===_0x2e65f0(0x120))return console[_0x2e65f0(0x168)](_0x2e65f0(0x116)),console[_0x2e65f0(0x168)](_0x2e65f0(0x16b)),0x1;if(!_0x505c5e[_0x2e65f0(0x114)])throw new SDKError(ErrorCode[_0x2e65f0(0x14d)],_0x2e65f0(0x167));const _0x1c435a=await withSpinner(_0x2e65f0(0x14a),()=>_0x514c64['segment'][_0x2e65f0(0x17c)](_0x505c5e['parentId'],_0x505c5e[_0x2e65f0(0x114)]),{'verbose':_0x55e9ea[_0x2e65f0(0x153)]}),_0x3570e0=_0x1c435a[_0x2e65f0(0x10e)],_0x50c679=await executeSchemaQuery(_0x3570e0,_0x514c64,_0x55e9ea);return await handleQueryOutput(_0x50c679,_0x55e9ea),0x0;}catch(_0x5459aa){if(_0x5459aa instanceof SDKError)return console[_0x2e65f0(0x168)](_0x2e65f0(0x113)+_0x5459aa[_0x2e65f0(0x158)]),_0x5459aa[_0x2e65f0(0x139)]&&console[_0x2e65f0(0x168)](_0x2e65f0(0x141)+_0x5459aa[_0x2e65f0(0x139)]),0x1;throw _0x5459aa;}}}
1
+ const a31_0xb6de7f=a31_0x386a;(function(_0x459a0b,_0x18a320){const _0x324522=a31_0x386a,_0x45f086=_0x459a0b();while(!![]){try{const _0x2c4089=-parseInt(_0x324522(0x1c5))/0x1*(parseInt(_0x324522(0x1f8))/0x2)+parseInt(_0x324522(0x1ce))/0x3+-parseInt(_0x324522(0x1a2))/0x4*(-parseInt(_0x324522(0x1b2))/0x5)+parseInt(_0x324522(0x1a3))/0x6*(-parseInt(_0x324522(0x1ba))/0x7)+-parseInt(_0x324522(0x204))/0x8+parseInt(_0x324522(0x1cc))/0x9+parseInt(_0x324522(0x1de))/0xa;if(_0x2c4089===_0x18a320)break;else _0x45f086['push'](_0x45f086['shift']());}catch(_0x521e98){_0x45f086['push'](_0x45f086['shift']());}}}(a31_0x5115,0xc465d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';function a31_0x5115(){const _0x581fee=['Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','verbose','segment','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Use:\x20tdx\x20ps\x20show','type','trim','Resolved\x20parent\x20ID:\x20','SEGMENT_NOT_FOUND','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','5buTYZh','replace','cyan','Resolved\x20folder\x20ID:\x20','Use:\x20tdx\x20ps\x20desc','Parent\x20name:\x20','url','processedRows','119GLgdsl','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','error','Show\x20segment\x20or\x20folder\x20details','code','createFolder','SELECT\x20*\x20FROM\x20(\x0a','segment:show','INVALID_ARGUMENT','segmentPath','Resolving\x20folder\x20\x27','1KGQsIk','elapsedTimeMillis','resolvePathToResource','Parent\x20ID:\x20','Examples:','Resolving\x20\x27','limit','4209570yJMRFn','Error:\x20Path\x20or\x20name\x20is\x20required','89796zkTXtS','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','getFolder','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','jobId','length','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','test','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20folder','json','execute','26053440TpeNeM','Options:','\x20[Job\x20ID:\x20','segment:sql','Creating\x20folder\x20\x27','✔\x20Created\x20folder\x20\x27','getParent','SQL\x20query:\x0a','Folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Folder\x20name:\x20','web','in\x20','green','Show\x20child\x20segment\x20schema\x20(column\x20types)','cause','segment:folder:create','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','parentId','format','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','log','message','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','2100386RmbBCs','includes','Executing\x20segment\x20query...','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSegment','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','toLocaleString','Parent\x20segment:\x20','10226488jvzGTZ','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','folderId','parentSegment','data','Site:\x20','description','Error:\x20','parent','parentFolder','Use:\x20tdx\x20ps\x20view','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','/app/ps/','resolveFolderId','Usage:\x20tdx\x20sg\x20desc\x20<name>','Create\x20segment\x20folder\x20for\x20organization','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Full\x20path:\x20','information_schema','folderPath','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','site','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Cause:\x20','✔\x20Found\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Fetching\x20segment\x20details...','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Fetching\x20parent\x20segment\x20details...','/e/','stats','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Listing\x20folders\x20for\x20parent\x20\x27','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20Segment\x20name:\x20','setJobId','name','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','folder','getSegmentSQL','resolveParentId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Folder\x20reference\x20is\x20required','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20Parent\x20segment:\x20','Resolved\x20type:\x20','segment:describe','segmentId','query','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','(root)','Resolved\x20parent\x20folder\x20ID:\x20','Segment\x20ID:\x20','fullPath','jsonl','Fetching\x20folder\x20details...','4965656fqUvXM','427578Rjilaq','segment:folder:show','\x27...','segment:desc'];a31_0x5115=function(){return _0x581fee;};return a31_0x5115();}import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a31_0x5bdee0 from'chalk';function resolveSegmentTarget(_0x170c4a,_0x4977d3,_0xe74e35){const _0x5d838d=a31_0x386a;if(isYamlFilePath(_0x170c4a))try{const _0x3b4776=resolveYamlFilePath(_0x170c4a);return _0xe74e35&&(console['error'](_0x5d838d(0x1a7)+_0x170c4a),console[_0x5d838d(0x1bc)](_0x5d838d(0x196)+_0x3b4776[_0x5d838d(0x209)]),console[_0x5d838d(0x1bc)](_0x5d838d(0x18c)+_0x3b4776['segmentName']),console['error']('\x20\x20Folder\x20path:\x20'+(_0x3b4776[_0x5d838d(0x219)]||_0x5d838d(0x19c))),console[_0x5d838d(0x1bc)](_0x5d838d(0x217)+_0x3b4776[_0x5d838d(0x19f)])),_0x3b4776[_0x5d838d(0x19f)];}catch(_0x4c30af){throw new SDKError(ErrorCode[_0x5d838d(0x1c2)],_0x5d838d(0x1bb)+_0x4c30af[_0x5d838d(0x1f4)]);}if(!_0x4977d3)throw new SDKError(ErrorCode[_0x5d838d(0x1c2)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x4977d3+'/'+_0x170c4a;}export class SegmentDescribeCommand extends BaseCommand{[a31_0xb6de7f(0x18e)]=a31_0xb6de7f(0x198);[a31_0xb6de7f(0x20c)]=a31_0xb6de7f(0x1bd);async[a31_0xb6de7f(0x1dd)](_0x597c00){const _0x41b234=a31_0xb6de7f,{options:_0x31b425,args:_0x143e86,tdx:_0xd70062}=_0x597c00,_0x439d41=_0x143e86[0x0],_0xe9b09=!_0x439d41&&!!_0x31b425[_0x41b234(0x209)],_0x1471ee=_0x439d41||_0x31b425[_0x41b234(0x209)];if(!_0x1471ee)return console[_0x41b234(0x1bc)](_0x41b234(0x1cd)),console['error'](_0x41b234(0x22a)),console[_0x41b234(0x1bc)](_0x41b234(0x1c9)),console[_0x41b234(0x1bc)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x41b234(0x1bc)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x41b234(0x1bc)](_0x41b234(0x1f7)),console['error'](_0x41b234(0x1ef)),0x1;try{const _0x47bc6a=_0x31b425[_0x41b234(0x1c3)];let _0x4bfdd8=_0x1471ee;!_0xe9b09&&_0x47bc6a&&!_0x1471ee[_0x41b234(0x1f9)]('/')&&(_0x4bfdd8=_0x47bc6a+'/'+_0x1471ee,_0x31b425[_0x41b234(0x1a9)]&&console[_0x41b234(0x1bc)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4bfdd8));const _0x518938=await withSpinner('Resolving\x20path\x20\x27'+_0x4bfdd8+'\x27...',()=>_0xd70062[_0x41b234(0x1aa)][_0x41b234(0x1c7)](_0x4bfdd8),{'verbose':_0x31b425[_0x41b234(0x1a9)]}),_0x41d023=_0x518938[_0x41b234(0x20a)];_0x31b425[_0x41b234(0x1a9)]&&(console['error'](_0x41b234(0x197)+_0x41d023[_0x41b234(0x1ad)]),console[_0x41b234(0x1bc)]('Parent\x20ID:\x20'+_0x41d023[_0x41b234(0x1f0)]),_0x41d023[_0x41b234(0x208)]&&console[_0x41b234(0x1bc)]('Folder\x20ID:\x20'+_0x41d023['folderId']),_0x41d023[_0x41b234(0x199)]&&console[_0x41b234(0x1bc)]('Segment\x20ID:\x20'+_0x41d023[_0x41b234(0x199)]));if(_0x41d023[_0x41b234(0x1ad)]===_0x41b234(0x20e)){const _0x43fca0=await withSpinner(_0x41b234(0x225),()=>_0xd70062[_0x41b234(0x1aa)][_0x41b234(0x1e4)](_0x41d023[_0x41b234(0x1f0)]),{'verbose':_0x31b425[_0x41b234(0x1a9)]});await handleSingleObjectOutput(_0x43fca0[_0x41b234(0x20a)],_0x31b425);}else{if(_0x41d023[_0x41b234(0x1ad)]==='folder'){if(!_0x41d023[_0x41b234(0x208)])throw new SDKError(ErrorCode[_0x41b234(0x1f5)],_0x41b234(0x21f));const _0x1b9171=await withSpinner('Fetching\x20folder\x20details...',()=>_0xd70062[_0x41b234(0x1aa)][_0x41b234(0x1d1)](_0x41d023[_0x41b234(0x208)]),{'verbose':_0x31b425[_0x41b234(0x1a9)]});await handleSingleObjectOutput(_0x1b9171[_0x41b234(0x20a)],_0x31b425);}else{if(_0x41d023[_0x41b234(0x1ad)]===_0x41b234(0x1aa)){if(!_0x41d023[_0x41b234(0x199)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x41b234(0x216));const _0x3a3d85=await withSpinner(_0x41b234(0x223),()=>_0xd70062['segment'][_0x41b234(0x1fd)](_0x41d023[_0x41b234(0x1f0)],_0x41d023[_0x41b234(0x199)]),{'verbose':_0x31b425['verbose']});await handleSingleObjectOutput(_0x3a3d85[_0x41b234(0x20a)],_0x31b425);}}}return 0x0;}catch(_0x2fcf6e){if(_0x2fcf6e instanceof SDKError)return console[_0x41b234(0x1bc)](_0x41b234(0x20d)+_0x2fcf6e[_0x41b234(0x1f4)]),_0x2fcf6e[_0x41b234(0x1ed)]&&console[_0x41b234(0x1bc)]('\x20\x20Cause:\x20'+_0x2fcf6e[_0x41b234(0x1ed)]),0x1;throw _0x2fcf6e;}}}export class SegmentShowCommand extends BaseCommand{[a31_0xb6de7f(0x18e)]=a31_0xb6de7f(0x1c1);['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a31_0xb6de7f(0x1dd)](_0xa3adf8){const _0x5f4e34=a31_0xb6de7f,{options:_0x5edb6b,args:_0xec1943,tdx:_0x1827d8}=_0xa3adf8,_0xb6a388=_0xec1943[0x0];if(!_0xb6a388)return console[_0x5f4e34(0x1bc)](_0x5f4e34(0x193)),console[_0x5f4e34(0x1bc)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1ff)),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1c9)),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x21e)),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1d2)),0x1;try{const _0x45debe=_0x5edb6b[_0x5f4e34(0x209)],_0x321248=resolveSegmentTarget(_0xb6a388,_0x45debe,_0x5edb6b[_0x5f4e34(0x1a9)]);_0x5edb6b[_0x5f4e34(0x1a9)]&&console[_0x5f4e34(0x1bc)]('Target\x20path:\x20'+_0x321248);const _0x461f20=await withSpinner(_0x5f4e34(0x1ca)+_0xb6a388+_0x5f4e34(0x1a5),()=>_0x1827d8[_0x5f4e34(0x1aa)][_0x5f4e34(0x1c7)](_0x321248),{'verbose':_0x5edb6b[_0x5f4e34(0x1a9)]}),_0x44215=_0x461f20[_0x5f4e34(0x20a)];_0x5edb6b[_0x5f4e34(0x1a9)]&&(console[_0x5f4e34(0x1bc)]('Resolved\x20type:\x20'+_0x44215[_0x5f4e34(0x1ad)]),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1c8)+_0x44215[_0x5f4e34(0x1f0)]));if(_0x44215[_0x5f4e34(0x1ad)]==='folder')return console['error'](_0x5f4e34(0x1ab)),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1d5)),0x1;if(_0x44215['type']===_0x5f4e34(0x20e))return console['error'](_0x5f4e34(0x1fc)),console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1ac)),0x1;if(!_0x44215[_0x5f4e34(0x199)])throw new SDKError(ErrorCode[_0x5f4e34(0x1b0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x303303=await withSpinner(_0x5f4e34(0x1cf),()=>_0x1827d8[_0x5f4e34(0x1aa)][_0x5f4e34(0x191)](_0x44215[_0x5f4e34(0x1f0)],_0x44215[_0x5f4e34(0x199)]),{'verbose':_0x5edb6b['verbose']});let _0x5abf02=_0x303303['data'];const _0x37d204=resolveLimit(_0x5edb6b[_0x5f4e34(0x1cb)],DEFAULT_DISPLAY_LIMIT),_0x11c1aa=/\bLIMIT\s+\d+/i[_0x5f4e34(0x1d9)](_0x5abf02);!_0x11c1aa&&(_0x5abf02=_0x5abf02[_0x5f4e34(0x1ae)]()[_0x5f4e34(0x1b3)](/;+$/,''),_0x5abf02=_0x5f4e34(0x1c0)+_0x5abf02+_0x5f4e34(0x211)+_0x37d204);_0x5edb6b[_0x5f4e34(0x1a9)]&&console[_0x5f4e34(0x1bc)](_0x5f4e34(0x1e5)+_0x5abf02);const _0x7a594d=await withQuerySpinner(_0x5f4e34(0x1fa),async _0x1b3b1f=>{const _0x161ceb=_0x5f4e34,_0x362526=await _0x1827d8[_0x161ceb(0x19a)][_0x161ceb(0x1dd)](_0x5abf02,{'catalog':'td','schema':_0x161ceb(0x218),'onJobId':_0x5cbfab=>{const _0x5d37ad=_0x161ceb;_0x1b3b1f[_0x5d37ad(0x18d)](_0x5cbfab);}});return _0x362526;},{'verbose':_0x5edb6b[_0x5f4e34(0x1a9)]}),_0x397998=_0x7a594d[_0x5f4e34(0x20a)],_0x1aae2b=_0x397998['jobId']?_0x5f4e34(0x1e0)+_0x397998[_0x5f4e34(0x1d3)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x397998[_0x5f4e34(0x227)][_0x5f4e34(0x1b9)][_0x5f4e34(0x202)]()+'\x20rows\x20'+(_0x5f4e34(0x1ea)+formatElapsed(_0x397998[_0x5f4e34(0x227)][_0x5f4e34(0x1c6)])+_0x1aae2b)),await handleQueryOutput(_0x397998,_0x5edb6b),0x0;}catch(_0x544109){if(_0x544109 instanceof SDKError)return console[_0x5f4e34(0x1bc)]('✖\x20Query\x20failed\x20['+_0x544109[_0x5f4e34(0x1be)]+']'),console['error']('\x0a'+_0x544109[_0x5f4e34(0x1f4)]),0x1;throw _0x544109;}}}export class SegmentFolderListCommand extends BaseCommand{[a31_0xb6de7f(0x18e)]='segment:folder:list';[a31_0xb6de7f(0x20c)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a31_0xb6de7f(0x1dd)](_0x54510d){const _0x39914f=a31_0xb6de7f,{options:_0x4c8dd,args:_0x485ebd,tdx:_0x591330}=_0x54510d;if(_0x485ebd['length']===0x0)return console['error'](_0x39914f(0x1e7)),console['error'](_0x39914f(0x207)),0x1;const _0x165012=_0x485ebd[0x0];try{_0x4c8dd[_0x39914f(0x1a9)]&&(console['error'](_0x39914f(0x20b)+_0x4c8dd['site']),console[_0x39914f(0x1bc)](_0x39914f(0x1b7)+_0x165012));const _0x3add81=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x165012+_0x39914f(0x1a5),()=>_0x591330[_0x39914f(0x1aa)][_0x39914f(0x192)](_0x165012),{'verbose':_0x4c8dd[_0x39914f(0x1a9)]}),_0x3bccec=_0x3add81['data'];_0x4c8dd[_0x39914f(0x1a9)]&&console[_0x39914f(0x1bc)](_0x39914f(0x1af)+_0x3bccec);const _0x5e2f6d=await withSpinner(_0x39914f(0x229)+_0x165012+_0x39914f(0x1a5),()=>_0x591330[_0x39914f(0x1aa)]['listFolders'](_0x3bccec),{'verbose':_0x4c8dd[_0x39914f(0x1a9)]}),_0x16dcf7=_0x5e2f6d[_0x39914f(0x20a)];return console[_0x39914f(0x1bc)](_0x39914f(0x221)+_0x16dcf7[_0x39914f(0x1d4)]+_0x39914f(0x1db)+(_0x16dcf7[_0x39914f(0x1d4)]!==0x1?'s':'')),await handleSDKOutput(_0x16dcf7,_0x4c8dd),0x0;}catch(_0x40ea6c){if(_0x40ea6c instanceof SDKError)return console[_0x39914f(0x1bc)](_0x39914f(0x20d)+_0x40ea6c[_0x39914f(0x1f4)]),_0x40ea6c['cause']&&console['error'](_0x39914f(0x220)+_0x40ea6c['cause']),0x1;throw _0x40ea6c;}}}function a31_0x386a(_0x305416,_0x500a13){_0x305416=_0x305416-0x18c;const _0x5115c1=a31_0x5115();let _0x386af9=_0x5115c1[_0x305416];return _0x386af9;}export class SegmentFolderShowCommand extends BaseCommand{['name']=a31_0xb6de7f(0x1a4);[a31_0xb6de7f(0x20c)]=a31_0xb6de7f(0x21d);async[a31_0xb6de7f(0x1dd)](_0x3ef58b){const _0x1f38c9=a31_0xb6de7f,{options:_0x930c32,args:_0x3c341a,tdx:_0x4f7efe}=_0x3ef58b;if(_0x3c341a[_0x1f38c9(0x1d4)]===0x0)return console['error'](_0x1f38c9(0x194)),console[_0x1f38c9(0x1bc)](_0x1f38c9(0x1f2)),0x1;try{const {parentId:_0xc4cd9e,childId:_0x535679}=parseSegmentRef(_0x3c341a[0x0]);_0x930c32[_0x1f38c9(0x1a9)]&&(console[_0x1f38c9(0x1bc)](_0x1f38c9(0x20b)+_0x930c32[_0x1f38c9(0x21c)]),console[_0x1f38c9(0x1bc)]('Parent\x20name:\x20'+_0xc4cd9e),_0x535679&&console[_0x1f38c9(0x1bc)](_0x1f38c9(0x1e8)+_0x535679));if(!_0x535679)return console[_0x1f38c9(0x1bc)](_0x1f38c9(0x205)),0x1;const _0x582e99=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xc4cd9e+'\x27...',()=>_0x4f7efe[_0x1f38c9(0x1aa)][_0x1f38c9(0x192)](_0xc4cd9e),{'verbose':_0x930c32[_0x1f38c9(0x1a9)]}),_0x3d75d8=_0x582e99['data'];_0x930c32[_0x1f38c9(0x1a9)]&&console[_0x1f38c9(0x1bc)]('Resolved\x20parent\x20ID:\x20'+_0x3d75d8);const _0x4c1d79=await withSpinner(_0x1f38c9(0x1c4)+_0x535679+_0x1f38c9(0x1a5),()=>_0x4f7efe['segment'][_0x1f38c9(0x213)](_0x3d75d8,_0x535679),{'verbose':_0x930c32[_0x1f38c9(0x1a9)]}),_0x474931=_0x4c1d79['data'];_0x930c32[_0x1f38c9(0x1a9)]&&console['error'](_0x1f38c9(0x1b5)+_0x474931);const _0x42b87e=await withSpinner('Fetching\x20folder\x20\x27'+_0x535679+_0x1f38c9(0x1a5),()=>_0x4f7efe['segment'][_0x1f38c9(0x1d1)](_0x474931),{'verbose':_0x930c32[_0x1f38c9(0x1a9)]});return await handleSDKOutput([_0x42b87e['data']],_0x930c32),0x0;}catch(_0x32e4e0){if(_0x32e4e0 instanceof SDKError)return console[_0x1f38c9(0x1bc)](_0x1f38c9(0x20d)+_0x32e4e0[_0x1f38c9(0x1f4)]),_0x32e4e0[_0x1f38c9(0x1ed)]&&console[_0x1f38c9(0x1bc)](_0x1f38c9(0x220)+_0x32e4e0[_0x1f38c9(0x1ed)]),0x1;throw _0x32e4e0;}}}export class SegmentSQLCommand extends BaseCommand{[a31_0xb6de7f(0x18e)]=a31_0xb6de7f(0x1e1);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a31_0xb6de7f(0x1dd)](_0x3c8dc1){const _0x19c0c5=a31_0xb6de7f,{options:_0x58c656,args:_0x12ebea,tdx:_0xecf1ba}=_0x3c8dc1,_0x59fee6=_0x12ebea[0x0];if(!_0x59fee6)return console[_0x19c0c5(0x1bc)](_0x19c0c5(0x193)),console[_0x19c0c5(0x1bc)](_0x19c0c5(0x201)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x19c0c5(0x1bc)](_0x19c0c5(0x1c9)),console['error'](_0x19c0c5(0x1d6)),console[_0x19c0c5(0x1bc)](_0x19c0c5(0x224)),0x1;try{const _0x12d5a1=_0x58c656[_0x19c0c5(0x209)],_0x52a2d8=resolveSegmentTarget(_0x59fee6,_0x12d5a1,_0x58c656[_0x19c0c5(0x1a9)]);_0x58c656['verbose']&&console[_0x19c0c5(0x1bc)](_0x19c0c5(0x206)+_0x52a2d8);const _0x1730b2=await withSpinner(_0x19c0c5(0x1ca)+_0x59fee6+'\x27...',()=>_0xecf1ba[_0x19c0c5(0x1aa)][_0x19c0c5(0x1c7)](_0x52a2d8),{'verbose':_0x58c656['verbose']}),_0x151e3a=_0x1730b2['data'];_0x58c656['verbose']&&(console[_0x19c0c5(0x1bc)](_0x19c0c5(0x197)+_0x151e3a[_0x19c0c5(0x1ad)]),console['error'](_0x19c0c5(0x1c8)+_0x151e3a['parentId']));if(_0x151e3a[_0x19c0c5(0x1ad)]===_0x19c0c5(0x190))return console[_0x19c0c5(0x1bc)](_0x19c0c5(0x1fe)),console[_0x19c0c5(0x1bc)](_0x19c0c5(0x1da)),0x1;if(_0x151e3a[_0x19c0c5(0x1ad)]===_0x19c0c5(0x20e))return console[_0x19c0c5(0x1bc)](_0x19c0c5(0x1b1)),console[_0x19c0c5(0x1bc)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x151e3a[_0x19c0c5(0x199)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x19c0c5(0x216));const _0x186396=await withSpinner(_0x19c0c5(0x1cf),()=>_0xecf1ba[_0x19c0c5(0x1aa)][_0x19c0c5(0x191)](_0x151e3a[_0x19c0c5(0x1f0)],_0x151e3a['segmentId']),{'verbose':_0x58c656[_0x19c0c5(0x1a9)]}),_0x458b6c=_0x186396['data'];return _0x58c656['format']===_0x19c0c5(0x1dc)||_0x58c656[_0x19c0c5(0x1f1)]===_0x19c0c5(0x1a0)?await handleSDKOutput([{'sql':_0x458b6c}],_0x58c656):console[_0x19c0c5(0x1f3)](_0x458b6c),0x0;}catch(_0x4a824d){if(_0x4a824d instanceof SDKError)return console['error'](_0x19c0c5(0x20d)+_0x4a824d[_0x19c0c5(0x1f4)]),_0x4a824d['cause']&&console['error'](_0x19c0c5(0x220)+_0x4a824d[_0x19c0c5(0x1ed)]),0x1;throw _0x4a824d;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a31_0xb6de7f(0x18e)]=a31_0xb6de7f(0x1ee);[a31_0xb6de7f(0x20c)]=a31_0xb6de7f(0x215);async[a31_0xb6de7f(0x1dd)](_0x58fc75){const _0x1b4ca8=a31_0xb6de7f,{options:_0x515f56,args:_0xcc7ad4,tdx:_0x4e9846}=_0x58fc75,_0x1375fd=_0x515f56;if(_0xcc7ad4['length']<0x2)return console[_0x1b4ca8(0x1bc)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x1b4ca8(0x1bc)](_0x1b4ca8(0x21b)),0x1;const _0x6239da=_0xcc7ad4[0x0],_0x4852a4=_0xcc7ad4[0x1];_0x1375fd['verbose']&&(console['error'](_0x1b4ca8(0x20b)+_0x1375fd[_0x1b4ca8(0x21c)]),console['error'](_0x1b4ca8(0x203)+_0x6239da),console['error']('Folder\x20name:\x20'+_0x4852a4));let _0x314117;if(_0x1375fd[_0x1b4ca8(0x20f)]){const _0x5a5e71=_0x1375fd[_0x1b4ca8(0x20f)],_0x1a1aa1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x6239da+_0x1b4ca8(0x1a5),()=>_0x4e9846[_0x1b4ca8(0x1aa)][_0x1b4ca8(0x192)](_0x6239da),{'verbose':_0x1375fd[_0x1b4ca8(0x1a9)]}),_0x5241d2=_0x1a1aa1['data'],_0xadf12d=await withSpinner(_0x1b4ca8(0x1f6)+_0x5a5e71+_0x1b4ca8(0x1a5),()=>_0x4e9846[_0x1b4ca8(0x1aa)][_0x1b4ca8(0x213)](_0x5241d2,_0x5a5e71),{'verbose':_0x1375fd[_0x1b4ca8(0x1a9)]});_0x314117=_0xadf12d[_0x1b4ca8(0x20a)],_0x1375fd['verbose']&&console[_0x1b4ca8(0x1bc)](_0x1b4ca8(0x19d)+_0x314117);}const _0x116bfe={'name':_0x4852a4,'description':_0x1375fd[_0x1b4ca8(0x20c)],'parentFolderId':_0x314117},_0x2b1cae=await withSpinner(_0x1b4ca8(0x1e2)+_0x4852a4+_0x1b4ca8(0x1a5),()=>_0x4e9846[_0x1b4ca8(0x1aa)][_0x1b4ca8(0x1bf)](_0x6239da,_0x116bfe),{'verbose':_0x1375fd['verbose']}),_0x5b3cfe=_0x2b1cae[_0x1b4ca8(0x20a)];return console[_0x1b4ca8(0x1bc)](_0x1b4ca8(0x1e3)+_0x5b3cfe[_0x1b4ca8(0x18e)]+_0x1b4ca8(0x200)+_0x5b3cfe['id']),await handleSDKOutput([_0x5b3cfe],_0x1375fd),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a31_0xb6de7f(0x20c)]=a31_0xb6de7f(0x195);async['execute'](_0x3c2ef3){const _0x1be1f1=a31_0xb6de7f,{options:_0xc48173,args:_0x4a9632,tdx:_0x465318}=_0x3c2ef3,_0x14dd8b=_0x4a9632[0x0];if(!_0x14dd8b)return console[_0x1be1f1(0x1bc)](_0x1be1f1(0x19b)),console[_0x1be1f1(0x1bc)](_0x1be1f1(0x1fb)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x1be1f1(0x1bc)](_0x1be1f1(0x1df)),console[_0x1be1f1(0x1bc)](_0x1be1f1(0x21a)),console[_0x1be1f1(0x1bc)]('Examples:'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x1be1f1(0x222)),console[_0x1be1f1(0x1bc)](_0x1be1f1(0x1a8)),console[_0x1be1f1(0x1bc)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x19934a=_0xc48173[_0x1be1f1(0x209)],_0x264565=resolveSegmentTarget(_0x14dd8b,_0x19934a,_0xc48173['verbose']);_0xc48173[_0x1be1f1(0x1a9)]&&console[_0x1be1f1(0x1bc)](_0x1be1f1(0x206)+_0x264565);const _0x3fa1d1=await withSpinner(_0x1be1f1(0x1ca)+_0x14dd8b+_0x1be1f1(0x1a5),()=>_0x465318[_0x1be1f1(0x1aa)][_0x1be1f1(0x1c7)](_0x264565),{'verbose':_0xc48173[_0x1be1f1(0x1a9)]}),_0xafe091=_0x3fa1d1[_0x1be1f1(0x20a)];_0xc48173[_0x1be1f1(0x1a9)]&&(console[_0x1be1f1(0x1bc)](_0x1be1f1(0x197)+_0xafe091[_0x1be1f1(0x1ad)]),console[_0x1be1f1(0x1bc)]('Parent\x20ID:\x20'+_0xafe091[_0x1be1f1(0x1f0)]),_0xafe091[_0x1be1f1(0x208)]&&console['error'](_0x1be1f1(0x1e6)+_0xafe091[_0x1be1f1(0x208)]),_0xafe091['segmentId']&&console['error'](_0x1be1f1(0x19e)+_0xafe091[_0x1be1f1(0x199)]));if(_0xc48173[_0x1be1f1(0x1e9)]){if(_0xafe091[_0x1be1f1(0x1ad)]===_0x1be1f1(0x190))return console[_0x1be1f1(0x1bc)](_0x1be1f1(0x1d7)),0x1;if(_0xafe091[_0x1be1f1(0x1ad)]===_0x1be1f1(0x20e))return console[_0x1be1f1(0x1bc)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1be1f1(0x1bc)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0xafe091[_0x1be1f1(0x199)])throw new SDKError(ErrorCode[_0x1be1f1(0x1b0)],_0x1be1f1(0x216));const _0x2d5a9d=getConsoleNextUrl(_0xc48173['site'],_0x1be1f1(0x212)+_0xafe091[_0x1be1f1(0x1f0)]+'/e/'+_0xafe091[_0x1be1f1(0x199)]);return console[_0x1be1f1(0x1bc)](a31_0x5bdee0[_0x1be1f1(0x1eb)]('✔')+'\x20Opening\x20'+a31_0x5bdee0[_0x1be1f1(0x1b4)](_0x2d5a9d)),openBrowser(_0x2d5a9d),0x0;}if(_0xafe091[_0x1be1f1(0x1ad)]==='folder'){if(!_0xafe091[_0x1be1f1(0x208)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x1be1f1(0x21f));const _0x49596f=await withSpinner(_0x1be1f1(0x1a1),()=>_0x465318[_0x1be1f1(0x1aa)][_0x1be1f1(0x1d1)](_0xafe091['folderId']),{'verbose':_0xc48173['verbose']});await handleSingleObjectOutput(_0x49596f[_0x1be1f1(0x20a)],_0xc48173);}else{if(_0xafe091[_0x1be1f1(0x1ad)]===_0x1be1f1(0x1aa)){if(!_0xafe091['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1570ca=await withSpinner('Fetching\x20segment\x20details...',()=>_0x465318[_0x1be1f1(0x1aa)]['getSegment'](_0xafe091[_0x1be1f1(0x1f0)],_0xafe091[_0x1be1f1(0x199)]),{'verbose':_0xc48173['verbose']}),_0x344795=getConsoleNextUrl(_0xc48173[_0x1be1f1(0x21c)],_0x1be1f1(0x212)+_0xafe091[_0x1be1f1(0x1f0)]+_0x1be1f1(0x226)+_0xafe091[_0x1be1f1(0x199)]),_0x152959=_0x1570ca[_0x1be1f1(0x20a)];_0x152959[_0x1be1f1(0x1b8)]=_0x344795,await handleSingleObjectOutput(_0x152959,_0xc48173);}else return console[_0x1be1f1(0x1bc)](_0x1be1f1(0x1d0)),console[_0x1be1f1(0x1bc)](_0x1be1f1(0x210)),0x1;}return 0x0;}catch(_0x24dd92){if(_0x24dd92 instanceof SDKError)return console[_0x1be1f1(0x1bc)](_0x1be1f1(0x20d)+_0x24dd92[_0x1be1f1(0x1f4)]),_0x24dd92['cause']&&console[_0x1be1f1(0x1bc)](_0x1be1f1(0x220)+_0x24dd92[_0x1be1f1(0x1ed)]),0x1;throw _0x24dd92;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a31_0xb6de7f(0x18e)]=a31_0xb6de7f(0x1a6);[a31_0xb6de7f(0x20c)]=a31_0xb6de7f(0x1ec);async[a31_0xb6de7f(0x1dd)](_0x4f6ec3){const _0xe3d39=a31_0xb6de7f,{options:_0x419234,args:_0xe3b1ef,tdx:_0x10232c}=_0x4f6ec3,_0x1fe21d=_0xe3b1ef[0x0];if(!_0x1fe21d)return console[_0xe3d39(0x1bc)](_0xe3d39(0x193)),console[_0xe3d39(0x1bc)](_0xe3d39(0x214)),console[_0xe3d39(0x1bc)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0xe3d39(0x1c9)),console[_0xe3d39(0x1bc)](_0xe3d39(0x18f)),console['error'](_0xe3d39(0x228)),0x1;try{const _0x1b6989=_0x419234['parentSegment'],_0x149b80=resolveSegmentTarget(_0x1fe21d,_0x1b6989,_0x419234['verbose']);_0x419234['verbose']&&console[_0xe3d39(0x1bc)]('Target\x20path:\x20'+_0x149b80);const _0x5c677c=await withSpinner(_0xe3d39(0x1ca)+_0x1fe21d+_0xe3d39(0x1a5),()=>_0x10232c['segment'][_0xe3d39(0x1c7)](_0x149b80),{'verbose':_0x419234[_0xe3d39(0x1a9)]}),_0x2e0850=_0x5c677c[_0xe3d39(0x20a)];_0x419234[_0xe3d39(0x1a9)]&&(console[_0xe3d39(0x1bc)](_0xe3d39(0x197)+_0x2e0850[_0xe3d39(0x1ad)]),console[_0xe3d39(0x1bc)](_0xe3d39(0x1c8)+_0x2e0850['parentId']));if(_0x2e0850[_0xe3d39(0x1ad)]===_0xe3d39(0x190))return console[_0xe3d39(0x1bc)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0xe3d39(0x1bc)](_0xe3d39(0x1da)),0x1;if(_0x2e0850[_0xe3d39(0x1ad)]===_0xe3d39(0x20e))return console[_0xe3d39(0x1bc)](_0xe3d39(0x1d8)),console[_0xe3d39(0x1bc)](_0xe3d39(0x1b6)),0x1;if(!_0x2e0850[_0xe3d39(0x199)])throw new SDKError(ErrorCode[_0xe3d39(0x1b0)],_0xe3d39(0x216));const _0xd038b5=await withSpinner(_0xe3d39(0x1cf),()=>_0x10232c[_0xe3d39(0x1aa)]['getSegmentSQL'](_0x2e0850[_0xe3d39(0x1f0)],_0x2e0850['segmentId']),{'verbose':_0x419234[_0xe3d39(0x1a9)]}),_0xed679d=_0xd038b5[_0xe3d39(0x20a)],_0xe39e02=await executeSchemaQuery(_0xed679d,_0x10232c,_0x419234);return await handleQueryOutput(_0xe39e02,_0x419234),0x0;}catch(_0x18c50b){if(_0x18c50b instanceof SDKError)return console[_0xe3d39(0x1bc)](_0xe3d39(0x20d)+_0x18c50b[_0xe3d39(0x1f4)]),_0x18c50b[_0xe3d39(0x1ed)]&&console[_0xe3d39(0x1bc)](_0xe3d39(0x220)+_0x18c50b[_0xe3d39(0x1ed)]),0x1;throw _0x18c50b;}}}