@treasuredata/tdx 0.8.5 → 0.8.6

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 (115) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.d.ts +1 -0
  18. package/dist/commands/claude-command.d.ts.map +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-command.js.map +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/connection-command.js +1 -1
  25. package/dist/commands/context-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/describe.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.js +1 -1
  61. package/dist/proxy/claude-usage-tracker.js +1 -1
  62. package/dist/proxy/context-signature.js +1 -1
  63. package/dist/proxy/conversation-utils.js +1 -1
  64. package/dist/proxy/server.js +1 -1
  65. package/dist/proxy/session-cache.js +1 -1
  66. package/dist/sdk/api.js +1 -1
  67. package/dist/sdk/connection.js +1 -1
  68. package/dist/sdk/engage.js +1 -1
  69. package/dist/sdk/errors.js +1 -1
  70. package/dist/sdk/index.js +1 -1
  71. package/dist/sdk/job.js +1 -1
  72. package/dist/sdk/journey.js +1 -1
  73. package/dist/sdk/llm.js +1 -1
  74. package/dist/sdk/query.js +1 -1
  75. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  76. package/dist/sdk/segment/journey-yaml.js +1 -1
  77. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  78. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  79. package/dist/sdk/segment.js +1 -1
  80. package/dist/sdk/user.js +1 -1
  81. package/dist/sdk/workflow.js +1 -1
  82. package/dist/types/endpoints.js +1 -1
  83. package/dist/types/index.js +1 -1
  84. package/dist/utils/agent-ref-parser.js +1 -1
  85. package/dist/utils/async.js +1 -1
  86. package/dist/utils/chat-cache.js +1 -1
  87. package/dist/utils/colors.js +1 -1
  88. package/dist/utils/command-output.js +1 -1
  89. package/dist/utils/constants.js +1 -1
  90. package/dist/utils/diff.js +1 -1
  91. package/dist/utils/fields-display.js +1 -1
  92. package/dist/utils/file-permissions.js +1 -1
  93. package/dist/utils/format-detector.js +1 -1
  94. package/dist/utils/formatters.js +1 -1
  95. package/dist/utils/json-loader.js +1 -1
  96. package/dist/utils/llm-backup-utils.js +1 -1
  97. package/dist/utils/model-aliases.js +1 -1
  98. package/dist/utils/model-factors.js +1 -1
  99. package/dist/utils/option-validation.js +1 -1
  100. package/dist/utils/port.js +1 -1
  101. package/dist/utils/process.js +1 -1
  102. package/dist/utils/prompt.js +1 -1
  103. package/dist/utils/segment-path-parser.js +1 -1
  104. package/dist/utils/segment-ref-parser.js +1 -1
  105. package/dist/utils/spinner.js +1 -1
  106. package/dist/utils/sql-parser.js +1 -1
  107. package/dist/utils/sse-parser.js +1 -1
  108. package/dist/utils/string-utils.js +1 -1
  109. package/dist/utils/table-ref-parser.js +1 -1
  110. package/dist/utils/tdx-config.js +1 -1
  111. package/dist/utils/tdx-logger.js +1 -1
  112. package/dist/utils/tree-formatter.js +1 -1
  113. package/dist/utils/version-check.js +1 -1
  114. package/dist/utils/workflow-utils.js +1 -1
  115. package/package.json +1 -1
@@ -1 +1 @@
1
- const a27_0x368b25=a27_0xecf5;(function(_0x1fb2d9,_0x327fff){const _0xe41229=a27_0xecf5,_0x2e9557=_0x1fb2d9();while(!![]){try{const _0x4b797d=parseInt(_0xe41229(0x1b3))/0x1+parseInt(_0xe41229(0x198))/0x2*(parseInt(_0xe41229(0x197))/0x3)+parseInt(_0xe41229(0x1c2))/0x4+parseInt(_0xe41229(0x19b))/0x5*(parseInt(_0xe41229(0x1b6))/0x6)+parseInt(_0xe41229(0x19e))/0x7*(-parseInt(_0xe41229(0x18f))/0x8)+-parseInt(_0xe41229(0x1a0))/0x9*(parseInt(_0xe41229(0x190))/0xa)+parseInt(_0xe41229(0x1a5))/0xb;if(_0x4b797d===_0x327fff)break;else _0x2e9557['push'](_0x2e9557['shift']());}catch(_0x518f66){_0x2e9557['push'](_0x2e9557['shift']());}}}(a27_0x24a2,0xaea32));import a27_0x34e2da from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';function a27_0x24a2(){const _0x1e3f7f=['execute','SIGTERM','bold','\x0aTesting\x20with\x20Agent\x20SDK:','log','white','Project\x20\x27','Server\x20Configuration:','find','logger','\x20\x20{','\x20\x20Project:','995288RBpBDc','\x20\x20Address:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','853212ypuMLa','\x0a\x0aShutting\x20down\x20proxy\x20server...','llm','stop','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','attributes','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x27\x20not\x20found','\x20\x20Agents:','close','created\x20on-demand\x20per\x20model','1284680icsXFh','name','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','description','cyan','dim','\x0aClaude\x20Code\x20Configuration:','Port\x20','NOT_FOUND','\x20\x20Site:','port','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','server','25784dyoPdb','10beDVKG','Resolving\x20project...','exit','site','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','✓\x20Proxy\x20server\x20stopped','\x20is\x20unavailable,\x20using\x20port\x20','1668363kJQDjI','2iFVayQ','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','start','5wrXDje','http://0.0.0.0:','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','2541pqNLwx','projects','7607169UqKMCB','init','green','llmProject','yellow','7872953TOdxHj','Starting\x20proxy\x20server...'];a27_0x24a2=function(){return _0x1e3f7f;};return a27_0x24a2();}import{TDXLogger}from'../utils/tdx-logger.js';function a27_0xecf5(_0x1b52c6,_0x370525){_0x1b52c6=_0x1b52c6-0x18f;const _0x24a243=a27_0x24a2();let _0xecf53e=_0x24a243[_0x1b52c6];return _0xecf53e;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x1da8a8,_0x3bdf13){const _0x132090=a27_0xecf5,{tdx:_0x139628,options:_0x213bd0}=_0x1da8a8,_0x49dd76=_0x3bdf13||_0x213bd0[_0x132090(0x1a3)];if(_0x49dd76){const _0x51438a=await _0x139628[_0x132090(0x1b8)][_0x132090(0x19f)](),_0x13d93e=_0x51438a['find'](_0x4597a0=>_0x4597a0[_0x132090(0x1bb)][_0x132090(0x1c3)]===_0x49dd76);if(!_0x13d93e)throw new SDKError(ErrorCode[_0x132090(0x1ca)],_0x132090(0x1ad)+_0x49dd76+_0x132090(0x1be),undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0x13d93e['id'];}const _0x140038=await _0x139628[_0x132090(0x1b8)]['getOrCreateDefaultProject']();return _0x140038['id'];}export class LLMProxyCommand extends BaseCommand{[a27_0x368b25(0x1c3)]='llm:proxy';[a27_0x368b25(0x1c5)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a27_0x368b25(0x1cf)];[a27_0x368b25(0x1b0)];async[a27_0x368b25(0x1a7)](_0x1d95ba){const _0xf5164b=a27_0x368b25,{tdx:_0x2c39b0,options:_0x5c13d1}=_0x1d95ba;try{const _0x5777dd=_0x5c13d1,_0x5351f9=_0x5777dd[_0xf5164b(0x1cc)]||0xfa0,_0x3d2955=_0x5777dd['project'],_0x248932=await findAvailablePort(_0x5351f9);console['log'](a27_0x34e2da[_0xf5164b(0x1c7)](_0xf5164b(0x191)));const _0x19cd08=await getProjectIdOrDefault(_0x1d95ba,_0x3d2955),_0x5c52b8=await _0x2c39b0['llm'][_0xf5164b(0x19f)](),_0xf02461=_0x5c52b8[_0xf5164b(0x1af)](_0x5123ff=>_0x5123ff['id']===_0x19cd08);this['logger']=new TDXLogger(_0x5c13d1['logLevel']),await this['logger'][_0xf5164b(0x1a1)](),console['log'](a27_0x34e2da['dim'](_0xf5164b(0x1a6)));_0x248932!==_0x5351f9&&console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1a4)](_0xf5164b(0x1c9)+_0x5351f9+_0xf5164b(0x196)+_0x248932));this[_0xf5164b(0x1cf)]=new ProxyServer({'port':_0x248932,'projectId':_0x19cd08,'tdx':_0x2c39b0,'logger':this[_0xf5164b(0x1b0)],'site':_0x5c13d1[_0xf5164b(0x193)]}),await this[_0xf5164b(0x1cf)][_0xf5164b(0x19a)](),console['log'](a27_0x34e2da['yellow'][_0xf5164b(0x1a9)](_0xf5164b(0x199))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1a4)](_0xf5164b(0x1c4))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1a4)](_0xf5164b(0x1b5))),console[_0xf5164b(0x1ab)](a27_0x34e2da['green'][_0xf5164b(0x1a9)](_0xf5164b(0x1ba))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1c6)](_0xf5164b(0x1ae))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1c7)](_0xf5164b(0x1b4)),a27_0x34e2da[_0xf5164b(0x1ac)](_0xf5164b(0x19c)+_0x248932)),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1c7)](_0xf5164b(0x1b2)),a27_0x34e2da[_0xf5164b(0x1ac)](_0xf02461?.[_0xf5164b(0x1bb)][_0xf5164b(0x1c3)]||_0x19cd08)),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1c7)](_0xf5164b(0x1bf)),a27_0x34e2da['white'](_0xf5164b(0x1c1))),console['log'](a27_0x34e2da[_0xf5164b(0x1c7)](_0xf5164b(0x1cb)),a27_0x34e2da['white'](_0x5c13d1['site'])),console[_0xf5164b(0x1ab)](a27_0x34e2da['cyan'](_0xf5164b(0x1c8))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1c7)]('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1ac)](_0xf5164b(0x1b1))),console['log'](a27_0x34e2da[_0xf5164b(0x1ac)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console[_0xf5164b(0x1ab)](a27_0x34e2da['white'](_0xf5164b(0x1ce)+_0x248932+'\x22,')),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1ac)](_0xf5164b(0x1bc))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1ac)](_0xf5164b(0x194))),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1ac)]('\x20\x20\x20\x20}')),console['log'](a27_0x34e2da[_0xf5164b(0x1ac)]('\x20\x20}')),console[_0xf5164b(0x1ab)](a27_0x34e2da[_0xf5164b(0x1c6)](_0xf5164b(0x1aa))),console[_0xf5164b(0x1ab)](a27_0x34e2da['dim'](_0xf5164b(0x19d))),console[_0xf5164b(0x1ab)](a27_0x34e2da['dim']('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0xf5164b(0x1ab)](a27_0x34e2da['dim'](_0xf5164b(0x1cd))),console['log'](a27_0x34e2da['yellow'](_0xf5164b(0x1bd)));const _0x5b3c5a=async()=>{const _0x198113=_0xf5164b;console[_0x198113(0x1ab)](a27_0x34e2da[_0x198113(0x1c7)](_0x198113(0x1b7))),this['server']&&await this[_0x198113(0x1cf)][_0x198113(0x1b9)](),this[_0x198113(0x1b0)]&&await this['logger'][_0x198113(0x1c0)](),console['log'](a27_0x34e2da[_0x198113(0x1a2)](_0x198113(0x195))),process[_0x198113(0x192)](0x0);};return process['on']('SIGINT',_0x5b3c5a),process['on'](_0xf5164b(0x1a8),_0x5b3c5a),await new Promise(()=>{}),0x0;}catch(_0x35e667){this[_0xf5164b(0x1cf)]&&await this[_0xf5164b(0x1cf)][_0xf5164b(0x1b9)]();this[_0xf5164b(0x1b0)]&&await this[_0xf5164b(0x1b0)]['close']();throw _0x35e667;}}}
1
+ const a27_0x5c0b46=a27_0x232f;(function(_0x29881e,_0x5394d0){const _0x3d93b8=a27_0x232f,_0x2047f3=_0x29881e();while(!![]){try{const _0x1926f7=-parseInt(_0x3d93b8(0xcd))/0x1+parseInt(_0x3d93b8(0xd4))/0x2*(-parseInt(_0x3d93b8(0xd1))/0x3)+-parseInt(_0x3d93b8(0xda))/0x4*(-parseInt(_0x3d93b8(0xeb))/0x5)+-parseInt(_0x3d93b8(0xd9))/0x6*(parseInt(_0x3d93b8(0xd3))/0x7)+-parseInt(_0x3d93b8(0xf6))/0x8+-parseInt(_0x3d93b8(0xc8))/0x9*(-parseInt(_0x3d93b8(0xe7))/0xa)+parseInt(_0x3d93b8(0xd8))/0xb;if(_0x1926f7===_0x5394d0)break;else _0x2047f3['push'](_0x2047f3['shift']());}catch(_0x478341){_0x2047f3['push'](_0x2047f3['shift']());}}}(a27_0x5f88,0xc15af));import a27_0xa037c1 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(_0x24dbfd,_0x19642c){const _0x5da01b=a27_0x232f,{tdx:_0x48e7b6,options:_0x344c36}=_0x24dbfd,_0x1de470=_0x19642c||_0x344c36[_0x5da01b(0xd7)];if(_0x1de470){const _0x288155=await _0x48e7b6[_0x5da01b(0xcb)][_0x5da01b(0xfb)](),_0xf91d0=_0x288155[_0x5da01b(0xf3)](_0x1f67f6=>_0x1f67f6[_0x5da01b(0xf0)][_0x5da01b(0xed)]===_0x1de470);if(!_0xf91d0)throw new SDKError(ErrorCode[_0x5da01b(0xca)],_0x5da01b(0xc4)+_0x1de470+_0x5da01b(0xff),undefined,{'helpText':_0x5da01b(0xf8)});return _0xf91d0['id'];}const _0x22da1c=await _0x48e7b6[_0x5da01b(0xcb)]['getOrCreateDefaultProject']();return _0x22da1c['id'];}function a27_0x5f88(){const _0x5d802b=['\x20\x20Address:','white','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','bold','close','http://0.0.0.0:','logLevel','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x20\x20Site:','server','102360RAYvca','green','log','exit','365VMedZI','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','name','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','dim','attributes','\x20\x20\x20\x20}','SIGTERM','find','yellow','\x20\x20}','6583824FpVjqS','description','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x0a\x0aShutting\x20down\x20proxy\x20server...','site','projects','\x20is\x20unavailable,\x20using\x20port\x20','logger','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x27\x20not\x20found','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','Port\x20','project','created\x20on-demand\x20per\x20model','Project\x20\x27','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','execute','port','1089KWKKch','Server\x20Configuration:','NOT_FOUND','llm','start','799945mTQjkv','SIGINT','stop','\x20\x20Agents:','57918dBocpH','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','355747jiMEjM','22mfwJbW','\x0aClaude\x20Code\x20Configuration:','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','llmProject','14360368cUhtOo','30nqEfSk','18484VDNgRk','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration'];a27_0x5f88=function(){return _0x5d802b;};return a27_0x5f88();}function a27_0x232f(_0x383d91,_0x336583){_0x383d91=_0x383d91-0xc4;const _0x5f889d=a27_0x5f88();let _0x232f40=_0x5f889d[_0x383d91];return _0x232f40;}export class LLMProxyCommand extends BaseCommand{[a27_0x5c0b46(0xed)]='llm:proxy';[a27_0x5c0b46(0xf7)]=a27_0x5c0b46(0xdc);[a27_0x5c0b46(0xe6)];['logger'];async[a27_0x5c0b46(0xc6)](_0x250bdc){const _0x2b4ebd=a27_0x5c0b46,{tdx:_0x31e625,options:_0x190e0a}=_0x250bdc;try{const _0x24f9ea=_0x190e0a,_0x2bd48d=_0x24f9ea[_0x2b4ebd(0xc7)]||0xfa0,_0x1845d4=_0x24f9ea[_0x2b4ebd(0x102)],_0x42b17e=await findAvailablePort(_0x2bd48d);console['log'](a27_0xa037c1[_0x2b4ebd(0xef)]('Resolving\x20project...'));const _0x2a5f9c=await getProjectIdOrDefault(_0x250bdc,_0x1845d4),_0xcb3d8c=await _0x31e625[_0x2b4ebd(0xcb)]['projects'](),_0x1f09d1=_0xcb3d8c[_0x2b4ebd(0xf3)](_0x4353b0=>_0x4353b0['id']===_0x2a5f9c);this['logger']=new TDXLogger(_0x190e0a[_0x2b4ebd(0xe3)]),await this[_0x2b4ebd(0xfd)]['init'](),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)]('Starting\x20proxy\x20server...'));_0x42b17e!==_0x2bd48d&&console[_0x2b4ebd(0xe9)](a27_0xa037c1['yellow'](_0x2b4ebd(0x101)+_0x2bd48d+_0x2b4ebd(0xfc)+_0x42b17e));this['server']=new ProxyServer({'port':_0x42b17e,'projectId':_0x2a5f9c,'tdx':_0x31e625,'logger':this['logger'],'site':_0x190e0a[_0x2b4ebd(0xfa)]}),await this[_0x2b4ebd(0xe6)][_0x2b4ebd(0xcc)](),console['log'](a27_0xa037c1['yellow'][_0x2b4ebd(0xe0)](_0x2b4ebd(0x100))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['yellow']('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console['log'](a27_0xa037c1['yellow'](_0x2b4ebd(0xc5))),console['log'](a27_0xa037c1[_0x2b4ebd(0xe8)]['bold'](_0x2b4ebd(0xd2))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['cyan'](_0x2b4ebd(0xc9))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['dim'](_0x2b4ebd(0xdd)),a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xe2)+_0x42b17e)),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)]('\x20\x20Project:'),a27_0xa037c1[_0x2b4ebd(0xde)](_0x1f09d1?.[_0x2b4ebd(0xf0)]['name']||_0x2a5f9c)),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xd0)),a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0x103))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xe5)),a27_0xa037c1[_0x2b4ebd(0xde)](_0x190e0a['site'])),console[_0x2b4ebd(0xe9)](a27_0xa037c1['cyan'](_0x2b4ebd(0xd5))),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xdb))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)]('\x20\x20{')),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console['log'](a27_0xa037c1[_0x2b4ebd(0xde)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x42b17e+'\x22,')),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xee))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xe4))),console['log'](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xf1))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xde)](_0x2b4ebd(0xf5))),console[_0x2b4ebd(0xe9)](a27_0xa037c1['cyan']('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xec))),console['log'](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xdf))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xef)](_0x2b4ebd(0xd6))),console[_0x2b4ebd(0xe9)](a27_0xa037c1[_0x2b4ebd(0xf4)](_0x2b4ebd(0xfe)));const _0x5ab520=async()=>{const _0x4e8d22=_0x2b4ebd;console[_0x4e8d22(0xe9)](a27_0xa037c1[_0x4e8d22(0xef)](_0x4e8d22(0xf9))),this[_0x4e8d22(0xe6)]&&await this['server'][_0x4e8d22(0xcf)](),this['logger']&&await this[_0x4e8d22(0xfd)][_0x4e8d22(0xe1)](),console['log'](a27_0xa037c1[_0x4e8d22(0xe8)]('✓\x20Proxy\x20server\x20stopped')),process[_0x4e8d22(0xea)](0x0);};return process['on'](_0x2b4ebd(0xce),_0x5ab520),process['on'](_0x2b4ebd(0xf2),_0x5ab520),await new Promise(()=>{}),0x0;}catch(_0x3b3294){this['server']&&await this[_0x2b4ebd(0xe6)][_0x2b4ebd(0xcf)]();this['logger']&&await this[_0x2b4ebd(0xfd)][_0x2b4ebd(0xe1)]();throw _0x3b3294;}}}
@@ -1 +1 @@
1
- const a28_0x3d9eee=a28_0x5394;(function(_0x4661b4,_0x1fad86){const _0x433fcc=a28_0x5394,_0x47da59=_0x4661b4();while(!![]){try{const _0x7cf1a3=-parseInt(_0x433fcc(0x18f))/0x1*(-parseInt(_0x433fcc(0x1ec))/0x2)+parseInt(_0x433fcc(0x1b7))/0x3+parseInt(_0x433fcc(0x26c))/0x4*(-parseInt(_0x433fcc(0x271))/0x5)+parseInt(_0x433fcc(0x21e))/0x6*(parseInt(_0x433fcc(0x22a))/0x7)+parseInt(_0x433fcc(0x21a))/0x8*(parseInt(_0x433fcc(0x201))/0x9)+-parseInt(_0x433fcc(0x219))/0xa*(-parseInt(_0x433fcc(0x2a2))/0xb)+-parseInt(_0x433fcc(0x1fa))/0xc;if(_0x7cf1a3===_0x1fad86)break;else _0x47da59['push'](_0x47da59['shift']());}catch(_0x762e34){_0x47da59['push'](_0x47da59['shift']());}}}(a28_0xe99e,0x9aaab));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a28_0x2b43c0 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';function a28_0x5394(_0x29de59,_0x4506c2){_0x29de59=_0x29de59-0x17d;const _0xe99e4d=a28_0xe99e();let _0x53948d=_0xe99e4d[_0x29de59];return _0x53948d;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a28_0xe99e(){const _0x10fd5c=['Columns:','List\x20available\x20fields\x20for\x20segmentation','message','\x20No\x20changes\x20-\x20','displayPreviewResults','710973cGFDDe','format','test','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Overwrite\x20\x27','Behavior:','status','schemaValid','✘\x20Failed\x20to\x20rename\x20directory:\x20','string','Attributes','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:desc','Fetching\x20current\x20configuration\x20for\x20\x27','parentSegment','No\x20parent\x20segments\x20found','scheduleOption','filter','Attribute:','\x20--enriched','Create\x20parent\x20segment\x20\x27','displayColumns','FINISHED','2530eraLNz','16lziugt','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','jobId','json','24SwclGv','/app/workflows/','segment:parent:create','\x20--behavior\x20\x22<name>\x22','To\x20view\x20sample\x20data:','\x20--attribute\x20\x22<name>\x22','/{name}.yml\x0a','toFixed','output','👥\x20','previewParentYaml','verbose','342706WPwjmk','yes','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Session:','customersWithEvents','Fetching\x20SQL\x20for\x20\x27','createParent','displayBehaviorsStats','run','Customers:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','label','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Validate:','cyan','Error\x20parsing\x20YAML:\x20','Source:','\x20Context\x20set:\x20','customerGroupFile','schemaError','Parent\x20segment:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','Listing\x20parent\x20segments\x20matching\x20\x27','execute','SQL\x20query:\x0a','\x20kill','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20--behavior\x20\x22','Site:\x20','Error:\x20File\x20not\x20found:\x20','displayAttributesStats','segment','Executing\x20parent\x20segment\x20query...','addAttributes','Found\x20YAML\x20file:\x20','site','table','segment:parent:push','.yaml','Error:\x20--attribute\x20requires\x20a\x20name\x0a','matchedCount','pushParentYaml','interval','\x27...','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','database','isDirectory','length','Created','displaySummary','\x20parent\x20segment','timezone','columns','\x20Opening\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','-1d','Options:','Options\x20(one\x20required):\x0a','\x20parent\x20segment\x20\x27','Table:\x20','double','segment:parent:validate','2356nVWCXK','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','repeat','segment:parent:view','attributes','1810WIaScZ','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','sampleData','use','column','/\x20→\x20','customerGroup','master','text','workflowId','elapsedTimeMillis','To\x20cancel:','getParentSQL','✔\x20Found\x20','/sessions/','preview','log','SELECT\x20*\x20FROM\x20(\x0a','/app/dw/parentSegments/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Errors:','tdx\x20segment\x20parent\x20preview\x20','Apply\x20changes\x20to\x20\x27','foreignKey','segment:parent:run','segment:parent:pull','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20--interval\x20','\x27\x20and\x20run\x20workflow?','dirname','✔\x20No\x20changes\x20-\x20\x27','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','all','rowCount','listParents','Show\x20parent\x20segment\x20details','data','attribute','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','darwin','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','listFields','workflowSessionId','red','Fetching\x20parent\x20segment\x20\x27','processedRows','population','99ZbiYvg','segment:parent:list','\x20rows)','xdg-open','coveragePercent','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20tdx\x20wf\x20attempt\x20','workflowAttemptId','resolveParentId','yellow','behaviors','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','dim','Rows:','displayValidateResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x27\x20is\x20up\x20to\x20date','Aborted.','error','getParentFull','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Join\x20on:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','819659Tvceio','Join:','name','Status:','Error\x20reading\x20file:\x20','updateParent','Updating','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','win32','runParent','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Available\x20behaviors:','jsonl','Resolving\x20parent\x20segment\x20\x27','open','Error:\x20Parent\x20segment\x20name\x20is\x20required','description','displayPreviewHints','localeCompare','Behaviors','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','Pattern:\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x5c$&','joinKey','limit','addBehaviorsFile','Audience\x20ID:','behaviorsFile','Available\x20attributes:','query','segment:parent:update','\x20[Job\x20ID:\x20','audienceId','endsWith','map','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Creating','2927700GDMHiG','Updated','\x20\x20No\x20sample\x20data\x20available','List\x20parent\x20segments','allValid','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','segment:parent:fields','varchar','\x20rows\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','replace','scheduleType','attributesFile','Get\x20SQL\x20query\x20for\x20parent\x20segment','behavior','Analyzing\x20changes...','\x20\x20\x20\x20-\x20','displayMasterInfo','bold','keys','stop','Error:\x20--behavior\x20requires\x20a\x20name\x0a','errors','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','customerPercent','\x20is\x20already\x20up\x20to\x20date','ignore','/attempt/','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','segment:parent:show','Listing\x20parent\x20segments...','session','displaySampleData','.yml','enriched','Master:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Error:','\x0a✔\x20Workflow\x20started','utf-8','Preview:','using\x20the\x20default\x20path:\x20','start','Name:\x20','Options:\x0a','toLocaleString','Listing\x20fields\x20for\x20\x27','in\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','/\x20directories\x20exist.','\x27\x20is\x20already\x20up\x20to\x20date','2NPFjEG','\x0aChanges\x20to\x20\x27','YAML\x20file:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','platform','apply','\x20=\x20','parent_segment','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Updating\x20parent\x20segment\x20\x27','green','Fetching\x20sample\x20data...','15659148DbjckD','\x0aUsage:\x20tdx\x20ps\x20preview\x20'];a28_0xe99e=function(){return _0x10fd5c;};return a28_0xe99e();}import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a28_0x4d9b6e from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a28_0x3d9eee(0x1f5);function openBrowser(_0x5b4fb7){const _0xb4a241=a28_0x3d9eee,_0x297c33=process[_0xb4a241(0x1f2)],_0x3cad34=_0x297c33===_0xb4a241(0x29a)?_0xb4a241(0x19d):_0x297c33===_0xb4a241(0x197)?_0xb4a241(0x1e2):_0xb4a241(0x2a5);spawn(_0x3cad34,[_0x5b4fb7],{'detached':!![],'stdio':_0xb4a241(0x1d2)})['unref']();}function migrateLegacyDirectory(){const _0x5e1cab=a28_0x3d9eee;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0xc5510a=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0xc5510a[_0x5e1cab(0x25c)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5e1cab(0x18a)](a28_0x4d9b6e[_0x5e1cab(0x181)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x5e1cab(0x1ea))),console[_0x5e1cab(0x18a)](a28_0x4d9b6e[_0x5e1cab(0x184)](_0x5e1cab(0x234)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a28_0x4d9b6e[_0x5e1cab(0x181)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5e1cab(0x276)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a28_0x4d9b6e[_0x5e1cab(0x1f8)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3849f9){const _0x223bd9=_0x3849f9 instanceof Error?_0x3849f9[_0x5e1cab(0x1fe)]:String(_0x3849f9);return console[_0x5e1cab(0x18a)](a28_0x4d9b6e['red'](_0x5e1cab(0x20a)+_0x223bd9+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a28_0x3d9eee(0x232)](_0x33f448){const _0x4826af=a28_0x3d9eee;return migrateLegacyDirectory(),super[_0x4826af(0x232)](_0x33f448);}}function resolveYamlFile(_0xe01c8b){const _0x1890df=a28_0x3d9eee;if(_0xe01c8b[_0x1890df(0x1b2)]('.yml')||_0xe01c8b[_0x1890df(0x1b2)](_0x1890df(0x251)))return _0xe01c8b;return a28_0x2b43c0['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0xe01c8b)+_0x1890df(0x1d9));}function formatProgressMessage(_0x15235f){const _0x226c42=a28_0x3d9eee,_0xbdb971=_0x15235f['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xbdb971){const [,_0x2592b9,_0x17edca,_0x2e2952='']=_0xbdb971;return a28_0x4d9b6e[_0x226c42(0x184)](_0x2592b9+':')+'\x20'+_0x17edca+a28_0x4d9b6e[_0x226c42(0x184)](_0x2e2952);}return a28_0x4d9b6e['dim'](_0x15235f);}function showFileNotFoundError(_0x1bcddc,_0x225874){const _0x2b7360=a28_0x3d9eee;console[_0x2b7360(0x18a)](a28_0x4d9b6e[_0x2b7360(0x29e)](_0x2b7360(0x248)+_0x1bcddc+'\x0a')),console[_0x2b7360(0x18a)](a28_0x4d9b6e[_0x2b7360(0x239)](_0x2b7360(0x1a3)+_0x225874+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x36494e){const _0x38805a=a28_0x3d9eee;console[_0x38805a(0x18a)](a28_0x4d9b6e[_0x38805a(0x181)](_0x38805a(0x264))),console[_0x38805a(0x18a)](_0x36494e);}export class ParentSegmentListCommand extends BaseCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x2a3);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x1ba);async[a28_0x3d9eee(0x242)](_0x555a58){const _0x137a4a=a28_0x3d9eee,{options:_0x85541a,args:_0x360572,tdx:_0x336f28}=_0x555a58,_0x416eef=_0x360572[0x0];_0x85541a[_0x137a4a(0x229)]&&(console[_0x137a4a(0x18a)](_0x137a4a(0x247)+_0x85541a[_0x137a4a(0x24e)]),_0x416eef&&console[_0x137a4a(0x18a)](_0x137a4a(0x1a5)+_0x416eef));const _0x22689c=await withSpinner(_0x416eef?_0x137a4a(0x241)+_0x416eef+_0x137a4a(0x256):_0x137a4a(0x1d6),()=>_0x336f28[_0x137a4a(0x24a)][_0x137a4a(0x295)](),{'verbose':_0x85541a[_0x137a4a(0x229)]});let _0x595496=_0x22689c[_0x137a4a(0x297)];if(_0x416eef){const _0x47d03d=_0x416eef[_0x137a4a(0x1c2)](/[.+^${}()|[\]\\]/g,_0x137a4a(0x1a7))[_0x137a4a(0x1c2)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2c3171=new RegExp('^'+_0x47d03d+'$','i');_0x595496=_0x595496[_0x137a4a(0x213)](_0x204531=>_0x2c3171[_0x137a4a(0x203)](_0x204531[_0x137a4a(0x270)][_0x137a4a(0x191)]));}_0x595496['sort']((_0x2507ee,_0x18f68e)=>_0x2507ee[_0x137a4a(0x270)]['name'][_0x137a4a(0x1a1)](_0x18f68e['attributes'][_0x137a4a(0x191)])),console[_0x137a4a(0x18a)]('✔\x20Found\x20'+_0x595496[_0x137a4a(0x25d)]+_0x137a4a(0x260)+(_0x595496['length']!==0x1?'s':''));if(_0x85541a['format']===_0x137a4a(0x21d)||_0x85541a[_0x137a4a(0x202)]==='jsonl')await handleSDKOutput(_0x595496,_0x85541a);else{if(_0x595496[_0x137a4a(0x25d)]===0x0)_0x416eef?console[_0x137a4a(0x281)](_0x137a4a(0x28d)+_0x416eef):console[_0x137a4a(0x281)](_0x137a4a(0x211));else for(const _0x2f554f of _0x595496){const _0x3b514d=_0x2f554f['attributes']['population']?a28_0x4d9b6e[_0x137a4a(0x184)]('\x20('+formatRows(_0x2f554f[_0x137a4a(0x270)][_0x137a4a(0x2a1)])+')'):'';console[_0x137a4a(0x281)](_0x137a4a(0x227)+_0x2f554f['attributes']['name']+_0x3b514d);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x220);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x183);async['execute'](_0x3df5ea){const _0x49cc6d=a28_0x3d9eee,{options:_0x365e41,args:_0x2e965c,tdx:_0x5bae83}=_0x3df5ea;console['error'](_0x49cc6d(0x1bc)+_0x49cc6d(0x1e9)+_0x49cc6d(0x17d));const _0x1769fc=_0x365e41;if(_0x2e965c[_0x49cc6d(0x25d)]===0x0)return console[_0x49cc6d(0x18a)](a28_0x4d9b6e[_0x49cc6d(0x29e)](_0x49cc6d(0x19e))),console['error'](_0x49cc6d(0x1dc)),0x1;const _0x37d5aa=_0x2e965c[0x0];if(!_0x1769fc[_0x49cc6d(0x25b)]||!_0x1769fc['table'])return console[_0x49cc6d(0x18a)](_0x49cc6d(0x240)),console['error'](_0x49cc6d(0x1dc)),0x1;_0x1769fc[_0x49cc6d(0x229)]&&(console[_0x49cc6d(0x18a)](_0x49cc6d(0x247)+_0x1769fc['site']),console[_0x49cc6d(0x18a)](_0x49cc6d(0x1e3)+_0x37d5aa),console[_0x49cc6d(0x18a)]('Database:\x20'+_0x1769fc[_0x49cc6d(0x25b)]),console[_0x49cc6d(0x18a)](_0x49cc6d(0x269)+_0x1769fc['table']));const _0x34e7c5=await loadJSONFromOptions(_0x1769fc[_0x49cc6d(0x270)],_0x1769fc[_0x49cc6d(0x1c4)]),_0x42a0fa=await loadJSONFromOptions(_0x1769fc[_0x49cc6d(0x182)],_0x1769fc[_0x49cc6d(0x1ac)]),_0x12543=await loadJSONFromOptions(_0x1769fc[_0x49cc6d(0x277)],_0x1769fc[_0x49cc6d(0x23d)]),_0x3e2772={'name':_0x37d5aa,'description':_0x1769fc[_0x49cc6d(0x19f)],'scheduleType':_0x1769fc[_0x49cc6d(0x1c3)],'scheduleOption':_0x1769fc[_0x49cc6d(0x212)],'timezone':_0x1769fc[_0x49cc6d(0x261)],'master':{'parentDatabaseName':_0x1769fc[_0x49cc6d(0x25b)],'parentTableName':_0x1769fc[_0x49cc6d(0x24f)]},'attributes':_0x34e7c5,'behaviors':_0x42a0fa,'customerGroup':_0x12543},_0x3c2cc2=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x37d5aa+_0x49cc6d(0x256),()=>_0x5bae83[_0x49cc6d(0x24a)][_0x49cc6d(0x230)](_0x3e2772),{'verbose':_0x365e41[_0x49cc6d(0x229)]}),_0x33293d=_0x3c2cc2[_0x49cc6d(0x297)];return console[_0x49cc6d(0x18a)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x33293d['name']+'\x27\x20with\x20ID:\x20'+_0x33293d['id']),await handleSDKOutput([_0x33293d],_0x365e41),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x1af);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x235);async[a28_0x3d9eee(0x242)](_0x57075c){const _0x5bb8f8=a28_0x3d9eee,{options:_0x1f959c,args:_0x529571,tdx:_0x5efca2}=_0x57075c;console[_0x5bb8f8(0x18a)](_0x5bb8f8(0x1ef)+_0x5bb8f8(0x1e9)+_0x5bb8f8(0x17d));const _0x335df7=_0x1f959c;if(_0x529571[_0x5bb8f8(0x25d)]===0x0)return console[_0x5bb8f8(0x18a)](a28_0x4d9b6e[_0x5bb8f8(0x29e)](_0x5bb8f8(0x19e))),console['error'](_0x5bb8f8(0x18c)),0x1;const _0x614d64=_0x529571[0x0];_0x335df7[_0x5bb8f8(0x229)]&&(console[_0x5bb8f8(0x18a)](_0x5bb8f8(0x247)+_0x335df7[_0x5bb8f8(0x24e)]),console[_0x5bb8f8(0x18a)]('Parent\x20segment:\x20'+_0x614d64));const _0xeae9b8=await withSpinner(_0x5bb8f8(0x20f)+_0x614d64+_0x5bb8f8(0x256),()=>_0x5efca2['segment'][_0x5bb8f8(0x18b)](_0x614d64),{'verbose':_0x335df7['verbose']}),_0xd665f6=_0xeae9b8[_0x5bb8f8(0x297)],_0x98303c=await loadJSONFromOptions(_0x335df7[_0x5bb8f8(0x24c)],_0x335df7['addAttributesFile']),_0x412b0c=await loadJSONFromOptions(_0x335df7['addBehaviors'],_0x335df7[_0x5bb8f8(0x1aa)]),_0xb5ff66={'name':_0xd665f6[_0x5bb8f8(0x191)],'description':_0x335df7[_0x5bb8f8(0x19f)]!==undefined?_0x335df7['description']:_0xd665f6[_0x5bb8f8(0x19f)],'scheduleType':_0x335df7[_0x5bb8f8(0x1c3)]!==undefined?_0x335df7[_0x5bb8f8(0x1c3)]:_0xd665f6[_0x5bb8f8(0x1c3)],'scheduleOption':_0x335df7[_0x5bb8f8(0x212)]!==undefined?_0x335df7[_0x5bb8f8(0x212)]:_0xd665f6[_0x5bb8f8(0x212)],'timezone':_0x335df7[_0x5bb8f8(0x261)]!==undefined?_0x335df7[_0x5bb8f8(0x261)]:_0xd665f6[_0x5bb8f8(0x261)],'master':_0xd665f6[_0x5bb8f8(0x278)],'attributes':_0x98303c?[..._0xd665f6['attributes']||[],..._0x98303c]:_0xd665f6['attributes'],'behaviors':_0x412b0c?[..._0xd665f6[_0x5bb8f8(0x182)]||[],..._0x412b0c]:_0xd665f6['behaviors'],'customerGroup':_0xd665f6[_0x5bb8f8(0x277)]},_0x4cadb0=await withSpinner(_0x5bb8f8(0x1f7)+_0x614d64+_0x5bb8f8(0x256),()=>_0x5efca2['segment'][_0x5bb8f8(0x194)](_0x614d64,_0xb5ff66),{'verbose':_0x335df7[_0x5bb8f8(0x229)]}),_0x32de89=_0x4cadb0[_0x5bb8f8(0x297)];return console[_0x5bb8f8(0x18a)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x32de89['name']+'\x27'),await handleSDKOutput([_0x32de89],_0x335df7),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x28a);['description']=a28_0x3d9eee(0x1a6);async[a28_0x3d9eee(0x242)](_0x1fdc70){const _0x40042b=a28_0x3d9eee,{options:_0x56f1ca,args:_0x1991e7,tdx:_0x95866}=_0x1fdc70,_0x596c66=_0x56f1ca,_0x44a18f=_0x1991e7[0x0]||_0x56f1ca[_0x40042b(0x210)];if(!_0x44a18f)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x596c66[_0x40042b(0x274)]&&_0x596c66[_0x40042b(0x226)])return console['error'](a28_0x4d9b6e[_0x40042b(0x29e)](_0x40042b(0x20d))),console[_0x40042b(0x18a)](a28_0x4d9b6e['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x40042b(0x18a)](a28_0x4d9b6e['dim'](_0x40042b(0x1e1)+PARENT_SEGMENT_DIR+_0x40042b(0x224))),console[_0x40042b(0x18a)](a28_0x4d9b6e[_0x40042b(0x239)](_0x40042b(0x1f6))),0x1;const _0x141147=_0x596c66[_0x40042b(0x226)]||a28_0x2b43c0['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x44a18f)+_0x40042b(0x1d9));_0x596c66[_0x40042b(0x229)]&&(console['error'](_0x40042b(0x247)+_0x596c66['site']),console[_0x40042b(0x18a)](_0x40042b(0x23f)+_0x44a18f),console['error']('Output\x20file:\x20'+_0x141147));const _0x426917=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x44a18f+_0x40042b(0x256),()=>_0x95866[_0x40042b(0x24a)]['pullParentYaml'](_0x44a18f),{'verbose':_0x596c66[_0x40042b(0x229)]}),_0x338884=_0x426917[_0x40042b(0x297)];if(existsSync(_0x141147)){const _0x3020c4=readFileSync(_0x141147,_0x40042b(0x1df)),_0x4cf19b=generateDiff(_0x3020c4,_0x338884);if(!hasChanges(_0x4cf19b))console[_0x40042b(0x18a)](a28_0x4d9b6e['green']('✔')+_0x40042b(0x1ff)+a28_0x4d9b6e['cyan'](_0x141147)+_0x40042b(0x1d1));else{console[_0x40042b(0x18a)](_0x40042b(0x1ed)+_0x141147+'\x27:'),console[_0x40042b(0x18a)]('─'['repeat'](0x3c)),console[_0x40042b(0x18a)](formatDiffWithColors(_0x4cf19b)),console['error']('─'['repeat'](0x3c));if(!_0x596c66['yes']){const _0x1b4a18=await confirmKey(_0x40042b(0x206)+_0x141147+'\x27?');if(!_0x1b4a18)return console['error'](_0x40042b(0x189)),0x1;}writeFileSync(_0x141147,_0x338884,'utf-8'),console[_0x40042b(0x18a)](a28_0x4d9b6e[_0x40042b(0x1f8)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a28_0x4d9b6e[_0x40042b(0x239)](_0x141147));}}else{const _0x3c8a85=a28_0x2b43c0[_0x40042b(0x290)](_0x141147);!existsSync(_0x3c8a85)&&mkdirSync(_0x3c8a85,{'recursive':!![]}),writeFileSync(_0x141147,_0x338884,_0x40042b(0x1df)),console[_0x40042b(0x18a)](a28_0x4d9b6e[_0x40042b(0x1f8)]('✔')+_0x40042b(0x1f1)+a28_0x4d9b6e[_0x40042b(0x239)](_0x141147));}return saveSessionContext({'parent_segment':_0x44a18f},_0x596c66[_0x40042b(0x1d7)]),console[_0x40042b(0x18a)](a28_0x4d9b6e[_0x40042b(0x1f8)]('✔')+_0x40042b(0x23c)+a28_0x4d9b6e['dim']('parent_segment')+_0x40042b(0x1f4)+a28_0x4d9b6e[_0x40042b(0x239)](_0x44a18f)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x250);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x28c);async[a28_0x3d9eee(0x242)](_0x2ab28e){const _0x317403=a28_0x3d9eee,{options:_0x2f9545,args:_0x12b916,tdx:_0x544fec}=_0x2ab28e,_0x3129aa=_0x2f9545,_0x2f2f24=_0x12b916[0x0]||_0x2f9545[_0x317403(0x210)];if(!_0x2f2f24)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'+_0x317403(0x284)),0x1;const _0x32e7bc=resolveYamlFile(_0x2f2f24);if(!existsSync(_0x32e7bc))return showFileNotFoundError(_0x32e7bc,_0x2f2f24),0x1;_0x3129aa['verbose']&&(console[_0x317403(0x18a)](_0x317403(0x247)+_0x3129aa[_0x317403(0x24e)]),console['error'](_0x317403(0x1ee)+_0x32e7bc));let _0x3c39c4;try{_0x3c39c4=readFileSync(_0x32e7bc,_0x317403(0x1df));}catch(_0x4f9295){const _0x5ead03=_0x4f9295 instanceof Error?_0x4f9295['message']:String(_0x4f9295);return console[_0x317403(0x18a)]('Error\x20reading\x20file:\x20'+_0x5ead03),0x1;}const _0x5a06dc=await withSpinner(_0x317403(0x1c7),()=>_0x544fec[_0x317403(0x24a)][_0x317403(0x254)](_0x3c39c4),{'verbose':_0x3129aa[_0x317403(0x229)]}),_0x2f7e29=_0x5a06dc['data'],{isNew:_0x3d4835,name:_0x45d2cf,hasChanges:_0x1a5efa,diffFormatted:_0x445d44}=_0x2f7e29;if(!_0x1a5efa)return console[_0x317403(0x18a)]('✔\x20No\x20changes\x20-\x20\x27'+_0x45d2cf+_0x317403(0x1eb)),0x0;_0x3d4835?console[_0x317403(0x18a)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x45d2cf+'\x27:'):console[_0x317403(0x18a)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x45d2cf+'\x27:');console[_0x317403(0x18a)]('─'[_0x317403(0x26e)](0x3c)),console['error'](_0x445d44),console[_0x317403(0x18a)]('─'[_0x317403(0x26e)](0x3c));const _0x5076ed=_0x3d4835?_0x317403(0x216)+_0x45d2cf+'\x27?':_0x317403(0x287)+_0x45d2cf+'\x27?';if(!_0x3129aa[_0x317403(0x22b)]){const _0x2c0b15=await confirmKey(_0x5076ed);if(!_0x2c0b15)return console[_0x317403(0x18a)](_0x317403(0x189)),0x1;}const _0x42146d=_0x3d4835?'Creating':'Updating',_0x22582c=await withSpinner(_0x42146d+_0x317403(0x268)+_0x45d2cf+'\x27...',()=>_0x2f7e29[_0x317403(0x1f3)](),{'verbose':_0x3129aa['verbose']}),_0x49b462=_0x22582c[_0x317403(0x297)],_0x48a6e3=getConsoleNextUrl(_0x3129aa['site'],_0x317403(0x283)+_0x49b462['id']),_0x18d536=_0x3d4835?_0x317403(0x25e):_0x317403(0x1b8);return console[_0x317403(0x18a)]('✔\x20'+_0x18d536+_0x317403(0x268)+_0x49b462[_0x317403(0x191)]+'\x27'),console[_0x317403(0x18a)]('\x20\x20'+_0x48a6e3),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x26b);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x1bd);async[a28_0x3d9eee(0x242)](_0x5291fa){const _0x41f891=a28_0x3d9eee,{options:_0x26cda0,args:_0x2c07b7,tdx:_0x4d9415}=_0x5291fa,_0xb41d20=_0x26cda0,_0x37723f=_0x2c07b7[0x0]||_0x26cda0[_0x41f891(0x210)];if(!_0x37723f)return showParentSegmentNotSetError(_0x41f891(0x1c1)+_0x41f891(0x245)+_0x41f891(0x1e4)+_0x41f891(0x1f0)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x5cca51=resolveYamlFile(_0x37723f);if(!existsSync(_0x5cca51))return showFileNotFoundError(_0x5cca51,_0x37723f),0x1;_0xb41d20[_0x41f891(0x229)]&&(console[_0x41f891(0x18a)](_0x41f891(0x247)+_0xb41d20[_0x41f891(0x24e)]),console[_0x41f891(0x18a)]('YAML\x20file:\x20'+_0x5cca51));let _0x3f0013;try{_0x3f0013=readFileSync(_0x5cca51,_0x41f891(0x1df));}catch(_0x4fb463){const _0x10da59=_0x4fb463 instanceof Error?_0x4fb463['message']:String(_0x4fb463);return console[_0x41f891(0x18a)](_0x41f891(0x193)+_0x10da59),0x1;}const _0x2e4122=createCommandSpinner(a28_0x4d9b6e[_0x41f891(0x184)]('Validating\x20configuration...'),{'verbose':_0xb41d20[_0x41f891(0x229)]});_0x2e4122['start']();const _0x1a40ae={'onProgress':_0x26da68=>{_0x2e4122['text']=formatProgressMessage(_0x26da68);}};if(_0xb41d20['master'])_0x1a40ae[_0x41f891(0x278)]=!![];if(_0xb41d20[_0x41f891(0x1da)])_0x1a40ae[_0x41f891(0x1da)]=!![];_0xb41d20['attribute']&&(_0x1a40ae[_0x41f891(0x298)]=_0xb41d20[_0x41f891(0x298)]);_0xb41d20['behavior']&&(_0x1a40ae[_0x41f891(0x1c6)]=_0xb41d20[_0x41f891(0x1c6)]);if(_0xb41d20[_0x41f891(0x255)])_0x1a40ae['interval']=_0xb41d20[_0x41f891(0x255)];let _0x2c431c;try{_0x2c431c=await _0x4d9415['segment']['validateParentYaml'](_0x3f0013,_0x1a40ae),_0x2e4122['stop']();}catch(_0x3e55b0){_0x2e4122[_0x41f891(0x1cc)]();throw _0x3e55b0;}const _0x46fe8a=_0xb41d20[_0x41f891(0x255)]||_0x41f891(0x265);return this[_0x41f891(0x186)](_0x2c431c,_0x1a40ae,_0x5cca51,_0x46fe8a),_0x2c431c[_0x41f891(0x1bb)]?0x0:0x1;}[a28_0x3d9eee(0x186)](_0x22c6e5,_0x9fef18,_0x20b499,_0x59f2ca){const _0x4338f5=a28_0x3d9eee;console['error']('\x0a'+a28_0x4d9b6e['bold'](_0x4338f5(0x238))+'\x20'+_0x22c6e5[_0x4338f5(0x191)]),console[_0x4338f5(0x18a)]('═'[_0x4338f5(0x26e)](0x3c)),this[_0x4338f5(0x1c9)](_0x22c6e5);if(typeof _0x9fef18['attribute']==='string'){this[_0x4338f5(0x249)](_0x22c6e5),this[_0x4338f5(0x25f)](_0x22c6e5),this[_0x4338f5(0x1a0)](_0x20b499,_0x59f2ca,'attribute',_0x9fef18['attribute']);return;}if(_0x9fef18['attribute']===!![]){this[_0x4338f5(0x249)](_0x22c6e5),this[_0x4338f5(0x25f)](_0x22c6e5),this[_0x4338f5(0x1a0)](_0x20b499,_0x59f2ca,'attributes');return;}if(typeof _0x9fef18[_0x4338f5(0x1c6)]===_0x4338f5(0x20b)){this[_0x4338f5(0x231)](_0x22c6e5,_0x59f2ca),this[_0x4338f5(0x25f)](_0x22c6e5),this[_0x4338f5(0x1a0)](_0x20b499,_0x59f2ca,_0x4338f5(0x1c6),_0x9fef18['behavior']);return;}if(_0x9fef18[_0x4338f5(0x1c6)]===!![]){this[_0x4338f5(0x231)](_0x22c6e5,_0x59f2ca),this['displaySummary'](_0x22c6e5),this[_0x4338f5(0x1a0)](_0x20b499,_0x59f2ca,_0x4338f5(0x182));return;}this['displayAttributesStats'](_0x22c6e5),this['displayBehaviorsStats'](_0x22c6e5,_0x59f2ca),this[_0x4338f5(0x25f)](_0x22c6e5),this[_0x4338f5(0x1a0)](_0x20b499,_0x59f2ca,_0x4338f5(0x293));}[a28_0x3d9eee(0x1a0)](_0x113bcc,_0x392345,_0x1e9b17,_0x4e8330){const _0x254880=a28_0x3d9eee;console[_0x254880(0x18a)]('\x0a'+a28_0x4d9b6e[_0x254880(0x184)](_0x254880(0x222)));const _0x595025=_0x392345!=='-1d'?_0x254880(0x28e)+_0x392345:'';if(_0x1e9b17===_0x254880(0x298)&&_0x4e8330)console[_0x254880(0x18a)]('\x20\x20'+a28_0x4d9b6e['dim'](_0x254880(0x286)+_0x113bcc+'\x20--attribute\x20\x22'+_0x4e8330+'\x22'+_0x595025));else{if(_0x1e9b17===_0x254880(0x1c6)&&_0x4e8330)console[_0x254880(0x18a)]('\x20\x20'+a28_0x4d9b6e['dim'](_0x254880(0x286)+_0x113bcc+_0x254880(0x246)+_0x4e8330+'\x22'+_0x595025));else(_0x1e9b17===_0x254880(0x270)||_0x1e9b17==='all')&&console[_0x254880(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x254880(0x184)](_0x254880(0x286)+_0x113bcc+_0x254880(0x223)+_0x595025));}(_0x1e9b17===_0x254880(0x182)||_0x1e9b17===_0x254880(0x293))&&console[_0x254880(0x18a)]('\x20\x20'+a28_0x4d9b6e['dim'](_0x254880(0x286)+_0x113bcc+_0x254880(0x221)+_0x595025)),_0x1e9b17===_0x254880(0x293)&&console[_0x254880(0x18a)]('\x20\x20'+a28_0x4d9b6e['dim'](_0x254880(0x286)+_0x113bcc+_0x254880(0x215)+_0x595025));}[a28_0x3d9eee(0x1c9)](_0x5435c9){const _0x61a09a=a28_0x3d9eee,{master:_0x44e7b2}=_0x5435c9,_0x11277b=_0x44e7b2[_0x61a09a(0x209)]?a28_0x4d9b6e[_0x61a09a(0x1f8)]('✔'):a28_0x4d9b6e[_0x61a09a(0x29e)]('✘');console['error']('\x0a'+a28_0x4d9b6e[_0x61a09a(0x184)]('Master\x20Table')),console[_0x61a09a(0x18a)](_0x11277b+'\x20'+a28_0x4d9b6e[_0x61a09a(0x1ca)](_0x44e7b2[_0x61a09a(0x25b)]+'.'+_0x44e7b2['table'])),_0x44e7b2[_0x61a09a(0x209)]?_0x44e7b2['rowCount']!==undefined&&console[_0x61a09a(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x61a09a(0x184)](_0x61a09a(0x185))+'\x20'+a28_0x4d9b6e[_0x61a09a(0x239)](formatRows(_0x44e7b2[_0x61a09a(0x294)]))):console['error']('\x20\x20'+a28_0x4d9b6e[_0x61a09a(0x29e)]('Error:')+'\x20'+_0x44e7b2['schemaError']);}[a28_0x3d9eee(0x249)](_0x2dac8f){const _0x24e886=a28_0x3d9eee;if(_0x2dac8f[_0x24e886(0x270)]['length']===0x0)return;console['error']('\x0a'+a28_0x4d9b6e[_0x24e886(0x184)](_0x24e886(0x20c)));for(const _0x4963a0 of _0x2dac8f[_0x24e886(0x270)]){const _0x1afecc=_0x4963a0['schemaValid']?a28_0x4d9b6e[_0x24e886(0x1f8)]('✔'):a28_0x4d9b6e[_0x24e886(0x29e)]('✘');let _0x87c3ac='';if(_0x4963a0[_0x24e886(0x209)]&&_0x4963a0[_0x24e886(0x253)]!==undefined&&_0x4963a0['coveragePercent']!==undefined){const _0x1cad1e=_0x4963a0[_0x24e886(0x2a6)][_0x24e886(0x225)](0x1),_0x5ea577=_0x4963a0[_0x24e886(0x2a6)]>=0x50?a28_0x4d9b6e['green']:_0x4963a0[_0x24e886(0x2a6)]>=0x32?a28_0x4d9b6e['yellow']:a28_0x4d9b6e[_0x24e886(0x29e)];_0x87c3ac='\x20'+a28_0x4d9b6e[_0x24e886(0x184)]('Coverage:')+'\x20'+_0x5ea577(_0x1cad1e+'%')+'\x20('+formatRows(_0x4963a0['matchedCount'])+_0x24e886(0x2a4);}console[_0x24e886(0x18a)](_0x1afecc+'\x20'+a28_0x4d9b6e[_0x24e886(0x1ca)](_0x4963a0[_0x24e886(0x191)])+_0x87c3ac),console[_0x24e886(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x24e886(0x184)](_0x24e886(0x23b))+'\x20'+a28_0x4d9b6e['bold'](_0x4963a0[_0x24e886(0x25b)]+'.'+_0x4963a0[_0x24e886(0x24f)]));const _0x47969d=_0x4963a0['joinKey']===_0x4963a0[_0x24e886(0x288)]?a28_0x4d9b6e[_0x24e886(0x184)](_0x24e886(0x18d))+'\x20'+_0x4963a0['joinKey']:a28_0x4d9b6e[_0x24e886(0x184)]('Join:')+'\x20'+_0x4963a0[_0x24e886(0x1a8)]+_0x24e886(0x1f4)+_0x4963a0[_0x24e886(0x288)];console['error']('\x20\x20'+_0x47969d),console['error']('\x20\x20'+a28_0x4d9b6e[_0x24e886(0x184)]('Columns:')),this[_0x24e886(0x217)](_0x4963a0[_0x24e886(0x262)]),!_0x4963a0[_0x24e886(0x209)]&&console[_0x24e886(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x24e886(0x29e)](_0x24e886(0x1dd))+'\x20'+_0x4963a0[_0x24e886(0x23e)]);}}[a28_0x3d9eee(0x231)](_0x22dac,_0x5892e4){const _0x254104=a28_0x3d9eee;if(_0x22dac[_0x254104(0x182)][_0x254104(0x25d)]===0x0)return;console['error']('\x0a'+a28_0x4d9b6e[_0x254104(0x184)](_0x254104(0x1a2))+'\x20'+a28_0x4d9b6e[_0x254104(0x184)]('('+_0x5892e4+')'));for(const _0x52fae9 of _0x22dac['behaviors']){const _0x3fb768=_0x52fae9[_0x254104(0x209)]?a28_0x4d9b6e[_0x254104(0x1f8)]('✔'):a28_0x4d9b6e[_0x254104(0x29e)]('✘');let _0x51b380='';if(_0x52fae9[_0x254104(0x209)]&&_0x52fae9[_0x254104(0x22e)]!==undefined&&_0x52fae9['totalEvents']!==undefined){const _0x5dcdce=_0x52fae9['customerPercent']?.[_0x254104(0x225)](0x1)||'?',_0x4cb8e2=(_0x52fae9[_0x254104(0x1d0)]??0x0)>=0x32?a28_0x4d9b6e[_0x254104(0x1f8)]:(_0x52fae9[_0x254104(0x1d0)]??0x0)>=0x14?a28_0x4d9b6e[_0x254104(0x181)]:a28_0x4d9b6e[_0x254104(0x29e)];_0x51b380='\x20'+a28_0x4d9b6e[_0x254104(0x184)](_0x254104(0x233))+'\x20'+_0x4cb8e2(formatRows(_0x52fae9[_0x254104(0x22e)]))+'\x20('+_0x5dcdce+'%)\x20'+a28_0x4d9b6e[_0x254104(0x184)]('Events:')+'\x20'+a28_0x4d9b6e[_0x254104(0x239)](formatRows(_0x52fae9['totalEvents']));}console[_0x254104(0x18a)](_0x3fb768+'\x20'+a28_0x4d9b6e[_0x254104(0x1ca)](_0x52fae9[_0x254104(0x191)])+_0x51b380),console['error']('\x20\x20'+a28_0x4d9b6e[_0x254104(0x184)](_0x254104(0x23b))+'\x20'+a28_0x4d9b6e[_0x254104(0x1ca)](_0x52fae9[_0x254104(0x25b)]+'.'+_0x52fae9[_0x254104(0x24f)]));const _0x47047f=_0x52fae9[_0x254104(0x1a8)]===_0x52fae9[_0x254104(0x288)]?a28_0x4d9b6e[_0x254104(0x184)]('Join\x20on:')+'\x20'+_0x52fae9['joinKey']:a28_0x4d9b6e['dim'](_0x254104(0x190))+'\x20'+_0x52fae9[_0x254104(0x1a8)]+_0x254104(0x1f4)+_0x52fae9[_0x254104(0x288)];console[_0x254104(0x18a)]('\x20\x20'+_0x47047f),console[_0x254104(0x18a)]('\x20\x20'+a28_0x4d9b6e['dim'](_0x254104(0x1fc))),this[_0x254104(0x217)](_0x52fae9[_0x254104(0x262)]),!_0x52fae9[_0x254104(0x209)]&&console[_0x254104(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x254104(0x29e)](_0x254104(0x1dd))+'\x20'+_0x52fae9[_0x254104(0x23e)]);}}[a28_0x3d9eee(0x217)](_0x17ca7c){const _0x41aef1=a28_0x3d9eee;for(const _0x5b27de of _0x17ca7c){_0x5b27de[_0x41aef1(0x236)]===_0x5b27de[_0x41aef1(0x275)]||_0x5b27de[_0x41aef1(0x275)]==='*'?console[_0x41aef1(0x18a)](_0x41aef1(0x1c8)+_0x5b27de[_0x41aef1(0x236)]):console['error'](_0x41aef1(0x1c8)+_0x5b27de['label']+'\x20'+a28_0x4d9b6e['dim']('('+_0x5b27de[_0x41aef1(0x275)]+')'));}}['displaySummary'](_0x4d04d2){const _0x2c42bc=a28_0x3d9eee;console[_0x2c42bc(0x18a)]('─'['repeat'](0x3c));if(_0x4d04d2['errors'][_0x2c42bc(0x25d)]>0x0){console['error']('\x0a'+a28_0x4d9b6e[_0x2c42bc(0x29e)]('Errors:'));for(const _0x1486ca of _0x4d04d2[_0x2c42bc(0x1ce)]){console[_0x2c42bc(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x2c42bc(0x29e)]('•')+'\x20'+_0x1486ca);}}_0x4d04d2[_0x2c42bc(0x1bb)]&&console[_0x2c42bc(0x18a)]('\x0a'+a28_0x4d9b6e[_0x2c42bc(0x1f8)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a28_0x3d9eee(0x191)]='segment:parent:preview';['description']='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x2b5e66){const _0x586ece=a28_0x3d9eee,{options:_0x18918d,args:_0x46628c,tdx:_0x3a6a3a}=_0x2b5e66,_0x36fb1b=_0x18918d,_0x30b71f=_0x46628c[0x0]||_0x18918d[_0x586ece(0x210)];if(!_0x30b71f)return showParentSegmentNotSetError(_0x586ece(0x22c)+_0x586ece(0x26d)+_0x586ece(0x267)+_0x586ece(0x237)+_0x586ece(0x258)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x586ece(0x21b)+_0x586ece(0x25a)),0x1;if(!_0x36fb1b[_0x586ece(0x278)]&&!_0x36fb1b[_0x586ece(0x298)]&&!_0x36fb1b[_0x586ece(0x1c6)]&&!_0x36fb1b['enriched'])return console[_0x586ece(0x18a)](a28_0x4d9b6e[_0x586ece(0x29e)](_0x586ece(0x199))),console['error'](_0x586ece(0x1e8)),console[_0x586ece(0x18a)](_0x586ece(0x266)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x586ece(0x18a)](_0x586ece(0x196)),console[_0x586ece(0x18a)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x220342=resolveYamlFile(_0x30b71f);if(!existsSync(_0x220342))return showFileNotFoundError(_0x220342,_0x30b71f),0x1;_0x36fb1b[_0x586ece(0x229)]&&(console[_0x586ece(0x18a)](_0x586ece(0x247)+_0x36fb1b[_0x586ece(0x24e)]),console[_0x586ece(0x18a)]('YAML\x20file:\x20'+_0x220342));let _0x41c9f3;try{_0x41c9f3=readFileSync(_0x220342,_0x586ece(0x1df));}catch(_0x494f27){const _0x59f78f=_0x494f27 instanceof Error?_0x494f27[_0x586ece(0x1fe)]:String(_0x494f27);return console['error'](_0x586ece(0x193)+_0x59f78f),0x1;}let _0x2c9d8f;try{_0x2c9d8f=parseYamlString(_0x41c9f3);}catch(_0x5b1a44){const _0x4bf8a4=_0x5b1a44 instanceof Error?_0x5b1a44[_0x586ece(0x1fe)]:String(_0x5b1a44);return console['error'](a28_0x4d9b6e[_0x586ece(0x29e)](_0x586ece(0x23a)+_0x4bf8a4)),0x1;}if(_0x36fb1b[_0x586ece(0x298)]===!![]||_0x36fb1b[_0x586ece(0x298)]===''){const _0x2f48d4=_0x2c9d8f[_0x586ece(0x270)]?.[_0x586ece(0x1b3)](_0x4cc2be=>_0x4cc2be[_0x586ece(0x191)])||[];if(_0x2f48d4[_0x586ece(0x25d)]===0x0)console[_0x586ece(0x18a)](a28_0x4d9b6e[_0x586ece(0x29e)](_0x586ece(0x257)));else{console['error'](a28_0x4d9b6e['red'](_0x586ece(0x252))),console[_0x586ece(0x18a)](_0x586ece(0x1ad));for(const _0xc08e4b of _0x2f48d4){console[_0x586ece(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x586ece(0x239)](_0xc08e4b));}console['error'](_0x586ece(0x1fb)+_0x30b71f+'\x20--attribute\x20\x22'+_0x2f48d4[0x0]+'\x22');}return 0x1;}if(_0x36fb1b['behavior']===!![]||_0x36fb1b[_0x586ece(0x1c6)]===''){const _0x237c45=_0x2c9d8f['behaviors']?.[_0x586ece(0x1b3)](_0x3d0bec=>_0x3d0bec[_0x586ece(0x191)])||[];if(_0x237c45[_0x586ece(0x25d)]===0x0)console[_0x586ece(0x18a)](a28_0x4d9b6e[_0x586ece(0x29e)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a28_0x4d9b6e[_0x586ece(0x29e)](_0x586ece(0x1cd))),console[_0x586ece(0x18a)](_0x586ece(0x19a));for(const _0x2576e8 of _0x237c45){console[_0x586ece(0x18a)]('\x20\x20'+a28_0x4d9b6e['cyan'](_0x2576e8));}console[_0x586ece(0x18a)](_0x586ece(0x1fb)+_0x30b71f+_0x586ece(0x246)+_0x237c45[0x0]+'\x22');}return 0x1;}const _0x33c75b=createCommandSpinner(a28_0x4d9b6e[_0x586ece(0x184)](_0x586ece(0x1f9)),{'verbose':_0x36fb1b[_0x586ece(0x229)]});_0x33c75b['start']();const _0x2b78e5={'onProgress':_0x3e47d8=>{const _0x40aad9=_0x586ece;_0x33c75b[_0x40aad9(0x279)]=formatProgressMessage(_0x3e47d8);}};if(_0x36fb1b[_0x586ece(0x278)])_0x2b78e5[_0x586ece(0x278)]=!![];if(_0x36fb1b[_0x586ece(0x298)]&&typeof _0x36fb1b[_0x586ece(0x298)]===_0x586ece(0x20b))_0x2b78e5[_0x586ece(0x298)]=_0x36fb1b[_0x586ece(0x298)];if(_0x36fb1b['behavior']&&typeof _0x36fb1b['behavior']===_0x586ece(0x20b))_0x2b78e5[_0x586ece(0x1c6)]=_0x36fb1b[_0x586ece(0x1c6)];if(_0x36fb1b[_0x586ece(0x1da)])_0x2b78e5[_0x586ece(0x1da)]=!![];if(_0x36fb1b['interval'])_0x2b78e5['interval']=_0x36fb1b[_0x586ece(0x255)];let _0x4e21cd;try{_0x4e21cd=await _0x3a6a3a[_0x586ece(0x24a)][_0x586ece(0x228)](_0x41c9f3,_0x2b78e5),_0x33c75b[_0x586ece(0x1cc)]();}catch(_0x4c4e3f){_0x33c75b[_0x586ece(0x1cc)]();throw _0x4c4e3f;}return await this[_0x586ece(0x200)](_0x4e21cd,{'master':_0x36fb1b['master'],'attribute':typeof _0x36fb1b[_0x586ece(0x298)]===_0x586ece(0x20b)?_0x36fb1b[_0x586ece(0x298)]:undefined,'behavior':typeof _0x36fb1b['behavior']===_0x586ece(0x20b)?_0x36fb1b[_0x586ece(0x1c6)]:undefined,'enriched':_0x36fb1b['enriched']}),_0x4e21cd['allValid']?0x0:0x1;}async[a28_0x3d9eee(0x200)](_0x36e1f6,_0x18d226){const _0x2ff76f=a28_0x3d9eee;console[_0x2ff76f(0x18a)]('\x0a'+a28_0x4d9b6e[_0x2ff76f(0x1ca)](_0x2ff76f(0x1e0))+'\x20'+_0x36e1f6[_0x2ff76f(0x191)]),console[_0x2ff76f(0x18a)]('═'[_0x2ff76f(0x26e)](0x3c));if(_0x18d226[_0x2ff76f(0x278)]&&_0x36e1f6[_0x2ff76f(0x273)]){const _0x4caa0b=a28_0x4d9b6e[_0x2ff76f(0x184)](_0x2ff76f(0x1db))+'\x20'+a28_0x4d9b6e[_0x2ff76f(0x1ca)](_0x36e1f6[_0x2ff76f(0x278)][_0x2ff76f(0x25b)]+'.'+_0x36e1f6[_0x2ff76f(0x278)]['table']);await this[_0x2ff76f(0x1d8)](_0x4caa0b,_0x36e1f6[_0x2ff76f(0x273)]);}else{if(_0x18d226[_0x2ff76f(0x298)]&&_0x36e1f6[_0x2ff76f(0x273)]){const _0xdfb92a=a28_0x4d9b6e[_0x2ff76f(0x184)](_0x2ff76f(0x214))+'\x20'+a28_0x4d9b6e[_0x2ff76f(0x1ca)](_0x18d226[_0x2ff76f(0x298)]);await this[_0x2ff76f(0x1d8)](_0xdfb92a,_0x36e1f6[_0x2ff76f(0x273)]);}else{if(_0x18d226[_0x2ff76f(0x1c6)]&&_0x36e1f6[_0x2ff76f(0x273)]){const _0x38cb5f=a28_0x4d9b6e[_0x2ff76f(0x184)](_0x2ff76f(0x207))+'\x20'+a28_0x4d9b6e['bold'](_0x18d226[_0x2ff76f(0x1c6)]);await this[_0x2ff76f(0x1d8)](_0x38cb5f,_0x36e1f6[_0x2ff76f(0x273)]);}else{if(_0x18d226[_0x2ff76f(0x1da)]&&_0x36e1f6[_0x2ff76f(0x273)]){const _0x52c540=a28_0x4d9b6e[_0x2ff76f(0x184)]('Enriched:')+'\x20'+a28_0x4d9b6e[_0x2ff76f(0x1ca)]('Master\x20+\x20Attributes');await this[_0x2ff76f(0x1d8)](_0x52c540,_0x36e1f6[_0x2ff76f(0x273)]);}else!_0x36e1f6[_0x2ff76f(0x273)]&&console[_0x2ff76f(0x18a)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x36e1f6[_0x2ff76f(0x1ce)]['length']>0x0){console[_0x2ff76f(0x18a)]('─'[_0x2ff76f(0x26e)](0x3c)),console[_0x2ff76f(0x18a)]('\x0a'+a28_0x4d9b6e[_0x2ff76f(0x29e)](_0x2ff76f(0x285)));for(const _0x2588b8 of _0x36e1f6[_0x2ff76f(0x1ce)]){console[_0x2ff76f(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x2ff76f(0x29e)]('•')+'\x20'+_0x2588b8);}}}async[a28_0x3d9eee(0x1d8)](_0x5364d1,_0x1a633c){const _0x3882cb=a28_0x3d9eee;if(_0x1a633c[_0x3882cb(0x25d)]===0x0){console[_0x3882cb(0x18a)]('\x0a'+_0x5364d1),console['error'](_0x3882cb(0x1b9));return;}console['error']('\x0a'+_0x5364d1);const _0x8f77b7=Object[_0x3882cb(0x1cb)](_0x1a633c[0x0])[_0x3882cb(0x1b3)](_0x5b9a7e=>({'name':_0x5b9a7e,'type':typeof _0x1a633c[0x0][_0x5b9a7e]==='number'?_0x3882cb(0x26a):_0x3882cb(0x1bf)})),_0x1630b6={'queryId':_0x3882cb(0x280),'columns':_0x8f77b7,'data':_0x1a633c,'stats':{'state':_0x3882cb(0x218),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1a633c['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x41c20e=formatAsTable(_0x1630b6,_0x1a633c[_0x3882cb(0x25d)],!![]);await writeOutput(_0x41c20e,undefined,_0x3882cb(0x24f));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a28_0x3d9eee(0x191)]=a28_0x3d9eee(0x289);['description']=a28_0x3d9eee(0x1b4);async[a28_0x3d9eee(0x242)](_0x3e7971){const _0x5831f0=a28_0x3d9eee,{options:_0x3f907f,args:_0x563c05,tdx:_0x28c94e}=_0x3e7971,_0x45b6f8=_0x3f907f,_0x496fbd=_0x563c05[0x0]||_0x3f907f[_0x5831f0(0x210)];if(!_0x496fbd)return showParentSegmentNotSetError(_0x5831f0(0x204)+_0x5831f0(0x259)),0x1;const _0x2e2156=resolveYamlFile(_0x496fbd);if(existsSync(_0x2e2156)){_0x45b6f8[_0x5831f0(0x229)]&&console[_0x5831f0(0x18a)](_0x5831f0(0x24d)+_0x2e2156);let _0x108b04;try{_0x108b04=readFileSync(_0x2e2156,'utf-8');}catch(_0x32f2b6){const _0x45e8d6=_0x32f2b6 instanceof Error?_0x32f2b6[_0x5831f0(0x1fe)]:String(_0x32f2b6);return console[_0x5831f0(0x18a)](_0x5831f0(0x193)+_0x45e8d6),0x1;}const _0xd2ff0c=await withSpinner(_0x5831f0(0x1c7),()=>_0x28c94e[_0x5831f0(0x24a)][_0x5831f0(0x254)](_0x108b04),{'verbose':_0x45b6f8[_0x5831f0(0x229)]}),_0x3355a2=_0xd2ff0c[_0x5831f0(0x297)],{isNew:_0x11f9ba,name:_0x5c5386,hasChanges:_0x1bfc50,diffFormatted:_0x5c1e5b}=_0x3355a2;if(_0x1bfc50){_0x11f9ba?console[_0x5831f0(0x18a)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x5c5386+'\x27:'):console[_0x5831f0(0x18a)](_0x5831f0(0x1a4)+_0x5c5386+'\x27:');console['error']('─'[_0x5831f0(0x26e)](0x3c)),console[_0x5831f0(0x18a)](_0x5c1e5b),console[_0x5831f0(0x18a)]('─'[_0x5831f0(0x26e)](0x3c));const _0x9fc65f=_0x11f9ba?_0x5831f0(0x216)+_0x5c5386+'\x27\x20and\x20run\x20workflow?':_0x5831f0(0x287)+_0x5c5386+_0x5831f0(0x28f);if(!_0x45b6f8[_0x5831f0(0x22b)]){const _0x415889=await confirmKey(_0x9fc65f);if(!_0x415889)return console['error']('Aborted.'),0x1;}const _0x3e0bdc=_0x11f9ba?_0x5831f0(0x1b6):_0x5831f0(0x195);await withSpinner(_0x3e0bdc+'\x20parent\x20segment\x20\x27'+_0x5c5386+_0x5831f0(0x256),()=>_0x3355a2['apply'](),{'verbose':_0x45b6f8[_0x5831f0(0x229)]});const _0x4cc8ed=_0x11f9ba?_0x5831f0(0x25e):_0x5831f0(0x1b8);console['error']('✔\x20'+_0x4cc8ed+_0x5831f0(0x268)+_0x5c5386+'\x27');}else console[_0x5831f0(0x18a)](_0x5831f0(0x291)+_0x5c5386+_0x5831f0(0x188));}const _0x3e5873=await withSpinner(_0x5831f0(0x292)+_0x496fbd+_0x5831f0(0x256),()=>_0x28c94e['segment'][_0x5831f0(0x198)](_0x496fbd),{'verbose':_0x45b6f8[_0x5831f0(0x229)]}),_0x3da636=_0x3e5873['data'],_0x24b5bf=getConsoleUrl(_0x45b6f8[_0x5831f0(0x24e)],_0x5831f0(0x21f)+_0x3da636[_0x5831f0(0x27a)]+_0x5831f0(0x27f)+_0x3da636[_0x5831f0(0x29d)]+_0x5831f0(0x1d3)+_0x3da636[_0x5831f0(0x17f)]);return console[_0x5831f0(0x18a)](_0x5831f0(0x1de)),console['error']('\x20\x20'+a28_0x4d9b6e[_0x5831f0(0x184)](_0x5831f0(0x1ab))+'\x20'+_0x3da636[_0x5831f0(0x1b1)]),console[_0x5831f0(0x18a)]('\x20\x20'+a28_0x4d9b6e['dim'](_0x5831f0(0x192))+'\x20'+_0x3da636[_0x5831f0(0x208)]),console[_0x5831f0(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x5831f0(0x184)](_0x5831f0(0x22d))+'\x20'+_0x3da636[_0x5831f0(0x29d)]),console[_0x5831f0(0x18a)]('\x20\x20'+a28_0x4d9b6e[_0x5831f0(0x184)]('Attempt:')+'\x20'+_0x3da636['workflowAttemptId']),console[_0x5831f0(0x18a)]('\x20\x20'+_0x24b5bf),console[_0x5831f0(0x18a)]('\x0a'+a28_0x4d9b6e[_0x5831f0(0x184)](_0x5831f0(0x27c))+_0x5831f0(0x17e)+_0x3da636[_0x5831f0(0x17f)]+_0x5831f0(0x244)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a28_0x3d9eee(0x1be);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x1fd);async[a28_0x3d9eee(0x242)](_0xc6ceea){const _0x75e4bf=a28_0x3d9eee,{options:_0xf83ef6,args:_0x11eb84,tdx:_0x40add3}=_0xc6ceea,_0x5b2ac3=_0x11eb84[0x0]||_0xf83ef6[_0x75e4bf(0x210)];if(!_0x5b2ac3)return showParentSegmentNotSetError(_0x75e4bf(0x1d4)+_0x75e4bf(0x299)),0x1;_0xf83ef6['verbose']&&(console[_0x75e4bf(0x18a)]('Site:\x20'+_0xf83ef6['site']),console[_0x75e4bf(0x18a)](_0x75e4bf(0x23f)+_0x5b2ac3));const _0x35f8eb=await withSpinner(_0x75e4bf(0x1e6)+_0x5b2ac3+_0x75e4bf(0x256),()=>_0x40add3[_0x75e4bf(0x24a)][_0x75e4bf(0x29c)](_0x5b2ac3),{'verbose':_0xf83ef6[_0x75e4bf(0x229)]}),_0x560625=_0x35f8eb[_0x75e4bf(0x297)];console[_0x75e4bf(0x18a)](_0x75e4bf(0x27e)+_0x560625[_0x75e4bf(0x25d)]+'\x20field'+(_0x560625['length']!==0x1?'s':''));if(_0xf83ef6[_0x75e4bf(0x21d)]||_0xf83ef6[_0x75e4bf(0x19b)])return await handleSDKOutput(_0x560625,_0xf83ef6),0x0;return displayFieldsHumanReadable(_0x560625,_0x5b2ac3),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a28_0x3d9eee(0x26f);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x296);async[a28_0x3d9eee(0x242)](_0x1eeeb8){const _0x337838=a28_0x3d9eee,{options:_0x9773c8,args:_0x3ff586,tdx:_0x506e3e}=_0x1eeeb8,_0x14d4a0=_0x9773c8,_0x32c5ff=_0x3ff586[0x0]||_0x9773c8[_0x337838(0x210)];if(!_0x32c5ff)return showParentSegmentNotSetError(_0x337838(0x1cf)+_0x337838(0x187)+_0x337838(0x1e4)+_0x337838(0x28b)),0x1;_0x9773c8[_0x337838(0x229)]&&(console[_0x337838(0x18a)](_0x337838(0x247)+_0x9773c8[_0x337838(0x24e)]),console[_0x337838(0x18a)](_0x337838(0x23f)+_0x32c5ff));const _0x3d4caf=await withSpinner(_0x337838(0x29f)+_0x32c5ff+_0x337838(0x256),()=>_0x506e3e[_0x337838(0x24a)]['getParentFull'](_0x32c5ff),{'verbose':_0x9773c8[_0x337838(0x229)]}),_0x3eb297=_0x3d4caf[_0x337838(0x297)];if(_0x14d4a0['web']){const _0x5e85b0=getConsoleNextUrl(_0x14d4a0['site'],'/app/dw/parentSegments/'+_0x3eb297['id']);return console[_0x337838(0x18a)](a28_0x4d9b6e[_0x337838(0x1f8)]('✔')+_0x337838(0x263)+a28_0x4d9b6e[_0x337838(0x239)](_0x5e85b0)),openBrowser(_0x5e85b0),0x0;}return await handleSingleObjectOutput(_0x3eb297,_0x9773c8),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a28_0x3d9eee(0x20e);[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x18e);async['execute'](_0x3217a0){const _0x57aed4=a28_0x3d9eee,{options:_0x9ffac4,args:_0xced21e,tdx:_0x22e491}=_0x3217a0,_0x3559a6=_0xced21e[0x0]||_0x9ffac4[_0x57aed4(0x210)];if(!_0x3559a6)return showParentSegmentNotSetError(_0x57aed4(0x272)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x9ffac4[_0x57aed4(0x229)]&&(console['error'](_0x57aed4(0x247)+_0x9ffac4[_0x57aed4(0x24e)]),console['error'](_0x57aed4(0x23f)+_0x3559a6));const _0x1f2d0e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3559a6+_0x57aed4(0x256),()=>_0x22e491[_0x57aed4(0x24a)][_0x57aed4(0x180)](_0x3559a6),{'verbose':_0x9ffac4[_0x57aed4(0x229)]}),_0xd9f45=_0x1f2d0e[_0x57aed4(0x297)],_0x4b12d4=await withSpinner(_0x57aed4(0x22f)+_0x3559a6+_0x57aed4(0x256),()=>_0x22e491['segment'][_0x57aed4(0x27d)](_0xd9f45),{'verbose':_0x9ffac4['verbose']}),_0x11bb9a=await executeSchemaQuery(_0x4b12d4[_0x57aed4(0x297)],_0x22e491,_0x9ffac4);return await handleQueryOutput(_0x11bb9a,_0x9ffac4),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a28_0x3d9eee(0x191)]='segment:parent:sql';[a28_0x3d9eee(0x19f)]=a28_0x3d9eee(0x1c5);async['execute'](_0x16cbfb){const _0x4d73f8=a28_0x3d9eee,{options:_0x2fc8b4,args:_0x10d437,tdx:_0x327e60}=_0x16cbfb,_0x24b5d7=_0x10d437[0x0]||_0x2fc8b4['parentSegment'];if(!_0x24b5d7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x4d73f8(0x29b)),0x1;_0x2fc8b4[_0x4d73f8(0x229)]&&(console[_0x4d73f8(0x18a)](_0x4d73f8(0x247)+_0x2fc8b4[_0x4d73f8(0x24e)]),console[_0x4d73f8(0x18a)](_0x4d73f8(0x23f)+_0x24b5d7));const _0xd07083=await withSpinner(_0x4d73f8(0x19c)+_0x24b5d7+_0x4d73f8(0x256),()=>_0x327e60[_0x4d73f8(0x24a)][_0x4d73f8(0x180)](_0x24b5d7),{'verbose':_0x2fc8b4[_0x4d73f8(0x229)]}),_0x1ed03f=_0xd07083[_0x4d73f8(0x297)],_0x212fbe=await withSpinner(_0x4d73f8(0x22f)+_0x24b5d7+_0x4d73f8(0x256),()=>_0x327e60[_0x4d73f8(0x24a)][_0x4d73f8(0x27d)](_0x1ed03f),{'verbose':_0x2fc8b4[_0x4d73f8(0x229)]}),_0x17793e=_0x212fbe['data'];return _0x2fc8b4['format']===_0x4d73f8(0x21d)||_0x2fc8b4[_0x4d73f8(0x202)]===_0x4d73f8(0x19b)?await handleSDKOutput([{'sql':_0x17793e}],_0x2fc8b4):console[_0x4d73f8(0x281)](_0x17793e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a28_0x3d9eee(0x1d5);['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a28_0x3d9eee(0x242)](_0x136673){const _0x2cb18a=a28_0x3d9eee,{options:_0x317e66,args:_0x46e483,tdx:_0x36dc0b}=_0x136673,_0x3fff1f=_0x46e483[0x0]||_0x317e66[_0x2cb18a(0x210)];if(!_0x3fff1f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x2cb18a(0x1b5)),0x1;_0x317e66[_0x2cb18a(0x229)]&&(console['error'](_0x2cb18a(0x247)+_0x317e66[_0x2cb18a(0x24e)]),console[_0x2cb18a(0x18a)]('Parent\x20segment:\x20'+_0x3fff1f));const _0x1f3208=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3fff1f+'\x27...',()=>_0x36dc0b[_0x2cb18a(0x24a)]['resolveParentId'](_0x3fff1f),{'verbose':_0x317e66[_0x2cb18a(0x229)]}),_0x6d562c=_0x1f3208['data'],_0x343dbd=await withSpinner(_0x2cb18a(0x22f)+_0x3fff1f+_0x2cb18a(0x256),()=>_0x36dc0b['segment'][_0x2cb18a(0x27d)](_0x6d562c),{'verbose':_0x317e66[_0x2cb18a(0x229)]});let _0x274b94=_0x343dbd[_0x2cb18a(0x297)];const _0x14a94d=resolveLimit(_0x317e66[_0x2cb18a(0x1a9)],DEFAULT_DISPLAY_LIMIT),_0x407841=/\bLIMIT\s+\d+/i[_0x2cb18a(0x203)](_0x274b94);!_0x407841&&(_0x274b94=_0x274b94['trim']()['replace'](/;+$/,''),_0x274b94=_0x2cb18a(0x282)+_0x274b94+_0x2cb18a(0x205)+_0x14a94d);_0x317e66[_0x2cb18a(0x229)]&&console['error'](_0x2cb18a(0x243)+_0x274b94);const _0xe851b6=await withQuerySpinner(_0x2cb18a(0x24b),async _0x1b56c2=>{const _0x2bf89e=_0x2cb18a,_0x4d53ce=await _0x36dc0b[_0x2bf89e(0x1ae)][_0x2bf89e(0x242)](_0x274b94,{'catalog':'td','schema':'information_schema','onJobId':_0x4f52c2=>{_0x1b56c2['setJobId'](_0x4f52c2);}});return _0x4d53ce;},{'verbose':_0x317e66[_0x2cb18a(0x229)]}),_0xdaf921=_0xe851b6['data'],_0x1bb142=_0xdaf921[_0x2cb18a(0x21c)]?_0x2cb18a(0x1b0)+_0xdaf921[_0x2cb18a(0x21c)]+']':'';return console[_0x2cb18a(0x18a)]('✔\x20Query\x20completed:\x20Processed\x20'+_0xdaf921['stats'][_0x2cb18a(0x2a0)][_0x2cb18a(0x1e5)]()+_0x2cb18a(0x1c0)+(_0x2cb18a(0x1e7)+formatElapsed(_0xdaf921['stats'][_0x2cb18a(0x27b)])+_0x1bb142)),await handleQueryOutput(_0xdaf921,_0x317e66),0x0;}}
1
+ const a28_0x1408f6=a28_0x29f8;(function(_0x4de90d,_0x2d2309){const _0x2627d8=a28_0x29f8,_0x2e8086=_0x4de90d();while(!![]){try{const _0x4d2b5e=parseInt(_0x2627d8(0x161))/0x1*(-parseInt(_0x2627d8(0xd9))/0x2)+-parseInt(_0x2627d8(0x119))/0x3*(-parseInt(_0x2627d8(0xce))/0x4)+parseInt(_0x2627d8(0x142))/0x5*(-parseInt(_0x2627d8(0xfa))/0x6)+parseInt(_0x2627d8(0x110))/0x7*(-parseInt(_0x2627d8(0x12d))/0x8)+parseInt(_0x2627d8(0xc9))/0x9+-parseInt(_0x2627d8(0xe4))/0xa+-parseInt(_0x2627d8(0x19c))/0xb*(-parseInt(_0x2627d8(0xcd))/0xc);if(_0x4d2b5e===_0x2d2309)break;else _0x2e8086['push'](_0x2e8086['shift']());}catch(_0x1fa031){_0x2e8086['push'](_0x2e8086['shift']());}}}(a28_0xe956,0x61118));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a28_0x45c961 from'path';import{BaseCommand}from'./command.js';function a28_0xe956(){const _0x251e4b=['Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Status:','List\x20available\x20fields\x20for\x20segmentation','data','segment:parent:run','test','yes','xdg-open','Parent\x20segment:\x20','replace','Updated','\x20Opening\x20','column','addBehaviors','Attempt:','isDirectory','1725QslROc','pushParentYaml','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x0aChanges\x20to\x20\x27','matchedCount','workflowAttemptId','jsonl','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','open','segment:parent:create','\x20--interval\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Executing\x20parent\x20segment\x20query...','\x20[Job\x20ID:\x20','runParent','Creating','stop','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','map','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x0aChanges\x20to\x20apply\x20to\x20\x27','/\x20directory.\x0a','\x20--attribute\x20\x22<name>\x22','\x20--behavior\x20\x22<name>\x22','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x27\x20is\x20already\x20up\x20to\x20date','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Error:\x20Parent\x20segment\x20name\x20is\x20required','/sessions/','name','filter','588253xdSzDj','Show\x20parent\x20segment\x20schema\x20(column\x20types)','varchar','\x20kill','customerGroupFile','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','database','Fetching\x20SQL\x20for\x20\x27','Rows:','sort','FINISHED','json','Error\x20parsing\x20YAML:\x20','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','message','/attempt/','segment:parent:sql','\x20Context\x20set:\x20','Listing\x20fields\x20for\x20\x27','displaySummary','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','coveragePercent','-1d','Updating','jobId','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','dirname','\x0aNew\x20parent\x20segment\x20\x27','previewParentYaml','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','log','Available\x20behaviors:','platform','unref','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','/\x20→\x20','createParent','getParentFull','Join:','attributes','\x20field','/app/dw/parentSegments/','keys','join','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Source:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','cyan','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','apply','\x27\x20with\x20ID:\x20','\x20--behavior\x20\x22','Validate:','\x20tdx\x20wf\x20attempt\x20','Behaviors','1892385AWrZMu','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','displayValidateResults','in\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Apply\x20changes\x20to\x20\x27','\x20--attribute\x20\x22','\x0aNo\x20sample\x20data\x20available','execute','segment:parent:desc','yellow','length','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','.yml','displayAttributesStats','Error:\x20--attribute\x20requires\x20a\x20name\x0a','verbose','master','Resolving\x20parent\x20segment\x20\x27','audienceId','bold','schemaError','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','interval','Error:\x20--behavior\x20requires\x20a\x20name\x0a','attributesFile','Error:\x20File\x20not\x20found:\x20','utf-8','Creating\x20parent\x20segment\x20\x27','\x20is\x20already\x20up\x20to\x20date','parent_segment','YAML\x20file:\x20','segment:parent:fields','displayPreviewHints','preview','resolveParentId','Aborted.','label','\x20Configuration\x20is\x20valid','parent_segments','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','customerGroup','Columns:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','all','Site:\x20','Error:','/{name}.yml\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','✔\x20Updated\x20parent\x20segment\x20\x27','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displaySampleData','tdx\x20segment\x20parent\x20preview\x20','Audience\x20ID:','customerPercent','stats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','population','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','allValid','description','double','totalEvents','\x20parent\x20segment\x20\x27','status','endsWith','using\x20the\x20default\x20path:\x20','getParentSQL','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20\x20\x20-\x20','segment:parent:pull','workflowSessionId','Events:','segment','text','updateParent','\x20=\x20','\x20rows)','Validating\x20configuration...','1357677XMVZzm','Error\x20reading\x20file:\x20','.yaml','web','108eAgwVw','1952036rQvvKs','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','rowCount','joinKey','Options:\x0a','schemaValid','win32','setJobId','\x0a⚠️\x20\x20Both\x20','errors','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','2dHeCYD','displayMasterInfo','Found\x20YAML\x20file:\x20','darwin','start','List\x20parent\x20segments','✔\x20No\x20changes\x20-\x20\x27','attribute','behavior','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:preview','2415560qyCrNm','limit','✔\x20Renamed\x20directory\x20to\x20','👥\x20','match','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Enriched:','Join\x20on:','displayBehaviorsStats','✔\x20Found\x20','\x20No\x20changes\x20-\x20','repeat','SQL\x20query:\x0a','sampleData','enriched','scheduleOption','segment:parent:view','string','\x5c$&','\x20parent\x20segment','/\x20and\x20','timezone','3048uTrrMF','displayColumns','Name:\x20','workflowId','Customers:','green','Master\x20Table','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Master\x20+\x20Attributes','Get\x20SQL\x20query\x20for\x20parent\x20segment','/app/workflows/','number','behaviors','foreignKey','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','To\x20cancel:','error','Session:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20parent\x20segment\x20\x27','table','To\x20view\x20sample\x20data:','14aGQHhf','\x27...','addBehaviorsFile','site','Show\x20parent\x20segment\x20details','dim','\x20\x20No\x20sample\x20data\x20available','displayPreviewResults','scheduleType','3rxnSAj','session','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Database:\x20','red','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Fetching\x20sample\x20data...','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','parentSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Available\x20attributes:','\x27\x20and\x20run\x20workflow?','Preview:','toFixed','Create\x20parent\x20segment\x20\x27','columns','Created','`\x20to\x20download\x20the\x20configuration\x20first','format','\x27\x20is\x20up\x20to\x20date','3138064tJKWVG','output','addAttributes','Error:\x20--database\x20and\x20--table\x20are\x20required'];a28_0xe956=function(){return _0x251e4b;};return a28_0xe956();}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a28_0xf2d79 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=a28_0x1408f6(0x9e),LEGACY_PARENT_SEGMENT_DIR=a28_0x1408f6(0x1bb);function openBrowser(_0x561216){const _0x19c178=a28_0x1408f6,_0x346802=process[_0x19c178(0x182)],_0x580996=_0x346802===_0x19c178(0xdc)?_0x19c178(0x14a):_0x346802===_0x19c178(0xd4)?_0x19c178(0xdd):_0x19c178(0x139);spawn(_0x580996,[_0x561216],{'detached':!![],'stdio':'ignore'})[_0x19c178(0x183)]();}function migrateLegacyDirectory(){const _0x5825aa=a28_0x1408f6;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x16da0e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x16da0e[_0x5825aa(0x141)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a28_0xf2d79[_0x5825aa(0x1a6)](_0x5825aa(0xd6)+LEGACY_PARENT_SEGMENT_DIR+_0x5825aa(0xf8)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x5825aa(0x10a)](a28_0xf2d79[_0x5825aa(0x115)](_0x5825aa(0xb1)+LEGACY_PARENT_SEGMENT_DIR+_0x5825aa(0x157))),![];console['error'](a28_0xf2d79[_0x5825aa(0x1a6)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5825aa(0x185)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5825aa(0x10a)](a28_0xf2d79[_0x5825aa(0xff)](_0x5825aa(0xe6)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2f9634){const _0x1d3b9c=_0x2f9634 instanceof Error?_0x2f9634[_0x5825aa(0x170)]:String(_0x2f9634);return console['error'](a28_0xf2d79[_0x5825aa(0x11d)](_0x5825aa(0x167)+_0x1d3b9c+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x18671a){return migrateLegacyDirectory(),super['run'](_0x18671a);}}function resolveYamlFile(_0x3e578c){const _0x363c13=a28_0x1408f6;if(_0x3e578c[_0x363c13(0xbb)](_0x363c13(0x1aa))||_0x3e578c[_0x363c13(0xbb)](_0x363c13(0xcb)))return _0x3e578c;return a28_0x45c961[_0x363c13(0x18d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3e578c)+_0x363c13(0x1aa));}function formatProgressMessage(_0x573571){const _0x1ad7b8=a28_0x1408f6,_0x25c622=_0x573571[_0x1ad7b8(0xe8)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x25c622){const [,_0x4bc6fe,_0x2a7d12,_0x4b65c0='']=_0x25c622;return a28_0xf2d79[_0x1ad7b8(0x115)](_0x4bc6fe+':')+'\x20'+_0x2a7d12+a28_0xf2d79[_0x1ad7b8(0x115)](_0x4b65c0);}return a28_0xf2d79[_0x1ad7b8(0x115)](_0x573571);}function showFileNotFoundError(_0x3fb837,_0x4ea1e3){const _0x5c4461=a28_0x1408f6;console['error'](a28_0xf2d79[_0x5c4461(0x11d)](_0x5c4461(0x1b7)+_0x3fb837+'\x0a')),console[_0x5c4461(0x10a)](a28_0xf2d79['cyan'](_0x5c4461(0x184)+_0x4ea1e3+_0x5c4461(0x12a)));}function showParentSegmentNotSetError(_0x204b91){const _0x96fec5=a28_0x1408f6;console[_0x96fec5(0x10a)](a28_0xf2d79[_0x96fec5(0x1a6)](_0x96fec5(0xbe))),console[_0x96fec5(0x10a)](_0x204b91);}export class ParentSegmentListCommand extends BaseCommand{[a28_0x1408f6(0x15f)]='segment:parent:list';[a28_0x1408f6(0xb6)]=a28_0x1408f6(0xde);async[a28_0x1408f6(0x1a4)](_0x352bed){const _0x5cff75=a28_0x1408f6,{options:_0x5977d4,args:_0x136d49,tdx:_0x22eec8}=_0x352bed,_0x3455aa=_0x136d49[0x0];_0x5977d4[_0x5cff75(0x1ad)]&&(console['error'](_0x5cff75(0xa5)+_0x5977d4[_0x5cff75(0x113)]),_0x3455aa&&console[_0x5cff75(0x10a)]('Pattern:\x20'+_0x3455aa));const _0x524c49=await withSpinner(_0x3455aa?_0x5cff75(0x192)+_0x3455aa+'\x27...':'Listing\x20parent\x20segments...',()=>_0x22eec8[_0x5cff75(0xc3)]['listParents'](),{'verbose':_0x5977d4[_0x5cff75(0x1ad)]});let _0x56e1af=_0x524c49[_0x5cff75(0x135)];if(_0x3455aa){const _0x1a0434=_0x3455aa[_0x5cff75(0x13b)](/[.+^${}()|[\]\\]/g,_0x5cff75(0xf6))['replace'](/\*/g,'.*')[_0x5cff75(0x13b)](/\?/g,'.'),_0x118595=new RegExp('^'+_0x1a0434+'$','i');_0x56e1af=_0x56e1af[_0x5cff75(0x160)](_0x558c2f=>_0x118595[_0x5cff75(0x137)](_0x558c2f[_0x5cff75(0x189)]['name']));}_0x56e1af[_0x5cff75(0x16b)]((_0x5549be,_0x4517d0)=>_0x5549be[_0x5cff75(0x189)][_0x5cff75(0x15f)]['localeCompare'](_0x4517d0[_0x5cff75(0x189)][_0x5cff75(0x15f)])),console['error'](_0x5cff75(0xed)+_0x56e1af[_0x5cff75(0x1a7)]+_0x5cff75(0xf7)+(_0x56e1af['length']!==0x1?'s':''));if(_0x5977d4[_0x5cff75(0x12b)]==='json'||_0x5977d4[_0x5cff75(0x12b)]==='jsonl')await handleSDKOutput(_0x56e1af,_0x5977d4);else{if(_0x56e1af[_0x5cff75(0x1a7)]===0x0)_0x3455aa?console['log'](_0x5cff75(0x1a0)+_0x3455aa):console['log']('No\x20parent\x20segments\x20found');else for(const _0x3f09ab of _0x56e1af){const _0x31aa5f=_0x3f09ab[_0x5cff75(0x189)][_0x5cff75(0xb2)]?a28_0xf2d79[_0x5cff75(0x115)]('\x20('+formatRows(_0x3f09ab[_0x5cff75(0x189)][_0x5cff75(0xb2)])+')'):'';console[_0x5cff75(0x180)](_0x5cff75(0xe7)+_0x3f09ab['attributes'][_0x5cff75(0x15f)]+_0x31aa5f);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a28_0x1408f6(0x15f)]=a28_0x1408f6(0x14b);['description']=a28_0x1408f6(0xa0);async['execute'](_0x4a9ca2){const _0x4b0e28=a28_0x1408f6,{options:_0x23b571,args:_0x3c7246,tdx:_0xdace11}=_0x4a9ca2;console[_0x4b0e28(0x10a)](_0x4b0e28(0x18f)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4b0e28(0x16f));const _0x4105ae=_0x23b571;if(_0x3c7246[_0x4b0e28(0x1a7)]===0x0)return console[_0x4b0e28(0x10a)](a28_0xf2d79[_0x4b0e28(0x11d)](_0x4b0e28(0x15d))),console[_0x4b0e28(0x10a)](_0x4b0e28(0xa3)),0x1;const _0x489a2c=_0x3c7246[0x0];if(!_0x4105ae[_0x4b0e28(0x168)]||!_0x4105ae['table'])return console['error'](_0x4b0e28(0x130)),console['error'](_0x4b0e28(0xa3)),0x1;_0x4105ae[_0x4b0e28(0x1ad)]&&(console[_0x4b0e28(0x10a)](_0x4b0e28(0xa5)+_0x4105ae[_0x4b0e28(0x113)]),console['error'](_0x4b0e28(0xfc)+_0x489a2c),console[_0x4b0e28(0x10a)](_0x4b0e28(0x11c)+_0x4105ae[_0x4b0e28(0x168)]),console[_0x4b0e28(0x10a)]('Table:\x20'+_0x4105ae[_0x4b0e28(0x10e)]));const _0x1d930f=await loadJSONFromOptions(_0x4105ae[_0x4b0e28(0x189)],_0x4105ae[_0x4b0e28(0x1b6)]),_0x49faac=await loadJSONFromOptions(_0x4105ae['behaviors'],_0x4105ae['behaviorsFile']),_0x5a26e1=await loadJSONFromOptions(_0x4105ae['customerGroup'],_0x4105ae[_0x4b0e28(0x165)]),_0x40ed4f={'name':_0x489a2c,'description':_0x4105ae['description'],'scheduleType':_0x4105ae[_0x4b0e28(0x118)],'scheduleOption':_0x4105ae[_0x4b0e28(0xf3)],'timezone':_0x4105ae[_0x4b0e28(0xf9)],'master':{'parentDatabaseName':_0x4105ae['database'],'parentTableName':_0x4105ae[_0x4b0e28(0x10e)]},'attributes':_0x1d930f,'behaviors':_0x49faac,'customerGroup':_0x5a26e1},_0x1f1704=await withSpinner(_0x4b0e28(0x1b9)+_0x489a2c+'\x27...',()=>_0xdace11['segment'][_0x4b0e28(0x186)](_0x40ed4f),{'verbose':_0x23b571['verbose']}),_0x2ea012=_0x1f1704['data'];return console[_0x4b0e28(0x10a)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x2ea012[_0x4b0e28(0x15f)]+_0x4b0e28(0x197)+_0x2ea012['id']),await handleSDKOutput([_0x2ea012],_0x23b571),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a28_0x1408f6(0x15f)]='segment:parent:update';['description']='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x4c10e7){const _0x26e5bf=a28_0x1408f6,{options:_0x979421,args:_0x5d624e,tdx:_0x3b89cc}=_0x4c10e7;console[_0x26e5bf(0x10a)](_0x26e5bf(0x191)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x26e5bf(0x16f));const _0x272f57=_0x979421;if(_0x5d624e[_0x26e5bf(0x1a7)]===0x0)return console[_0x26e5bf(0x10a)](a28_0xf2d79[_0x26e5bf(0x11d)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x26e5bf(0x10a)](_0x26e5bf(0x101)),0x1;const _0x59ce35=_0x5d624e[0x0];_0x272f57[_0x26e5bf(0x1ad)]&&(console[_0x26e5bf(0x10a)](_0x26e5bf(0xa5)+_0x272f57[_0x26e5bf(0x113)]),console[_0x26e5bf(0x10a)](_0x26e5bf(0x13a)+_0x59ce35));const _0x305b46=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x59ce35+_0x26e5bf(0x111),()=>_0x3b89cc[_0x26e5bf(0xc3)]['getParentFull'](_0x59ce35),{'verbose':_0x272f57[_0x26e5bf(0x1ad)]}),_0x2a394f=_0x305b46['data'],_0x3af899=await loadJSONFromOptions(_0x272f57[_0x26e5bf(0x12f)],_0x272f57['addAttributesFile']),_0x56e929=await loadJSONFromOptions(_0x272f57[_0x26e5bf(0x13f)],_0x272f57[_0x26e5bf(0x112)]),_0x5aba0e={'name':_0x2a394f[_0x26e5bf(0x15f)],'description':_0x272f57[_0x26e5bf(0xb6)]!==undefined?_0x272f57[_0x26e5bf(0xb6)]:_0x2a394f[_0x26e5bf(0xb6)],'scheduleType':_0x272f57[_0x26e5bf(0x118)]!==undefined?_0x272f57[_0x26e5bf(0x118)]:_0x2a394f['scheduleType'],'scheduleOption':_0x272f57[_0x26e5bf(0xf3)]!==undefined?_0x272f57[_0x26e5bf(0xf3)]:_0x2a394f[_0x26e5bf(0xf3)],'timezone':_0x272f57[_0x26e5bf(0xf9)]!==undefined?_0x272f57[_0x26e5bf(0xf9)]:_0x2a394f['timezone'],'master':_0x2a394f[_0x26e5bf(0x1ae)],'attributes':_0x3af899?[..._0x2a394f['attributes']||[],..._0x3af899]:_0x2a394f['attributes'],'behaviors':_0x56e929?[..._0x2a394f[_0x26e5bf(0x106)]||[],..._0x56e929]:_0x2a394f['behaviors'],'customerGroup':_0x2a394f[_0x26e5bf(0xa1)]},_0x51c49b=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x59ce35+_0x26e5bf(0x111),()=>_0x3b89cc['segment'][_0x26e5bf(0xc5)](_0x59ce35,_0x5aba0e),{'verbose':_0x272f57[_0x26e5bf(0x1ad)]}),_0x1cd26e=_0x51c49b[_0x26e5bf(0x135)];return console[_0x26e5bf(0x10a)](_0x26e5bf(0xa9)+_0x1cd26e[_0x26e5bf(0x15f)]+'\x27'),await handleSDKOutput([_0x1cd26e],_0x272f57),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a28_0x1408f6(0x15f)]=a28_0x1408f6(0xc0);['description']=a28_0x1408f6(0x149);async[a28_0x1408f6(0x1a4)](_0x335634){const _0x45eae3=a28_0x1408f6,{options:_0x1e77ee,args:_0x404058,tdx:_0xba1252}=_0x335634,_0x724ff9=_0x1e77ee,_0x3f6540=_0x404058[0x0]||_0x1e77ee[_0x45eae3(0x121)];if(!_0x3f6540)return showParentSegmentNotSetError(_0x45eae3(0xb3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x724ff9['use']&&_0x724ff9['output'])return console[_0x45eae3(0x10a)](a28_0xf2d79[_0x45eae3(0x11d)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x45eae3(0x10a)](a28_0xf2d79[_0x45eae3(0x115)](_0x45eae3(0x1b3))),console['error'](a28_0xf2d79[_0x45eae3(0x115)](_0x45eae3(0xbc)+PARENT_SEGMENT_DIR+_0x45eae3(0xa7))),console[_0x45eae3(0x10a)](a28_0xf2d79['cyan'](_0x45eae3(0xaa))),0x1;const _0x586668=_0x724ff9[_0x45eae3(0x12e)]||a28_0x45c961[_0x45eae3(0x18d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3f6540)+_0x45eae3(0x1aa));_0x724ff9[_0x45eae3(0x1ad)]&&(console[_0x45eae3(0x10a)](_0x45eae3(0xa5)+_0x724ff9[_0x45eae3(0x113)]),console[_0x45eae3(0x10a)]('Parent\x20segment:\x20'+_0x3f6540),console[_0x45eae3(0x10a)]('Output\x20file:\x20'+_0x586668));const _0x353160=await withSpinner(_0x45eae3(0x10d)+_0x3f6540+_0x45eae3(0x111),()=>_0xba1252[_0x45eae3(0xc3)]['pullParentYaml'](_0x3f6540),{'verbose':_0x724ff9[_0x45eae3(0x1ad)]}),_0x505ae9=_0x353160[_0x45eae3(0x135)];if(existsSync(_0x586668)){const _0x4dfbd2=readFileSync(_0x586668,_0x45eae3(0x1b8)),_0x3f8973=generateDiff(_0x4dfbd2,_0x505ae9);if(!hasChanges(_0x3f8973))console[_0x45eae3(0x10a)](a28_0xf2d79[_0x45eae3(0xff)]('✔')+_0x45eae3(0xee)+a28_0xf2d79['cyan'](_0x586668)+_0x45eae3(0x1ba));else{console[_0x45eae3(0x10a)](_0x45eae3(0x145)+_0x586668+'\x27:'),console[_0x45eae3(0x10a)]('─'[_0x45eae3(0xef)](0x3c)),console[_0x45eae3(0x10a)](formatDiffWithColors(_0x3f8973)),console[_0x45eae3(0x10a)]('─'[_0x45eae3(0xef)](0x3c));if(!_0x724ff9[_0x45eae3(0x138)]){const _0x13ab87=await confirmKey('Overwrite\x20\x27'+_0x586668+'\x27?');if(!_0x13ab87)return console[_0x45eae3(0x10a)](_0x45eae3(0x9b)),0x1;}writeFileSync(_0x586668,_0x505ae9,_0x45eae3(0x1b8)),console[_0x45eae3(0x10a)](a28_0xf2d79[_0x45eae3(0xff)]('✔')+_0x45eae3(0x1a9)+a28_0xf2d79[_0x45eae3(0x194)](_0x586668));}}else{const _0x393db8=a28_0x45c961[_0x45eae3(0x17c)](_0x586668);!existsSync(_0x393db8)&&mkdirSync(_0x393db8,{'recursive':!![]}),writeFileSync(_0x586668,_0x505ae9,'utf-8'),console[_0x45eae3(0x10a)](a28_0xf2d79['green']('✔')+_0x45eae3(0x1a9)+a28_0xf2d79[_0x45eae3(0x194)](_0x586668));}return saveSessionContext({'parent_segment':_0x3f6540},_0x724ff9[_0x45eae3(0x11a)]),console[_0x45eae3(0x10a)](a28_0xf2d79[_0x45eae3(0xff)]('✔')+_0x45eae3(0x173)+a28_0xf2d79[_0x45eae3(0x115)](_0x45eae3(0x1bb))+_0x45eae3(0xc6)+a28_0xf2d79[_0x45eae3(0x194)](_0x3f6540)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']='segment:parent:push';[a28_0x1408f6(0xb6)]=a28_0x1408f6(0x15a);async[a28_0x1408f6(0x1a4)](_0x187bd4){const _0x5ac9b0=a28_0x1408f6,{options:_0x27173c,args:_0x42ed4d,tdx:_0x144298}=_0x187bd4,_0x16f667=_0x27173c,_0x1cab1d=_0x42ed4d[0x0]||_0x27173c[_0x5ac9b0(0x121)];if(!_0x1cab1d)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'+_0x5ac9b0(0x9f)),0x1;const _0x55c8ff=resolveYamlFile(_0x1cab1d);if(!existsSync(_0x55c8ff))return showFileNotFoundError(_0x55c8ff,_0x1cab1d),0x1;_0x16f667[_0x5ac9b0(0x1ad)]&&(console['error']('Site:\x20'+_0x16f667[_0x5ac9b0(0x113)]),console[_0x5ac9b0(0x10a)]('YAML\x20file:\x20'+_0x55c8ff));let _0x335035;try{_0x335035=readFileSync(_0x55c8ff,_0x5ac9b0(0x1b8));}catch(_0xd34907){const _0x4ba161=_0xd34907 instanceof Error?_0xd34907[_0x5ac9b0(0x170)]:String(_0xd34907);return console[_0x5ac9b0(0x10a)]('Error\x20reading\x20file:\x20'+_0x4ba161),0x1;}const _0x338944=await withSpinner('Analyzing\x20changes...',()=>_0x144298[_0x5ac9b0(0xc3)][_0x5ac9b0(0x143)](_0x335035),{'verbose':_0x16f667[_0x5ac9b0(0x1ad)]}),_0x44b240=_0x338944['data'],{isNew:_0x33d9a8,name:_0x47fedc,hasChanges:_0xb2dc20,diffFormatted:_0x16d6db}=_0x44b240;if(!_0xb2dc20)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x47fedc+_0x5ac9b0(0x15b)),0x0;_0x33d9a8?console[_0x5ac9b0(0x10a)](_0x5ac9b0(0x17d)+_0x47fedc+'\x27:'):console[_0x5ac9b0(0x10a)](_0x5ac9b0(0x156)+_0x47fedc+'\x27:');console[_0x5ac9b0(0x10a)]('─'[_0x5ac9b0(0xef)](0x3c)),console[_0x5ac9b0(0x10a)](_0x16d6db),console[_0x5ac9b0(0x10a)]('─'[_0x5ac9b0(0xef)](0x3c));const _0x527705=_0x33d9a8?_0x5ac9b0(0x127)+_0x47fedc+'\x27?':_0x5ac9b0(0x1a1)+_0x47fedc+'\x27?';if(!_0x16f667[_0x5ac9b0(0x138)]){const _0x45a818=await confirmKey(_0x527705);if(!_0x45a818)return console[_0x5ac9b0(0x10a)]('Aborted.'),0x1;}const _0x42bc0e=_0x33d9a8?_0x5ac9b0(0x151):_0x5ac9b0(0x179),_0x4d1714=await withSpinner(_0x42bc0e+_0x5ac9b0(0xb9)+_0x47fedc+_0x5ac9b0(0x111),()=>_0x44b240[_0x5ac9b0(0x196)](),{'verbose':_0x16f667[_0x5ac9b0(0x1ad)]}),_0x1b65c0=_0x4d1714[_0x5ac9b0(0x135)],_0x4eef8a=getConsoleNextUrl(_0x16f667[_0x5ac9b0(0x113)],_0x5ac9b0(0x18b)+_0x1b65c0['id']),_0x21634f=_0x33d9a8?_0x5ac9b0(0x129):_0x5ac9b0(0x13c);return console[_0x5ac9b0(0x10a)]('✔\x20'+_0x21634f+'\x20parent\x20segment\x20\x27'+_0x1b65c0[_0x5ac9b0(0x15f)]+'\x27'),console[_0x5ac9b0(0x10a)]('\x20\x20'+_0x4eef8a),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a28_0x1408f6(0x15f)]='segment:parent:validate';[a28_0x1408f6(0xb6)]=a28_0x1408f6(0x18e);async['execute'](_0x3d2f80){const _0x58bbb6=a28_0x1408f6,{options:_0x1c6536,args:_0x15e843,tdx:_0x38cca3}=_0x3d2f80,_0x191c9c=_0x1c6536,_0x9691ca=_0x15e843[0x0]||_0x1c6536['parentSegment'];if(!_0x9691ca)return showParentSegmentNotSetError(_0x58bbb6(0x176)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x58bbb6(0xd2)+_0x58bbb6(0x1a8)+_0x58bbb6(0xcf)+_0x58bbb6(0x120)),0x1;const _0x3b810d=resolveYamlFile(_0x9691ca);if(!existsSync(_0x3b810d))return showFileNotFoundError(_0x3b810d,_0x9691ca),0x1;_0x191c9c[_0x58bbb6(0x1ad)]&&(console[_0x58bbb6(0x10a)](_0x58bbb6(0xa5)+_0x191c9c['site']),console[_0x58bbb6(0x10a)]('YAML\x20file:\x20'+_0x3b810d));let _0x2d54c7;try{_0x2d54c7=readFileSync(_0x3b810d,_0x58bbb6(0x1b8));}catch(_0x44cc3f){const _0x3bf2c8=_0x44cc3f instanceof Error?_0x44cc3f['message']:String(_0x44cc3f);return console[_0x58bbb6(0x10a)]('Error\x20reading\x20file:\x20'+_0x3bf2c8),0x1;}const _0x4e6502=createCommandSpinner(a28_0xf2d79['dim'](_0x58bbb6(0xc8)),{'verbose':_0x191c9c[_0x58bbb6(0x1ad)]});_0x4e6502['start']();const _0x3dc620={'onProgress':_0x321ce4=>{const _0x2d5bd6=_0x58bbb6;_0x4e6502[_0x2d5bd6(0xc4)]=formatProgressMessage(_0x321ce4);}};if(_0x191c9c[_0x58bbb6(0x1ae)])_0x3dc620[_0x58bbb6(0x1ae)]=!![];if(_0x191c9c[_0x58bbb6(0xf2)])_0x3dc620['enriched']=!![];_0x191c9c[_0x58bbb6(0xe0)]&&(_0x3dc620[_0x58bbb6(0xe0)]=_0x191c9c['attribute']);_0x191c9c[_0x58bbb6(0xe1)]&&(_0x3dc620['behavior']=_0x191c9c[_0x58bbb6(0xe1)]);if(_0x191c9c[_0x58bbb6(0x1b4)])_0x3dc620[_0x58bbb6(0x1b4)]=_0x191c9c[_0x58bbb6(0x1b4)];let _0x13bd74;try{_0x13bd74=await _0x38cca3[_0x58bbb6(0xc3)]['validateParentYaml'](_0x2d54c7,_0x3dc620),_0x4e6502['stop']();}catch(_0x497d77){_0x4e6502['stop']();throw _0x497d77;}const _0x498555=_0x191c9c[_0x58bbb6(0x1b4)]||_0x58bbb6(0x178);return this[_0x58bbb6(0x19e)](_0x13bd74,_0x3dc620,_0x3b810d,_0x498555),_0x13bd74[_0x58bbb6(0xb5)]?0x0:0x1;}['displayValidateResults'](_0x3b93ee,_0x1600b8,_0x39878b,_0x1884f1){const _0x3a7cc8=a28_0x1408f6;console[_0x3a7cc8(0x10a)]('\x0a'+a28_0xf2d79[_0x3a7cc8(0x1b1)](_0x3a7cc8(0x199))+'\x20'+_0x3b93ee[_0x3a7cc8(0x15f)]),console[_0x3a7cc8(0x10a)]('═'[_0x3a7cc8(0xef)](0x3c)),this[_0x3a7cc8(0xda)](_0x3b93ee);if(typeof _0x1600b8[_0x3a7cc8(0xe0)]===_0x3a7cc8(0xf5)){this['displayAttributesStats'](_0x3b93ee),this[_0x3a7cc8(0x175)](_0x3b93ee),this[_0x3a7cc8(0x98)](_0x39878b,_0x1884f1,_0x3a7cc8(0xe0),_0x1600b8[_0x3a7cc8(0xe0)]);return;}if(_0x1600b8[_0x3a7cc8(0xe0)]===!![]){this[_0x3a7cc8(0x1ab)](_0x3b93ee),this['displaySummary'](_0x3b93ee),this['displayPreviewHints'](_0x39878b,_0x1884f1,_0x3a7cc8(0x189));return;}if(typeof _0x1600b8['behavior']===_0x3a7cc8(0xf5)){this[_0x3a7cc8(0xec)](_0x3b93ee,_0x1884f1),this[_0x3a7cc8(0x175)](_0x3b93ee),this[_0x3a7cc8(0x98)](_0x39878b,_0x1884f1,_0x3a7cc8(0xe1),_0x1600b8[_0x3a7cc8(0xe1)]);return;}if(_0x1600b8[_0x3a7cc8(0xe1)]===!![]){this[_0x3a7cc8(0xec)](_0x3b93ee,_0x1884f1),this[_0x3a7cc8(0x175)](_0x3b93ee),this[_0x3a7cc8(0x98)](_0x39878b,_0x1884f1,_0x3a7cc8(0x106));return;}this[_0x3a7cc8(0x1ab)](_0x3b93ee),this[_0x3a7cc8(0xec)](_0x3b93ee,_0x1884f1),this[_0x3a7cc8(0x175)](_0x3b93ee),this[_0x3a7cc8(0x98)](_0x39878b,_0x1884f1,'all');}[a28_0x1408f6(0x98)](_0x2cf747,_0x97b87d,_0x5bd046,_0x12602b){const _0x4c3a9a=a28_0x1408f6;console[_0x4c3a9a(0x10a)]('\x0a'+a28_0xf2d79[_0x4c3a9a(0x115)](_0x4c3a9a(0x10f)));const _0x3e7cab=_0x97b87d!==_0x4c3a9a(0x178)?_0x4c3a9a(0x14c)+_0x97b87d:'';if(_0x5bd046===_0x4c3a9a(0xe0)&&_0x12602b)console[_0x4c3a9a(0x10a)]('\x20\x20'+a28_0xf2d79[_0x4c3a9a(0x115)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2cf747+'\x20--attribute\x20\x22'+_0x12602b+'\x22'+_0x3e7cab));else{if(_0x5bd046===_0x4c3a9a(0xe1)&&_0x12602b)console[_0x4c3a9a(0x10a)]('\x20\x20'+a28_0xf2d79[_0x4c3a9a(0x115)](_0x4c3a9a(0xac)+_0x2cf747+_0x4c3a9a(0x198)+_0x12602b+'\x22'+_0x3e7cab));else(_0x5bd046===_0x4c3a9a(0x189)||_0x5bd046==='all')&&console[_0x4c3a9a(0x10a)]('\x20\x20'+a28_0xf2d79[_0x4c3a9a(0x115)](_0x4c3a9a(0xac)+_0x2cf747+_0x4c3a9a(0x158)+_0x3e7cab));}(_0x5bd046===_0x4c3a9a(0x106)||_0x5bd046===_0x4c3a9a(0xa4))&&console[_0x4c3a9a(0x10a)]('\x20\x20'+a28_0xf2d79[_0x4c3a9a(0x115)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2cf747+_0x4c3a9a(0x159)+_0x3e7cab)),_0x5bd046===_0x4c3a9a(0xa4)&&console[_0x4c3a9a(0x10a)]('\x20\x20'+a28_0xf2d79['dim'](_0x4c3a9a(0xac)+_0x2cf747+'\x20--enriched'+_0x3e7cab));}[a28_0x1408f6(0xda)](_0xc361c1){const _0x5e2481=a28_0x1408f6,{master:_0x34d47d}=_0xc361c1,_0x3ea46b=_0x34d47d['schemaValid']?a28_0xf2d79[_0x5e2481(0xff)]('✔'):a28_0xf2d79[_0x5e2481(0x11d)]('✘');console[_0x5e2481(0x10a)]('\x0a'+a28_0xf2d79[_0x5e2481(0x115)](_0x5e2481(0x100))),console[_0x5e2481(0x10a)](_0x3ea46b+'\x20'+a28_0xf2d79['bold'](_0x34d47d[_0x5e2481(0x168)]+'.'+_0x34d47d[_0x5e2481(0x10e)])),_0x34d47d[_0x5e2481(0xd3)]?_0x34d47d[_0x5e2481(0xd0)]!==undefined&&console[_0x5e2481(0x10a)]('\x20\x20'+a28_0xf2d79[_0x5e2481(0x115)](_0x5e2481(0x16a))+'\x20'+a28_0xf2d79[_0x5e2481(0x194)](formatRows(_0x34d47d[_0x5e2481(0xd0)]))):console[_0x5e2481(0x10a)]('\x20\x20'+a28_0xf2d79[_0x5e2481(0x11d)](_0x5e2481(0xa6))+'\x20'+_0x34d47d[_0x5e2481(0x1b2)]);}['displayAttributesStats'](_0x20827d){const _0x1f0195=a28_0x1408f6;if(_0x20827d['attributes']['length']===0x0)return;console['error']('\x0a'+a28_0xf2d79[_0x1f0195(0x115)]('Attributes'));for(const _0x1b7f88 of _0x20827d[_0x1f0195(0x189)]){const _0x268956=_0x1b7f88[_0x1f0195(0xd3)]?a28_0xf2d79[_0x1f0195(0xff)]('✔'):a28_0xf2d79[_0x1f0195(0x11d)]('✘');let _0x4580cc='';if(_0x1b7f88[_0x1f0195(0xd3)]&&_0x1b7f88['matchedCount']!==undefined&&_0x1b7f88[_0x1f0195(0x177)]!==undefined){const _0x330e37=_0x1b7f88[_0x1f0195(0x177)][_0x1f0195(0x126)](0x1),_0xddbd3c=_0x1b7f88['coveragePercent']>=0x50?a28_0xf2d79[_0x1f0195(0xff)]:_0x1b7f88[_0x1f0195(0x177)]>=0x32?a28_0xf2d79[_0x1f0195(0x1a6)]:a28_0xf2d79[_0x1f0195(0x11d)];_0x4580cc='\x20'+a28_0xf2d79[_0x1f0195(0x115)]('Coverage:')+'\x20'+_0xddbd3c(_0x330e37+'%')+'\x20('+formatRows(_0x1b7f88[_0x1f0195(0x146)])+_0x1f0195(0xc7);}console[_0x1f0195(0x10a)](_0x268956+'\x20'+a28_0xf2d79['bold'](_0x1b7f88[_0x1f0195(0x15f)])+_0x4580cc),console[_0x1f0195(0x10a)]('\x20\x20'+a28_0xf2d79[_0x1f0195(0x115)](_0x1f0195(0x190))+'\x20'+a28_0xf2d79['bold'](_0x1b7f88[_0x1f0195(0x168)]+'.'+_0x1b7f88[_0x1f0195(0x10e)]));const _0x4bba39=_0x1b7f88[_0x1f0195(0xd1)]===_0x1b7f88['foreignKey']?a28_0xf2d79[_0x1f0195(0x115)](_0x1f0195(0xeb))+'\x20'+_0x1b7f88[_0x1f0195(0xd1)]:a28_0xf2d79[_0x1f0195(0x115)](_0x1f0195(0x188))+'\x20'+_0x1b7f88['joinKey']+_0x1f0195(0xc6)+_0x1b7f88[_0x1f0195(0x107)];console[_0x1f0195(0x10a)]('\x20\x20'+_0x4bba39),console[_0x1f0195(0x10a)]('\x20\x20'+a28_0xf2d79[_0x1f0195(0x115)](_0x1f0195(0xa2))),this[_0x1f0195(0xfb)](_0x1b7f88['columns']),!_0x1b7f88[_0x1f0195(0xd3)]&&console[_0x1f0195(0x10a)]('\x20\x20'+a28_0xf2d79[_0x1f0195(0x11d)](_0x1f0195(0xa6))+'\x20'+_0x1b7f88['schemaError']);}}[a28_0x1408f6(0xec)](_0x36cbd7,_0x498754){const _0x1c1e26=a28_0x1408f6;if(_0x36cbd7[_0x1c1e26(0x106)][_0x1c1e26(0x1a7)]===0x0)return;console[_0x1c1e26(0x10a)]('\x0a'+a28_0xf2d79[_0x1c1e26(0x115)](_0x1c1e26(0x19b))+'\x20'+a28_0xf2d79[_0x1c1e26(0x115)]('('+_0x498754+')'));for(const _0x407f22 of _0x36cbd7[_0x1c1e26(0x106)]){const _0x4bf3b4=_0x407f22[_0x1c1e26(0xd3)]?a28_0xf2d79[_0x1c1e26(0xff)]('✔'):a28_0xf2d79['red']('✘');let _0x149395='';if(_0x407f22['schemaValid']&&_0x407f22['customersWithEvents']!==undefined&&_0x407f22[_0x1c1e26(0xb8)]!==undefined){const _0x18156f=_0x407f22[_0x1c1e26(0xae)]?.[_0x1c1e26(0x126)](0x1)||'?',_0x5284a8=(_0x407f22[_0x1c1e26(0xae)]??0x0)>=0x32?a28_0xf2d79[_0x1c1e26(0xff)]:(_0x407f22[_0x1c1e26(0xae)]??0x0)>=0x14?a28_0xf2d79[_0x1c1e26(0x1a6)]:a28_0xf2d79[_0x1c1e26(0x11d)];_0x149395='\x20'+a28_0xf2d79[_0x1c1e26(0x115)](_0x1c1e26(0xfe))+'\x20'+_0x5284a8(formatRows(_0x407f22['customersWithEvents']))+'\x20('+_0x18156f+'%)\x20'+a28_0xf2d79['dim'](_0x1c1e26(0xc2))+'\x20'+a28_0xf2d79['cyan'](formatRows(_0x407f22[_0x1c1e26(0xb8)]));}console['error'](_0x4bf3b4+'\x20'+a28_0xf2d79[_0x1c1e26(0x1b1)](_0x407f22[_0x1c1e26(0x15f)])+_0x149395),console[_0x1c1e26(0x10a)]('\x20\x20'+a28_0xf2d79[_0x1c1e26(0x115)](_0x1c1e26(0x190))+'\x20'+a28_0xf2d79[_0x1c1e26(0x1b1)](_0x407f22[_0x1c1e26(0x168)]+'.'+_0x407f22[_0x1c1e26(0x10e)]));const _0x5056fa=_0x407f22['joinKey']===_0x407f22[_0x1c1e26(0x107)]?a28_0xf2d79[_0x1c1e26(0x115)](_0x1c1e26(0xeb))+'\x20'+_0x407f22[_0x1c1e26(0xd1)]:a28_0xf2d79['dim'](_0x1c1e26(0x188))+'\x20'+_0x407f22['joinKey']+'\x20=\x20'+_0x407f22[_0x1c1e26(0x107)];console['error']('\x20\x20'+_0x5056fa),console['error']('\x20\x20'+a28_0xf2d79[_0x1c1e26(0x115)](_0x1c1e26(0xa2))),this[_0x1c1e26(0xfb)](_0x407f22[_0x1c1e26(0x128)]),!_0x407f22[_0x1c1e26(0xd3)]&&console[_0x1c1e26(0x10a)]('\x20\x20'+a28_0xf2d79[_0x1c1e26(0x11d)](_0x1c1e26(0xa6))+'\x20'+_0x407f22[_0x1c1e26(0x1b2)]);}}[a28_0x1408f6(0xfb)](_0xc7966c){const _0x111aef=a28_0x1408f6;for(const _0x43e9dd of _0xc7966c){_0x43e9dd[_0x111aef(0x9c)]===_0x43e9dd[_0x111aef(0x13e)]||_0x43e9dd['column']==='*'?console[_0x111aef(0x10a)](_0x111aef(0xbf)+_0x43e9dd[_0x111aef(0x9c)]):console[_0x111aef(0x10a)](_0x111aef(0xbf)+_0x43e9dd[_0x111aef(0x9c)]+'\x20'+a28_0xf2d79[_0x111aef(0x115)]('('+_0x43e9dd[_0x111aef(0x13e)]+')'));}}['displaySummary'](_0x2f2c38){const _0x4419df=a28_0x1408f6;console[_0x4419df(0x10a)]('─'['repeat'](0x3c));if(_0x2f2c38[_0x4419df(0xd7)][_0x4419df(0x1a7)]>0x0){console[_0x4419df(0x10a)]('\x0a'+a28_0xf2d79[_0x4419df(0x11d)]('Errors:'));for(const _0x407a6d of _0x2f2c38[_0x4419df(0xd7)]){console[_0x4419df(0x10a)]('\x20\x20'+a28_0xf2d79[_0x4419df(0x11d)]('•')+'\x20'+_0x407a6d);}}_0x2f2c38[_0x4419df(0xb5)]&&console[_0x4419df(0x10a)]('\x0a'+a28_0xf2d79[_0x4419df(0xff)]('✔')+_0x4419df(0x9d));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a28_0x1408f6(0xe3);[a28_0x1408f6(0xb6)]=a28_0x1408f6(0xb4);async[a28_0x1408f6(0x1a4)](_0x1c8cf6){const _0x1eba8f=a28_0x1408f6,{options:_0xa7f3b7,args:_0x71d67a,tdx:_0x52d5af}=_0x1c8cf6,_0x4c5627=_0xa7f3b7,_0x1e09d7=_0x71d67a[0x0]||_0xa7f3b7[_0x1eba8f(0x121)];if(!_0x1e09d7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x1eba8f(0x144)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x1eba8f(0xe9)+_0x1eba8f(0x17f)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x4c5627[_0x1eba8f(0x1ae)]&&!_0x4c5627[_0x1eba8f(0xe0)]&&!_0x4c5627['behavior']&&!_0x4c5627[_0x1eba8f(0xf2)])return console[_0x1eba8f(0x10a)](a28_0xf2d79[_0x1eba8f(0x11d)](_0x1eba8f(0x166))),console[_0x1eba8f(0x10a)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error']('Options:'),console['error'](_0x1eba8f(0xd8)),console['error'](_0x1eba8f(0x14d)),console[_0x1eba8f(0x10a)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x1eba8f(0x10a)](_0x1eba8f(0x17b)),0x1;const _0x2c8dea=resolveYamlFile(_0x1e09d7);if(!existsSync(_0x2c8dea))return showFileNotFoundError(_0x2c8dea,_0x1e09d7),0x1;_0x4c5627[_0x1eba8f(0x1ad)]&&(console[_0x1eba8f(0x10a)](_0x1eba8f(0xa5)+_0x4c5627[_0x1eba8f(0x113)]),console['error'](_0x1eba8f(0x96)+_0x2c8dea));let _0x3301d4;try{_0x3301d4=readFileSync(_0x2c8dea,'utf-8');}catch(_0x423e65){const _0xd0170a=_0x423e65 instanceof Error?_0x423e65[_0x1eba8f(0x170)]:String(_0x423e65);return console[_0x1eba8f(0x10a)](_0x1eba8f(0xca)+_0xd0170a),0x1;}let _0x39bf0c;try{_0x39bf0c=parseYamlString(_0x3301d4);}catch(_0x36ab12){const _0x4e5810=_0x36ab12 instanceof Error?_0x36ab12[_0x1eba8f(0x170)]:String(_0x36ab12);return console['error'](a28_0xf2d79[_0x1eba8f(0x11d)](_0x1eba8f(0x16e)+_0x4e5810)),0x1;}if(_0x4c5627[_0x1eba8f(0xe0)]===!![]||_0x4c5627['attribute']===''){const _0x19a8cd=_0x39bf0c[_0x1eba8f(0x189)]?.[_0x1eba8f(0x154)](_0x3abfc3=>_0x3abfc3['name'])||[];if(_0x19a8cd[_0x1eba8f(0x1a7)]===0x0)console[_0x1eba8f(0x10a)](a28_0xf2d79[_0x1eba8f(0x11d)](_0x1eba8f(0x15c)));else{console[_0x1eba8f(0x10a)](a28_0xf2d79['red'](_0x1eba8f(0x1ac))),console[_0x1eba8f(0x10a)](_0x1eba8f(0x123));for(const _0x446935 of _0x19a8cd){console[_0x1eba8f(0x10a)]('\x20\x20'+a28_0xf2d79['cyan'](_0x446935));}console[_0x1eba8f(0x10a)](_0x1eba8f(0x11b)+_0x1e09d7+_0x1eba8f(0x1a2)+_0x19a8cd[0x0]+'\x22');}return 0x1;}if(_0x4c5627[_0x1eba8f(0xe1)]===!![]||_0x4c5627[_0x1eba8f(0xe1)]===''){const _0x4d1221=_0x39bf0c['behaviors']?.[_0x1eba8f(0x154)](_0x598820=>_0x598820[_0x1eba8f(0x15f)])||[];if(_0x4d1221[_0x1eba8f(0x1a7)]===0x0)console[_0x1eba8f(0x10a)](a28_0xf2d79[_0x1eba8f(0x11d)](_0x1eba8f(0xe2)));else{console['error'](a28_0xf2d79['red'](_0x1eba8f(0x1b5))),console[_0x1eba8f(0x10a)](_0x1eba8f(0x181));for(const _0x42e2fc of _0x4d1221){console[_0x1eba8f(0x10a)]('\x20\x20'+a28_0xf2d79['cyan'](_0x42e2fc));}console[_0x1eba8f(0x10a)](_0x1eba8f(0x11b)+_0x1e09d7+_0x1eba8f(0x198)+_0x4d1221[0x0]+'\x22');}return 0x1;}const _0x33ae09=createCommandSpinner(a28_0xf2d79[_0x1eba8f(0x115)](_0x1eba8f(0x11f)),{'verbose':_0x4c5627['verbose']});_0x33ae09[_0x1eba8f(0xdd)]();const _0x2909c4={'onProgress':_0x2471b1=>{const _0x89028f=_0x1eba8f;_0x33ae09[_0x89028f(0xc4)]=formatProgressMessage(_0x2471b1);}};if(_0x4c5627[_0x1eba8f(0x1ae)])_0x2909c4['master']=!![];if(_0x4c5627[_0x1eba8f(0xe0)]&&typeof _0x4c5627[_0x1eba8f(0xe0)]===_0x1eba8f(0xf5))_0x2909c4[_0x1eba8f(0xe0)]=_0x4c5627['attribute'];if(_0x4c5627[_0x1eba8f(0xe1)]&&typeof _0x4c5627[_0x1eba8f(0xe1)]===_0x1eba8f(0xf5))_0x2909c4[_0x1eba8f(0xe1)]=_0x4c5627['behavior'];if(_0x4c5627[_0x1eba8f(0xf2)])_0x2909c4[_0x1eba8f(0xf2)]=!![];if(_0x4c5627[_0x1eba8f(0x1b4)])_0x2909c4[_0x1eba8f(0x1b4)]=_0x4c5627[_0x1eba8f(0x1b4)];let _0x19d651;try{_0x19d651=await _0x52d5af[_0x1eba8f(0xc3)][_0x1eba8f(0x17e)](_0x3301d4,_0x2909c4),_0x33ae09['stop']();}catch(_0x232d2e){_0x33ae09[_0x1eba8f(0x152)]();throw _0x232d2e;}return await this[_0x1eba8f(0x117)](_0x19d651,{'master':_0x4c5627[_0x1eba8f(0x1ae)],'attribute':typeof _0x4c5627[_0x1eba8f(0xe0)]==='string'?_0x4c5627[_0x1eba8f(0xe0)]:undefined,'behavior':typeof _0x4c5627['behavior']==='string'?_0x4c5627[_0x1eba8f(0xe1)]:undefined,'enriched':_0x4c5627[_0x1eba8f(0xf2)]}),_0x19d651['allValid']?0x0:0x1;}async[a28_0x1408f6(0x117)](_0x42d7c1,_0x338296){const _0x213893=a28_0x1408f6;console[_0x213893(0x10a)]('\x0a'+a28_0xf2d79['bold'](_0x213893(0x125))+'\x20'+_0x42d7c1['name']),console['error']('═'[_0x213893(0xef)](0x3c));if(_0x338296[_0x213893(0x1ae)]&&_0x42d7c1[_0x213893(0xf1)]){const _0x123f40=a28_0xf2d79['dim']('Master:')+'\x20'+a28_0xf2d79[_0x213893(0x1b1)](_0x42d7c1['master'][_0x213893(0x168)]+'.'+_0x42d7c1[_0x213893(0x1ae)]['table']);await this[_0x213893(0xab)](_0x123f40,_0x42d7c1[_0x213893(0xf1)]);}else{if(_0x338296['attribute']&&_0x42d7c1['sampleData']){const _0x10835a=a28_0xf2d79[_0x213893(0x115)]('Attribute:')+'\x20'+a28_0xf2d79['bold'](_0x338296['attribute']);await this[_0x213893(0xab)](_0x10835a,_0x42d7c1[_0x213893(0xf1)]);}else{if(_0x338296[_0x213893(0xe1)]&&_0x42d7c1[_0x213893(0xf1)]){const _0x38e546=a28_0xf2d79[_0x213893(0x115)]('Behavior:')+'\x20'+a28_0xf2d79[_0x213893(0x1b1)](_0x338296[_0x213893(0xe1)]);await this[_0x213893(0xab)](_0x38e546,_0x42d7c1[_0x213893(0xf1)]);}else{if(_0x338296['enriched']&&_0x42d7c1[_0x213893(0xf1)]){const _0x13a66b=a28_0xf2d79[_0x213893(0x115)](_0x213893(0xea))+'\x20'+a28_0xf2d79[_0x213893(0x1b1)](_0x213893(0x102));await this[_0x213893(0xab)](_0x13a66b,_0x42d7c1[_0x213893(0xf1)]);}else!_0x42d7c1[_0x213893(0xf1)]&&console[_0x213893(0x10a)](_0x213893(0x1a3));}}}if(_0x42d7c1['errors'][_0x213893(0x1a7)]>0x0){console[_0x213893(0x10a)]('─'[_0x213893(0xef)](0x3c)),console['error']('\x0a'+a28_0xf2d79['red']('Errors:'));for(const _0x4da168 of _0x42d7c1['errors']){console['error']('\x20\x20'+a28_0xf2d79[_0x213893(0x11d)]('•')+'\x20'+_0x4da168);}}}async[a28_0x1408f6(0xab)](_0x533965,_0x2fd798){const _0x306aad=a28_0x1408f6;if(_0x2fd798['length']===0x0){console[_0x306aad(0x10a)]('\x0a'+_0x533965),console[_0x306aad(0x10a)](_0x306aad(0x116));return;}console[_0x306aad(0x10a)]('\x0a'+_0x533965);const _0xc74697=Object[_0x306aad(0x18c)](_0x2fd798[0x0])[_0x306aad(0x154)](_0x2df637=>({'name':_0x2df637,'type':typeof _0x2fd798[0x0][_0x2df637]===_0x306aad(0x105)?_0x306aad(0xb7):_0x306aad(0x163)})),_0x3cdf98={'queryId':_0x306aad(0x99),'columns':_0xc74697,'data':_0x2fd798,'stats':{'state':_0x306aad(0x16c),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2fd798[_0x306aad(0x1a7)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x115331=formatAsTable(_0x3cdf98,_0x2fd798[_0x306aad(0x1a7)],!![]);await writeOutput(_0x115331,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a28_0x1408f6(0x15f)]=a28_0x1408f6(0x136);[a28_0x1408f6(0xb6)]=a28_0x1408f6(0x155);async[a28_0x1408f6(0x1a4)](_0x51cc4b){const _0x281e59=a28_0x1408f6,{options:_0x180483,args:_0x10f547,tdx:_0x1afb35}=_0x51cc4b,_0x17e3be=_0x180483,_0x58bcb1=_0x10f547[0x0]||_0x180483[_0x281e59(0x121)];if(!_0x58bcb1)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x5653fd=resolveYamlFile(_0x58bcb1);if(existsSync(_0x5653fd)){_0x17e3be[_0x281e59(0x1ad)]&&console[_0x281e59(0x10a)](_0x281e59(0xdb)+_0x5653fd);let _0x5b54fb;try{_0x5b54fb=readFileSync(_0x5653fd,'utf-8');}catch(_0x1a9121){const _0x5dacf9=_0x1a9121 instanceof Error?_0x1a9121[_0x281e59(0x170)]:String(_0x1a9121);return console[_0x281e59(0x10a)](_0x281e59(0xca)+_0x5dacf9),0x1;}const _0x22edd4=await withSpinner('Analyzing\x20changes...',()=>_0x1afb35[_0x281e59(0xc3)][_0x281e59(0x143)](_0x5b54fb),{'verbose':_0x17e3be[_0x281e59(0x1ad)]}),_0x195018=_0x22edd4[_0x281e59(0x135)],{isNew:_0x37cee6,name:_0x40590c,hasChanges:_0x5b2f9a,diffFormatted:_0x5774af}=_0x195018;if(_0x5b2f9a){_0x37cee6?console['error'](_0x281e59(0x17d)+_0x40590c+'\x27:'):console[_0x281e59(0x10a)](_0x281e59(0x156)+_0x40590c+'\x27:');console[_0x281e59(0x10a)]('─'['repeat'](0x3c)),console['error'](_0x5774af),console['error']('─'[_0x281e59(0xef)](0x3c));const _0x1e9b55=_0x37cee6?_0x281e59(0x127)+_0x40590c+_0x281e59(0x124):_0x281e59(0x1a1)+_0x40590c+_0x281e59(0x124);if(!_0x17e3be[_0x281e59(0x138)]){const _0x91d026=await confirmKey(_0x1e9b55);if(!_0x91d026)return console[_0x281e59(0x10a)](_0x281e59(0x9b)),0x1;}const _0x3836ab=_0x37cee6?_0x281e59(0x151):_0x281e59(0x179);await withSpinner(_0x3836ab+_0x281e59(0xb9)+_0x40590c+_0x281e59(0x111),()=>_0x195018['apply'](),{'verbose':_0x17e3be['verbose']});const _0xeb1c8c=_0x37cee6?_0x281e59(0x129):_0x281e59(0x13c);console[_0x281e59(0x10a)]('✔\x20'+_0xeb1c8c+'\x20parent\x20segment\x20\x27'+_0x40590c+'\x27');}else console['error'](_0x281e59(0xdf)+_0x40590c+_0x281e59(0x12c));}const _0x48a44f=await withSpinner(_0x281e59(0x131)+_0x58bcb1+'\x27...',()=>_0x1afb35[_0x281e59(0xc3)][_0x281e59(0x150)](_0x58bcb1),{'verbose':_0x17e3be[_0x281e59(0x1ad)]}),_0x58c7f2=_0x48a44f[_0x281e59(0x135)],_0x5ddca3=getConsoleUrl(_0x17e3be['site'],_0x281e59(0x104)+_0x58c7f2[_0x281e59(0xfd)]+_0x281e59(0x15e)+_0x58c7f2[_0x281e59(0xc1)]+_0x281e59(0x171)+_0x58c7f2[_0x281e59(0x147)]);return console[_0x281e59(0x10a)]('\x0a✔\x20Workflow\x20started'),console[_0x281e59(0x10a)]('\x20\x20'+a28_0xf2d79[_0x281e59(0x115)](_0x281e59(0xad))+'\x20'+_0x58c7f2[_0x281e59(0x1b0)]),console['error']('\x20\x20'+a28_0xf2d79[_0x281e59(0x115)](_0x281e59(0x133))+'\x20'+_0x58c7f2[_0x281e59(0xba)]),console[_0x281e59(0x10a)]('\x20\x20'+a28_0xf2d79[_0x281e59(0x115)](_0x281e59(0x10b))+'\x20'+_0x58c7f2['workflowSessionId']),console[_0x281e59(0x10a)]('\x20\x20'+a28_0xf2d79[_0x281e59(0x115)](_0x281e59(0x140))+'\x20'+_0x58c7f2[_0x281e59(0x147)]),console[_0x281e59(0x10a)]('\x20\x20'+_0x5ddca3),console['error']('\x0a'+a28_0xf2d79[_0x281e59(0x115)](_0x281e59(0x109))+_0x281e59(0x19a)+_0x58c7f2[_0x281e59(0x147)]+_0x281e59(0x164)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a28_0x1408f6(0x97);[a28_0x1408f6(0xb6)]=a28_0x1408f6(0x134);async[a28_0x1408f6(0x1a4)](_0x255d80){const _0x116678=a28_0x1408f6,{options:_0x576dfb,args:_0x5946d5,tdx:_0x595fad}=_0x255d80,_0x240a36=_0x5946d5[0x0]||_0x576dfb[_0x116678(0x121)];if(!_0x240a36)return showParentSegmentNotSetError(_0x116678(0x11e)+_0x116678(0xb0)),0x1;_0x576dfb[_0x116678(0x1ad)]&&(console[_0x116678(0x10a)]('Site:\x20'+_0x576dfb[_0x116678(0x113)]),console['error']('Parent\x20segment:\x20'+_0x240a36));const _0x2408c3=await withSpinner(_0x116678(0x174)+_0x240a36+_0x116678(0x111),()=>_0x595fad[_0x116678(0xc3)]['listFields'](_0x240a36),{'verbose':_0x576dfb['verbose']}),_0x748429=_0x2408c3['data'];console[_0x116678(0x10a)](_0x116678(0xed)+_0x748429[_0x116678(0x1a7)]+_0x116678(0x18a)+(_0x748429[_0x116678(0x1a7)]!==0x1?'s':''));if(_0x576dfb['json']||_0x576dfb[_0x116678(0x148)])return await handleSDKOutput(_0x748429,_0x576dfb),0x0;return displayFieldsHumanReadable(_0x748429,_0x240a36),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a28_0x1408f6(0x15f)]=a28_0x1408f6(0xf4);['description']=a28_0x1408f6(0x114);async[a28_0x1408f6(0x1a4)](_0x2ea849){const _0x812197=a28_0x1408f6,{options:_0x1f5cde,args:_0x511f47,tdx:_0xd9804}=_0x2ea849,_0x5710d6=_0x1f5cde,_0x580705=_0x511f47[0x0]||_0x1f5cde[_0x812197(0x121)];if(!_0x580705)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x812197(0x193)+'Options:\x0a'+_0x812197(0x108)),0x1;_0x1f5cde[_0x812197(0x1ad)]&&(console[_0x812197(0x10a)](_0x812197(0xa5)+_0x1f5cde[_0x812197(0x113)]),console['error'](_0x812197(0x13a)+_0x580705));const _0x5d1947=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x580705+_0x812197(0x111),()=>_0xd9804[_0x812197(0xc3)][_0x812197(0x187)](_0x580705),{'verbose':_0x1f5cde['verbose']}),_0x442d97=_0x5d1947['data'];if(_0x5710d6[_0x812197(0xcc)]){const _0x3b40f4=getConsoleNextUrl(_0x5710d6[_0x812197(0x113)],_0x812197(0x18b)+_0x442d97['id']);return console[_0x812197(0x10a)](a28_0xf2d79['green']('✔')+_0x812197(0x13d)+a28_0xf2d79[_0x812197(0x194)](_0x3b40f4)),openBrowser(_0x3b40f4),0x0;}return await handleSingleObjectOutput(_0x442d97,_0x1f5cde),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a28_0x1408f6(0x15f)]=a28_0x1408f6(0x1a5);['description']=a28_0x1408f6(0x162);async[a28_0x1408f6(0x1a4)](_0x248858){const _0x23573c=a28_0x1408f6,{options:_0x40ff6b,args:_0x523b9a,tdx:_0x33c63b}=_0x248858,_0x343488=_0x523b9a[0x0]||_0x40ff6b[_0x23573c(0x121)];if(!_0x343488)return showParentSegmentNotSetError(_0x23573c(0x132)+_0x23573c(0x19d)),0x1;_0x40ff6b['verbose']&&(console['error'](_0x23573c(0xa5)+_0x40ff6b[_0x23573c(0x113)]),console[_0x23573c(0x10a)](_0x23573c(0x13a)+_0x343488));const _0x288078=await withSpinner(_0x23573c(0x1af)+_0x343488+_0x23573c(0x111),()=>_0x33c63b['segment']['resolveParentId'](_0x343488),{'verbose':_0x40ff6b[_0x23573c(0x1ad)]}),_0x451941=_0x288078[_0x23573c(0x135)],_0x432c17=await withSpinner(_0x23573c(0x169)+_0x343488+_0x23573c(0x111),()=>_0x33c63b[_0x23573c(0xc3)]['getParentSQL'](_0x451941),{'verbose':_0x40ff6b[_0x23573c(0x1ad)]}),_0x40ee7c=await executeSchemaQuery(_0x432c17[_0x23573c(0x135)],_0x33c63b,_0x40ff6b);return await handleQueryOutput(_0x40ee7c,_0x40ff6b),0x0;}}function a28_0x29f8(_0xb6e945,_0xa88528){_0xb6e945=_0xb6e945-0x96;const _0xe9560e=a28_0xe956();let _0x29f830=_0xe9560e[_0xb6e945];return _0x29f830;}export class ParentSegmentSQLCommand extends BaseCommand{[a28_0x1408f6(0x15f)]=a28_0x1408f6(0x172);['description']=a28_0x1408f6(0x103);async[a28_0x1408f6(0x1a4)](_0x1a9cc1){const _0x307413=a28_0x1408f6,{options:_0x205358,args:_0x1df992,tdx:_0x284762}=_0x1a9cc1,_0x4d1b21=_0x1df992[0x0]||_0x205358[_0x307413(0x121)];if(!_0x4d1b21)return showParentSegmentNotSetError(_0x307413(0xa8)+_0x307413(0x153)),0x1;_0x205358[_0x307413(0x1ad)]&&(console['error'](_0x307413(0xa5)+_0x205358['site']),console[_0x307413(0x10a)](_0x307413(0x13a)+_0x4d1b21));const _0xbb5b3c=await withSpinner(_0x307413(0x1af)+_0x4d1b21+_0x307413(0x111),()=>_0x284762['segment'][_0x307413(0x9a)](_0x4d1b21),{'verbose':_0x205358[_0x307413(0x1ad)]}),_0x3cb4a3=_0xbb5b3c['data'],_0x443bba=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4d1b21+_0x307413(0x111),()=>_0x284762[_0x307413(0xc3)]['getParentSQL'](_0x3cb4a3),{'verbose':_0x205358['verbose']}),_0x50dd0f=_0x443bba[_0x307413(0x135)];return _0x205358[_0x307413(0x12b)]===_0x307413(0x16d)||_0x205358[_0x307413(0x12b)]===_0x307413(0x148)?await handleSDKOutput([{'sql':_0x50dd0f}],_0x205358):console[_0x307413(0x180)](_0x50dd0f),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a28_0x1408f6(0x15f)]='segment:parent:show';[a28_0x1408f6(0xb6)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a28_0x1408f6(0x1a4)](_0xbe7c21){const _0x182057=a28_0x1408f6,{options:_0x31fa59,args:_0x108e0d,tdx:_0xaa7ccf}=_0xbe7c21,_0x5b2b0f=_0x108e0d[0x0]||_0x31fa59[_0x182057(0x121)];if(!_0x5b2b0f)return showParentSegmentNotSetError(_0x182057(0x195)+_0x182057(0x122)),0x1;_0x31fa59[_0x182057(0x1ad)]&&(console[_0x182057(0x10a)](_0x182057(0xa5)+_0x31fa59[_0x182057(0x113)]),console['error'](_0x182057(0x13a)+_0x5b2b0f));const _0x138d7a=await withSpinner(_0x182057(0x1af)+_0x5b2b0f+_0x182057(0x111),()=>_0xaa7ccf['segment'][_0x182057(0x9a)](_0x5b2b0f),{'verbose':_0x31fa59['verbose']}),_0x1c747c=_0x138d7a[_0x182057(0x135)],_0x319597=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5b2b0f+'\x27...',()=>_0xaa7ccf[_0x182057(0xc3)][_0x182057(0xbd)](_0x1c747c),{'verbose':_0x31fa59[_0x182057(0x1ad)]});let _0x22b9c5=_0x319597['data'];const _0xf288d6=resolveLimit(_0x31fa59[_0x182057(0xe5)],DEFAULT_DISPLAY_LIMIT),_0x12c904=/\bLIMIT\s+\d+/i['test'](_0x22b9c5);!_0x12c904&&(_0x22b9c5=_0x22b9c5['trim']()[_0x182057(0x13b)](/;+$/,''),_0x22b9c5='SELECT\x20*\x20FROM\x20(\x0a'+_0x22b9c5+_0x182057(0x10c)+_0xf288d6);_0x31fa59['verbose']&&console[_0x182057(0x10a)](_0x182057(0xf0)+_0x22b9c5);const _0x276780=await withQuerySpinner(_0x182057(0x14e),async _0x531238=>{const _0x2e85e1=_0x182057,_0x57d68b=await _0xaa7ccf['query'][_0x2e85e1(0x1a4)](_0x22b9c5,{'catalog':'td','schema':'information_schema','onJobId':_0x323257=>{const _0x9e0030=_0x2e85e1;_0x531238[_0x9e0030(0xd5)](_0x323257);}});return _0x57d68b;},{'verbose':_0x31fa59[_0x182057(0x1ad)]}),_0x588aed=_0x276780[_0x182057(0x135)],_0x46f238=_0x588aed[_0x182057(0x17a)]?_0x182057(0x14f)+_0x588aed[_0x182057(0x17a)]+']':'';return console[_0x182057(0x10a)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x588aed[_0x182057(0xaf)]['processedRows']['toLocaleString']()+'\x20rows\x20'+(_0x182057(0x19f)+formatElapsed(_0x588aed[_0x182057(0xaf)]['elapsedTimeMillis'])+_0x46f238)),await handleQueryOutput(_0x588aed,_0x31fa59),0x0;}}
@@ -1 +1 @@
1
- const a29_0x37615d=a29_0x12d7;function a29_0x12d7(_0x257793,_0x1ba1fb){_0x257793=_0x257793-0x1c8;const _0x230526=a29_0x2305();let _0x12d7d8=_0x230526[_0x257793];return _0x12d7d8;}(function(_0x1ffa0b,_0x469279){const _0x425443=a29_0x12d7,_0x2ea3c6=_0x1ffa0b();while(!![]){try{const _0x5bcb02=-parseInt(_0x425443(0x1d0))/0x1*(parseInt(_0x425443(0x1cb))/0x2)+-parseInt(_0x425443(0x1d4))/0x3*(parseInt(_0x425443(0x1e0))/0x4)+parseInt(_0x425443(0x1d9))/0x5*(-parseInt(_0x425443(0x1d6))/0x6)+-parseInt(_0x425443(0x1ca))/0x7*(-parseInt(_0x425443(0x1df))/0x8)+-parseInt(_0x425443(0x1da))/0x9*(-parseInt(_0x425443(0x1cf))/0xa)+-parseInt(_0x425443(0x1c9))/0xb+parseInt(_0x425443(0x1cc))/0xc*(parseInt(_0x425443(0x1d8))/0xd);if(_0x5bcb02===_0x469279)break;else _0x2ea3c6['push'](_0x2ea3c6['shift']());}catch(_0x4f6f8a){_0x2ea3c6['push'](_0x2ea3c6['shift']());}}}(a29_0x2305,0xed4b9));function a29_0x2305(){const _0x3a2d6c=['name','72mzAMUz','346396UWMvrm','execute','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','map','17762943qaxLWa','42133QpTglX','38DKpbTB','62060232rgBZyK','config','profiles','1810RatXko','71711CdWaxb','scope','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','Error:\x20','3YpFnaP','error','282elHlHe','\x20\x20Global:\x20~/.config/tdx/tdx.json','13onOATW','141670WUzpaB','7047zlfowI','List\x20all\x20available\x20profiles','message','log'];a29_0x2305=function(){return _0x3a2d6c;};return a29_0x2305();}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{[a29_0x37615d(0x1de)]=a29_0x37615d(0x1ce);['description']=a29_0x37615d(0x1db);async[a29_0x37615d(0x1e1)](_0x50064c){const _0x39fcba=a29_0x37615d,{options:_0x1e4bb7}=_0x50064c;try{const _0x5b2965=listProfiles(),_0x588367=getActiveProfile();if(_0x5b2965['length']===0x0)return console[_0x39fcba(0x1dd)](_0x39fcba(0x1d2)),console['log'](_0x39fcba(0x1e2)),console[_0x39fcba(0x1dd)](_0x39fcba(0x1d7)),0x0;const _0x58b620=_0x5b2965[_0x39fcba(0x1c8)](_0x226b7c=>{const _0x70c44=_0x39fcba,_0x59b70e=_0x226b7c['name']===_0x588367,_0x2edc97=getProfileParams(_0x226b7c['config']);return{'name':_0x226b7c[_0x70c44(0x1de)],'active':_0x59b70e,'scope':_0x226b7c[_0x70c44(0x1d1)],'description':_0x226b7c[_0x70c44(0x1cd)]['description']||'','params':_0x2edc97};});return await handleSDKOutput(_0x58b620,_0x1e4bb7),0x0;}catch(_0x2b3be8){return _0x2b3be8 instanceof Error&&console[_0x39fcba(0x1d5)](_0x39fcba(0x1d3)+_0x2b3be8[_0x39fcba(0x1dc)]),0x1;}}}
1
+ const a29_0x3a2f31=a29_0x37de;(function(_0x643671,_0x533841){const _0x550e77=a29_0x37de,_0x114a28=_0x643671();while(!![]){try{const _0x422c70=parseInt(_0x550e77(0x1c1))/0x1+parseInt(_0x550e77(0x1cb))/0x2+parseInt(_0x550e77(0x1bf))/0x3*(-parseInt(_0x550e77(0x1c3))/0x4)+parseInt(_0x550e77(0x1d4))/0x5*(parseInt(_0x550e77(0x1c8))/0x6)+-parseInt(_0x550e77(0x1ce))/0x7*(parseInt(_0x550e77(0x1cd))/0x8)+-parseInt(_0x550e77(0x1bc))/0x9*(parseInt(_0x550e77(0x1c7))/0xa)+parseInt(_0x550e77(0x1be))/0xb;if(_0x422c70===_0x533841)break;else _0x114a28['push'](_0x114a28['shift']());}catch(_0x515e27){_0x114a28['push'](_0x114a28['shift']());}}}(a29_0x26a8,0xf10f5));import{BaseCommand}from'./command.js';function a29_0x37de(_0x328a83,_0x46c480){_0x328a83=_0x328a83-0x1bc;const _0x26a894=a29_0x26a8();let _0x37debc=_0x26a894[_0x328a83];return _0x37debc;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a29_0x3a2f31(0x1bd)]=a29_0x3a2f31(0x1d3);[a29_0x3a2f31(0x1c6)]=a29_0x3a2f31(0x1d0);async[a29_0x3a2f31(0x1c5)](_0x4f39ee){const _0x5cf4fc=a29_0x3a2f31,{options:_0xa4278f}=_0x4f39ee;try{const _0x5b741e=listProfiles(),_0x5be5d8=getActiveProfile();if(_0x5b741e[_0x5cf4fc(0x1ca)]===0x0)return console[_0x5cf4fc(0x1c0)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x5cf4fc(0x1c0)](_0x5cf4fc(0x1d1)),console[_0x5cf4fc(0x1c0)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x348ac7=_0x5b741e[_0x5cf4fc(0x1c9)](_0x157d2d=>{const _0x5e1921=_0x5cf4fc,_0x4498fa=_0x157d2d[_0x5e1921(0x1bd)]===_0x5be5d8,_0x32a910=getProfileParams(_0x157d2d['config']);return{'name':_0x157d2d[_0x5e1921(0x1bd)],'active':_0x4498fa,'scope':_0x157d2d[_0x5e1921(0x1c4)],'description':_0x157d2d[_0x5e1921(0x1d2)]['description']||'','params':_0x32a910};});return await handleSDKOutput(_0x348ac7,_0xa4278f),0x0;}catch(_0x5583ea){return _0x5583ea instanceof Error&&console[_0x5cf4fc(0x1cc)](_0x5cf4fc(0x1c2)+_0x5583ea[_0x5cf4fc(0x1cf)]),0x1;}}}function a29_0x26a8(){const _0x4d610e=['651971mBGuYj','Error:\x20','56pvYOJy','scope','execute','description','2890HcdZgR','6CDUCmh','map','length','606774YOxOXf','error','40HAmauT','1597757rOZpxf','message','List\x20all\x20available\x20profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config','profiles','4145565yaLKVx','21582iZprVR','name','29318333doCPVf','348882LOuqgu','log'];a29_0x26a8=function(){return _0x4d610e;};return a29_0x26a8();}
@@ -1 +1 @@
1
- const a30_0x2bc39c=a30_0x2078;(function(_0x3ad573,_0x235a8d){const _0x533996=a30_0x2078,_0x46a1d3=_0x3ad573();while(!![]){try{const _0x3a96d0=parseInt(_0x533996(0x1e5))/0x1+parseInt(_0x533996(0x1e3))/0x2*(parseInt(_0x533996(0x1e2))/0x3)+parseInt(_0x533996(0x1d6))/0x4*(-parseInt(_0x533996(0x1b8))/0x5)+-parseInt(_0x533996(0x1b7))/0x6*(-parseInt(_0x533996(0x1c0))/0x7)+-parseInt(_0x533996(0x1de))/0x8+parseInt(_0x533996(0x1bf))/0x9+parseInt(_0x533996(0x1da))/0xa*(-parseInt(_0x533996(0x1b9))/0xb);if(_0x3a96d0===_0x235a8d)break;else _0x46a1d3['push'](_0x46a1d3['shift']());}catch(_0x1f380d){_0x46a1d3['push'](_0x46a1d3['shift']());}}}(a30_0x347a,0xda373));function a30_0x2078(_0x4be625,_0x4ed111){_0x4be625=_0x4be625-0x1b0;const _0x347ab7=a30_0x347a();let _0x2078d7=_0x347ab7[_0x4be625];return _0x2078d7;}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';function a30_0x347a(){const _0x4bc956=['210ZfWLCp','originalMessage','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','2640792gkClfU','options','name','Error:\x20','1548267hcdVbJ','2grJMIw','jobId','471026kxJESm','...','query','validate','length','setPhase','stats','args','1356RfFDKA','4755rsgDJN','868285vOdVqf','\x20splits','Executing\x20query...','push','database','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','12256722IQXEAm','24213aFcybt','No\x20SQL\x20provided','SQL:\x20','catalog','Catalog:\x20','\x20rows\x20','\x20[Job\x20ID:\x20','processedRows','verbose','error','description','Schema:\x20','file','Executing\x20query\x20[','completedSplits','information_schema','\x20-\x20','Executing\x20statement\x20','output','message','\x0aAll\x20results\x20saved\x20to\x20','execute','1048xrXNJW','elapsedTimeMillis','Statement\x20','Query\x20completed:\x20Processed\x20'];a30_0x347a=function(){return _0x4bc956;};return a30_0x347a();}import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a30_0x2bc39c(0x1e0)]=a30_0x2bc39c(0x1b1);[a30_0x2bc39c(0x1ca)]=a30_0x2bc39c(0x1dc);async[a30_0x2bc39c(0x1d5)](_0x38b13a){const _0x67d4c7=a30_0x2bc39c,{options:_0xb6ad81,args:_0x35cb1f,tdx:_0x337dca}=_0x38b13a,_0x36b03d=_0x35cb1f[0x0],_0x397e1a=_0xb6ad81[_0x67d4c7(0x1cc)];let _0x3a2ebf;try{if(_0x397e1a)_0x3a2ebf=readSqlStatementsFromFile(_0x397e1a);else{if(_0x36b03d==='-')_0x3a2ebf=await readSqlStatementsFromStdin();else{if(_0x36b03d&&isSqlFilePath(_0x36b03d))_0x3a2ebf=readSqlStatementsFromFile(_0x36b03d);else{if(_0x36b03d)_0x3a2ebf=splitSqlStatements(_0x36b03d);else throw new Error(_0x67d4c7(0x1c1));}}}}catch(_0x3df3ff){return console['error'](_0x67d4c7(0x1e1)+_0x3df3ff['message']),0x1;}const _0x240771=_0xb6ad81[_0x67d4c7(0x1bd)]||_0x67d4c7(0x1cf),_0x5d7553=_0xb6ad81[_0x67d4c7(0x1c3)];try{const _0x598fbd=[],_0xfbe4d=!!_0xb6ad81[_0x67d4c7(0x1d2)];for(let _0x325cf3=0x0;_0x325cf3<_0x3a2ebf['length'];_0x325cf3++){const _0x173272=_0x3a2ebf[_0x325cf3],_0xdacf1f=_0x325cf3+0x1,_0x41d09c=_0x3a2ebf[_0x67d4c7(0x1b3)],_0x25e53a=_0x41d09c>0x1;_0xb6ad81[_0x67d4c7(0x1c8)]&&(console[_0x67d4c7(0x1c9)]('\x0a'+(_0x25e53a?_0x67d4c7(0x1d8)+_0xdacf1f+'/'+_0x41d09c+':':'')),console['error']('Site:\x20'+_0xb6ad81['site']),console[_0x67d4c7(0x1c9)](_0x67d4c7(0x1c4)+(_0x5d7553||'td')),console[_0x67d4c7(0x1c9)](_0x67d4c7(0x1cb)+_0x240771),console[_0x67d4c7(0x1c9)](_0x67d4c7(0x1c2)+_0x173272));const _0x33d8a4=_0x25e53a?_0x67d4c7(0x1d1)+_0xdacf1f+'/'+_0x41d09c+_0x67d4c7(0x1b0):_0x67d4c7(0x1bb);try{const _0x50c9f1=await withQuerySpinner(_0x33d8a4,async _0x1bd36f=>{const _0x15062a=_0x67d4c7,_0x886eef=await _0x337dca[_0x15062a(0x1b1)][_0x15062a(0x1d5)](_0x173272,{'catalog':_0x5d7553,'schema':_0x240771,'onJobId':_0x50aaf2=>{_0x1bd36f['setJobId'](_0x50aaf2);},'onProgress':_0x3e5927=>{const _0x4e4f8a=_0x15062a;_0x1bd36f[_0x4e4f8a(0x1b4)](_0x4e4f8a(0x1cd)+_0x3e5927['state']+']'),_0x1bd36f['setExtra'](formatRows(_0x3e5927[_0x4e4f8a(0x1c7)])+_0x4e4f8a(0x1c5)+_0x3e5927[_0x4e4f8a(0x1ce)]+'/'+_0x3e5927['totalSplits']+_0x4e4f8a(0x1ba));}});return _0x886eef;},{'verbose':_0xb6ad81[_0x67d4c7(0x1c8)]}),_0x1624bd=_0x50c9f1['data'],_0x528b31=_0x1624bd['jobId']?_0x67d4c7(0x1c6)+_0x1624bd[_0x67d4c7(0x1e4)]+']':'',_0xe7c242=_0x25e53a?_0x67d4c7(0x1d8)+_0xdacf1f+'/'+_0x41d09c+_0x67d4c7(0x1d0):'';console[_0x67d4c7(0x1c9)]('✔\x20'+_0xe7c242+_0x67d4c7(0x1d9)+formatRows(_0x1624bd['stats'][_0x67d4c7(0x1c7)])+_0x67d4c7(0x1c5)+('in\x20'+formatElapsed(_0x1624bd[_0x67d4c7(0x1b5)][_0x67d4c7(0x1d7)])+_0x528b31));if(_0x25e53a&&_0xfbe4d){const _0x317586=resolveOutputOptions(_0xb6ad81),_0x2df582=await formatQueryOutput(_0x1624bd,_0x317586);_0x598fbd[_0x67d4c7(0x1bc)](_0x2df582);}else await handleQueryOutput(_0x1624bd,_0xb6ad81);}catch(_0x2f5fae){const _0x3fa6b7=_0x25e53a?_0x67d4c7(0x1d8)+_0xdacf1f+'/'+_0x41d09c+':\x0a':'',_0x2edc1f=_0x2f5fae instanceof SDKError?_0x2f5fae[_0x67d4c7(0x1db)]:_0x2f5fae[_0x67d4c7(0x1d3)];return console[_0x67d4c7(0x1c9)](''+_0x3fa6b7+_0x2edc1f),0x1;}}if(_0x3a2ebf[_0x67d4c7(0x1b3)]>0x1&&_0xfbe4d&&_0x598fbd[_0x67d4c7(0x1b3)]>0x0){const _0x44f8ee=_0x598fbd['join']('\x0a');writeFileSync(_0xb6ad81[_0x67d4c7(0x1d2)],_0x44f8ee),console['error'](_0x67d4c7(0x1d4)+_0xb6ad81[_0x67d4c7(0x1d2)]);}return 0x0;}catch(_0x3ad23a){throw _0x3ad23a;}}[a30_0x2bc39c(0x1b2)](_0x23dd18){const _0x39601b=a30_0x2bc39c,_0x25db77=_0x23dd18[_0x39601b(0x1b6)][0x0],_0x2551bd=_0x23dd18[_0x39601b(0x1df)][_0x39601b(0x1cc)];if(!_0x25db77&&!_0x2551bd)return _0x39601b(0x1dd);if(_0x25db77&&_0x2551bd)return _0x39601b(0x1be);return undefined;}}
1
+ const a30_0x945c91=a30_0x3f0d;function a30_0x2c06(){const _0xddbee=['site','file','1ePGvbR','stats','1980350LKDVia','...','Executing\x20query...','Statement\x20','setPhase','1642497bnhAYb','19689527tXUryT','207OUHoPU','verbose','processedRows','push','SQL:\x20','\x20splits','message','jobId','\x20[Job\x20ID:\x20','1779040HklLuf','database','information_schema','3923500EQMmkl','Executing\x20statement\x20','catalog','No\x20SQL\x20provided','length','elapsedTimeMillis','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','query','Site:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','name','Schema:\x20','161144XTKPpB','\x20rows\x20','173828JbWAhP','state','error','originalMessage','data','output','Error:\x20','totalSplits','6FRugXk','Run\x20Trino\x20queries\x20(streaming)','in\x20','\x0aAll\x20results\x20saved\x20to\x20','setJobId','4ZgtIsS','execute','completedSplits','\x20-\x20','Executing\x20query\x20['];a30_0x2c06=function(){return _0xddbee;};return a30_0x2c06();}(function(_0x182e8f,_0x4aae01){const _0x12c15a=a30_0x3f0d,_0x465e22=_0x182e8f();while(!![]){try{const _0x44b7a0=-parseInt(_0x12c15a(0x122))/0x1*(parseInt(_0x12c15a(0x10e))/0x2)+-parseInt(_0x12c15a(0x129))/0x3*(parseInt(_0x12c15a(0x11b))/0x4)+-parseInt(_0x12c15a(0x134))/0x5*(-parseInt(_0x12c15a(0x116))/0x6)+-parseInt(_0x12c15a(0x137))/0x7+-parseInt(_0x12c15a(0x10c))/0x8*(parseInt(_0x12c15a(0x12b))/0x9)+-parseInt(_0x12c15a(0x124))/0xa+parseInt(_0x12c15a(0x12a))/0xb;if(_0x44b7a0===_0x4aae01)break;else _0x465e22['push'](_0x465e22['shift']());}catch(_0x33d7d0){_0x465e22['push'](_0x465e22['shift']());}}}(a30_0x2c06,0x46af8));import{BaseCommand}from'./command.js';function a30_0x3f0d(_0x9fa451,_0x58f778){_0x9fa451=_0x9fa451-0x109;const _0x2c06f2=a30_0x2c06();let _0x3f0d7c=_0x2c06f2[_0x9fa451];return _0x3f0d7c;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a30_0x945c91(0x10a)]=a30_0x945c91(0x13e);['description']=a30_0x945c91(0x117);async[a30_0x945c91(0x11c)](_0x4bc8fd){const _0x4d1714=a30_0x945c91,{options:_0x6ecbda,args:_0x4e1b46,tdx:_0x584ee8}=_0x4bc8fd,_0x53121b=_0x4e1b46[0x0],_0x4560bb=_0x6ecbda[_0x4d1714(0x121)];let _0x2743db;try{if(_0x4560bb)_0x2743db=readSqlStatementsFromFile(_0x4560bb);else{if(_0x53121b==='-')_0x2743db=await readSqlStatementsFromStdin();else{if(_0x53121b&&isSqlFilePath(_0x53121b))_0x2743db=readSqlStatementsFromFile(_0x53121b);else{if(_0x53121b)_0x2743db=splitSqlStatements(_0x53121b);else throw new Error(_0x4d1714(0x13a));}}}}catch(_0xebf7d0){return console['error'](_0x4d1714(0x114)+_0xebf7d0['message']),0x1;}const _0x7d2a55=_0x6ecbda[_0x4d1714(0x135)]||_0x4d1714(0x136),_0x96353a=_0x6ecbda[_0x4d1714(0x139)];try{const _0x2e9a29=[],_0x1fe82a=!!_0x6ecbda[_0x4d1714(0x113)];for(let _0x1d0777=0x0;_0x1d0777<_0x2743db['length'];_0x1d0777++){const _0x17b3eb=_0x2743db[_0x1d0777],_0x1d2f09=_0x1d0777+0x1,_0xb3bdf1=_0x2743db['length'],_0x81076c=_0xb3bdf1>0x1;_0x6ecbda[_0x4d1714(0x12c)]&&(console[_0x4d1714(0x110)]('\x0a'+(_0x81076c?_0x4d1714(0x127)+_0x1d2f09+'/'+_0xb3bdf1+':':'')),console[_0x4d1714(0x110)](_0x4d1714(0x13f)+_0x6ecbda[_0x4d1714(0x120)]),console[_0x4d1714(0x110)]('Catalog:\x20'+(_0x96353a||'td')),console[_0x4d1714(0x110)](_0x4d1714(0x10b)+_0x7d2a55),console[_0x4d1714(0x110)](_0x4d1714(0x12f)+_0x17b3eb));const _0x132ff8=_0x81076c?_0x4d1714(0x138)+_0x1d2f09+'/'+_0xb3bdf1+_0x4d1714(0x125):_0x4d1714(0x126);try{const _0x12af3e=await withQuerySpinner(_0x132ff8,async _0x136f2c=>{const _0x5e8cf4=_0x4d1714,_0x15595f=await _0x584ee8[_0x5e8cf4(0x13e)][_0x5e8cf4(0x11c)](_0x17b3eb,{'catalog':_0x96353a,'schema':_0x7d2a55,'onJobId':_0x1fef2c=>{const _0x78c683=_0x5e8cf4;_0x136f2c[_0x78c683(0x11a)](_0x1fef2c);},'onProgress':_0x58b495=>{const _0x18aa79=_0x5e8cf4;_0x136f2c[_0x18aa79(0x128)](_0x18aa79(0x11f)+_0x58b495[_0x18aa79(0x10f)]+']'),_0x136f2c['setExtra'](formatRows(_0x58b495[_0x18aa79(0x12d)])+'\x20rows\x20'+_0x58b495[_0x18aa79(0x11d)]+'/'+_0x58b495[_0x18aa79(0x115)]+_0x18aa79(0x130));}});return _0x15595f;},{'verbose':_0x6ecbda['verbose']}),_0x14ae86=_0x12af3e[_0x4d1714(0x112)],_0x1eb4f8=_0x14ae86[_0x4d1714(0x132)]?_0x4d1714(0x133)+_0x14ae86[_0x4d1714(0x132)]+']':'',_0x5eff8c=_0x81076c?_0x4d1714(0x127)+_0x1d2f09+'/'+_0xb3bdf1+_0x4d1714(0x11e):'';console[_0x4d1714(0x110)]('✔\x20'+_0x5eff8c+'Query\x20completed:\x20Processed\x20'+formatRows(_0x14ae86[_0x4d1714(0x123)][_0x4d1714(0x12d)])+_0x4d1714(0x10d)+(_0x4d1714(0x118)+formatElapsed(_0x14ae86[_0x4d1714(0x123)][_0x4d1714(0x13c)])+_0x1eb4f8));if(_0x81076c&&_0x1fe82a){const _0x40fb08=resolveOutputOptions(_0x6ecbda),_0x59c809=await formatQueryOutput(_0x14ae86,_0x40fb08);_0x2e9a29[_0x4d1714(0x12e)](_0x59c809);}else await handleQueryOutput(_0x14ae86,_0x6ecbda);}catch(_0x382f8d){const _0x290ddd=_0x81076c?_0x4d1714(0x127)+_0x1d2f09+'/'+_0xb3bdf1+':\x0a':'',_0x39668d=_0x382f8d instanceof SDKError?_0x382f8d[_0x4d1714(0x111)]:_0x382f8d[_0x4d1714(0x131)];return console[_0x4d1714(0x110)](''+_0x290ddd+_0x39668d),0x1;}}if(_0x2743db[_0x4d1714(0x13b)]>0x1&&_0x1fe82a&&_0x2e9a29[_0x4d1714(0x13b)]>0x0){const _0x1e5db3=_0x2e9a29['join']('\x0a');writeFileSync(_0x6ecbda[_0x4d1714(0x113)],_0x1e5db3),console[_0x4d1714(0x110)](_0x4d1714(0x119)+_0x6ecbda[_0x4d1714(0x113)]);}return 0x0;}catch(_0x1d2106){throw _0x1d2106;}}['validate'](_0x3d295a){const _0x25b45e=a30_0x945c91,_0x969c9f=_0x3d295a['args'][0x0],_0x4e3cd8=_0x3d295a['options'][_0x25b45e(0x121)];if(!_0x969c9f&&!_0x4e3cd8)return _0x25b45e(0x13d);if(_0x969c9f&&_0x4e3cd8)return _0x25b45e(0x109);return undefined;}}
@@ -1 +1 @@
1
- const a31_0x93cf53=a31_0x4b40;(function(_0x13aa34,_0x26eeb2){const _0x59d444=a31_0x4b40,_0x422c2b=_0x13aa34();while(!![]){try{const _0x26fad5=-parseInt(_0x59d444(0x1ed))/0x1+-parseInt(_0x59d444(0x1e7))/0x2+parseInt(_0x59d444(0x1ab))/0x3+parseInt(_0x59d444(0x19a))/0x4+parseInt(_0x59d444(0x1d3))/0x5+-parseInt(_0x59d444(0x165))/0x6+-parseInt(_0x59d444(0x175))/0x7*(parseInt(_0x59d444(0x197))/0x8);if(_0x26fad5===_0x26eeb2)break;else _0x422c2b['push'](_0x422c2b['shift']());}catch(_0xa73d48){_0x422c2b['push'](_0x422c2b['shift']());}}}(a31_0x3a46,0xebe44));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a31_0x25efaa from'chalk';function a31_0x4b40(_0x33724d,_0x461d3b){_0x33724d=_0x33724d-0x158;const _0x3a461a=a31_0x3a46();let _0x4b405e=_0x3a461a[_0x33724d];return _0x4b405e;}function resolveSegmentTarget(_0x5e0da2,_0x3fedbe,_0x4081cc){const _0x481993=a31_0x4b40;if(isYamlFilePath(_0x5e0da2))try{const _0x4a6a8d=resolveYamlFilePath(_0x5e0da2);return _0x4081cc&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x5e0da2),console['error'](_0x481993(0x187)+_0x4a6a8d[_0x481993(0x1f0)]),console[_0x481993(0x199)](_0x481993(0x196)+_0x4a6a8d['segmentName']),console[_0x481993(0x199)](_0x481993(0x1d8)+(_0x4a6a8d[_0x481993(0x174)]||_0x481993(0x15b))),console[_0x481993(0x199)](_0x481993(0x19e)+_0x4a6a8d[_0x481993(0x1b1)])),_0x4a6a8d[_0x481993(0x1b1)];}catch(_0x2edab3){throw new SDKError(ErrorCode[_0x481993(0x1c5)],_0x481993(0x1d6)+_0x2edab3[_0x481993(0x15d)]);}if(!_0x3fedbe)throw new SDKError(ErrorCode[_0x481993(0x1c5)],_0x481993(0x1d5));return _0x3fedbe+'/'+_0x5e0da2;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a31_0x93cf53(0x1db)]=a31_0x93cf53(0x1f2);async[a31_0x93cf53(0x1dd)](_0x4805d1){const _0x15e60e=a31_0x93cf53,{options:_0x58813b,args:_0x51746e,tdx:_0x527b0b}=_0x4805d1,_0x50fd0b=_0x51746e[0x0],_0x50dbc9=!_0x50fd0b&&!!_0x58813b['parentSegment'],_0x33965c=_0x50fd0b||_0x58813b[_0x15e60e(0x1f0)];if(!_0x33965c)return console['error'](_0x15e60e(0x1a7)),console['error'](_0x15e60e(0x15e)),console[_0x15e60e(0x199)](_0x15e60e(0x1e5)),console[_0x15e60e(0x199)](_0x15e60e(0x1c9)),console[_0x15e60e(0x199)](_0x15e60e(0x1cd)),console[_0x15e60e(0x199)](_0x15e60e(0x1ef)),console[_0x15e60e(0x199)](_0x15e60e(0x1c3)),0x1;try{const _0x4f029d=_0x58813b['segmentPath'];let _0x3362ae=_0x33965c;!_0x50dbc9&&_0x4f029d&&!_0x33965c[_0x15e60e(0x1eb)]('/')&&(_0x3362ae=_0x4f029d+'/'+_0x33965c,_0x58813b['verbose']&&console[_0x15e60e(0x199)](_0x15e60e(0x1b7)+_0x3362ae));const _0x3d72cd=await withSpinner(_0x15e60e(0x1cb)+_0x3362ae+_0x15e60e(0x17e),()=>_0x527b0b['segment'][_0x15e60e(0x1c8)](_0x3362ae),{'verbose':_0x58813b['verbose']}),_0x6cde59=_0x3d72cd[_0x15e60e(0x172)];_0x58813b[_0x15e60e(0x189)]&&(console[_0x15e60e(0x199)]('Resolved\x20type:\x20'+_0x6cde59[_0x15e60e(0x16a)]),console['error'](_0x15e60e(0x1a5)+_0x6cde59['parentId']),_0x6cde59[_0x15e60e(0x17a)]&&console[_0x15e60e(0x199)](_0x15e60e(0x1a4)+_0x6cde59[_0x15e60e(0x17a)]),_0x6cde59[_0x15e60e(0x1b2)]&&console[_0x15e60e(0x199)](_0x15e60e(0x1c4)+_0x6cde59[_0x15e60e(0x1b2)]));if(_0x6cde59[_0x15e60e(0x16a)]===_0x15e60e(0x160)){const _0x2813a5=await withSpinner(_0x15e60e(0x168),()=>_0x527b0b['segment'][_0x15e60e(0x192)](_0x6cde59[_0x15e60e(0x1c6)]),{'verbose':_0x58813b[_0x15e60e(0x189)]});await handleSingleObjectOutput(_0x2813a5[_0x15e60e(0x172)],_0x58813b);}else{if(_0x6cde59[_0x15e60e(0x16a)]==='folder'){if(!_0x6cde59[_0x15e60e(0x17a)])throw new SDKError(ErrorCode[_0x15e60e(0x1ca)],_0x15e60e(0x1e6));const _0x58f827=await withSpinner(_0x15e60e(0x1e4),()=>_0x527b0b[_0x15e60e(0x1cf)][_0x15e60e(0x1d0)](_0x6cde59[_0x15e60e(0x17a)]),{'verbose':_0x58813b[_0x15e60e(0x189)]});await handleSingleObjectOutput(_0x58f827[_0x15e60e(0x172)],_0x58813b);}else{if(_0x6cde59[_0x15e60e(0x16a)]===_0x15e60e(0x1cf)){if(!_0x6cde59[_0x15e60e(0x1b2)])throw new SDKError(ErrorCode[_0x15e60e(0x15c)],_0x15e60e(0x1b3));const _0x357a09=await withSpinner(_0x15e60e(0x1ee),()=>_0x527b0b[_0x15e60e(0x1cf)]['getSegment'](_0x6cde59['parentId'],_0x6cde59['segmentId']),{'verbose':_0x58813b[_0x15e60e(0x189)]});await handleSingleObjectOutput(_0x357a09[_0x15e60e(0x172)],_0x58813b);}}}return 0x0;}catch(_0x5dba3f){if(_0x5dba3f instanceof SDKError)return console[_0x15e60e(0x199)](_0x15e60e(0x1c7)+_0x5dba3f[_0x15e60e(0x15d)]),_0x5dba3f[_0x15e60e(0x17b)]&&console['error'](_0x15e60e(0x17d)+_0x5dba3f['cause']),0x1;throw _0x5dba3f;}}}export class SegmentShowCommand extends BaseCommand{[a31_0x93cf53(0x1df)]=a31_0x93cf53(0x15f);[a31_0x93cf53(0x1db)]=a31_0x93cf53(0x16d);async[a31_0x93cf53(0x1dd)](_0x508c68){const _0x4690cd=a31_0x93cf53,{options:_0x1c84ed,args:_0x1bd748,tdx:_0x34fa96}=_0x508c68,_0x2484f2=_0x1bd748[0x0];if(!_0x2484f2)return console[_0x4690cd(0x199)](_0x4690cd(0x1e1)),console[_0x4690cd(0x199)](_0x4690cd(0x184)),console[_0x4690cd(0x199)](_0x4690cd(0x195)),console[_0x4690cd(0x199)]('Examples:'),console[_0x4690cd(0x199)](_0x4690cd(0x1b8)),console[_0x4690cd(0x199)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x418d3d=_0x1c84ed['parentSegment'],_0x18731a=resolveSegmentTarget(_0x2484f2,_0x418d3d,_0x1c84ed[_0x4690cd(0x189)]);_0x1c84ed[_0x4690cd(0x189)]&&console['error'](_0x4690cd(0x1ba)+_0x18731a);const _0x190ed9=await withSpinner(_0x4690cd(0x16b)+_0x2484f2+_0x4690cd(0x17e),()=>_0x34fa96['segment'][_0x4690cd(0x1c8)](_0x18731a),{'verbose':_0x1c84ed[_0x4690cd(0x189)]}),_0x3d4958=_0x190ed9[_0x4690cd(0x172)];_0x1c84ed[_0x4690cd(0x189)]&&(console['error'](_0x4690cd(0x1a9)+_0x3d4958[_0x4690cd(0x16a)]),console[_0x4690cd(0x199)](_0x4690cd(0x1a5)+_0x3d4958[_0x4690cd(0x1c6)]));if(_0x3d4958[_0x4690cd(0x16a)]===_0x4690cd(0x1c0))return console[_0x4690cd(0x199)](_0x4690cd(0x162)),console[_0x4690cd(0x199)](_0x4690cd(0x1ea)),0x1;if(_0x3d4958[_0x4690cd(0x16a)]===_0x4690cd(0x160))return console[_0x4690cd(0x199)](_0x4690cd(0x1ce)),console[_0x4690cd(0x199)](_0x4690cd(0x15a)),0x1;if(!_0x3d4958[_0x4690cd(0x1b2)])throw new SDKError(ErrorCode[_0x4690cd(0x15c)],_0x4690cd(0x1b3));const _0x34a343=await withSpinner(_0x4690cd(0x19d),()=>_0x34fa96[_0x4690cd(0x1cf)][_0x4690cd(0x1b6)](_0x3d4958['parentId'],_0x3d4958['segmentId']),{'verbose':_0x1c84ed[_0x4690cd(0x189)]});let _0x18dacb=_0x34a343['data'];const _0x4b874c=resolveLimit(_0x1c84ed['limit'],DEFAULT_DISPLAY_LIMIT),_0x3e0e50=/\bLIMIT\s+\d+/i['test'](_0x18dacb);!_0x3e0e50&&(_0x18dacb=_0x18dacb['trim']()[_0x4690cd(0x167)](/;+$/,''),_0x18dacb=_0x4690cd(0x1a8)+_0x18dacb+_0x4690cd(0x1b0)+_0x4b874c);_0x1c84ed[_0x4690cd(0x189)]&&console[_0x4690cd(0x199)]('SQL\x20query:\x0a'+_0x18dacb);const _0xc5e9bb=await withQuerySpinner(_0x4690cd(0x18d),async _0x2aeafd=>{const _0x523097=_0x4690cd,_0x269884=await _0x34fa96[_0x523097(0x188)][_0x523097(0x1dd)](_0x18dacb,{'catalog':'td','schema':_0x523097(0x1d1),'onJobId':_0x3c6a63=>{const _0x214f8a=_0x523097;_0x2aeafd[_0x214f8a(0x193)](_0x3c6a63);}});return _0x269884;},{'verbose':_0x1c84ed[_0x4690cd(0x189)]}),_0x1470f1=_0xc5e9bb[_0x4690cd(0x172)],_0x57a529=_0x1470f1[_0x4690cd(0x158)]?_0x4690cd(0x1ae)+_0x1470f1['jobId']+']':'';return console[_0x4690cd(0x199)](_0x4690cd(0x1c1)+_0x1470f1[_0x4690cd(0x177)][_0x4690cd(0x17c)]['toLocaleString']()+_0x4690cd(0x178)+(_0x4690cd(0x1e3)+formatElapsed(_0x1470f1[_0x4690cd(0x177)][_0x4690cd(0x1a3)])+_0x57a529)),await handleQueryOutput(_0x1470f1,_0x1c84ed),0x0;}catch(_0x4d2b87){if(_0x4d2b87 instanceof SDKError)return console[_0x4690cd(0x199)](_0x4690cd(0x1bf)+_0x4d2b87[_0x4690cd(0x1e2)]+']'),console[_0x4690cd(0x199)]('\x0a'+_0x4d2b87[_0x4690cd(0x15d)]),0x1;throw _0x4d2b87;}}}export class SegmentFolderListCommand extends BaseCommand{[a31_0x93cf53(0x1df)]=a31_0x93cf53(0x1b5);[a31_0x93cf53(0x1db)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a31_0x93cf53(0x1dd)](_0x27e97b){const _0x4209da=a31_0x93cf53,{options:_0x590525,args:_0x4da5aa,tdx:_0x272d70}=_0x27e97b;if(_0x4da5aa[_0x4209da(0x176)]===0x0)return console[_0x4209da(0x199)](_0x4209da(0x16e)),console[_0x4209da(0x199)](_0x4209da(0x1ac)),0x1;const _0x2b4aa5=_0x4da5aa[0x0];try{_0x590525[_0x4209da(0x189)]&&(console[_0x4209da(0x199)]('Site:\x20'+_0x590525[_0x4209da(0x18b)]),console[_0x4209da(0x199)](_0x4209da(0x18a)+_0x2b4aa5));const _0x99c9c0=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2b4aa5+_0x4209da(0x17e),()=>_0x272d70['segment'][_0x4209da(0x1a1)](_0x2b4aa5),{'verbose':_0x590525[_0x4209da(0x189)]}),_0x34b2ca=_0x99c9c0[_0x4209da(0x172)];_0x590525[_0x4209da(0x189)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x34b2ca);const _0x394ffa=await withSpinner(_0x4209da(0x1bb)+_0x2b4aa5+_0x4209da(0x17e),()=>_0x272d70[_0x4209da(0x1cf)][_0x4209da(0x170)](_0x34b2ca),{'verbose':_0x590525[_0x4209da(0x189)]}),_0x4ce7b8=_0x394ffa['data'];return console['error'](_0x4209da(0x159)+_0x4ce7b8['length']+_0x4209da(0x17f)+(_0x4ce7b8[_0x4209da(0x176)]!==0x1?'s':'')),await handleSDKOutput(_0x4ce7b8,_0x590525),0x0;}catch(_0x5b8367){if(_0x5b8367 instanceof SDKError)return console[_0x4209da(0x199)]('Error:\x20'+_0x5b8367['message']),_0x5b8367[_0x4209da(0x17b)]&&console[_0x4209da(0x199)](_0x4209da(0x17d)+_0x5b8367[_0x4209da(0x17b)]),0x1;throw _0x5b8367;}}}export class SegmentFolderShowCommand extends BaseCommand{[a31_0x93cf53(0x1df)]=a31_0x93cf53(0x181);[a31_0x93cf53(0x1db)]=a31_0x93cf53(0x173);async[a31_0x93cf53(0x1dd)](_0x4b53f1){const _0x32b18d=a31_0x93cf53,{options:_0x15c2a5,args:_0x46ecfa,tdx:_0x2a8b8a}=_0x4b53f1;if(_0x46ecfa[_0x32b18d(0x176)]===0x0)return console[_0x32b18d(0x199)](_0x32b18d(0x198)),console['error'](_0x32b18d(0x19f)),0x1;try{const {parentId:_0x1a8a01,childId:_0xfe56bf}=parseSegmentRef(_0x46ecfa[0x0]);_0x15c2a5['verbose']&&(console[_0x32b18d(0x199)](_0x32b18d(0x1d4)+_0x15c2a5[_0x32b18d(0x18b)]),console[_0x32b18d(0x199)](_0x32b18d(0x18a)+_0x1a8a01),_0xfe56bf&&console[_0x32b18d(0x199)](_0x32b18d(0x190)+_0xfe56bf));if(!_0xfe56bf)return console[_0x32b18d(0x199)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x941bf8=await withSpinner(_0x32b18d(0x16f)+_0x1a8a01+_0x32b18d(0x17e),()=>_0x2a8b8a[_0x32b18d(0x1cf)]['resolveParentId'](_0x1a8a01),{'verbose':_0x15c2a5[_0x32b18d(0x189)]}),_0x50a5d1=_0x941bf8[_0x32b18d(0x172)];_0x15c2a5[_0x32b18d(0x189)]&&console[_0x32b18d(0x199)]('Resolved\x20parent\x20ID:\x20'+_0x50a5d1);const _0x5e48d2=await withSpinner(_0x32b18d(0x18c)+_0xfe56bf+_0x32b18d(0x17e),()=>_0x2a8b8a[_0x32b18d(0x1cf)][_0x32b18d(0x1a2)](_0x50a5d1,_0xfe56bf),{'verbose':_0x15c2a5[_0x32b18d(0x189)]}),_0x300b8a=_0x5e48d2['data'];_0x15c2a5['verbose']&&console[_0x32b18d(0x199)](_0x32b18d(0x19c)+_0x300b8a);const _0x1ef9c7=await withSpinner(_0x32b18d(0x1b9)+_0xfe56bf+_0x32b18d(0x17e),()=>_0x2a8b8a[_0x32b18d(0x1cf)]['getFolder'](_0x300b8a),{'verbose':_0x15c2a5[_0x32b18d(0x189)]});return await handleSDKOutput([_0x1ef9c7['data']],_0x15c2a5),0x0;}catch(_0xbe11cb){if(_0xbe11cb instanceof SDKError)return console['error'](_0x32b18d(0x1c7)+_0xbe11cb[_0x32b18d(0x15d)]),_0xbe11cb[_0x32b18d(0x17b)]&&console[_0x32b18d(0x199)](_0x32b18d(0x17d)+_0xbe11cb[_0x32b18d(0x17b)]),0x1;throw _0xbe11cb;}}}export class SegmentSQLCommand extends BaseCommand{[a31_0x93cf53(0x1df)]=a31_0x93cf53(0x1af);['description']=a31_0x93cf53(0x1f5);async[a31_0x93cf53(0x1dd)](_0x2dbfa2){const _0x3bc213=a31_0x93cf53,{options:_0x5b51e2,args:_0x3188da,tdx:_0x10258b}=_0x2dbfa2,_0x3e31b1=_0x3188da[0x0];if(!_0x3e31b1)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3bc213(0x199)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x3bc213(0x199)](_0x3bc213(0x1bc)),console[_0x3bc213(0x199)](_0x3bc213(0x1e5)),console[_0x3bc213(0x199)](_0x3bc213(0x1f3)),console[_0x3bc213(0x199)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2b42ee=_0x5b51e2[_0x3bc213(0x1f0)],_0x25af11=resolveSegmentTarget(_0x3e31b1,_0x2b42ee,_0x5b51e2['verbose']);_0x5b51e2['verbose']&&console[_0x3bc213(0x199)]('Target\x20path:\x20'+_0x25af11);const _0x5ad2e4=await withSpinner(_0x3bc213(0x16b)+_0x3e31b1+_0x3bc213(0x17e),()=>_0x10258b[_0x3bc213(0x1cf)][_0x3bc213(0x1c8)](_0x25af11),{'verbose':_0x5b51e2[_0x3bc213(0x189)]}),_0x2661b3=_0x5ad2e4[_0x3bc213(0x172)];_0x5b51e2[_0x3bc213(0x189)]&&(console[_0x3bc213(0x199)](_0x3bc213(0x1a9)+_0x2661b3['type']),console[_0x3bc213(0x199)](_0x3bc213(0x1a5)+_0x2661b3[_0x3bc213(0x1c6)]));if(_0x2661b3[_0x3bc213(0x16a)]===_0x3bc213(0x1c0))return console[_0x3bc213(0x199)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console['error'](_0x3bc213(0x194)),0x1;if(_0x2661b3[_0x3bc213(0x16a)]===_0x3bc213(0x160))return console[_0x3bc213(0x199)](_0x3bc213(0x182)),console[_0x3bc213(0x199)](_0x3bc213(0x1e8)),0x1;if(!_0x2661b3[_0x3bc213(0x1b2)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x347251=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x10258b[_0x3bc213(0x1cf)]['getSegmentSQL'](_0x2661b3['parentId'],_0x2661b3[_0x3bc213(0x1b2)]),{'verbose':_0x5b51e2['verbose']}),_0x368b0d=_0x347251[_0x3bc213(0x172)];return _0x5b51e2[_0x3bc213(0x180)]===_0x3bc213(0x1c2)||_0x5b51e2[_0x3bc213(0x180)]===_0x3bc213(0x191)?await handleSDKOutput([{'sql':_0x368b0d}],_0x5b51e2):console[_0x3bc213(0x1dc)](_0x368b0d),0x0;}catch(_0x407ade){if(_0x407ade instanceof SDKError)return console[_0x3bc213(0x199)]('Error:\x20'+_0x407ade[_0x3bc213(0x15d)]),_0x407ade[_0x3bc213(0x17b)]&&console['error'](_0x3bc213(0x17d)+_0x407ade[_0x3bc213(0x17b)]),0x1;throw _0x407ade;}}}function a31_0x3a46(){const _0x2d0310=['error','2854888MyVxcL','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolved\x20folder\x20ID:\x20','Fetching\x20SQL\x20for\x20segment...','\x20\x20Full\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','resolveParentId','resolveFolderId','elapsedTimeMillis','Folder\x20ID:\x20','Parent\x20ID:\x20','Create\x20segment\x20folder\x20for\x20organization','Error:\x20Path\x20or\x20name\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20type:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','5031498NcvNZv','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20[Job\x20ID:\x20','segment:sql','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','fullPath','segmentId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','url','segment:folder:list','getSegmentSQL','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20folder\x20\x27','Target\x20path:\x20','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','✖\x20Query\x20failed\x20[','folder','✔\x20Query\x20completed:\x20Processed\x20','json','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Segment\x20ID:\x20','INVALID_ARGUMENT','parentId','Error:\x20','resolvePathToResource','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20path\x20\x27','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment','getFolder','information_schema','web','8729535cYtSIJ','Site:\x20','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','Creating\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','Use:\x20tdx\x20ps\x20desc','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','description','log','execute','/e/','name','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','code','in\x20','Fetching\x20folder\x20details...','Examples:','Folder\x20ID\x20missing\x20from\x20resolved\x20path','1219724YnJiVR','Use:\x20tdx\x20ps\x20sql','Options:','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','includes','Resolved\x20parent\x20folder\x20ID:\x20','1747235kGdUbd','Fetching\x20segment\x20details...','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','parentSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','✔\x20Created\x20folder\x20\x27','Get\x20SQL\x20query\x20for\x20child\x20segment','jobId','✔\x20Found\x20','Use:\x20tdx\x20ps\x20show','(root)','SEGMENT_NOT_FOUND','message','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:show','parent','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','createFolder','Parent\x20segment:\x20','3430602Regoiu','parentFolder','replace','Fetching\x20parent\x20segment\x20details...','Resolving\x20parent\x20folder\x20\x27','type','Resolving\x20\x27','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Parent\x20segment\x20name\x20is\x20required','Resolving\x20parent\x20segment\x20\x27','listFolders','Show\x20child\x20segment\x20schema\x20(column\x20types)','data','Show\x20segment\x20folder\x20details','folderPath','8589AZWvnw','length','stats','\x20rows\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','folderId','cause','processedRows','\x20\x20Cause:\x20','\x27...','\x20folder','format','segment:folder:show','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:desc','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Parent\x20segment:\x20','query','verbose','Parent\x20name:\x20','site','Resolving\x20folder\x20\x27','Executing\x20segment\x20query...','Usage:\x20tdx\x20sg\x20desc\x20<name>','/app/ps/','Folder\x20name:\x20','jsonl','getParent','setJobId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20Segment\x20name:\x20','1576qtYocq','Error:\x20Folder\x20reference\x20is\x20required'];a31_0x3a46=function(){return _0x2d0310;};return a31_0x3a46();}export class SegmentFolderCreateCommand extends BaseCommand{[a31_0x93cf53(0x1df)]='segment:folder:create';[a31_0x93cf53(0x1db)]=a31_0x93cf53(0x1a6);async[a31_0x93cf53(0x1dd)](_0x113bfd){const _0xcf66ef=a31_0x93cf53,{options:_0x540fae,args:_0xa1abf2,tdx:_0x5ec4e5}=_0x113bfd,_0x56b985=_0x540fae;if(_0xa1abf2[_0xcf66ef(0x176)]<0x2)return console[_0xcf66ef(0x199)](_0xcf66ef(0x19b)),console[_0xcf66ef(0x199)](_0xcf66ef(0x179)),0x1;const _0x259686=_0xa1abf2[0x0],_0x4a6afd=_0xa1abf2[0x1];_0x56b985[_0xcf66ef(0x189)]&&(console[_0xcf66ef(0x199)](_0xcf66ef(0x1d4)+_0x56b985['site']),console['error'](_0xcf66ef(0x164)+_0x259686),console[_0xcf66ef(0x199)](_0xcf66ef(0x190)+_0x4a6afd));let _0x1b7cd2;if(_0x56b985[_0xcf66ef(0x166)]){const _0x199ce1=_0x56b985['parentFolder'],_0x4fe6ca=await withSpinner(_0xcf66ef(0x16f)+_0x259686+_0xcf66ef(0x17e),()=>_0x5ec4e5['segment'][_0xcf66ef(0x1a1)](_0x259686),{'verbose':_0x56b985[_0xcf66ef(0x189)]}),_0x2f52d3=_0x4fe6ca['data'],_0x47fd70=await withSpinner(_0xcf66ef(0x169)+_0x199ce1+'\x27...',()=>_0x5ec4e5[_0xcf66ef(0x1cf)][_0xcf66ef(0x1a2)](_0x2f52d3,_0x199ce1),{'verbose':_0x56b985[_0xcf66ef(0x189)]});_0x1b7cd2=_0x47fd70[_0xcf66ef(0x172)],_0x56b985[_0xcf66ef(0x189)]&&console[_0xcf66ef(0x199)](_0xcf66ef(0x1ec)+_0x1b7cd2);}const _0x573c0e={'name':_0x4a6afd,'description':_0x56b985[_0xcf66ef(0x1db)],'parentFolderId':_0x1b7cd2},_0x2af9ea=await withSpinner(_0xcf66ef(0x1d7)+_0x4a6afd+_0xcf66ef(0x17e),()=>_0x5ec4e5[_0xcf66ef(0x1cf)][_0xcf66ef(0x163)](_0x259686,_0x573c0e),{'verbose':_0x56b985['verbose']}),_0x568f86=_0x2af9ea[_0xcf66ef(0x172)];return console[_0xcf66ef(0x199)](_0xcf66ef(0x1f4)+_0x568f86[_0xcf66ef(0x1df)]+_0xcf66ef(0x1cc)+_0x568f86['id']),await handleSDKOutput([_0x568f86],_0x56b985),0x0;}}export class SegmentViewCommand extends BaseCommand{[a31_0x93cf53(0x1df)]='segment:view';['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async[a31_0x93cf53(0x1dd)](_0x3ef05e){const _0x45e55b=a31_0x93cf53,{options:_0xd71bb3,args:_0x5aa788,tdx:_0x2a1dda}=_0x3ef05e,_0xbc6a6e=_0x5aa788[0x0];if(!_0xbc6a6e)return console[_0x45e55b(0x199)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x45e55b(0x199)](_0x45e55b(0x1e0)),console[_0x45e55b(0x199)](_0x45e55b(0x1f1)),console[_0x45e55b(0x199)](_0x45e55b(0x1e9)),console[_0x45e55b(0x199)](_0x45e55b(0x186)),console[_0x45e55b(0x199)](_0x45e55b(0x1e5)),console['error'](_0x45e55b(0x1da)),console[_0x45e55b(0x199)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x45e55b(0x199)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x45e55b(0x199)](_0x45e55b(0x1a0)),0x1;try{const _0x1ee846=_0xd71bb3[_0x45e55b(0x1f0)],_0x3613ea=resolveSegmentTarget(_0xbc6a6e,_0x1ee846,_0xd71bb3[_0x45e55b(0x189)]);_0xd71bb3[_0x45e55b(0x189)]&&console[_0x45e55b(0x199)](_0x45e55b(0x1ba)+_0x3613ea);const _0x45664e=await withSpinner('Resolving\x20\x27'+_0xbc6a6e+_0x45e55b(0x17e),()=>_0x2a1dda[_0x45e55b(0x1cf)][_0x45e55b(0x1c8)](_0x3613ea),{'verbose':_0xd71bb3[_0x45e55b(0x189)]}),_0x545d76=_0x45664e[_0x45e55b(0x172)];_0xd71bb3[_0x45e55b(0x189)]&&(console[_0x45e55b(0x199)](_0x45e55b(0x1a9)+_0x545d76[_0x45e55b(0x16a)]),console[_0x45e55b(0x199)](_0x45e55b(0x1a5)+_0x545d76['parentId']),_0x545d76['folderId']&&console[_0x45e55b(0x199)](_0x45e55b(0x1a4)+_0x545d76[_0x45e55b(0x17a)]),_0x545d76[_0x45e55b(0x1b2)]&&console[_0x45e55b(0x199)]('Segment\x20ID:\x20'+_0x545d76[_0x45e55b(0x1b2)]));if(_0xd71bb3[_0x45e55b(0x1d2)]){if(_0x545d76[_0x45e55b(0x16a)]===_0x45e55b(0x1c0))return console[_0x45e55b(0x199)](_0x45e55b(0x16c)),0x1;if(_0x545d76[_0x45e55b(0x16a)]===_0x45e55b(0x160))return console[_0x45e55b(0x199)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x45e55b(0x199)](_0x45e55b(0x161)),0x1;if(!_0x545d76[_0x45e55b(0x1b2)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x45e55b(0x1b3));const _0x3784f4=getConsoleNextUrl(_0xd71bb3['site'],_0x45e55b(0x18f)+_0x545d76[_0x45e55b(0x1c6)]+_0x45e55b(0x1de)+_0x545d76['segmentId']);return console[_0x45e55b(0x199)](a31_0x25efaa['green']('✔')+'\x20Opening\x20'+a31_0x25efaa['cyan'](_0x3784f4)),openBrowser(_0x3784f4),0x0;}if(_0x545d76[_0x45e55b(0x16a)]==='folder'){if(!_0x545d76[_0x45e55b(0x17a)])throw new SDKError(ErrorCode[_0x45e55b(0x1ca)],_0x45e55b(0x1e6));const _0x46366b=await withSpinner(_0x45e55b(0x1e4),()=>_0x2a1dda[_0x45e55b(0x1cf)][_0x45e55b(0x1d0)](_0x545d76[_0x45e55b(0x17a)]),{'verbose':_0xd71bb3[_0x45e55b(0x189)]});await handleSingleObjectOutput(_0x46366b['data'],_0xd71bb3);}else{if(_0x545d76[_0x45e55b(0x16a)]==='segment'){if(!_0x545d76['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1a6de2=await withSpinner(_0x45e55b(0x1ee),()=>_0x2a1dda[_0x45e55b(0x1cf)]['getSegment'](_0x545d76['parentId'],_0x545d76[_0x45e55b(0x1b2)]),{'verbose':_0xd71bb3[_0x45e55b(0x189)]}),_0x134698=getConsoleNextUrl(_0xd71bb3[_0x45e55b(0x18b)],_0x45e55b(0x18f)+_0x545d76[_0x45e55b(0x1c6)]+_0x45e55b(0x1de)+_0x545d76[_0x45e55b(0x1b2)]),_0x214ba4=_0x1a6de2[_0x45e55b(0x172)];_0x214ba4[_0x45e55b(0x1b4)]=_0x134698,await handleSingleObjectOutput(_0x214ba4,_0xd71bb3);}else return console[_0x45e55b(0x199)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x45e55b(0x199)](_0x45e55b(0x1bd)),0x1;}return 0x0;}catch(_0xa0641a){if(_0xa0641a instanceof SDKError)return console['error']('Error:\x20'+_0xa0641a[_0x45e55b(0x15d)]),_0xa0641a[_0x45e55b(0x17b)]&&console['error'](_0x45e55b(0x17d)+_0xa0641a[_0x45e55b(0x17b)]),0x1;throw _0xa0641a;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a31_0x93cf53(0x1df)]=a31_0x93cf53(0x183);['description']=a31_0x93cf53(0x171);async['execute'](_0x56d053){const _0x5be7da=a31_0x93cf53,{options:_0x66ca1c,args:_0x5471c9,tdx:_0x1d3afb}=_0x56d053,_0x3f1b4d=_0x5471c9[0x0];if(!_0x3f1b4d)return console[_0x5be7da(0x199)](_0x5be7da(0x1e1)),console['error'](_0x5be7da(0x18e)),console['error'](_0x5be7da(0x185)),console[_0x5be7da(0x199)]('Examples:'),console[_0x5be7da(0x199)](_0x5be7da(0x1be)),console[_0x5be7da(0x199)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x836bf2=_0x66ca1c['parentSegment'],_0x3c2d18=resolveSegmentTarget(_0x3f1b4d,_0x836bf2,_0x66ca1c['verbose']);_0x66ca1c[_0x5be7da(0x189)]&&console[_0x5be7da(0x199)](_0x5be7da(0x1ba)+_0x3c2d18);const _0x4bae5d=await withSpinner(_0x5be7da(0x16b)+_0x3f1b4d+_0x5be7da(0x17e),()=>_0x1d3afb[_0x5be7da(0x1cf)][_0x5be7da(0x1c8)](_0x3c2d18),{'verbose':_0x66ca1c[_0x5be7da(0x189)]}),_0xbeaacf=_0x4bae5d['data'];_0x66ca1c[_0x5be7da(0x189)]&&(console[_0x5be7da(0x199)](_0x5be7da(0x1a9)+_0xbeaacf[_0x5be7da(0x16a)]),console[_0x5be7da(0x199)](_0x5be7da(0x1a5)+_0xbeaacf[_0x5be7da(0x1c6)]));if(_0xbeaacf[_0x5be7da(0x16a)]===_0x5be7da(0x1c0))return console['error'](_0x5be7da(0x1aa)),console[_0x5be7da(0x199)](_0x5be7da(0x194)),0x1;if(_0xbeaacf[_0x5be7da(0x16a)]===_0x5be7da(0x160))return console[_0x5be7da(0x199)](_0x5be7da(0x1ad)),console[_0x5be7da(0x199)](_0x5be7da(0x1d9)),0x1;if(!_0xbeaacf[_0x5be7da(0x1b2)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5be7da(0x1b3));const _0x918043=await withSpinner(_0x5be7da(0x19d),()=>_0x1d3afb[_0x5be7da(0x1cf)]['getSegmentSQL'](_0xbeaacf[_0x5be7da(0x1c6)],_0xbeaacf[_0x5be7da(0x1b2)]),{'verbose':_0x66ca1c[_0x5be7da(0x189)]}),_0x4ad30c=_0x918043[_0x5be7da(0x172)],_0x1ac2cb=await executeSchemaQuery(_0x4ad30c,_0x1d3afb,_0x66ca1c);return await handleQueryOutput(_0x1ac2cb,_0x66ca1c),0x0;}catch(_0x6f1649){if(_0x6f1649 instanceof SDKError)return console[_0x5be7da(0x199)](_0x5be7da(0x1c7)+_0x6f1649['message']),_0x6f1649[_0x5be7da(0x17b)]&&console[_0x5be7da(0x199)](_0x5be7da(0x17d)+_0x6f1649['cause']),0x1;throw _0x6f1649;}}}
1
+ const a31_0x11eeb9=a31_0x526b;(function(_0x554071,_0x40f94d){const _0x372216=a31_0x526b,_0x1084ab=_0x554071();while(!![]){try{const _0x20e8bf=-parseInt(_0x372216(0x1bd))/0x1+-parseInt(_0x372216(0x1fa))/0x2+-parseInt(_0x372216(0x1eb))/0x3+-parseInt(_0x372216(0x1d9))/0x4*(parseInt(_0x372216(0x1ad))/0x5)+parseInt(_0x372216(0x1c8))/0x6+-parseInt(_0x372216(0x1c1))/0x7*(-parseInt(_0x372216(0x1cb))/0x8)+-parseInt(_0x372216(0x1f4))/0x9*(-parseInt(_0x372216(0x1cf))/0xa);if(_0x20e8bf===_0x40f94d)break;else _0x1084ab['push'](_0x1084ab['shift']());}catch(_0x555562){_0x1084ab['push'](_0x1084ab['shift']());}}}(a31_0x7f3f,0x1f347));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';function a31_0x7f3f(){const _0x117e22=['getFolder','Fetching\x20folder\x20details...','/app/ps/','data','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','trim','parentSegment','Target\x20path:\x20','Error:\x20Folder\x20reference\x20is\x20required','folderId','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Executing\x20segment\x20query...','28840VTLWek','/e/','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolved\x20parent\x20folder\x20ID:\x20','folderPath','resolveFolderId','Use:\x20tdx\x20ps\x20desc','type','createFolder','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Parent\x20segment\x20name\x20is\x20required','SEGMENT_FOLDER_NOT_FOUND','254774CFwnQC','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Site:\x20','getSegment','41594WHGOGK','Folder\x20ID:\x20','Show\x20segment\x20or\x20folder\x20details','Show\x20segment\x20folder\x20details','(root)','Error:\x20Path\x20or\x20name\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','756096zqFzWx','Segment\x20ID:\x20','error','8IFOZTL','setJobId','cyan','Folder\x20ID\x20missing\x20from\x20resolved\x20path','203730jcbxni','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Use:\x20tdx\x20ps\x20view\x20-w','Use:\x20tdx\x20ps\x20sql','Parent\x20ID:\x20','Resolved\x20parent\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','description','jsonl','172xzbVyk','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','getParent','elapsedTimeMillis','limit','verbose','execute','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','✖\x20Query\x20failed\x20[','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20parent\x20segment\x20\x27','Fetching\x20SQL\x20for\x20segment...','Examples:','cause','json','folder','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','167355ZMRnlV','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Fetching\x20parent\x20segment\x20details...','\x27...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Resolved\x20YAML\x20file:\x20','\x20\x20Full\x20path:\x20','segment:folder:list','279JPxZwz','site','\x20rows\x20','name','segment:sql','stats','154246EQxerc','SEGMENT_NOT_FOUND','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Parent\x20segment:\x20','Resolved\x20folder\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20desc\x20<name>','fullPath','Show\x20child\x20segment\x20schema\x20(column\x20types)','resolveParentId','Resolving\x20parent\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20\x27','url','Usage:\x20tdx\x20sg\x20show\x20<name>','segment:folder:create','toLocaleString','test','length','\x20[Job\x20ID:\x20','getSegmentSQL','message','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','in\x20','segmentName','format','parentId','Fetching\x20segment\x20details...','segment:view','segmentId','\x20Opening\x20','code','✔\x20Found\x20','SQL\x20query:\x0a','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Resolved\x20type:\x20','web','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','query','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','replace','processedRows','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','resolvePathToResource','jobId','Use:\x20tdx\x20ps\x20show','parent','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20ps\x20view','segment:describe','segment','Resolving\x20folder\x20\x27','Error:\x20','Folder\x20name:\x20'];a31_0x7f3f=function(){return _0x117e22;};return a31_0x7f3f();}import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a31_0xf75273 from'chalk';function resolveSegmentTarget(_0x3b7b43,_0x4aa6b7,_0x7565b2){const _0x29db67=a31_0x526b;if(isYamlFilePath(_0x3b7b43))try{const _0x13c8ef=resolveYamlFilePath(_0x3b7b43);return _0x7565b2&&(console[_0x29db67(0x1ca)](_0x29db67(0x1f1)+_0x3b7b43),console[_0x29db67(0x1ca)]('\x20\x20Parent\x20segment:\x20'+_0x13c8ef[_0x29db67(0x1a7)]),console[_0x29db67(0x1ca)](_0x29db67(0x189)+_0x13c8ef[_0x29db67(0x217)]),console['error'](_0x29db67(0x209)+(_0x13c8ef[_0x29db67(0x1b1)]||_0x29db67(0x1c5))),console[_0x29db67(0x1ca)](_0x29db67(0x1f2)+_0x13c8ef[_0x29db67(0x202)])),_0x13c8ef[_0x29db67(0x202)];}catch(_0x4c8065){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x29db67(0x18d)+_0x4c8065[_0x29db67(0x214)]);}if(!_0x4aa6b7)throw new SDKError(ErrorCode[_0x29db67(0x1fc)],_0x29db67(0x1a5));return _0x4aa6b7+'/'+_0x3b7b43;}export class SegmentDescribeCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]=a31_0x11eeb9(0x19c);[a31_0x11eeb9(0x1d7)]=a31_0x11eeb9(0x1c3);async[a31_0x11eeb9(0x1e0)](_0x7cf382){const _0x43022f=a31_0x11eeb9,{options:_0x13842d,args:_0x371132,tdx:_0x34d961}=_0x7cf382,_0x4e8b33=_0x371132[0x0],_0x9a0190=!_0x4e8b33&&!!_0x13842d[_0x43022f(0x1a7)],_0x14f64c=_0x4e8b33||_0x13842d['parentSegment'];if(!_0x14f64c)return console[_0x43022f(0x1ca)](_0x43022f(0x1c6)),console[_0x43022f(0x1ca)](_0x43022f(0x208)),console[_0x43022f(0x1ca)](_0x43022f(0x1e6)),console[_0x43022f(0x1ca)](_0x43022f(0x20a)),console['error'](_0x43022f(0x1fd)),console[_0x43022f(0x1ca)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x43022f(0x19a)),0x1;try{const _0x247458=_0x13842d['segmentPath'];let _0x489604=_0x14f64c;!_0x9a0190&&_0x247458&&!_0x14f64c['includes']('/')&&(_0x489604=_0x247458+'/'+_0x14f64c,_0x13842d['verbose']&&console[_0x43022f(0x1ca)](_0x43022f(0x1c7)+_0x489604));const _0x462328=await withSpinner('Resolving\x20path\x20\x27'+_0x489604+_0x43022f(0x1ee),()=>_0x34d961[_0x43022f(0x19d)][_0x43022f(0x196)](_0x489604),{'verbose':_0x13842d[_0x43022f(0x1df)]}),_0x3bf7a2=_0x462328[_0x43022f(0x1a4)];_0x13842d[_0x43022f(0x1df)]&&(console[_0x43022f(0x1ca)]('Resolved\x20type:\x20'+_0x3bf7a2[_0x43022f(0x1b4)]),console[_0x43022f(0x1ca)]('Parent\x20ID:\x20'+_0x3bf7a2['parentId']),_0x3bf7a2[_0x43022f(0x1aa)]&&console[_0x43022f(0x1ca)](_0x43022f(0x1c2)+_0x3bf7a2[_0x43022f(0x1aa)]),_0x3bf7a2[_0x43022f(0x21c)]&&console[_0x43022f(0x1ca)](_0x43022f(0x1c9)+_0x3bf7a2['segmentId']));if(_0x3bf7a2['type']===_0x43022f(0x199)){const _0x543896=await withSpinner(_0x43022f(0x1ed),()=>_0x34d961[_0x43022f(0x19d)][_0x43022f(0x1dc)](_0x3bf7a2[_0x43022f(0x219)]),{'verbose':_0x13842d['verbose']});await handleSingleObjectOutput(_0x543896[_0x43022f(0x1a4)],_0x13842d);}else{if(_0x3bf7a2[_0x43022f(0x1b4)]===_0x43022f(0x1e9)){if(!_0x3bf7a2[_0x43022f(0x1aa)])throw new SDKError(ErrorCode[_0x43022f(0x1bc)],_0x43022f(0x1ce));const _0x26b938=await withSpinner(_0x43022f(0x1a2),()=>_0x34d961[_0x43022f(0x19d)][_0x43022f(0x1a1)](_0x3bf7a2[_0x43022f(0x1aa)]),{'verbose':_0x13842d['verbose']});await handleSingleObjectOutput(_0x26b938[_0x43022f(0x1a4)],_0x13842d);}else{if(_0x3bf7a2['type']==='segment'){if(!_0x3bf7a2['segmentId'])throw new SDKError(ErrorCode[_0x43022f(0x1fb)],_0x43022f(0x200));const _0x59c602=await withSpinner(_0x43022f(0x21a),()=>_0x34d961['segment'][_0x43022f(0x1c0)](_0x3bf7a2[_0x43022f(0x219)],_0x3bf7a2[_0x43022f(0x21c)]),{'verbose':_0x13842d['verbose']});await handleSingleObjectOutput(_0x59c602[_0x43022f(0x1a4)],_0x13842d);}}}return 0x0;}catch(_0x4dd982){if(_0x4dd982 instanceof SDKError)return console[_0x43022f(0x1ca)](_0x43022f(0x19f)+_0x4dd982[_0x43022f(0x214)]),_0x4dd982[_0x43022f(0x1e7)]&&console['error'](_0x43022f(0x18f)+_0x4dd982[_0x43022f(0x1e7)]),0x1;throw _0x4dd982;}}}export class SegmentShowCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]='segment:show';[a31_0x11eeb9(0x1d7)]=a31_0x11eeb9(0x1d1);async[a31_0x11eeb9(0x1e0)](_0x575df1){const _0x285189=a31_0x11eeb9,{options:_0x135df7,args:_0x3a0313,tdx:_0x5d90b2}=_0x575df1,_0x250589=_0x3a0313[0x0];if(!_0x250589)return console[_0x285189(0x1ca)](_0x285189(0x188)),console[_0x285189(0x1ca)](_0x285189(0x20d)),console[_0x285189(0x1ca)](_0x285189(0x1b9)),console['error'](_0x285189(0x1e6)),console[_0x285189(0x1ca)](_0x285189(0x18a)),console[_0x285189(0x1ca)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5cb95c=_0x135df7['parentSegment'],_0x5cc26c=resolveSegmentTarget(_0x250589,_0x5cb95c,_0x135df7[_0x285189(0x1df)]);_0x135df7['verbose']&&console[_0x285189(0x1ca)](_0x285189(0x1a8)+_0x5cc26c);const _0x49ae0c=await withSpinner(_0x285189(0x20b)+_0x250589+_0x285189(0x1ee),()=>_0x5d90b2[_0x285189(0x19d)][_0x285189(0x196)](_0x5cc26c),{'verbose':_0x135df7['verbose']}),_0x3cce14=_0x49ae0c[_0x285189(0x1a4)];_0x135df7['verbose']&&(console['error'](_0x285189(0x18b)+_0x3cce14[_0x285189(0x1b4)]),console[_0x285189(0x1ca)](_0x285189(0x1d4)+_0x3cce14[_0x285189(0x219)]));if(_0x3cce14['type']===_0x285189(0x1e9))return console[_0x285189(0x1ca)](_0x285189(0x1b7)),console[_0x285189(0x1ca)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x3cce14['type']===_0x285189(0x199))return console['error'](_0x285189(0x1b8)),console[_0x285189(0x1ca)](_0x285189(0x198)),0x1;if(!_0x3cce14[_0x285189(0x21c)])throw new SDKError(ErrorCode[_0x285189(0x1fb)],_0x285189(0x200));const _0x347cd0=await withSpinner(_0x285189(0x1e5),()=>_0x5d90b2[_0x285189(0x19d)]['getSegmentSQL'](_0x3cce14[_0x285189(0x219)],_0x3cce14['segmentId']),{'verbose':_0x135df7[_0x285189(0x1df)]});let _0x2b1509=_0x347cd0[_0x285189(0x1a4)];const _0x463a58=resolveLimit(_0x135df7[_0x285189(0x1de)],DEFAULT_DISPLAY_LIMIT),_0x9f7efb=/\bLIMIT\s+\d+/i[_0x285189(0x210)](_0x2b1509);!_0x9f7efb&&(_0x2b1509=_0x2b1509[_0x285189(0x1a6)]()[_0x285189(0x192)](/;+$/,''),_0x2b1509=_0x285189(0x1b6)+_0x2b1509+_0x285189(0x1e3)+_0x463a58);_0x135df7[_0x285189(0x1df)]&&console[_0x285189(0x1ca)](_0x285189(0x220)+_0x2b1509);const _0x3776d2=await withQuerySpinner(_0x285189(0x1ac),async _0x5ab7fe=>{const _0x5e2394=_0x285189,_0x13022a=await _0x5d90b2[_0x5e2394(0x18e)][_0x5e2394(0x1e0)](_0x2b1509,{'catalog':'td','schema':'information_schema','onJobId':_0x2ce8c3=>{const _0x214983=_0x5e2394;_0x5ab7fe[_0x214983(0x1cc)](_0x2ce8c3);}});return _0x13022a;},{'verbose':_0x135df7['verbose']}),_0x332865=_0x3776d2[_0x285189(0x1a4)],_0x441566=_0x332865[_0x285189(0x197)]?_0x285189(0x212)+_0x332865[_0x285189(0x197)]+']':'';return console[_0x285189(0x1ca)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x332865[_0x285189(0x1f9)][_0x285189(0x193)][_0x285189(0x20f)]()+_0x285189(0x1f6)+(_0x285189(0x216)+formatElapsed(_0x332865['stats'][_0x285189(0x1dd)])+_0x441566)),await handleQueryOutput(_0x332865,_0x135df7),0x0;}catch(_0x41c3bf){if(_0x41c3bf instanceof SDKError)return console[_0x285189(0x1ca)](_0x285189(0x1e2)+_0x41c3bf[_0x285189(0x21e)]+']'),console[_0x285189(0x1ca)]('\x0a'+_0x41c3bf[_0x285189(0x214)]),0x1;throw _0x41c3bf;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a31_0x11eeb9(0x1f3);[a31_0x11eeb9(0x1d7)]=a31_0x11eeb9(0x1f0);async[a31_0x11eeb9(0x1e0)](_0x5772ed){const _0x183d82=a31_0x11eeb9,{options:_0x12980d,args:_0x5a75ca,tdx:_0x3a422c}=_0x5772ed;if(_0x5a75ca[_0x183d82(0x211)]===0x0)return console[_0x183d82(0x1ca)](_0x183d82(0x1bb)),console[_0x183d82(0x1ca)](_0x183d82(0x207)),0x1;const _0x530540=_0x5a75ca[0x0];try{_0x12980d[_0x183d82(0x1df)]&&(console['error'](_0x183d82(0x1bf)+_0x12980d[_0x183d82(0x1f5)]),console[_0x183d82(0x1ca)]('Parent\x20name:\x20'+_0x530540));const _0x15cd59=await withSpinner(_0x183d82(0x1e4)+_0x530540+_0x183d82(0x1ee),()=>_0x3a422c[_0x183d82(0x19d)]['resolveParentId'](_0x530540),{'verbose':_0x12980d[_0x183d82(0x1df)]}),_0x485c24=_0x15cd59['data'];_0x12980d[_0x183d82(0x1df)]&&console[_0x183d82(0x1ca)](_0x183d82(0x1d5)+_0x485c24);const _0x111a8b=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x530540+_0x183d82(0x1ee),()=>_0x3a422c[_0x183d82(0x19d)]['listFolders'](_0x485c24),{'verbose':_0x12980d[_0x183d82(0x1df)]}),_0x15afcf=_0x111a8b[_0x183d82(0x1a4)];return console[_0x183d82(0x1ca)](_0x183d82(0x21f)+_0x15afcf[_0x183d82(0x211)]+'\x20folder'+(_0x15afcf[_0x183d82(0x211)]!==0x1?'s':'')),await handleSDKOutput(_0x15afcf,_0x12980d),0x0;}catch(_0x3baaaa){if(_0x3baaaa instanceof SDKError)return console['error'](_0x183d82(0x19f)+_0x3baaaa[_0x183d82(0x214)]),_0x3baaaa[_0x183d82(0x1e7)]&&console[_0x183d82(0x1ca)](_0x183d82(0x18f)+_0x3baaaa[_0x183d82(0x1e7)]),0x1;throw _0x3baaaa;}}}export class SegmentFolderShowCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]='segment:folder:show';[a31_0x11eeb9(0x1d7)]=a31_0x11eeb9(0x1c4);async[a31_0x11eeb9(0x1e0)](_0x237145){const _0x89304e=a31_0x11eeb9,{options:_0x272f68,args:_0x5c4cbb,tdx:_0x46843a}=_0x237145;if(_0x5c4cbb[_0x89304e(0x211)]===0x0)return console[_0x89304e(0x1ca)](_0x89304e(0x1a9)),console[_0x89304e(0x1ca)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x14ea00,childId:_0x401f10}=parseSegmentRef(_0x5c4cbb[0x0]);_0x272f68[_0x89304e(0x1df)]&&(console['error'](_0x89304e(0x1bf)+_0x272f68['site']),console[_0x89304e(0x1ca)]('Parent\x20name:\x20'+_0x14ea00),_0x401f10&&console['error'](_0x89304e(0x1a0)+_0x401f10));if(!_0x401f10)return console[_0x89304e(0x1ca)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0xe608aa=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x14ea00+_0x89304e(0x1ee),()=>_0x46843a[_0x89304e(0x19d)]['resolveParentId'](_0x14ea00),{'verbose':_0x272f68[_0x89304e(0x1df)]}),_0x222136=_0xe608aa[_0x89304e(0x1a4)];_0x272f68[_0x89304e(0x1df)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x222136);const _0x32d7b7=await withSpinner(_0x89304e(0x19e)+_0x401f10+_0x89304e(0x1ee),()=>_0x46843a[_0x89304e(0x19d)][_0x89304e(0x1b2)](_0x222136,_0x401f10),{'verbose':_0x272f68[_0x89304e(0x1df)]}),_0x30350e=_0x32d7b7[_0x89304e(0x1a4)];_0x272f68['verbose']&&console[_0x89304e(0x1ca)](_0x89304e(0x1ff)+_0x30350e);const _0x13f7be=await withSpinner('Fetching\x20folder\x20\x27'+_0x401f10+_0x89304e(0x1ee),()=>_0x46843a[_0x89304e(0x19d)]['getFolder'](_0x30350e),{'verbose':_0x272f68[_0x89304e(0x1df)]});return await handleSDKOutput([_0x13f7be[_0x89304e(0x1a4)]],_0x272f68),0x0;}catch(_0x4ed4f3){if(_0x4ed4f3 instanceof SDKError)return console[_0x89304e(0x1ca)]('Error:\x20'+_0x4ed4f3[_0x89304e(0x214)]),_0x4ed4f3[_0x89304e(0x1e7)]&&console[_0x89304e(0x1ca)](_0x89304e(0x18f)+_0x4ed4f3['cause']),0x1;throw _0x4ed4f3;}}}function a31_0x526b(_0x72c48a,_0xdfe484){_0x72c48a=_0x72c48a-0x188;const _0x7f3f3f=a31_0x7f3f();let _0x526bb3=_0x7f3f3f[_0x72c48a];return _0x526bb3;}export class SegmentSQLCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]=a31_0x11eeb9(0x1f8);[a31_0x11eeb9(0x1d7)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a31_0x11eeb9(0x1e0)](_0x482d93){const _0x1deffd=a31_0x11eeb9,{options:_0x50ab9c,args:_0x3d1e6b,tdx:_0x4f4a36}=_0x482d93,_0x154856=_0x3d1e6b[0x0];if(!_0x154856)return console['error'](_0x1deffd(0x188)),console[_0x1deffd(0x1ca)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x1deffd(0x1ca)](_0x1deffd(0x1be)),console[_0x1deffd(0x1ca)](_0x1deffd(0x1e6)),console['error'](_0x1deffd(0x190)),console[_0x1deffd(0x1ca)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4eb35c=_0x50ab9c[_0x1deffd(0x1a7)],_0x5e87b2=resolveSegmentTarget(_0x154856,_0x4eb35c,_0x50ab9c[_0x1deffd(0x1df)]);_0x50ab9c[_0x1deffd(0x1df)]&&console[_0x1deffd(0x1ca)](_0x1deffd(0x1a8)+_0x5e87b2);const _0x3fd6aa=await withSpinner(_0x1deffd(0x20b)+_0x154856+_0x1deffd(0x1ee),()=>_0x4f4a36[_0x1deffd(0x19d)]['resolvePathToResource'](_0x5e87b2),{'verbose':_0x50ab9c['verbose']}),_0x11dd16=_0x3fd6aa[_0x1deffd(0x1a4)];_0x50ab9c['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x11dd16[_0x1deffd(0x1b4)]),console[_0x1deffd(0x1ca)](_0x1deffd(0x1d4)+_0x11dd16[_0x1deffd(0x219)]));if(_0x11dd16[_0x1deffd(0x1b4)]===_0x1deffd(0x1e9))return console['error']('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x1deffd(0x1ca)](_0x1deffd(0x191)),0x1;if(_0x11dd16[_0x1deffd(0x1b4)]==='parent')return console[_0x1deffd(0x1ca)](_0x1deffd(0x1ea)),console[_0x1deffd(0x1ca)](_0x1deffd(0x1d3)),0x1;if(!_0x11dd16['segmentId'])throw new SDKError(ErrorCode[_0x1deffd(0x1fb)],_0x1deffd(0x200));const _0x383258=await withSpinner(_0x1deffd(0x1e5),()=>_0x4f4a36[_0x1deffd(0x19d)]['getSegmentSQL'](_0x11dd16[_0x1deffd(0x219)],_0x11dd16[_0x1deffd(0x21c)]),{'verbose':_0x50ab9c[_0x1deffd(0x1df)]}),_0x1ffce8=_0x383258[_0x1deffd(0x1a4)];return _0x50ab9c[_0x1deffd(0x218)]===_0x1deffd(0x1e8)||_0x50ab9c[_0x1deffd(0x218)]===_0x1deffd(0x1d8)?await handleSDKOutput([{'sql':_0x1ffce8}],_0x50ab9c):console['log'](_0x1ffce8),0x0;}catch(_0x1c3904){if(_0x1c3904 instanceof SDKError)return console[_0x1deffd(0x1ca)](_0x1deffd(0x19f)+_0x1c3904[_0x1deffd(0x214)]),_0x1c3904[_0x1deffd(0x1e7)]&&console[_0x1deffd(0x1ca)](_0x1deffd(0x18f)+_0x1c3904[_0x1deffd(0x1e7)]),0x1;throw _0x1c3904;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]=a31_0x11eeb9(0x20e);[a31_0x11eeb9(0x1d7)]='Create\x20segment\x20folder\x20for\x20organization';async[a31_0x11eeb9(0x1e0)](_0x37ac44){const _0x38b96b=a31_0x11eeb9,{options:_0x1c062f,args:_0x33b725,tdx:_0x5d0833}=_0x37ac44,_0x404002=_0x1c062f;if(_0x33b725[_0x38b96b(0x211)]<0x2)return console[_0x38b96b(0x1ca)](_0x38b96b(0x1da)),console[_0x38b96b(0x1ca)](_0x38b96b(0x206)),0x1;const _0x45abe6=_0x33b725[0x0],_0x2c6b32=_0x33b725[0x1];_0x404002['verbose']&&(console[_0x38b96b(0x1ca)](_0x38b96b(0x1bf)+_0x404002['site']),console[_0x38b96b(0x1ca)](_0x38b96b(0x1fe)+_0x45abe6),console[_0x38b96b(0x1ca)](_0x38b96b(0x1a0)+_0x2c6b32));let _0x50ccae;if(_0x404002['parentFolder']){const _0x3c29b5=_0x404002['parentFolder'],_0x2bef82=await withSpinner(_0x38b96b(0x1e4)+_0x45abe6+'\x27...',()=>_0x5d0833[_0x38b96b(0x19d)][_0x38b96b(0x204)](_0x45abe6),{'verbose':_0x404002[_0x38b96b(0x1df)]}),_0x186e97=_0x2bef82[_0x38b96b(0x1a4)],_0x58213a=await withSpinner(_0x38b96b(0x205)+_0x3c29b5+_0x38b96b(0x1ee),()=>_0x5d0833[_0x38b96b(0x19d)][_0x38b96b(0x1b2)](_0x186e97,_0x3c29b5),{'verbose':_0x404002[_0x38b96b(0x1df)]});_0x50ccae=_0x58213a['data'],_0x404002[_0x38b96b(0x1df)]&&console[_0x38b96b(0x1ca)](_0x38b96b(0x1b0)+_0x50ccae);}const _0x29427f={'name':_0x2c6b32,'description':_0x404002['description'],'parentFolderId':_0x50ccae},_0x5ad629=await withSpinner('Creating\x20folder\x20\x27'+_0x2c6b32+_0x38b96b(0x1ee),()=>_0x5d0833['segment'][_0x38b96b(0x1b5)](_0x45abe6,_0x29427f),{'verbose':_0x404002[_0x38b96b(0x1df)]}),_0x1f1ac2=_0x5ad629[_0x38b96b(0x1a4)];return console[_0x38b96b(0x1ca)]('✔\x20Created\x20folder\x20\x27'+_0x1f1ac2[_0x38b96b(0x1f7)]+'\x27\x20with\x20ID:\x20'+_0x1f1ac2['id']),await handleSDKOutput([_0x1f1ac2],_0x404002),0x0;}}export class SegmentViewCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]=a31_0x11eeb9(0x21b);[a31_0x11eeb9(0x1d7)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a31_0x11eeb9(0x1e0)](_0x3df757){const _0x5536c3=a31_0x11eeb9,{options:_0x7b4bf8,args:_0xddb4ca,tdx:_0x1796bf}=_0x3df757,_0x9e6e8c=_0xddb4ca[0x0];if(!_0x9e6e8c)return console[_0x5536c3(0x1ca)](_0x5536c3(0x1d6)),console['error'](_0x5536c3(0x1af)),console[_0x5536c3(0x1ca)](_0x5536c3(0x194)),console[_0x5536c3(0x1ca)]('Options:'),console[_0x5536c3(0x1ca)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5536c3(0x1ca)](_0x5536c3(0x1e6)),console[_0x5536c3(0x1ca)](_0x5536c3(0x1d0)),console['error'](_0x5536c3(0x215)),console[_0x5536c3(0x1ca)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x5536c3(0x1db)),0x1;try{const _0x42a789=_0x7b4bf8[_0x5536c3(0x1a7)],_0x1c820e=resolveSegmentTarget(_0x9e6e8c,_0x42a789,_0x7b4bf8['verbose']);_0x7b4bf8[_0x5536c3(0x1df)]&&console[_0x5536c3(0x1ca)](_0x5536c3(0x1a8)+_0x1c820e);const _0x144ae8=await withSpinner(_0x5536c3(0x20b)+_0x9e6e8c+'\x27...',()=>_0x1796bf['segment'][_0x5536c3(0x196)](_0x1c820e),{'verbose':_0x7b4bf8[_0x5536c3(0x1df)]}),_0x58e622=_0x144ae8[_0x5536c3(0x1a4)];_0x7b4bf8[_0x5536c3(0x1df)]&&(console[_0x5536c3(0x1ca)](_0x5536c3(0x18b)+_0x58e622[_0x5536c3(0x1b4)]),console[_0x5536c3(0x1ca)](_0x5536c3(0x1d4)+_0x58e622['parentId']),_0x58e622['folderId']&&console[_0x5536c3(0x1ca)](_0x5536c3(0x1c2)+_0x58e622[_0x5536c3(0x1aa)]),_0x58e622['segmentId']&&console[_0x5536c3(0x1ca)]('Segment\x20ID:\x20'+_0x58e622[_0x5536c3(0x21c)]));if(_0x7b4bf8[_0x5536c3(0x18c)]){if(_0x58e622[_0x5536c3(0x1b4)]==='folder')return console[_0x5536c3(0x1ca)](_0x5536c3(0x1ba)),0x1;if(_0x58e622['type']===_0x5536c3(0x199))return console[_0x5536c3(0x1ca)](_0x5536c3(0x1e1)),console[_0x5536c3(0x1ca)](_0x5536c3(0x1d2)),0x1;if(!_0x58e622[_0x5536c3(0x21c)])throw new SDKError(ErrorCode[_0x5536c3(0x1fb)],_0x5536c3(0x200));const _0x124624=getConsoleNextUrl(_0x7b4bf8[_0x5536c3(0x1f5)],_0x5536c3(0x1a3)+_0x58e622[_0x5536c3(0x219)]+'/e/'+_0x58e622[_0x5536c3(0x21c)]);return console[_0x5536c3(0x1ca)](a31_0xf75273['green']('✔')+_0x5536c3(0x21d)+a31_0xf75273[_0x5536c3(0x1cd)](_0x124624)),openBrowser(_0x124624),0x0;}if(_0x58e622[_0x5536c3(0x1b4)]===_0x5536c3(0x1e9)){if(!_0x58e622[_0x5536c3(0x1aa)])throw new SDKError(ErrorCode[_0x5536c3(0x1bc)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x476834=await withSpinner(_0x5536c3(0x1a2),()=>_0x1796bf['segment'][_0x5536c3(0x1a1)](_0x58e622[_0x5536c3(0x1aa)]),{'verbose':_0x7b4bf8[_0x5536c3(0x1df)]});await handleSingleObjectOutput(_0x476834[_0x5536c3(0x1a4)],_0x7b4bf8);}else{if(_0x58e622['type']==='segment'){if(!_0x58e622[_0x5536c3(0x21c)])throw new SDKError(ErrorCode[_0x5536c3(0x1fb)],_0x5536c3(0x200));const _0x37c9d4=await withSpinner(_0x5536c3(0x21a),()=>_0x1796bf[_0x5536c3(0x19d)][_0x5536c3(0x1c0)](_0x58e622[_0x5536c3(0x219)],_0x58e622[_0x5536c3(0x21c)]),{'verbose':_0x7b4bf8[_0x5536c3(0x1df)]}),_0x467143=getConsoleNextUrl(_0x7b4bf8['site'],_0x5536c3(0x1a3)+_0x58e622['parentId']+_0x5536c3(0x1ae)+_0x58e622[_0x5536c3(0x21c)]),_0x2effe6=_0x37c9d4[_0x5536c3(0x1a4)];_0x2effe6[_0x5536c3(0x20c)]=_0x467143,await handleSingleObjectOutput(_0x2effe6,_0x7b4bf8);}else return console[_0x5536c3(0x1ca)](_0x5536c3(0x1ab)),console[_0x5536c3(0x1ca)](_0x5536c3(0x19b)),0x1;}return 0x0;}catch(_0x432645){if(_0x432645 instanceof SDKError)return console[_0x5536c3(0x1ca)](_0x5536c3(0x19f)+_0x432645[_0x5536c3(0x214)]),_0x432645[_0x5536c3(0x1e7)]&&console['error'](_0x5536c3(0x18f)+_0x432645[_0x5536c3(0x1e7)]),0x1;throw _0x432645;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a31_0x11eeb9(0x1f7)]='segment:desc';[a31_0x11eeb9(0x1d7)]=a31_0x11eeb9(0x203);async[a31_0x11eeb9(0x1e0)](_0x1da93d){const _0x22352d=a31_0x11eeb9,{options:_0x4eadba,args:_0x1954a1,tdx:_0x3d1bd6}=_0x1da93d,_0x1c7589=_0x1954a1[0x0];if(!_0x1c7589)return console[_0x22352d(0x1ca)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x22352d(0x1ca)](_0x22352d(0x201)),console[_0x22352d(0x1ca)](_0x22352d(0x195)),console[_0x22352d(0x1ca)](_0x22352d(0x1e6)),console[_0x22352d(0x1ca)](_0x22352d(0x1ec)),console['error'](_0x22352d(0x1ef)),0x1;try{const _0x53766f=_0x4eadba[_0x22352d(0x1a7)],_0x1e5dc6=resolveSegmentTarget(_0x1c7589,_0x53766f,_0x4eadba[_0x22352d(0x1df)]);_0x4eadba[_0x22352d(0x1df)]&&console[_0x22352d(0x1ca)](_0x22352d(0x1a8)+_0x1e5dc6);const _0x519998=await withSpinner(_0x22352d(0x20b)+_0x1c7589+'\x27...',()=>_0x3d1bd6[_0x22352d(0x19d)]['resolvePathToResource'](_0x1e5dc6),{'verbose':_0x4eadba[_0x22352d(0x1df)]}),_0x45964e=_0x519998['data'];_0x4eadba[_0x22352d(0x1df)]&&(console[_0x22352d(0x1ca)](_0x22352d(0x18b)+_0x45964e[_0x22352d(0x1b4)]),console[_0x22352d(0x1ca)](_0x22352d(0x1d4)+_0x45964e['parentId']));if(_0x45964e[_0x22352d(0x1b4)]==='folder')return console[_0x22352d(0x1ca)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x22352d(0x1ca)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x45964e[_0x22352d(0x1b4)]==='parent')return console[_0x22352d(0x1ca)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x22352d(0x1ca)](_0x22352d(0x1b3)),0x1;if(!_0x45964e[_0x22352d(0x21c)])throw new SDKError(ErrorCode[_0x22352d(0x1fb)],_0x22352d(0x200));const _0x1447b7=await withSpinner(_0x22352d(0x1e5),()=>_0x3d1bd6['segment'][_0x22352d(0x213)](_0x45964e[_0x22352d(0x219)],_0x45964e[_0x22352d(0x21c)]),{'verbose':_0x4eadba[_0x22352d(0x1df)]}),_0x2b1384=_0x1447b7['data'],_0x264f4d=await executeSchemaQuery(_0x2b1384,_0x3d1bd6,_0x4eadba);return await handleQueryOutput(_0x264f4d,_0x4eadba),0x0;}catch(_0x4e172f){if(_0x4e172f instanceof SDKError)return console[_0x22352d(0x1ca)](_0x22352d(0x19f)+_0x4e172f[_0x22352d(0x214)]),_0x4e172f[_0x22352d(0x1e7)]&&console[_0x22352d(0x1ca)](_0x22352d(0x18f)+_0x4e172f['cause']),0x1;throw _0x4e172f;}}}