@treasuredata/tdx 0.9.2 → 0.9.4

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 +86 -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 +60 -3
  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 +187 -6
  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
+ const a28_0x5d25e6=a28_0x3495;(function(_0x34d0f6,_0x2649c2){const _0xfb615c=a28_0x3495,_0x1b165c=_0x34d0f6();while(!![]){try{const _0x1aba7c=-parseInt(_0xfb615c(0x20e))/0x1+parseInt(_0xfb615c(0x20b))/0x2+parseInt(_0xfb615c(0x1e8))/0x3+-parseInt(_0xfb615c(0x1ea))/0x4+-parseInt(_0xfb615c(0x1f3))/0x5*(parseInt(_0xfb615c(0x1f7))/0x6)+parseInt(_0xfb615c(0x1dc))/0x7+parseInt(_0xfb615c(0x1f5))/0x8;if(_0x1aba7c===_0x2649c2)break;else _0x1b165c['push'](_0x1b165c['shift']());}catch(_0x17e549){_0x1b165c['push'](_0x1b165c['shift']());}}}(a28_0x4146,0x35b7f));function a28_0x4146(){const _0x4ceb53=['NOT_FOUND','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','start','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','290ldTGwE','log','1120192byxWut','green','12030QBdahp','projects','✓\x20Proxy\x20server\x20stopped','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','Port\x20','\x27\x20not\x20found','llm:proxy','\x20\x20Agents:','server','yellow','\x20\x20\x20\x20\x22env\x22:\x20{','\x0aTesting\x20with\x20Agent\x20SDK:','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','bold','description','Project\x20\x27','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','dim','created\x20on-demand\x20per\x20model','871650CuhcmO','init','cyan','422257dDUOzd','find','Resolving\x20project...','logger','llmProject','exit','logLevel','white','\x20\x20Site:','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','http://0.0.0.0:','\x20\x20}','\x0aClaude\x20Code\x20Configuration:','265979iKINWK','SIGTERM','execute','\x0a\x0aShutting\x20down\x20proxy\x20server...','site','\x20\x20Address:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','SIGINT','llm','close','Starting\x20proxy\x20server...','1017834zBwSkM','project','778184WGlwTT','name','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','port'];a28_0x4146=function(){return _0x4ceb53;};return a28_0x4146();}import a28_0x54582e 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(_0x13aae4,_0x17db52){const _0x3b8806=a28_0x3495,{tdx:_0x469e9d,options:_0x2f6039}=_0x13aae4,_0x3f6f9f=_0x17db52||_0x2f6039[_0x3b8806(0x212)];if(_0x3f6f9f){const _0xf6f666=await _0x469e9d[_0x3b8806(0x1e5)][_0x3b8806(0x1f8)](),_0x5916c4=_0xf6f666['find'](_0x46fb9e=>_0x46fb9e['attributes'][_0x3b8806(0x1eb)]===_0x3f6f9f);if(!_0x5916c4)throw new SDKError(ErrorCode[_0x3b8806(0x1ee)],_0x3b8806(0x206)+_0x3f6f9f+_0x3b8806(0x1fc),undefined,{'helpText':_0x3b8806(0x1ec)});return _0x5916c4['id'];}const _0x561b61=await _0x469e9d[_0x3b8806(0x1e5)]['getOrCreateDefaultProject']();return _0x561b61['id'];}function a28_0x3495(_0x356f1d,_0x50ac7f){_0x356f1d=_0x356f1d-0x1d9;const _0x41461b=a28_0x4146();let _0x3495fa=_0x41461b[_0x356f1d];return _0x3495fa;}export class LLMProxyCommand extends BaseCommand{[a28_0x5d25e6(0x1eb)]=a28_0x5d25e6(0x1fd);[a28_0x5d25e6(0x205)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';['server'];[a28_0x5d25e6(0x211)];async[a28_0x5d25e6(0x1de)](_0x3f570e){const _0x387a73=a28_0x5d25e6,{tdx:_0x5c968c,options:_0x1c3212}=_0x3f570e;try{const _0x4f5172=_0x1c3212,_0x413072=_0x4f5172[_0x387a73(0x1ed)]||0xfa0,_0x1e0434=_0x4f5172[_0x387a73(0x1e9)],_0x571375=await findAvailablePort(_0x413072);console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x210)));const _0x6be4df=await getProjectIdOrDefault(_0x3f570e,_0x1e0434),_0x29a322=await _0x5c968c[_0x387a73(0x1e5)][_0x387a73(0x1f8)](),_0x3a8f3a=_0x29a322[_0x387a73(0x20f)](_0x1c966a=>_0x1c966a['id']===_0x6be4df);this[_0x387a73(0x211)]=new TDXLogger(_0x1c3212[_0x387a73(0x214)]),await this[_0x387a73(0x211)][_0x387a73(0x20c)](),console['log'](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x1e7)));_0x571375!==_0x413072&&console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x200)](_0x387a73(0x1fb)+_0x413072+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x571375));this['server']=new ProxyServer({'port':_0x571375,'projectId':_0x6be4df,'tdx':_0x5c968c,'logger':this[_0x387a73(0x211)],'site':_0x1c3212[_0x387a73(0x1e0)]}),await this[_0x387a73(0x1ff)][_0x387a73(0x1f0)](),console[_0x387a73(0x1f4)](a28_0x54582e['yellow']['bold'](_0x387a73(0x1f1))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x200)](_0x387a73(0x203))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x200)](_0x387a73(0x1f2))),console[_0x387a73(0x1f4)](a28_0x54582e['green'][_0x387a73(0x204)]('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x20d)]('Server\x20Configuration:')),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x1e1)),a28_0x54582e[_0x387a73(0x215)](_0x387a73(0x1d9)+_0x571375)),console[_0x387a73(0x1f4)](a28_0x54582e['dim']('\x20\x20Project:'),a28_0x54582e['white'](_0x3a8f3a?.['attributes'][_0x387a73(0x1eb)]||_0x6be4df)),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x1fe)),a28_0x54582e[_0x387a73(0x215)](_0x387a73(0x20a))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x216)),a28_0x54582e[_0x387a73(0x215)](_0x1c3212[_0x387a73(0x1e0)])),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x20d)](_0x387a73(0x1db))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x1e2))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x215)]('\x20\x20{')),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x215)](_0x387a73(0x201))),console[_0x387a73(0x1f4)](a28_0x54582e['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x571375+'\x22,')),console['log'](a28_0x54582e[_0x387a73(0x215)](_0x387a73(0x1fa))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x215)](_0x387a73(0x207))),console[_0x387a73(0x1f4)](a28_0x54582e['white']('\x20\x20\x20\x20}')),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x215)](_0x387a73(0x1da))),console['log'](a28_0x54582e[_0x387a73(0x20d)](_0x387a73(0x202))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x217))),console['log'](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x1ef))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x209)](_0x387a73(0x1e3))),console[_0x387a73(0x1f4)](a28_0x54582e[_0x387a73(0x200)](_0x387a73(0x208)));const _0x2382cf=async()=>{const _0x54dafd=_0x387a73;console[_0x54dafd(0x1f4)](a28_0x54582e['dim'](_0x54dafd(0x1df))),this[_0x54dafd(0x1ff)]&&await this[_0x54dafd(0x1ff)]['stop'](),this[_0x54dafd(0x211)]&&await this[_0x54dafd(0x211)][_0x54dafd(0x1e6)](),console['log'](a28_0x54582e[_0x54dafd(0x1f6)](_0x54dafd(0x1f9))),process[_0x54dafd(0x213)](0x0);};return process['on'](_0x387a73(0x1e4),_0x2382cf),process['on'](_0x387a73(0x1dd),_0x2382cf),await new Promise(()=>{}),0x0;}catch(_0x3e2424){this[_0x387a73(0x1ff)]&&await this[_0x387a73(0x1ff)]['stop']();this['logger']&&await this[_0x387a73(0x211)][_0x387a73(0x1e6)]();throw _0x3e2424;}}}
@@ -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_0x367de6=a29_0x5e17;(function(_0xb7e2e6,_0x52d73c){const _0x14e270=a29_0x5e17,_0x36e10d=_0xb7e2e6();while(!![]){try{const _0x8c7734=parseInt(_0x14e270(0x1e5))/0x1*(parseInt(_0x14e270(0x2d7))/0x2)+parseInt(_0x14e270(0x24a))/0x3+parseInt(_0x14e270(0x207))/0x4+-parseInt(_0x14e270(0x2ba))/0x5+-parseInt(_0x14e270(0x2dc))/0x6+-parseInt(_0x14e270(0x272))/0x7+parseInt(_0x14e270(0x290))/0x8*(parseInt(_0x14e270(0x1e8))/0x9);if(_0x8c7734===_0x52d73c)break;else _0x36e10d['push'](_0x36e10d['shift']());}catch(_0xb5b95e){_0x36e10d['push'](_0x36e10d['shift']());}}}(a29_0x49f3,0x41220));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';function a29_0x49f3(){const _0x4ab331=['map','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','win32','Source:','workflowSessionId','\x0a⚠️\x20\x20Both\x20','✔\x20Created\x20parent\x20segment\x20\x27','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','open','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','ignore','Output\x20file:\x20','bold','attribute','apply','\x0aChanges\x20to\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','1241277YBZJww','segment:parent:list','processedRows','cyan','Options:\x0a','.yml','foreignKey','jsonl','Preview:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','displayPreviewResults','resolveParentId','segment:parent:update','\x20Opening\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','getParentSQL','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:preview','stats','Aborted.','utf-8','yellow','segment:parent:desc','Columns:','workflowId','sort','join','match','attributesFile','Table:\x20','localeCompare','web','Analyzing\x20changes...','database','text','Create\x20parent\x20segment\x20\x27','runParent','Apply\x20changes\x20to\x20\x27','execute','2668701FjhNfc','Attributes','tdx\x20segment\x20parent\x20preview\x20','toFixed','List\x20available\x20fields\x20for\x20segmentation','\x27\x20with\x20ID:\x20','\x0aNew\x20parent\x20segment\x20\x27','replace','in\x20','setJobId','displayColumns','\x20No\x20changes\x20-\x20','customerGroupFile','segment:parent:fields','Customers:','\x20\x20No\x20sample\x20data\x20available','red','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x27...','YAML\x20file:\x20','varchar','Database:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','verbose','Events:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','string','filter','Join:','Audience\x20ID:','8ubrOCd','\x20--interval\x20','length','behavior','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Enriched:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','green','toLocaleString','displayBehaviorsStats','Error:\x20File\x20not\x20found:\x20','errors','Updating\x20parent\x20segment\x20\x27','scheduleOption','jobId','darwin','Parent\x20segment:\x20','displayAttributesStats','Site:\x20','Attribute:','addBehaviorsFile','segment:parent:show','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','✔\x20Renamed\x20directory\x20to\x20','audienceId','using\x20the\x20default\x20path:\x20','joinKey','✔\x20Query\x20completed:\x20Processed\x20','session','behaviors','Join\x20on:','xdg-open','Name:\x20','displayMasterInfo','pullParentYaml','displayValidateResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','all','Fetching\x20sample\x20data...','Options:','\x27\x20is\x20up\x20to\x20date','table','1406450OpKGjx','scheduleType','master','%)\x20','\x20is\x20already\x20up\x20to\x20date','segment:parent:push','segment:parent:create','customerPercent','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Creating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Behaviors','\x20--enriched','unref','segment','column','Updating','test','timezone','rowCount','Session:','allValid','\x20field','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','output','/\x20→\x20','Status:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','2450ZmSTcW','SQL\x20query:\x0a','endsWith','description','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','2345538cennrk','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','repeat','\x0a⚠️\x20\x20Migrating:\x20','matchedCount','✔\x20No\x20changes\x20-\x20\x27','Error\x20parsing\x20YAML:\x20','\x20parent\x20segment\x20\x27','query','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x27\x20and\x20run\x20workflow?','Behavior:','✘\x20Failed\x20to\x20rename\x20directory:\x20','enriched','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','schemaError','platform','Master\x20+\x20Attributes','segment:parent:sql','message','dim','Created','workflowAttemptId','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displayPreviewHints','pushParentYaml','\x20\x20\x20\x20-\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Errors:','addAttributesFile','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Get\x20SQL\x20query\x20for\x20parent\x20segment','Creating','dirname','To\x20cancel:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','yes','Error:\x20Parent\x20segment\x20name\x20is\x20required','`\x20to\x20download\x20the\x20configuration\x20first','coveragePercent','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Rows:','100GOeoTT','\x20--behavior\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','4662612luqzkC','stop','Validate:','start','double','FINISHED','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','interval','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','log','segment:parent:validate','-1d','columns','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20Context\x20set:\x20','validateParentYaml','sampleData','parentSegment','\x20--attribute\x20\x22<name>\x22','/\x20directories\x20exist.','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','displaySummary','\x0aChanges\x20to\x20apply\x20to\x20\x27','/app/dw/parentSegments/','Updated','addBehaviors','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Attempt:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','parent_segment','1063652rFarab','site','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','run','Executing\x20parent\x20segment\x20query...','Listing\x20fields\x20for\x20\x27','json','elapsedTimeMillis','data','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Resolving\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','getParentFull','✔\x20Found\x20','\x20--behavior\x20\x22<name>\x22','segment:parent:view','displaySampleData','/attempt/','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Error\x20reading\x20file:\x20','\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','\x20=\x20','listParents','customerGroup','status','\x20rows)','Error:','Validating\x20configuration...','Error:\x20--database\x20and\x20--table\x20are\x20required','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','preview','Fetching\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','SELECT\x20*\x20FROM\x20(\x0a','information_schema','Listing\x20parent\x20segments\x20matching\x20\x27','attributes','customersWithEvents','format','segment:parent:run','totalEvents','schemaValid','label','Fetching\x20SQL\x20for\x20\x27','\x20parent\x20segment'];a29_0x49f3=function(){return _0x4ab331;};return a29_0x49f3();}import{spawn}from'child_process';import a29_0x31c5f7 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_0x454280 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x367de6(0x206);function openBrowser(_0x2fd43f){const _0x39b447=a29_0x367de6,_0x55d5cf=process[_0x39b447(0x2ed)],_0x84cfc6=_0x55d5cf===_0x39b447(0x29f)?_0x39b447(0x241):_0x55d5cf===_0x39b447(0x23a)?_0x39b447(0x1eb):_0x39b447(0x2af);spawn(_0x84cfc6,[_0x2fd43f],{'detached':!![],'stdio':_0x39b447(0x243)})[_0x39b447(0x2c7)]();}function migrateLegacyDirectory(){const _0x3063a8=a29_0x367de6;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3989ad=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3989ad['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x454280[_0x3063a8(0x260)](_0x3063a8(0x23d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x3063a8(0x1fb))),console['error'](a29_0x454280[_0x3063a8(0x1ce)](_0x3063a8(0x249)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x3063a8(0x25a)](a29_0x454280[_0x3063a8(0x260)](_0x3063a8(0x2df)+LEGACY_PARENT_SEGMENT_DIR+_0x3063a8(0x2d4)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a29_0x454280[_0x3063a8(0x297)](_0x3063a8(0x2a7)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x307257){const _0x16f4cb=_0x307257 instanceof Error?_0x307257[_0x3063a8(0x1cd)]:String(_0x307257);return console[_0x3063a8(0x25a)](a29_0x454280['red'](_0x3063a8(0x2e8)+_0x16f4cb+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x367de6(0x20a)](_0x331ee8){const _0xf00f64=a29_0x367de6;return migrateLegacyDirectory(),super[_0xf00f64(0x20a)](_0x331ee8);}}function resolveYamlFile(_0x1a2c2c){const _0x531ca6=a29_0x367de6;if(_0x1a2c2c['endsWith'](_0x531ca6(0x24f))||_0x1a2c2c[_0x531ca6(0x2d9)]('.yaml'))return _0x1a2c2c;return a29_0x31c5f7['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1a2c2c)+_0x531ca6(0x24f));}function formatProgressMessage(_0x143e94){const _0x219a05=a29_0x367de6,_0x5067f5=_0x143e94[_0x219a05(0x266)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5067f5){const [,_0x55aa3d,_0x5a88f4,_0x4aef75='']=_0x5067f5;return a29_0x454280[_0x219a05(0x1ce)](_0x55aa3d+':')+'\x20'+_0x5a88f4+a29_0x454280['dim'](_0x4aef75);}return a29_0x454280['dim'](_0x143e94);}function showFileNotFoundError(_0x9129eb,_0x559948){const _0x40cca0=a29_0x367de6;console[_0x40cca0(0x25a)](a29_0x454280['red'](_0x40cca0(0x29a)+_0x9129eb+'\x0a')),console[_0x40cca0(0x25a)](a29_0x454280[_0x40cca0(0x24d)](_0x40cca0(0x226)+_0x559948+_0x40cca0(0x1e1)));}function showParentSegmentNotSetError(_0x5199fa){const _0x532d4d=a29_0x367de6;console[_0x532d4d(0x25a)](a29_0x454280[_0x532d4d(0x260)](_0x532d4d(0x205))),console[_0x532d4d(0x25a)](_0x5199fa);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x24b);['description']='List\x20parent\x20segments';async[a29_0x367de6(0x271)](_0x53e9c0){const _0x482d85=a29_0x367de6,{options:_0x49691b,args:_0x3aaf05,tdx:_0x274151}=_0x53e9c0,_0x6a5bcf=_0x3aaf05[0x0];_0x49691b['verbose']&&(console[_0x482d85(0x25a)]('Site:\x20'+_0x49691b[_0x482d85(0x208)]),_0x6a5bcf&&console[_0x482d85(0x25a)]('Pattern:\x20'+_0x6a5bcf));const _0xd9eee1=await withSpinner(_0x6a5bcf?_0x482d85(0x22c)+_0x6a5bcf+_0x482d85(0x284):'Listing\x20parent\x20segments...',()=>_0x274151[_0x482d85(0x2c8)][_0x482d85(0x21f)](),{'verbose':_0x49691b[_0x482d85(0x289)]});let _0x17f4c6=_0xd9eee1[_0x482d85(0x20f)];if(_0x6a5bcf){const _0x16c7f1=_0x6a5bcf['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x482d85(0x279)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x46091e=new RegExp('^'+_0x16c7f1+'$','i');_0x17f4c6=_0x17f4c6[_0x482d85(0x28d)](_0x52f43c=>_0x46091e['test'](_0x52f43c[_0x482d85(0x22d)]['name']));}_0x17f4c6[_0x482d85(0x264)]((_0x4fe153,_0x2d302b)=>_0x4fe153[_0x482d85(0x22d)][_0x482d85(0x238)][_0x482d85(0x269)](_0x2d302b['attributes'][_0x482d85(0x238)])),console[_0x482d85(0x25a)](_0x482d85(0x215)+_0x17f4c6[_0x482d85(0x292)]+_0x482d85(0x235)+(_0x17f4c6[_0x482d85(0x292)]!==0x1?'s':''));if(_0x49691b[_0x482d85(0x22f)]==='json'||_0x49691b['format']===_0x482d85(0x251))await handleSDKOutput(_0x17f4c6,_0x49691b);else{if(_0x17f4c6['length']===0x0)_0x6a5bcf?console['log'](_0x482d85(0x1d6)+_0x6a5bcf):console['log']('No\x20parent\x20segments\x20found');else for(const _0xc10964 of _0x17f4c6){const _0x10fc95=_0xc10964[_0x482d85(0x22d)]['population']?a29_0x454280[_0x482d85(0x1ce)]('\x20('+formatRows(_0xc10964['attributes']['population'])+')'):'';console[_0x482d85(0x1f1)]('👥\x20'+_0xc10964[_0x482d85(0x22d)]['name']+_0x10fc95);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x2c0);[a29_0x367de6(0x2da)]=a29_0x367de6(0x258);async['execute'](_0x352bdc){const _0x50525e=a29_0x367de6,{options:_0x24215b,args:_0x58486c,tdx:_0x16b3b4}=_0x352bdc;console[_0x50525e(0x25a)](_0x50525e(0x210)+_0x50525e(0x237)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x42cf61=_0x24215b;if(_0x58486c['length']===0x0)return console[_0x50525e(0x25a)](a29_0x454280[_0x50525e(0x282)](_0x50525e(0x1e0))),console[_0x50525e(0x25a)](_0x50525e(0x1de)),0x1;const _0x2298d4=_0x58486c[0x0];if(!_0x42cf61[_0x50525e(0x26c)]||!_0x42cf61[_0x50525e(0x2b9)])return console[_0x50525e(0x25a)](_0x50525e(0x225)),console[_0x50525e(0x25a)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x42cf61['verbose']&&(console[_0x50525e(0x25a)](_0x50525e(0x2a2)+_0x42cf61[_0x50525e(0x208)]),console[_0x50525e(0x25a)](_0x50525e(0x2b0)+_0x2298d4),console[_0x50525e(0x25a)](_0x50525e(0x287)+_0x42cf61['database']),console[_0x50525e(0x25a)](_0x50525e(0x268)+_0x42cf61[_0x50525e(0x2b9)]));const _0x18c0c7=await loadJSONFromOptions(_0x42cf61[_0x50525e(0x22d)],_0x42cf61[_0x50525e(0x267)]),_0x477729=await loadJSONFromOptions(_0x42cf61[_0x50525e(0x2ad)],_0x42cf61['behaviorsFile']),_0x58b4c5=await loadJSONFromOptions(_0x42cf61[_0x50525e(0x220)],_0x42cf61[_0x50525e(0x27e)]),_0x51c59b={'name':_0x2298d4,'description':_0x42cf61['description'],'scheduleType':_0x42cf61[_0x50525e(0x2bb)],'scheduleOption':_0x42cf61[_0x50525e(0x29d)],'timezone':_0x42cf61['timezone'],'master':{'parentDatabaseName':_0x42cf61[_0x50525e(0x26c)],'parentTableName':_0x42cf61[_0x50525e(0x2b9)]},'attributes':_0x18c0c7,'behaviors':_0x477729,'customerGroup':_0x58b4c5},_0x22ee36=await withSpinner(_0x50525e(0x2c3)+_0x2298d4+'\x27...',()=>_0x16b3b4[_0x50525e(0x2c8)]['createParent'](_0x51c59b),{'verbose':_0x24215b[_0x50525e(0x289)]}),_0x35fd4a=_0x22ee36['data'];return console[_0x50525e(0x25a)](_0x50525e(0x23e)+_0x35fd4a[_0x50525e(0x238)]+_0x50525e(0x277)+_0x35fd4a['id']),await handleSDKOutput([_0x35fd4a],_0x24215b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x256);['description']=a29_0x367de6(0x2db);async[a29_0x367de6(0x271)](_0xbe181){const _0x4d1eea=a29_0x367de6,{options:_0x4e9557,args:_0x2036df,tdx:_0x10f15e}=_0xbe181;console[_0x4d1eea(0x25a)](_0x4d1eea(0x1fc)+'\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 _0x341bc1=_0x4e9557;if(_0x2036df['length']===0x0)return console[_0x4d1eea(0x25a)](a29_0x454280[_0x4d1eea(0x282)](_0x4d1eea(0x1e0))),console[_0x4d1eea(0x25a)](_0x4d1eea(0x1f5)),0x1;const _0x24d32c=_0x2036df[0x0];_0x341bc1[_0x4d1eea(0x289)]&&(console[_0x4d1eea(0x25a)](_0x4d1eea(0x2a2)+_0x341bc1[_0x4d1eea(0x208)]),console['error'](_0x4d1eea(0x2a0)+_0x24d32c));const _0x565ccf=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x24d32c+_0x4d1eea(0x284),()=>_0x10f15e[_0x4d1eea(0x2c8)][_0x4d1eea(0x214)](_0x24d32c),{'verbose':_0x341bc1['verbose']}),_0x92afd7=_0x565ccf[_0x4d1eea(0x20f)],_0x378094=await loadJSONFromOptions(_0x341bc1['addAttributes'],_0x341bc1[_0x4d1eea(0x1d8)]),_0x5d488c=await loadJSONFromOptions(_0x341bc1[_0x4d1eea(0x201)],_0x341bc1[_0x4d1eea(0x2a4)]),_0x30a431={'name':_0x92afd7[_0x4d1eea(0x238)],'description':_0x341bc1[_0x4d1eea(0x2da)]!==undefined?_0x341bc1[_0x4d1eea(0x2da)]:_0x92afd7[_0x4d1eea(0x2da)],'scheduleType':_0x341bc1['scheduleType']!==undefined?_0x341bc1['scheduleType']:_0x92afd7[_0x4d1eea(0x2bb)],'scheduleOption':_0x341bc1[_0x4d1eea(0x29d)]!==undefined?_0x341bc1[_0x4d1eea(0x29d)]:_0x92afd7[_0x4d1eea(0x29d)],'timezone':_0x341bc1[_0x4d1eea(0x2cc)]!==undefined?_0x341bc1[_0x4d1eea(0x2cc)]:_0x92afd7[_0x4d1eea(0x2cc)],'master':_0x92afd7[_0x4d1eea(0x2bc)],'attributes':_0x378094?[..._0x92afd7['attributes']||[],..._0x378094]:_0x92afd7[_0x4d1eea(0x22d)],'behaviors':_0x5d488c?[..._0x92afd7['behaviors']||[],..._0x5d488c]:_0x92afd7[_0x4d1eea(0x2ad)],'customerGroup':_0x92afd7[_0x4d1eea(0x220)]},_0x1b6137=await withSpinner(_0x4d1eea(0x29c)+_0x24d32c+'\x27...',()=>_0x10f15e[_0x4d1eea(0x2c8)]['updateParent'](_0x24d32c,_0x30a431),{'verbose':_0x341bc1[_0x4d1eea(0x289)]}),_0x1d0764=_0x1b6137['data'];return console[_0x4d1eea(0x25a)](_0x4d1eea(0x202)+_0x1d0764[_0x4d1eea(0x238)]+'\x27'),await handleSDKOutput([_0x1d0764],_0x341bc1),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]='segment:parent:pull';[a29_0x367de6(0x2da)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a29_0x367de6(0x271)](_0x40563f){const _0x5f0fa4=a29_0x367de6,{options:_0x527f31,args:_0x321459,tdx:_0x2265e1}=_0x40563f,_0x201d8a=_0x527f31,_0x178bf5=_0x321459[0x0]||_0x527f31['parentSegment'];if(!_0x178bf5)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'+_0x5f0fa4(0x28b)),0x1;if(_0x201d8a['use']&&_0x201d8a[_0x5f0fa4(0x2d3)])return console[_0x5f0fa4(0x25a)](a29_0x454280['red'](_0x5f0fa4(0x2c2))),console[_0x5f0fa4(0x25a)](a29_0x454280[_0x5f0fa4(0x1ce)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x5f0fa4(0x25a)](a29_0x454280['dim'](_0x5f0fa4(0x2a9)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x5f0fa4(0x25a)](a29_0x454280[_0x5f0fa4(0x24d)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0xd17662=_0x201d8a[_0x5f0fa4(0x2d3)]||a29_0x31c5f7[_0x5f0fa4(0x265)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x178bf5)+_0x5f0fa4(0x24f));_0x201d8a[_0x5f0fa4(0x289)]&&(console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x2a2)+_0x201d8a[_0x5f0fa4(0x208)]),console['error']('Parent\x20segment:\x20'+_0x178bf5),console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x244)+_0xd17662));const _0x584968=await withSpinner(_0x5f0fa4(0x228)+_0x178bf5+'\x27...',()=>_0x2265e1[_0x5f0fa4(0x2c8)][_0x5f0fa4(0x2b2)](_0x178bf5),{'verbose':_0x201d8a['verbose']}),_0x23e880=_0x584968['data'];if(existsSync(_0xd17662)){const _0x4e47ea=readFileSync(_0xd17662,'utf-8'),_0x26ac58=generateDiff(_0x4e47ea,_0x23e880);if(!hasChanges(_0x26ac58))console[_0x5f0fa4(0x25a)](a29_0x454280['green']('✔')+_0x5f0fa4(0x27d)+a29_0x454280['cyan'](_0xd17662)+_0x5f0fa4(0x2be));else{console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x248)+_0xd17662+'\x27:'),console[_0x5f0fa4(0x25a)]('─'[_0x5f0fa4(0x2de)](0x3c)),console['error'](formatDiffWithColors(_0x26ac58)),console[_0x5f0fa4(0x25a)]('─'[_0x5f0fa4(0x2de)](0x3c));if(!_0x201d8a[_0x5f0fa4(0x1df)]){const _0x3cdd98=await confirmKey('Overwrite\x20\x27'+_0xd17662+'\x27?');if(!_0x3cdd98)return console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x25e)),0x1;}writeFileSync(_0xd17662,_0x23e880,_0x5f0fa4(0x25f)),console['error'](a29_0x454280[_0x5f0fa4(0x297)]('✔')+_0x5f0fa4(0x2ea)+a29_0x454280['cyan'](_0xd17662));}}else{const _0x1355e0=a29_0x31c5f7[_0x5f0fa4(0x1dc)](_0xd17662);!existsSync(_0x1355e0)&&mkdirSync(_0x1355e0,{'recursive':!![]}),writeFileSync(_0xd17662,_0x23e880,_0x5f0fa4(0x25f)),console['error'](a29_0x454280['green']('✔')+_0x5f0fa4(0x2ea)+a29_0x454280[_0x5f0fa4(0x24d)](_0xd17662));}return saveSessionContext({'parent_segment':_0x178bf5},_0x201d8a[_0x5f0fa4(0x2ac)]),console[_0x5f0fa4(0x25a)](a29_0x454280[_0x5f0fa4(0x297)]('✔')+_0x5f0fa4(0x1f6)+a29_0x454280[_0x5f0fa4(0x1ce)](_0x5f0fa4(0x206))+_0x5f0fa4(0x21e)+a29_0x454280[_0x5f0fa4(0x24d)](_0x178bf5)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x2bf);['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0xd82408){const _0x2081ac=a29_0x367de6,{options:_0x2e5ad7,args:_0x7b0c82,tdx:_0xf363e5}=_0xd82408,_0x43db2f=_0x2e5ad7,_0x23afc8=_0x7b0c82[0x0]||_0x2e5ad7[_0x2081ac(0x1f9)];if(!_0x23afc8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2081ac(0x2b4)),0x1;const _0x4c0591=resolveYamlFile(_0x23afc8);if(!existsSync(_0x4c0591))return showFileNotFoundError(_0x4c0591,_0x23afc8),0x1;_0x43db2f[_0x2081ac(0x289)]&&(console['error'](_0x2081ac(0x2a2)+_0x43db2f[_0x2081ac(0x208)]),console[_0x2081ac(0x25a)](_0x2081ac(0x285)+_0x4c0591));let _0x3ff4fd;try{_0x3ff4fd=readFileSync(_0x4c0591,_0x2081ac(0x25f));}catch(_0x1b2e3f){const _0x2e8026=_0x1b2e3f instanceof Error?_0x1b2e3f[_0x2081ac(0x1cd)]:String(_0x1b2e3f);return console['error'](_0x2081ac(0x21b)+_0x2e8026),0x1;}const _0x5997cf=await withSpinner(_0x2081ac(0x26b),()=>_0xf363e5[_0x2081ac(0x2c8)][_0x2081ac(0x1d4)](_0x3ff4fd),{'verbose':_0x43db2f[_0x2081ac(0x289)]}),_0x56d3b2=_0x5997cf[_0x2081ac(0x20f)],{isNew:_0x2256fc,name:_0x507cc4,hasChanges:_0x216d9d,diffFormatted:_0xd88ebb}=_0x56d3b2;if(!_0x216d9d)return console[_0x2081ac(0x25a)](_0x2081ac(0x2e1)+_0x507cc4+_0x2081ac(0x229)),0x0;_0x2256fc?console[_0x2081ac(0x25a)](_0x2081ac(0x278)+_0x507cc4+'\x27:'):console[_0x2081ac(0x25a)](_0x2081ac(0x1fe)+_0x507cc4+'\x27:');console[_0x2081ac(0x25a)]('─'[_0x2081ac(0x2de)](0x3c)),console[_0x2081ac(0x25a)](_0xd88ebb),console['error']('─'[_0x2081ac(0x2de)](0x3c));const _0x4d160a=_0x2256fc?_0x2081ac(0x26e)+_0x507cc4+'\x27?':_0x2081ac(0x270)+_0x507cc4+'\x27?';if(!_0x43db2f[_0x2081ac(0x1df)]){const _0x594701=await confirmKey(_0x4d160a);if(!_0x594701)return console[_0x2081ac(0x25a)](_0x2081ac(0x25e)),0x1;}const _0x44ee7d=_0x2256fc?_0x2081ac(0x1db):'Updating',_0x22c2d6=await withSpinner(_0x44ee7d+_0x2081ac(0x2e3)+_0x507cc4+_0x2081ac(0x284),()=>_0x56d3b2[_0x2081ac(0x247)](),{'verbose':_0x43db2f['verbose']}),_0x34fb6f=_0x22c2d6[_0x2081ac(0x20f)],_0x4d3e72=getConsoleNextUrl(_0x43db2f[_0x2081ac(0x208)],_0x2081ac(0x1ff)+_0x34fb6f['id']),_0x47c89c=_0x2256fc?_0x2081ac(0x1cf):'Updated';return console[_0x2081ac(0x25a)]('✔\x20'+_0x47c89c+_0x2081ac(0x2e3)+_0x34fb6f['name']+'\x27'),console[_0x2081ac(0x25a)]('\x20\x20'+_0x4d3e72),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x1f2);[a29_0x367de6(0x2da)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x23648d){const _0x517b24=a29_0x367de6,{options:_0x5a4fd6,args:_0x3943ed,tdx:_0x151307}=_0x23648d,_0x2ddf53=_0x5a4fd6,_0x5de2b9=_0x3943ed[0x0]||_0x5a4fd6[_0x517b24(0x1f9)];if(!_0x5de2b9)return showParentSegmentNotSetError(_0x517b24(0x240)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x517b24(0x24e)+_0x517b24(0x1f0)+_0x517b24(0x23f)+_0x517b24(0x242)),0x1;const _0x2f9441=resolveYamlFile(_0x5de2b9);if(!existsSync(_0x2f9441))return showFileNotFoundError(_0x2f9441,_0x5de2b9),0x1;_0x2ddf53[_0x517b24(0x289)]&&(console[_0x517b24(0x25a)](_0x517b24(0x2a2)+_0x2ddf53[_0x517b24(0x208)]),console[_0x517b24(0x25a)]('YAML\x20file:\x20'+_0x2f9441));let _0x3206b0;try{_0x3206b0=readFileSync(_0x2f9441,_0x517b24(0x25f));}catch(_0x41aea0){const _0x15ce8f=_0x41aea0 instanceof Error?_0x41aea0['message']:String(_0x41aea0);return console['error'](_0x517b24(0x21b)+_0x15ce8f),0x1;}const _0x43e5c0=createCommandSpinner(a29_0x454280[_0x517b24(0x1ce)](_0x517b24(0x224)),{'verbose':_0x2ddf53['verbose']});_0x43e5c0['start']();const _0x3c7786={'onProgress':_0x4f9be6=>{const _0x4bfd6e=_0x517b24;_0x43e5c0[_0x4bfd6e(0x26d)]=formatProgressMessage(_0x4f9be6);}};if(_0x2ddf53[_0x517b24(0x2bc)])_0x3c7786[_0x517b24(0x2bc)]=!![];if(_0x2ddf53[_0x517b24(0x2e9)])_0x3c7786['enriched']=!![];_0x2ddf53[_0x517b24(0x246)]&&(_0x3c7786['attribute']=_0x2ddf53[_0x517b24(0x246)]);_0x2ddf53['behavior']&&(_0x3c7786['behavior']=_0x2ddf53[_0x517b24(0x293)]);if(_0x2ddf53[_0x517b24(0x1ef)])_0x3c7786[_0x517b24(0x1ef)]=_0x2ddf53[_0x517b24(0x1ef)];let _0x350c60;try{_0x350c60=await _0x151307['segment'][_0x517b24(0x1f7)](_0x3206b0,_0x3c7786),_0x43e5c0['stop']();}catch(_0x275b6d){_0x43e5c0[_0x517b24(0x1e9)]();throw _0x275b6d;}const _0x4c2c76=_0x2ddf53['interval']||_0x517b24(0x1f3);return this['displayValidateResults'](_0x350c60,_0x3c7786,_0x2f9441,_0x4c2c76),_0x350c60[_0x517b24(0x2cf)]?0x0:0x1;}[a29_0x367de6(0x2b3)](_0x4c428f,_0x36cc2a,_0x421fc4,_0x458b6b){const _0x29b8bc=a29_0x367de6;console['error']('\x0a'+a29_0x454280[_0x29b8bc(0x245)](_0x29b8bc(0x1ea))+'\x20'+_0x4c428f['name']),console['error']('═'[_0x29b8bc(0x2de)](0x3c)),this[_0x29b8bc(0x2b1)](_0x4c428f);if(typeof _0x36cc2a[_0x29b8bc(0x246)]==='string'){this[_0x29b8bc(0x2a1)](_0x4c428f),this['displaySummary'](_0x4c428f),this[_0x29b8bc(0x1d3)](_0x421fc4,_0x458b6b,_0x29b8bc(0x246),_0x36cc2a[_0x29b8bc(0x246)]);return;}if(_0x36cc2a[_0x29b8bc(0x246)]===!![]){this[_0x29b8bc(0x2a1)](_0x4c428f),this['displaySummary'](_0x4c428f),this[_0x29b8bc(0x1d3)](_0x421fc4,_0x458b6b,'attributes');return;}if(typeof _0x36cc2a[_0x29b8bc(0x293)]===_0x29b8bc(0x28c)){this[_0x29b8bc(0x299)](_0x4c428f,_0x458b6b),this[_0x29b8bc(0x1fd)](_0x4c428f),this['displayPreviewHints'](_0x421fc4,_0x458b6b,_0x29b8bc(0x293),_0x36cc2a['behavior']);return;}if(_0x36cc2a[_0x29b8bc(0x293)]===!![]){this[_0x29b8bc(0x299)](_0x4c428f,_0x458b6b),this['displaySummary'](_0x4c428f),this['displayPreviewHints'](_0x421fc4,_0x458b6b,_0x29b8bc(0x2ad));return;}this['displayAttributesStats'](_0x4c428f),this['displayBehaviorsStats'](_0x4c428f,_0x458b6b),this[_0x29b8bc(0x1fd)](_0x4c428f),this[_0x29b8bc(0x1d3)](_0x421fc4,_0x458b6b,_0x29b8bc(0x2b5));}[a29_0x367de6(0x1d3)](_0x2fd187,_0x4bea79,_0x47dbf6,_0x29538a){const _0x45c4e1=a29_0x367de6;console[_0x45c4e1(0x25a)]('\x0a'+a29_0x454280['dim']('To\x20view\x20sample\x20data:'));const _0x46923d=_0x4bea79!==_0x45c4e1(0x1f3)?_0x45c4e1(0x291)+_0x4bea79:'';if(_0x47dbf6==='attribute'&&_0x29538a)console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280['dim'](_0x45c4e1(0x274)+_0x2fd187+'\x20--attribute\x20\x22'+_0x29538a+'\x22'+_0x46923d));else{if(_0x47dbf6===_0x45c4e1(0x293)&&_0x29538a)console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280[_0x45c4e1(0x1ce)](_0x45c4e1(0x274)+_0x2fd187+_0x45c4e1(0x1e6)+_0x29538a+'\x22'+_0x46923d));else(_0x47dbf6===_0x45c4e1(0x22d)||_0x47dbf6==='all')&&console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280[_0x45c4e1(0x1ce)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2fd187+_0x45c4e1(0x1fa)+_0x46923d));}(_0x47dbf6===_0x45c4e1(0x2ad)||_0x47dbf6===_0x45c4e1(0x2b5))&&console['error']('\x20\x20'+a29_0x454280['dim'](_0x45c4e1(0x274)+_0x2fd187+_0x45c4e1(0x216)+_0x46923d)),_0x47dbf6===_0x45c4e1(0x2b5)&&console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280['dim'](_0x45c4e1(0x274)+_0x2fd187+_0x45c4e1(0x2c6)+_0x46923d));}[a29_0x367de6(0x2b1)](_0x280b69){const _0x6fdaf6=a29_0x367de6,{master:_0x25f3c9}=_0x280b69,_0x240777=_0x25f3c9[_0x6fdaf6(0x232)]?a29_0x454280[_0x6fdaf6(0x297)]('✔'):a29_0x454280[_0x6fdaf6(0x282)]('✘');console[_0x6fdaf6(0x25a)]('\x0a'+a29_0x454280[_0x6fdaf6(0x1ce)]('Master\x20Table')),console[_0x6fdaf6(0x25a)](_0x240777+'\x20'+a29_0x454280[_0x6fdaf6(0x245)](_0x25f3c9[_0x6fdaf6(0x26c)]+'.'+_0x25f3c9[_0x6fdaf6(0x2b9)])),_0x25f3c9['schemaValid']?_0x25f3c9[_0x6fdaf6(0x2cd)]!==undefined&&console['error']('\x20\x20'+a29_0x454280['dim'](_0x6fdaf6(0x1e4))+'\x20'+a29_0x454280[_0x6fdaf6(0x24d)](formatRows(_0x25f3c9[_0x6fdaf6(0x2cd)]))):console[_0x6fdaf6(0x25a)]('\x20\x20'+a29_0x454280[_0x6fdaf6(0x282)]('Error:')+'\x20'+_0x25f3c9[_0x6fdaf6(0x2ec)]);}[a29_0x367de6(0x2a1)](_0x35a044){const _0x56db89=a29_0x367de6;if(_0x35a044['attributes'][_0x56db89(0x292)]===0x0)return;console[_0x56db89(0x25a)]('\x0a'+a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x273)));for(const _0x140bbc of _0x35a044[_0x56db89(0x22d)]){const _0x29e85b=_0x140bbc[_0x56db89(0x232)]?a29_0x454280[_0x56db89(0x297)]('✔'):a29_0x454280['red']('✘');let _0x43c67e='';if(_0x140bbc[_0x56db89(0x232)]&&_0x140bbc['matchedCount']!==undefined&&_0x140bbc['coveragePercent']!==undefined){const _0x57379b=_0x140bbc[_0x56db89(0x1e2)]['toFixed'](0x1),_0x188fb8=_0x140bbc[_0x56db89(0x1e2)]>=0x50?a29_0x454280['green']:_0x140bbc[_0x56db89(0x1e2)]>=0x32?a29_0x454280[_0x56db89(0x260)]:a29_0x454280[_0x56db89(0x282)];_0x43c67e='\x20'+a29_0x454280[_0x56db89(0x1ce)]('Coverage:')+'\x20'+_0x188fb8(_0x57379b+'%')+'\x20('+formatRows(_0x140bbc[_0x56db89(0x2e0)])+_0x56db89(0x222);}console[_0x56db89(0x25a)](_0x29e85b+'\x20'+a29_0x454280[_0x56db89(0x245)](_0x140bbc[_0x56db89(0x238)])+_0x43c67e),console[_0x56db89(0x25a)]('\x20\x20'+a29_0x454280[_0x56db89(0x1ce)]('Source:')+'\x20'+a29_0x454280['bold'](_0x140bbc[_0x56db89(0x26c)]+'.'+_0x140bbc[_0x56db89(0x2b9)]));const _0x1dbd57=_0x140bbc[_0x56db89(0x2aa)]===_0x140bbc[_0x56db89(0x250)]?a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x2ae))+'\x20'+_0x140bbc[_0x56db89(0x2aa)]:a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x28e))+'\x20'+_0x140bbc[_0x56db89(0x2aa)]+_0x56db89(0x21e)+_0x140bbc[_0x56db89(0x250)];console['error']('\x20\x20'+_0x1dbd57),console['error']('\x20\x20'+a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x262))),this[_0x56db89(0x27c)](_0x140bbc[_0x56db89(0x1f4)]),!_0x140bbc[_0x56db89(0x232)]&&console['error']('\x20\x20'+a29_0x454280[_0x56db89(0x282)]('Error:')+'\x20'+_0x140bbc[_0x56db89(0x2ec)]);}}[a29_0x367de6(0x299)](_0x4859f4,_0x333efd){const _0x581163=a29_0x367de6;if(_0x4859f4[_0x581163(0x2ad)][_0x581163(0x292)]===0x0)return;console['error']('\x0a'+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x2c5))+'\x20'+a29_0x454280[_0x581163(0x1ce)]('('+_0x333efd+')'));for(const _0x2d2313 of _0x4859f4[_0x581163(0x2ad)]){const _0x470386=_0x2d2313[_0x581163(0x232)]?a29_0x454280['green']('✔'):a29_0x454280['red']('✘');let _0x4d956d='';if(_0x2d2313[_0x581163(0x232)]&&_0x2d2313['customersWithEvents']!==undefined&&_0x2d2313[_0x581163(0x231)]!==undefined){const _0xa4b1ba=_0x2d2313[_0x581163(0x2c1)]?.[_0x581163(0x275)](0x1)||'?',_0x4256ca=(_0x2d2313[_0x581163(0x2c1)]??0x0)>=0x32?a29_0x454280[_0x581163(0x297)]:(_0x2d2313[_0x581163(0x2c1)]??0x0)>=0x14?a29_0x454280['yellow']:a29_0x454280[_0x581163(0x282)];_0x4d956d='\x20'+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x280))+'\x20'+_0x4256ca(formatRows(_0x2d2313[_0x581163(0x22e)]))+'\x20('+_0xa4b1ba+_0x581163(0x2bd)+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x28a))+'\x20'+a29_0x454280[_0x581163(0x24d)](formatRows(_0x2d2313['totalEvents']));}console['error'](_0x470386+'\x20'+a29_0x454280[_0x581163(0x245)](_0x2d2313[_0x581163(0x238)])+_0x4d956d),console[_0x581163(0x25a)]('\x20\x20'+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x23b))+'\x20'+a29_0x454280[_0x581163(0x245)](_0x2d2313[_0x581163(0x26c)]+'.'+_0x2d2313['table']));const _0x567b64=_0x2d2313[_0x581163(0x2aa)]===_0x2d2313['foreignKey']?a29_0x454280[_0x581163(0x1ce)](_0x581163(0x2ae))+'\x20'+_0x2d2313['joinKey']:a29_0x454280[_0x581163(0x1ce)](_0x581163(0x28e))+'\x20'+_0x2d2313[_0x581163(0x2aa)]+'\x20=\x20'+_0x2d2313[_0x581163(0x250)];console[_0x581163(0x25a)]('\x20\x20'+_0x567b64),console[_0x581163(0x25a)]('\x20\x20'+a29_0x454280[_0x581163(0x1ce)]('Columns:')),this[_0x581163(0x27c)](_0x2d2313['columns']),!_0x2d2313[_0x581163(0x232)]&&console[_0x581163(0x25a)]('\x20\x20'+a29_0x454280[_0x581163(0x282)](_0x581163(0x223))+'\x20'+_0x2d2313['schemaError']);}}[a29_0x367de6(0x27c)](_0x5032f7){const _0x418b3c=a29_0x367de6;for(const _0x8ae6a of _0x5032f7){_0x8ae6a['label']===_0x8ae6a[_0x418b3c(0x2c9)]||_0x8ae6a[_0x418b3c(0x2c9)]==='*'?console[_0x418b3c(0x25a)](_0x418b3c(0x1d5)+_0x8ae6a[_0x418b3c(0x233)]):console['error']('\x20\x20\x20\x20-\x20'+_0x8ae6a[_0x418b3c(0x233)]+'\x20'+a29_0x454280[_0x418b3c(0x1ce)]('('+_0x8ae6a['column']+')'));}}['displaySummary'](_0x2aed15){const _0x4bb93e=a29_0x367de6;console[_0x4bb93e(0x25a)]('─'[_0x4bb93e(0x2de)](0x3c));if(_0x2aed15['errors']['length']>0x0){console[_0x4bb93e(0x25a)]('\x0a'+a29_0x454280[_0x4bb93e(0x282)](_0x4bb93e(0x1d7)));for(const _0xe773df of _0x2aed15[_0x4bb93e(0x29b)]){console['error']('\x20\x20'+a29_0x454280[_0x4bb93e(0x282)]('•')+'\x20'+_0xe773df);}}_0x2aed15[_0x4bb93e(0x2cf)]&&console[_0x4bb93e(0x25a)]('\x0a'+a29_0x454280[_0x4bb93e(0x297)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x25c);[a29_0x367de6(0x2da)]=a29_0x367de6(0x283);async[a29_0x367de6(0x271)](_0x54113a){const _0x1ddd85=a29_0x367de6,{options:_0x27edfb,args:_0x47d8dc,tdx:_0x213423}=_0x54113a,_0x47e210=_0x27edfb,_0x5a45a0=_0x47d8dc[0x0]||_0x27edfb[_0x1ddd85(0x1f9)];if(!_0x5a45a0)return showParentSegmentNotSetError(_0x1ddd85(0x1e3)+_0x1ddd85(0x239)+'Options\x20(one\x20required):\x0a'+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x1ddd85(0x203)+_0x1ddd85(0x1ee)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x1ddd85(0x242)),0x1;if(!_0x47e210[_0x1ddd85(0x2bc)]&&!_0x47e210[_0x1ddd85(0x246)]&&!_0x47e210[_0x1ddd85(0x293)]&&!_0x47e210[_0x1ddd85(0x2e9)])return console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x209))),console[_0x1ddd85(0x25a)](_0x1ddd85(0x2c4)),console[_0x1ddd85(0x25a)](_0x1ddd85(0x2b7)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x1ddd85(0x25a)](_0x1ddd85(0x211)),console[_0x1ddd85(0x25a)](_0x1ddd85(0x296)),console[_0x1ddd85(0x25a)](_0x1ddd85(0x294)),0x1;const _0x286ab2=resolveYamlFile(_0x5a45a0);if(!existsSync(_0x286ab2))return showFileNotFoundError(_0x286ab2,_0x5a45a0),0x1;_0x47e210[_0x1ddd85(0x289)]&&(console[_0x1ddd85(0x25a)](_0x1ddd85(0x2a2)+_0x47e210[_0x1ddd85(0x208)]),console[_0x1ddd85(0x25a)]('YAML\x20file:\x20'+_0x286ab2));let _0x41f09a;try{_0x41f09a=readFileSync(_0x286ab2,_0x1ddd85(0x25f));}catch(_0x1676cd){const _0x38a59a=_0x1676cd instanceof Error?_0x1676cd[_0x1ddd85(0x1cd)]:String(_0x1676cd);return console['error']('Error\x20reading\x20file:\x20'+_0x38a59a),0x1;}let _0x591780;try{_0x591780=parseYamlString(_0x41f09a);}catch(_0x439848){const _0x2d2dad=_0x439848 instanceof Error?_0x439848[_0x1ddd85(0x1cd)]:String(_0x439848);return console[_0x1ddd85(0x25a)](a29_0x454280['red'](_0x1ddd85(0x2e2)+_0x2d2dad)),0x1;}if(_0x47e210[_0x1ddd85(0x246)]===!![]||_0x47e210[_0x1ddd85(0x246)]===''){const _0x35de20=_0x591780[_0x1ddd85(0x22d)]?.[_0x1ddd85(0x236)](_0x22b462=>_0x22b462[_0x1ddd85(0x238)])||[];if(_0x35de20[_0x1ddd85(0x292)]===0x0)console['error'](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x1d2)));else{console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x2d6))),console[_0x1ddd85(0x25a)]('Available\x20attributes:');for(const _0x275ddd of _0x35de20){console[_0x1ddd85(0x25a)]('\x20\x20'+a29_0x454280[_0x1ddd85(0x24d)](_0x275ddd));}console[_0x1ddd85(0x25a)](_0x1ddd85(0x2e5)+_0x5a45a0+'\x20--attribute\x20\x22'+_0x35de20[0x0]+'\x22');}return 0x1;}if(_0x47e210[_0x1ddd85(0x293)]===!![]||_0x47e210[_0x1ddd85(0x293)]===''){const _0x5b30d4=_0x591780['behaviors']?.[_0x1ddd85(0x236)](_0x481a44=>_0x481a44[_0x1ddd85(0x238)])||[];if(_0x5b30d4[_0x1ddd85(0x292)]===0x0)console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x1d9)));else{console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x21a))),console['error']('Available\x20behaviors:');for(const _0x2636e8 of _0x5b30d4){console[_0x1ddd85(0x25a)]('\x20\x20'+a29_0x454280['cyan'](_0x2636e8));}console[_0x1ddd85(0x25a)](_0x1ddd85(0x2e5)+_0x5a45a0+_0x1ddd85(0x1e6)+_0x5b30d4[0x0]+'\x22');}return 0x1;}const _0xd31eb9=createCommandSpinner(a29_0x454280[_0x1ddd85(0x1ce)](_0x1ddd85(0x2b6)),{'verbose':_0x47e210[_0x1ddd85(0x289)]});_0xd31eb9['start']();const _0x184d15={'onProgress':_0xaef133=>{const _0x67d70c=_0x1ddd85;_0xd31eb9[_0x67d70c(0x26d)]=formatProgressMessage(_0xaef133);}};if(_0x47e210[_0x1ddd85(0x2bc)])_0x184d15[_0x1ddd85(0x2bc)]=!![];if(_0x47e210[_0x1ddd85(0x246)]&&typeof _0x47e210[_0x1ddd85(0x246)]==='string')_0x184d15[_0x1ddd85(0x246)]=_0x47e210[_0x1ddd85(0x246)];if(_0x47e210['behavior']&&typeof _0x47e210['behavior']===_0x1ddd85(0x28c))_0x184d15[_0x1ddd85(0x293)]=_0x47e210['behavior'];if(_0x47e210[_0x1ddd85(0x2e9)])_0x184d15['enriched']=!![];if(_0x47e210[_0x1ddd85(0x1ef)])_0x184d15['interval']=_0x47e210[_0x1ddd85(0x1ef)];let _0x2cd29e;try{_0x2cd29e=await _0x213423[_0x1ddd85(0x2c8)]['previewParentYaml'](_0x41f09a,_0x184d15),_0xd31eb9['stop']();}catch(_0x594dec){_0xd31eb9[_0x1ddd85(0x1e9)]();throw _0x594dec;}return await this[_0x1ddd85(0x254)](_0x2cd29e,{'master':_0x47e210['master'],'attribute':typeof _0x47e210[_0x1ddd85(0x246)]===_0x1ddd85(0x28c)?_0x47e210[_0x1ddd85(0x246)]:undefined,'behavior':typeof _0x47e210[_0x1ddd85(0x293)]==='string'?_0x47e210[_0x1ddd85(0x293)]:undefined,'enriched':_0x47e210[_0x1ddd85(0x2e9)]}),_0x2cd29e[_0x1ddd85(0x2cf)]?0x0:0x1;}async[a29_0x367de6(0x254)](_0x5d1272,_0x26d6ff){const _0x2b0b87=a29_0x367de6;console[_0x2b0b87(0x25a)]('\x0a'+a29_0x454280['bold'](_0x2b0b87(0x252))+'\x20'+_0x5d1272[_0x2b0b87(0x238)]),console['error']('═'['repeat'](0x3c));if(_0x26d6ff[_0x2b0b87(0x2bc)]&&_0x5d1272['sampleData']){const _0x5bf4f=a29_0x454280['dim']('Master:')+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x5d1272[_0x2b0b87(0x2bc)][_0x2b0b87(0x26c)]+'.'+_0x5d1272['master'][_0x2b0b87(0x2b9)]);await this[_0x2b0b87(0x218)](_0x5bf4f,_0x5d1272['sampleData']);}else{if(_0x26d6ff[_0x2b0b87(0x246)]&&_0x5d1272[_0x2b0b87(0x1f8)]){const _0x1bfc8d=a29_0x454280[_0x2b0b87(0x1ce)](_0x2b0b87(0x2a3))+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x26d6ff[_0x2b0b87(0x246)]);await this[_0x2b0b87(0x218)](_0x1bfc8d,_0x5d1272[_0x2b0b87(0x1f8)]);}else{if(_0x26d6ff[_0x2b0b87(0x293)]&&_0x5d1272[_0x2b0b87(0x1f8)]){const _0x275b17=a29_0x454280[_0x2b0b87(0x1ce)](_0x2b0b87(0x2e7))+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x26d6ff[_0x2b0b87(0x293)]);await this['displaySampleData'](_0x275b17,_0x5d1272[_0x2b0b87(0x1f8)]);}else{if(_0x26d6ff[_0x2b0b87(0x2e9)]&&_0x5d1272[_0x2b0b87(0x1f8)]){const _0x5b564a=a29_0x454280[_0x2b0b87(0x1ce)](_0x2b0b87(0x295))+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x2b0b87(0x1cb));await this[_0x2b0b87(0x218)](_0x5b564a,_0x5d1272[_0x2b0b87(0x1f8)]);}else!_0x5d1272[_0x2b0b87(0x1f8)]&&console[_0x2b0b87(0x25a)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x5d1272[_0x2b0b87(0x29b)][_0x2b0b87(0x292)]>0x0){console[_0x2b0b87(0x25a)]('─'[_0x2b0b87(0x2de)](0x3c)),console[_0x2b0b87(0x25a)]('\x0a'+a29_0x454280[_0x2b0b87(0x282)](_0x2b0b87(0x1d7)));for(const _0x43db05 of _0x5d1272['errors']){console[_0x2b0b87(0x25a)]('\x20\x20'+a29_0x454280[_0x2b0b87(0x282)]('•')+'\x20'+_0x43db05);}}}async[a29_0x367de6(0x218)](_0x3a4241,_0x4d6b96){const _0x20ab14=a29_0x367de6;if(_0x4d6b96[_0x20ab14(0x292)]===0x0){console[_0x20ab14(0x25a)]('\x0a'+_0x3a4241),console[_0x20ab14(0x25a)](_0x20ab14(0x281));return;}console[_0x20ab14(0x25a)]('\x0a'+_0x3a4241);const _0x5ca5a4=Object['keys'](_0x4d6b96[0x0])[_0x20ab14(0x236)](_0x50308f=>({'name':_0x50308f,'type':typeof _0x4d6b96[0x0][_0x50308f]==='number'?_0x20ab14(0x1ec):_0x20ab14(0x286)})),_0x4091f3={'queryId':_0x20ab14(0x227),'columns':_0x5ca5a4,'data':_0x4d6b96,'stats':{'state':_0x20ab14(0x1ed),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4d6b96[_0x20ab14(0x292)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x31f301=formatAsTable(_0x4091f3,_0x4d6b96[_0x20ab14(0x292)],!![]);await writeOutput(_0x31f301,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a29_0x367de6(0x230);[a29_0x367de6(0x2da)]=a29_0x367de6(0x2a6);async[a29_0x367de6(0x271)](_0x34ed95){const _0x310db8=a29_0x367de6,{options:_0x19f8ed,args:_0x25e149,tdx:_0x2d2d62}=_0x34ed95,_0x2413fa=_0x19f8ed,_0x487adc=_0x25e149[0x0]||_0x19f8ed['parentSegment'];if(!_0x487adc)return showParentSegmentNotSetError(_0x310db8(0x2dd)+_0x310db8(0x1e7)),0x1;const _0x1256c2=resolveYamlFile(_0x487adc);if(existsSync(_0x1256c2)){_0x2413fa['verbose']&&console['error']('Found\x20YAML\x20file:\x20'+_0x1256c2);let _0x131a94;try{_0x131a94=readFileSync(_0x1256c2,_0x310db8(0x25f));}catch(_0x5450ae){const _0x203dbd=_0x5450ae instanceof Error?_0x5450ae[_0x310db8(0x1cd)]:String(_0x5450ae);return console[_0x310db8(0x25a)](_0x310db8(0x21b)+_0x203dbd),0x1;}const _0x13499c=await withSpinner(_0x310db8(0x26b),()=>_0x2d2d62['segment'][_0x310db8(0x1d4)](_0x131a94),{'verbose':_0x2413fa[_0x310db8(0x289)]}),_0x26900f=_0x13499c[_0x310db8(0x20f)],{isNew:_0x57a733,name:_0x3bc031,hasChanges:_0x1e9900,diffFormatted:_0x3ae6c8}=_0x26900f;if(_0x1e9900){_0x57a733?console[_0x310db8(0x25a)](_0x310db8(0x278)+_0x3bc031+'\x27:'):console[_0x310db8(0x25a)](_0x310db8(0x1fe)+_0x3bc031+'\x27:');console[_0x310db8(0x25a)]('─'[_0x310db8(0x2de)](0x3c)),console['error'](_0x3ae6c8),console['error']('─'[_0x310db8(0x2de)](0x3c));const _0x19aaa2=_0x57a733?'Create\x20parent\x20segment\x20\x27'+_0x3bc031+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x3bc031+_0x310db8(0x2e6);if(!_0x2413fa[_0x310db8(0x1df)]){const _0x522aaa=await confirmKey(_0x19aaa2);if(!_0x522aaa)return console[_0x310db8(0x25a)](_0x310db8(0x25e)),0x1;}const _0x3e542a=_0x57a733?'Creating':_0x310db8(0x2ca);await withSpinner(_0x3e542a+'\x20parent\x20segment\x20\x27'+_0x3bc031+_0x310db8(0x284),()=>_0x26900f['apply'](),{'verbose':_0x2413fa[_0x310db8(0x289)]});const _0x1c2d95=_0x57a733?_0x310db8(0x1cf):_0x310db8(0x200);console[_0x310db8(0x25a)]('✔\x20'+_0x1c2d95+_0x310db8(0x2e3)+_0x3bc031+'\x27');}else console[_0x310db8(0x25a)]('✔\x20No\x20changes\x20-\x20\x27'+_0x3bc031+_0x310db8(0x2b8));}const _0x1a5a9e=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x487adc+_0x310db8(0x284),()=>_0x2d2d62[_0x310db8(0x2c8)][_0x310db8(0x26f)](_0x487adc),{'verbose':_0x2413fa[_0x310db8(0x289)]}),_0x2bf4d0=_0x1a5a9e['data'],_0x5af76c=getConsoleUrl(_0x2413fa['site'],'/app/workflows/'+_0x2bf4d0[_0x310db8(0x263)]+'/sessions/'+_0x2bf4d0['workflowSessionId']+_0x310db8(0x219)+_0x2bf4d0[_0x310db8(0x1d0)]);return console[_0x310db8(0x25a)]('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a29_0x454280['dim'](_0x310db8(0x28f))+'\x20'+_0x2bf4d0[_0x310db8(0x2a8)]),console[_0x310db8(0x25a)]('\x20\x20'+a29_0x454280[_0x310db8(0x1ce)](_0x310db8(0x2d5))+'\x20'+_0x2bf4d0[_0x310db8(0x221)]),console[_0x310db8(0x25a)]('\x20\x20'+a29_0x454280['dim'](_0x310db8(0x2ce))+'\x20'+_0x2bf4d0[_0x310db8(0x23c)]),console[_0x310db8(0x25a)]('\x20\x20'+a29_0x454280[_0x310db8(0x1ce)](_0x310db8(0x204))+'\x20'+_0x2bf4d0['workflowAttemptId']),console['error']('\x20\x20'+_0x5af76c),console['error']('\x0a'+a29_0x454280[_0x310db8(0x1ce)](_0x310db8(0x1dd))+'\x20tdx\x20wf\x20attempt\x20'+_0x2bf4d0[_0x310db8(0x1d0)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x27f);['description']=a29_0x367de6(0x276);async[a29_0x367de6(0x271)](_0x9bb77f){const _0x106bac=a29_0x367de6,{options:_0x29b628,args:_0x172ea2,tdx:_0x1aad51}=_0x9bb77f,_0x1c893f=_0x172ea2[0x0]||_0x29b628[_0x106bac(0x1f9)];if(!_0x1c893f)return showParentSegmentNotSetError(_0x106bac(0x2d1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x29b628['verbose']&&(console[_0x106bac(0x25a)](_0x106bac(0x2a2)+_0x29b628[_0x106bac(0x208)]),console[_0x106bac(0x25a)]('Parent\x20segment:\x20'+_0x1c893f));const _0xc66827=await withSpinner(_0x106bac(0x20c)+_0x1c893f+_0x106bac(0x284),()=>_0x1aad51[_0x106bac(0x2c8)]['listFields'](_0x1c893f),{'verbose':_0x29b628[_0x106bac(0x289)]}),_0x3621eb=_0xc66827['data'];console['error'](_0x106bac(0x215)+_0x3621eb[_0x106bac(0x292)]+_0x106bac(0x2d0)+(_0x3621eb[_0x106bac(0x292)]!==0x1?'s':''));if(_0x29b628[_0x106bac(0x20d)]||_0x29b628[_0x106bac(0x251)])return await handleSDKOutput(_0x3621eb,_0x29b628),0x0;return displayFieldsHumanReadable(_0x3621eb,_0x1c893f),0x0;}}function a29_0x5e17(_0x1f2980,_0x119c28){_0x1f2980=_0x1f2980-0x1cb;const _0x49f3df=a29_0x49f3();let _0x5e17ff=_0x49f3df[_0x1f2980];return _0x5e17ff;}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x217);[a29_0x367de6(0x2da)]='Show\x20parent\x20segment\x20details';async[a29_0x367de6(0x271)](_0x290cdd){const _0x11d7f0=a29_0x367de6,{options:_0x239753,args:_0x23f245,tdx:_0x16cc9a}=_0x290cdd,_0x43067c=_0x239753,_0x2b122b=_0x23f245[0x0]||_0x239753[_0x11d7f0(0x1f9)];if(!_0x2b122b)return showParentSegmentNotSetError(_0x11d7f0(0x288)+_0x11d7f0(0x25b)+'Options:\x0a'+_0x11d7f0(0x2eb)),0x1;_0x239753[_0x11d7f0(0x289)]&&(console['error'](_0x11d7f0(0x2a2)+_0x239753[_0x11d7f0(0x208)]),console[_0x11d7f0(0x25a)](_0x11d7f0(0x2a0)+_0x2b122b));const _0x9eeb2b=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x2b122b+_0x11d7f0(0x284),()=>_0x16cc9a[_0x11d7f0(0x2c8)][_0x11d7f0(0x214)](_0x2b122b),{'verbose':_0x239753['verbose']}),_0x4aaab2=_0x9eeb2b[_0x11d7f0(0x20f)];if(_0x43067c[_0x11d7f0(0x26a)]){const _0x5e7eb5=getConsoleNextUrl(_0x43067c[_0x11d7f0(0x208)],_0x11d7f0(0x1ff)+_0x4aaab2['id']);return console[_0x11d7f0(0x25a)](a29_0x454280[_0x11d7f0(0x297)]('✔')+_0x11d7f0(0x257)+a29_0x454280['cyan'](_0x5e7eb5)),openBrowser(_0x5e7eb5),0x0;}return await handleSingleObjectOutput(_0x4aaab2,_0x239753),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x261);[a29_0x367de6(0x2da)]=a29_0x367de6(0x213);async[a29_0x367de6(0x271)](_0x18b924){const _0x2c97ad=a29_0x367de6,{options:_0x55cee5,args:_0x569e85,tdx:_0x57cddb}=_0x18b924,_0x7cfa5=_0x569e85[0x0]||_0x55cee5[_0x2c97ad(0x1f9)];if(!_0x7cfa5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x2c97ad(0x21d)),0x1;_0x55cee5[_0x2c97ad(0x289)]&&(console['error']('Site:\x20'+_0x55cee5[_0x2c97ad(0x208)]),console[_0x2c97ad(0x25a)]('Parent\x20segment:\x20'+_0x7cfa5));const _0x25649b=await withSpinner(_0x2c97ad(0x212)+_0x7cfa5+'\x27...',()=>_0x57cddb[_0x2c97ad(0x2c8)][_0x2c97ad(0x255)](_0x7cfa5),{'verbose':_0x55cee5[_0x2c97ad(0x289)]}),_0x2aa887=_0x25649b['data'],_0x10498f=await withSpinner(_0x2c97ad(0x234)+_0x7cfa5+_0x2c97ad(0x284),()=>_0x57cddb[_0x2c97ad(0x2c8)][_0x2c97ad(0x259)](_0x2aa887),{'verbose':_0x55cee5[_0x2c97ad(0x289)]}),_0x234118=await executeSchemaQuery(_0x10498f[_0x2c97ad(0x20f)],_0x57cddb,_0x55cee5);return await handleQueryOutput(_0x234118,_0x55cee5),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x1cc);[a29_0x367de6(0x2da)]=a29_0x367de6(0x1da);async[a29_0x367de6(0x271)](_0x321e74){const _0x272c85=a29_0x367de6,{options:_0xc8c6d,args:_0x421b11,tdx:_0x42d029}=_0x321e74,_0x50f48b=_0x421b11[0x0]||_0xc8c6d[_0x272c85(0x1f9)];if(!_0x50f48b)return showParentSegmentNotSetError(_0x272c85(0x2d2)+'\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;_0xc8c6d[_0x272c85(0x289)]&&(console[_0x272c85(0x25a)](_0x272c85(0x2a2)+_0xc8c6d[_0x272c85(0x208)]),console['error']('Parent\x20segment:\x20'+_0x50f48b));const _0xb00b84=await withSpinner(_0x272c85(0x212)+_0x50f48b+'\x27...',()=>_0x42d029[_0x272c85(0x2c8)][_0x272c85(0x255)](_0x50f48b),{'verbose':_0xc8c6d['verbose']}),_0x1ad4ff=_0xb00b84['data'],_0x2541b1=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x50f48b+'\x27...',()=>_0x42d029[_0x272c85(0x2c8)][_0x272c85(0x259)](_0x1ad4ff),{'verbose':_0xc8c6d['verbose']}),_0x266f60=_0x2541b1[_0x272c85(0x20f)];return _0xc8c6d[_0x272c85(0x22f)]==='json'||_0xc8c6d[_0x272c85(0x22f)]==='jsonl'?await handleSDKOutput([{'sql':_0x266f60}],_0xc8c6d):console[_0x272c85(0x1f1)](_0x266f60),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x2a5);[a29_0x367de6(0x2da)]=a29_0x367de6(0x1d1);async['execute'](_0x2813bf){const _0x299341=a29_0x367de6,{options:_0x20b98e,args:_0x55cdae,tdx:_0x5d1176}=_0x2813bf,_0x550c94=_0x55cdae[0x0]||_0x20b98e[_0x299341(0x1f9)];if(!_0x550c94)return showParentSegmentNotSetError(_0x299341(0x253)+_0x299341(0x21c)),0x1;_0x20b98e[_0x299341(0x289)]&&(console['error']('Site:\x20'+_0x20b98e[_0x299341(0x208)]),console[_0x299341(0x25a)](_0x299341(0x2a0)+_0x550c94));const _0x21f6c1=await withSpinner(_0x299341(0x212)+_0x550c94+'\x27...',()=>_0x5d1176[_0x299341(0x2c8)][_0x299341(0x255)](_0x550c94),{'verbose':_0x20b98e[_0x299341(0x289)]}),_0x2e3464=_0x21f6c1[_0x299341(0x20f)],_0x472454=await withSpinner(_0x299341(0x234)+_0x550c94+_0x299341(0x284),()=>_0x5d1176[_0x299341(0x2c8)][_0x299341(0x259)](_0x2e3464),{'verbose':_0x20b98e[_0x299341(0x289)]});let _0x378c05=_0x472454[_0x299341(0x20f)];const _0x351cfe=resolveLimit(_0x20b98e['limit'],DEFAULT_DISPLAY_LIMIT),_0x8bcfce=/\bLIMIT\s+\d+/i[_0x299341(0x2cb)](_0x378c05);!_0x8bcfce&&(_0x378c05=_0x378c05['trim']()[_0x299341(0x279)](/;+$/,''),_0x378c05=_0x299341(0x22a)+_0x378c05+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x351cfe);_0x20b98e['verbose']&&console['error'](_0x299341(0x2d8)+_0x378c05);const _0xdb2198=await withQuerySpinner(_0x299341(0x20b),async _0x497a08=>{const _0x21a171=_0x299341,_0x4a2966=await _0x5d1176[_0x21a171(0x2e4)]['execute'](_0x378c05,{'catalog':'td','schema':_0x21a171(0x22b),'onJobId':_0x38e40f=>{const _0x53b08f=_0x21a171;_0x497a08[_0x53b08f(0x27b)](_0x38e40f);}});return _0x4a2966;},{'verbose':_0x20b98e[_0x299341(0x289)]}),_0x3a5de2=_0xdb2198['data'],_0x1efd15=_0x3a5de2[_0x299341(0x29e)]?'\x20[Job\x20ID:\x20'+_0x3a5de2[_0x299341(0x29e)]+']':'';return console['error'](_0x299341(0x2ab)+_0x3a5de2[_0x299341(0x25d)][_0x299341(0x24c)][_0x299341(0x298)]()+'\x20rows\x20'+(_0x299341(0x27a)+formatElapsed(_0x3a5de2[_0x299341(0x25d)][_0x299341(0x20e)])+_0x1efd15)),await handleQueryOutput(_0x3a5de2,_0x20b98e),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_0x54ecb6=a30_0x1f14;(function(_0x1bf2a3,_0x2e92c5){const _0x40ad49=a30_0x1f14,_0x2d8b96=_0x1bf2a3();while(!![]){try{const _0x5e7fac=-parseInt(_0x40ad49(0xf8))/0x1+-parseInt(_0x40ad49(0x10b))/0x2+parseInt(_0x40ad49(0x108))/0x3*(-parseInt(_0x40ad49(0x100))/0x4)+parseInt(_0x40ad49(0xff))/0x5+parseInt(_0x40ad49(0xfa))/0x6+-parseInt(_0x40ad49(0x106))/0x7*(-parseInt(_0x40ad49(0xf7))/0x8)+-parseInt(_0x40ad49(0x101))/0x9*(parseInt(_0x40ad49(0x107))/0xa);if(_0x5e7fac===_0x2e92c5)break;else _0x2d8b96['push'](_0x2d8b96['shift']());}catch(_0x50a91b){_0x2d8b96['push'](_0x2d8b96['shift']());}}}(a30_0x267e,0x8d830));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a30_0x1f14(_0x4f464e,_0x2bbe39){_0x4f464e=_0x4f464e-0xf7;const _0x267ea4=a30_0x267e();let _0x1f14bf=_0x267ea4[_0x4f464e];return _0x1f14bf;}import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x54ecb6(0x109)]='profiles';[a30_0x54ecb6(0x105)]=a30_0x54ecb6(0x10a);async[a30_0x54ecb6(0xf9)](_0x2bd21e){const _0x8fde12=a30_0x54ecb6,{options:_0x385e20}=_0x2bd21e;try{const _0x1d0b33=listProfiles(),_0x3262af=getActiveProfile();if(_0x1d0b33[_0x8fde12(0x103)]===0x0)return console['log'](_0x8fde12(0x10c)),console[_0x8fde12(0xfc)](_0x8fde12(0xfb)),console[_0x8fde12(0xfc)](_0x8fde12(0x104)),0x0;const _0x2dca28=_0x1d0b33['map'](_0xa74b4b=>{const _0x59b63a=_0x8fde12,_0x2732cd=_0xa74b4b[_0x59b63a(0x109)]===_0x3262af,_0x57c638=getProfileParams(_0xa74b4b[_0x59b63a(0xfd)]);return{'name':_0xa74b4b[_0x59b63a(0x109)],'active':_0x2732cd,'scope':_0xa74b4b['scope'],'description':_0xa74b4b[_0x59b63a(0xfd)][_0x59b63a(0x105)]||'','params':_0x57c638};});return await handleSDKOutput(_0x2dca28,_0x385e20),0x0;}catch(_0x191401){return _0x191401 instanceof Error&&console['error'](_0x8fde12(0x102)+_0x191401[_0x8fde12(0xfe)]),0x1;}}}function a30_0x267e(){const _0x3d1a82=['\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','config','message','5062085HZZcrl','32pKPxHE','9NCAJxc','Error:\x20','length','\x20\x20Global:\x20~/.config/tdx/tdx.json','description','287yJufpS','1343830eDHQyT','173055dsxmgL','name','List\x20all\x20available\x20profiles','1081110kVFIZp','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','101512cYvyzU','269683HBclIs','execute','2718402HBIKKp'];a30_0x267e=function(){return _0x3d1a82;};return a30_0x267e();}
@@ -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_0x286302=a31_0x5a26;(function(_0x3e8679,_0x3b2534){const _0x1f1dc0=a31_0x5a26,_0x184727=_0x3e8679();while(!![]){try{const _0x4f9879=-parseInt(_0x1f1dc0(0x77))/0x1+parseInt(_0x1f1dc0(0x82))/0x2*(parseInt(_0x1f1dc0(0x92))/0x3)+parseInt(_0x1f1dc0(0x75))/0x4+parseInt(_0x1f1dc0(0x7f))/0x5+parseInt(_0x1f1dc0(0x7e))/0x6+-parseInt(_0x1f1dc0(0xa2))/0x7*(parseInt(_0x1f1dc0(0xa5))/0x8)+-parseInt(_0x1f1dc0(0x71))/0x9*(parseInt(_0x1f1dc0(0x8a))/0xa);if(_0x4f9879===_0x3b2534)break;else _0x184727['push'](_0x184727['shift']());}catch(_0x4ad0f2){_0x184727['push'](_0x184727['shift']());}}}(a31_0x34e0,0x1f102));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';function a31_0x5a26(_0x7a5379,_0xa3d131){_0x7a5379=_0x7a5379-0x71;const _0x34e085=a31_0x34e0();let _0x5a26e7=_0x34e085[_0x7a5379];return _0x5a26e7;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';function a31_0x34e0(){const _0x954cff=['1013334blrygW','956670eGBezZ','file','No\x20SQL\x20provided','84698tjKyhI','...','processedRows','verbose','in\x20','push','SQL:\x20','\x20splits','5630vgIQkT','\x20rows\x20','name','options','Executing\x20query...','args','originalMessage','completedSplits','15RHnlZJ','description','message','query','database','elapsedTimeMillis','Executing\x20query\x20[','\x20-\x20','catalog','state','length','setExtra','output','Run\x20Trino\x20queries\x20(streaming)','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','jobId','6251YWaVwS','error','Schema:\x20','648VNjSkS','6885uuaBPA','setJobId','information_schema','validate','251268xyvkFP','data','4523WsyrpJ','Catalog:\x20','Statement\x20','stats','Error:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x0aAll\x20results\x20saved\x20to\x20'];a31_0x34e0=function(){return _0x954cff;};return a31_0x34e0();}import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a31_0x286302(0x8c)]=a31_0x286302(0x95);[a31_0x286302(0x93)]=a31_0x286302(0x9f);async['execute'](_0x12a647){const _0x78c5f9=a31_0x286302,{options:_0x536049,args:_0x41cc3e,tdx:_0x43aa67}=_0x12a647,_0x414429=_0x41cc3e[0x0],_0x57801b=_0x536049[_0x78c5f9(0x80)];let _0x52c315;try{if(_0x57801b)_0x52c315=readSqlStatementsFromFile(_0x57801b);else{if(_0x414429==='-')_0x52c315=await readSqlStatementsFromStdin();else{if(_0x414429&&isSqlFilePath(_0x414429))_0x52c315=readSqlStatementsFromFile(_0x414429);else{if(_0x414429)_0x52c315=splitSqlStatements(_0x414429);else throw new Error(_0x78c5f9(0x81));}}}}catch(_0x5370c4){return console['error'](_0x78c5f9(0x7b)+_0x5370c4[_0x78c5f9(0x94)]),0x1;}const _0x1466c8=_0x536049[_0x78c5f9(0x96)]||_0x78c5f9(0x73),_0x57880c=_0x536049[_0x78c5f9(0x9a)];try{const _0x47e563=[],_0x2d4720=!!_0x536049[_0x78c5f9(0x9e)];for(let _0x1447ea=0x0;_0x1447ea<_0x52c315[_0x78c5f9(0x9c)];_0x1447ea++){const _0x2ae7c0=_0x52c315[_0x1447ea],_0x508467=_0x1447ea+0x1,_0x2d4aeb=_0x52c315[_0x78c5f9(0x9c)],_0x32544f=_0x2d4aeb>0x1;_0x536049[_0x78c5f9(0x85)]&&(console['error']('\x0a'+(_0x32544f?'Statement\x20'+_0x508467+'/'+_0x2d4aeb+':':'')),console[_0x78c5f9(0xa3)]('Site:\x20'+_0x536049['site']),console['error'](_0x78c5f9(0x78)+(_0x57880c||'td')),console[_0x78c5f9(0xa3)](_0x78c5f9(0xa4)+_0x1466c8),console[_0x78c5f9(0xa3)](_0x78c5f9(0x88)+_0x2ae7c0));const _0x3615b1=_0x32544f?'Executing\x20statement\x20'+_0x508467+'/'+_0x2d4aeb+_0x78c5f9(0x83):_0x78c5f9(0x8e);try{const _0x3fc1b8=await withQuerySpinner(_0x3615b1,async _0x4a0b8b=>{const _0x4be97a=_0x78c5f9,_0x5bad97=await _0x43aa67[_0x4be97a(0x95)]['execute'](_0x2ae7c0,{'catalog':_0x57880c,'schema':_0x1466c8,'onJobId':_0x51e7ab=>{const _0x4e0203=_0x4be97a;_0x4a0b8b[_0x4e0203(0x72)](_0x51e7ab);},'onProgress':_0x58b261=>{const _0x107512=_0x4be97a;_0x4a0b8b['setPhase'](_0x107512(0x98)+_0x58b261[_0x107512(0x9b)]+']'),_0x4a0b8b[_0x107512(0x9d)](formatRows(_0x58b261['processedRows'])+_0x107512(0x8b)+_0x58b261[_0x107512(0x91)]+'/'+_0x58b261['totalSplits']+_0x107512(0x89));}});return _0x5bad97;},{'verbose':_0x536049['verbose']}),_0x151fa1=_0x3fc1b8[_0x78c5f9(0x76)],_0x23bec1=_0x151fa1[_0x78c5f9(0xa1)]?'\x20[Job\x20ID:\x20'+_0x151fa1[_0x78c5f9(0xa1)]+']':'',_0x1987c5=_0x32544f?_0x78c5f9(0x79)+_0x508467+'/'+_0x2d4aeb+_0x78c5f9(0x99):'';console['error']('✔\x20'+_0x1987c5+'Query\x20completed:\x20Processed\x20'+formatRows(_0x151fa1[_0x78c5f9(0x7a)][_0x78c5f9(0x84)])+_0x78c5f9(0x8b)+(_0x78c5f9(0x86)+formatElapsed(_0x151fa1['stats'][_0x78c5f9(0x97)])+_0x23bec1));if(_0x32544f&&_0x2d4720){const _0x26691a=resolveOutputOptions(_0x536049),_0x179b32=await formatQueryOutput(_0x151fa1,_0x26691a);_0x47e563[_0x78c5f9(0x87)](_0x179b32);}else await handleQueryOutput(_0x151fa1,_0x536049);}catch(_0x94586f){const _0xd5e08a=_0x32544f?'Statement\x20'+_0x508467+'/'+_0x2d4aeb+':\x0a':'',_0xedb168=_0x94586f instanceof SDKError?_0x94586f[_0x78c5f9(0x90)]:_0x94586f[_0x78c5f9(0x94)];return console[_0x78c5f9(0xa3)](''+_0xd5e08a+_0xedb168),0x1;}}if(_0x52c315[_0x78c5f9(0x9c)]>0x1&&_0x2d4720&&_0x47e563[_0x78c5f9(0x9c)]>0x0){const _0x26c745=_0x47e563['join']('\x0a');writeFileSync(_0x536049[_0x78c5f9(0x9e)],_0x26c745),console['error'](_0x78c5f9(0x7d)+_0x536049['output']);}return 0x0;}catch(_0x9a3a9e){throw _0x9a3a9e;}}[a31_0x286302(0x74)](_0x154089){const _0x3a5d98=a31_0x286302,_0x1e74a0=_0x154089[_0x3a5d98(0x8f)][0x0],_0x27449f=_0x154089[_0x3a5d98(0x8d)][_0x3a5d98(0x80)];if(!_0x1e74a0&&!_0x27449f)return _0x3a5d98(0xa0);if(_0x1e74a0&&_0x27449f)return _0x3a5d98(0x7c);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_0x2274e8=a32_0x2bb6;(function(_0x1d7936,_0x982175){const _0x50f0f0=a32_0x2bb6,_0x31424a=_0x1d7936();while(!![]){try{const _0x4333f7=-parseInt(_0x50f0f0(0x21f))/0x1*(parseInt(_0x50f0f0(0x1fb))/0x2)+-parseInt(_0x50f0f0(0x27b))/0x3*(-parseInt(_0x50f0f0(0x273))/0x4)+-parseInt(_0x50f0f0(0x271))/0x5*(-parseInt(_0x50f0f0(0x1f2))/0x6)+parseInt(_0x50f0f0(0x20e))/0x7+-parseInt(_0x50f0f0(0x229))/0x8+-parseInt(_0x50f0f0(0x1f1))/0x9+-parseInt(_0x50f0f0(0x276))/0xa;if(_0x4333f7===_0x982175)break;else _0x31424a['push'](_0x31424a['shift']());}catch(_0x59d405){_0x31424a['push'](_0x31424a['shift']());}}}(a32_0xa8ad,0x3b6a2));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_0xa45164 from'chalk';function resolveSegmentTarget(_0x4480e5,_0x533144,_0x3b869c){const _0x220198=a32_0x2bb6;if(isYamlFilePath(_0x4480e5))try{const _0x8249ec=resolveYamlFilePath(_0x4480e5);return _0x3b869c&&(console['error'](_0x220198(0x27f)+_0x4480e5),console['error'](_0x220198(0x250)+_0x8249ec[_0x220198(0x1ff)]),console[_0x220198(0x24f)]('\x20\x20Segment\x20name:\x20'+_0x8249ec['segmentName']),console['error'](_0x220198(0x26b)+(_0x8249ec[_0x220198(0x23e)]||_0x220198(0x289))),console['error'](_0x220198(0x25a)+_0x8249ec['fullPath'])),_0x8249ec[_0x220198(0x253)];}catch(_0x4d609f){throw new SDKError(ErrorCode[_0x220198(0x1f4)],_0x220198(0x210)+_0x4d609f[_0x220198(0x202)]);}if(!_0x533144)throw new SDKError(ErrorCode[_0x220198(0x1f4)],_0x220198(0x20f));return _0x533144+'/'+_0x4480e5;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x1f6);['description']=a32_0x2274e8(0x265);async[a32_0x2274e8(0x213)](_0x45d228){const _0x40e85c=a32_0x2274e8,{options:_0x19c0fc,args:_0x2de484,tdx:_0x3a062b}=_0x45d228,_0x122317=_0x2de484[0x0],_0x5aec66=!_0x122317&&!!_0x19c0fc[_0x40e85c(0x1ff)],_0x566128=_0x122317||_0x19c0fc['parentSegment'];if(!_0x566128)return console[_0x40e85c(0x24f)](_0x40e85c(0x248)),console['error'](_0x40e85c(0x226)),console['error'](_0x40e85c(0x256)),console[_0x40e85c(0x24f)](_0x40e85c(0x22c)),console['error'](_0x40e85c(0x264)),console[_0x40e85c(0x24f)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x40e85c(0x20a)),0x1;try{const _0x321e6a=_0x19c0fc[_0x40e85c(0x1f9)];let _0x1e712f=_0x566128;!_0x5aec66&&_0x321e6a&&!_0x566128['includes']('/')&&(_0x1e712f=_0x321e6a+'/'+_0x566128,_0x19c0fc[_0x40e85c(0x267)]&&console[_0x40e85c(0x24f)](_0x40e85c(0x279)+_0x1e712f));const _0x1075c6=await withSpinner(_0x40e85c(0x268)+_0x1e712f+_0x40e85c(0x26a),()=>_0x3a062b['segment'][_0x40e85c(0x282)](_0x1e712f),{'verbose':_0x19c0fc[_0x40e85c(0x267)]}),_0x5834e8=_0x1075c6[_0x40e85c(0x20c)];_0x19c0fc[_0x40e85c(0x267)]&&(console[_0x40e85c(0x24f)](_0x40e85c(0x217)+_0x5834e8[_0x40e85c(0x1f8)]),console[_0x40e85c(0x24f)](_0x40e85c(0x26c)+_0x5834e8[_0x40e85c(0x23f)]),_0x5834e8['folderId']&&console['error'](_0x40e85c(0x277)+_0x5834e8['folderId']),_0x5834e8['segmentId']&&console[_0x40e85c(0x24f)](_0x40e85c(0x21a)+_0x5834e8[_0x40e85c(0x237)]));if(_0x5834e8[_0x40e85c(0x1f8)]===_0x40e85c(0x28d)){const _0x397d71=await withSpinner(_0x40e85c(0x24d),()=>_0x3a062b[_0x40e85c(0x28e)][_0x40e85c(0x20d)](_0x5834e8[_0x40e85c(0x23f)]),{'verbose':_0x19c0fc['verbose']});await handleSingleObjectOutput(_0x397d71[_0x40e85c(0x20c)],_0x19c0fc);}else{if(_0x5834e8['type']===_0x40e85c(0x25c)){if(!_0x5834e8[_0x40e85c(0x228)])throw new SDKError(ErrorCode[_0x40e85c(0x283)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x332b5d=await withSpinner(_0x40e85c(0x284),()=>_0x3a062b[_0x40e85c(0x28e)][_0x40e85c(0x22d)](_0x5834e8['folderId']),{'verbose':_0x19c0fc['verbose']});await handleSingleObjectOutput(_0x332b5d[_0x40e85c(0x20c)],_0x19c0fc);}else{if(_0x5834e8[_0x40e85c(0x1f8)]===_0x40e85c(0x28e)){if(!_0x5834e8[_0x40e85c(0x237)])throw new SDKError(ErrorCode[_0x40e85c(0x200)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x53a438=await withSpinner(_0x40e85c(0x280),()=>_0x3a062b[_0x40e85c(0x28e)][_0x40e85c(0x247)](_0x5834e8[_0x40e85c(0x23f)],_0x5834e8[_0x40e85c(0x237)]),{'verbose':_0x19c0fc[_0x40e85c(0x267)]});await handleSingleObjectOutput(_0x53a438['data'],_0x19c0fc);}}}return 0x0;}catch(_0x55cd9f){if(_0x55cd9f instanceof SDKError)return console[_0x40e85c(0x24f)](_0x40e85c(0x1ef)+_0x55cd9f[_0x40e85c(0x202)]),_0x55cd9f[_0x40e85c(0x24c)]&&console[_0x40e85c(0x24f)](_0x40e85c(0x204)+_0x55cd9f[_0x40e85c(0x24c)]),0x1;throw _0x55cd9f;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x249);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x215);async[a32_0x2274e8(0x213)](_0x1d5d2b){const _0x446f49=a32_0x2274e8,{options:_0x492a2e,args:_0x27c2f5,tdx:_0x16e80f}=_0x1d5d2b,_0x44915a=_0x27c2f5[0x0];if(!_0x44915a)return console[_0x446f49(0x24f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x446f49(0x24f)](_0x446f49(0x27c)),console[_0x446f49(0x24f)](_0x446f49(0x256)),console[_0x446f49(0x24f)](_0x446f49(0x23d)),console['error'](_0x446f49(0x260)),0x1;try{const _0x34b2f7=_0x492a2e[_0x446f49(0x1ff)],_0x17bdfd=resolveSegmentTarget(_0x44915a,_0x34b2f7,_0x492a2e['verbose']);_0x492a2e[_0x446f49(0x267)]&&console['error'](_0x446f49(0x258)+_0x17bdfd);const _0x406c14=await withSpinner('Resolving\x20\x27'+_0x44915a+_0x446f49(0x26a),()=>_0x16e80f[_0x446f49(0x28e)][_0x446f49(0x282)](_0x17bdfd),{'verbose':_0x492a2e[_0x446f49(0x267)]}),_0x49cbf5=_0x406c14[_0x446f49(0x20c)];_0x492a2e[_0x446f49(0x267)]&&(console[_0x446f49(0x24f)]('Resolved\x20type:\x20'+_0x49cbf5[_0x446f49(0x1f8)]),console['error']('Parent\x20ID:\x20'+_0x49cbf5[_0x446f49(0x23f)]));if(_0x49cbf5['type']==='folder')return console[_0x446f49(0x24f)](_0x446f49(0x231)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x49cbf5[_0x446f49(0x1f8)]===_0x446f49(0x28d))return console[_0x446f49(0x24f)](_0x446f49(0x220)),console[_0x446f49(0x24f)](_0x446f49(0x244)),0x1;if(!_0x49cbf5[_0x446f49(0x237)])throw new SDKError(ErrorCode[_0x446f49(0x200)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x28a35a=await withSpinner(_0x446f49(0x22e),()=>_0x16e80f['segment'][_0x446f49(0x26f)](_0x49cbf5[_0x446f49(0x23f)],_0x49cbf5[_0x446f49(0x237)]),{'verbose':_0x492a2e[_0x446f49(0x267)]});let _0x214b3c=_0x28a35a[_0x446f49(0x20c)];const _0x3ca9bd=resolveLimit(_0x492a2e[_0x446f49(0x24e)],DEFAULT_DISPLAY_LIMIT),_0x8290b2=/\bLIMIT\s+\d+/i[_0x446f49(0x275)](_0x214b3c);!_0x8290b2&&(_0x214b3c=_0x214b3c['trim']()['replace'](/;+$/,''),_0x214b3c=_0x446f49(0x242)+_0x214b3c+_0x446f49(0x214)+_0x3ca9bd);_0x492a2e[_0x446f49(0x267)]&&console['error'](_0x446f49(0x234)+_0x214b3c);const _0xb96b41=await withQuerySpinner(_0x446f49(0x241),async _0x533b7c=>{const _0x25793a=_0x446f49,_0x29975f=await _0x16e80f[_0x25793a(0x286)][_0x25793a(0x213)](_0x214b3c,{'catalog':'td','schema':'information_schema','onJobId':_0x4bd363=>{const _0x51b659=_0x25793a;_0x533b7c[_0x51b659(0x205)](_0x4bd363);}});return _0x29975f;},{'verbose':_0x492a2e[_0x446f49(0x267)]}),_0x172d79=_0xb96b41['data'],_0x3d7e98=_0x172d79[_0x446f49(0x25e)]?'\x20[Job\x20ID:\x20'+_0x172d79['jobId']+']':'';return console[_0x446f49(0x24f)](_0x446f49(0x238)+_0x172d79[_0x446f49(0x259)][_0x446f49(0x23c)]['toLocaleString']()+_0x446f49(0x209)+('in\x20'+formatElapsed(_0x172d79[_0x446f49(0x259)][_0x446f49(0x24b)])+_0x3d7e98)),await handleQueryOutput(_0x172d79,_0x492a2e),0x0;}catch(_0x5bcb72){if(_0x5bcb72 instanceof SDKError)return console[_0x446f49(0x24f)](_0x446f49(0x251)+_0x5bcb72['code']+']'),console[_0x446f49(0x24f)]('\x0a'+_0x5bcb72['message']),0x1;throw _0x5bcb72;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x2274e8(0x239)]='segment:folder:list';[a32_0x2274e8(0x1f5)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a32_0x2274e8(0x213)](_0x5d35fe){const _0x488e13=a32_0x2274e8,{options:_0x17dcb0,args:_0x16fd8c,tdx:_0x5da57a}=_0x5d35fe;if(_0x16fd8c['length']===0x0)return console[_0x488e13(0x24f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x488e13(0x24f)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x46a534=_0x16fd8c[0x0];try{_0x17dcb0[_0x488e13(0x267)]&&(console[_0x488e13(0x24f)](_0x488e13(0x25d)+_0x17dcb0['site']),console[_0x488e13(0x24f)](_0x488e13(0x285)+_0x46a534));const _0x2dd30=await withSpinner(_0x488e13(0x261)+_0x46a534+_0x488e13(0x26a),()=>_0x5da57a[_0x488e13(0x28e)][_0x488e13(0x243)](_0x46a534),{'verbose':_0x17dcb0[_0x488e13(0x267)]}),_0x434dd8=_0x2dd30['data'];_0x17dcb0[_0x488e13(0x267)]&&console[_0x488e13(0x24f)]('Resolved\x20parent\x20ID:\x20'+_0x434dd8);const _0x46c808=await withSpinner(_0x488e13(0x24a)+_0x46a534+_0x488e13(0x26a),()=>_0x5da57a[_0x488e13(0x28e)]['listFolders'](_0x434dd8),{'verbose':_0x17dcb0[_0x488e13(0x267)]}),_0x29117a=_0x46c808[_0x488e13(0x20c)];return console['error'](_0x488e13(0x252)+_0x29117a[_0x488e13(0x211)]+_0x488e13(0x27e)+(_0x29117a[_0x488e13(0x211)]!==0x1?'s':'')),await handleSDKOutput(_0x29117a,_0x17dcb0),0x0;}catch(_0x1df1ff){if(_0x1df1ff instanceof SDKError)return console[_0x488e13(0x24f)](_0x488e13(0x1ef)+_0x1df1ff[_0x488e13(0x202)]),_0x1df1ff['cause']&&console[_0x488e13(0x24f)]('\x20\x20Cause:\x20'+_0x1df1ff[_0x488e13(0x24c)]),0x1;throw _0x1df1ff;}}}export class SegmentFolderShowCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x1f7);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x21c);async['execute'](_0xf947aa){const _0x1e9669=a32_0x2274e8,{options:_0x1968b7,args:_0x11d9e7,tdx:_0x1dcccb}=_0xf947aa;if(_0x11d9e7[_0x1e9669(0x211)]===0x0)return console[_0x1e9669(0x24f)](_0x1e9669(0x21b)),console[_0x1e9669(0x24f)](_0x1e9669(0x27a)),0x1;try{const {parentId:_0x2aebed,childId:_0x4e4840}=parseSegmentRef(_0x11d9e7[0x0]);_0x1968b7[_0x1e9669(0x267)]&&(console[_0x1e9669(0x24f)](_0x1e9669(0x25d)+_0x1968b7[_0x1e9669(0x269)]),console[_0x1e9669(0x24f)]('Parent\x20name:\x20'+_0x2aebed),_0x4e4840&&console[_0x1e9669(0x24f)](_0x1e9669(0x219)+_0x4e4840));if(!_0x4e4840)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x5cd8ac=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2aebed+_0x1e9669(0x26a),()=>_0x1dcccb[_0x1e9669(0x28e)][_0x1e9669(0x243)](_0x2aebed),{'verbose':_0x1968b7[_0x1e9669(0x267)]}),_0x1c080f=_0x5cd8ac[_0x1e9669(0x20c)];_0x1968b7[_0x1e9669(0x267)]&&console[_0x1e9669(0x24f)](_0x1e9669(0x224)+_0x1c080f);const _0x2eb834=await withSpinner(_0x1e9669(0x221)+_0x4e4840+'\x27...',()=>_0x1dcccb['segment'][_0x1e9669(0x22f)](_0x1c080f,_0x4e4840),{'verbose':_0x1968b7['verbose']}),_0x470387=_0x2eb834[_0x1e9669(0x20c)];_0x1968b7['verbose']&&console[_0x1e9669(0x24f)](_0x1e9669(0x257)+_0x470387);const _0x18cde8=await withSpinner(_0x1e9669(0x208)+_0x4e4840+'\x27...',()=>_0x1dcccb['segment']['getFolder'](_0x470387),{'verbose':_0x1968b7[_0x1e9669(0x267)]});return await handleSDKOutput([_0x18cde8['data']],_0x1968b7),0x0;}catch(_0x93fc6){if(_0x93fc6 instanceof SDKError)return console[_0x1e9669(0x24f)](_0x1e9669(0x1ef)+_0x93fc6[_0x1e9669(0x202)]),_0x93fc6[_0x1e9669(0x24c)]&&console[_0x1e9669(0x24f)](_0x1e9669(0x204)+_0x93fc6[_0x1e9669(0x24c)]),0x1;throw _0x93fc6;}}}function a32_0x2bb6(_0x4d2503,_0x48c265){_0x4d2503=_0x4d2503-0x1ef;const _0xa8ad7a=a32_0xa8ad();let _0x2bb630=_0xa8ad7a[_0x4d2503];return _0x2bb630;}function a32_0xa8ad(){const _0x4af578=['Creating\x20folder\x20\x27','data','getParent','967960dgCrBZ','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','length','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','execute','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','cyan','Resolved\x20type:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20name:\x20','Segment\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','Show\x20segment\x20folder\x20details','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','json','68WHQvwn','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20parent\x20ID:\x20','log','Usage:\x20tdx\x20segment\x20describe\x20<path>','Create\x20segment\x20folder\x20for\x20organization','folderId','3682664QmpgVS','/app/ps/','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getFolder','Fetching\x20SQL\x20for\x20segment...','resolveFolderId','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Use:\x20tdx\x20ps\x20sql','\x27\x20with\x20ID:\x20','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20Opening\x20','segmentId','✔\x20Query\x20completed:\x20Processed\x20','name','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','processedRows','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','folderPath','parentId','Usage:\x20tdx\x20sg\x20sql\x20<name>','Executing\x20segment\x20query...','SELECT\x20*\x20FROM\x20(\x0a','resolveParentId','Use:\x20tdx\x20ps\x20show','Options:','segment:sql','getSegment','Error:\x20Path\x20or\x20name\x20is\x20required','segment:show','Listing\x20folders\x20for\x20parent\x20\x27','elapsedTimeMillis','cause','Fetching\x20parent\x20segment\x20details...','limit','error','\x20\x20Parent\x20segment:\x20','✖\x20Query\x20failed\x20[','✔\x20Found\x20','fullPath','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Examples:','Resolved\x20folder\x20ID:\x20','Target\x20path:\x20','stats','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','folder','Site:\x20','jobId','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Resolving\x20parent\x20segment\x20\x27','/e/','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Show\x20segment\x20or\x20folder\x20details','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','verbose','Resolving\x20path\x20\x27','site','\x27...','\x20\x20Folder\x20path:\x20','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20desc','getSegmentSQL','Get\x20SQL\x20query\x20for\x20child\x20segment','405415dDjMoO','Resolving\x20\x27','100ltqomt','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','test','565030joRUMW','Folder\x20ID:\x20','✔\x20Created\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','56538HGUMdV','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','parentFolder','\x20folder','Resolved\x20YAML\x20file:\x20','Fetching\x20segment\x20details...','createFolder','resolvePathToResource','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20folder\x20details...','Parent\x20name:\x20','query','Use:\x20tdx\x20ps\x20view','Parent\x20segment:\x20','(root)','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','segment:desc','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parent','segment','Error:\x20','segment:folder:create','2217159TJhEbL','30bWzKsq','green','INVALID_ARGUMENT','description','segment:describe','segment:folder:show','type','segmentPath','Use:\x20tdx\x20ps\x20view\x20-w','244caASIi','jsonl','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','parentSegment','SEGMENT_NOT_FOUND','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','message','segment:view','\x20\x20Cause:\x20','setJobId','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','format','Fetching\x20folder\x20\x27','\x20rows\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'];a32_0xa8ad=function(){return _0x4af578;};return a32_0xa8ad();}export class SegmentSQLCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x246);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x270);async[a32_0x2274e8(0x213)](_0x1020a0){const _0x535a8a=a32_0x2274e8,{options:_0x2d76d8,args:_0x41951b,tdx:_0x2aecd3}=_0x1020a0,_0x10541f=_0x41951b[0x0];if(!_0x10541f)return console[_0x535a8a(0x24f)](_0x535a8a(0x21d)),console[_0x535a8a(0x24f)](_0x535a8a(0x240)),console[_0x535a8a(0x24f)](_0x535a8a(0x201)),console[_0x535a8a(0x24f)](_0x535a8a(0x256)),console[_0x535a8a(0x24f)](_0x535a8a(0x28c)),console[_0x535a8a(0x24f)](_0x535a8a(0x235)),0x1;try{const _0x3795f1=_0x2d76d8[_0x535a8a(0x1ff)],_0x5645fe=resolveSegmentTarget(_0x10541f,_0x3795f1,_0x2d76d8['verbose']);_0x2d76d8[_0x535a8a(0x267)]&&console[_0x535a8a(0x24f)]('Target\x20path:\x20'+_0x5645fe);const _0x1e4313=await withSpinner(_0x535a8a(0x272)+_0x10541f+'\x27...',()=>_0x2aecd3[_0x535a8a(0x28e)][_0x535a8a(0x282)](_0x5645fe),{'verbose':_0x2d76d8[_0x535a8a(0x267)]}),_0x25b651=_0x1e4313[_0x535a8a(0x20c)];_0x2d76d8['verbose']&&(console[_0x535a8a(0x24f)](_0x535a8a(0x217)+_0x25b651[_0x535a8a(0x1f8)]),console['error']('Parent\x20ID:\x20'+_0x25b651[_0x535a8a(0x23f)]));if(_0x25b651[_0x535a8a(0x1f8)]===_0x535a8a(0x25c))return console[_0x535a8a(0x24f)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x535a8a(0x24f)](_0x535a8a(0x1fd)),0x1;if(_0x25b651[_0x535a8a(0x1f8)]===_0x535a8a(0x28d))return console[_0x535a8a(0x24f)](_0x535a8a(0x206)),console[_0x535a8a(0x24f)](_0x535a8a(0x232)),0x1;if(!_0x25b651[_0x535a8a(0x237)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x535a8a(0x22b));const _0x41d05d=await withSpinner(_0x535a8a(0x22e),()=>_0x2aecd3[_0x535a8a(0x28e)]['getSegmentSQL'](_0x25b651[_0x535a8a(0x23f)],_0x25b651[_0x535a8a(0x237)]),{'verbose':_0x2d76d8[_0x535a8a(0x267)]}),_0x1f82eb=_0x41d05d[_0x535a8a(0x20c)];return _0x2d76d8[_0x535a8a(0x207)]===_0x535a8a(0x21e)||_0x2d76d8[_0x535a8a(0x207)]===_0x535a8a(0x1fc)?await handleSDKOutput([{'sql':_0x1f82eb}],_0x2d76d8):console[_0x535a8a(0x225)](_0x1f82eb),0x0;}catch(_0xd6b956){if(_0xd6b956 instanceof SDKError)return console['error'](_0x535a8a(0x1ef)+_0xd6b956[_0x535a8a(0x202)]),_0xd6b956[_0x535a8a(0x24c)]&&console[_0x535a8a(0x24f)]('\x20\x20Cause:\x20'+_0xd6b956[_0x535a8a(0x24c)]),0x1;throw _0xd6b956;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a32_0x2274e8(0x1f0);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x227);async['execute'](_0x258700){const _0x1bf78d=a32_0x2274e8,{options:_0x35983f,args:_0x4f5dd1,tdx:_0x53e962}=_0x258700,_0x467ee3=_0x35983f;if(_0x4f5dd1[_0x1bf78d(0x211)]<0x2)return console[_0x1bf78d(0x24f)](_0x1bf78d(0x28a)),console[_0x1bf78d(0x24f)](_0x1bf78d(0x263)),0x1;const _0xe51827=_0x4f5dd1[0x0],_0x4cec4b=_0x4f5dd1[0x1];_0x467ee3[_0x1bf78d(0x267)]&&(console['error'](_0x1bf78d(0x25d)+_0x467ee3[_0x1bf78d(0x269)]),console[_0x1bf78d(0x24f)](_0x1bf78d(0x288)+_0xe51827),console[_0x1bf78d(0x24f)](_0x1bf78d(0x219)+_0x4cec4b));let _0x56c701;if(_0x467ee3['parentFolder']){const _0x4b8d59=_0x467ee3[_0x1bf78d(0x27d)],_0xc9e9d2=await withSpinner(_0x1bf78d(0x261)+_0xe51827+_0x1bf78d(0x26a),()=>_0x53e962[_0x1bf78d(0x28e)]['resolveParentId'](_0xe51827),{'verbose':_0x467ee3['verbose']}),_0x5dfc16=_0xc9e9d2['data'],_0x76b21f=await withSpinner(_0x1bf78d(0x23a)+_0x4b8d59+_0x1bf78d(0x26a),()=>_0x53e962[_0x1bf78d(0x28e)][_0x1bf78d(0x22f)](_0x5dfc16,_0x4b8d59),{'verbose':_0x467ee3[_0x1bf78d(0x267)]});_0x56c701=_0x76b21f['data'],_0x467ee3[_0x1bf78d(0x267)]&&console[_0x1bf78d(0x24f)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x56c701);}const _0xe71e5b={'name':_0x4cec4b,'description':_0x467ee3[_0x1bf78d(0x1f5)],'parentFolderId':_0x56c701},_0x5acf5a=await withSpinner(_0x1bf78d(0x20b)+_0x4cec4b+_0x1bf78d(0x26a),()=>_0x53e962['segment'][_0x1bf78d(0x281)](_0xe51827,_0xe71e5b),{'verbose':_0x467ee3[_0x1bf78d(0x267)]}),_0x371132=_0x5acf5a[_0x1bf78d(0x20c)];return console[_0x1bf78d(0x24f)](_0x1bf78d(0x278)+_0x371132[_0x1bf78d(0x239)]+_0x1bf78d(0x233)+_0x371132['id']),await handleSDKOutput([_0x371132],_0x467ee3),0x0;}}export class SegmentViewCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x203);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x230);async[a32_0x2274e8(0x213)](_0x3e6914){const _0x55db7d=a32_0x2274e8,{options:_0x34514e,args:_0x4ccc9e,tdx:_0x5f5ec3}=_0x3e6914,_0x55b8a7=_0x4ccc9e[0x0];if(!_0x55b8a7)return console[_0x55db7d(0x24f)](_0x55db7d(0x218)),console[_0x55db7d(0x24f)](_0x55db7d(0x212)),console[_0x55db7d(0x24f)](_0x55db7d(0x26d)),console['error'](_0x55db7d(0x245)),console['error'](_0x55db7d(0x1fe)),console['error']('Examples:'),console['error'](_0x55db7d(0x25b)),console['error'](_0x55db7d(0x23b)),console[_0x55db7d(0x24f)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x55db7d(0x24f)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x57740f=_0x34514e[_0x55db7d(0x1ff)],_0x19cabb=resolveSegmentTarget(_0x55b8a7,_0x57740f,_0x34514e[_0x55db7d(0x267)]);_0x34514e['verbose']&&console[_0x55db7d(0x24f)]('Target\x20path:\x20'+_0x19cabb);const _0x3301db=await withSpinner(_0x55db7d(0x272)+_0x55b8a7+_0x55db7d(0x26a),()=>_0x5f5ec3[_0x55db7d(0x28e)]['resolvePathToResource'](_0x19cabb),{'verbose':_0x34514e['verbose']}),_0x222ce3=_0x3301db[_0x55db7d(0x20c)];_0x34514e[_0x55db7d(0x267)]&&(console[_0x55db7d(0x24f)](_0x55db7d(0x217)+_0x222ce3[_0x55db7d(0x1f8)]),console[_0x55db7d(0x24f)](_0x55db7d(0x26c)+_0x222ce3['parentId']),_0x222ce3['folderId']&&console[_0x55db7d(0x24f)](_0x55db7d(0x277)+_0x222ce3[_0x55db7d(0x228)]),_0x222ce3['segmentId']&&console[_0x55db7d(0x24f)](_0x55db7d(0x21a)+_0x222ce3[_0x55db7d(0x237)]));if(_0x34514e['web']){if(_0x222ce3[_0x55db7d(0x1f8)]===_0x55db7d(0x25c))return console[_0x55db7d(0x24f)](_0x55db7d(0x266)),0x1;if(_0x222ce3[_0x55db7d(0x1f8)]===_0x55db7d(0x28d))return console[_0x55db7d(0x24f)](_0x55db7d(0x274)),console['error'](_0x55db7d(0x1fa)),0x1;if(!_0x222ce3[_0x55db7d(0x237)])throw new SDKError(ErrorCode[_0x55db7d(0x200)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4c638a=getConsoleNextUrl(_0x34514e['site'],'/app/ps/'+_0x222ce3[_0x55db7d(0x23f)]+_0x55db7d(0x262)+_0x222ce3[_0x55db7d(0x237)]);return console[_0x55db7d(0x24f)](a32_0xa45164[_0x55db7d(0x1f3)]('✔')+_0x55db7d(0x236)+a32_0xa45164[_0x55db7d(0x216)](_0x4c638a)),openBrowser(_0x4c638a),0x0;}if(_0x222ce3['type']==='folder'){if(!_0x222ce3['folderId'])throw new SDKError(ErrorCode[_0x55db7d(0x283)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x477490=await withSpinner(_0x55db7d(0x284),()=>_0x5f5ec3[_0x55db7d(0x28e)][_0x55db7d(0x22d)](_0x222ce3[_0x55db7d(0x228)]),{'verbose':_0x34514e[_0x55db7d(0x267)]});await handleSingleObjectOutput(_0x477490[_0x55db7d(0x20c)],_0x34514e);}else{if(_0x222ce3[_0x55db7d(0x1f8)]===_0x55db7d(0x28e)){if(!_0x222ce3[_0x55db7d(0x237)])throw new SDKError(ErrorCode[_0x55db7d(0x200)],_0x55db7d(0x22b));const _0x3a9b44=await withSpinner(_0x55db7d(0x280),()=>_0x5f5ec3[_0x55db7d(0x28e)][_0x55db7d(0x247)](_0x222ce3['parentId'],_0x222ce3[_0x55db7d(0x237)]),{'verbose':_0x34514e[_0x55db7d(0x267)]}),_0x15f242=getConsoleNextUrl(_0x34514e[_0x55db7d(0x269)],_0x55db7d(0x22a)+_0x222ce3[_0x55db7d(0x23f)]+_0x55db7d(0x262)+_0x222ce3[_0x55db7d(0x237)]),_0x3446fb=_0x3a9b44[_0x55db7d(0x20c)];_0x3446fb['url']=_0x15f242,await handleSingleObjectOutput(_0x3446fb,_0x34514e);}else return console[_0x55db7d(0x24f)](_0x55db7d(0x25f)),console[_0x55db7d(0x24f)](_0x55db7d(0x287)),0x1;}return 0x0;}catch(_0x306240){if(_0x306240 instanceof SDKError)return console[_0x55db7d(0x24f)](_0x55db7d(0x1ef)+_0x306240['message']),_0x306240[_0x55db7d(0x24c)]&&console['error']('\x20\x20Cause:\x20'+_0x306240[_0x55db7d(0x24c)]),0x1;throw _0x306240;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x28b);[a32_0x2274e8(0x1f5)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a32_0x2274e8(0x213)](_0x534fea){const _0x7c49cd=a32_0x2274e8,{options:_0x2a34be,args:_0x490059,tdx:_0x342f54}=_0x534fea,_0x32a981=_0x490059[0x0];if(!_0x32a981)return console['error'](_0x7c49cd(0x21d)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x7c49cd(0x24f)](_0x7c49cd(0x222)),console['error'](_0x7c49cd(0x256)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x7c49cd(0x24f)](_0x7c49cd(0x255)),0x1;try{const _0x4c9fab=_0x2a34be['parentSegment'],_0x253825=resolveSegmentTarget(_0x32a981,_0x4c9fab,_0x2a34be[_0x7c49cd(0x267)]);_0x2a34be[_0x7c49cd(0x267)]&&console[_0x7c49cd(0x24f)]('Target\x20path:\x20'+_0x253825);const _0x245d50=await withSpinner(_0x7c49cd(0x272)+_0x32a981+_0x7c49cd(0x26a),()=>_0x342f54[_0x7c49cd(0x28e)][_0x7c49cd(0x282)](_0x253825),{'verbose':_0x2a34be[_0x7c49cd(0x267)]}),_0x4d4479=_0x245d50['data'];_0x2a34be['verbose']&&(console[_0x7c49cd(0x24f)](_0x7c49cd(0x217)+_0x4d4479[_0x7c49cd(0x1f8)]),console[_0x7c49cd(0x24f)](_0x7c49cd(0x26c)+_0x4d4479[_0x7c49cd(0x23f)]));if(_0x4d4479[_0x7c49cd(0x1f8)]===_0x7c49cd(0x25c))return console[_0x7c49cd(0x24f)](_0x7c49cd(0x223)),console[_0x7c49cd(0x24f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x4d4479[_0x7c49cd(0x1f8)]===_0x7c49cd(0x28d))return console[_0x7c49cd(0x24f)](_0x7c49cd(0x254)),console[_0x7c49cd(0x24f)](_0x7c49cd(0x26e)),0x1;if(!_0x4d4479['segmentId'])throw new SDKError(ErrorCode[_0x7c49cd(0x200)],_0x7c49cd(0x22b));const _0x2a8789=await withSpinner(_0x7c49cd(0x22e),()=>_0x342f54[_0x7c49cd(0x28e)][_0x7c49cd(0x26f)](_0x4d4479[_0x7c49cd(0x23f)],_0x4d4479['segmentId']),{'verbose':_0x2a34be[_0x7c49cd(0x267)]}),_0x1be75b=_0x2a8789[_0x7c49cd(0x20c)],_0x3681fa=await executeSchemaQuery(_0x1be75b,_0x342f54,_0x2a34be);return await handleQueryOutput(_0x3681fa,_0x2a34be),0x0;}catch(_0x5f3da8){if(_0x5f3da8 instanceof SDKError)return console[_0x7c49cd(0x24f)](_0x7c49cd(0x1ef)+_0x5f3da8[_0x7c49cd(0x202)]),_0x5f3da8[_0x7c49cd(0x24c)]&&console[_0x7c49cd(0x24f)](_0x7c49cd(0x204)+_0x5f3da8[_0x7c49cd(0x24c)]),0x1;throw _0x5f3da8;}}}