@treasuredata/tdx 0.9.2 → 0.9.3

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 (130) 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.d.ts +35 -1
  9. package/dist/client/llm-api-client.d.ts.map +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/llm-api-client.js.map +1 -1
  12. package/dist/client/rate-limiter.js +1 -1
  13. package/dist/client/td-api-client.js +1 -1
  14. package/dist/client/trino-api-client.js +1 -1
  15. package/dist/client/workflow-client.js +1 -1
  16. package/dist/commands/activations.js +1 -1
  17. package/dist/commands/agent-command.d.ts.map +1 -1
  18. package/dist/commands/agent-command.js +1 -1
  19. package/dist/commands/agent-command.js.map +1 -1
  20. package/dist/commands/api-command.js +1 -1
  21. package/dist/commands/auth-command.js +1 -1
  22. package/dist/commands/chat-command.js +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-statusline-command.js +1 -1
  25. package/dist/commands/claude-usage-command.js +1 -1
  26. package/dist/commands/command.js +1 -1
  27. package/dist/commands/connection-command.js +1 -1
  28. package/dist/commands/context-command.js +1 -1
  29. package/dist/commands/databases.js +1 -1
  30. package/dist/commands/describe.js +1 -1
  31. package/dist/commands/engage-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/llm-proxy.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/use-command.js +1 -1
  50. package/dist/commands/user-command.js +1 -1
  51. package/dist/commands/workflow-command.js +1 -1
  52. package/dist/core/auth.js +1 -1
  53. package/dist/core/config.js +1 -1
  54. package/dist/core/connection-cache.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/server.js +1 -1
  68. package/dist/proxy/session-cache.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.d.ts +45 -1
  70. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  73. package/dist/sdk/api.js +1 -1
  74. package/dist/sdk/connection.js +1 -1
  75. package/dist/sdk/engage.js +1 -1
  76. package/dist/sdk/errors.js +1 -1
  77. package/dist/sdk/index.js +1 -1
  78. package/dist/sdk/job.js +1 -1
  79. package/dist/sdk/journey.js +1 -1
  80. package/dist/sdk/llm.d.ts.map +1 -1
  81. package/dist/sdk/llm.js +1 -1
  82. package/dist/sdk/llm.js.map +1 -1
  83. package/dist/sdk/query.js +1 -1
  84. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  85. package/dist/sdk/segment/journey-yaml.js +1 -1
  86. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  87. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  88. package/dist/sdk/segment.js +1 -1
  89. package/dist/sdk/user.js +1 -1
  90. package/dist/sdk/workflow.js +1 -1
  91. package/dist/types/endpoints.js +1 -1
  92. package/dist/types/index.d.ts +1 -1
  93. package/dist/types/index.d.ts.map +1 -1
  94. package/dist/types/index.js +1 -1
  95. package/dist/types/llm.d.ts +80 -4
  96. package/dist/types/llm.d.ts.map +1 -1
  97. package/dist/utils/agent-config.js +1 -1
  98. package/dist/utils/agent-ref-parser.js +1 -1
  99. package/dist/utils/async.js +1 -1
  100. package/dist/utils/chat-cache.js +1 -1
  101. package/dist/utils/colors.js +1 -1
  102. package/dist/utils/command-output.js +1 -1
  103. package/dist/utils/constants.js +1 -1
  104. package/dist/utils/diff.js +1 -1
  105. package/dist/utils/fields-display.js +1 -1
  106. package/dist/utils/file-permissions.js +1 -1
  107. package/dist/utils/format-detector.js +1 -1
  108. package/dist/utils/formatters.js +1 -1
  109. package/dist/utils/journey-utils.js +1 -1
  110. package/dist/utils/json-loader.js +1 -1
  111. package/dist/utils/llm-backup-utils.js +1 -1
  112. package/dist/utils/model-aliases.js +1 -1
  113. package/dist/utils/model-factors.js +1 -1
  114. package/dist/utils/option-validation.js +1 -1
  115. package/dist/utils/port.js +1 -1
  116. package/dist/utils/process.js +1 -1
  117. package/dist/utils/prompt.js +1 -1
  118. package/dist/utils/segment-path-parser.js +1 -1
  119. package/dist/utils/segment-ref-parser.js +1 -1
  120. package/dist/utils/spinner.js +1 -1
  121. package/dist/utils/sql-parser.js +1 -1
  122. package/dist/utils/sse-parser.js +1 -1
  123. package/dist/utils/string-utils.js +1 -1
  124. package/dist/utils/table-ref-parser.js +1 -1
  125. package/dist/utils/tdx-config.js +1 -1
  126. package/dist/utils/tdx-logger.js +1 -1
  127. package/dist/utils/tree-formatter.js +1 -1
  128. package/dist/utils/version-check.js +1 -1
  129. package/dist/utils/workflow-utils.js +1 -1
  130. package/package.json +1 -1
@@ -1 +1 @@
1
- function a28_0x1bc9(_0x3c1e60,_0x1237a1){_0x3c1e60=_0x3c1e60-0x103;const _0x862602=a28_0x8626();let _0x1bc9d5=_0x862602[_0x3c1e60];return _0x1bc9d5;}const a28_0x134254=a28_0x1bc9;(function(_0x129e45,_0x15ef98){const _0x3fdf0e=a28_0x1bc9,_0x3f6a8b=_0x129e45();while(!![]){try{const _0x5d5d42=-parseInt(_0x3fdf0e(0x106))/0x1+-parseInt(_0x3fdf0e(0x13e))/0x2+-parseInt(_0x3fdf0e(0x129))/0x3*(parseInt(_0x3fdf0e(0x113))/0x4)+-parseInt(_0x3fdf0e(0x13d))/0x5*(-parseInt(_0x3fdf0e(0x121))/0x6)+parseInt(_0x3fdf0e(0x10c))/0x7+parseInt(_0x3fdf0e(0x11f))/0x8+parseInt(_0x3fdf0e(0x105))/0x9;if(_0x5d5d42===_0x15ef98)break;else _0x3f6a8b['push'](_0x3f6a8b['shift']());}catch(_0x399899){_0x3f6a8b['push'](_0x3f6a8b['shift']());}}}(a28_0x8626,0xbdf44));function a28_0x8626(){const _0x1bc159=['Port\x20','site','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','5iIiodS','2873906axTRnK','attributes','start','Server\x20Configuration:','logger','projects','cyan','\x0aTesting\x20with\x20Agent\x20SDK:','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','Starting\x20proxy\x20server...','15018183nZcmke','133903pbECeq','created\x20on-demand\x20per\x20model','dim','SIGTERM','\x20is\x20unavailable,\x20using\x20port\x20','SIGINT','2682204OQHfQO','find','white','\x20\x20\x20\x20\x22env\x22:\x20{','log','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','1948gZWdAU','llm','name','http://0.0.0.0:','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','stop','description','Project\x20\x27','\x20\x20Project:','logLevel','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','server','8363288dIbyJD','exit','2543082cKTeDQ','\x20\x20Address:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x0a\x0aShutting\x20down\x20proxy\x20server...','execute','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','\x20\x20Site:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','7221qgPYHE','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','yellow','\x0aClaude\x20Code\x20Configuration:','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','llm:proxy','\x20\x20\x20\x20}','close','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','bold','✓\x20Proxy\x20server\x20stopped','init','\x20\x20Agents:','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','Resolving\x20project...','\x27\x20not\x20found','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.'];a28_0x8626=function(){return _0x1bc159;};return a28_0x8626();}import a28_0x5734ed 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(_0x33d3f6,_0x4e02ad){const _0xceff50=a28_0x1bc9,{tdx:_0x474bc5,options:_0x23ba11}=_0x33d3f6,_0x44f9ba=_0x4e02ad||_0x23ba11['llmProject'];if(_0x44f9ba){const _0x5db379=await _0x474bc5[_0xceff50(0x114)][_0xceff50(0x143)](),_0x251381=_0x5db379[_0xceff50(0x10d)](_0x4558a9=>_0x4558a9[_0xceff50(0x13f)]['name']===_0x44f9ba);if(!_0x251381)throw new SDKError(ErrorCode['NOT_FOUND'],_0xceff50(0x11a)+_0x44f9ba+_0xceff50(0x138),undefined,{'helpText':_0xceff50(0x11d)});return _0x251381['id'];}const _0x5452bc=await _0x474bc5[_0xceff50(0x114)]['getOrCreateDefaultProject']();return _0x5452bc['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x134254(0x115)]=a28_0x134254(0x12e);[a28_0x134254(0x119)]=a28_0x134254(0x126);[a28_0x134254(0x11e)];['logger'];async[a28_0x134254(0x125)](_0x46e0a3){const _0x5b4f35=a28_0x134254,{tdx:_0x1d2249,options:_0x36ad05}=_0x46e0a3;try{const _0x1f312e=_0x36ad05,_0x1451d2=_0x1f312e['port']||0xfa0,_0x47ab8f=_0x1f312e['project'],_0x36973d=await findAvailablePort(_0x1451d2);console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x137)));const _0x350db5=await getProjectIdOrDefault(_0x46e0a3,_0x47ab8f),_0xa99073=await _0x1d2249[_0x5b4f35(0x114)][_0x5b4f35(0x143)](),_0x22cf0b=_0xa99073[_0x5b4f35(0x10d)](_0x1aa752=>_0x1aa752['id']===_0x350db5);this[_0x5b4f35(0x142)]=new TDXLogger(_0x36ad05[_0x5b4f35(0x11c)]),await this[_0x5b4f35(0x142)][_0x5b4f35(0x134)](),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x104)));_0x36973d!==_0x1451d2&&console[_0x5b4f35(0x110)](a28_0x5734ed['yellow'](_0x5b4f35(0x13a)+_0x1451d2+_0x5b4f35(0x10a)+_0x36973d));this['server']=new ProxyServer({'port':_0x36973d,'projectId':_0x350db5,'tdx':_0x1d2249,'logger':this[_0x5b4f35(0x142)],'site':_0x36ad05['site']}),await this[_0x5b4f35(0x11e)][_0x5b4f35(0x140)](),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x12b)][_0x5b4f35(0x132)](_0x5b4f35(0x117))),console['log'](a28_0x5734ed[_0x5b4f35(0x12b)](_0x5b4f35(0x139))),console['log'](a28_0x5734ed['yellow'](_0x5b4f35(0x128))),console[_0x5b4f35(0x110)](a28_0x5734ed['green'][_0x5b4f35(0x132)](_0x5b4f35(0x12d))),console['log'](a28_0x5734ed['cyan'](_0x5b4f35(0x141))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x122)),a28_0x5734ed['white'](_0x5b4f35(0x116)+_0x36973d)),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x11b)),a28_0x5734ed[_0x5b4f35(0x10e)](_0x22cf0b?.[_0x5b4f35(0x13f)][_0x5b4f35(0x115)]||_0x350db5)),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x135)),a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x107))),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x127)),a28_0x5734ed[_0x5b4f35(0x10e)](_0x36ad05[_0x5b4f35(0x13b)])),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x144)](_0x5b4f35(0x12c))),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x123))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)]('\x20\x20{')),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x10f))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x13c)+_0x36973d+'\x22,')),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x103))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x131))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x12f))),console['log'](a28_0x5734ed[_0x5b4f35(0x10e)]('\x20\x20}')),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x144)](_0x5b4f35(0x145))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x111))),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x136))),console[_0x5b4f35(0x110)](a28_0x5734ed['dim'](_0x5b4f35(0x12a))),console[_0x5b4f35(0x110)](a28_0x5734ed['yellow'](_0x5b4f35(0x112)));const _0x1f28db=async()=>{const _0xc4e4b3=_0x5b4f35;console[_0xc4e4b3(0x110)](a28_0x5734ed['dim'](_0xc4e4b3(0x124))),this[_0xc4e4b3(0x11e)]&&await this[_0xc4e4b3(0x11e)][_0xc4e4b3(0x118)](),this[_0xc4e4b3(0x142)]&&await this[_0xc4e4b3(0x142)]['close'](),console[_0xc4e4b3(0x110)](a28_0x5734ed['green'](_0xc4e4b3(0x133))),process[_0xc4e4b3(0x120)](0x0);};return process['on'](_0x5b4f35(0x10b),_0x1f28db),process['on'](_0x5b4f35(0x109),_0x1f28db),await new Promise(()=>{}),0x0;}catch(_0x45c225){this[_0x5b4f35(0x11e)]&&await this[_0x5b4f35(0x11e)]['stop']();this[_0x5b4f35(0x142)]&&await this[_0x5b4f35(0x142)][_0x5b4f35(0x130)]();throw _0x45c225;}}}
1
+ function a28_0x5987(){const _0x268840=['\x0aTesting\x20with\x20Agent\x20SDK:','white','init','http://0.0.0.0:','server','1024227jVwWqC','Project\x20\x27','267592GqfFSF','\x20\x20\x20\x20}','llmProject','green','189ywAWBM','projects','yellow','logger','name','444RrAskF','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x20\x20Agents:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x20\x20{','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x20\x20Site:','close','Server\x20Configuration:','1051338pTXuiY','7GlrWmf','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20Project:','214342AWVCTW','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20\x20}','SIGTERM','description','site','Starting\x20proxy\x20server...','NOT_FOUND','logLevel','50270djXyzm','bold','llm','exit','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','attributes','project','Port\x20','getOrCreateDefaultProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','start','llm:proxy','stop','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','3iFiFIG','26139817SYBzuG','find','cyan','✓\x20Proxy\x20server\x20stopped','created\x20on-demand\x20per\x20model','log','39385kojqtg','\x0aClaude\x20Code\x20Configuration:','port','dim','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','\x27\x20not\x20found'];a28_0x5987=function(){return _0x268840;};return a28_0x5987();}const a28_0x4c10d6=a28_0x225d;(function(_0x20b9b8,_0xa45ee2){const _0x33b07c=a28_0x225d,_0x4db19b=_0x20b9b8();while(!![]){try{const _0x21eaca=-parseInt(_0x33b07c(0x115))/0x1*(parseInt(_0x33b07c(0x141))/0x2)+-parseInt(_0x33b07c(0x128))/0x3+-parseInt(_0x33b07c(0x133))/0x4*(parseInt(_0x33b07c(0x11c))/0x5)+-parseInt(_0x33b07c(0x13d))/0x6+parseInt(_0x33b07c(0x13e))/0x7*(-parseInt(_0x33b07c(0x12a))/0x8)+parseInt(_0x33b07c(0x12e))/0x9*(-parseInt(_0x33b07c(0x107))/0xa)+parseInt(_0x33b07c(0x116))/0xb;if(_0x21eaca===_0xa45ee2)break;else _0x4db19b['push'](_0x4db19b['shift']());}catch(_0x5699e6){_0x4db19b['push'](_0x4db19b['shift']());}}}(a28_0x5987,0x80227));import a28_0x450b58 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a28_0x225d(_0x5b0810,_0x52123a){_0x5b0810=_0x5b0810-0x104;const _0x5987a0=a28_0x5987();let _0x225dec=_0x5987a0[_0x5b0810];return _0x225dec;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x401cd4,_0x1ddb55){const _0x5cee3c=a28_0x225d,{tdx:_0x5b4d51,options:_0x612619}=_0x401cd4,_0x459118=_0x1ddb55||_0x612619[_0x5cee3c(0x12c)];if(_0x459118){const _0x453469=await _0x5b4d51[_0x5cee3c(0x109)][_0x5cee3c(0x12f)](),_0x2cbd67=_0x453469[_0x5cee3c(0x117)](_0x4bbbc2=>_0x4bbbc2['attributes'][_0x5cee3c(0x132)]===_0x459118);if(!_0x2cbd67)throw new SDKError(ErrorCode[_0x5cee3c(0x105)],_0x5cee3c(0x129)+_0x459118+_0x5cee3c(0x122),undefined,{'helpText':_0x5cee3c(0x110)});return _0x2cbd67['id'];}const _0x3e8d9a=await _0x5b4d51[_0x5cee3c(0x109)][_0x5cee3c(0x10f)]();return _0x3e8d9a['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x4c10d6(0x132)]=a28_0x4c10d6(0x112);[a28_0x4c10d6(0x145)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a28_0x4c10d6(0x127)];[a28_0x4c10d6(0x131)];async['execute'](_0x44b812){const _0x1a2046=a28_0x4c10d6,{tdx:_0x152ac,options:_0x598a4e}=_0x44b812;try{const _0x49c08e=_0x598a4e,_0xc7fe2e=_0x49c08e[_0x1a2046(0x11e)]||0xfa0,_0x7d80b8=_0x49c08e[_0x1a2046(0x10d)],_0x309d81=await findAvailablePort(_0xc7fe2e);console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)]('Resolving\x20project...'));const _0x87808d=await getProjectIdOrDefault(_0x44b812,_0x7d80b8),_0x57107e=await _0x152ac[_0x1a2046(0x109)][_0x1a2046(0x12f)](),_0x5a7508=_0x57107e['find'](_0x34da61=>_0x34da61['id']===_0x87808d);this[_0x1a2046(0x131)]=new TDXLogger(_0x598a4e[_0x1a2046(0x106)]),await this[_0x1a2046(0x131)][_0x1a2046(0x125)](),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x104)));_0x309d81!==_0xc7fe2e&&console[_0x1a2046(0x11b)](a28_0x450b58['yellow'](_0x1a2046(0x10e)+_0xc7fe2e+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x309d81));this[_0x1a2046(0x127)]=new ProxyServer({'port':_0x309d81,'projectId':_0x87808d,'tdx':_0x152ac,'logger':this[_0x1a2046(0x131)],'site':_0x598a4e[_0x1a2046(0x146)]}),await this['server'][_0x1a2046(0x111)](),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x130)]['bold'](_0x1a2046(0x120))),console[_0x1a2046(0x11b)](a28_0x450b58['yellow']('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x130)](_0x1a2046(0x136))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x12d)][_0x1a2046(0x108)](_0x1a2046(0x134))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x118)](_0x1a2046(0x13c))),console[_0x1a2046(0x11b)](a28_0x450b58['dim']('\x20\x20Address:'),a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x126)+_0x309d81)),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x140)),a28_0x450b58['white'](_0x5a7508?.[_0x1a2046(0x10c)][_0x1a2046(0x132)]||_0x87808d)),console[_0x1a2046(0x11b)](a28_0x450b58['dim'](_0x1a2046(0x135)),a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x11a))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x13a)),a28_0x450b58[_0x1a2046(0x124)](_0x598a4e[_0x1a2046(0x146)])),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x118)](_0x1a2046(0x11d))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x138))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x137))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x13f))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x309d81+'\x22,')),console[_0x1a2046(0x11b)](a28_0x450b58['white'](_0x1a2046(0x139))),console['log'](a28_0x450b58['white'](_0x1a2046(0x114))),console[_0x1a2046(0x11b)](a28_0x450b58['white'](_0x1a2046(0x12b))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x143))),console[_0x1a2046(0x11b)](a28_0x450b58['cyan'](_0x1a2046(0x123))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x121))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x130)](_0x1a2046(0x10b)));const _0x5f3454=async()=>{const _0x268760=_0x1a2046;console[_0x268760(0x11b)](a28_0x450b58['dim'](_0x268760(0x142))),this['server']&&await this[_0x268760(0x127)][_0x268760(0x113)](),this[_0x268760(0x131)]&&await this[_0x268760(0x131)][_0x268760(0x13b)](),console[_0x268760(0x11b)](a28_0x450b58[_0x268760(0x12d)](_0x268760(0x119))),process[_0x268760(0x10a)](0x0);};return process['on']('SIGINT',_0x5f3454),process['on'](_0x1a2046(0x144),_0x5f3454),await new Promise(()=>{}),0x0;}catch(_0x568bb8){this['server']&&await this[_0x1a2046(0x127)][_0x1a2046(0x113)]();this[_0x1a2046(0x131)]&&await this['logger'][_0x1a2046(0x13b)]();throw _0x568bb8;}}}
@@ -1 +1 @@
1
- const a29_0x354af5=a29_0x28e4;(function(_0x40209a,_0x41d556){const _0x559e20=a29_0x28e4,_0x54cd2f=_0x40209a();while(!![]){try{const _0xcee8da=-parseInt(_0x559e20(0x23f))/0x1+parseInt(_0x559e20(0x280))/0x2+-parseInt(_0x559e20(0x1d4))/0x3+-parseInt(_0x559e20(0x1a0))/0x4+parseInt(_0x559e20(0x1db))/0x5*(-parseInt(_0x559e20(0x1e9))/0x6)+parseInt(_0x559e20(0x1f9))/0x7*(-parseInt(_0x559e20(0x258))/0x8)+parseInt(_0x559e20(0x251))/0x9*(parseInt(_0x559e20(0x17b))/0xa);if(_0xcee8da===_0x41d556)break;else _0x54cd2f['push'](_0x54cd2f['shift']());}catch(_0x305180){_0x54cd2f['push'](_0x54cd2f['shift']());}}}(a29_0x1024,0x6c6a2));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x45cb35 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 a29_0x265ace from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a29_0x28e4(_0x1d4f42,_0x12dae2){_0x1d4f42=_0x1d4f42-0x16b;const _0x102450=a29_0x1024();let _0x28e42f=_0x102450[_0x1d4f42];return _0x28e42f;}const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x354af5(0x1d2);function openBrowser(_0x11513c){const _0xffd2aa=a29_0x354af5,_0x3f94e2=process['platform'],_0x263306=_0x3f94e2===_0xffd2aa(0x187)?_0xffd2aa(0x184):_0x3f94e2===_0xffd2aa(0x192)?'start':'xdg-open';spawn(_0x263306,[_0x11513c],{'detached':!![],'stdio':'ignore'})[_0xffd2aa(0x242)]();}function migrateLegacyDirectory(){const _0x5af697=a29_0x354af5;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x271364=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x271364[_0x5af697(0x193)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5af697(0x233)](a29_0x265ace['yellow'](_0x5af697(0x1fc)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x5af697(0x233)](a29_0x265ace[_0x5af697(0x1e1)](_0x5af697(0x290)+LEGACY_PARENT_SEGMENT_DIR+_0x5af697(0x225))),![];console[_0x5af697(0x233)](a29_0x265ace[_0x5af697(0x190)](_0x5af697(0x1ac)+LEGACY_PARENT_SEGMENT_DIR+_0x5af697(0x1ec)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5af697(0x233)](a29_0x265ace['green'](_0x5af697(0x212)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x15960c){const _0x62d10e=_0x15960c instanceof Error?_0x15960c[_0x5af697(0x185)]:String(_0x15960c);return console[_0x5af697(0x233)](a29_0x265ace[_0x5af697(0x1a2)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x62d10e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x354af5(0x18e)](_0x50c78e){return migrateLegacyDirectory(),super['run'](_0x50c78e);}}function resolveYamlFile(_0x2e4024){const _0x5c47b0=a29_0x354af5;if(_0x2e4024[_0x5c47b0(0x1eb)](_0x5c47b0(0x1bf))||_0x2e4024[_0x5c47b0(0x1eb)]('.yaml'))return _0x2e4024;return a29_0x45cb35[_0x5c47b0(0x1e4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2e4024)+_0x5c47b0(0x1bf));}function formatProgressMessage(_0x44c12d){const _0x5ea6f5=a29_0x354af5,_0x4b56e0=_0x44c12d[_0x5ea6f5(0x248)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4b56e0){const [,_0x23897d,_0xff70d1,_0x5348c5='']=_0x4b56e0;return a29_0x265ace[_0x5ea6f5(0x1e1)](_0x23897d+':')+'\x20'+_0xff70d1+a29_0x265ace[_0x5ea6f5(0x1e1)](_0x5348c5);}return a29_0x265ace['dim'](_0x44c12d);}function showFileNotFoundError(_0x195ea9,_0x26ba4e){const _0x1c11b2=a29_0x354af5;console['error'](a29_0x265ace[_0x1c11b2(0x1a2)](_0x1c11b2(0x298)+_0x195ea9+'\x0a')),console[_0x1c11b2(0x233)](a29_0x265ace[_0x1c11b2(0x25b)](_0x1c11b2(0x19f)+_0x26ba4e+_0x1c11b2(0x18d)));}function showParentSegmentNotSetError(_0x217bad){const _0x7553d1=a29_0x354af5;console[_0x7553d1(0x233)](a29_0x265ace[_0x7553d1(0x190)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x7553d1(0x233)](_0x217bad);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x354af5(0x1a6);[a29_0x354af5(0x24c)]=a29_0x354af5(0x223);async['execute'](_0x12507c){const _0x300474=a29_0x354af5,{options:_0x1d4d65,args:_0x578fd2,tdx:_0x3d168d}=_0x12507c,_0x1958dc=_0x578fd2[0x0];_0x1d4d65[_0x300474(0x200)]&&(console[_0x300474(0x233)](_0x300474(0x1a8)+_0x1d4d65[_0x300474(0x282)]),_0x1958dc&&console['error'](_0x300474(0x170)+_0x1958dc));const _0x1fd2fb=await withSpinner(_0x1958dc?_0x300474(0x186)+_0x1958dc+'\x27...':_0x300474(0x181),()=>_0x3d168d[_0x300474(0x25e)][_0x300474(0x19b)](),{'verbose':_0x1d4d65[_0x300474(0x200)]});let _0x27c57f=_0x1fd2fb[_0x300474(0x20e)];if(_0x1958dc){const _0xa26915=_0x1958dc['replace'](/[.+^${}()|[\]\\]/g,_0x300474(0x1d1))[_0x300474(0x24b)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3aea85=new RegExp('^'+_0xa26915+'$','i');_0x27c57f=_0x27c57f[_0x300474(0x238)](_0x38e3b4=>_0x3aea85[_0x300474(0x27f)](_0x38e3b4['attributes'][_0x300474(0x272)]));}_0x27c57f['sort']((_0x5b9010,_0x438a0d)=>_0x5b9010[_0x300474(0x24d)]['name'][_0x300474(0x198)](_0x438a0d[_0x300474(0x24d)]['name'])),console['error'](_0x300474(0x245)+_0x27c57f['length']+_0x300474(0x1e2)+(_0x27c57f[_0x300474(0x24a)]!==0x1?'s':''));if(_0x1d4d65[_0x300474(0x17f)]===_0x300474(0x295)||_0x1d4d65[_0x300474(0x17f)]===_0x300474(0x18a))await handleSDKOutput(_0x27c57f,_0x1d4d65);else{if(_0x27c57f[_0x300474(0x24a)]===0x0)_0x1958dc?console['log'](_0x300474(0x1f7)+_0x1958dc):console[_0x300474(0x208)](_0x300474(0x209));else for(const _0xeeb2ac of _0x27c57f){const _0x242ec2=_0xeeb2ac[_0x300474(0x24d)][_0x300474(0x1be)]?a29_0x265ace['dim']('\x20('+formatRows(_0xeeb2ac[_0x300474(0x24d)]['population'])+')'):'';console['log'](_0x300474(0x218)+_0xeeb2ac[_0x300474(0x24d)][_0x300474(0x272)]+_0x242ec2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x257);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1cf);async['execute'](_0x3a5feb){const _0x5d58ae=a29_0x354af5,{options:_0x16ab59,args:_0x15cb5f,tdx:_0x4fdcc0}=_0x3a5feb;console[_0x5d58ae(0x233)](_0x5d58ae(0x255)+'\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 _0x532e7e=_0x16ab59;if(_0x15cb5f[_0x5d58ae(0x24a)]===0x0)return console[_0x5d58ae(0x233)](a29_0x265ace[_0x5d58ae(0x1a2)](_0x5d58ae(0x1c2))),console[_0x5d58ae(0x233)](_0x5d58ae(0x1a4)),0x1;const _0x2cc029=_0x15cb5f[0x0];if(!_0x532e7e[_0x5d58ae(0x20a)]||!_0x532e7e[_0x5d58ae(0x268)])return console[_0x5d58ae(0x233)](_0x5d58ae(0x17c)),console[_0x5d58ae(0x233)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x532e7e[_0x5d58ae(0x200)]&&(console[_0x5d58ae(0x233)](_0x5d58ae(0x1a8)+_0x532e7e['site']),console[_0x5d58ae(0x233)](_0x5d58ae(0x217)+_0x2cc029),console['error'](_0x5d58ae(0x1dc)+_0x532e7e[_0x5d58ae(0x20a)]),console[_0x5d58ae(0x233)](_0x5d58ae(0x25d)+_0x532e7e[_0x5d58ae(0x268)]));const _0x58ad47=await loadJSONFromOptions(_0x532e7e['attributes'],_0x532e7e['attributesFile']),_0x40ce25=await loadJSONFromOptions(_0x532e7e[_0x5d58ae(0x194)],_0x532e7e[_0x5d58ae(0x1ee)]),_0x285f2d=await loadJSONFromOptions(_0x532e7e[_0x5d58ae(0x1df)],_0x532e7e[_0x5d58ae(0x224)]),_0x2e0ff6={'name':_0x2cc029,'description':_0x532e7e['description'],'scheduleType':_0x532e7e[_0x5d58ae(0x1bc)],'scheduleOption':_0x532e7e[_0x5d58ae(0x16c)],'timezone':_0x532e7e[_0x5d58ae(0x172)],'master':{'parentDatabaseName':_0x532e7e[_0x5d58ae(0x20a)],'parentTableName':_0x532e7e['table']},'attributes':_0x58ad47,'behaviors':_0x40ce25,'customerGroup':_0x285f2d},_0x58cb13=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2cc029+_0x5d58ae(0x1a5),()=>_0x4fdcc0[_0x5d58ae(0x25e)][_0x5d58ae(0x250)](_0x2e0ff6),{'verbose':_0x16ab59[_0x5d58ae(0x200)]}),_0x165927=_0x58cb13[_0x5d58ae(0x20e)];return console[_0x5d58ae(0x233)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x165927[_0x5d58ae(0x272)]+'\x27\x20with\x20ID:\x20'+_0x165927['id']),await handleSDKOutput([_0x165927],_0x16ab59),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x354af5(0x272)]='segment:parent:update';['description']=a29_0x354af5(0x1ab);async[a29_0x354af5(0x20d)](_0x19cf2){const _0xf9564=a29_0x354af5,{options:_0x452685,args:_0x20ba05,tdx:_0x64fa26}=_0x19cf2;console[_0xf9564(0x233)](_0xf9564(0x292)+_0xf9564(0x288)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1d0005=_0x452685;if(_0x20ba05[_0xf9564(0x24a)]===0x0)return console[_0xf9564(0x233)](a29_0x265ace[_0xf9564(0x1a2)](_0xf9564(0x1c2))),console[_0xf9564(0x233)](_0xf9564(0x29a)),0x1;const _0x5b21cc=_0x20ba05[0x0];_0x1d0005[_0xf9564(0x200)]&&(console[_0xf9564(0x233)](_0xf9564(0x1a8)+_0x1d0005[_0xf9564(0x282)]),console['error'](_0xf9564(0x1de)+_0x5b21cc));const _0x3872ad=await withSpinner(_0xf9564(0x1c9)+_0x5b21cc+'\x27...',()=>_0x64fa26[_0xf9564(0x25e)][_0xf9564(0x264)](_0x5b21cc),{'verbose':_0x1d0005[_0xf9564(0x200)]}),_0x4ec605=_0x3872ad[_0xf9564(0x20e)],_0x48ca73=await loadJSONFromOptions(_0x1d0005[_0xf9564(0x1b1)],_0x1d0005[_0xf9564(0x21f)]),_0x284ca7=await loadJSONFromOptions(_0x1d0005[_0xf9564(0x1d8)],_0x1d0005[_0xf9564(0x171)]),_0x563599={'name':_0x4ec605[_0xf9564(0x272)],'description':_0x1d0005[_0xf9564(0x24c)]!==undefined?_0x1d0005['description']:_0x4ec605[_0xf9564(0x24c)],'scheduleType':_0x1d0005['scheduleType']!==undefined?_0x1d0005[_0xf9564(0x1bc)]:_0x4ec605[_0xf9564(0x1bc)],'scheduleOption':_0x1d0005['scheduleOption']!==undefined?_0x1d0005[_0xf9564(0x16c)]:_0x4ec605['scheduleOption'],'timezone':_0x1d0005[_0xf9564(0x172)]!==undefined?_0x1d0005[_0xf9564(0x172)]:_0x4ec605[_0xf9564(0x172)],'master':_0x4ec605[_0xf9564(0x1d7)],'attributes':_0x48ca73?[..._0x4ec605[_0xf9564(0x24d)]||[],..._0x48ca73]:_0x4ec605[_0xf9564(0x24d)],'behaviors':_0x284ca7?[..._0x4ec605['behaviors']||[],..._0x284ca7]:_0x4ec605[_0xf9564(0x194)],'customerGroup':_0x4ec605[_0xf9564(0x1df)]},_0xe49147=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x5b21cc+_0xf9564(0x1a5),()=>_0x64fa26[_0xf9564(0x25e)]['updateParent'](_0x5b21cc,_0x563599),{'verbose':_0x1d0005[_0xf9564(0x200)]}),_0x4cf63b=_0xe49147[_0xf9564(0x20e)];return console[_0xf9564(0x233)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x4cf63b[_0xf9564(0x272)]+'\x27'),await handleSDKOutput([_0x4cf63b],_0x1d0005),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a29_0x354af5(0x230);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1f4);async[a29_0x354af5(0x20d)](_0x4ec206){const _0x276e4f=a29_0x354af5,{options:_0x5af38f,args:_0xf2c79d,tdx:_0x2a71a2}=_0x4ec206,_0x29e5f9=_0x5af38f,_0x3cf812=_0xf2c79d[0x0]||_0x5af38f[_0x276e4f(0x20b)];if(!_0x3cf812)return showParentSegmentNotSetError(_0x276e4f(0x270)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x29e5f9[_0x276e4f(0x1f3)]&&_0x29e5f9[_0x276e4f(0x22f)])return console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1a2)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1e1)](_0x276e4f(0x17d))),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1e1)](_0x276e4f(0x22b)+PARENT_SEGMENT_DIR+_0x276e4f(0x249))),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x25b)](_0x276e4f(0x1fa))),0x1;const _0xbbc7e6=_0x29e5f9[_0x276e4f(0x22f)]||a29_0x45cb35[_0x276e4f(0x1e4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3cf812)+_0x276e4f(0x1bf));_0x29e5f9['verbose']&&(console[_0x276e4f(0x233)](_0x276e4f(0x1a8)+_0x29e5f9['site']),console[_0x276e4f(0x233)](_0x276e4f(0x1de)+_0x3cf812),console[_0x276e4f(0x233)](_0x276e4f(0x283)+_0xbbc7e6));const _0xa15c7a=await withSpinner(_0x276e4f(0x189)+_0x3cf812+_0x276e4f(0x1a5),()=>_0x2a71a2[_0x276e4f(0x25e)]['pullParentYaml'](_0x3cf812),{'verbose':_0x29e5f9[_0x276e4f(0x200)]}),_0x5c4789=_0xa15c7a[_0x276e4f(0x20e)];if(existsSync(_0xbbc7e6)){const _0x2bbb66=readFileSync(_0xbbc7e6,_0x276e4f(0x1ae)),_0x64e7dc=generateDiff(_0x2bbb66,_0x5c4789);if(!hasChanges(_0x64e7dc))console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1c7)]('✔')+_0x276e4f(0x179)+a29_0x265ace[_0x276e4f(0x25b)](_0xbbc7e6)+_0x276e4f(0x1ea));else{console[_0x276e4f(0x233)]('\x0aChanges\x20to\x20\x27'+_0xbbc7e6+'\x27:'),console[_0x276e4f(0x233)]('─'[_0x276e4f(0x28c)](0x3c)),console[_0x276e4f(0x233)](formatDiffWithColors(_0x64e7dc)),console[_0x276e4f(0x233)]('─'[_0x276e4f(0x28c)](0x3c));if(!_0x29e5f9['yes']){const _0x9760f1=await confirmKey(_0x276e4f(0x1f2)+_0xbbc7e6+'\x27?');if(!_0x9760f1)return console[_0x276e4f(0x233)](_0x276e4f(0x199)),0x1;}writeFileSync(_0xbbc7e6,_0x5c4789,_0x276e4f(0x1ae)),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1c7)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a29_0x265ace[_0x276e4f(0x25b)](_0xbbc7e6));}}else{const _0x29d484=a29_0x45cb35[_0x276e4f(0x219)](_0xbbc7e6);!existsSync(_0x29d484)&&mkdirSync(_0x29d484,{'recursive':!![]}),writeFileSync(_0xbbc7e6,_0x5c4789,_0x276e4f(0x1ae)),console['error'](a29_0x265ace[_0x276e4f(0x1c7)]('✔')+_0x276e4f(0x195)+a29_0x265ace['cyan'](_0xbbc7e6));}return saveSessionContext({'parent_segment':_0x3cf812},_0x29e5f9[_0x276e4f(0x285)]),console[_0x276e4f(0x233)](a29_0x265ace['green']('✔')+_0x276e4f(0x1f6)+a29_0x265ace[_0x276e4f(0x1e1)]('parent_segment')+'\x20=\x20'+a29_0x265ace['cyan'](_0x3cf812)),0x0;}}function a29_0x1024(){const _0xcf2c40=['green','\x20Opening\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Listing\x20fields\x20for\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20rows\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','customersWithEvents','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x5c$&','parent_segment','\x20--attribute\x20\x22','2398077NgiNHg','\x20parent\x20segment\x20\x27','coveragePercent','master','addBehaviors','workflowSessionId','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','1434635SKkWXq','Database:\x20','SQL\x20query:\x0a','Parent\x20segment:\x20','customerGroup','Show\x20parent\x20segment\x20details','dim','\x20parent\x20segment','segment:parent:fields','join','Updating','Enriched:','workflowId','Creating','6QgnIVj','\x20is\x20already\x20up\x20to\x20date','endsWith','/\x20→\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','behaviorsFile','toFixed','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayValidateResults','Overwrite\x20\x27','use','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','segment:parent:push','\x20Context\x20set:\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','22211PGiGXD','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Updated','\x0a⚠️\x20\x20Both\x20','\x20field','number','\x0a✔\x20Workflow\x20started','verbose','Options:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','keys','preview','%)\x20','displayAttributesStats','segment:parent:validate','log','No\x20parent\x20segments\x20found','database','parentSegment','displayColumns','execute','data','sampleData','Join:','Error\x20reading\x20file:\x20','✔\x20Renamed\x20directory\x20to\x20','segment:parent:desc','joinKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20kill','Name:\x20','👥\x20','dirname','Customers:','string','in\x20','runParent','Executing\x20parent\x20segment\x20query...','addAttributesFile','validateParentYaml','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','List\x20parent\x20segments','customerGroupFile','/\x20directory.\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','✔\x20Query\x20completed:\x20Processed\x20','jobId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','using\x20the\x20default\x20path:\x20','text','behavior','Analyzing\x20changes...','output','segment:parent:pull','Fetching\x20sample\x20data...','\x0aUsage:\x20tdx\x20ps\x20preview\x20','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','apply','\x20\x20\x20\x20-\x20','filter','allValid','varchar','Error\x20parsing\x20YAML:\x20','/attempt/','enriched','Master\x20Table','828228CwxlUC','start','/app/dw/parentSegments/','unref','tdx\x20segment\x20parent\x20preview\x20','foreignKey','✔\x20Found\x20','bold','Coverage:','match','/{name}.yml\x0a','length','replace','description','attributes','Columns:','\x20--behavior\x20\x22<name>\x22','createParent','30657699KziZBM','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20rows)','segment:parent:create','2168pRFKId','Get\x20SQL\x20query\x20for\x20parent\x20segment','Created','cyan','\x20--enriched','Table:\x20','segment','Options:\x0a','customerPercent','displayPreviewResults','displayPreviewHints','query','getParentFull','List\x20available\x20fields\x20for\x20segmentation','segment:parent:preview','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','table','To\x20cancel:','Apply\x20changes\x20to\x20\x27','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Rows:','Join\x20on:','Events:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','displayMasterInfo','name','audienceId','segment:parent:run','displaySampleData','previewParentYaml','\x27\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','trim','map','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\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','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','test','461544NtwaRx','column','site','Output\x20file:\x20','Validate:','session','Master:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20--attribute\x20\x22<name>\x22','Source:','columns','repeat','Attempt:','elapsedTimeMillis','Found\x20YAML\x20file:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\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','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','stats','json','\x0aNew\x20parent\x20segment\x20\x27','To\x20view\x20sample\x20data:','Error:\x20File\x20not\x20found:\x20','schemaError','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','segment:parent:sql','scheduleOption','Available\x20behaviors:','✔\x20No\x20changes\x20-\x20\x27','displayBehaviorsStats','Pattern:\x20','addBehaviorsFile','timezone','totalEvents','web','all','errors','double','status','\x20No\x20changes\x20-\x20','Master\x20+\x20Attributes','10wxzMnC','Error:\x20--database\x20and\x20--table\x20are\x20required','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','information_schema','format','displaySummary','Listing\x20parent\x20segments...','\x20\x20No\x20sample\x20data\x20available','interval','open','message','Listing\x20parent\x20segments\x20matching\x20\x27','darwin','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Fetching\x20parent\x20segment\x20\x27','jsonl','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x27\x20and\x20run\x20workflow?','`\x20to\x20download\x20the\x20configuration\x20first','run','Status:','yellow','Fetching\x20SQL\x20for\x20\x27','win32','isDirectory','behaviors','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20Configuration\x20is\x20valid','yes','localeCompare','Aborted.','segment:parent:show','listParents','Error:\x20--attribute\x20requires\x20a\x20name\x0a','FINISHED','Attribute:','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','1674880aIGRkg','toLocaleString','red','label','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x27...','segment:parent:list','getParentSQL','Site:\x20','/app/workflows/','attribute','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0a⚠️\x20\x20Migrating:\x20','Options\x20(one\x20required):\x0a','utf-8','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','rowCount','addAttributes','Resolving\x20parent\x20segment\x20\x27','Error:','matchedCount','workflowAttemptId','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','-1d','Create\x20parent\x20segment\x20\x27','\x20--behavior\x20\x22','resolveParentId','scheduleType','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','population','.yml','schemaValid','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Errors:','stop','listFields','\x20=\x20'];a29_0x1024=function(){return _0xcf2c40;};return a29_0x1024();}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x1f5);[a29_0x354af5(0x24c)]=a29_0x354af5(0x252);async[a29_0x354af5(0x20d)](_0x5b86af){const _0xbe9049=a29_0x354af5,{options:_0x542528,args:_0x9f4ced,tdx:_0x3c9a34}=_0x5b86af,_0x3de9c1=_0x542528,_0x211fcb=_0x9f4ced[0x0]||_0x542528[_0xbe9049(0x20b)];if(!_0x211fcb)return showParentSegmentNotSetError(_0xbe9049(0x222)+_0xbe9049(0x27e)),0x1;const _0x5e5085=resolveYamlFile(_0x211fcb);if(!existsSync(_0x5e5085))return showFileNotFoundError(_0x5e5085,_0x211fcb),0x1;_0x3de9c1['verbose']&&(console['error'](_0xbe9049(0x1a8)+_0x3de9c1[_0xbe9049(0x282)]),console[_0xbe9049(0x233)](_0xbe9049(0x26b)+_0x5e5085));let _0x3f557a;try{_0x3f557a=readFileSync(_0x5e5085,_0xbe9049(0x1ae));}catch(_0x4e7f11){const _0x2ea1c2=_0x4e7f11 instanceof Error?_0x4e7f11[_0xbe9049(0x185)]:String(_0x4e7f11);return console[_0xbe9049(0x233)](_0xbe9049(0x211)+_0x2ea1c2),0x1;}const _0x1d6b08=await withSpinner(_0xbe9049(0x22e),()=>_0x3c9a34[_0xbe9049(0x25e)]['pushParentYaml'](_0x3f557a),{'verbose':_0x3de9c1[_0xbe9049(0x200)]}),_0x572366=_0x1d6b08[_0xbe9049(0x20e)],{isNew:_0x19cd51,name:_0x56b503,hasChanges:_0x32a44c,diffFormatted:_0x46be03}=_0x572366;if(!_0x32a44c)return console[_0xbe9049(0x233)](_0xbe9049(0x16e)+_0x56b503+_0xbe9049(0x277)),0x0;_0x19cd51?console[_0xbe9049(0x233)](_0xbe9049(0x296)+_0x56b503+'\x27:'):console[_0xbe9049(0x233)](_0xbe9049(0x1b6)+_0x56b503+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0xbe9049(0x233)](_0x46be03),console[_0xbe9049(0x233)]('─'['repeat'](0x3c));const _0x53356f=_0x19cd51?'Create\x20parent\x20segment\x20\x27'+_0x56b503+'\x27?':_0xbe9049(0x26a)+_0x56b503+'\x27?';if(!_0x3de9c1[_0xbe9049(0x197)]){const _0x385e38=await confirmKey(_0x53356f);if(!_0x385e38)return console['error'](_0xbe9049(0x199)),0x1;}const _0x42f63c=_0x19cd51?'Creating':_0xbe9049(0x1e5),_0x3696c7=await withSpinner(_0x42f63c+'\x20parent\x20segment\x20\x27'+_0x56b503+_0xbe9049(0x1a5),()=>_0x572366['apply'](),{'verbose':_0x3de9c1['verbose']}),_0x28e03f=_0x3696c7[_0xbe9049(0x20e)],_0x2e852e=getConsoleNextUrl(_0x3de9c1[_0xbe9049(0x282)],'/app/dw/parentSegments/'+_0x28e03f['id']),_0x488b2e=_0x19cd51?_0xbe9049(0x25a):_0xbe9049(0x1fb);return console[_0xbe9049(0x233)]('✔\x20'+_0x488b2e+_0xbe9049(0x1d5)+_0x28e03f[_0xbe9049(0x272)]+'\x27'),console[_0xbe9049(0x233)]('\x20\x20'+_0x2e852e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x207);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1f0);async['execute'](_0x2eda68){const _0x3486e5=a29_0x354af5,{options:_0x4d54bd,args:_0x3edbd9,tdx:_0x39d44e}=_0x2eda68,_0x4d1fc8=_0x4d54bd,_0x401146=_0x3edbd9[0x0]||_0x4d54bd[_0x3486e5(0x20b)];if(!_0x401146)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'+_0x3486e5(0x229)+_0x3486e5(0x25f)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x3486e5(0x291)+_0x3486e5(0x1da)),0x1;const _0xf990fd=resolveYamlFile(_0x401146);if(!existsSync(_0xf990fd))return showFileNotFoundError(_0xf990fd,_0x401146),0x1;_0x4d1fc8[_0x3486e5(0x200)]&&(console[_0x3486e5(0x233)](_0x3486e5(0x1a8)+_0x4d1fc8['site']),console['error'](_0x3486e5(0x26b)+_0xf990fd));let _0x2f5f08;try{_0x2f5f08=readFileSync(_0xf990fd,_0x3486e5(0x1ae));}catch(_0x2a6d5c){const _0x208c65=_0x2a6d5c instanceof Error?_0x2a6d5c['message']:String(_0x2a6d5c);return console[_0x3486e5(0x233)](_0x3486e5(0x211)+_0x208c65),0x1;}const _0x38e50f=createCommandSpinner(a29_0x265ace[_0x3486e5(0x1e1)]('Validating\x20configuration...'),{'verbose':_0x4d1fc8[_0x3486e5(0x200)]});_0x38e50f['start']();const _0x5811e7={'onProgress':_0x550d27=>{const _0x5bb2ed=_0x3486e5;_0x38e50f[_0x5bb2ed(0x22c)]=formatProgressMessage(_0x550d27);}};if(_0x4d1fc8[_0x3486e5(0x1d7)])_0x5811e7['master']=!![];if(_0x4d1fc8[_0x3486e5(0x23d)])_0x5811e7[_0x3486e5(0x23d)]=!![];_0x4d1fc8[_0x3486e5(0x1aa)]&&(_0x5811e7[_0x3486e5(0x1aa)]=_0x4d1fc8[_0x3486e5(0x1aa)]);_0x4d1fc8[_0x3486e5(0x22d)]&&(_0x5811e7['behavior']=_0x4d1fc8[_0x3486e5(0x22d)]);if(_0x4d1fc8['interval'])_0x5811e7[_0x3486e5(0x183)]=_0x4d1fc8['interval'];let _0x3438bf;try{_0x3438bf=await _0x39d44e['segment'][_0x3486e5(0x220)](_0x2f5f08,_0x5811e7),_0x38e50f[_0x3486e5(0x1c4)]();}catch(_0x17d8c5){_0x38e50f[_0x3486e5(0x1c4)]();throw _0x17d8c5;}const _0x3f6ff4=_0x4d1fc8['interval']||_0x3486e5(0x1b8);return this[_0x3486e5(0x1f1)](_0x3438bf,_0x5811e7,_0xf990fd,_0x3f6ff4),_0x3438bf['allValid']?0x0:0x1;}[a29_0x354af5(0x1f1)](_0x3105db,_0x10e569,_0xa17ab7,_0x13eb89){const _0x5b2430=a29_0x354af5;console[_0x5b2430(0x233)]('\x0a'+a29_0x265ace[_0x5b2430(0x246)](_0x5b2430(0x284))+'\x20'+_0x3105db[_0x5b2430(0x272)]),console[_0x5b2430(0x233)]('═'['repeat'](0x3c)),this['displayMasterInfo'](_0x3105db);if(typeof _0x10e569[_0x5b2430(0x1aa)]===_0x5b2430(0x21b)){this['displayAttributesStats'](_0x3105db),this[_0x5b2430(0x180)](_0x3105db),this['displayPreviewHints'](_0xa17ab7,_0x13eb89,'attribute',_0x10e569['attribute']);return;}if(_0x10e569[_0x5b2430(0x1aa)]===!![]){this[_0x5b2430(0x206)](_0x3105db),this[_0x5b2430(0x180)](_0x3105db),this['displayPreviewHints'](_0xa17ab7,_0x13eb89,_0x5b2430(0x24d));return;}if(typeof _0x10e569[_0x5b2430(0x22d)]===_0x5b2430(0x21b)){this[_0x5b2430(0x16f)](_0x3105db,_0x13eb89),this[_0x5b2430(0x180)](_0x3105db),this[_0x5b2430(0x262)](_0xa17ab7,_0x13eb89,_0x5b2430(0x22d),_0x10e569[_0x5b2430(0x22d)]);return;}if(_0x10e569[_0x5b2430(0x22d)]===!![]){this['displayBehaviorsStats'](_0x3105db,_0x13eb89),this[_0x5b2430(0x180)](_0x3105db),this[_0x5b2430(0x262)](_0xa17ab7,_0x13eb89,_0x5b2430(0x194));return;}this['displayAttributesStats'](_0x3105db),this[_0x5b2430(0x16f)](_0x3105db,_0x13eb89),this[_0x5b2430(0x180)](_0x3105db),this['displayPreviewHints'](_0xa17ab7,_0x13eb89,_0x5b2430(0x175));}[a29_0x354af5(0x262)](_0x3cd4c5,_0x5224aa,_0x1b935b,_0x296958){const _0x37180f=a29_0x354af5;console[_0x37180f(0x233)]('\x0a'+a29_0x265ace[_0x37180f(0x1e1)](_0x37180f(0x297)));const _0x4f3716=_0x5224aa!==_0x37180f(0x1b8)?'\x20--interval\x20'+_0x5224aa:'';if(_0x1b935b===_0x37180f(0x1aa)&&_0x296958)console['error']('\x20\x20'+a29_0x265ace['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x3cd4c5+_0x37180f(0x1d3)+_0x296958+'\x22'+_0x4f3716));else{if(_0x1b935b===_0x37180f(0x22d)&&_0x296958)console[_0x37180f(0x233)]('\x20\x20'+a29_0x265ace[_0x37180f(0x1e1)]('tdx\x20segment\x20parent\x20preview\x20'+_0x3cd4c5+_0x37180f(0x1ba)+_0x296958+'\x22'+_0x4f3716));else(_0x1b935b===_0x37180f(0x24d)||_0x1b935b===_0x37180f(0x175))&&console['error']('\x20\x20'+a29_0x265ace['dim'](_0x37180f(0x243)+_0x3cd4c5+_0x37180f(0x289)+_0x4f3716));}(_0x1b935b===_0x37180f(0x194)||_0x1b935b===_0x37180f(0x175))&&console['error']('\x20\x20'+a29_0x265ace['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x3cd4c5+_0x37180f(0x24f)+_0x4f3716)),_0x1b935b===_0x37180f(0x175)&&console[_0x37180f(0x233)]('\x20\x20'+a29_0x265ace['dim'](_0x37180f(0x243)+_0x3cd4c5+_0x37180f(0x25c)+_0x4f3716));}[a29_0x354af5(0x271)](_0x1e3dba){const _0x1eb793=a29_0x354af5,{master:_0x32c5c2}=_0x1e3dba,_0x536377=_0x32c5c2[_0x1eb793(0x1c0)]?a29_0x265ace[_0x1eb793(0x1c7)]('✔'):a29_0x265ace[_0x1eb793(0x1a2)]('✘');console['error']('\x0a'+a29_0x265ace[_0x1eb793(0x1e1)](_0x1eb793(0x23e))),console[_0x1eb793(0x233)](_0x536377+'\x20'+a29_0x265ace[_0x1eb793(0x246)](_0x32c5c2[_0x1eb793(0x20a)]+'.'+_0x32c5c2[_0x1eb793(0x268)])),_0x32c5c2[_0x1eb793(0x1c0)]?_0x32c5c2[_0x1eb793(0x1b0)]!==undefined&&console['error']('\x20\x20'+a29_0x265ace[_0x1eb793(0x1e1)](_0x1eb793(0x26d))+'\x20'+a29_0x265ace[_0x1eb793(0x25b)](formatRows(_0x32c5c2['rowCount']))):console[_0x1eb793(0x233)]('\x20\x20'+a29_0x265ace[_0x1eb793(0x1a2)](_0x1eb793(0x1b3))+'\x20'+_0x32c5c2[_0x1eb793(0x299)]);}['displayAttributesStats'](_0x42d3ac){const _0x48dc87=a29_0x354af5;if(_0x42d3ac[_0x48dc87(0x24d)][_0x48dc87(0x24a)]===0x0)return;console[_0x48dc87(0x233)]('\x0a'+a29_0x265ace[_0x48dc87(0x1e1)]('Attributes'));for(const _0x1826e of _0x42d3ac['attributes']){const _0x41fa02=_0x1826e[_0x48dc87(0x1c0)]?a29_0x265ace[_0x48dc87(0x1c7)]('✔'):a29_0x265ace[_0x48dc87(0x1a2)]('✘');let _0x53e057='';if(_0x1826e[_0x48dc87(0x1c0)]&&_0x1826e[_0x48dc87(0x1b4)]!==undefined&&_0x1826e[_0x48dc87(0x1d6)]!==undefined){const _0x385f70=_0x1826e[_0x48dc87(0x1d6)]['toFixed'](0x1),_0x234540=_0x1826e['coveragePercent']>=0x50?a29_0x265ace[_0x48dc87(0x1c7)]:_0x1826e[_0x48dc87(0x1d6)]>=0x32?a29_0x265ace[_0x48dc87(0x190)]:a29_0x265ace[_0x48dc87(0x1a2)];_0x53e057='\x20'+a29_0x265ace[_0x48dc87(0x1e1)](_0x48dc87(0x247))+'\x20'+_0x234540(_0x385f70+'%')+'\x20('+formatRows(_0x1826e[_0x48dc87(0x1b4)])+_0x48dc87(0x256);}console[_0x48dc87(0x233)](_0x41fa02+'\x20'+a29_0x265ace[_0x48dc87(0x246)](_0x1826e[_0x48dc87(0x272)])+_0x53e057),console['error']('\x20\x20'+a29_0x265ace[_0x48dc87(0x1e1)](_0x48dc87(0x28a))+'\x20'+a29_0x265ace['bold'](_0x1826e[_0x48dc87(0x20a)]+'.'+_0x1826e[_0x48dc87(0x268)]));const _0x5243b9=_0x1826e[_0x48dc87(0x214)]===_0x1826e[_0x48dc87(0x244)]?a29_0x265ace[_0x48dc87(0x1e1)]('Join\x20on:')+'\x20'+_0x1826e[_0x48dc87(0x214)]:a29_0x265ace['dim'](_0x48dc87(0x210))+'\x20'+_0x1826e[_0x48dc87(0x214)]+_0x48dc87(0x1c6)+_0x1826e['foreignKey'];console[_0x48dc87(0x233)]('\x20\x20'+_0x5243b9),console[_0x48dc87(0x233)]('\x20\x20'+a29_0x265ace[_0x48dc87(0x1e1)](_0x48dc87(0x24e))),this[_0x48dc87(0x20c)](_0x1826e[_0x48dc87(0x28b)]),!_0x1826e['schemaValid']&&console['error']('\x20\x20'+a29_0x265ace[_0x48dc87(0x1a2)](_0x48dc87(0x1b3))+'\x20'+_0x1826e[_0x48dc87(0x299)]);}}[a29_0x354af5(0x16f)](_0x422977,_0xb0d0c8){const _0x518203=a29_0x354af5;if(_0x422977[_0x518203(0x194)][_0x518203(0x24a)]===0x0)return;console[_0x518203(0x233)]('\x0a'+a29_0x265ace[_0x518203(0x1e1)]('Behaviors')+'\x20'+a29_0x265ace[_0x518203(0x1e1)]('('+_0xb0d0c8+')'));for(const _0x537d11 of _0x422977['behaviors']){const _0x339a40=_0x537d11[_0x518203(0x1c0)]?a29_0x265ace['green']('✔'):a29_0x265ace[_0x518203(0x1a2)]('✘');let _0x3986eb='';if(_0x537d11[_0x518203(0x1c0)]&&_0x537d11[_0x518203(0x1ce)]!==undefined&&_0x537d11[_0x518203(0x173)]!==undefined){const _0x39675c=_0x537d11[_0x518203(0x260)]?.[_0x518203(0x1ef)](0x1)||'?',_0x20b8be=(_0x537d11[_0x518203(0x260)]??0x0)>=0x32?a29_0x265ace[_0x518203(0x1c7)]:(_0x537d11[_0x518203(0x260)]??0x0)>=0x14?a29_0x265ace['yellow']:a29_0x265ace[_0x518203(0x1a2)];_0x3986eb='\x20'+a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x21a))+'\x20'+_0x20b8be(formatRows(_0x537d11[_0x518203(0x1ce)]))+'\x20('+_0x39675c+_0x518203(0x205)+a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x26f))+'\x20'+a29_0x265ace['cyan'](formatRows(_0x537d11[_0x518203(0x173)]));}console[_0x518203(0x233)](_0x339a40+'\x20'+a29_0x265ace[_0x518203(0x246)](_0x537d11[_0x518203(0x272)])+_0x3986eb),console[_0x518203(0x233)]('\x20\x20'+a29_0x265ace[_0x518203(0x1e1)]('Source:')+'\x20'+a29_0x265ace[_0x518203(0x246)](_0x537d11[_0x518203(0x20a)]+'.'+_0x537d11[_0x518203(0x268)]));const _0x54c376=_0x537d11[_0x518203(0x214)]===_0x537d11[_0x518203(0x244)]?a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x26e))+'\x20'+_0x537d11[_0x518203(0x214)]:a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x210))+'\x20'+_0x537d11['joinKey']+_0x518203(0x1c6)+_0x537d11[_0x518203(0x244)];console[_0x518203(0x233)]('\x20\x20'+_0x54c376),console[_0x518203(0x233)]('\x20\x20'+a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x24e))),this[_0x518203(0x20c)](_0x537d11['columns']),!_0x537d11['schemaValid']&&console[_0x518203(0x233)]('\x20\x20'+a29_0x265ace[_0x518203(0x1a2)](_0x518203(0x1b3))+'\x20'+_0x537d11['schemaError']);}}[a29_0x354af5(0x20c)](_0x18319b){const _0x4666e2=a29_0x354af5;for(const _0x142d25 of _0x18319b){_0x142d25[_0x4666e2(0x1a3)]===_0x142d25[_0x4666e2(0x281)]||_0x142d25[_0x4666e2(0x281)]==='*'?console[_0x4666e2(0x233)](_0x4666e2(0x237)+_0x142d25['label']):console[_0x4666e2(0x233)]('\x20\x20\x20\x20-\x20'+_0x142d25[_0x4666e2(0x1a3)]+'\x20'+a29_0x265ace['dim']('('+_0x142d25[_0x4666e2(0x281)]+')'));}}[a29_0x354af5(0x180)](_0x1872f9){const _0x2ff344=a29_0x354af5;console[_0x2ff344(0x233)]('─'[_0x2ff344(0x28c)](0x3c));if(_0x1872f9['errors'][_0x2ff344(0x24a)]>0x0){console['error']('\x0a'+a29_0x265ace[_0x2ff344(0x1a2)](_0x2ff344(0x1c3)));for(const _0x1ba519 of _0x1872f9['errors']){console[_0x2ff344(0x233)]('\x20\x20'+a29_0x265ace[_0x2ff344(0x1a2)]('•')+'\x20'+_0x1ba519);}}_0x1872f9[_0x2ff344(0x239)]&&console[_0x2ff344(0x233)]('\x0a'+a29_0x265ace[_0x2ff344(0x1c7)]('✔')+_0x2ff344(0x196));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a29_0x354af5(0x266);[a29_0x354af5(0x24c)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0xfeb788){const _0x5253ed=a29_0x354af5,{options:_0x3a5ad5,args:_0x12e01e,tdx:_0x5b2dc6}=_0xfeb788,_0x4c285e=_0x3a5ad5,_0x5d7065=_0x12e01e[0x0]||_0x3a5ad5[_0x5253ed(0x20b)];if(!_0x5d7065)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'+_0x5253ed(0x27c)+_0x5253ed(0x1ad)+_0x5253ed(0x18b)+_0x5253ed(0x188)+_0x5253ed(0x27b)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x5253ed(0x1da)),0x1;if(!_0x4c285e[_0x5253ed(0x1d7)]&&!_0x4c285e['attribute']&&!_0x4c285e[_0x5253ed(0x22d)]&&!_0x4c285e['enriched'])return console['error'](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x253))),console['error'](_0x5253ed(0x1f8)),console[_0x5253ed(0x233)](_0x5253ed(0x201)),console[_0x5253ed(0x233)](_0x5253ed(0x1af)),console[_0x5253ed(0x233)](_0x5253ed(0x254)),console[_0x5253ed(0x233)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5253ed(0x233)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x254710=resolveYamlFile(_0x5d7065);if(!existsSync(_0x254710))return showFileNotFoundError(_0x254710,_0x5d7065),0x1;_0x4c285e[_0x5253ed(0x200)]&&(console[_0x5253ed(0x233)]('Site:\x20'+_0x4c285e[_0x5253ed(0x282)]),console[_0x5253ed(0x233)](_0x5253ed(0x26b)+_0x254710));let _0x4ae82e;try{_0x4ae82e=readFileSync(_0x254710,_0x5253ed(0x1ae));}catch(_0x541701){const _0x320a3b=_0x541701 instanceof Error?_0x541701[_0x5253ed(0x185)]:String(_0x541701);return console[_0x5253ed(0x233)](_0x5253ed(0x211)+_0x320a3b),0x1;}let _0x30e842;try{_0x30e842=parseYamlString(_0x4ae82e);}catch(_0x330728){const _0x1d07cb=_0x330728 instanceof Error?_0x330728['message']:String(_0x330728);return console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x23b)+_0x1d07cb)),0x1;}if(_0x4c285e[_0x5253ed(0x1aa)]===!![]||_0x4c285e['attribute']===''){const _0xd854a7=_0x30e842[_0x5253ed(0x24d)]?.[_0x5253ed(0x27a)](_0x44aa56=>_0x44aa56[_0x5253ed(0x272)])||[];if(_0xd854a7[_0x5253ed(0x24a)]===0x0)console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x1bd)));else{console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x19c))),console['error']('Available\x20attributes:');for(const _0x29465f of _0xd854a7){console[_0x5253ed(0x233)]('\x20\x20'+a29_0x265ace[_0x5253ed(0x25b)](_0x29465f));}console[_0x5253ed(0x233)](_0x5253ed(0x232)+_0x5d7065+_0x5253ed(0x1d3)+_0xd854a7[0x0]+'\x22');}return 0x1;}if(_0x4c285e['behavior']===!![]||_0x4c285e['behavior']===''){const _0x5a17a2=_0x30e842['behaviors']?.[_0x5253ed(0x27a)](_0x2e02f5=>_0x2e02f5[_0x5253ed(0x272)])||[];if(_0x5a17a2['length']===0x0)console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x267)));else{console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x22a))),console[_0x5253ed(0x233)](_0x5253ed(0x16d));for(const _0x572dd5 of _0x5a17a2){console[_0x5253ed(0x233)]('\x20\x20'+a29_0x265ace['cyan'](_0x572dd5));}console[_0x5253ed(0x233)](_0x5253ed(0x232)+_0x5d7065+_0x5253ed(0x1ba)+_0x5a17a2[0x0]+'\x22');}return 0x1;}const _0x5603ed=createCommandSpinner(a29_0x265ace[_0x5253ed(0x1e1)](_0x5253ed(0x231)),{'verbose':_0x4c285e[_0x5253ed(0x200)]});_0x5603ed[_0x5253ed(0x240)]();const _0x3b7735={'onProgress':_0x1c0745=>{const _0x518f72=_0x5253ed;_0x5603ed[_0x518f72(0x22c)]=formatProgressMessage(_0x1c0745);}};if(_0x4c285e[_0x5253ed(0x1d7)])_0x3b7735[_0x5253ed(0x1d7)]=!![];if(_0x4c285e[_0x5253ed(0x1aa)]&&typeof _0x4c285e[_0x5253ed(0x1aa)]==='string')_0x3b7735['attribute']=_0x4c285e[_0x5253ed(0x1aa)];if(_0x4c285e[_0x5253ed(0x22d)]&&typeof _0x4c285e[_0x5253ed(0x22d)]===_0x5253ed(0x21b))_0x3b7735['behavior']=_0x4c285e[_0x5253ed(0x22d)];if(_0x4c285e['enriched'])_0x3b7735[_0x5253ed(0x23d)]=!![];if(_0x4c285e[_0x5253ed(0x183)])_0x3b7735[_0x5253ed(0x183)]=_0x4c285e['interval'];let _0x3573f5;try{_0x3573f5=await _0x5b2dc6[_0x5253ed(0x25e)][_0x5253ed(0x276)](_0x4ae82e,_0x3b7735),_0x5603ed[_0x5253ed(0x1c4)]();}catch(_0x341ee6){_0x5603ed[_0x5253ed(0x1c4)]();throw _0x341ee6;}return await this['displayPreviewResults'](_0x3573f5,{'master':_0x4c285e[_0x5253ed(0x1d7)],'attribute':typeof _0x4c285e[_0x5253ed(0x1aa)]==='string'?_0x4c285e['attribute']:undefined,'behavior':typeof _0x4c285e[_0x5253ed(0x22d)]===_0x5253ed(0x21b)?_0x4c285e[_0x5253ed(0x22d)]:undefined,'enriched':_0x4c285e[_0x5253ed(0x23d)]}),_0x3573f5[_0x5253ed(0x239)]?0x0:0x1;}async[a29_0x354af5(0x261)](_0x469259,_0x19f20a){const _0xa74ba=a29_0x354af5;console['error']('\x0a'+a29_0x265ace[_0xa74ba(0x246)]('Preview:')+'\x20'+_0x469259[_0xa74ba(0x272)]),console[_0xa74ba(0x233)]('═'[_0xa74ba(0x28c)](0x3c));if(_0x19f20a[_0xa74ba(0x1d7)]&&_0x469259[_0xa74ba(0x20f)]){const _0x167a03=a29_0x265ace[_0xa74ba(0x1e1)](_0xa74ba(0x286))+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0x469259['master'][_0xa74ba(0x20a)]+'.'+_0x469259[_0xa74ba(0x1d7)][_0xa74ba(0x268)]);await this[_0xa74ba(0x275)](_0x167a03,_0x469259[_0xa74ba(0x20f)]);}else{if(_0x19f20a[_0xa74ba(0x1aa)]&&_0x469259[_0xa74ba(0x20f)]){const _0x757649=a29_0x265ace[_0xa74ba(0x1e1)](_0xa74ba(0x19e))+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0x19f20a[_0xa74ba(0x1aa)]);await this[_0xa74ba(0x275)](_0x757649,_0x469259[_0xa74ba(0x20f)]);}else{if(_0x19f20a[_0xa74ba(0x22d)]&&_0x469259[_0xa74ba(0x20f)]){const _0x51283f=a29_0x265ace[_0xa74ba(0x1e1)]('Behavior:')+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0x19f20a[_0xa74ba(0x22d)]);await this[_0xa74ba(0x275)](_0x51283f,_0x469259[_0xa74ba(0x20f)]);}else{if(_0x19f20a[_0xa74ba(0x23d)]&&_0x469259[_0xa74ba(0x20f)]){const _0x126cbd=a29_0x265ace['dim'](_0xa74ba(0x1e6))+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0xa74ba(0x17a));await this['displaySampleData'](_0x126cbd,_0x469259['sampleData']);}else!_0x469259['sampleData']&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0x469259[_0xa74ba(0x176)][_0xa74ba(0x24a)]>0x0){console[_0xa74ba(0x233)]('─'[_0xa74ba(0x28c)](0x3c)),console[_0xa74ba(0x233)]('\x0a'+a29_0x265ace[_0xa74ba(0x1a2)](_0xa74ba(0x1c3)));for(const _0x2fc2c8 of _0x469259[_0xa74ba(0x176)]){console[_0xa74ba(0x233)]('\x20\x20'+a29_0x265ace[_0xa74ba(0x1a2)]('•')+'\x20'+_0x2fc2c8);}}}async[a29_0x354af5(0x275)](_0x54b0c7,_0x553600){const _0x4342ae=a29_0x354af5;if(_0x553600[_0x4342ae(0x24a)]===0x0){console[_0x4342ae(0x233)]('\x0a'+_0x54b0c7),console[_0x4342ae(0x233)](_0x4342ae(0x182));return;}console[_0x4342ae(0x233)]('\x0a'+_0x54b0c7);const _0x6c4d21=Object[_0x4342ae(0x203)](_0x553600[0x0])[_0x4342ae(0x27a)](_0x296a82=>({'name':_0x296a82,'type':typeof _0x553600[0x0][_0x296a82]===_0x4342ae(0x1fe)?_0x4342ae(0x177):_0x4342ae(0x23a)})),_0x1f101c={'queryId':_0x4342ae(0x204),'columns':_0x6c4d21,'data':_0x553600,'stats':{'state':_0x4342ae(0x19d),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x553600[_0x4342ae(0x24a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2759e6=formatAsTable(_0x1f101c,_0x553600[_0x4342ae(0x24a)],!![]);await writeOutput(_0x2759e6,undefined,_0x4342ae(0x268));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x274);[a29_0x354af5(0x24c)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x354af5(0x20d)](_0x13fe25){const _0x31a5c7=a29_0x354af5,{options:_0x554c2d,args:_0x4b0c98,tdx:_0x254d41}=_0x13fe25,_0x394a73=_0x554c2d,_0x46aad0=_0x4b0c98[0x0]||_0x554c2d[_0x31a5c7(0x20b)];if(!_0x46aad0)return showParentSegmentNotSetError(_0x31a5c7(0x278)+_0x31a5c7(0x215)),0x1;const _0x20edba=resolveYamlFile(_0x46aad0);if(existsSync(_0x20edba)){_0x394a73[_0x31a5c7(0x200)]&&console[_0x31a5c7(0x233)](_0x31a5c7(0x28f)+_0x20edba);let _0x158de5;try{_0x158de5=readFileSync(_0x20edba,_0x31a5c7(0x1ae));}catch(_0x4a7011){const _0x481427=_0x4a7011 instanceof Error?_0x4a7011[_0x31a5c7(0x185)]:String(_0x4a7011);return console[_0x31a5c7(0x233)]('Error\x20reading\x20file:\x20'+_0x481427),0x1;}const _0x42d4e2=await withSpinner(_0x31a5c7(0x22e),()=>_0x254d41[_0x31a5c7(0x25e)]['pushParentYaml'](_0x158de5),{'verbose':_0x394a73[_0x31a5c7(0x200)]}),_0x11b144=_0x42d4e2[_0x31a5c7(0x20e)],{isNew:_0x259dec,name:_0x4d09d5,hasChanges:_0x3cd5e5,diffFormatted:_0x73bd93}=_0x11b144;if(_0x3cd5e5){_0x259dec?console[_0x31a5c7(0x233)](_0x31a5c7(0x296)+_0x4d09d5+'\x27:'):console[_0x31a5c7(0x233)](_0x31a5c7(0x1b6)+_0x4d09d5+'\x27:');console[_0x31a5c7(0x233)]('─'[_0x31a5c7(0x28c)](0x3c)),console[_0x31a5c7(0x233)](_0x73bd93),console[_0x31a5c7(0x233)]('─'[_0x31a5c7(0x28c)](0x3c));const _0x2e9c30=_0x259dec?_0x31a5c7(0x1b9)+_0x4d09d5+_0x31a5c7(0x18c):'Apply\x20changes\x20to\x20\x27'+_0x4d09d5+_0x31a5c7(0x18c);if(!_0x394a73[_0x31a5c7(0x197)]){const _0x8926f=await confirmKey(_0x2e9c30);if(!_0x8926f)return console['error'](_0x31a5c7(0x199)),0x1;}const _0xd123c6=_0x259dec?_0x31a5c7(0x1e8):'Updating';await withSpinner(_0xd123c6+_0x31a5c7(0x1d5)+_0x4d09d5+_0x31a5c7(0x1a5),()=>_0x11b144[_0x31a5c7(0x236)](),{'verbose':_0x394a73[_0x31a5c7(0x200)]});const _0x4cf0fc=_0x259dec?_0x31a5c7(0x25a):_0x31a5c7(0x1fb);console[_0x31a5c7(0x233)]('✔\x20'+_0x4cf0fc+_0x31a5c7(0x1d5)+_0x4d09d5+'\x27');}else console[_0x31a5c7(0x233)](_0x31a5c7(0x16e)+_0x4d09d5+_0x31a5c7(0x221));}const _0x354384=await withSpinner(_0x31a5c7(0x293)+_0x46aad0+_0x31a5c7(0x1a5),()=>_0x254d41[_0x31a5c7(0x25e)][_0x31a5c7(0x21d)](_0x46aad0),{'verbose':_0x394a73[_0x31a5c7(0x200)]}),_0x2350f6=_0x354384['data'],_0x45da10=getConsoleUrl(_0x394a73[_0x31a5c7(0x282)],_0x31a5c7(0x1a9)+_0x2350f6[_0x31a5c7(0x1e7)]+'/sessions/'+_0x2350f6[_0x31a5c7(0x1d9)]+_0x31a5c7(0x23c)+_0x2350f6['workflowAttemptId']);return console['error'](_0x31a5c7(0x1ff)),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace[_0x31a5c7(0x1e1)]('Audience\x20ID:')+'\x20'+_0x2350f6[_0x31a5c7(0x273)]),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace[_0x31a5c7(0x1e1)](_0x31a5c7(0x18f))+'\x20'+_0x2350f6[_0x31a5c7(0x178)]),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace[_0x31a5c7(0x1e1)]('Session:')+'\x20'+_0x2350f6[_0x31a5c7(0x1d9)]),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace['dim'](_0x31a5c7(0x28d))+'\x20'+_0x2350f6[_0x31a5c7(0x1b5)]),console[_0x31a5c7(0x233)]('\x20\x20'+_0x45da10),console['error']('\x0a'+a29_0x265ace['dim'](_0x31a5c7(0x269))+'\x20tdx\x20wf\x20attempt\x20'+_0x2350f6['workflowAttemptId']+_0x31a5c7(0x216)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x1e3);[a29_0x354af5(0x24c)]=a29_0x354af5(0x265);async['execute'](_0x57eb03){const _0x216f86=a29_0x354af5,{options:_0x2f14c8,args:_0x19856b,tdx:_0x15cf83}=_0x57eb03,_0x54a00d=_0x19856b[0x0]||_0x2f14c8[_0x216f86(0x20b)];if(!_0x54a00d)return showParentSegmentNotSetError(_0x216f86(0x1cd)+_0x216f86(0x1d0)),0x1;_0x2f14c8[_0x216f86(0x200)]&&(console[_0x216f86(0x233)](_0x216f86(0x1a8)+_0x2f14c8[_0x216f86(0x282)]),console[_0x216f86(0x233)](_0x216f86(0x1de)+_0x54a00d));const _0x2b9320=await withSpinner(_0x216f86(0x1ca)+_0x54a00d+'\x27...',()=>_0x15cf83[_0x216f86(0x25e)][_0x216f86(0x1c5)](_0x54a00d),{'verbose':_0x2f14c8[_0x216f86(0x200)]}),_0x4df3b8=_0x2b9320[_0x216f86(0x20e)];console['error']('✔\x20Found\x20'+_0x4df3b8['length']+_0x216f86(0x1fd)+(_0x4df3b8[_0x216f86(0x24a)]!==0x1?'s':''));if(_0x2f14c8['json']||_0x2f14c8[_0x216f86(0x18a)])return await handleSDKOutput(_0x4df3b8,_0x2f14c8),0x0;return displayFieldsHumanReadable(_0x4df3b8,_0x54a00d),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x354af5(0x272)]='segment:parent:view';[a29_0x354af5(0x24c)]=a29_0x354af5(0x1e0);async[a29_0x354af5(0x20d)](_0x307020){const _0x2cf9cf=a29_0x354af5,{options:_0x4f9d84,args:_0x464ae4,tdx:_0x18a631}=_0x307020,_0x6279cb=_0x4f9d84,_0x2baf25=_0x464ae4[0x0]||_0x4f9d84[_0x2cf9cf(0x20b)];if(!_0x2baf25)return showParentSegmentNotSetError(_0x2cf9cf(0x1c1)+_0x2cf9cf(0x27d)+_0x2cf9cf(0x25f)+_0x2cf9cf(0x226)),0x1;_0x4f9d84[_0x2cf9cf(0x200)]&&(console[_0x2cf9cf(0x233)](_0x2cf9cf(0x1a8)+_0x4f9d84[_0x2cf9cf(0x282)]),console[_0x2cf9cf(0x233)](_0x2cf9cf(0x1de)+_0x2baf25));const _0xb5bb0=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x2baf25+_0x2cf9cf(0x1a5),()=>_0x18a631[_0x2cf9cf(0x25e)][_0x2cf9cf(0x264)](_0x2baf25),{'verbose':_0x4f9d84['verbose']}),_0x1fa55d=_0xb5bb0[_0x2cf9cf(0x20e)];if(_0x6279cb[_0x2cf9cf(0x174)]){const _0xab9f78=getConsoleNextUrl(_0x6279cb[_0x2cf9cf(0x282)],_0x2cf9cf(0x241)+_0x1fa55d['id']);return console[_0x2cf9cf(0x233)](a29_0x265ace[_0x2cf9cf(0x1c7)]('✔')+_0x2cf9cf(0x1c8)+a29_0x265ace[_0x2cf9cf(0x25b)](_0xab9f78)),openBrowser(_0xab9f78),0x0;}return await handleSingleObjectOutput(_0x1fa55d,_0x4f9d84),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x213);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1cb);async[a29_0x354af5(0x20d)](_0xf0a29b){const _0x124bcd=a29_0x354af5,{options:_0x51b488,args:_0x30210d,tdx:_0x4b5b8f}=_0xf0a29b,_0x2de8ad=_0x30210d[0x0]||_0x51b488[_0x124bcd(0x20b)];if(!_0x2de8ad)return showParentSegmentNotSetError(_0x124bcd(0x26c)+_0x124bcd(0x235)),0x1;_0x51b488[_0x124bcd(0x200)]&&(console[_0x124bcd(0x233)](_0x124bcd(0x1a8)+_0x51b488[_0x124bcd(0x282)]),console[_0x124bcd(0x233)](_0x124bcd(0x1de)+_0x2de8ad));const _0x47566a=await withSpinner(_0x124bcd(0x1b2)+_0x2de8ad+_0x124bcd(0x1a5),()=>_0x4b5b8f['segment'][_0x124bcd(0x1bb)](_0x2de8ad),{'verbose':_0x51b488[_0x124bcd(0x200)]}),_0x2ca2b6=_0x47566a[_0x124bcd(0x20e)],_0x1de741=await withSpinner(_0x124bcd(0x191)+_0x2de8ad+_0x124bcd(0x1a5),()=>_0x4b5b8f[_0x124bcd(0x25e)][_0x124bcd(0x1a7)](_0x2ca2b6),{'verbose':_0x51b488[_0x124bcd(0x200)]}),_0xdd6302=await executeSchemaQuery(_0x1de741[_0x124bcd(0x20e)],_0x4b5b8f,_0x51b488);return await handleQueryOutput(_0xdd6302,_0x51b488),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x16b);[a29_0x354af5(0x24c)]=a29_0x354af5(0x259);async[a29_0x354af5(0x20d)](_0x45787f){const _0x4dff77=a29_0x354af5,{options:_0x42b319,args:_0x339770,tdx:_0x2523da}=_0x45787f,_0x23e1ae=_0x339770[0x0]||_0x42b319['parentSegment'];if(!_0x23e1ae)return showParentSegmentNotSetError(_0x4dff77(0x1b7)+_0x4dff77(0x287)),0x1;_0x42b319['verbose']&&(console['error'](_0x4dff77(0x1a8)+_0x42b319[_0x4dff77(0x282)]),console[_0x4dff77(0x233)]('Parent\x20segment:\x20'+_0x23e1ae));const _0xd97dc8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x23e1ae+'\x27...',()=>_0x2523da[_0x4dff77(0x25e)]['resolveParentId'](_0x23e1ae),{'verbose':_0x42b319[_0x4dff77(0x200)]}),_0x4d010f=_0xd97dc8['data'],_0x37124d=await withSpinner(_0x4dff77(0x191)+_0x23e1ae+_0x4dff77(0x1a5),()=>_0x2523da[_0x4dff77(0x25e)][_0x4dff77(0x1a7)](_0x4d010f),{'verbose':_0x42b319['verbose']}),_0x5e8491=_0x37124d[_0x4dff77(0x20e)];return _0x42b319[_0x4dff77(0x17f)]===_0x4dff77(0x295)||_0x42b319[_0x4dff77(0x17f)]===_0x4dff77(0x18a)?await handleSDKOutput([{'sql':_0x5e8491}],_0x42b319):console[_0x4dff77(0x208)](_0x5e8491),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x19a);[a29_0x354af5(0x24c)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x3f4967){const _0x546cab=a29_0x354af5,{options:_0x50af43,args:_0x20a1e3,tdx:_0x34c5b2}=_0x3f4967,_0x2bc00e=_0x20a1e3[0x0]||_0x50af43[_0x546cab(0x20b)];if(!_0x2bc00e)return showParentSegmentNotSetError(_0x546cab(0x202)+_0x546cab(0x234)),0x1;_0x50af43['verbose']&&(console[_0x546cab(0x233)](_0x546cab(0x1a8)+_0x50af43[_0x546cab(0x282)]),console[_0x546cab(0x233)](_0x546cab(0x1de)+_0x2bc00e));const _0x5903b4=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2bc00e+_0x546cab(0x1a5),()=>_0x34c5b2[_0x546cab(0x25e)][_0x546cab(0x1bb)](_0x2bc00e),{'verbose':_0x50af43[_0x546cab(0x200)]}),_0x51dd26=_0x5903b4[_0x546cab(0x20e)],_0x190e42=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2bc00e+'\x27...',()=>_0x34c5b2[_0x546cab(0x25e)]['getParentSQL'](_0x51dd26),{'verbose':_0x50af43[_0x546cab(0x200)]});let _0x4c4446=_0x190e42[_0x546cab(0x20e)];const _0x320e31=resolveLimit(_0x50af43['limit'],DEFAULT_DISPLAY_LIMIT),_0x33bc55=/\bLIMIT\s+\d+/i['test'](_0x4c4446);!_0x33bc55&&(_0x4c4446=_0x4c4446[_0x546cab(0x279)]()[_0x546cab(0x24b)](/;+$/,''),_0x4c4446='SELECT\x20*\x20FROM\x20(\x0a'+_0x4c4446+_0x546cab(0x1ed)+_0x320e31);_0x50af43['verbose']&&console['error'](_0x546cab(0x1dd)+_0x4c4446);const _0x471573=await withQuerySpinner(_0x546cab(0x21e),async _0x22f026=>{const _0x1609e3=_0x546cab,_0x44d84a=await _0x34c5b2[_0x1609e3(0x263)]['execute'](_0x4c4446,{'catalog':'td','schema':_0x1609e3(0x17e),'onJobId':_0x30aea6=>{_0x22f026['setJobId'](_0x30aea6);}});return _0x44d84a;},{'verbose':_0x50af43['verbose']}),_0xc0d1db=_0x471573['data'],_0x2cf372=_0xc0d1db[_0x546cab(0x228)]?'\x20[Job\x20ID:\x20'+_0xc0d1db['jobId']+']':'';return console[_0x546cab(0x233)](_0x546cab(0x227)+_0xc0d1db[_0x546cab(0x294)]['processedRows'][_0x546cab(0x1a1)]()+_0x546cab(0x1cc)+(_0x546cab(0x21c)+formatElapsed(_0xc0d1db[_0x546cab(0x294)][_0x546cab(0x28e)])+_0x2cf372)),await handleQueryOutput(_0xc0d1db,_0x50af43),0x0;}}
1
+ const a29_0x5453af=a29_0x37a3;(function(_0x11336d,_0x25bab6){const _0x355bff=a29_0x37a3,_0x205503=_0x11336d();while(!![]){try{const _0x40ee83=parseInt(_0x355bff(0x20e))/0x1*(-parseInt(_0x355bff(0x1af))/0x2)+-parseInt(_0x355bff(0x16e))/0x3+-parseInt(_0x355bff(0x1eb))/0x4*(parseInt(_0x355bff(0x22e))/0x5)+-parseInt(_0x355bff(0x23a))/0x6+-parseInt(_0x355bff(0x188))/0x7+parseInt(_0x355bff(0x25a))/0x8*(-parseInt(_0x355bff(0x22f))/0x9)+-parseInt(_0x355bff(0x207))/0xa*(-parseInt(_0x355bff(0x219))/0xb);if(_0x40ee83===_0x25bab6)break;else _0x205503['push'](_0x205503['shift']());}catch(_0x3b58b3){_0x205503['push'](_0x205503['shift']());}}}(a29_0x2858,0x36ab1));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0xb8402e 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 a29_0xfad20c 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=a29_0x5453af(0x1f9),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x287de2){const _0x30c283=a29_0x5453af,_0x1856a8=process[_0x30c283(0x18a)],_0x4fb5f7=_0x1856a8==='darwin'?_0x30c283(0x254):_0x1856a8===_0x30c283(0x273)?_0x30c283(0x27f):_0x30c283(0x170);spawn(_0x4fb5f7,[_0x287de2],{'detached':!![],'stdio':_0x30c283(0x1a3)})[_0x30c283(0x17d)]();}function migrateLegacyDirectory(){const _0x524e6a=a29_0x5453af;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x20ff67=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x20ff67[_0x524e6a(0x189)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x524e6a(0x173)](a29_0xfad20c['yellow'](_0x524e6a(0x177)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x524e6a(0x1e9))),console[_0x524e6a(0x173)](a29_0xfad20c['dim'](_0x524e6a(0x176)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x524e6a(0x173)](a29_0xfad20c[_0x524e6a(0x195)](_0x524e6a(0x1ef)+LEGACY_PARENT_SEGMENT_DIR+_0x524e6a(0x256)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x524e6a(0x173)](a29_0xfad20c['green'](_0x524e6a(0x1f4)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x56b0fa){const _0x48df7e=_0x56b0fa instanceof Error?_0x56b0fa[_0x524e6a(0x175)]:String(_0x56b0fa);return console[_0x524e6a(0x173)](a29_0xfad20c['red'](_0x524e6a(0x259)+_0x48df7e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x420a2a){const _0x20b171=a29_0x5453af;return migrateLegacyDirectory(),super[_0x20b171(0x21c)](_0x420a2a);}}function resolveYamlFile(_0x31318c){const _0x4a32fd=a29_0x5453af;if(_0x31318c[_0x4a32fd(0x1b0)](_0x4a32fd(0x1a4))||_0x31318c[_0x4a32fd(0x1b0)]('.yaml'))return _0x31318c;return a29_0xb8402e[_0x4a32fd(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31318c)+'.yml');}function formatProgressMessage(_0x7db43d){const _0x5bf28c=a29_0x5453af,_0x11215a=_0x7db43d['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x11215a){const [,_0x4c3ec4,_0x1b297c,_0x4a8493='']=_0x11215a;return a29_0xfad20c[_0x5bf28c(0x1b9)](_0x4c3ec4+':')+'\x20'+_0x1b297c+a29_0xfad20c[_0x5bf28c(0x1b9)](_0x4a8493);}return a29_0xfad20c[_0x5bf28c(0x1b9)](_0x7db43d);}function showFileNotFoundError(_0x250727,_0x38c36b){const _0x2c77f7=a29_0x5453af;console[_0x2c77f7(0x173)](a29_0xfad20c[_0x2c77f7(0x286)]('Error:\x20File\x20not\x20found:\x20'+_0x250727+'\x0a')),console[_0x2c77f7(0x173)](a29_0xfad20c[_0x2c77f7(0x162)](_0x2c77f7(0x1c9)+_0x38c36b+_0x2c77f7(0x1d3)));}function showParentSegmentNotSetError(_0x3c876c){const _0x3a04c1=a29_0x5453af;console[_0x3a04c1(0x173)](a29_0xfad20c[_0x3a04c1(0x195)](_0x3a04c1(0x17f))),console[_0x3a04c1(0x173)](_0x3c876c);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x1a6);[a29_0x5453af(0x280)]=a29_0x5453af(0x224);async[a29_0x5453af(0x21f)](_0x197203){const _0x86a2b9=a29_0x5453af,{options:_0xaee5ce,args:_0xa05c5d,tdx:_0x5482af}=_0x197203,_0x375706=_0xa05c5d[0x0];_0xaee5ce[_0x86a2b9(0x19d)]&&(console[_0x86a2b9(0x173)](_0x86a2b9(0x255)+_0xaee5ce[_0x86a2b9(0x180)]),_0x375706&&console[_0x86a2b9(0x173)](_0x86a2b9(0x282)+_0x375706));const _0x2eb430=await withSpinner(_0x375706?_0x86a2b9(0x18f)+_0x375706+_0x86a2b9(0x1d4):_0x86a2b9(0x23f),()=>_0x5482af[_0x86a2b9(0x1a8)][_0x86a2b9(0x1fb)](),{'verbose':_0xaee5ce[_0x86a2b9(0x19d)]});let _0x31fc3f=_0x2eb430[_0x86a2b9(0x1e6)];if(_0x375706){const _0x543e1e=_0x375706['replace'](/[.+^${}()|[\]\\]/g,_0x86a2b9(0x1a0))['replace'](/\*/g,'.*')[_0x86a2b9(0x178)](/\?/g,'.'),_0x2db4d4=new RegExp('^'+_0x543e1e+'$','i');_0x31fc3f=_0x31fc3f[_0x86a2b9(0x1d0)](_0x4bac45=>_0x2db4d4['test'](_0x4bac45[_0x86a2b9(0x19a)]['name']));}_0x31fc3f[_0x86a2b9(0x190)]((_0x2dfb96,_0x384082)=>_0x2dfb96[_0x86a2b9(0x19a)][_0x86a2b9(0x185)][_0x86a2b9(0x26f)](_0x384082['attributes'][_0x86a2b9(0x185)])),console[_0x86a2b9(0x173)]('✔\x20Found\x20'+_0x31fc3f[_0x86a2b9(0x1fc)]+_0x86a2b9(0x1c5)+(_0x31fc3f[_0x86a2b9(0x1fc)]!==0x1?'s':''));if(_0xaee5ce[_0x86a2b9(0x16a)]==='json'||_0xaee5ce[_0x86a2b9(0x16a)]===_0x86a2b9(0x24d))await handleSDKOutput(_0x31fc3f,_0xaee5ce);else{if(_0x31fc3f[_0x86a2b9(0x1fc)]===0x0)_0x375706?console['log']('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x375706):console[_0x86a2b9(0x27e)](_0x86a2b9(0x160));else for(const _0x347e84 of _0x31fc3f){const _0x572bac=_0x347e84[_0x86a2b9(0x19a)][_0x86a2b9(0x1cc)]?a29_0xfad20c['dim']('\x20('+formatRows(_0x347e84['attributes'][_0x86a2b9(0x1cc)])+')'):'';console[_0x86a2b9(0x27e)](_0x86a2b9(0x18d)+_0x347e84[_0x86a2b9(0x19a)][_0x86a2b9(0x185)]+_0x572bac);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x194);['description']=a29_0x5453af(0x262);async['execute'](_0x4caf9d){const _0x2ef2d9=a29_0x5453af,{options:_0x26ccc9,args:_0x3a1700,tdx:_0x5c87c8}=_0x4caf9d;console[_0x2ef2d9(0x173)](_0x2ef2d9(0x26b)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2ef2d9(0x229));const _0x1c4f11=_0x26ccc9;if(_0x3a1700[_0x2ef2d9(0x1fc)]===0x0)return console[_0x2ef2d9(0x173)](a29_0xfad20c[_0x2ef2d9(0x286)](_0x2ef2d9(0x230))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x31350b=_0x3a1700[0x0];if(!_0x1c4f11[_0x2ef2d9(0x27b)]||!_0x1c4f11['table'])return console[_0x2ef2d9(0x173)](_0x2ef2d9(0x288)),console[_0x2ef2d9(0x173)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x1c4f11[_0x2ef2d9(0x19d)]&&(console[_0x2ef2d9(0x173)](_0x2ef2d9(0x255)+_0x1c4f11[_0x2ef2d9(0x180)]),console[_0x2ef2d9(0x173)](_0x2ef2d9(0x287)+_0x31350b),console[_0x2ef2d9(0x173)](_0x2ef2d9(0x1f5)+_0x1c4f11[_0x2ef2d9(0x27b)]),console[_0x2ef2d9(0x173)](_0x2ef2d9(0x249)+_0x1c4f11[_0x2ef2d9(0x24a)]));const _0x47b641=await loadJSONFromOptions(_0x1c4f11[_0x2ef2d9(0x19a)],_0x1c4f11['attributesFile']),_0x2059b1=await loadJSONFromOptions(_0x1c4f11[_0x2ef2d9(0x19e)],_0x1c4f11[_0x2ef2d9(0x235)]),_0x573681=await loadJSONFromOptions(_0x1c4f11['customerGroup'],_0x1c4f11[_0x2ef2d9(0x22d)]),_0x5917cd={'name':_0x31350b,'description':_0x1c4f11[_0x2ef2d9(0x280)],'scheduleType':_0x1c4f11[_0x2ef2d9(0x261)],'scheduleOption':_0x1c4f11[_0x2ef2d9(0x213)],'timezone':_0x1c4f11[_0x2ef2d9(0x1f0)],'master':{'parentDatabaseName':_0x1c4f11[_0x2ef2d9(0x27b)],'parentTableName':_0x1c4f11[_0x2ef2d9(0x24a)]},'attributes':_0x47b641,'behaviors':_0x2059b1,'customerGroup':_0x573681},_0x117671=await withSpinner(_0x2ef2d9(0x250)+_0x31350b+_0x2ef2d9(0x1d4),()=>_0x5c87c8[_0x2ef2d9(0x1a8)][_0x2ef2d9(0x1b6)](_0x5917cd),{'verbose':_0x26ccc9[_0x2ef2d9(0x19d)]}),_0x511e05=_0x117671['data'];return console[_0x2ef2d9(0x173)](_0x2ef2d9(0x21d)+_0x511e05[_0x2ef2d9(0x185)]+'\x27\x20with\x20ID:\x20'+_0x511e05['id']),await handleSDKOutput([_0x511e05],_0x26ccc9),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x218);['description']=a29_0x5453af(0x1ce);async[a29_0x5453af(0x21f)](_0x509ca0){const _0x4d447d=a29_0x5453af,{options:_0x8acd20,args:_0x27fe55,tdx:_0x343386}=_0x509ca0;console[_0x4d447d(0x173)](_0x4d447d(0x244)+_0x4d447d(0x217)+_0x4d447d(0x229));const _0x5f15cc=_0x8acd20;if(_0x27fe55['length']===0x0)return console['error'](a29_0xfad20c[_0x4d447d(0x286)](_0x4d447d(0x230))),console['error'](_0x4d447d(0x277)),0x1;const _0x1b13e7=_0x27fe55[0x0];_0x5f15cc['verbose']&&(console[_0x4d447d(0x173)]('Site:\x20'+_0x5f15cc[_0x4d447d(0x180)]),console[_0x4d447d(0x173)](_0x4d447d(0x1a2)+_0x1b13e7));const _0x6aac09=await withSpinner(_0x4d447d(0x285)+_0x1b13e7+_0x4d447d(0x1d4),()=>_0x343386[_0x4d447d(0x1a8)][_0x4d447d(0x1be)](_0x1b13e7),{'verbose':_0x5f15cc[_0x4d447d(0x19d)]}),_0x2cc103=_0x6aac09[_0x4d447d(0x1e6)],_0x2f2ab3=await loadJSONFromOptions(_0x5f15cc['addAttributes'],_0x5f15cc['addAttributesFile']),_0x5f4bbb=await loadJSONFromOptions(_0x5f15cc[_0x4d447d(0x24b)],_0x5f15cc[_0x4d447d(0x179)]),_0x42bea9={'name':_0x2cc103[_0x4d447d(0x185)],'description':_0x5f15cc[_0x4d447d(0x280)]!==undefined?_0x5f15cc['description']:_0x2cc103[_0x4d447d(0x280)],'scheduleType':_0x5f15cc[_0x4d447d(0x261)]!==undefined?_0x5f15cc[_0x4d447d(0x261)]:_0x2cc103[_0x4d447d(0x261)],'scheduleOption':_0x5f15cc[_0x4d447d(0x213)]!==undefined?_0x5f15cc[_0x4d447d(0x213)]:_0x2cc103['scheduleOption'],'timezone':_0x5f15cc[_0x4d447d(0x1f0)]!==undefined?_0x5f15cc[_0x4d447d(0x1f0)]:_0x2cc103[_0x4d447d(0x1f0)],'master':_0x2cc103[_0x4d447d(0x1d7)],'attributes':_0x2f2ab3?[..._0x2cc103['attributes']||[],..._0x2f2ab3]:_0x2cc103[_0x4d447d(0x19a)],'behaviors':_0x5f4bbb?[..._0x2cc103[_0x4d447d(0x19e)]||[],..._0x5f4bbb]:_0x2cc103[_0x4d447d(0x19e)],'customerGroup':_0x2cc103[_0x4d447d(0x203)]},_0x3c465d=await withSpinner(_0x4d447d(0x24f)+_0x1b13e7+'\x27...',()=>_0x343386[_0x4d447d(0x1a8)][_0x4d447d(0x17e)](_0x1b13e7,_0x42bea9),{'verbose':_0x5f15cc[_0x4d447d(0x19d)]}),_0x32dd5a=_0x3c465d['data'];return console[_0x4d447d(0x173)](_0x4d447d(0x236)+_0x32dd5a[_0x4d447d(0x185)]+'\x27'),await handleSDKOutput([_0x32dd5a],_0x5f15cc),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x1c3);[a29_0x5453af(0x280)]=a29_0x5453af(0x1ff);async['execute'](_0x5b9348){const _0x24d75e=a29_0x5453af,{options:_0xb0ef4f,args:_0x3a85a2,tdx:_0x59d194}=_0x5b9348,_0x208564=_0xb0ef4f,_0x3095ca=_0x3a85a2[0x0]||_0xb0ef4f['parentSegment'];if(!_0x3095ca)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x24d75e(0x271)),0x1;if(_0x208564[_0x24d75e(0x1c8)]&&_0x208564['output'])return console[_0x24d75e(0x173)](a29_0xfad20c['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x1b9)](_0x24d75e(0x1f1))),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x1b9)](_0x24d75e(0x1b2)+PARENT_SEGMENT_DIR+_0x24d75e(0x17a))),console['error'](a29_0xfad20c['cyan'](_0x24d75e(0x20a))),0x1;const _0x1e5546=_0x208564[_0x24d75e(0x1ee)]||a29_0xb8402e[_0x24d75e(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3095ca)+_0x24d75e(0x1a4));_0x208564[_0x24d75e(0x19d)]&&(console[_0x24d75e(0x173)](_0x24d75e(0x255)+_0x208564[_0x24d75e(0x180)]),console['error'](_0x24d75e(0x1a2)+_0x3095ca),console['error'](_0x24d75e(0x1ea)+_0x1e5546));const _0x3725d1=await withSpinner(_0x24d75e(0x1da)+_0x3095ca+_0x24d75e(0x1d4),()=>_0x59d194['segment']['pullParentYaml'](_0x3095ca),{'verbose':_0x208564[_0x24d75e(0x19d)]}),_0x1759bb=_0x3725d1[_0x24d75e(0x1e6)];if(existsSync(_0x1e5546)){const _0x308f3d=readFileSync(_0x1e5546,_0x24d75e(0x193)),_0x49ac12=generateDiff(_0x308f3d,_0x1759bb);if(!hasChanges(_0x49ac12))console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x226)]('✔')+'\x20No\x20changes\x20-\x20'+a29_0xfad20c[_0x24d75e(0x162)](_0x1e5546)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x24d75e(0x209)+_0x1e5546+'\x27:'),console['error']('─'[_0x24d75e(0x1ed)](0x3c)),console[_0x24d75e(0x173)](formatDiffWithColors(_0x49ac12)),console[_0x24d75e(0x173)]('─'[_0x24d75e(0x1ed)](0x3c));if(!_0x208564[_0x24d75e(0x27d)]){const _0x323099=await confirmKey('Overwrite\x20\x27'+_0x1e5546+'\x27?');if(!_0x323099)return console[_0x24d75e(0x173)](_0x24d75e(0x166)),0x1;}writeFileSync(_0x1e5546,_0x1759bb,'utf-8'),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x226)]('✔')+_0x24d75e(0x269)+a29_0xfad20c[_0x24d75e(0x162)](_0x1e5546));}}else{const _0x4b1131=a29_0xb8402e['dirname'](_0x1e5546);!existsSync(_0x4b1131)&&mkdirSync(_0x4b1131,{'recursive':!![]}),writeFileSync(_0x1e5546,_0x1759bb,'utf-8'),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x226)]('✔')+_0x24d75e(0x269)+a29_0xfad20c['cyan'](_0x1e5546));}return saveSessionContext({'parent_segment':_0x3095ca},_0x208564[_0x24d75e(0x264)]),console['error'](a29_0xfad20c[_0x24d75e(0x226)]('✔')+_0x24d75e(0x220)+a29_0xfad20c['dim'](_0x24d75e(0x1dd))+_0x24d75e(0x205)+a29_0xfad20c[_0x24d75e(0x162)](_0x3095ca)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']='segment:parent:push';['description']=a29_0x5453af(0x1ab);async[a29_0x5453af(0x21f)](_0x3f5c79){const _0x755f10=a29_0x5453af,{options:_0x443ec7,args:_0x4d9148,tdx:_0x6f8c09}=_0x3f5c79,_0x350a19=_0x443ec7,_0x3cea7d=_0x4d9148[0x0]||_0x443ec7['parentSegment'];if(!_0x3cea7d)return showParentSegmentNotSetError(_0x755f10(0x16c)+_0x755f10(0x186)),0x1;const _0x5ec535=resolveYamlFile(_0x3cea7d);if(!existsSync(_0x5ec535))return showFileNotFoundError(_0x5ec535,_0x3cea7d),0x1;_0x350a19[_0x755f10(0x19d)]&&(console[_0x755f10(0x173)](_0x755f10(0x255)+_0x350a19[_0x755f10(0x180)]),console[_0x755f10(0x173)](_0x755f10(0x1c0)+_0x5ec535));let _0x271c39;try{_0x271c39=readFileSync(_0x5ec535,_0x755f10(0x193));}catch(_0x5d46a3){const _0x42f599=_0x5d46a3 instanceof Error?_0x5d46a3[_0x755f10(0x175)]:String(_0x5d46a3);return console[_0x755f10(0x173)](_0x755f10(0x1d1)+_0x42f599),0x1;}const _0x5f42f6=await withSpinner(_0x755f10(0x1fd),()=>_0x6f8c09[_0x755f10(0x1a8)]['pushParentYaml'](_0x271c39),{'verbose':_0x350a19[_0x755f10(0x19d)]}),_0x28faf1=_0x5f42f6[_0x755f10(0x1e6)],{isNew:_0x509622,name:_0x2eb933,hasChanges:_0x234a51,diffFormatted:_0x38ae1d}=_0x28faf1;if(!_0x234a51)return console['error'](_0x755f10(0x216)+_0x2eb933+_0x755f10(0x21e)),0x0;_0x509622?console[_0x755f10(0x173)](_0x755f10(0x1b5)+_0x2eb933+'\x27:'):console[_0x755f10(0x173)](_0x755f10(0x183)+_0x2eb933+'\x27:');console[_0x755f10(0x173)]('─'[_0x755f10(0x1ed)](0x3c)),console['error'](_0x38ae1d),console[_0x755f10(0x173)]('─'[_0x755f10(0x1ed)](0x3c));const _0x42e08a=_0x509622?_0x755f10(0x23d)+_0x2eb933+'\x27?':_0x755f10(0x172)+_0x2eb933+'\x27?';if(!_0x350a19[_0x755f10(0x27d)]){const _0xdab7b6=await confirmKey(_0x42e08a);if(!_0xdab7b6)return console[_0x755f10(0x173)](_0x755f10(0x166)),0x1;}const _0x37db5d=_0x509622?_0x755f10(0x22c):_0x755f10(0x275),_0x50a954=await withSpinner(_0x37db5d+_0x755f10(0x240)+_0x2eb933+_0x755f10(0x1d4),()=>_0x28faf1[_0x755f10(0x233)](),{'verbose':_0x350a19[_0x755f10(0x19d)]}),_0x5a7707=_0x50a954[_0x755f10(0x1e6)],_0x2ad86a=getConsoleNextUrl(_0x350a19[_0x755f10(0x180)],_0x755f10(0x181)+_0x5a7707['id']),_0x13a792=_0x509622?_0x755f10(0x27a):_0x755f10(0x243);return console[_0x755f10(0x173)]('✔\x20'+_0x13a792+_0x755f10(0x240)+_0x5a7707['name']+'\x27'),console[_0x755f10(0x173)]('\x20\x20'+_0x2ad86a),0x0;}}function a29_0x37a3(_0x40c398,_0x39ee3d){_0x40c398=_0x40c398-0x15a;const _0x285806=a29_0x2858();let _0x37a3b9=_0x285806[_0x40c398];return _0x37a3b9;}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x1e0);[a29_0x5453af(0x280)]=a29_0x5453af(0x24e);async[a29_0x5453af(0x21f)](_0x45ed71){const _0x3e90bc=a29_0x5453af,{options:_0x962bc2,args:_0x45792c,tdx:_0x3958fc}=_0x45ed71,_0x359e80=_0x962bc2,_0x4686cf=_0x45792c[0x0]||_0x962bc2[_0x3e90bc(0x200)];if(!_0x4686cf)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x3e90bc(0x252)+_0x3e90bc(0x17c)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x4632d0=resolveYamlFile(_0x4686cf);if(!existsSync(_0x4632d0))return showFileNotFoundError(_0x4632d0,_0x4686cf),0x1;_0x359e80[_0x3e90bc(0x19d)]&&(console['error'](_0x3e90bc(0x255)+_0x359e80[_0x3e90bc(0x180)]),console[_0x3e90bc(0x173)](_0x3e90bc(0x1c0)+_0x4632d0));let _0x2ece75;try{_0x2ece75=readFileSync(_0x4632d0,_0x3e90bc(0x193));}catch(_0x5545fc){const _0x37bdb9=_0x5545fc instanceof Error?_0x5545fc[_0x3e90bc(0x175)]:String(_0x5545fc);return console[_0x3e90bc(0x173)](_0x3e90bc(0x1d1)+_0x37bdb9),0x1;}const _0x48c882=createCommandSpinner(a29_0xfad20c[_0x3e90bc(0x1b9)](_0x3e90bc(0x191)),{'verbose':_0x359e80['verbose']});_0x48c882[_0x3e90bc(0x27f)]();const _0xb55ab3={'onProgress':_0x53bd70=>{const _0x51dd23=_0x3e90bc;_0x48c882[_0x51dd23(0x21b)]=formatProgressMessage(_0x53bd70);}};if(_0x359e80['master'])_0xb55ab3[_0x3e90bc(0x1d7)]=!![];if(_0x359e80['enriched'])_0xb55ab3[_0x3e90bc(0x272)]=!![];_0x359e80['attribute']&&(_0xb55ab3[_0x3e90bc(0x197)]=_0x359e80['attribute']);_0x359e80[_0x3e90bc(0x184)]&&(_0xb55ab3['behavior']=_0x359e80[_0x3e90bc(0x184)]);if(_0x359e80[_0x3e90bc(0x22b)])_0xb55ab3['interval']=_0x359e80['interval'];let _0x5df1d6;try{_0x5df1d6=await _0x3958fc[_0x3e90bc(0x1a8)][_0x3e90bc(0x1b3)](_0x2ece75,_0xb55ab3),_0x48c882[_0x3e90bc(0x161)]();}catch(_0x21ef9f){_0x48c882['stop']();throw _0x21ef9f;}const _0x1cd7e2=_0x359e80[_0x3e90bc(0x22b)]||_0x3e90bc(0x1c6);return this['displayValidateResults'](_0x5df1d6,_0xb55ab3,_0x4632d0,_0x1cd7e2),_0x5df1d6[_0x3e90bc(0x1a7)]?0x0:0x1;}['displayValidateResults'](_0x12670a,_0x893169,_0x1ed089,_0x3b1386){const _0x3398d4=a29_0x5453af;console[_0x3398d4(0x173)]('\x0a'+a29_0xfad20c[_0x3398d4(0x1bf)](_0x3398d4(0x245))+'\x20'+_0x12670a['name']),console[_0x3398d4(0x173)]('═'[_0x3398d4(0x1ed)](0x3c)),this[_0x3398d4(0x25f)](_0x12670a);if(typeof _0x893169[_0x3398d4(0x197)]===_0x3398d4(0x17b)){this['displayAttributesStats'](_0x12670a),this[_0x3398d4(0x1ac)](_0x12670a),this['displayPreviewHints'](_0x1ed089,_0x3b1386,_0x3398d4(0x197),_0x893169[_0x3398d4(0x197)]);return;}if(_0x893169[_0x3398d4(0x197)]===!![]){this[_0x3398d4(0x168)](_0x12670a),this[_0x3398d4(0x1ac)](_0x12670a),this[_0x3398d4(0x246)](_0x1ed089,_0x3b1386,_0x3398d4(0x19a));return;}if(typeof _0x893169['behavior']===_0x3398d4(0x17b)){this[_0x3398d4(0x187)](_0x12670a,_0x3b1386),this[_0x3398d4(0x1ac)](_0x12670a),this['displayPreviewHints'](_0x1ed089,_0x3b1386,_0x3398d4(0x184),_0x893169[_0x3398d4(0x184)]);return;}if(_0x893169[_0x3398d4(0x184)]===!![]){this[_0x3398d4(0x187)](_0x12670a,_0x3b1386),this[_0x3398d4(0x1ac)](_0x12670a),this[_0x3398d4(0x246)](_0x1ed089,_0x3b1386,_0x3398d4(0x19e));return;}this['displayAttributesStats'](_0x12670a),this[_0x3398d4(0x187)](_0x12670a,_0x3b1386),this[_0x3398d4(0x1ac)](_0x12670a),this[_0x3398d4(0x246)](_0x1ed089,_0x3b1386,'all');}[a29_0x5453af(0x246)](_0xbac5a4,_0x86369f,_0x172c84,_0x49e419){const _0x4d82de=a29_0x5453af;console[_0x4d82de(0x173)]('\x0a'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x23c)));const _0x5155b9=_0x86369f!==_0x4d82de(0x1c6)?'\x20--interval\x20'+_0x86369f:'';if(_0x172c84==='attribute'&&_0x49e419)console['error']('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+'\x20--attribute\x20\x22'+_0x49e419+'\x22'+_0x5155b9));else{if(_0x172c84===_0x4d82de(0x184)&&_0x49e419)console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)]('tdx\x20segment\x20parent\x20preview\x20'+_0xbac5a4+_0x4d82de(0x18b)+_0x49e419+'\x22'+_0x5155b9));else(_0x172c84===_0x4d82de(0x19a)||_0x172c84===_0x4d82de(0x19b))&&console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+_0x4d82de(0x270)+_0x5155b9));}(_0x172c84===_0x4d82de(0x19e)||_0x172c84==='all')&&console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+'\x20--behavior\x20\x22<name>\x22'+_0x5155b9)),_0x172c84===_0x4d82de(0x19b)&&console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+_0x4d82de(0x225)+_0x5155b9));}[a29_0x5453af(0x25f)](_0x352caa){const _0xe4decf=a29_0x5453af,{master:_0x34ecbc}=_0x352caa,_0x1fd847=_0x34ecbc[_0xe4decf(0x241)]?a29_0xfad20c[_0xe4decf(0x226)]('✔'):a29_0xfad20c[_0xe4decf(0x286)]('✘');console[_0xe4decf(0x173)]('\x0a'+a29_0xfad20c[_0xe4decf(0x1b9)](_0xe4decf(0x278))),console[_0xe4decf(0x173)](_0x1fd847+'\x20'+a29_0xfad20c[_0xe4decf(0x1bf)](_0x34ecbc['database']+'.'+_0x34ecbc[_0xe4decf(0x24a)])),_0x34ecbc[_0xe4decf(0x241)]?_0x34ecbc[_0xe4decf(0x1d9)]!==undefined&&console['error']('\x20\x20'+a29_0xfad20c[_0xe4decf(0x1b9)](_0xe4decf(0x1d5))+'\x20'+a29_0xfad20c[_0xe4decf(0x162)](formatRows(_0x34ecbc[_0xe4decf(0x1d9)]))):console[_0xe4decf(0x173)]('\x20\x20'+a29_0xfad20c[_0xe4decf(0x286)]('Error:')+'\x20'+_0x34ecbc[_0xe4decf(0x25d)]);}[a29_0x5453af(0x168)](_0x583908){const _0x4daac7=a29_0x5453af;if(_0x583908['attributes'][_0x4daac7(0x1fc)]===0x0)return;console[_0x4daac7(0x173)]('\x0a'+a29_0xfad20c[_0x4daac7(0x1b9)](_0x4daac7(0x165)));for(const _0x599dea of _0x583908[_0x4daac7(0x19a)]){const _0x2e00d6=_0x599dea[_0x4daac7(0x241)]?a29_0xfad20c[_0x4daac7(0x226)]('✔'):a29_0xfad20c[_0x4daac7(0x286)]('✘');let _0x3011b7='';if(_0x599dea[_0x4daac7(0x241)]&&_0x599dea[_0x4daac7(0x21a)]!==undefined&&_0x599dea[_0x4daac7(0x15b)]!==undefined){const _0x1e5162=_0x599dea[_0x4daac7(0x15b)]['toFixed'](0x1),_0x33e25b=_0x599dea[_0x4daac7(0x15b)]>=0x50?a29_0xfad20c['green']:_0x599dea[_0x4daac7(0x15b)]>=0x32?a29_0xfad20c['yellow']:a29_0xfad20c['red'];_0x3011b7='\x20'+a29_0xfad20c[_0x4daac7(0x1b9)](_0x4daac7(0x15d))+'\x20'+_0x33e25b(_0x1e5162+'%')+'\x20('+formatRows(_0x599dea[_0x4daac7(0x21a)])+'\x20rows)';}console[_0x4daac7(0x173)](_0x2e00d6+'\x20'+a29_0xfad20c[_0x4daac7(0x1bf)](_0x599dea[_0x4daac7(0x185)])+_0x3011b7),console[_0x4daac7(0x173)]('\x20\x20'+a29_0xfad20c['dim'](_0x4daac7(0x267))+'\x20'+a29_0xfad20c['bold'](_0x599dea[_0x4daac7(0x27b)]+'.'+_0x599dea[_0x4daac7(0x24a)]));const _0x4feb2f=_0x599dea[_0x4daac7(0x1ae)]===_0x599dea['foreignKey']?a29_0xfad20c[_0x4daac7(0x1b9)](_0x4daac7(0x1bc))+'\x20'+_0x599dea[_0x4daac7(0x1ae)]:a29_0xfad20c['dim']('Join:')+'\x20'+_0x599dea[_0x4daac7(0x1ae)]+_0x4daac7(0x205)+_0x599dea[_0x4daac7(0x266)];console[_0x4daac7(0x173)]('\x20\x20'+_0x4feb2f),console['error']('\x20\x20'+a29_0xfad20c[_0x4daac7(0x1b9)]('Columns:')),this['displayColumns'](_0x599dea[_0x4daac7(0x15c)]),!_0x599dea['schemaValid']&&console[_0x4daac7(0x173)]('\x20\x20'+a29_0xfad20c[_0x4daac7(0x286)](_0x4daac7(0x199))+'\x20'+_0x599dea[_0x4daac7(0x25d)]);}}[a29_0x5453af(0x187)](_0x4fcd68,_0x1c1eb7){const _0x46b45c=a29_0x5453af;if(_0x4fcd68[_0x46b45c(0x19e)]['length']===0x0)return;console[_0x46b45c(0x173)]('\x0a'+a29_0xfad20c['dim']('Behaviors')+'\x20'+a29_0xfad20c['dim']('('+_0x1c1eb7+')'));for(const _0xff7cb1 of _0x4fcd68[_0x46b45c(0x19e)]){const _0x58ecda=_0xff7cb1['schemaValid']?a29_0xfad20c[_0x46b45c(0x226)]('✔'):a29_0xfad20c[_0x46b45c(0x286)]('✘');let _0x267000='';if(_0xff7cb1[_0x46b45c(0x241)]&&_0xff7cb1[_0x46b45c(0x25e)]!==undefined&&_0xff7cb1[_0x46b45c(0x169)]!==undefined){const _0x5698b6=_0xff7cb1['customerPercent']?.[_0x46b45c(0x171)](0x1)||'?',_0x400000=(_0xff7cb1[_0x46b45c(0x211)]??0x0)>=0x32?a29_0xfad20c['green']:(_0xff7cb1['customerPercent']??0x0)>=0x14?a29_0xfad20c['yellow']:a29_0xfad20c['red'];_0x267000='\x20'+a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x1f8))+'\x20'+_0x400000(formatRows(_0xff7cb1['customersWithEvents']))+'\x20('+_0x5698b6+_0x46b45c(0x1e3)+a29_0xfad20c['dim'](_0x46b45c(0x23e))+'\x20'+a29_0xfad20c[_0x46b45c(0x162)](formatRows(_0xff7cb1[_0x46b45c(0x169)]));}console['error'](_0x58ecda+'\x20'+a29_0xfad20c['bold'](_0xff7cb1[_0x46b45c(0x185)])+_0x267000),console[_0x46b45c(0x173)]('\x20\x20'+a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x267))+'\x20'+a29_0xfad20c[_0x46b45c(0x1bf)](_0xff7cb1[_0x46b45c(0x27b)]+'.'+_0xff7cb1[_0x46b45c(0x24a)]));const _0x38e4d1=_0xff7cb1[_0x46b45c(0x1ae)]===_0xff7cb1['foreignKey']?a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x1bc))+'\x20'+_0xff7cb1['joinKey']:a29_0xfad20c[_0x46b45c(0x1b9)]('Join:')+'\x20'+_0xff7cb1['joinKey']+_0x46b45c(0x205)+_0xff7cb1[_0x46b45c(0x266)];console[_0x46b45c(0x173)]('\x20\x20'+_0x38e4d1),console[_0x46b45c(0x173)]('\x20\x20'+a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x1c1))),this[_0x46b45c(0x164)](_0xff7cb1[_0x46b45c(0x15c)]),!_0xff7cb1['schemaValid']&&console[_0x46b45c(0x173)]('\x20\x20'+a29_0xfad20c['red'](_0x46b45c(0x199))+'\x20'+_0xff7cb1[_0x46b45c(0x25d)]);}}[a29_0x5453af(0x164)](_0x3e7a4f){const _0x1d6517=a29_0x5453af;for(const _0x4ff222 of _0x3e7a4f){_0x4ff222[_0x1d6517(0x1c7)]===_0x4ff222[_0x1d6517(0x16f)]||_0x4ff222[_0x1d6517(0x16f)]==='*'?console[_0x1d6517(0x173)]('\x20\x20\x20\x20-\x20'+_0x4ff222[_0x1d6517(0x1c7)]):console[_0x1d6517(0x173)](_0x1d6517(0x1c2)+_0x4ff222['label']+'\x20'+a29_0xfad20c[_0x1d6517(0x1b9)]('('+_0x4ff222['column']+')'));}}['displaySummary'](_0x131c1f){const _0x37d232=a29_0x5453af;console[_0x37d232(0x173)]('─'['repeat'](0x3c));if(_0x131c1f['errors'][_0x37d232(0x1fc)]>0x0){console[_0x37d232(0x173)]('\x0a'+a29_0xfad20c[_0x37d232(0x286)](_0x37d232(0x1ad)));for(const _0x29f2b0 of _0x131c1f[_0x37d232(0x22a)]){console[_0x37d232(0x173)]('\x20\x20'+a29_0xfad20c[_0x37d232(0x286)]('•')+'\x20'+_0x29f2b0);}}_0x131c1f[_0x37d232(0x1a7)]&&console['error']('\x0a'+a29_0xfad20c['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]='segment:parent:preview';[a29_0x5453af(0x280)]=a29_0x5453af(0x228);async[a29_0x5453af(0x21f)](_0x2a9c6f){const _0x36c8d0=a29_0x5453af,{options:_0x57db8f,args:_0x2fe4f4,tdx:_0x269e34}=_0x2a9c6f,_0x2deb39=_0x57db8f,_0x2e01e5=_0x2fe4f4[0x0]||_0x57db8f[_0x36c8d0(0x200)];if(!_0x2e01e5)return showParentSegmentNotSetError(_0x36c8d0(0x1cf)+_0x36c8d0(0x26c)+_0x36c8d0(0x15e)+_0x36c8d0(0x234)+_0x36c8d0(0x1b7)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x36c8d0(0x260)+_0x36c8d0(0x268)),0x1;if(!_0x2deb39['master']&&!_0x2deb39[_0x36c8d0(0x197)]&&!_0x2deb39[_0x36c8d0(0x184)]&&!_0x2deb39[_0x36c8d0(0x272)])return console['error'](a29_0xfad20c['red'](_0x36c8d0(0x1db))),console[_0x36c8d0(0x173)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x36c8d0(0x173)]('Options:'),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x36c8d0(0x173)](_0x36c8d0(0x1bb)),console['error'](_0x36c8d0(0x198)),0x1;const _0x13330c=resolveYamlFile(_0x2e01e5);if(!existsSync(_0x13330c))return showFileNotFoundError(_0x13330c,_0x2e01e5),0x1;_0x2deb39[_0x36c8d0(0x19d)]&&(console[_0x36c8d0(0x173)](_0x36c8d0(0x255)+_0x2deb39[_0x36c8d0(0x180)]),console[_0x36c8d0(0x173)]('YAML\x20file:\x20'+_0x13330c));let _0xb7d27;try{_0xb7d27=readFileSync(_0x13330c,_0x36c8d0(0x193));}catch(_0x212e7f){const _0x5b9d39=_0x212e7f instanceof Error?_0x212e7f[_0x36c8d0(0x175)]:String(_0x212e7f);return console[_0x36c8d0(0x173)]('Error\x20reading\x20file:\x20'+_0x5b9d39),0x1;}let _0x2d735c;try{_0x2d735c=parseYamlString(_0xb7d27);}catch(_0xb5a083){const _0x30cbb1=_0xb5a083 instanceof Error?_0xb5a083['message']:String(_0xb5a083);return console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)]('Error\x20parsing\x20YAML:\x20'+_0x30cbb1)),0x1;}if(_0x2deb39[_0x36c8d0(0x197)]===!![]||_0x2deb39[_0x36c8d0(0x197)]===''){const _0x334035=_0x2d735c['attributes']?.[_0x36c8d0(0x25c)](_0x449274=>_0x449274['name'])||[];if(_0x334035['length']===0x0)console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)](_0x36c8d0(0x231)));else{console[_0x36c8d0(0x173)](a29_0xfad20c['red'](_0x36c8d0(0x222))),console[_0x36c8d0(0x173)](_0x36c8d0(0x1bd));for(const _0x25f598 of _0x334035){console[_0x36c8d0(0x173)]('\x20\x20'+a29_0xfad20c['cyan'](_0x25f598));}console[_0x36c8d0(0x173)](_0x36c8d0(0x238)+_0x2e01e5+_0x36c8d0(0x1d6)+_0x334035[0x0]+'\x22');}return 0x1;}if(_0x2deb39[_0x36c8d0(0x184)]===!![]||_0x2deb39[_0x36c8d0(0x184)]===''){const _0xa2ffbd=_0x2d735c[_0x36c8d0(0x19e)]?.['map'](_0x35f209=>_0x35f209[_0x36c8d0(0x185)])||[];if(_0xa2ffbd[_0x36c8d0(0x1fc)]===0x0)console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)](_0x36c8d0(0x1b1)));else{console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)](_0x36c8d0(0x1d2))),console['error'](_0x36c8d0(0x174));for(const _0x597579 of _0xa2ffbd){console['error']('\x20\x20'+a29_0xfad20c[_0x36c8d0(0x162)](_0x597579));}console[_0x36c8d0(0x173)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2e01e5+'\x20--behavior\x20\x22'+_0xa2ffbd[0x0]+'\x22');}return 0x1;}const _0x3d4f59=createCommandSpinner(a29_0xfad20c['dim']('Fetching\x20sample\x20data...'),{'verbose':_0x2deb39['verbose']});_0x3d4f59[_0x36c8d0(0x27f)]();const _0x54c6b9={'onProgress':_0x2e2f2b=>{_0x3d4f59['text']=formatProgressMessage(_0x2e2f2b);}};if(_0x2deb39[_0x36c8d0(0x1d7)])_0x54c6b9[_0x36c8d0(0x1d7)]=!![];if(_0x2deb39[_0x36c8d0(0x197)]&&typeof _0x2deb39[_0x36c8d0(0x197)]===_0x36c8d0(0x17b))_0x54c6b9[_0x36c8d0(0x197)]=_0x2deb39[_0x36c8d0(0x197)];if(_0x2deb39[_0x36c8d0(0x184)]&&typeof _0x2deb39['behavior']==='string')_0x54c6b9[_0x36c8d0(0x184)]=_0x2deb39[_0x36c8d0(0x184)];if(_0x2deb39[_0x36c8d0(0x272)])_0x54c6b9[_0x36c8d0(0x272)]=!![];if(_0x2deb39['interval'])_0x54c6b9[_0x36c8d0(0x22b)]=_0x2deb39[_0x36c8d0(0x22b)];let _0x312e40;try{_0x312e40=await _0x269e34[_0x36c8d0(0x1a8)][_0x36c8d0(0x1e2)](_0xb7d27,_0x54c6b9),_0x3d4f59['stop']();}catch(_0x1fb77c){_0x3d4f59[_0x36c8d0(0x161)]();throw _0x1fb77c;}return await this[_0x36c8d0(0x1a1)](_0x312e40,{'master':_0x2deb39[_0x36c8d0(0x1d7)],'attribute':typeof _0x2deb39[_0x36c8d0(0x197)]===_0x36c8d0(0x17b)?_0x2deb39[_0x36c8d0(0x197)]:undefined,'behavior':typeof _0x2deb39[_0x36c8d0(0x184)]===_0x36c8d0(0x17b)?_0x2deb39['behavior']:undefined,'enriched':_0x2deb39[_0x36c8d0(0x272)]}),_0x312e40[_0x36c8d0(0x1a7)]?0x0:0x1;}async[a29_0x5453af(0x1a1)](_0x199779,_0x56fc67){const _0x4c1416=a29_0x5453af;console['error']('\x0a'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x4c1416(0x25b))+'\x20'+_0x199779[_0x4c1416(0x185)]),console[_0x4c1416(0x173)]('═'['repeat'](0x3c));if(_0x56fc67[_0x4c1416(0x1d7)]&&_0x199779[_0x4c1416(0x201)]){const _0x40d60a=a29_0xfad20c[_0x4c1416(0x1b9)](_0x4c1416(0x1b8))+'\x20'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x199779[_0x4c1416(0x1d7)]['database']+'.'+_0x199779[_0x4c1416(0x1d7)][_0x4c1416(0x24a)]);await this[_0x4c1416(0x23b)](_0x40d60a,_0x199779['sampleData']);}else{if(_0x56fc67[_0x4c1416(0x197)]&&_0x199779[_0x4c1416(0x201)]){const _0x24ca43=a29_0xfad20c['dim'](_0x4c1416(0x1cb))+'\x20'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x56fc67[_0x4c1416(0x197)]);await this[_0x4c1416(0x23b)](_0x24ca43,_0x199779[_0x4c1416(0x201)]);}else{if(_0x56fc67[_0x4c1416(0x184)]&&_0x199779[_0x4c1416(0x201)]){const _0x68cf02=a29_0xfad20c[_0x4c1416(0x1b9)](_0x4c1416(0x1ba))+'\x20'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x56fc67['behavior']);await this[_0x4c1416(0x23b)](_0x68cf02,_0x199779[_0x4c1416(0x201)]);}else{if(_0x56fc67[_0x4c1416(0x272)]&&_0x199779[_0x4c1416(0x201)]){const _0xbe684d=a29_0xfad20c['dim'](_0x4c1416(0x167))+'\x20'+a29_0xfad20c['bold']('Master\x20+\x20Attributes');await this[_0x4c1416(0x23b)](_0xbe684d,_0x199779['sampleData']);}else!_0x199779['sampleData']&&console[_0x4c1416(0x173)](_0x4c1416(0x1e5));}}}if(_0x199779[_0x4c1416(0x22a)][_0x4c1416(0x1fc)]>0x0){console[_0x4c1416(0x173)]('─'['repeat'](0x3c)),console[_0x4c1416(0x173)]('\x0a'+a29_0xfad20c[_0x4c1416(0x286)](_0x4c1416(0x1ad)));for(const _0x441dd2 of _0x199779[_0x4c1416(0x22a)]){console[_0x4c1416(0x173)]('\x20\x20'+a29_0xfad20c[_0x4c1416(0x286)]('•')+'\x20'+_0x441dd2);}}}async[a29_0x5453af(0x23b)](_0x1c124a,_0x4eaf81){const _0x12b68b=a29_0x5453af;if(_0x4eaf81[_0x12b68b(0x1fc)]===0x0){console[_0x12b68b(0x173)]('\x0a'+_0x1c124a),console[_0x12b68b(0x173)](_0x12b68b(0x284));return;}console['error']('\x0a'+_0x1c124a);const _0x25a659=Object[_0x12b68b(0x237)](_0x4eaf81[0x0])[_0x12b68b(0x25c)](_0x4278ec=>({'name':_0x4278ec,'type':typeof _0x4eaf81[0x0][_0x4278ec]===_0x12b68b(0x227)?_0x12b68b(0x251):_0x12b68b(0x232)})),_0x27f486={'queryId':_0x12b68b(0x1fa),'columns':_0x25a659,'data':_0x4eaf81,'stats':{'state':_0x12b68b(0x283),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4eaf81[_0x12b68b(0x1fc)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x595769=formatAsTable(_0x27f486,_0x4eaf81[_0x12b68b(0x1fc)],!![]);await writeOutput(_0x595769,undefined,_0x12b68b(0x24a));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x18e);[a29_0x5453af(0x280)]=a29_0x5453af(0x1f6);async['execute'](_0x5c7057){const _0x4bf6ef=a29_0x5453af,{options:_0x40a94e,args:_0x4983cc,tdx:_0x1b473e}=_0x5c7057,_0x59d70b=_0x40a94e,_0x28130c=_0x4983cc[0x0]||_0x40a94e[_0x4bf6ef(0x200)];if(!_0x28130c)return showParentSegmentNotSetError(_0x4bf6ef(0x16b)+_0x4bf6ef(0x26a)),0x1;const _0x2b4e5e=resolveYamlFile(_0x28130c);if(existsSync(_0x2b4e5e)){_0x59d70b[_0x4bf6ef(0x19d)]&&console[_0x4bf6ef(0x173)]('Found\x20YAML\x20file:\x20'+_0x2b4e5e);let _0x32384;try{_0x32384=readFileSync(_0x2b4e5e,_0x4bf6ef(0x193));}catch(_0x5af553){const _0xf0b0e9=_0x5af553 instanceof Error?_0x5af553['message']:String(_0x5af553);return console['error'](_0x4bf6ef(0x1d1)+_0xf0b0e9),0x1;}const _0x423c4d=await withSpinner(_0x4bf6ef(0x1fd),()=>_0x1b473e[_0x4bf6ef(0x1a8)][_0x4bf6ef(0x1aa)](_0x32384),{'verbose':_0x59d70b[_0x4bf6ef(0x19d)]}),_0x433ddc=_0x423c4d[_0x4bf6ef(0x1e6)],{isNew:_0x5a317e,name:_0x280ac0,hasChanges:_0x2005fc,diffFormatted:_0x2da862}=_0x433ddc;if(_0x2005fc){_0x5a317e?console[_0x4bf6ef(0x173)](_0x4bf6ef(0x1b5)+_0x280ac0+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x280ac0+'\x27:');console[_0x4bf6ef(0x173)]('─'[_0x4bf6ef(0x1ed)](0x3c)),console[_0x4bf6ef(0x173)](_0x2da862),console['error']('─'[_0x4bf6ef(0x1ed)](0x3c));const _0x19e4f8=_0x5a317e?'Create\x20parent\x20segment\x20\x27'+_0x280ac0+_0x4bf6ef(0x1fe):_0x4bf6ef(0x172)+_0x280ac0+_0x4bf6ef(0x1fe);if(!_0x59d70b[_0x4bf6ef(0x27d)]){const _0xc0c64a=await confirmKey(_0x19e4f8);if(!_0xc0c64a)return console[_0x4bf6ef(0x173)](_0x4bf6ef(0x166)),0x1;}const _0xa35174=_0x5a317e?_0x4bf6ef(0x22c):'Updating';await withSpinner(_0xa35174+'\x20parent\x20segment\x20\x27'+_0x280ac0+_0x4bf6ef(0x1d4),()=>_0x433ddc[_0x4bf6ef(0x233)](),{'verbose':_0x59d70b['verbose']});const _0x22a030=_0x5a317e?_0x4bf6ef(0x27a):_0x4bf6ef(0x243);console[_0x4bf6ef(0x173)]('✔\x20'+_0x22a030+'\x20parent\x20segment\x20\x27'+_0x280ac0+'\x27');}else console['error'](_0x4bf6ef(0x216)+_0x280ac0+_0x4bf6ef(0x196));}const _0x54ca59=await withSpinner(_0x4bf6ef(0x163)+_0x28130c+_0x4bf6ef(0x1d4),()=>_0x1b473e[_0x4bf6ef(0x1a8)][_0x4bf6ef(0x208)](_0x28130c),{'verbose':_0x59d70b[_0x4bf6ef(0x19d)]}),_0x6b93db=_0x54ca59[_0x4bf6ef(0x1e6)],_0x465223=getConsoleUrl(_0x59d70b[_0x4bf6ef(0x180)],_0x4bf6ef(0x202)+_0x6b93db[_0x4bf6ef(0x253)]+_0x4bf6ef(0x20f)+_0x6b93db[_0x4bf6ef(0x258)]+'/attempt/'+_0x6b93db[_0x4bf6ef(0x276)]);return console[_0x4bf6ef(0x173)](_0x4bf6ef(0x279)),console[_0x4bf6ef(0x173)]('\x20\x20'+a29_0xfad20c[_0x4bf6ef(0x1b9)](_0x4bf6ef(0x26d))+'\x20'+_0x6b93db[_0x4bf6ef(0x15f)]),console[_0x4bf6ef(0x173)]('\x20\x20'+a29_0xfad20c[_0x4bf6ef(0x1b9)](_0x4bf6ef(0x1c4))+'\x20'+_0x6b93db[_0x4bf6ef(0x1ca)]),console[_0x4bf6ef(0x173)]('\x20\x20'+a29_0xfad20c[_0x4bf6ef(0x1b9)](_0x4bf6ef(0x206))+'\x20'+_0x6b93db[_0x4bf6ef(0x258)]),console['error']('\x20\x20'+a29_0xfad20c['dim'](_0x4bf6ef(0x20c))+'\x20'+_0x6b93db['workflowAttemptId']),console[_0x4bf6ef(0x173)]('\x20\x20'+_0x465223),console['error']('\x0a'+a29_0xfad20c[_0x4bf6ef(0x1b9)]('To\x20cancel:')+_0x4bf6ef(0x1e1)+_0x6b93db[_0x4bf6ef(0x276)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a29_0x5453af(0x280)]=a29_0x5453af(0x223);async[a29_0x5453af(0x21f)](_0x29208e){const _0x424532=a29_0x5453af,{options:_0xd3c295,args:_0x539303,tdx:_0x1305db}=_0x29208e,_0x3a9d0a=_0x539303[0x0]||_0xd3c295[_0x424532(0x200)];if(!_0x3a9d0a)return showParentSegmentNotSetError(_0x424532(0x215)+_0x424532(0x16d)),0x1;_0xd3c295[_0x424532(0x19d)]&&(console[_0x424532(0x173)](_0x424532(0x255)+_0xd3c295['site']),console[_0x424532(0x173)](_0x424532(0x1a2)+_0x3a9d0a));const _0x4a3e4a=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3a9d0a+_0x424532(0x1d4),()=>_0x1305db[_0x424532(0x1a8)][_0x424532(0x265)](_0x3a9d0a),{'verbose':_0xd3c295['verbose']}),_0xd2df8a=_0x4a3e4a[_0x424532(0x1e6)];console[_0x424532(0x173)](_0x424532(0x1f7)+_0xd2df8a['length']+_0x424532(0x257)+(_0xd2df8a['length']!==0x1?'s':''));if(_0xd3c295[_0x424532(0x1e7)]||_0xd3c295[_0x424532(0x24d)])return await handleSDKOutput(_0xd2df8a,_0xd3c295),0x0;return displayFieldsHumanReadable(_0xd2df8a,_0x3a9d0a),0x0;}}function a29_0x2858(){const _0x2fba94=['displayAttributesStats','totalEvents','format','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','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\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','1001721hTjnZl','column','xdg-open','toFixed','Apply\x20changes\x20to\x20\x27','error','Available\x20behaviors:','message','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x0a⚠️\x20\x20Both\x20','replace','addBehaviorsFile','/{name}.yml\x0a','string','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','unref','updateParent','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','site','/app/dw/parentSegments/','resolveParentId','\x0aChanges\x20to\x20apply\x20to\x20\x27','behavior','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayBehaviorsStats','2248176YYQCiF','isDirectory','platform','\x20--behavior\x20\x22','Show\x20parent\x20segment\x20schema\x20(column\x20types)','👥\x20','segment:parent:run','Listing\x20parent\x20segments\x20matching\x20\x27','sort','Validating\x20configuration...','trim','utf-8','segment:parent:create','yellow','\x27\x20is\x20up\x20to\x20date','attribute','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Error:','attributes','all','query','verbose','behaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x5c$&','displayPreviewResults','Parent\x20segment:\x20','ignore','.yml','segment:parent:show','segment:parent:list','allValid','segment','limit','pushParentYaml','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','displaySummary','Errors:','joinKey','46uJVDcH','endsWith','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','using\x20the\x20default\x20path:\x20','validateParentYaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x0aNew\x20parent\x20segment\x20\x27','createParent','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Master:','dim','Behavior:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Join\x20on:','Available\x20attributes:','getParentFull','bold','YAML\x20file:\x20','Columns:','\x20\x20\x20\x20-\x20','segment:parent:pull','Status:','\x20parent\x20segment','-1d','label','use','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','status','Attribute:','population','join','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','filter','Error\x20reading\x20file:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','`\x20to\x20download\x20the\x20configuration\x20first','\x27...','Rows:','\x20--attribute\x20\x22','master','setJobId','rowCount','Fetching\x20parent\x20segment\x20\x27','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','parent_segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:parent:validate','\x20tdx\x20wf\x20attempt\x20','previewParentYaml','%)\x20','Executing\x20parent\x20segment\x20query...','\x0aNo\x20sample\x20data\x20available','data','json','Show\x20parent\x20segment\x20details','/\x20directories\x20exist.','Output\x20file:\x20','192xGtvXB','test','repeat','output','\x0a⚠️\x20\x20Migrating:\x20','timezone','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:desc','✔\x20Renamed\x20directory\x20to\x20','Database:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','✔\x20Found\x20','Customers:','parent_segments','preview','listParents','length','Analyzing\x20changes...','\x27\x20and\x20run\x20workflow?','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','parentSegment','sampleData','/app/workflows/','customerGroup','jobId','\x20=\x20','Session:','4428290oLwyYM','runParent','\x0aChanges\x20to\x20\x27','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','getParentSQL','Attempt:','SELECT\x20*\x20FROM\x20(\x0a','59TWNuHL','/sessions/','\x20[Job\x20ID:\x20','customerPercent','in\x20','scheduleOption','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment:parent:update','44xJzmKN','matchedCount','text','run','✔\x20Created\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','execute','\x20Context\x20set:\x20','\x20rows\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','List\x20available\x20fields\x20for\x20segmentation','List\x20parent\x20segments','\x20--enriched','green','number','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','errors','interval','Creating','customerGroupFile','44215eMYMTT','2882277xCXNar','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','varchar','apply','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','behaviorsFile','✔\x20Updated\x20parent\x20segment\x20\x27','keys','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','877476bzCUKL','displaySampleData','To\x20view\x20sample\x20data:','Create\x20parent\x20segment\x20\x27','Events:','Listing\x20parent\x20segments...','\x20parent\x20segment\x20\x27','schemaValid','toLocaleString','Updated','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Validate:','displayPreviewHints','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','✔\x20Query\x20completed:\x20Processed\x20','Table:\x20','table','addBehaviors','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','jsonl','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Updating\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','double','Options:\x0a','workflowId','open','Site:\x20','/\x20→\x20','\x20field','workflowSessionId','✘\x20Failed\x20to\x20rename\x20directory:\x20','8coDObC','Preview:','map','schemaError','customersWithEvents','displayMasterInfo','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','scheduleType','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','tdx\x20segment\x20parent\x20preview\x20','session','listFields','foreignKey','Source:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\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','Audience\x20ID:','Resolving\x20parent\x20segment\x20\x27','localeCompare','\x20--attribute\x20\x22<name>\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','enriched','win32','Fetching\x20SQL\x20for\x20\x27','Updating','workflowAttemptId','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Master\x20Table','\x0a✔\x20Workflow\x20started','Created','database','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','yes','log','start','description','elapsedTimeMillis','Pattern:\x20','FINISHED','\x20\x20No\x20sample\x20data\x20available','Fetching\x20current\x20configuration\x20for\x20\x27','red','Name:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','web','coveragePercent','columns','Coverage:','Options\x20(one\x20required):\x0a','audienceId','No\x20parent\x20segments\x20found','stop','cyan','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','displayColumns','Attributes','Aborted.','Enriched:'];a29_0x2858=function(){return _0x2fba94;};return a29_0x2858();}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x5453af(0x185)]='segment:parent:view';['description']=a29_0x5453af(0x1e8);async[a29_0x5453af(0x21f)](_0x94cca7){const _0x5864af=a29_0x5453af,{options:_0x5cc6e1,args:_0x3dc832,tdx:_0x26d2a3}=_0x94cca7,_0x32051c=_0x5cc6e1,_0x3d7a0d=_0x3dc832[0x0]||_0x5cc6e1[_0x5864af(0x200)];if(!_0x3d7a0d)return showParentSegmentNotSetError(_0x5864af(0x24c)+_0x5864af(0x19f)+_0x5864af(0x252)+_0x5864af(0x1f2)),0x1;_0x5cc6e1[_0x5864af(0x19d)]&&(console[_0x5864af(0x173)]('Site:\x20'+_0x5cc6e1[_0x5864af(0x180)]),console[_0x5864af(0x173)](_0x5864af(0x1a2)+_0x3d7a0d));const _0x48ef9c=await withSpinner(_0x5864af(0x1da)+_0x3d7a0d+'\x27...',()=>_0x26d2a3[_0x5864af(0x1a8)][_0x5864af(0x1be)](_0x3d7a0d),{'verbose':_0x5cc6e1[_0x5864af(0x19d)]}),_0x30eddc=_0x48ef9c[_0x5864af(0x1e6)];if(_0x32051c[_0x5864af(0x15a)]){const _0x409053=getConsoleNextUrl(_0x32051c[_0x5864af(0x180)],'/app/dw/parentSegments/'+_0x30eddc['id']);return console[_0x5864af(0x173)](a29_0xfad20c['green']('✔')+'\x20Opening\x20'+a29_0xfad20c[_0x5864af(0x162)](_0x409053)),openBrowser(_0x409053),0x0;}return await handleSingleObjectOutput(_0x30eddc,_0x5cc6e1),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a29_0x5453af(0x1f3);[a29_0x5453af(0x280)]=a29_0x5453af(0x18c);async['execute'](_0x3dd26e){const _0x2e3a13=a29_0x5453af,{options:_0x343426,args:_0x390774,tdx:_0x5bb656}=_0x3dd26e,_0x2a80dc=_0x390774[0x0]||_0x343426['parentSegment'];if(!_0x2a80dc)return showParentSegmentNotSetError(_0x2e3a13(0x214)+_0x2e3a13(0x1de)),0x1;_0x343426[_0x2e3a13(0x19d)]&&(console[_0x2e3a13(0x173)]('Site:\x20'+_0x343426['site']),console[_0x2e3a13(0x173)]('Parent\x20segment:\x20'+_0x2a80dc));const _0x3d889e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2a80dc+_0x2e3a13(0x1d4),()=>_0x5bb656['segment'][_0x2e3a13(0x182)](_0x2a80dc),{'verbose':_0x343426['verbose']}),_0x101035=_0x3d889e[_0x2e3a13(0x1e6)],_0x5f48ac=await withSpinner(_0x2e3a13(0x274)+_0x2a80dc+_0x2e3a13(0x1d4),()=>_0x5bb656[_0x2e3a13(0x1a8)][_0x2e3a13(0x20b)](_0x101035),{'verbose':_0x343426[_0x2e3a13(0x19d)]}),_0x29ce5a=await executeSchemaQuery(_0x5f48ac[_0x2e3a13(0x1e6)],_0x5bb656,_0x343426);return await handleQueryOutput(_0x29ce5a,_0x343426),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x5453af(0x185)]='segment:parent:sql';[a29_0x5453af(0x280)]=a29_0x5453af(0x1dc);async['execute'](_0x135ebf){const _0x30f8a5=a29_0x5453af,{options:_0x2d106e,args:_0x5379ea,tdx:_0xd20f8f}=_0x135ebf,_0x49df96=_0x5379ea[0x0]||_0x2d106e[_0x30f8a5(0x200)];if(!_0x49df96)return showParentSegmentNotSetError(_0x30f8a5(0x27c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x2d106e[_0x30f8a5(0x19d)]&&(console[_0x30f8a5(0x173)](_0x30f8a5(0x255)+_0x2d106e['site']),console['error'](_0x30f8a5(0x1a2)+_0x49df96));const _0x9791c0=await withSpinner(_0x30f8a5(0x26e)+_0x49df96+_0x30f8a5(0x1d4),()=>_0xd20f8f['segment']['resolveParentId'](_0x49df96),{'verbose':_0x2d106e[_0x30f8a5(0x19d)]}),_0x30def8=_0x9791c0[_0x30f8a5(0x1e6)],_0x115aa7=await withSpinner(_0x30f8a5(0x274)+_0x49df96+_0x30f8a5(0x1d4),()=>_0xd20f8f[_0x30f8a5(0x1a8)][_0x30f8a5(0x20b)](_0x30def8),{'verbose':_0x2d106e[_0x30f8a5(0x19d)]}),_0x532c82=_0x115aa7['data'];return _0x2d106e[_0x30f8a5(0x16a)]===_0x30f8a5(0x1e7)||_0x2d106e['format']===_0x30f8a5(0x24d)?await handleSDKOutput([{'sql':_0x532c82}],_0x2d106e):console[_0x30f8a5(0x27e)](_0x532c82),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a29_0x5453af(0x1a5);['description']=a29_0x5453af(0x1df);async['execute'](_0x44652b){const _0xe1aee6=a29_0x5453af,{options:_0x2612a2,args:_0x3efba5,tdx:_0x2cd124}=_0x44652b,_0x5d2c06=_0x3efba5[0x0]||_0x2612a2[_0xe1aee6(0x200)];if(!_0x5d2c06)return showParentSegmentNotSetError(_0xe1aee6(0x247)+_0xe1aee6(0x1b4)),0x1;_0x2612a2['verbose']&&(console[_0xe1aee6(0x173)](_0xe1aee6(0x255)+_0x2612a2[_0xe1aee6(0x180)]),console['error']('Parent\x20segment:\x20'+_0x5d2c06));const _0x20e838=await withSpinner(_0xe1aee6(0x26e)+_0x5d2c06+_0xe1aee6(0x1d4),()=>_0x2cd124['segment'][_0xe1aee6(0x182)](_0x5d2c06),{'verbose':_0x2612a2[_0xe1aee6(0x19d)]}),_0x4dacaf=_0x20e838[_0xe1aee6(0x1e6)],_0x105c8a=await withSpinner(_0xe1aee6(0x274)+_0x5d2c06+'\x27...',()=>_0x2cd124[_0xe1aee6(0x1a8)][_0xe1aee6(0x20b)](_0x4dacaf),{'verbose':_0x2612a2[_0xe1aee6(0x19d)]});let _0x51e514=_0x105c8a[_0xe1aee6(0x1e6)];const _0x3ec0e3=resolveLimit(_0x2612a2[_0xe1aee6(0x1a9)],DEFAULT_DISPLAY_LIMIT),_0x36bd08=/\bLIMIT\s+\d+/i[_0xe1aee6(0x1ec)](_0x51e514);!_0x36bd08&&(_0x51e514=_0x51e514[_0xe1aee6(0x192)]()[_0xe1aee6(0x178)](/;+$/,''),_0x51e514=_0xe1aee6(0x20d)+_0x51e514+_0xe1aee6(0x239)+_0x3ec0e3);_0x2612a2[_0xe1aee6(0x19d)]&&console[_0xe1aee6(0x173)]('SQL\x20query:\x0a'+_0x51e514);const _0x3ce854=await withQuerySpinner(_0xe1aee6(0x1e4),async _0x858275=>{const _0x257101=_0xe1aee6,_0x565567=await _0x2cd124[_0x257101(0x19c)][_0x257101(0x21f)](_0x51e514,{'catalog':'td','schema':'information_schema','onJobId':_0x46cfce=>{const _0x2471e5=_0x257101;_0x858275[_0x2471e5(0x1d8)](_0x46cfce);}});return _0x565567;},{'verbose':_0x2612a2['verbose']}),_0x588cbc=_0x3ce854[_0xe1aee6(0x1e6)],_0x35e9f2=_0x588cbc[_0xe1aee6(0x204)]?_0xe1aee6(0x210)+_0x588cbc['jobId']+']':'';return console[_0xe1aee6(0x173)](_0xe1aee6(0x248)+_0x588cbc['stats']['processedRows'][_0xe1aee6(0x242)]()+_0xe1aee6(0x221)+(_0xe1aee6(0x212)+formatElapsed(_0x588cbc['stats'][_0xe1aee6(0x281)])+_0x35e9f2)),await handleQueryOutput(_0x588cbc,_0x2612a2),0x0;}}
@@ -1 +1 @@
1
- const a30_0x3e5728=a30_0x5665;function a30_0x4f05(){const _0x41015b=['log','4725798IYDozG','message','47424OvtYYy','2pyEfxx','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','5540730FbVmJO','553BhtSGB','6390VKbFaP','24Hxekef','Error:\x20','length','17990863MUXSfm','config','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','map','error','name','53112HhBXCh','21040Txrqoq','246242uFECsL','\x20\x20Global:\x20~/.config/tdx/tdx.json','16hVNKvZ'];a30_0x4f05=function(){return _0x41015b;};return a30_0x4f05();}(function(_0x20360f,_0x3c5963){const _0x43051f=a30_0x5665,_0x2466f9=_0x20360f();while(!![]){try{const _0x59a883=parseInt(_0x43051f(0x82))/0x1*(parseInt(_0x43051f(0x94))/0x2)+-parseInt(_0x43051f(0x81))/0x3*(-parseInt(_0x43051f(0x7d))/0x4)+parseInt(_0x43051f(0x86))/0x5+parseInt(_0x43051f(0x7f))/0x6+parseInt(_0x43051f(0x87))/0x7*(parseInt(_0x43051f(0x92))/0x8)+parseInt(_0x43051f(0x88))/0x9*(parseInt(_0x43051f(0x93))/0xa)+-parseInt(_0x43051f(0x8c))/0xb*(parseInt(_0x43051f(0x89))/0xc);if(_0x59a883===_0x3c5963)break;else _0x2466f9['push'](_0x2466f9['shift']());}catch(_0x52be9b){_0x2466f9['push'](_0x2466f9['shift']());}}}(a30_0x4f05,0xe88bc));function a30_0x5665(_0x5d0918,_0x4cf80e){_0x5d0918=_0x5d0918-0x7d;const _0x4f059a=a30_0x4f05();let _0x566515=_0x4f059a[_0x5d0918];return _0x566515;}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{[a30_0x3e5728(0x91)]='profiles';[a30_0x3e5728(0x83)]='List\x20all\x20available\x20profiles';async[a30_0x3e5728(0x85)](_0x3da2fd){const _0x55aed6=a30_0x3e5728,{options:_0x597a20}=_0x3da2fd;try{const _0x12b0fa=listProfiles(),_0x47a01f=getActiveProfile();if(_0x12b0fa[_0x55aed6(0x8b)]===0x0)return console[_0x55aed6(0x7e)](_0x55aed6(0x8e)),console['log'](_0x55aed6(0x84)),console[_0x55aed6(0x7e)](_0x55aed6(0x95)),0x0;const _0x4b94c9=_0x12b0fa[_0x55aed6(0x8f)](_0xbf78c2=>{const _0x5a8266=_0x55aed6,_0x25ab0d=_0xbf78c2[_0x5a8266(0x91)]===_0x47a01f,_0x164fab=getProfileParams(_0xbf78c2[_0x5a8266(0x8d)]);return{'name':_0xbf78c2[_0x5a8266(0x91)],'active':_0x25ab0d,'scope':_0xbf78c2['scope'],'description':_0xbf78c2[_0x5a8266(0x8d)][_0x5a8266(0x83)]||'','params':_0x164fab};});return await handleSDKOutput(_0x4b94c9,_0x597a20),0x0;}catch(_0x457dea){return _0x457dea instanceof Error&&console[_0x55aed6(0x90)](_0x55aed6(0x8a)+_0x457dea[_0x55aed6(0x80)]),0x1;}}}
1
+ const a30_0x39e785=a30_0x4dde;(function(_0x550f8f,_0x518052){const _0x40e7b7=a30_0x4dde,_0x5aed69=_0x550f8f();while(!![]){try{const _0x4fc7cb=-parseInt(_0x40e7b7(0xdb))/0x1+parseInt(_0x40e7b7(0xd1))/0x2+-parseInt(_0x40e7b7(0xd4))/0x3+parseInt(_0x40e7b7(0xd6))/0x4+parseInt(_0x40e7b7(0xd7))/0x5*(-parseInt(_0x40e7b7(0xda))/0x6)+-parseInt(_0x40e7b7(0xd8))/0x7+parseInt(_0x40e7b7(0xd3))/0x8*(parseInt(_0x40e7b7(0xcf))/0x9);if(_0x4fc7cb===_0x518052)break;else _0x5aed69['push'](_0x5aed69['shift']());}catch(_0x46fb76){_0x5aed69['push'](_0x5aed69['shift']());}}}(a30_0x7ba1,0x21ab9));function a30_0x7ba1(){const _0x22219d=['275755KKgdDE','name','message','error','profiles','length','execute','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','4421646lgerFa','config','205666BvTTDB','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','8PiWROi','709287QDvFiR','description','867236vAVNWI','135CGEzoX','673974RRTDJl','log','14346VAvRUQ'];a30_0x7ba1=function(){return _0x22219d;};return a30_0x7ba1();}function a30_0x4dde(_0x5021e7,_0x477f88){_0x5021e7=_0x5021e7-0xcd;const _0x7ba1f0=a30_0x7ba1();let _0x4dde22=_0x7ba1f0[_0x5021e7];return _0x4dde22;}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{[a30_0x39e785(0xdc)]=a30_0x39e785(0xdf);[a30_0x39e785(0xd5)]=a30_0x39e785(0xce);async[a30_0x39e785(0xe1)](_0x714cf){const _0x55c489=a30_0x39e785,{options:_0x54753d}=_0x714cf;try{const _0x5702f3=listProfiles(),_0x31d90f=getActiveProfile();if(_0x5702f3[_0x55c489(0xe0)]===0x0)return console[_0x55c489(0xd9)](_0x55c489(0xd2)),console[_0x55c489(0xd9)](_0x55c489(0xcd)),console[_0x55c489(0xd9)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x533204=_0x5702f3['map'](_0x3fb3e2=>{const _0x41919b=_0x55c489,_0x22084b=_0x3fb3e2[_0x41919b(0xdc)]===_0x31d90f,_0x3e218a=getProfileParams(_0x3fb3e2[_0x41919b(0xd0)]);return{'name':_0x3fb3e2[_0x41919b(0xdc)],'active':_0x22084b,'scope':_0x3fb3e2['scope'],'description':_0x3fb3e2[_0x41919b(0xd0)]['description']||'','params':_0x3e218a};});return await handleSDKOutput(_0x533204,_0x54753d),0x0;}catch(_0x7ac078){return _0x7ac078 instanceof Error&&console[_0x55c489(0xde)]('Error:\x20'+_0x7ac078[_0x55c489(0xdd)]),0x1;}}}
@@ -1 +1 @@
1
- function a31_0x5ae9(_0x3c3b83,_0x4cac86){_0x3c3b83=_0x3c3b83-0x178;const _0x52a017=a31_0x52a0();let _0x5ae9fb=_0x52a017[_0x3c3b83];return _0x5ae9fb;}const a31_0x50d114=a31_0x5ae9;function a31_0x52a0(){const _0x4dfdd0=['execute','Catalog:\x20','10juXWgu','information_schema','setJobId','52479JOaSns','push','totalSplits','args','\x20rows\x20','No\x20SQL\x20provided','Executing\x20query\x20[','verbose','...','Site:\x20','state','660735yNouuP','in\x20','error','Statement\x20','query','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20-\x20','originalMessage','6qUhrpB','elapsedTimeMillis','stats','14hVyjdo','Query\x20completed:\x20Processed\x20','Executing\x20query...','27884pOgavD','\x0aAll\x20results\x20saved\x20to\x20','file','output','catalog','processedRows','setExtra','\x20splits','setPhase','description','487984LBgtcC','jobId','6113943BKMMci','options','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','site','\x20[Job\x20ID:\x20','1375465UcQVbp','name','length','999400VTPCGE','join','message','data'];a31_0x52a0=function(){return _0x4dfdd0;};return a31_0x52a0();}(function(_0x354bf7,_0x4fd801){const _0x123940=a31_0x5ae9,_0x234113=_0x354bf7();while(!![]){try{const _0x3c611d=parseInt(_0x123940(0x18b))/0x1*(parseInt(_0x123940(0x188))/0x2)+parseInt(_0x123940(0x1a8))/0x3+parseInt(_0x123940(0x195))/0x4+parseInt(_0x123940(0x17d))/0x5+-parseInt(_0x123940(0x185))/0x6*(-parseInt(_0x123940(0x19c))/0x7)+parseInt(_0x123940(0x19f))/0x8+-parseInt(_0x123940(0x197))/0x9*(parseInt(_0x123940(0x1a5))/0xa);if(_0x3c611d===_0x4fd801)break;else _0x234113['push'](_0x234113['shift']());}catch(_0x254163){_0x234113['push'](_0x234113['shift']());}}}(a31_0x52a0,0x1a975));import{BaseCommand}from'./command.js';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{[a31_0x50d114(0x19d)]=a31_0x50d114(0x181);[a31_0x50d114(0x194)]='Run\x20Trino\x20queries\x20(streaming)';async[a31_0x50d114(0x1a3)](_0x4b73a9){const _0x11456b=a31_0x50d114,{options:_0x2b5075,args:_0x54e6c3,tdx:_0x227ffd}=_0x4b73a9,_0x49c7dd=_0x54e6c3[0x0],_0x379030=_0x2b5075[_0x11456b(0x18d)];let _0x1beb54;try{if(_0x379030)_0x1beb54=readSqlStatementsFromFile(_0x379030);else{if(_0x49c7dd==='-')_0x1beb54=await readSqlStatementsFromStdin();else{if(_0x49c7dd&&isSqlFilePath(_0x49c7dd))_0x1beb54=readSqlStatementsFromFile(_0x49c7dd);else{if(_0x49c7dd)_0x1beb54=splitSqlStatements(_0x49c7dd);else throw new Error(_0x11456b(0x1ad));}}}}catch(_0x2b9029){return console[_0x11456b(0x17f)]('Error:\x20'+_0x2b9029[_0x11456b(0x1a1)]),0x1;}const _0x3b01be=_0x2b5075['database']||_0x11456b(0x1a6),_0x808f3a=_0x2b5075[_0x11456b(0x18f)];try{const _0x4df070=[],_0x3854bf=!!_0x2b5075[_0x11456b(0x18e)];for(let _0x3cde3f=0x0;_0x3cde3f<_0x1beb54[_0x11456b(0x19e)];_0x3cde3f++){const _0x682a92=_0x1beb54[_0x3cde3f],_0x454ef2=_0x3cde3f+0x1,_0xb26daa=_0x1beb54['length'],_0x52bf25=_0xb26daa>0x1;_0x2b5075[_0x11456b(0x179)]&&(console[_0x11456b(0x17f)]('\x0a'+(_0x52bf25?'Statement\x20'+_0x454ef2+'/'+_0xb26daa+':':'')),console[_0x11456b(0x17f)](_0x11456b(0x17b)+_0x2b5075[_0x11456b(0x19a)]),console[_0x11456b(0x17f)](_0x11456b(0x1a4)+(_0x808f3a||'td')),console[_0x11456b(0x17f)]('Schema:\x20'+_0x3b01be),console['error']('SQL:\x20'+_0x682a92));const _0x59482=_0x52bf25?'Executing\x20statement\x20'+_0x454ef2+'/'+_0xb26daa+_0x11456b(0x17a):_0x11456b(0x18a);try{const _0x50e3f7=await withQuerySpinner(_0x59482,async _0x139c6c=>{const _0x2d269a=await _0x227ffd['query']['execute'](_0x682a92,{'catalog':_0x808f3a,'schema':_0x3b01be,'onJobId':_0x445ab3=>{const _0x532d33=a31_0x5ae9;_0x139c6c[_0x532d33(0x1a7)](_0x445ab3);},'onProgress':_0xddfe54=>{const _0x3dee44=a31_0x5ae9;_0x139c6c[_0x3dee44(0x193)](_0x3dee44(0x178)+_0xddfe54[_0x3dee44(0x17c)]+']'),_0x139c6c[_0x3dee44(0x191)](formatRows(_0xddfe54[_0x3dee44(0x190)])+_0x3dee44(0x1ac)+_0xddfe54['completedSplits']+'/'+_0xddfe54[_0x3dee44(0x1aa)]+_0x3dee44(0x192));}});return _0x2d269a;},{'verbose':_0x2b5075[_0x11456b(0x179)]}),_0x39dc36=_0x50e3f7[_0x11456b(0x1a2)],_0x42b51a=_0x39dc36[_0x11456b(0x196)]?_0x11456b(0x19b)+_0x39dc36[_0x11456b(0x196)]+']':'',_0x21086d=_0x52bf25?'Statement\x20'+_0x454ef2+'/'+_0xb26daa+_0x11456b(0x183):'';console[_0x11456b(0x17f)]('✔\x20'+_0x21086d+_0x11456b(0x189)+formatRows(_0x39dc36[_0x11456b(0x187)][_0x11456b(0x190)])+_0x11456b(0x1ac)+(_0x11456b(0x17e)+formatElapsed(_0x39dc36[_0x11456b(0x187)][_0x11456b(0x186)])+_0x42b51a));if(_0x52bf25&&_0x3854bf){const _0x4bba8c=resolveOutputOptions(_0x2b5075),_0xd64bd3=await formatQueryOutput(_0x39dc36,_0x4bba8c);_0x4df070[_0x11456b(0x1a9)](_0xd64bd3);}else await handleQueryOutput(_0x39dc36,_0x2b5075);}catch(_0x3094fe){const _0x49e756=_0x52bf25?_0x11456b(0x180)+_0x454ef2+'/'+_0xb26daa+':\x0a':'',_0x200dd1=_0x3094fe instanceof SDKError?_0x3094fe[_0x11456b(0x184)]:_0x3094fe[_0x11456b(0x1a1)];return console[_0x11456b(0x17f)](''+_0x49e756+_0x200dd1),0x1;}}if(_0x1beb54[_0x11456b(0x19e)]>0x1&&_0x3854bf&&_0x4df070[_0x11456b(0x19e)]>0x0){const _0x17b70f=_0x4df070[_0x11456b(0x1a0)]('\x0a');writeFileSync(_0x2b5075[_0x11456b(0x18e)],_0x17b70f),console[_0x11456b(0x17f)](_0x11456b(0x18c)+_0x2b5075['output']);}return 0x0;}catch(_0x280d7c){throw _0x280d7c;}}['validate'](_0x54fa42){const _0x481f86=a31_0x50d114,_0x30f6bc=_0x54fa42[_0x481f86(0x1ab)][0x0],_0x32b60c=_0x54fa42[_0x481f86(0x198)]['file'];if(!_0x30f6bc&&!_0x32b60c)return _0x481f86(0x199);if(_0x30f6bc&&_0x32b60c)return _0x481f86(0x182);return undefined;}}
1
+ const a31_0x17c242=a31_0x1619;function a31_0xb2c5(){const _0x1ba3ae=['8786511RatFSZ','totalSplits','join','setExtra','originalMessage','20cbPFau','Statement\x20','619615MdaMWA','8057852cMAYFw','verbose','file','133yMaDqo','push','query','message','Site:\x20','output','elapsedTimeMillis','...','Run\x20Trino\x20queries\x20(streaming)','length','database','setJobId','completedSplits','10DHyCQL','164410TykxAp','information_schema','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','13rIPxes','\x20[Job\x20ID:\x20','\x20rows\x20','3525036FIDvrK','processedRows','\x0aAll\x20results\x20saved\x20to\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Schema:\x20','execute','168248DxGQmX','SQL:\x20','Catalog:\x20','validate','stats','Query\x20completed:\x20Processed\x20','jobId','catalog','Executing\x20query\x20[','2790750cMJZUq','No\x20SQL\x20provided','Executing\x20query...','error'];a31_0xb2c5=function(){return _0x1ba3ae;};return a31_0xb2c5();}(function(_0x5f0fa1,_0xa32222){const _0x240aa7=a31_0x1619,_0x2a8190=_0x5f0fa1();while(!![]){try{const _0x7da31=parseInt(_0x240aa7(0xe2))/0x1*(-parseInt(_0x240aa7(0xdf))/0x2)+parseInt(_0x240aa7(0xe5))/0x3+-parseInt(_0x240aa7(0xcb))/0x4*(parseInt(_0x240aa7(0xcd))/0x5)+parseInt(_0x240aa7(0xc2))/0x6+-parseInt(_0x240aa7(0xd1))/0x7*(-parseInt(_0x240aa7(0xb9))/0x8)+-parseInt(_0x240aa7(0xc6))/0x9*(-parseInt(_0x240aa7(0xde))/0xa)+-parseInt(_0x240aa7(0xce))/0xb;if(_0x7da31===_0xa32222)break;else _0x2a8190['push'](_0x2a8190['shift']());}catch(_0xcbdbd8){_0x2a8190['push'](_0x2a8190['shift']());}}}(a31_0xb2c5,0x914f9));import{BaseCommand}from'./command.js';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';function a31_0x1619(_0x594a46,_0x2804e7){_0x594a46=_0x594a46-0xb7;const _0xb2c5b6=a31_0xb2c5();let _0x16196d=_0xb2c5b6[_0x594a46];return _0x16196d;}import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{['name']=a31_0x17c242(0xd3);['description']=a31_0x17c242(0xd9);async[a31_0x17c242(0xb8)](_0x4fde24){const _0x2498a4=a31_0x17c242,{options:_0x7c8337,args:_0x53f685,tdx:_0x2448a0}=_0x4fde24,_0x53cb57=_0x53f685[0x0],_0x5deb28=_0x7c8337['file'];let _0x574be0;try{if(_0x5deb28)_0x574be0=readSqlStatementsFromFile(_0x5deb28);else{if(_0x53cb57==='-')_0x574be0=await readSqlStatementsFromStdin();else{if(_0x53cb57&&isSqlFilePath(_0x53cb57))_0x574be0=readSqlStatementsFromFile(_0x53cb57);else{if(_0x53cb57)_0x574be0=splitSqlStatements(_0x53cb57);else throw new Error(_0x2498a4(0xc3));}}}}catch(_0x499335){return console[_0x2498a4(0xc5)]('Error:\x20'+_0x499335[_0x2498a4(0xd4)]),0x1;}const _0x186049=_0x7c8337[_0x2498a4(0xdb)]||_0x2498a4(0xe0),_0xc20f5e=_0x7c8337[_0x2498a4(0xc0)];try{const _0x1e275a=[],_0x5936aa=!!_0x7c8337[_0x2498a4(0xd6)];for(let _0x8f43c5=0x0;_0x8f43c5<_0x574be0[_0x2498a4(0xda)];_0x8f43c5++){const _0x4abe91=_0x574be0[_0x8f43c5],_0xeaf007=_0x8f43c5+0x1,_0x436984=_0x574be0['length'],_0x4174a8=_0x436984>0x1;_0x7c8337['verbose']&&(console['error']('\x0a'+(_0x4174a8?_0x2498a4(0xcc)+_0xeaf007+'/'+_0x436984+':':'')),console['error'](_0x2498a4(0xd5)+_0x7c8337['site']),console[_0x2498a4(0xc5)](_0x2498a4(0xbb)+(_0xc20f5e||'td')),console[_0x2498a4(0xc5)](_0x2498a4(0xb7)+_0x186049),console[_0x2498a4(0xc5)](_0x2498a4(0xba)+_0x4abe91));const _0x3966ab=_0x4174a8?'Executing\x20statement\x20'+_0xeaf007+'/'+_0x436984+_0x2498a4(0xd8):_0x2498a4(0xc4);try{const _0x2e8fde=await withQuerySpinner(_0x3966ab,async _0x41d15f=>{const _0x503ae3=_0x2498a4,_0x3ebbce=await _0x2448a0['query'][_0x503ae3(0xb8)](_0x4abe91,{'catalog':_0xc20f5e,'schema':_0x186049,'onJobId':_0x507400=>{const _0x4bc952=_0x503ae3;_0x41d15f[_0x4bc952(0xdc)](_0x507400);},'onProgress':_0x4a1da9=>{const _0x11912b=_0x503ae3;_0x41d15f['setPhase'](_0x11912b(0xc1)+_0x4a1da9['state']+']'),_0x41d15f[_0x11912b(0xc9)](formatRows(_0x4a1da9[_0x11912b(0xe6)])+_0x11912b(0xe4)+_0x4a1da9[_0x11912b(0xdd)]+'/'+_0x4a1da9[_0x11912b(0xc7)]+'\x20splits');}});return _0x3ebbce;},{'verbose':_0x7c8337[_0x2498a4(0xcf)]}),_0x24e67f=_0x2e8fde['data'],_0x1f7ed6=_0x24e67f[_0x2498a4(0xbf)]?_0x2498a4(0xe3)+_0x24e67f[_0x2498a4(0xbf)]+']':'',_0x1e8dba=_0x4174a8?_0x2498a4(0xcc)+_0xeaf007+'/'+_0x436984+'\x20-\x20':'';console[_0x2498a4(0xc5)]('✔\x20'+_0x1e8dba+_0x2498a4(0xbe)+formatRows(_0x24e67f[_0x2498a4(0xbd)][_0x2498a4(0xe6)])+_0x2498a4(0xe4)+('in\x20'+formatElapsed(_0x24e67f[_0x2498a4(0xbd)][_0x2498a4(0xd7)])+_0x1f7ed6));if(_0x4174a8&&_0x5936aa){const _0x37e8e4=resolveOutputOptions(_0x7c8337),_0x8367aa=await formatQueryOutput(_0x24e67f,_0x37e8e4);_0x1e275a[_0x2498a4(0xd2)](_0x8367aa);}else await handleQueryOutput(_0x24e67f,_0x7c8337);}catch(_0x4afc23){const _0x4e3a07=_0x4174a8?_0x2498a4(0xcc)+_0xeaf007+'/'+_0x436984+':\x0a':'',_0x2896e0=_0x4afc23 instanceof SDKError?_0x4afc23[_0x2498a4(0xca)]:_0x4afc23[_0x2498a4(0xd4)];return console['error'](''+_0x4e3a07+_0x2896e0),0x1;}}if(_0x574be0[_0x2498a4(0xda)]>0x1&&_0x5936aa&&_0x1e275a[_0x2498a4(0xda)]>0x0){const _0x25659c=_0x1e275a[_0x2498a4(0xc8)]('\x0a');writeFileSync(_0x7c8337[_0x2498a4(0xd6)],_0x25659c),console[_0x2498a4(0xc5)](_0x2498a4(0xe7)+_0x7c8337[_0x2498a4(0xd6)]);}return 0x0;}catch(_0x490ab5){throw _0x490ab5;}}[a31_0x17c242(0xbc)](_0x214358){const _0x26ab5e=a31_0x17c242,_0x1aef1a=_0x214358['args'][0x0],_0x384e69=_0x214358['options'][_0x26ab5e(0xd0)];if(!_0x1aef1a&&!_0x384e69)return _0x26ab5e(0xe1);if(_0x1aef1a&&_0x384e69)return _0x26ab5e(0xe8);return undefined;}}
@@ -1 +1 @@
1
- function a32_0xf358(){const _0x2feda3=['Site:\x20','413861cAFdfn','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','2259vgWtDy','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','SELECT\x20*\x20FROM\x20(\x0a','execute','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','/e/','INVALID_ARGUMENT','Error:\x20Path\x20or\x20name\x20is\x20required','segment:folder:create','trim','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Examples:','Resolved\x20type:\x20','Creating\x20folder\x20\x27','parentSegment','segmentPath','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20Opening\x20','json','29865MCfArM','data','cause','message','getSegmentSQL','description','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','folderPath','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20segment\x20folder\x20details','SEGMENT_NOT_FOUND','parentFolder','listFolders','Folder\x20ID:\x20','toLocaleString','log','Usage:\x20tdx\x20sg\x20desc\x20<name>','18668gDFWCT','cyan','Fetching\x20folder\x20details...','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Target\x20path:\x20','\x20rows\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20Parent\x20segment:\x20','Parent\x20ID:\x20','SQL\x20query:\x0a','\x27\x20with\x20ID:\x20','\x27...','Use:\x20tdx\x20ps\x20desc','parentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolved\x20YAML\x20file:\x20','jsonl','includes','url','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','segment:folder:list','Resolved\x20folder\x20ID:\x20','Resolving\x20\x27','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Fetching\x20parent\x20segment\x20details...','limit','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','stats','folder','segment:view','525OKLDAa','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','/app/ps/','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolving\x20parent\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','parent','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20parent\x20ID:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:desc','121840tzrFuP','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','information_schema','✖\x20Query\x20failed\x20[','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','(root)','segmentId','error','✔\x20Found\x20','Resolving\x20path\x20\x27','2136GJmBGV','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','segment','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20folder','Error:\x20Folder\x20reference\x20is\x20required','fullPath','✔\x20Query\x20completed:\x20Processed\x20','test','Error:\x20','folderId','12SdGrOS','✔\x20Created\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20segment\x20details...','createFolder','length','type','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20folder\x20\x27','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','segment:sql','resolveParentId','Create\x20segment\x20folder\x20for\x20organization','Fetching\x20SQL\x20for\x20segment...','resolvePathToResource','name','Resolving\x20folder\x20\x27','703520WbGTyf','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','processedRows','getSegment','in\x20','Use:\x20tdx\x20ps\x20show','\x20\x20Cause:\x20','verbose','Segment\x20ID:\x20','\x20[Job\x20ID:\x20','2438lNVRbz','site','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','80GZIZTN','\x20\x20Full\x20path:\x20','Show\x20segment\x20or\x20folder\x20details','Parent\x20name:\x20','Resolving\x20parent\x20segment\x20\x27','resolveFolderId','segmentName','getFolder','replace','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','web','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Use:\x20tdx\x20ps\x20view\x20-w','Use:\x20tdx\x20ps\x20view','query'];a32_0xf358=function(){return _0x2feda3;};return a32_0xf358();}const a32_0x22f685=a32_0xdd02;(function(_0x2123c6,_0x30ddc5){const _0x1a389c=a32_0xdd02,_0x6fb9fd=_0x2123c6();while(!![]){try{const _0x1772e4=parseInt(_0x1a389c(0x23f))/0x1+parseInt(_0x1a389c(0x1d4))/0x2*(-parseInt(_0x1a389c(0x233))/0x3)+parseInt(_0x1a389c(0x211))/0x4*(parseInt(_0x1a389c(0x1d8))/0x5)+parseInt(_0x1a389c(0x256))/0x6*(parseInt(_0x1a389c(0x1e8))/0x7)+parseInt(_0x1a389c(0x24b))/0x8*(-parseInt(_0x1a389c(0x1ea))/0x9)+parseInt(_0x1a389c(0x268))/0xa+parseInt(_0x1a389c(0x1fd))/0xb;if(_0x1772e4===_0x30ddc5)break;else _0x6fb9fd['push'](_0x6fb9fd['shift']());}catch(_0x515890){_0x6fb9fd['push'](_0x6fb9fd['shift']());}}}(a32_0xf358,0x1a3db));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 a32_0x10f154 from'chalk';function resolveSegmentTarget(_0x40f1d1,_0x5e1a39,_0x350492){const _0xbed8d8=a32_0xdd02;if(isYamlFilePath(_0x40f1d1))try{const _0x5f351f=resolveYamlFilePath(_0x40f1d1);return _0x350492&&(console[_0xbed8d8(0x248)](_0xbed8d8(0x220)+_0x40f1d1),console[_0xbed8d8(0x248)](_0xbed8d8(0x218)+_0x5f351f[_0xbed8d8(0x1f8)]),console[_0xbed8d8(0x248)]('\x20\x20Segment\x20name:\x20'+_0x5f351f[_0xbed8d8(0x1de)]),console['error'](_0xbed8d8(0x238)+(_0x5f351f[_0xbed8d8(0x205)]||_0xbed8d8(0x246))),console['error'](_0xbed8d8(0x1d9)+_0x5f351f[_0xbed8d8(0x251)])),_0x5f351f[_0xbed8d8(0x251)];}catch(_0x23d5cf){throw new SDKError(ErrorCode[_0xbed8d8(0x1f0)],_0xbed8d8(0x1eb)+_0x23d5cf['message']);}if(!_0x5e1a39)throw new SDKError(ErrorCode[_0xbed8d8(0x1f0)],_0xbed8d8(0x229));return _0x5e1a39+'/'+_0x40f1d1;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x22f685(0x266)]='segment:describe';[a32_0x22f685(0x202)]=a32_0x22f685(0x1da);async[a32_0x22f685(0x1ed)](_0x4c0ead){const _0x331cee=a32_0x22f685,{options:_0x366a45,args:_0x3c1be0,tdx:_0x31495}=_0x4c0ead,_0x1ad931=_0x3c1be0[0x0],_0x1d357a=!_0x1ad931&&!!_0x366a45[_0x331cee(0x1f8)],_0x576040=_0x1ad931||_0x366a45['parentSegment'];if(!_0x576040)return console[_0x331cee(0x248)](_0x331cee(0x1f1)),console[_0x331cee(0x248)](_0x331cee(0x236)),console[_0x331cee(0x248)](_0x331cee(0x1f5)),console[_0x331cee(0x248)](_0x331cee(0x1e9)),console[_0x331cee(0x248)](_0x331cee(0x207)),console[_0x331cee(0x248)](_0x331cee(0x1e1)),console[_0x331cee(0x248)](_0x331cee(0x239)),0x1;try{const _0xb9b6a9=_0x366a45[_0x331cee(0x1f9)];let _0x6ea400=_0x576040;!_0x1d357a&&_0xb9b6a9&&!_0x576040[_0x331cee(0x222)]('/')&&(_0x6ea400=_0xb9b6a9+'/'+_0x576040,_0x366a45['verbose']&&console[_0x331cee(0x248)](_0x331cee(0x225)+_0x6ea400));const _0x5c2c43=await withSpinner(_0x331cee(0x24a)+_0x6ea400+_0x331cee(0x21c),()=>_0x31495['segment'][_0x331cee(0x265)](_0x6ea400),{'verbose':_0x366a45[_0x331cee(0x1d1)]}),_0x4e0e81=_0x5c2c43[_0x331cee(0x1fe)];_0x366a45[_0x331cee(0x1d1)]&&(console[_0x331cee(0x248)]('Resolved\x20type:\x20'+_0x4e0e81[_0x331cee(0x25c)]),console[_0x331cee(0x248)]('Parent\x20ID:\x20'+_0x4e0e81['parentId']),_0x4e0e81['folderId']&&console[_0x331cee(0x248)](_0x331cee(0x20d)+_0x4e0e81[_0x331cee(0x255)]),_0x4e0e81[_0x331cee(0x247)]&&console['error'](_0x331cee(0x1d2)+_0x4e0e81[_0x331cee(0x247)]));if(_0x4e0e81[_0x331cee(0x25c)]===_0x331cee(0x23a)){const _0x47ffc4=await withSpinner(_0x331cee(0x22d),()=>_0x31495['segment']['getParent'](_0x4e0e81[_0x331cee(0x21e)]),{'verbose':_0x366a45[_0x331cee(0x1d1)]});await handleSingleObjectOutput(_0x47ffc4['data'],_0x366a45);}else{if(_0x4e0e81[_0x331cee(0x25c)]===_0x331cee(0x231)){if(!_0x4e0e81[_0x331cee(0x255)])throw new SDKError(ErrorCode[_0x331cee(0x25f)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x43da13=await withSpinner(_0x331cee(0x213),()=>_0x31495['segment'][_0x331cee(0x1df)](_0x4e0e81['folderId']),{'verbose':_0x366a45[_0x331cee(0x1d1)]});await handleSingleObjectOutput(_0x43da13['data'],_0x366a45);}else{if(_0x4e0e81[_0x331cee(0x25c)]===_0x331cee(0x24d)){if(!_0x4e0e81[_0x331cee(0x247)])throw new SDKError(ErrorCode[_0x331cee(0x20a)],_0x331cee(0x224));const _0x25b887=await withSpinner(_0x331cee(0x259),()=>_0x31495[_0x331cee(0x24d)]['getSegment'](_0x4e0e81[_0x331cee(0x21e)],_0x4e0e81[_0x331cee(0x247)]),{'verbose':_0x366a45[_0x331cee(0x1d1)]});await handleSingleObjectOutput(_0x25b887[_0x331cee(0x1fe)],_0x366a45);}}}return 0x0;}catch(_0x375094){if(_0x375094 instanceof SDKError)return console[_0x331cee(0x248)]('Error:\x20'+_0x375094[_0x331cee(0x200)]),_0x375094[_0x331cee(0x1ff)]&&console[_0x331cee(0x248)](_0x331cee(0x1d0)+_0x375094[_0x331cee(0x1ff)]),0x1;throw _0x375094;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x22f685(0x266)]='segment:show';[a32_0x22f685(0x202)]=a32_0x22f685(0x1ee);async[a32_0x22f685(0x1ed)](_0x3b8742){const _0x463922=a32_0x22f685,{options:_0xbc7b6a,args:_0x1928f2,tdx:_0x1bc033}=_0x3b8742,_0x438f10=_0x1928f2[0x0];if(!_0x438f10)return console[_0x463922(0x248)](_0x463922(0x1d7)),console['error'](_0x463922(0x243)),console['error'](_0x463922(0x24c)),console[_0x463922(0x248)](_0x463922(0x1f5)),console[_0x463922(0x248)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x463922(0x248)](_0x463922(0x26a)),0x1;try{const _0x1da838=_0xbc7b6a[_0x463922(0x1f8)],_0x404a30=resolveSegmentTarget(_0x438f10,_0x1da838,_0xbc7b6a[_0x463922(0x1d1)]);_0xbc7b6a['verbose']&&console['error'](_0x463922(0x215)+_0x404a30);const _0x364368=await withSpinner(_0x463922(0x228)+_0x438f10+_0x463922(0x21c),()=>_0x1bc033[_0x463922(0x24d)][_0x463922(0x265)](_0x404a30),{'verbose':_0xbc7b6a[_0x463922(0x1d1)]}),_0x154c1f=_0x364368[_0x463922(0x1fe)];_0xbc7b6a['verbose']&&(console['error'](_0x463922(0x1f6)+_0x154c1f[_0x463922(0x25c)]),console[_0x463922(0x248)](_0x463922(0x219)+_0x154c1f[_0x463922(0x21e)]));if(_0x154c1f['type']===_0x463922(0x231))return console[_0x463922(0x248)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x463922(0x248)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x154c1f[_0x463922(0x25c)]===_0x463922(0x23a))return console['error'](_0x463922(0x26b)),console[_0x463922(0x248)](_0x463922(0x1cf)),0x1;if(!_0x154c1f['segmentId'])throw new SDKError(ErrorCode[_0x463922(0x20a)],_0x463922(0x224));const _0x3a5e69=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1bc033[_0x463922(0x24d)][_0x463922(0x201)](_0x154c1f[_0x463922(0x21e)],_0x154c1f[_0x463922(0x247)]),{'verbose':_0xbc7b6a[_0x463922(0x1d1)]});let _0x196a73=_0x3a5e69[_0x463922(0x1fe)];const _0x240b0e=resolveLimit(_0xbc7b6a[_0x463922(0x22e)],DEFAULT_DISPLAY_LIMIT),_0x4c3c7c=/\bLIMIT\s+\d+/i[_0x463922(0x253)](_0x196a73);!_0x4c3c7c&&(_0x196a73=_0x196a73[_0x463922(0x1f3)]()[_0x463922(0x1e0)](/;+$/,''),_0x196a73=_0x463922(0x1ec)+_0x196a73+_0x463922(0x25d)+_0x240b0e);_0xbc7b6a[_0x463922(0x1d1)]&&console[_0x463922(0x248)](_0x463922(0x21a)+_0x196a73);const _0x113d0d=await withQuerySpinner('Executing\x20segment\x20query...',async _0x5cc080=>{const _0x2de917=_0x463922,_0x372fbe=await _0x1bc033[_0x2de917(0x1e6)][_0x2de917(0x1ed)](_0x196a73,{'catalog':'td','schema':_0x2de917(0x241),'onJobId':_0x57931d=>{_0x5cc080['setJobId'](_0x57931d);}});return _0x372fbe;},{'verbose':_0xbc7b6a[_0x463922(0x1d1)]}),_0x265191=_0x113d0d[_0x463922(0x1fe)],_0xd9fbdf=_0x265191[_0x463922(0x203)]?_0x463922(0x1d3)+_0x265191[_0x463922(0x203)]+']':'';return console[_0x463922(0x248)](_0x463922(0x252)+_0x265191['stats'][_0x463922(0x26c)][_0x463922(0x20e)]()+_0x463922(0x216)+(_0x463922(0x26e)+formatElapsed(_0x265191[_0x463922(0x230)]['elapsedTimeMillis'])+_0xd9fbdf)),await handleQueryOutput(_0x265191,_0xbc7b6a),0x0;}catch(_0x3c1726){if(_0x3c1726 instanceof SDKError)return console[_0x463922(0x248)](_0x463922(0x242)+_0x3c1726['code']+']'),console['error']('\x0a'+_0x3c1726[_0x463922(0x200)]),0x1;throw _0x3c1726;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x22f685(0x266)]=a32_0x22f685(0x226);['description']=a32_0x22f685(0x234);async[a32_0x22f685(0x1ed)](_0x48237b){const _0x59c631=a32_0x22f685,{options:_0x55e24c,args:_0x531f80,tdx:_0x3a0d20}=_0x48237b;if(_0x531f80['length']===0x0)return console[_0x59c631(0x248)](_0x59c631(0x244)),console[_0x59c631(0x248)](_0x59c631(0x269)),0x1;const _0x2b0cc5=_0x531f80[0x0];try{_0x55e24c[_0x59c631(0x1d1)]&&(console['error'](_0x59c631(0x1e7)+_0x55e24c[_0x59c631(0x1d5)]),console[_0x59c631(0x248)](_0x59c631(0x1db)+_0x2b0cc5));const _0x295fb6=await withSpinner(_0x59c631(0x1dc)+_0x2b0cc5+_0x59c631(0x21c),()=>_0x3a0d20[_0x59c631(0x24d)]['resolveParentId'](_0x2b0cc5),{'verbose':_0x55e24c[_0x59c631(0x1d1)]}),_0x55ed2a=_0x295fb6[_0x59c631(0x1fe)];_0x55e24c[_0x59c631(0x1d1)]&&console[_0x59c631(0x248)]('Resolved\x20parent\x20ID:\x20'+_0x55ed2a);const _0x174fe1=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x2b0cc5+_0x59c631(0x21c),()=>_0x3a0d20[_0x59c631(0x24d)][_0x59c631(0x20c)](_0x55ed2a),{'verbose':_0x55e24c[_0x59c631(0x1d1)]}),_0x42973b=_0x174fe1[_0x59c631(0x1fe)];return console['error'](_0x59c631(0x249)+_0x42973b[_0x59c631(0x25b)]+_0x59c631(0x24f)+(_0x42973b['length']!==0x1?'s':'')),await handleSDKOutput(_0x42973b,_0x55e24c),0x0;}catch(_0x5572bc){if(_0x5572bc instanceof SDKError)return console[_0x59c631(0x248)](_0x59c631(0x254)+_0x5572bc[_0x59c631(0x200)]),_0x5572bc[_0x59c631(0x1ff)]&&console[_0x59c631(0x248)](_0x59c631(0x1d0)+_0x5572bc[_0x59c631(0x1ff)]),0x1;throw _0x5572bc;}}}export class SegmentFolderShowCommand extends BaseCommand{[a32_0x22f685(0x266)]='segment:folder:show';[a32_0x22f685(0x202)]=a32_0x22f685(0x209);async[a32_0x22f685(0x1ed)](_0xc53fad){const _0x36113b=a32_0x22f685,{options:_0x34093e,args:_0x9eba61,tdx:_0x232c74}=_0xc53fad;if(_0x9eba61[_0x36113b(0x25b)]===0x0)return console['error'](_0x36113b(0x250)),console[_0x36113b(0x248)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x30520f,childId:_0x1f44de}=parseSegmentRef(_0x9eba61[0x0]);_0x34093e[_0x36113b(0x1d1)]&&(console['error'](_0x36113b(0x1e7)+_0x34093e[_0x36113b(0x1d5)]),console[_0x36113b(0x248)]('Parent\x20name:\x20'+_0x30520f),_0x1f44de&&console[_0x36113b(0x248)]('Folder\x20name:\x20'+_0x1f44de));if(!_0x1f44de)return console[_0x36113b(0x248)](_0x36113b(0x1f4)),0x1;const _0x2d33a9=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x30520f+_0x36113b(0x21c),()=>_0x232c74[_0x36113b(0x24d)][_0x36113b(0x262)](_0x30520f),{'verbose':_0x34093e[_0x36113b(0x1d1)]}),_0x3bc630=_0x2d33a9[_0x36113b(0x1fe)];_0x34093e[_0x36113b(0x1d1)]&&console[_0x36113b(0x248)](_0x36113b(0x23c)+_0x3bc630);const _0x1c0e09=await withSpinner(_0x36113b(0x267)+_0x1f44de+_0x36113b(0x21c),()=>_0x232c74['segment'][_0x36113b(0x1dd)](_0x3bc630,_0x1f44de),{'verbose':_0x34093e[_0x36113b(0x1d1)]}),_0x59f8f8=_0x1c0e09[_0x36113b(0x1fe)];_0x34093e[_0x36113b(0x1d1)]&&console[_0x36113b(0x248)](_0x36113b(0x227)+_0x59f8f8);const _0x55176c=await withSpinner(_0x36113b(0x25e)+_0x1f44de+_0x36113b(0x21c),()=>_0x232c74['segment'][_0x36113b(0x1df)](_0x59f8f8),{'verbose':_0x34093e['verbose']});return await handleSDKOutput([_0x55176c[_0x36113b(0x1fe)]],_0x34093e),0x0;}catch(_0x19935f){if(_0x19935f instanceof SDKError)return console[_0x36113b(0x248)]('Error:\x20'+_0x19935f['message']),_0x19935f[_0x36113b(0x1ff)]&&console[_0x36113b(0x248)](_0x36113b(0x1d0)+_0x19935f['cause']),0x1;throw _0x19935f;}}}export class SegmentSQLCommand extends BaseCommand{[a32_0x22f685(0x266)]=a32_0x22f685(0x261);[a32_0x22f685(0x202)]=a32_0x22f685(0x24e);async[a32_0x22f685(0x1ed)](_0x52e13a){const _0x12c69a=a32_0x22f685,{options:_0x5dcf9a,args:_0x44470f,tdx:_0x417ac6}=_0x52e13a,_0x1ad84c=_0x44470f[0x0];if(!_0x1ad84c)return console['error'](_0x12c69a(0x1d7)),console[_0x12c69a(0x248)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x12c69a(0x248)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x12c69a(0x248)]('Examples:'),console[_0x12c69a(0x248)](_0x12c69a(0x245)),console[_0x12c69a(0x248)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x53f159=_0x5dcf9a[_0x12c69a(0x1f8)],_0x1d2a90=resolveSegmentTarget(_0x1ad84c,_0x53f159,_0x5dcf9a['verbose']);_0x5dcf9a[_0x12c69a(0x1d1)]&&console['error'](_0x12c69a(0x215)+_0x1d2a90);const _0x5162ab=await withSpinner(_0x12c69a(0x228)+_0x1ad84c+'\x27...',()=>_0x417ac6['segment'][_0x12c69a(0x265)](_0x1d2a90),{'verbose':_0x5dcf9a['verbose']}),_0x2c5aea=_0x5162ab['data'];_0x5dcf9a[_0x12c69a(0x1d1)]&&(console[_0x12c69a(0x248)](_0x12c69a(0x1f6)+_0x2c5aea['type']),console['error'](_0x12c69a(0x219)+_0x2c5aea[_0x12c69a(0x21e)]));if(_0x2c5aea[_0x12c69a(0x25c)]===_0x12c69a(0x231))return console[_0x12c69a(0x248)](_0x12c69a(0x240)),console[_0x12c69a(0x248)](_0x12c69a(0x23b)),0x1;if(_0x2c5aea[_0x12c69a(0x25c)]===_0x12c69a(0x23a))return console[_0x12c69a(0x248)](_0x12c69a(0x23d)),console[_0x12c69a(0x248)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x2c5aea['segmentId'])throw new SDKError(ErrorCode[_0x12c69a(0x20a)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5221d3=await withSpinner(_0x12c69a(0x264),()=>_0x417ac6[_0x12c69a(0x24d)]['getSegmentSQL'](_0x2c5aea[_0x12c69a(0x21e)],_0x2c5aea[_0x12c69a(0x247)]),{'verbose':_0x5dcf9a[_0x12c69a(0x1d1)]}),_0x48c0bd=_0x5221d3[_0x12c69a(0x1fe)];return _0x5dcf9a['format']===_0x12c69a(0x1fc)||_0x5dcf9a['format']===_0x12c69a(0x221)?await handleSDKOutput([{'sql':_0x48c0bd}],_0x5dcf9a):console[_0x12c69a(0x20f)](_0x48c0bd),0x0;}catch(_0x34857c){if(_0x34857c instanceof SDKError)return console['error'](_0x12c69a(0x254)+_0x34857c['message']),_0x34857c[_0x12c69a(0x1ff)]&&console[_0x12c69a(0x248)]('\x20\x20Cause:\x20'+_0x34857c[_0x12c69a(0x1ff)]),0x1;throw _0x34857c;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a32_0x22f685(0x1f2);['description']=a32_0x22f685(0x263);async[a32_0x22f685(0x1ed)](_0x48ce56){const _0x67942d=a32_0x22f685,{options:_0x3aeacd,args:_0x1f1087,tdx:_0x25437f}=_0x48ce56,_0x216e39=_0x3aeacd;if(_0x1f1087[_0x67942d(0x25b)]<0x2)return console['error'](_0x67942d(0x1e3)),console[_0x67942d(0x248)](_0x67942d(0x208)),0x1;const _0x4a839b=_0x1f1087[0x0],_0x1fa298=_0x1f1087[0x1];_0x216e39[_0x67942d(0x1d1)]&&(console[_0x67942d(0x248)](_0x67942d(0x1e7)+_0x216e39[_0x67942d(0x1d5)]),console[_0x67942d(0x248)]('Parent\x20segment:\x20'+_0x4a839b),console[_0x67942d(0x248)]('Folder\x20name:\x20'+_0x1fa298));let _0x4ee1af;if(_0x216e39[_0x67942d(0x20b)]){const _0x140b76=_0x216e39[_0x67942d(0x20b)],_0x19085e=await withSpinner(_0x67942d(0x1dc)+_0x4a839b+_0x67942d(0x21c),()=>_0x25437f[_0x67942d(0x24d)][_0x67942d(0x262)](_0x4a839b),{'verbose':_0x216e39[_0x67942d(0x1d1)]}),_0x144b1d=_0x19085e[_0x67942d(0x1fe)],_0x27fa7b=await withSpinner(_0x67942d(0x237)+_0x140b76+_0x67942d(0x21c),()=>_0x25437f[_0x67942d(0x24d)]['resolveFolderId'](_0x144b1d,_0x140b76),{'verbose':_0x216e39[_0x67942d(0x1d1)]});_0x4ee1af=_0x27fa7b[_0x67942d(0x1fe)],_0x216e39[_0x67942d(0x1d1)]&&console[_0x67942d(0x248)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4ee1af);}const _0x2afce6={'name':_0x1fa298,'description':_0x216e39[_0x67942d(0x202)],'parentFolderId':_0x4ee1af},_0x8cd354=await withSpinner(_0x67942d(0x1f7)+_0x1fa298+_0x67942d(0x21c),()=>_0x25437f['segment'][_0x67942d(0x25a)](_0x4a839b,_0x2afce6),{'verbose':_0x216e39[_0x67942d(0x1d1)]}),_0xe3491c=_0x8cd354[_0x67942d(0x1fe)];return console[_0x67942d(0x248)](_0x67942d(0x257)+_0xe3491c[_0x67942d(0x266)]+_0x67942d(0x21b)+_0xe3491c['id']),await handleSDKOutput([_0xe3491c],_0x216e39),0x0;}}export class SegmentViewCommand extends BaseCommand{[a32_0x22f685(0x266)]=a32_0x22f685(0x232);[a32_0x22f685(0x202)]=a32_0x22f685(0x22b);async['execute'](_0x555c00){const _0x4f6937=a32_0x22f685,{options:_0x4bea07,args:_0x1ae342,tdx:_0x4c1618}=_0x555c00,_0x1ba7e1=_0x1ae342[0x0];if(!_0x1ba7e1)return console[_0x4f6937(0x248)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4f6937(0x248)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x4f6937(0x21f)),console['error']('Options:'),console[_0x4f6937(0x248)](_0x4f6937(0x22c)),console[_0x4f6937(0x248)](_0x4f6937(0x1f5)),console['error'](_0x4f6937(0x204)),console[_0x4f6937(0x248)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4f6937(0x248)](_0x4f6937(0x22a)),console['error'](_0x4f6937(0x1d6)),0x1;try{const _0x5a86ba=_0x4bea07['parentSegment'],_0x2d788f=resolveSegmentTarget(_0x1ba7e1,_0x5a86ba,_0x4bea07[_0x4f6937(0x1d1)]);_0x4bea07[_0x4f6937(0x1d1)]&&console[_0x4f6937(0x248)](_0x4f6937(0x215)+_0x2d788f);const _0x563a17=await withSpinner('Resolving\x20\x27'+_0x1ba7e1+_0x4f6937(0x21c),()=>_0x4c1618[_0x4f6937(0x24d)][_0x4f6937(0x265)](_0x2d788f),{'verbose':_0x4bea07[_0x4f6937(0x1d1)]}),_0x5f55ee=_0x563a17['data'];_0x4bea07[_0x4f6937(0x1d1)]&&(console['error']('Resolved\x20type:\x20'+_0x5f55ee[_0x4f6937(0x25c)]),console['error'](_0x4f6937(0x219)+_0x5f55ee[_0x4f6937(0x21e)]),_0x5f55ee[_0x4f6937(0x255)]&&console[_0x4f6937(0x248)]('Folder\x20ID:\x20'+_0x5f55ee[_0x4f6937(0x255)]),_0x5f55ee['segmentId']&&console[_0x4f6937(0x248)](_0x4f6937(0x1d2)+_0x5f55ee[_0x4f6937(0x247)]));if(_0x4bea07[_0x4f6937(0x1e2)]){if(_0x5f55ee[_0x4f6937(0x25c)]===_0x4f6937(0x231))return console[_0x4f6937(0x248)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x5f55ee[_0x4f6937(0x25c)]===_0x4f6937(0x23a))return console[_0x4f6937(0x248)](_0x4f6937(0x260)),console[_0x4f6937(0x248)](_0x4f6937(0x1e4)),0x1;if(!_0x5f55ee[_0x4f6937(0x247)])throw new SDKError(ErrorCode[_0x4f6937(0x20a)],_0x4f6937(0x224));const _0x38718a=getConsoleNextUrl(_0x4bea07[_0x4f6937(0x1d5)],_0x4f6937(0x235)+_0x5f55ee[_0x4f6937(0x21e)]+'/e/'+_0x5f55ee[_0x4f6937(0x247)]);return console['error'](a32_0x10f154['green']('✔')+_0x4f6937(0x1fb)+a32_0x10f154[_0x4f6937(0x212)](_0x38718a)),openBrowser(_0x38718a),0x0;}if(_0x5f55ee['type']===_0x4f6937(0x231)){if(!_0x5f55ee[_0x4f6937(0x255)])throw new SDKError(ErrorCode[_0x4f6937(0x25f)],_0x4f6937(0x258));const _0x9c6178=await withSpinner(_0x4f6937(0x213),()=>_0x4c1618[_0x4f6937(0x24d)][_0x4f6937(0x1df)](_0x5f55ee[_0x4f6937(0x255)]),{'verbose':_0x4bea07[_0x4f6937(0x1d1)]});await handleSingleObjectOutput(_0x9c6178[_0x4f6937(0x1fe)],_0x4bea07);}else{if(_0x5f55ee[_0x4f6937(0x25c)]===_0x4f6937(0x24d)){if(!_0x5f55ee[_0x4f6937(0x247)])throw new SDKError(ErrorCode[_0x4f6937(0x20a)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x17a0c8=await withSpinner(_0x4f6937(0x259),()=>_0x4c1618[_0x4f6937(0x24d)][_0x4f6937(0x26d)](_0x5f55ee[_0x4f6937(0x21e)],_0x5f55ee[_0x4f6937(0x247)]),{'verbose':_0x4bea07[_0x4f6937(0x1d1)]}),_0x19aa1d=getConsoleNextUrl(_0x4bea07[_0x4f6937(0x1d5)],_0x4f6937(0x235)+_0x5f55ee['parentId']+_0x4f6937(0x1ef)+_0x5f55ee[_0x4f6937(0x247)]),_0x52013e=_0x17a0c8[_0x4f6937(0x1fe)];_0x52013e[_0x4f6937(0x223)]=_0x19aa1d,await handleSingleObjectOutput(_0x52013e,_0x4bea07);}else return console[_0x4f6937(0x248)](_0x4f6937(0x217)),console[_0x4f6937(0x248)](_0x4f6937(0x1e5)),0x1;}return 0x0;}catch(_0x2befa2){if(_0x2befa2 instanceof SDKError)return console[_0x4f6937(0x248)](_0x4f6937(0x254)+_0x2befa2[_0x4f6937(0x200)]),_0x2befa2['cause']&&console[_0x4f6937(0x248)](_0x4f6937(0x1d0)+_0x2befa2[_0x4f6937(0x1ff)]),0x1;throw _0x2befa2;}}}function a32_0xdd02(_0x5ebce1,_0x1556c9){_0x5ebce1=_0x5ebce1-0x1cf;const _0xf35816=a32_0xf358();let _0xdd02af=_0xf35816[_0x5ebce1];return _0xdd02af;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x22f685(0x266)]=a32_0x22f685(0x23e);[a32_0x22f685(0x202)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a32_0x22f685(0x1ed)](_0x23ebcd){const _0x4d750c=a32_0x22f685,{options:_0x58c3d9,args:_0x30459e,tdx:_0x2e8548}=_0x23ebcd,_0xee0f79=_0x30459e[0x0];if(!_0xee0f79)return console[_0x4d750c(0x248)](_0x4d750c(0x1d7)),console['error'](_0x4d750c(0x210)),console[_0x4d750c(0x248)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error']('Examples:'),console['error'](_0x4d750c(0x22f)),console[_0x4d750c(0x248)](_0x4d750c(0x1fa)),0x1;try{const _0x4c7431=_0x58c3d9[_0x4d750c(0x1f8)],_0x387f0b=resolveSegmentTarget(_0xee0f79,_0x4c7431,_0x58c3d9[_0x4d750c(0x1d1)]);_0x58c3d9[_0x4d750c(0x1d1)]&&console[_0x4d750c(0x248)]('Target\x20path:\x20'+_0x387f0b);const _0x3d1090=await withSpinner(_0x4d750c(0x228)+_0xee0f79+_0x4d750c(0x21c),()=>_0x2e8548[_0x4d750c(0x24d)][_0x4d750c(0x265)](_0x387f0b),{'verbose':_0x58c3d9['verbose']}),_0x3e6ada=_0x3d1090[_0x4d750c(0x1fe)];_0x58c3d9[_0x4d750c(0x1d1)]&&(console[_0x4d750c(0x248)](_0x4d750c(0x1f6)+_0x3e6ada['type']),console[_0x4d750c(0x248)](_0x4d750c(0x219)+_0x3e6ada['parentId']));if(_0x3e6ada[_0x4d750c(0x25c)]===_0x4d750c(0x231))return console['error'](_0x4d750c(0x214)),console['error'](_0x4d750c(0x23b)),0x1;if(_0x3e6ada['type']===_0x4d750c(0x23a))return console['error'](_0x4d750c(0x206)),console[_0x4d750c(0x248)](_0x4d750c(0x21d)),0x1;if(!_0x3e6ada[_0x4d750c(0x247)])throw new SDKError(ErrorCode[_0x4d750c(0x20a)],_0x4d750c(0x224));const _0x3374b7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x2e8548[_0x4d750c(0x24d)][_0x4d750c(0x201)](_0x3e6ada['parentId'],_0x3e6ada[_0x4d750c(0x247)]),{'verbose':_0x58c3d9['verbose']}),_0x545537=_0x3374b7[_0x4d750c(0x1fe)],_0x4cb884=await executeSchemaQuery(_0x545537,_0x2e8548,_0x58c3d9);return await handleQueryOutput(_0x4cb884,_0x58c3d9),0x0;}catch(_0x252b77){if(_0x252b77 instanceof SDKError)return console[_0x4d750c(0x248)](_0x4d750c(0x254)+_0x252b77[_0x4d750c(0x200)]),_0x252b77[_0x4d750c(0x1ff)]&&console[_0x4d750c(0x248)](_0x4d750c(0x1d0)+_0x252b77[_0x4d750c(0x1ff)]),0x1;throw _0x252b77;}}}
1
+ const a32_0x69f1e0=a32_0x55ef;(function(_0x38c9dd,_0x262820){const _0xbcf698=a32_0x55ef,_0x3ffb8d=_0x38c9dd();while(!![]){try{const _0x504757=parseInt(_0xbcf698(0x150))/0x1*(parseInt(_0xbcf698(0x152))/0x2)+parseInt(_0xbcf698(0x1bd))/0x3*(-parseInt(_0xbcf698(0x18c))/0x4)+parseInt(_0xbcf698(0x19e))/0x5*(parseInt(_0xbcf698(0x18f))/0x6)+parseInt(_0xbcf698(0x1cb))/0x7+-parseInt(_0xbcf698(0x13b))/0x8+parseInt(_0xbcf698(0x188))/0x9+-parseInt(_0xbcf698(0x1a2))/0xa*(parseInt(_0xbcf698(0x19b))/0xb);if(_0x504757===_0x262820)break;else _0x3ffb8d['push'](_0x3ffb8d['shift']());}catch(_0x3f244c){_0x3ffb8d['push'](_0x3ffb8d['shift']());}}}(a32_0x4af2,0x1c328));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a32_0x4af2(){const _0x184658=['\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Folder\x20ID\x20missing\x20from\x20resolved\x20path','verbose','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','format','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','folderId','replace','\x20Opening\x20','3eHYQBk','Get\x20SQL\x20query\x20for\x20child\x20segment','Segment\x20ID:\x20','\x20\x20Cause:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Resolving\x20parent\x20segment\x20\x27','log','getSegmentSQL','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20sg\x20show\x20<name>','stats','cause','798161QlEfEh','Options:','Site:\x20','Use:\x20tdx\x20ps\x20view\x20-w','✔\x20Created\x20folder\x20\x27','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x27\x20with\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20ID:\x20','INVALID_ARGUMENT','parentFolder','358064SjXUiN','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Create\x20segment\x20folder\x20for\x20organization','Error:\x20','segment:folder:list','SEGMENT_FOLDER_NOT_FOUND','url','/e/','Use:\x20tdx\x20ps\x20sql','\x27...','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','createFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Target\x20path:\x20','Parent\x20ID:\x20','listFolders','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','information_schema','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','toLocaleString','6115QnboDQ','description','46EpHuDS','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','✖\x20Query\x20failed\x20[','Creating\x20folder\x20\x27','segmentId','\x20\x20Full\x20path:\x20','resolveFolderId','/app/ps/','Parent\x20segment:\x20','segmentName','data','Parent\x20name:\x20','Use:\x20tdx\x20ps\x20desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','query','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','parentSegment','Resolved\x20YAML\x20file:\x20','json','segment:desc','resolvePathToResource','error','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Resolving\x20path\x20\x27','Usage:\x20tdx\x20sg\x20desc\x20<name>','getParent','Fetching\x20folder\x20details...','web','Resolving\x20\x27','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','execute','type','\x20rows\x20','segment','Resolving\x20folder\x20\x27','Executing\x20segment\x20query...','Resolved\x20parent\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','getSegment','Resolved\x20type:\x20','Resolving\x20parent\x20folder\x20\x27','SQL\x20query:\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','code','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','parent','limit','folderPath','1828089azpkhy','folder','message','\x20\x20Segment\x20name:\x20','444228SOfXwJ','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Path\x20or\x20name\x20is\x20required','354OYSTfn','resolveParentId','Fetching\x20segment\x20details...','(root)','SELECT\x20*\x20FROM\x20(\x0a','parentId','\x20\x20Folder\x20path:\x20','\x20[Job\x20ID:\x20','segment:sql','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','name','3336927KPMmhF','jobId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','9905Waulrq','\x20\x20Parent\x20segment:\x20','Resolved\x20parent\x20ID:\x20','in\x20','10BnKBmA','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','processedRows','Examples:','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','test','site','elapsedTimeMillis','fullPath','SEGMENT_NOT_FOUND','segment:view','getFolder','length','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Show\x20segment\x20or\x20folder\x20details'];a32_0x4af2=function(){return _0x184658;};return a32_0x4af2();}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 a32_0x252943 from'chalk';function resolveSegmentTarget(_0x3c009d,_0x410d41,_0x2d160d){const _0x3e19c0=a32_0x55ef;if(isYamlFilePath(_0x3c009d))try{const _0x191779=resolveYamlFilePath(_0x3c009d);return _0x2d160d&&(console[_0x3e19c0(0x168)](_0x3e19c0(0x164)+_0x3c009d),console['error'](_0x3e19c0(0x19f)+_0x191779[_0x3e19c0(0x163)]),console['error'](_0x3e19c0(0x18b)+_0x191779[_0x3e19c0(0x15b)]),console['error'](_0x3e19c0(0x195)+(_0x191779[_0x3e19c0(0x187)]||_0x3e19c0(0x192))),console[_0x3e19c0(0x168)](_0x3e19c0(0x157)+_0x191779[_0x3e19c0(0x1ab)])),_0x191779[_0x3e19c0(0x1ab)];}catch(_0x251c71){throw new SDKError(ErrorCode[_0x3e19c0(0x139)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x251c71[_0x3e19c0(0x18a)]);}if(!_0x410d41)throw new SDKError(ErrorCode[_0x3e19c0(0x139)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x410d41+'/'+_0x3c009d;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]='segment:describe';[a32_0x69f1e0(0x151)]=a32_0x69f1e0(0x1b1);async['execute'](_0x2228d1){const _0x2bd1ae=a32_0x69f1e0,{options:_0x59bf2b,args:_0x227f88,tdx:_0x1c6b24}=_0x2228d1,_0x57bb0b=_0x227f88[0x0],_0x54a035=!_0x57bb0b&&!!_0x59bf2b[_0x2bd1ae(0x163)],_0x4f1425=_0x57bb0b||_0x59bf2b[_0x2bd1ae(0x163)];if(!_0x4f1425)return console[_0x2bd1ae(0x168)](_0x2bd1ae(0x18e)),console[_0x2bd1ae(0x168)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2bd1ae(0x168)](_0x2bd1ae(0x1a5)),console['error'](_0x2bd1ae(0x1b9)),console[_0x2bd1ae(0x168)](_0x2bd1ae(0x184)),console[_0x2bd1ae(0x168)](_0x2bd1ae(0x13d)),console[_0x2bd1ae(0x168)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x46ca89=_0x59bf2b['segmentPath'];let _0x16b7dd=_0x4f1425;!_0x54a035&&_0x46ca89&&!_0x4f1425['includes']('/')&&(_0x16b7dd=_0x46ca89+'/'+_0x4f1425,_0x59bf2b[_0x2bd1ae(0x1b4)]&&console[_0x2bd1ae(0x168)]('Resolved\x20relative\x20path\x20to:\x20'+_0x16b7dd));const _0x5ba280=await withSpinner(_0x2bd1ae(0x16b)+_0x16b7dd+_0x2bd1ae(0x145),()=>_0x1c6b24['segment'][_0x2bd1ae(0x167)](_0x16b7dd),{'verbose':_0x59bf2b[_0x2bd1ae(0x1b4)]}),_0x554700=_0x5ba280[_0x2bd1ae(0x15c)];_0x59bf2b[_0x2bd1ae(0x1b4)]&&(console['error'](_0x2bd1ae(0x17f)+_0x554700[_0x2bd1ae(0x177)]),console['error']('Parent\x20ID:\x20'+_0x554700['parentId']),_0x554700[_0x2bd1ae(0x1ba)]&&console['error']('Folder\x20ID:\x20'+_0x554700['folderId']),_0x554700[_0x2bd1ae(0x156)]&&console[_0x2bd1ae(0x168)](_0x2bd1ae(0x1bf)+_0x554700[_0x2bd1ae(0x156)]));if(_0x554700[_0x2bd1ae(0x177)]===_0x2bd1ae(0x185)){const _0x279bd6=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x1c6b24['segment'][_0x2bd1ae(0x16d)](_0x554700[_0x2bd1ae(0x194)]),{'verbose':_0x59bf2b[_0x2bd1ae(0x1b4)]});await handleSingleObjectOutput(_0x279bd6[_0x2bd1ae(0x15c)],_0x59bf2b);}else{if(_0x554700[_0x2bd1ae(0x177)]===_0x2bd1ae(0x189)){if(!_0x554700[_0x2bd1ae(0x1ba)])throw new SDKError(ErrorCode[_0x2bd1ae(0x141)],_0x2bd1ae(0x1b3));const _0x559c7e=await withSpinner(_0x2bd1ae(0x16e),()=>_0x1c6b24[_0x2bd1ae(0x179)]['getFolder'](_0x554700[_0x2bd1ae(0x1ba)]),{'verbose':_0x59bf2b[_0x2bd1ae(0x1b4)]});await handleSingleObjectOutput(_0x559c7e['data'],_0x59bf2b);}else{if(_0x554700[_0x2bd1ae(0x177)]==='segment'){if(!_0x554700[_0x2bd1ae(0x156)])throw new SDKError(ErrorCode[_0x2bd1ae(0x1ac)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x57f5ef=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1c6b24['segment'][_0x2bd1ae(0x17e)](_0x554700[_0x2bd1ae(0x194)],_0x554700[_0x2bd1ae(0x156)]),{'verbose':_0x59bf2b[_0x2bd1ae(0x1b4)]});await handleSingleObjectOutput(_0x57f5ef[_0x2bd1ae(0x15c)],_0x59bf2b);}}}return 0x0;}catch(_0x571baa){if(_0x571baa instanceof SDKError)return console[_0x2bd1ae(0x168)](_0x2bd1ae(0x13f)+_0x571baa[_0x2bd1ae(0x18a)]),_0x571baa[_0x2bd1ae(0x1ca)]&&console['error']('\x20\x20Cause:\x20'+_0x571baa['cause']),0x1;throw _0x571baa;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]='segment:show';[a32_0x69f1e0(0x151)]=a32_0x69f1e0(0x1c6);async[a32_0x69f1e0(0x176)](_0x50fc39){const _0x2d6f6b=a32_0x69f1e0,{options:_0x122f6f,args:_0x35b8fb,tdx:_0x2f9eb9}=_0x50fc39,_0x4d2c03=_0x35b8fb[0x0];if(!_0x4d2c03)return console['error'](_0x2d6f6b(0x134)),console['error'](_0x2d6f6b(0x1c8)),console[_0x2d6f6b(0x168)](_0x2d6f6b(0x15f)),console[_0x2d6f6b(0x168)](_0x2d6f6b(0x1a5)),console[_0x2d6f6b(0x168)](_0x2d6f6b(0x18d)),console[_0x2d6f6b(0x168)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x30cb0d=_0x122f6f[_0x2d6f6b(0x163)],_0x50cb12=resolveSegmentTarget(_0x4d2c03,_0x30cb0d,_0x122f6f['verbose']);_0x122f6f['verbose']&&console[_0x2d6f6b(0x168)](_0x2d6f6b(0x149)+_0x50cb12);const _0x48f7e4=await withSpinner(_0x2d6f6b(0x170)+_0x4d2c03+_0x2d6f6b(0x145),()=>_0x2f9eb9[_0x2d6f6b(0x179)][_0x2d6f6b(0x167)](_0x50cb12),{'verbose':_0x122f6f[_0x2d6f6b(0x1b4)]}),_0x13bc6e=_0x48f7e4[_0x2d6f6b(0x15c)];_0x122f6f[_0x2d6f6b(0x1b4)]&&(console[_0x2d6f6b(0x168)](_0x2d6f6b(0x17f)+_0x13bc6e[_0x2d6f6b(0x177)]),console['error'](_0x2d6f6b(0x14a)+_0x13bc6e['parentId']));if(_0x13bc6e[_0x2d6f6b(0x177)]===_0x2d6f6b(0x189))return console['error'](_0x2d6f6b(0x1c1)),console[_0x2d6f6b(0x168)](_0x2d6f6b(0x16a)),0x1;if(_0x13bc6e[_0x2d6f6b(0x177)]===_0x2d6f6b(0x185))return console['error'](_0x2d6f6b(0x171)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x13bc6e['segmentId'])throw new SDKError(ErrorCode[_0x2d6f6b(0x1ac)],_0x2d6f6b(0x169));const _0x171902=await withSpinner(_0x2d6f6b(0x172),()=>_0x2f9eb9[_0x2d6f6b(0x179)]['getSegmentSQL'](_0x13bc6e['parentId'],_0x13bc6e['segmentId']),{'verbose':_0x122f6f['verbose']});let _0x35aa65=_0x171902[_0x2d6f6b(0x15c)];const _0x17fc5a=resolveLimit(_0x122f6f[_0x2d6f6b(0x186)],DEFAULT_DISPLAY_LIMIT),_0x1a5573=/\bLIMIT\s+\d+/i[_0x2d6f6b(0x1a8)](_0x35aa65);!_0x1a5573&&(_0x35aa65=_0x35aa65['trim']()[_0x2d6f6b(0x1bb)](/;+$/,''),_0x35aa65=_0x2d6f6b(0x193)+_0x35aa65+_0x2d6f6b(0x19d)+_0x17fc5a);_0x122f6f[_0x2d6f6b(0x1b4)]&&console['error'](_0x2d6f6b(0x181)+_0x35aa65);const _0x3f9685=await withQuerySpinner(_0x2d6f6b(0x17b),async _0x4aa21a=>{const _0x40f50d=_0x2d6f6b,_0x5f1d71=await _0x2f9eb9[_0x40f50d(0x161)]['execute'](_0x35aa65,{'catalog':'td','schema':_0x40f50d(0x14d),'onJobId':_0x45841d=>{_0x4aa21a['setJobId'](_0x45841d);}});return _0x5f1d71;},{'verbose':_0x122f6f[_0x2d6f6b(0x1b4)]}),_0x5cd086=_0x3f9685[_0x2d6f6b(0x15c)],_0xb72db=_0x5cd086[_0x2d6f6b(0x19c)]?_0x2d6f6b(0x196)+_0x5cd086[_0x2d6f6b(0x19c)]+']':'';return console[_0x2d6f6b(0x168)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x5cd086['stats'][_0x2d6f6b(0x1a4)][_0x2d6f6b(0x14f)]()+_0x2d6f6b(0x178)+(_0x2d6f6b(0x1a1)+formatElapsed(_0x5cd086[_0x2d6f6b(0x1c9)][_0x2d6f6b(0x1aa)])+_0xb72db)),await handleQueryOutput(_0x5cd086,_0x122f6f),0x0;}catch(_0x182af3){if(_0x182af3 instanceof SDKError)return console[_0x2d6f6b(0x168)](_0x2d6f6b(0x154)+_0x182af3[_0x2d6f6b(0x183)]+']'),console['error']('\x0a'+_0x182af3[_0x2d6f6b(0x18a)]),0x1;throw _0x182af3;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]=a32_0x69f1e0(0x140);[a32_0x69f1e0(0x151)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a32_0x69f1e0(0x176)](_0xeb263e){const _0x1948ff=a32_0x69f1e0,{options:_0x4c0e83,args:_0x2cb060,tdx:_0x37523b}=_0xeb263e;if(_0x2cb060['length']===0x0)return console[_0x1948ff(0x168)](_0x1948ff(0x174)),console[_0x1948ff(0x168)](_0x1948ff(0x17d)),0x1;const _0x3c4970=_0x2cb060[0x0];try{_0x4c0e83['verbose']&&(console['error']('Site:\x20'+_0x4c0e83[_0x1948ff(0x1a9)]),console[_0x1948ff(0x168)](_0x1948ff(0x15d)+_0x3c4970));const _0x21bbc1=await withSpinner(_0x1948ff(0x1c2)+_0x3c4970+_0x1948ff(0x145),()=>_0x37523b[_0x1948ff(0x179)]['resolveParentId'](_0x3c4970),{'verbose':_0x4c0e83['verbose']}),_0x15b018=_0x21bbc1[_0x1948ff(0x15c)];_0x4c0e83[_0x1948ff(0x1b4)]&&console['error'](_0x1948ff(0x1a0)+_0x15b018);const _0x403399=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x3c4970+_0x1948ff(0x145),()=>_0x37523b['segment'][_0x1948ff(0x14b)](_0x15b018),{'verbose':_0x4c0e83['verbose']}),_0x3c4bfc=_0x403399[_0x1948ff(0x15c)];return console[_0x1948ff(0x168)]('✔\x20Found\x20'+_0x3c4bfc['length']+'\x20folder'+(_0x3c4bfc[_0x1948ff(0x1af)]!==0x1?'s':'')),await handleSDKOutput(_0x3c4bfc,_0x4c0e83),0x0;}catch(_0x28333e){if(_0x28333e instanceof SDKError)return console[_0x1948ff(0x168)](_0x1948ff(0x13f)+_0x28333e[_0x1948ff(0x18a)]),_0x28333e[_0x1948ff(0x1ca)]&&console[_0x1948ff(0x168)](_0x1948ff(0x1c0)+_0x28333e['cause']),0x1;throw _0x28333e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]='segment:folder:show';['description']='Show\x20segment\x20folder\x20details';async[a32_0x69f1e0(0x176)](_0x3de8b1){const _0x2242ab=a32_0x69f1e0,{options:_0x317bc5,args:_0xed81c,tdx:_0x31bb2b}=_0x3de8b1;if(_0xed81c[_0x2242ab(0x1af)]===0x0)return console[_0x2242ab(0x168)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x2242ab(0x168)](_0x2242ab(0x153)),0x1;try{const {parentId:_0x1bb346,childId:_0x1bda54}=parseSegmentRef(_0xed81c[0x0]);_0x317bc5[_0x2242ab(0x1b4)]&&(console[_0x2242ab(0x168)]('Site:\x20'+_0x317bc5[_0x2242ab(0x1a9)]),console[_0x2242ab(0x168)]('Parent\x20name:\x20'+_0x1bb346),_0x1bda54&&console[_0x2242ab(0x168)]('Folder\x20name:\x20'+_0x1bda54));if(!_0x1bda54)return console[_0x2242ab(0x168)](_0x2242ab(0x162)),0x1;const _0xbfbe88=await withSpinner(_0x2242ab(0x1c2)+_0x1bb346+_0x2242ab(0x145),()=>_0x31bb2b[_0x2242ab(0x179)][_0x2242ab(0x190)](_0x1bb346),{'verbose':_0x317bc5['verbose']}),_0x47c5db=_0xbfbe88['data'];_0x317bc5[_0x2242ab(0x1b4)]&&console[_0x2242ab(0x168)](_0x2242ab(0x1a0)+_0x47c5db);const _0x278ef1=await withSpinner(_0x2242ab(0x17a)+_0x1bda54+'\x27...',()=>_0x31bb2b[_0x2242ab(0x179)][_0x2242ab(0x158)](_0x47c5db,_0x1bda54),{'verbose':_0x317bc5[_0x2242ab(0x1b4)]}),_0x4a6e4a=_0x278ef1['data'];_0x317bc5[_0x2242ab(0x1b4)]&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x4a6e4a);const _0x1d14bc=await withSpinner('Fetching\x20folder\x20\x27'+_0x1bda54+'\x27...',()=>_0x31bb2b[_0x2242ab(0x179)][_0x2242ab(0x1ae)](_0x4a6e4a),{'verbose':_0x317bc5[_0x2242ab(0x1b4)]});return await handleSDKOutput([_0x1d14bc['data']],_0x317bc5),0x0;}catch(_0x2391f7){if(_0x2391f7 instanceof SDKError)return console['error'](_0x2242ab(0x13f)+_0x2391f7['message']),_0x2391f7[_0x2242ab(0x1ca)]&&console[_0x2242ab(0x168)](_0x2242ab(0x1c0)+_0x2391f7[_0x2242ab(0x1ca)]),0x1;throw _0x2391f7;}}}export class SegmentSQLCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]=a32_0x69f1e0(0x197);[a32_0x69f1e0(0x151)]=a32_0x69f1e0(0x1be);async['execute'](_0x4ce115){const _0x243d4e=a32_0x69f1e0,{options:_0x46a6b8,args:_0x25fe58,tdx:_0x45134d}=_0x4ce115,_0x43fed7=_0x25fe58[0x0];if(!_0x43fed7)return console[_0x243d4e(0x168)](_0x243d4e(0x134)),console[_0x243d4e(0x168)](_0x243d4e(0x135)),console['error'](_0x243d4e(0x182)),console[_0x243d4e(0x168)]('Examples:'),console[_0x243d4e(0x168)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x243d4e(0x168)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x285ad6=_0x46a6b8[_0x243d4e(0x163)],_0x510d0=resolveSegmentTarget(_0x43fed7,_0x285ad6,_0x46a6b8[_0x243d4e(0x1b4)]);_0x46a6b8[_0x243d4e(0x1b4)]&&console[_0x243d4e(0x168)](_0x243d4e(0x149)+_0x510d0);const _0x38d269=await withSpinner('Resolving\x20\x27'+_0x43fed7+_0x243d4e(0x145),()=>_0x45134d[_0x243d4e(0x179)][_0x243d4e(0x167)](_0x510d0),{'verbose':_0x46a6b8[_0x243d4e(0x1b4)]}),_0x100209=_0x38d269[_0x243d4e(0x15c)];_0x46a6b8['verbose']&&(console[_0x243d4e(0x168)](_0x243d4e(0x17f)+_0x100209[_0x243d4e(0x177)]),console[_0x243d4e(0x168)](_0x243d4e(0x14a)+_0x100209[_0x243d4e(0x194)]));if(_0x100209[_0x243d4e(0x177)]===_0x243d4e(0x189))return console['error'](_0x243d4e(0x198)),console[_0x243d4e(0x168)](_0x243d4e(0x1c7)),0x1;if(_0x100209[_0x243d4e(0x177)]===_0x243d4e(0x185))return console[_0x243d4e(0x168)](_0x243d4e(0x1b6)),console[_0x243d4e(0x168)](_0x243d4e(0x144)),0x1;if(!_0x100209[_0x243d4e(0x156)])throw new SDKError(ErrorCode[_0x243d4e(0x1ac)],_0x243d4e(0x169));const _0x25f57f=await withSpinner(_0x243d4e(0x172),()=>_0x45134d['segment'][_0x243d4e(0x1c4)](_0x100209[_0x243d4e(0x194)],_0x100209['segmentId']),{'verbose':_0x46a6b8[_0x243d4e(0x1b4)]}),_0x5c3527=_0x25f57f['data'];return _0x46a6b8[_0x243d4e(0x1b8)]===_0x243d4e(0x165)||_0x46a6b8[_0x243d4e(0x1b8)]==='jsonl'?await handleSDKOutput([{'sql':_0x5c3527}],_0x46a6b8):console[_0x243d4e(0x1c3)](_0x5c3527),0x0;}catch(_0x549e02){if(_0x549e02 instanceof SDKError)return console[_0x243d4e(0x168)]('Error:\x20'+_0x549e02[_0x243d4e(0x18a)]),_0x549e02['cause']&&console[_0x243d4e(0x168)](_0x243d4e(0x1c0)+_0x549e02[_0x243d4e(0x1ca)]),0x1;throw _0x549e02;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]='segment:folder:create';[a32_0x69f1e0(0x151)]=a32_0x69f1e0(0x13e);async[a32_0x69f1e0(0x176)](_0x188fca){const _0x1dbc10=a32_0x69f1e0,{options:_0x5836a5,args:_0x3517ec,tdx:_0x17a4ad}=_0x188fca,_0x49f997=_0x5836a5;if(_0x3517ec[_0x1dbc10(0x1af)]<0x2)return console[_0x1dbc10(0x168)](_0x1dbc10(0x160)),console[_0x1dbc10(0x168)](_0x1dbc10(0x1c5)),0x1;const _0x3dce3a=_0x3517ec[0x0],_0x4c94d2=_0x3517ec[0x1];_0x49f997['verbose']&&(console[_0x1dbc10(0x168)](_0x1dbc10(0x1cd)+_0x49f997[_0x1dbc10(0x1a9)]),console[_0x1dbc10(0x168)](_0x1dbc10(0x15a)+_0x3dce3a),console[_0x1dbc10(0x168)]('Folder\x20name:\x20'+_0x4c94d2));let _0x30eeb7;if(_0x49f997[_0x1dbc10(0x13a)]){const _0x544e5e=_0x49f997['parentFolder'],_0x7b8e1b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3dce3a+_0x1dbc10(0x145),()=>_0x17a4ad[_0x1dbc10(0x179)]['resolveParentId'](_0x3dce3a),{'verbose':_0x49f997[_0x1dbc10(0x1b4)]}),_0x163761=_0x7b8e1b['data'],_0x964d8e=await withSpinner(_0x1dbc10(0x180)+_0x544e5e+_0x1dbc10(0x145),()=>_0x17a4ad[_0x1dbc10(0x179)][_0x1dbc10(0x158)](_0x163761,_0x544e5e),{'verbose':_0x49f997[_0x1dbc10(0x1b4)]});_0x30eeb7=_0x964d8e['data'],_0x49f997[_0x1dbc10(0x1b4)]&&console[_0x1dbc10(0x168)](_0x1dbc10(0x17c)+_0x30eeb7);}const _0x2e9a3d={'name':_0x4c94d2,'description':_0x49f997[_0x1dbc10(0x151)],'parentFolderId':_0x30eeb7},_0x39c204=await withSpinner(_0x1dbc10(0x155)+_0x4c94d2+_0x1dbc10(0x145),()=>_0x17a4ad[_0x1dbc10(0x179)][_0x1dbc10(0x147)](_0x3dce3a,_0x2e9a3d),{'verbose':_0x49f997[_0x1dbc10(0x1b4)]}),_0xf05268=_0x39c204[_0x1dbc10(0x15c)];return console[_0x1dbc10(0x168)](_0x1dbc10(0x1cf)+_0xf05268[_0x1dbc10(0x19a)]+_0x1dbc10(0x136)+_0xf05268['id']),await handleSDKOutput([_0xf05268],_0x49f997),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a32_0x69f1e0(0x1ad);[a32_0x69f1e0(0x151)]=a32_0x69f1e0(0x173);async[a32_0x69f1e0(0x176)](_0x42ca98){const _0x22ee73=a32_0x69f1e0,{options:_0x59bed0,args:_0x3c7e47,tdx:_0x41c682}=_0x42ca98,_0x5b37d5=_0x3c7e47[0x0];if(!_0x5b37d5)return console[_0x22ee73(0x168)](_0x22ee73(0x137)),console[_0x22ee73(0x168)](_0x22ee73(0x1a6)),console[_0x22ee73(0x168)](_0x22ee73(0x14e)),console[_0x22ee73(0x168)](_0x22ee73(0x1cc)),console[_0x22ee73(0x168)](_0x22ee73(0x1b2)),console[_0x22ee73(0x168)]('Examples:'),console[_0x22ee73(0x168)](_0x22ee73(0x1a7)),console['error'](_0x22ee73(0x175)),console['error'](_0x22ee73(0x14c)),console[_0x22ee73(0x168)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1ffe90=_0x59bed0['parentSegment'],_0x52c231=resolveSegmentTarget(_0x5b37d5,_0x1ffe90,_0x59bed0[_0x22ee73(0x1b4)]);_0x59bed0['verbose']&&console[_0x22ee73(0x168)](_0x22ee73(0x149)+_0x52c231);const _0x2f59dd=await withSpinner('Resolving\x20\x27'+_0x5b37d5+_0x22ee73(0x145),()=>_0x41c682['segment'][_0x22ee73(0x167)](_0x52c231),{'verbose':_0x59bed0['verbose']}),_0x4d2a2f=_0x2f59dd[_0x22ee73(0x15c)];_0x59bed0['verbose']&&(console[_0x22ee73(0x168)]('Resolved\x20type:\x20'+_0x4d2a2f[_0x22ee73(0x177)]),console[_0x22ee73(0x168)](_0x22ee73(0x14a)+_0x4d2a2f[_0x22ee73(0x194)]),_0x4d2a2f[_0x22ee73(0x1ba)]&&console[_0x22ee73(0x168)](_0x22ee73(0x138)+_0x4d2a2f[_0x22ee73(0x1ba)]),_0x4d2a2f[_0x22ee73(0x156)]&&console['error'](_0x22ee73(0x1bf)+_0x4d2a2f[_0x22ee73(0x156)]));if(_0x59bed0[_0x22ee73(0x16f)]){if(_0x4d2a2f[_0x22ee73(0x177)]==='folder')return console[_0x22ee73(0x168)](_0x22ee73(0x146)),0x1;if(_0x4d2a2f[_0x22ee73(0x177)]===_0x22ee73(0x185))return console[_0x22ee73(0x168)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x22ee73(0x168)](_0x22ee73(0x1ce)),0x1;if(!_0x4d2a2f[_0x22ee73(0x156)])throw new SDKError(ErrorCode[_0x22ee73(0x1ac)],_0x22ee73(0x169));const _0x3e1981=getConsoleNextUrl(_0x59bed0[_0x22ee73(0x1a9)],_0x22ee73(0x159)+_0x4d2a2f['parentId']+'/e/'+_0x4d2a2f[_0x22ee73(0x156)]);return console[_0x22ee73(0x168)](a32_0x252943['green']('✔')+_0x22ee73(0x1bc)+a32_0x252943['cyan'](_0x3e1981)),openBrowser(_0x3e1981),0x0;}if(_0x4d2a2f['type']===_0x22ee73(0x189)){if(!_0x4d2a2f[_0x22ee73(0x1ba)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x22ee73(0x1b3));const _0x209084=await withSpinner(_0x22ee73(0x16e),()=>_0x41c682[_0x22ee73(0x179)][_0x22ee73(0x1ae)](_0x4d2a2f[_0x22ee73(0x1ba)]),{'verbose':_0x59bed0['verbose']});await handleSingleObjectOutput(_0x209084[_0x22ee73(0x15c)],_0x59bed0);}else{if(_0x4d2a2f[_0x22ee73(0x177)]===_0x22ee73(0x179)){if(!_0x4d2a2f['segmentId'])throw new SDKError(ErrorCode[_0x22ee73(0x1ac)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1d42ea=await withSpinner(_0x22ee73(0x191),()=>_0x41c682['segment'][_0x22ee73(0x17e)](_0x4d2a2f[_0x22ee73(0x194)],_0x4d2a2f[_0x22ee73(0x156)]),{'verbose':_0x59bed0[_0x22ee73(0x1b4)]}),_0x439320=getConsoleNextUrl(_0x59bed0[_0x22ee73(0x1a9)],_0x22ee73(0x159)+_0x4d2a2f[_0x22ee73(0x194)]+_0x22ee73(0x143)+_0x4d2a2f[_0x22ee73(0x156)]),_0x152e92=_0x1d42ea[_0x22ee73(0x15c)];_0x152e92[_0x22ee73(0x142)]=_0x439320,await handleSingleObjectOutput(_0x152e92,_0x59bed0);}else return console[_0x22ee73(0x168)](_0x22ee73(0x1b7)),console[_0x22ee73(0x168)](_0x22ee73(0x1b5)),0x1;}return 0x0;}catch(_0x5ca094){if(_0x5ca094 instanceof SDKError)return console[_0x22ee73(0x168)](_0x22ee73(0x13f)+_0x5ca094[_0x22ee73(0x18a)]),_0x5ca094[_0x22ee73(0x1ca)]&&console['error']('\x20\x20Cause:\x20'+_0x5ca094[_0x22ee73(0x1ca)]),0x1;throw _0x5ca094;}}}export const SegmentInfoCommand=SegmentViewCommand;function a32_0x55ef(_0x1d216a,_0x2b3876){_0x1d216a=_0x1d216a-0x134;const _0x4af248=a32_0x4af2();let _0x55ef5b=_0x4af248[_0x1d216a];return _0x55ef5b;}export class SegmentDescCommand extends BaseCommand{[a32_0x69f1e0(0x19a)]=a32_0x69f1e0(0x166);[a32_0x69f1e0(0x151)]=a32_0x69f1e0(0x13c);async[a32_0x69f1e0(0x176)](_0x4d0e57){const _0x18424a=a32_0x69f1e0,{options:_0x4efbfc,args:_0x14c352,tdx:_0x117c98}=_0x4d0e57,_0x2018b=_0x14c352[0x0];if(!_0x2018b)return console[_0x18424a(0x168)](_0x18424a(0x134)),console[_0x18424a(0x168)](_0x18424a(0x16c)),console[_0x18424a(0x168)](_0x18424a(0x148)),console[_0x18424a(0x168)]('Examples:'),console[_0x18424a(0x168)](_0x18424a(0x1b0)),console[_0x18424a(0x168)](_0x18424a(0x1a3)),0x1;try{const _0x1e7958=_0x4efbfc['parentSegment'],_0xb50fd6=resolveSegmentTarget(_0x2018b,_0x1e7958,_0x4efbfc[_0x18424a(0x1b4)]);_0x4efbfc['verbose']&&console[_0x18424a(0x168)]('Target\x20path:\x20'+_0xb50fd6);const _0x560a2d=await withSpinner(_0x18424a(0x170)+_0x2018b+'\x27...',()=>_0x117c98[_0x18424a(0x179)][_0x18424a(0x167)](_0xb50fd6),{'verbose':_0x4efbfc[_0x18424a(0x1b4)]}),_0x58c6c1=_0x560a2d[_0x18424a(0x15c)];_0x4efbfc[_0x18424a(0x1b4)]&&(console[_0x18424a(0x168)](_0x18424a(0x17f)+_0x58c6c1[_0x18424a(0x177)]),console['error']('Parent\x20ID:\x20'+_0x58c6c1['parentId']));if(_0x58c6c1[_0x18424a(0x177)]===_0x18424a(0x189))return console[_0x18424a(0x168)](_0x18424a(0x199)),console[_0x18424a(0x168)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x58c6c1[_0x18424a(0x177)]===_0x18424a(0x185))return console[_0x18424a(0x168)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x18424a(0x168)](_0x18424a(0x15e)),0x1;if(!_0x58c6c1[_0x18424a(0x156)])throw new SDKError(ErrorCode[_0x18424a(0x1ac)],_0x18424a(0x169));const _0x402608=await withSpinner(_0x18424a(0x172),()=>_0x117c98[_0x18424a(0x179)][_0x18424a(0x1c4)](_0x58c6c1['parentId'],_0x58c6c1[_0x18424a(0x156)]),{'verbose':_0x4efbfc[_0x18424a(0x1b4)]}),_0x2a3092=_0x402608[_0x18424a(0x15c)],_0x10bfb6=await executeSchemaQuery(_0x2a3092,_0x117c98,_0x4efbfc);return await handleQueryOutput(_0x10bfb6,_0x4efbfc),0x0;}catch(_0x2d6241){if(_0x2d6241 instanceof SDKError)return console[_0x18424a(0x168)]('Error:\x20'+_0x2d6241[_0x18424a(0x18a)]),_0x2d6241[_0x18424a(0x1ca)]&&console[_0x18424a(0x168)]('\x20\x20Cause:\x20'+_0x2d6241[_0x18424a(0x1ca)]),0x1;throw _0x2d6241;}}}