@treasuredata/tdx 0.16.19 → 0.17.0

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 (192) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.d.ts +3 -0
  22. package/dist/commands/job-command.d.ts.map +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/job-command.js.map +1 -1
  25. package/dist/commands/journey-command.js +1 -1
  26. package/dist/commands/journey-validate-command.js +1 -1
  27. package/dist/commands/llm-command.js +1 -1
  28. package/dist/commands/llm-proxy.js +1 -1
  29. package/dist/commands/mcp-command.js +1 -1
  30. package/dist/commands/parent-segment-command.js +1 -1
  31. package/dist/commands/profile-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.js +1 -1
  34. package/dist/commands/schedule-command.d.ts +67 -0
  35. package/dist/commands/schedule-command.d.ts.map +1 -0
  36. package/dist/commands/schedule-command.js +1 -0
  37. package/dist/commands/schedule-command.js.map +1 -0
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/use-command.js +1 -1
  52. package/dist/commands/user-command.js +1 -1
  53. package/dist/commands/workflow-command.js +1 -1
  54. package/dist/core/auth.js +1 -1
  55. package/dist/core/command-output.js +1 -1
  56. package/dist/core/config.js +1 -1
  57. package/dist/core/connection-cache.js +1 -1
  58. package/dist/core/constants.js +1 -1
  59. package/dist/core/credential-cache.js +1 -1
  60. package/dist/core/global-context.js +1 -1
  61. package/dist/core/keychain.js +1 -1
  62. package/dist/core/profile.js +1 -1
  63. package/dist/core/project-config.js +1 -1
  64. package/dist/core/session.js +1 -1
  65. package/dist/core/user-cache.js +1 -1
  66. package/dist/core/version.js +1 -1
  67. package/dist/index.js +1 -1
  68. package/dist/mcp/server.js +1 -1
  69. package/dist/mcp/tools/index.js +1 -1
  70. package/dist/mcp/tools/tdx-run.js +1 -1
  71. package/dist/mcp/tools/tdx-search.js +1 -1
  72. package/dist/mcp/utils.js +1 -1
  73. package/dist/proxy/anthropic-adapter.js +1 -1
  74. package/dist/proxy/claude-usage-tracker.js +1 -1
  75. package/dist/proxy/context-signature.js +1 -1
  76. package/dist/proxy/conversation-utils.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/server.js +1 -1
  79. package/dist/proxy/session-cache.js +1 -1
  80. package/dist/proxy/sse-usage-parser.js +1 -1
  81. package/dist/sdk/agent/agent-config.js +1 -1
  82. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/agent/test/evaluator.js +1 -1
  85. package/dist/sdk/agent/test/executor.js +1 -1
  86. package/dist/sdk/agent/test/index.js +1 -1
  87. package/dist/sdk/agent/test/output.js +1 -1
  88. package/dist/sdk/agent/test/parser.js +1 -1
  89. package/dist/sdk/api.js +1 -1
  90. package/dist/sdk/client/cdp-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/rate-limiter.js +1 -1
  96. package/dist/sdk/client/td-api-client.d.ts +64 -1
  97. package/dist/sdk/client/td-api-client.d.ts.map +1 -1
  98. package/dist/sdk/client/td-api-client.js +1 -1
  99. package/dist/sdk/client/td-api-client.js.map +1 -1
  100. package/dist/sdk/client/trino-api-client.js +1 -1
  101. package/dist/sdk/client/workflow-client.js +1 -1
  102. package/dist/sdk/connection-validator.js +1 -1
  103. package/dist/sdk/connection.js +1 -1
  104. package/dist/sdk/engage.js +1 -1
  105. package/dist/sdk/errors.js +1 -1
  106. package/dist/sdk/index.d.ts +6 -0
  107. package/dist/sdk/index.d.ts.map +1 -1
  108. package/dist/sdk/index.js +1 -1
  109. package/dist/sdk/index.js.map +1 -1
  110. package/dist/sdk/io/index.js +1 -1
  111. package/dist/sdk/io/node-filesystem.js +1 -1
  112. package/dist/sdk/job.js +1 -1
  113. package/dist/sdk/journey.js +1 -1
  114. package/dist/sdk/llm/chat-cache.js +1 -1
  115. package/dist/sdk/llm/index.js +1 -1
  116. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  117. package/dist/sdk/llm/model-aliases.js +1 -1
  118. package/dist/sdk/llm/model-factors.js +1 -1
  119. package/dist/sdk/query/index.js +1 -1
  120. package/dist/sdk/query/sql-parser.js +1 -1
  121. package/dist/sdk/schedule.d.ts +99 -0
  122. package/dist/sdk/schedule.d.ts.map +1 -0
  123. package/dist/sdk/schedule.js +1 -0
  124. package/dist/sdk/schedule.js.map +1 -0
  125. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  126. package/dist/sdk/segment/fields-display.js +1 -1
  127. package/dist/sdk/segment/file-discovery.js +1 -1
  128. package/dist/sdk/segment/journey-utils.js +1 -1
  129. package/dist/sdk/segment/journey-yaml.js +1 -1
  130. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  131. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/pull-workflow.js +1 -1
  133. package/dist/sdk/segment/push-workflow.js +1 -1
  134. package/dist/sdk/segment/resolution-context.js +1 -1
  135. package/dist/sdk/segment/segment-path-parser.js +1 -1
  136. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  137. package/dist/sdk/segment/target-resolution.js +1 -1
  138. package/dist/sdk/segment/tdx-config.js +1 -1
  139. package/dist/sdk/segment/validate-files.js +1 -1
  140. package/dist/sdk/segment/yaml-validator.js +1 -1
  141. package/dist/sdk/segment.js +1 -1
  142. package/dist/sdk/types/index.d.ts +1 -0
  143. package/dist/sdk/types/index.d.ts.map +1 -1
  144. package/dist/sdk/types/index.js +1 -1
  145. package/dist/sdk/types/progress.js +1 -1
  146. package/dist/sdk/types/schedule.d.ts +196 -0
  147. package/dist/sdk/types/schedule.d.ts.map +1 -0
  148. package/dist/sdk/types/schedule.js +1 -0
  149. package/dist/sdk/types/schedule.js.map +1 -0
  150. package/dist/sdk/user.js +1 -1
  151. package/dist/sdk/util/format-detector.js +1 -1
  152. package/dist/sdk/util/formatters.js +1 -1
  153. package/dist/sdk/util/index.js +1 -1
  154. package/dist/sdk/util/tree-formatter.js +1 -1
  155. package/dist/sdk/workflow/clone-workflow.js +1 -1
  156. package/dist/sdk/workflow/index.js +1 -1
  157. package/dist/sdk/workflow/pull-workflow.js +1 -1
  158. package/dist/sdk/workflow/push-workflow.js +1 -1
  159. package/dist/sdk/workflow/tdx-config.js +1 -1
  160. package/dist/sdk/workflow/workflow-utils.js +1 -1
  161. package/dist/test-utils/command-runner.js +1 -1
  162. package/dist/test-utils/factories.js +1 -1
  163. package/dist/test-utils/fixtures.js +1 -1
  164. package/dist/test-utils/http-mock.js +1 -1
  165. package/dist/test-utils/index.js +1 -1
  166. package/dist/utils/async.js +1 -1
  167. package/dist/utils/colors.js +1 -1
  168. package/dist/utils/diff.js +1 -1
  169. package/dist/utils/file-permissions.js +1 -1
  170. package/dist/utils/global-cache.js +1 -1
  171. package/dist/utils/json-loader.js +1 -1
  172. package/dist/utils/local-cache.js +1 -1
  173. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  174. package/dist/utils/logger/formatters/index.js +1 -1
  175. package/dist/utils/logger/handlers/console-handler.js +1 -1
  176. package/dist/utils/logger/handlers/file-handler.js +1 -1
  177. package/dist/utils/logger/handlers/index.js +1 -1
  178. package/dist/utils/logger/handlers/null-handler.js +1 -1
  179. package/dist/utils/logger/index.js +1 -1
  180. package/dist/utils/logger/logger.js +1 -1
  181. package/dist/utils/logger/types.js +1 -1
  182. package/dist/utils/option-validation.js +1 -1
  183. package/dist/utils/port.js +1 -1
  184. package/dist/utils/process.js +1 -1
  185. package/dist/utils/prompt.js +1 -1
  186. package/dist/utils/spinner.js +1 -1
  187. package/dist/utils/sse-parser.js +1 -1
  188. package/dist/utils/string-utils.js +1 -1
  189. package/dist/utils/table-ref-parser.js +1 -1
  190. package/dist/utils/tdx-logger.js +1 -1
  191. package/dist/utils/version-check.js +1 -1
  192. package/package.json +2 -2
@@ -1 +1 @@
1
- const a21_0x168bfe=a21_0x211c;function a21_0x211c(_0x374602,_0x49f1ce){_0x374602=_0x374602-0x107;const _0x3fc93a=a21_0x3fc9();let _0x211cc7=_0x3fc93a[_0x374602];return _0x211cc7;}(function(_0x100964,_0x118bd1){const _0x3a1bab=a21_0x211c,_0x4dd436=_0x100964();while(!![]){try{const _0x515aaf=parseInt(_0x3a1bab(0x141))/0x1+parseInt(_0x3a1bab(0x122))/0x2+parseInt(_0x3a1bab(0x13d))/0x3*(parseInt(_0x3a1bab(0x10b))/0x4)+-parseInt(_0x3a1bab(0x140))/0x5*(-parseInt(_0x3a1bab(0x113))/0x6)+-parseInt(_0x3a1bab(0x111))/0x7*(-parseInt(_0x3a1bab(0x117))/0x8)+parseInt(_0x3a1bab(0x12e))/0x9+-parseInt(_0x3a1bab(0x13e))/0xa;if(_0x515aaf===_0x118bd1)break;else _0x4dd436['push'](_0x4dd436['shift']());}catch(_0x46161d){_0x4dd436['push'](_0x4dd436['shift']());}}}(a21_0x3fc9,0xc62ca));import a21_0x3fd31c from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a21_0x3fc9(){const _0x18255d=['2330362QirsEV','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','llm','start','logger','find','getOrCreateDefaultProject','Port\x20','green','log','stop','✓\x20Proxy\x20server\x20stopped','10442376ykfSLj','SIGTERM','bold','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','server','close','white','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x20\x20Agents:','\x20\x20Address:','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x20is\x20unavailable,\x20using\x20port\x20','exit','Server\x20Configuration:','execute','68361FHWAUX','45996600RviuBs','\x20\x20Site:','4015930ywdzjU','849921DalCEf','cyan','attributes','projects','site','\x0aClaude\x20Code\x20Configuration:','SIGINT','128pxNxjR','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20}','\x0a\x0aShutting\x20down\x20proxy\x20server...','dim','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','14XJewgy','Resolving\x20project...','6mulurB','init','NOT_FOUND','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','2814584yKgOrj','\x20\x20Project:','name','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20\x20\x20}','yellow','http://0.0.0.0:','logLevel','Starting\x20proxy\x20server...','\x27\x20not\x20found','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'];a21_0x3fc9=function(){return _0x18255d;};return a21_0x3fc9();}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0xb8cae3,_0x179f4c){const _0x387182=a21_0x211c,{tdx:_0x485bc3,options:_0x43549a}=_0xb8cae3,_0x62b948=_0x179f4c||_0x43549a['llmProject'];if(_0x62b948){const _0x117d1e=await _0x485bc3[_0x387182(0x124)]['projects'](),_0x346327=_0x117d1e[_0x387182(0x127)](_0x577a40=>_0x577a40[_0x387182(0x143)][_0x387182(0x119)]===_0x62b948);if(!_0x346327)throw new SDKError(ErrorCode[_0x387182(0x115)],'Project\x20\x27'+_0x62b948+_0x387182(0x120),undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0x346327['id'];}const _0xf15099=await _0x485bc3[_0x387182(0x124)][_0x387182(0x128)]();return _0xf15099['id'];}export class LLMProxyCommand extends BaseCommand{[a21_0x168bfe(0x119)]='llm:proxy';['description']='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a21_0x168bfe(0x132)];[a21_0x168bfe(0x126)];async[a21_0x168bfe(0x13c)](_0x27c6fb){const _0x50fb30=a21_0x168bfe,{tdx:_0x40e6b0,options:_0xea9ab2}=_0x27c6fb;try{const _0x39c1e4=_0xea9ab2,_0x168c7a=_0x39c1e4['port']||0xfa0,_0x5a99e5=_0x39c1e4['project'],_0x8dffd4=await findAvailablePort(_0x168c7a);console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x112)));const _0x3bba35=await getProjectIdOrDefault(_0x27c6fb,_0x5a99e5),_0x1c8ef8=await _0x40e6b0['llm'][_0x50fb30(0x107)](),_0x5f16f2=_0x1c8ef8[_0x50fb30(0x127)](_0x3d2dcc=>_0x3d2dcc['id']===_0x3bba35);this[_0x50fb30(0x126)]=new TDXLogger(_0xea9ab2[_0x50fb30(0x11e)]),await this[_0x50fb30(0x126)][_0x50fb30(0x114)](),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x11f)));_0x8dffd4!==_0x168c7a&&console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x11c)](_0x50fb30(0x129)+_0x168c7a+_0x50fb30(0x139)+_0x8dffd4));this[_0x50fb30(0x132)]=new ProxyServer({'port':_0x8dffd4,'projectId':_0x3bba35,'tdx':_0x40e6b0,'logger':this[_0x50fb30(0x126)],'site':_0xea9ab2[_0x50fb30(0x108)]}),await this[_0x50fb30(0x132)][_0x50fb30(0x125)](),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x11c)]['bold'](_0x50fb30(0x123))),console['log'](a21_0x3fd31c['yellow']('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console[_0x50fb30(0x12b)](a21_0x3fd31c['yellow'](_0x50fb30(0x135))),console['log'](a21_0x3fd31c[_0x50fb30(0x12a)][_0x50fb30(0x130)]('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x142)](_0x50fb30(0x13b))),console[_0x50fb30(0x12b)](a21_0x3fd31c['dim'](_0x50fb30(0x137)),a21_0x3fd31c[_0x50fb30(0x134)](_0x50fb30(0x11d)+_0x8dffd4)),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x118)),a21_0x3fd31c['white'](_0x5f16f2?.[_0x50fb30(0x143)][_0x50fb30(0x119)]||_0x3bba35)),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x136)),a21_0x3fd31c[_0x50fb30(0x134)]('created\x20on-demand\x20per\x20model')),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x13f)),a21_0x3fd31c[_0x50fb30(0x134)](_0xea9ab2[_0x50fb30(0x108)])),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x142)](_0x50fb30(0x109))),console['log'](a21_0x3fd31c[_0x50fb30(0x10f)]('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console['log'](a21_0x3fd31c[_0x50fb30(0x134)]('\x20\x20{')),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x134)](_0x50fb30(0x10c))),console[_0x50fb30(0x12b)](a21_0x3fd31c['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x8dffd4+'\x22,')),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x134)](_0x50fb30(0x116))),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x134)](_0x50fb30(0x138))),console['log'](a21_0x3fd31c['white'](_0x50fb30(0x11b))),console[_0x50fb30(0x12b)](a21_0x3fd31c['white'](_0x50fb30(0x10d))),console['log'](a21_0x3fd31c['cyan']('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x50fb30(0x12b)](a21_0x3fd31c['dim'](_0x50fb30(0x131))),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x11a))),console['log'](a21_0x3fd31c[_0x50fb30(0x10f)](_0x50fb30(0x110))),console[_0x50fb30(0x12b)](a21_0x3fd31c[_0x50fb30(0x11c)](_0x50fb30(0x121)));const _0x40d648=async()=>{const _0xe26489=_0x50fb30;console['log'](a21_0x3fd31c[_0xe26489(0x10f)](_0xe26489(0x10e))),this[_0xe26489(0x132)]&&await this[_0xe26489(0x132)][_0xe26489(0x12c)](),this['logger']&&await this[_0xe26489(0x126)]['close'](),console[_0xe26489(0x12b)](a21_0x3fd31c[_0xe26489(0x12a)](_0xe26489(0x12d))),process[_0xe26489(0x13a)](0x0);};return process['on'](_0x50fb30(0x10a),_0x40d648),process['on'](_0x50fb30(0x12f),_0x40d648),await new Promise(()=>{}),0x0;}catch(_0x39b22e){this[_0x50fb30(0x132)]&&await this[_0x50fb30(0x132)][_0x50fb30(0x12c)]();this[_0x50fb30(0x126)]&&await this['logger'][_0x50fb30(0x133)]();throw _0x39b22e;}}}
1
+ const a21_0x4ce215=a21_0x379f;(function(_0x1ccc9e,_0x25f08a){const _0x1199ad=a21_0x379f,_0x24b833=_0x1ccc9e();while(!![]){try{const _0x3b6358=parseInt(_0x1199ad(0x199))/0x1+parseInt(_0x1199ad(0x17d))/0x2+-parseInt(_0x1199ad(0x1a7))/0x3*(parseInt(_0x1199ad(0x176))/0x4)+parseInt(_0x1199ad(0x17f))/0x5+-parseInt(_0x1199ad(0x1a1))/0x6*(parseInt(_0x1199ad(0x1a4))/0x7)+parseInt(_0x1199ad(0x177))/0x8+-parseInt(_0x1199ad(0x1b3))/0x9;if(_0x3b6358===_0x25f08a)break;else _0x24b833['push'](_0x24b833['shift']());}catch(_0x5654c1){_0x24b833['push'](_0x24b833['shift']());}}}(a21_0x18a0,0xa0b5e));import a21_0x4fbf8f 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';function a21_0x18a0(){const _0x39f070=['find','Project\x20\x27','exit','green','Resolving\x20project...','Port\x20','\x0a\x0aShutting\x20down\x20proxy\x20server...','1281852KMQqXy','cyan','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x0aTesting\x20with\x20Agent\x20SDK:','port','SIGTERM','llm','\x20\x20\x20\x20}','1168242oMSjOL','start','\x27\x20not\x20found','42kELzbO','white','logger','3iRHFNF','server','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','attributes','llm:proxy','\x20\x20Address:','projects','init','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','bold','1054395OVyesw','5143196rQnFNI','3493136naUsdv','log','\x20\x20Site:','yellow','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','1422602asvFJl','\x20\x20}','3998355wdNVLT','\x0aClaude\x20Code\x20Configuration:','http://0.0.0.0:','SIGINT','logLevel','name','NOT_FOUND','Server\x20Configuration:','Starting\x20proxy\x20server...','\x20\x20Agents:','close','\x20is\x20unavailable,\x20using\x20port\x20','stop','site','description','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x20\x20Project:','✓\x20Proxy\x20server\x20stopped','dim'];a21_0x18a0=function(){return _0x39f070;};return a21_0x18a0();}function a21_0x379f(_0x372dbe,_0x57536c){_0x372dbe=_0x372dbe-0x176;const _0x18a04b=a21_0x18a0();let _0x379fd5=_0x18a04b[_0x372dbe];return _0x379fd5;}import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x32d59d,_0x57a576){const _0x2f0f6=a21_0x379f,{tdx:_0x391aaf,options:_0x508a21}=_0x32d59d,_0x4c18dd=_0x57a576||_0x508a21['llmProject'];if(_0x4c18dd){const _0x2e1c50=await _0x391aaf['llm'][_0x2f0f6(0x1af)](),_0x1348fc=_0x2e1c50[_0x2f0f6(0x192)](_0x1d3dbf=>_0x1d3dbf['attributes'][_0x2f0f6(0x184)]===_0x4c18dd);if(!_0x1348fc)throw new SDKError(ErrorCode[_0x2f0f6(0x185)],_0x2f0f6(0x193)+_0x4c18dd+_0x2f0f6(0x1a3),undefined,{'helpText':_0x2f0f6(0x17b)});return _0x1348fc['id'];}const _0x55cca5=await _0x391aaf[_0x2f0f6(0x19f)]['getOrCreateDefaultProject']();return _0x55cca5['id'];}export class LLMProxyCommand extends BaseCommand{[a21_0x4ce215(0x184)]=a21_0x4ce215(0x1ad);[a21_0x4ce215(0x18d)]=a21_0x4ce215(0x17c);[a21_0x4ce215(0x1a8)];['logger'];async['execute'](_0x506739){const _0x441e67=a21_0x4ce215,{tdx:_0x4bd66c,options:_0x22be10}=_0x506739;try{const _0x3842ea=_0x22be10,_0x229571=_0x3842ea[_0x441e67(0x19d)]||0xfa0,_0x3df6e2=_0x3842ea['project'],_0x348aa2=await findAvailablePort(_0x229571);console['log'](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x196)));const _0x48b6a8=await getProjectIdOrDefault(_0x506739,_0x3df6e2),_0x1c76df=await _0x4bd66c['llm']['projects'](),_0x4ea41a=_0x1c76df[_0x441e67(0x192)](_0x4408c2=>_0x4408c2['id']===_0x48b6a8);this[_0x441e67(0x1a6)]=new TDXLogger(_0x22be10[_0x441e67(0x183)]),await this[_0x441e67(0x1a6)][_0x441e67(0x1b0)](),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x187)));_0x348aa2!==_0x229571&&console['log'](a21_0x4fbf8f['yellow'](_0x441e67(0x197)+_0x229571+_0x441e67(0x18a)+_0x348aa2));this[_0x441e67(0x1a8)]=new ProxyServer({'port':_0x348aa2,'projectId':_0x48b6a8,'tdx':_0x4bd66c,'logger':this[_0x441e67(0x1a6)],'site':_0x22be10[_0x441e67(0x18c)]}),await this[_0x441e67(0x1a8)][_0x441e67(0x1a2)](),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x17a)]['bold']('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x17a)](_0x441e67(0x1ab))),console[_0x441e67(0x178)](a21_0x4fbf8f['yellow']('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console['log'](a21_0x4fbf8f[_0x441e67(0x195)][_0x441e67(0x1b2)](_0x441e67(0x1a9))),console['log'](a21_0x4fbf8f[_0x441e67(0x19a)](_0x441e67(0x186))),console['log'](a21_0x4fbf8f['dim'](_0x441e67(0x1ae)),a21_0x4fbf8f[_0x441e67(0x1a5)](_0x441e67(0x181)+_0x348aa2)),console['log'](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x18f)),a21_0x4fbf8f[_0x441e67(0x1a5)](_0x4ea41a?.[_0x441e67(0x1ac)][_0x441e67(0x184)]||_0x48b6a8)),console['log'](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x188)),a21_0x4fbf8f[_0x441e67(0x1a5)]('created\x20on-demand\x20per\x20model')),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x179)),a21_0x4fbf8f[_0x441e67(0x1a5)](_0x22be10[_0x441e67(0x18c)])),console[_0x441e67(0x178)](a21_0x4fbf8f['cyan'](_0x441e67(0x180))),console['log'](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x1b1))),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x1a5)]('\x20\x20{')),console[_0x441e67(0x178)](a21_0x4fbf8f['white']('\x20\x20\x20\x20\x22env\x22:\x20{')),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x1a5)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x348aa2+'\x22,')),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x1a5)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console[_0x441e67(0x178)](a21_0x4fbf8f['white'](_0x441e67(0x18e))),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x1a5)](_0x441e67(0x1a0))),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x1a5)](_0x441e67(0x17e))),console['log'](a21_0x4fbf8f[_0x441e67(0x19a)](_0x441e67(0x19c))),console[_0x441e67(0x178)](a21_0x4fbf8f['dim'](_0x441e67(0x1aa))),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x191)](_0x441e67(0x19b))),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x191)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x441e67(0x178)](a21_0x4fbf8f[_0x441e67(0x17a)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x4e0e54=async()=>{const _0x5bb028=_0x441e67;console[_0x5bb028(0x178)](a21_0x4fbf8f['dim'](_0x5bb028(0x198))),this[_0x5bb028(0x1a8)]&&await this[_0x5bb028(0x1a8)][_0x5bb028(0x18b)](),this[_0x5bb028(0x1a6)]&&await this['logger'][_0x5bb028(0x189)](),console[_0x5bb028(0x178)](a21_0x4fbf8f[_0x5bb028(0x195)](_0x5bb028(0x190))),process[_0x5bb028(0x194)](0x0);};return process['on'](_0x441e67(0x182),_0x4e0e54),process['on'](_0x441e67(0x19e),_0x4e0e54),await new Promise(()=>{}),0x0;}catch(_0xa7aab4){this[_0x441e67(0x1a8)]&&await this[_0x441e67(0x1a8)]['stop']();this[_0x441e67(0x1a6)]&&await this[_0x441e67(0x1a6)]['close']();throw _0xa7aab4;}}}
@@ -1 +1 @@
1
- function a22_0x2411(_0xc2ad0c,_0x373e7d){_0xc2ad0c=_0xc2ad0c-0x1ec;const _0x3a5fe1=a22_0x3a5f();let _0x24118b=_0x3a5fe1[_0xc2ad0c];return _0x24118b;}const a22_0xa71817=a22_0x2411;(function(_0x702ce0,_0x5a7d9d){const _0x2cfb31=a22_0x2411,_0x80eb5a=_0x702ce0();while(!![]){try{const _0x27f2ef=parseInt(_0x2cfb31(0x1fb))/0x1*(parseInt(_0x2cfb31(0x1f4))/0x2)+parseInt(_0x2cfb31(0x200))/0x3*(-parseInt(_0x2cfb31(0x1fe))/0x4)+-parseInt(_0x2cfb31(0x202))/0x5+-parseInt(_0x2cfb31(0x1fc))/0x6*(parseInt(_0x2cfb31(0x1ef))/0x7)+parseInt(_0x2cfb31(0x1f8))/0x8+parseInt(_0x2cfb31(0x1ed))/0x9+-parseInt(_0x2cfb31(0x1ee))/0xa*(-parseInt(_0x2cfb31(0x1ec))/0xb);if(_0x27f2ef===_0x5a7d9d)break;else _0x80eb5a['push'](_0x80eb5a['shift']());}catch(_0x2df1ed){_0x80eb5a['push'](_0x80eb5a['shift']());}}}(a22_0x3a5f,0xd0fd9));function a22_0x3a5f(){const _0x27221d=['name','profile','6930560ddtjjn','description','MCP\x20server\x20error:\x20','103533OwfRrx','7429962qPMLdC','apiKey','500bIoqzx','context','12201WyEuOB','TDX_API_KEY','3200240YvrRPe','mcp','231CyXCpW','8859933ZljDhu','120550TweXWi','7WMoUWb','env','../mcp/server.js','message','TDX_SITE','22yLdLGR','TDX_PROFILE'];a22_0x3a5f=function(){return _0x27221d;};return a22_0x3a5f();}import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{[a22_0xa71817(0x1f6)]=a22_0xa71817(0x203);[a22_0xa71817(0x1f9)]='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async['execute'](_0x36e008){const _0x2e90ae=a22_0xa71817,{tdx:_0x149910}=_0x36e008,_0x4fb50d={};if(process[_0x2e90ae(0x1f0)][_0x2e90ae(0x1f5)])_0x4fb50d['TDX_PROFILE']=process[_0x2e90ae(0x1f0)]['TDX_PROFILE'];else{if(process[_0x2e90ae(0x1f0)]['TDX_API_KEY'])_0x4fb50d[_0x2e90ae(0x201)]=process['env'][_0x2e90ae(0x201)],process[_0x2e90ae(0x1f0)][_0x2e90ae(0x1f3)]&&(_0x4fb50d[_0x2e90ae(0x1f3)]=process[_0x2e90ae(0x1f0)][_0x2e90ae(0x1f3)]);else _0x149910[_0x2e90ae(0x1ff)][_0x2e90ae(0x1fd)]&&(_0x4fb50d[_0x2e90ae(0x201)]=_0x149910[_0x2e90ae(0x1ff)][_0x2e90ae(0x1fd)],_0x4fb50d[_0x2e90ae(0x1f3)]=_0x149910[_0x2e90ae(0x1ff)]['site']);}_0x149910[_0x2e90ae(0x1ff)][_0x2e90ae(0x1f7)]&&(_0x4fb50d[_0x2e90ae(0x1f5)]=_0x149910[_0x2e90ae(0x1ff)]['profile']);try{const {startMCPServer:_0x221d13}=await import(_0x2e90ae(0x1f1));return await _0x221d13({'env':_0x4fb50d}),0x0;}catch(_0x165f8c){const _0x66a79b=_0x165f8c instanceof Error?_0x165f8c[_0x2e90ae(0x1f2)]:String(_0x165f8c);return console['error'](_0x2e90ae(0x1fa)+_0x66a79b),0x1;}}}
1
+ const a22_0xe3cdc=a22_0x359f;function a22_0x359f(_0x43aec4,_0xa2a05c){_0x43aec4=_0x43aec4-0x129;const _0xd503ec=a22_0xd503();let _0x359f11=_0xd503ec[_0x43aec4];return _0x359f11;}(function(_0x3244a7,_0x1292c8){const _0x50630e=a22_0x359f,_0x20db90=_0x3244a7();while(!![]){try{const _0x13a49d=parseInt(_0x50630e(0x142))/0x1+parseInt(_0x50630e(0x13c))/0x2*(parseInt(_0x50630e(0x12c))/0x3)+parseInt(_0x50630e(0x13a))/0x4+parseInt(_0x50630e(0x13f))/0x5+-parseInt(_0x50630e(0x141))/0x6*(parseInt(_0x50630e(0x136))/0x7)+-parseInt(_0x50630e(0x12e))/0x8+-parseInt(_0x50630e(0x130))/0x9*(parseInt(_0x50630e(0x12d))/0xa);if(_0x13a49d===_0x1292c8)break;else _0x20db90['push'](_0x20db90['shift']());}catch(_0x359116){_0x20db90['push'](_0x20db90['shift']());}}}(a22_0xd503,0xa3175));function a22_0xd503(){const _0x5e431e=['4316ETZOOr','profile','execute','597600QFoael','apiKey','418956PFCowg','785604LapyJH','MCP\x20server\x20error:\x20','../mcp/server.js','error','mcp','1731wqsGqN','580eMRurb','3566616IMSdvt','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','193203npBJtv','site','context','message','env','description','77TcsTYB','TDX_PROFILE','name','TDX_API_KEY','3906920veFAOX','TDX_SITE'];a22_0xd503=function(){return _0x5e431e;};return a22_0xd503();}import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{[a22_0xe3cdc(0x138)]=a22_0xe3cdc(0x12b);[a22_0xe3cdc(0x135)]=a22_0xe3cdc(0x12f);async[a22_0xe3cdc(0x13e)](_0x410fa0){const _0x1308b1=a22_0xe3cdc,{tdx:_0x492b04}=_0x410fa0,_0xeeda77={};if(process[_0x1308b1(0x134)][_0x1308b1(0x137)])_0xeeda77[_0x1308b1(0x137)]=process[_0x1308b1(0x134)][_0x1308b1(0x137)];else{if(process['env'][_0x1308b1(0x139)])_0xeeda77[_0x1308b1(0x139)]=process[_0x1308b1(0x134)]['TDX_API_KEY'],process[_0x1308b1(0x134)][_0x1308b1(0x13b)]&&(_0xeeda77['TDX_SITE']=process[_0x1308b1(0x134)]['TDX_SITE']);else _0x492b04['context'][_0x1308b1(0x140)]&&(_0xeeda77[_0x1308b1(0x139)]=_0x492b04[_0x1308b1(0x132)]['apiKey'],_0xeeda77['TDX_SITE']=_0x492b04[_0x1308b1(0x132)][_0x1308b1(0x131)]);}_0x492b04[_0x1308b1(0x132)][_0x1308b1(0x13d)]&&(_0xeeda77['TDX_PROFILE']=_0x492b04['context'][_0x1308b1(0x13d)]);try{const {startMCPServer:_0x3982ce}=await import(_0x1308b1(0x129));return await _0x3982ce({'env':_0xeeda77}),0x0;}catch(_0xe19548){const _0x5275fe=_0xe19548 instanceof Error?_0xe19548[_0x1308b1(0x133)]:String(_0xe19548);return console[_0x1308b1(0x12a)](_0x1308b1(0x143)+_0x5275fe),0x1;}}}
@@ -1 +1 @@
1
- const a23_0x5aec6d=a23_0x7bd6;(function(_0x282629,_0xe8320){const _0x3b69b5=a23_0x7bd6,_0xaebc50=_0x282629();while(!![]){try{const _0x11064a=-parseInt(_0x3b69b5(0xac))/0x1*(parseInt(_0x3b69b5(0x139))/0x2)+parseInt(_0x3b69b5(0x18b))/0x3*(-parseInt(_0x3b69b5(0xab))/0x4)+parseInt(_0x3b69b5(0xb4))/0x5*(-parseInt(_0x3b69b5(0x9e))/0x6)+-parseInt(_0x3b69b5(0x18f))/0x7*(parseInt(_0x3b69b5(0xc5))/0x8)+-parseInt(_0x3b69b5(0x7a))/0x9*(parseInt(_0x3b69b5(0xd7))/0xa)+-parseInt(_0x3b69b5(0x14c))/0xb*(-parseInt(_0x3b69b5(0x13c))/0xc)+parseInt(_0x3b69b5(0x14d))/0xd*(parseInt(_0x3b69b5(0xe4))/0xe);if(_0x11064a===_0xe8320)break;else _0xaebc50['push'](_0xaebc50['shift']());}catch(_0x1e9e14){_0xaebc50['push'](_0xaebc50['shift']());}}}(a23_0x3c75,0xa76a1));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x277061 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';function a23_0x7bd6(_0x20232e,_0xc3f683){_0x20232e=_0x20232e-0x71;const _0x3c7542=a23_0x3c75();let _0x7bd6bd=_0x3c7542[_0x20232e];return _0x7bd6bd;}import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x2e85c1 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x5aec6d(0x14e);function openBrowser(_0x4f3b62){const _0x1f45cc=a23_0x5aec6d,_0x540778=process[_0x1f45cc(0x126)],_0x30267c=_0x540778===_0x1f45cc(0x103)?_0x1f45cc(0x142):_0x540778===_0x1f45cc(0x83)?_0x1f45cc(0x96):'xdg-open';spawn(_0x30267c,[_0x4f3b62],{'detached':!![],'stdio':'ignore'})[_0x1f45cc(0x163)]();}function migrateLegacyDirectory(){const _0x460858=a23_0x5aec6d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4482ee=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4482ee[_0x460858(0x11d)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x460858(0xd5)](a23_0x2e85c1[_0x460858(0x97)](_0x460858(0xd0)+LEGACY_PARENT_SEGMENT_DIR+_0x460858(0xa2)+PARENT_SEGMENT_DIR+_0x460858(0x153))),console['error'](a23_0x2e85c1[_0x460858(0x108)](_0x460858(0x127)+LEGACY_PARENT_SEGMENT_DIR+_0x460858(0x11c))),![];console[_0x460858(0xd5)](a23_0x2e85c1[_0x460858(0x97)](_0x460858(0x184)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x460858(0xd5)](a23_0x2e85c1[_0x460858(0x12b)](_0x460858(0x117)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2a84dc){const _0x162410=_0x2a84dc instanceof Error?_0x2a84dc[_0x460858(0x18d)]:String(_0x2a84dc);return console[_0x460858(0xd5)](a23_0x2e85c1[_0x460858(0xda)](_0x460858(0xcd)+_0x162410+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x5aec6d(0x192)](_0x28b759){const _0x4878d2=a23_0x5aec6d;return migrateLegacyDirectory(),super[_0x4878d2(0x192)](_0x28b759);}}function resolveYamlFile(_0x3b027d){const _0x47c0a8=a23_0x5aec6d;if(_0x3b027d['endsWith'](_0x47c0a8(0xe2))||_0x3b027d[_0x47c0a8(0x16f)](_0x47c0a8(0xf3)))return _0x3b027d;return a23_0x277061[_0x47c0a8(0x95)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3b027d)+'.yml');}function formatProgressMessage(_0x1ac986){const _0x5edb1f=a23_0x5aec6d,_0x41733c=_0x1ac986[_0x5edb1f(0x182)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x41733c){const [,_0x3087ff,_0x181527,_0x230467='']=_0x41733c;return a23_0x2e85c1[_0x5edb1f(0x108)](_0x3087ff+':')+'\x20'+_0x181527+a23_0x2e85c1[_0x5edb1f(0x108)](_0x230467);}return a23_0x2e85c1['dim'](_0x1ac986);}function showFileNotFoundError(_0x3f750e,_0x55d0d7){const _0x36050c=a23_0x5aec6d;console[_0x36050c(0xd5)](a23_0x2e85c1['red'](_0x36050c(0x106)+_0x3f750e+'\x0a')),console[_0x36050c(0xd5)](a23_0x2e85c1[_0x36050c(0xd6)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x55d0d7+_0x36050c(0x154)));}function showParentSegmentNotSetError(_0x2fa35c){const _0x4ee5cf=a23_0x5aec6d;console['error'](a23_0x2e85c1[_0x4ee5cf(0x97)](_0x4ee5cf(0xce))),console[_0x4ee5cf(0xd5)](_0x2fa35c);}export class ParentSegmentListCommand extends BaseCommand{['name']='segment:parent:list';['description']='List\x20parent\x20segments';async[a23_0x5aec6d(0x145)](_0x96e0a7){const _0x10f621=a23_0x5aec6d,{options:_0x35824e,args:_0x1fe13b,tdx:_0xc1be7e}=_0x96e0a7,_0x1f177b=_0x1fe13b[0x0];_0x35824e[_0x10f621(0xc1)]&&(console['error']('Site:\x20'+_0x35824e[_0x10f621(0xc7)]),_0x1f177b&&console[_0x10f621(0xd5)](_0x10f621(0x125)+_0x1f177b));const _0x3afe70=await withSpinner(_0x1f177b?_0x10f621(0x136)+_0x1f177b+_0x10f621(0x194):_0x10f621(0x10e),()=>_0xc1be7e[_0x10f621(0x197)]['listParents'](),{'verbose':_0x35824e[_0x10f621(0xc1)]});let _0x1170b5=_0x3afe70['data'];if(_0x1f177b){const _0x5ec973=_0x1f177b[_0x10f621(0xea)](/[.+^${}()|[\]\\]/g,_0x10f621(0x146))[_0x10f621(0xea)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2088c3=new RegExp('^'+_0x5ec973+'$','i');_0x1170b5=_0x1170b5[_0x10f621(0x84)](_0x492634=>_0x2088c3['test'](_0x492634[_0x10f621(0x15b)]['name']));}_0x1170b5['sort']((_0x1eb058,_0x5471c4)=>_0x1eb058[_0x10f621(0x15b)][_0x10f621(0x130)]['localeCompare'](_0x5471c4[_0x10f621(0x15b)][_0x10f621(0x130)])),console['error'](_0x10f621(0xfe)+_0x1170b5[_0x10f621(0x11f)]+_0x10f621(0x151)+(_0x1170b5[_0x10f621(0x11f)]!==0x1?'s':''));const _0x52d24f=_0x1967aa=>{const _0x33ea9c=_0x10f621;return getConsoleNextUrl(_0x35824e[_0x33ea9c(0xc7)],_0x33ea9c(0xe1)+_0x1967aa);};if(_0x35824e[_0x10f621(0xc0)]===_0x10f621(0xcb)||_0x35824e[_0x10f621(0xc0)]==='jsonl'){const _0x34cb03=_0x1170b5[_0x10f621(0x112)](_0x34da09=>({..._0x34da09,'url':_0x52d24f(_0x34da09['id'])}));await handleSDKOutput(_0x34cb03,_0x35824e);}else{if(_0x1170b5[_0x10f621(0x11f)]===0x0)_0x1f177b?console[_0x10f621(0x90)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x1f177b):console['log'](_0x10f621(0x12e));else for(const _0x24abd3 of _0x1170b5){const _0x4eed13=_0x24abd3[_0x10f621(0x15b)][_0x10f621(0xe0)]?a23_0x2e85c1['dim']('\x20('+formatRows(_0x24abd3[_0x10f621(0x15b)][_0x10f621(0xe0)])+')'):'',_0x3ec874=hyperlink(_0x24abd3[_0x10f621(0x15b)][_0x10f621(0x130)],_0x52d24f(_0x24abd3['id']));console[_0x10f621(0x90)](_0x10f621(0x17c)+_0x3ec874+_0x4eed13);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0xd4);[a23_0x5aec6d(0x180)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x1627b0){const _0x2a5cca=a23_0x5aec6d,{options:_0x49054c,args:_0x3cb5b8,tdx:_0x5e7ccc}=_0x1627b0;console[_0x2a5cca(0xd5)](_0x2a5cca(0x158)+_0x2a5cca(0x15d)+_0x2a5cca(0x87));const _0xf4c3d9=_0x49054c;if(_0x3cb5b8[_0x2a5cca(0x11f)]===0x0)return console['error'](a23_0x2e85c1['red'](_0x2a5cca(0x195))),console[_0x2a5cca(0xd5)](_0x2a5cca(0xdd)),0x1;const _0x331ade=_0x3cb5b8[0x0];if(!_0xf4c3d9[_0x2a5cca(0x17e)]||!_0xf4c3d9[_0x2a5cca(0x190)])return console['error'](_0x2a5cca(0x80)),console[_0x2a5cca(0xd5)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0xf4c3d9[_0x2a5cca(0xc1)]&&(console['error']('Site:\x20'+_0xf4c3d9[_0x2a5cca(0xc7)]),console[_0x2a5cca(0xd5)](_0x2a5cca(0x9b)+_0x331ade),console['error'](_0x2a5cca(0x13d)+_0xf4c3d9['database']),console['error']('Table:\x20'+_0xf4c3d9[_0x2a5cca(0x190)]));const _0x5a1bdd=await loadJSONFromOptions(_0xf4c3d9[_0x2a5cca(0x15b)],_0xf4c3d9[_0x2a5cca(0x152)]),_0x5f59d4=await loadJSONFromOptions(_0xf4c3d9[_0x2a5cca(0x149)],_0xf4c3d9[_0x2a5cca(0x116)]),_0x5a1fe4=await loadJSONFromOptions(_0xf4c3d9[_0x2a5cca(0xb7)],_0xf4c3d9[_0x2a5cca(0x141)]),_0x1f26c0={'name':_0x331ade,'description':_0xf4c3d9['description'],'scheduleType':_0xf4c3d9[_0x2a5cca(0xbf)],'scheduleOption':_0xf4c3d9[_0x2a5cca(0xe8)],'timezone':_0xf4c3d9[_0x2a5cca(0x16c)],'master':{'parentDatabaseName':_0xf4c3d9[_0x2a5cca(0x17e)],'parentTableName':_0xf4c3d9['table']},'attributes':_0x5a1bdd,'behaviors':_0x5f59d4,'customerGroup':_0x5a1fe4},_0x381785=await withSpinner(_0x2a5cca(0xb6)+_0x331ade+_0x2a5cca(0x194),()=>_0x5e7ccc['segment'][_0x2a5cca(0x111)](_0x1f26c0),{'verbose':_0x49054c[_0x2a5cca(0xc1)]}),_0x410e1e=_0x381785['data'];return console[_0x2a5cca(0xd5)](_0x2a5cca(0x13b)+_0x410e1e[_0x2a5cca(0x130)]+_0x2a5cca(0xa9)+_0x410e1e['id']),await handleSDKOutput([_0x410e1e],_0x49054c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x5aec6d(0x130)]='segment:parent:update';[a23_0x5aec6d(0x180)]=a23_0x5aec6d(0x11e);async[a23_0x5aec6d(0x145)](_0x176574){const _0x193d43=a23_0x5aec6d,{options:_0x2d3e8b,args:_0x4c6b14,tdx:_0x12feb6}=_0x176574;console['error'](_0x193d43(0xbb)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x193d43(0x87));const _0x632a0b=_0x2d3e8b;if(_0x4c6b14[_0x193d43(0x11f)]===0x0)return console['error'](a23_0x2e85c1['red'](_0x193d43(0x195))),console[_0x193d43(0xd5)](_0x193d43(0x178)),0x1;const _0x5dfc3d=_0x4c6b14[0x0];_0x632a0b[_0x193d43(0xc1)]&&(console['error']('Site:\x20'+_0x632a0b['site']),console[_0x193d43(0xd5)](_0x193d43(0xcf)+_0x5dfc3d));const _0x125cf6=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x5dfc3d+'\x27...',()=>_0x12feb6[_0x193d43(0x197)][_0x193d43(0x17d)](_0x5dfc3d),{'verbose':_0x632a0b[_0x193d43(0xc1)]}),_0x4577e1=_0x125cf6[_0x193d43(0x15f)],_0x4e9723=await loadJSONFromOptions(_0x632a0b[_0x193d43(0x75)],_0x632a0b[_0x193d43(0x140)]),_0x51f263=await loadJSONFromOptions(_0x632a0b['addBehaviors'],_0x632a0b[_0x193d43(0x13a)]),_0x47f1a8={'name':_0x4577e1[_0x193d43(0x130)],'description':_0x632a0b[_0x193d43(0x180)]!==undefined?_0x632a0b[_0x193d43(0x180)]:_0x4577e1[_0x193d43(0x180)],'scheduleType':_0x632a0b['scheduleType']!==undefined?_0x632a0b['scheduleType']:_0x4577e1[_0x193d43(0xbf)],'scheduleOption':_0x632a0b[_0x193d43(0xe8)]!==undefined?_0x632a0b[_0x193d43(0xe8)]:_0x4577e1['scheduleOption'],'timezone':_0x632a0b[_0x193d43(0x16c)]!==undefined?_0x632a0b['timezone']:_0x4577e1[_0x193d43(0x16c)],'master':_0x4577e1['master'],'attributes':_0x4e9723?[..._0x4577e1[_0x193d43(0x15b)]||[],..._0x4e9723]:_0x4577e1[_0x193d43(0x15b)],'behaviors':_0x51f263?[..._0x4577e1[_0x193d43(0x149)]||[],..._0x51f263]:_0x4577e1['behaviors'],'customerGroup':_0x4577e1[_0x193d43(0xb7)]},_0x2e5899=await withSpinner(_0x193d43(0xa6)+_0x5dfc3d+_0x193d43(0x194),()=>_0x12feb6[_0x193d43(0x197)][_0x193d43(0xa4)](_0x5dfc3d,_0x47f1a8),{'verbose':_0x632a0b[_0x193d43(0xc1)]}),_0x4c2dbe=_0x2e5899[_0x193d43(0x15f)];return console['error'](_0x193d43(0xf4)+_0x4c2dbe['name']+'\x27'),await handleSDKOutput([_0x4c2dbe],_0x632a0b),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a23_0x5aec6d(0x99);['description']=a23_0x5aec6d(0x169);async[a23_0x5aec6d(0x145)](_0x4d9cae){const _0x210c03=a23_0x5aec6d,{options:_0x18e1eb,args:_0x5ba920,tdx:_0x4a9d09}=_0x4d9cae,_0x48dc0a=_0x18e1eb,_0x2257a6=_0x5ba920[0x0]||_0x18e1eb[_0x210c03(0x8d)];if(!_0x2257a6)return showParentSegmentNotSetError(_0x210c03(0x171)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x48dc0a[_0x210c03(0x81)]&&_0x48dc0a[_0x210c03(0x78)])return console['error'](a23_0x2e85c1[_0x210c03(0xda)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x210c03(0xd5)](a23_0x2e85c1[_0x210c03(0x108)](_0x210c03(0x9f))),console[_0x210c03(0xd5)](a23_0x2e85c1[_0x210c03(0x108)](_0x210c03(0x134)+PARENT_SEGMENT_DIR+_0x210c03(0x92))),console[_0x210c03(0xd5)](a23_0x2e85c1[_0x210c03(0xd6)](_0x210c03(0x7f))),0x1;const _0x407d2c=_0x48dc0a[_0x210c03(0x78)]||a23_0x277061['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2257a6)+_0x210c03(0xe2));_0x48dc0a[_0x210c03(0xc1)]&&(console['error']('Site:\x20'+_0x48dc0a[_0x210c03(0xc7)]),console[_0x210c03(0xd5)](_0x210c03(0xcf)+_0x2257a6),console['error'](_0x210c03(0x175)+_0x407d2c));const _0x13896c=await withSpinner(_0x210c03(0x132)+_0x2257a6+'\x27...',()=>_0x4a9d09[_0x210c03(0x197)][_0x210c03(0xeb)](_0x2257a6),{'verbose':_0x48dc0a[_0x210c03(0xc1)]}),_0x4bdd48=_0x13896c[_0x210c03(0x15f)];if(existsSync(_0x407d2c)){const _0x48c2d4=readFileSync(_0x407d2c,_0x210c03(0x156)),_0x54a688=generateDiff(_0x48c2d4,_0x4bdd48);if(!hasChanges(_0x54a688))console['error'](a23_0x2e85c1['green']('✔')+_0x210c03(0x188)+a23_0x2e85c1[_0x210c03(0xd6)](_0x407d2c)+_0x210c03(0xb1));else{console[_0x210c03(0xd5)](_0x210c03(0x186)+_0x407d2c+'\x27:'),console[_0x210c03(0xd5)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x54a688)),console[_0x210c03(0xd5)]('─'[_0x210c03(0x198)](0x3c));if(!_0x48dc0a[_0x210c03(0x14f)]){const _0x964a5a=await confirmKey('Overwrite\x20\x27'+_0x407d2c+'\x27?');if(!_0x964a5a)return console[_0x210c03(0xd5)]('Aborted.'),0x1;}writeFileSync(_0x407d2c,_0x4bdd48,_0x210c03(0x156)),console[_0x210c03(0xd5)](a23_0x2e85c1[_0x210c03(0x12b)]('✔')+_0x210c03(0x18c)+a23_0x2e85c1[_0x210c03(0xd6)](_0x407d2c));}}else{const _0x59edde=a23_0x277061[_0x210c03(0x177)](_0x407d2c);!existsSync(_0x59edde)&&mkdirSync(_0x59edde,{'recursive':!![]}),writeFileSync(_0x407d2c,_0x4bdd48,'utf-8'),console[_0x210c03(0xd5)](a23_0x2e85c1[_0x210c03(0x12b)]('✔')+_0x210c03(0x18c)+a23_0x2e85c1[_0x210c03(0xd6)](_0x407d2c));}return saveSessionContext({'parent_segment':_0x2257a6},_0x48dc0a[_0x210c03(0x14b)]),console[_0x210c03(0xd5)](a23_0x2e85c1['green']('✔')+_0x210c03(0x107)+a23_0x2e85c1[_0x210c03(0x108)](_0x210c03(0x14e))+_0x210c03(0x11a)+a23_0x2e85c1['cyan'](_0x2257a6)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0x144);[a23_0x5aec6d(0x180)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a23_0x5aec6d(0x145)](_0x475cdd){const _0x282cec=a23_0x5aec6d,{options:_0x31782e,args:_0x2b9036,tdx:_0x42f636}=_0x475cdd,_0x2c7be7=_0x31782e,_0x565c34=_0x2b9036[0x0]||_0x31782e[_0x282cec(0x8d)];if(!_0x565c34)return showParentSegmentNotSetError(_0x282cec(0xdc)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x37431b=resolveYamlFile(_0x565c34);if(!existsSync(_0x37431b))return showFileNotFoundError(_0x37431b,_0x565c34),0x1;_0x2c7be7[_0x282cec(0xc1)]&&(console[_0x282cec(0xd5)](_0x282cec(0x74)+_0x2c7be7['site']),console['error'](_0x282cec(0xf5)+_0x37431b));let _0x4222c7;try{_0x4222c7=readFileSync(_0x37431b,_0x282cec(0x156));}catch(_0x310018){const _0x400c3d=_0x310018 instanceof Error?_0x310018[_0x282cec(0x18d)]:String(_0x310018);return console[_0x282cec(0xd5)](_0x282cec(0xe7)+_0x400c3d),0x1;}const _0x2f1a1c=await withSpinner(_0x282cec(0x10a),()=>_0x42f636[_0x282cec(0x197)]['pushParentYaml'](_0x4222c7),{'verbose':_0x2c7be7[_0x282cec(0xc1)]}),_0x2cf962=_0x2f1a1c['data'],{isNew:_0x982598,name:_0x25a38d,hasChanges:_0x15fa85,diffFormatted:_0x1342fb}=_0x2cf962;if(!_0x15fa85)return console[_0x282cec(0xd5)]('✔\x20No\x20changes\x20-\x20\x27'+_0x25a38d+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x982598?console[_0x282cec(0xd5)](_0x282cec(0x10d)+_0x25a38d+'\x27:'):console[_0x282cec(0xd5)](_0x282cec(0xd1)+_0x25a38d+'\x27:');console['error']('─'[_0x282cec(0x198)](0x3c)),console[_0x282cec(0xd5)](_0x1342fb),console[_0x282cec(0xd5)]('─'['repeat'](0x3c));const _0x13e534=_0x982598?_0x282cec(0x7b)+_0x25a38d+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x25a38d+'\x27?';if(!_0x2c7be7[_0x282cec(0x14f)]){const _0x10617e=await confirmKey(_0x13e534);if(!_0x10617e)return console[_0x282cec(0xd5)](_0x282cec(0xbd)),0x1;}const _0xe4ba3e=_0x982598?'Creating':'Updating',_0x29f0a4=await withSpinner(_0xe4ba3e+_0x282cec(0xad)+_0x25a38d+'\x27...',()=>_0x2cf962[_0x282cec(0xf9)](),{'verbose':_0x2c7be7['verbose']}),_0xc4b037=_0x29f0a4['data'],_0x5ea951=getConsoleNextUrl(_0x2c7be7[_0x282cec(0xc7)],_0x282cec(0xe1)+_0xc4b037['id']),_0x5ce9f6=_0x982598?'Created':'Updated';return console[_0x282cec(0xd5)]('✔\x20'+_0x5ce9f6+_0x282cec(0xad)+_0xc4b037[_0x282cec(0x130)]+'\x27'),console[_0x282cec(0xd5)]('\x20\x20'+_0x5ea951),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x5aec6d(0x129);[a23_0x5aec6d(0x180)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x8f7225){const _0x39cc29=a23_0x5aec6d,{options:_0x1687dd,args:_0x51c726,tdx:_0x10b081}=_0x8f7225,_0x461ff1=_0x1687dd,_0x48d8f0=_0x51c726[0x0]||_0x1687dd[_0x39cc29(0x8d)];if(!_0x48d8f0)return showParentSegmentNotSetError(_0x39cc29(0x93)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x39cc29(0xb3)+_0x39cc29(0xa1)+_0x39cc29(0x109)+_0x39cc29(0x133)),0x1;const _0x189259=resolveYamlFile(_0x48d8f0);if(!existsSync(_0x189259))return showFileNotFoundError(_0x189259,_0x48d8f0),0x1;_0x461ff1[_0x39cc29(0xc1)]&&(console[_0x39cc29(0xd5)](_0x39cc29(0x74)+_0x461ff1['site']),console[_0x39cc29(0xd5)](_0x39cc29(0xf5)+_0x189259));let _0x2943e7;try{_0x2943e7=readFileSync(_0x189259,_0x39cc29(0x156));}catch(_0x487236){const _0x2ef5b3=_0x487236 instanceof Error?_0x487236[_0x39cc29(0x18d)]:String(_0x487236);return console['error'](_0x39cc29(0xe7)+_0x2ef5b3),0x1;}const _0x1e69ce=createCommandSpinner(a23_0x2e85c1[_0x39cc29(0x108)](_0x39cc29(0xdf)),{'verbose':_0x461ff1[_0x39cc29(0xc1)]});_0x1e69ce['start']();const _0x4df002={'onProgress':_0xfe2c76=>{_0x1e69ce['text']=formatProgressMessage(_0xfe2c76);}};if(_0x461ff1[_0x39cc29(0x16e)])_0x4df002[_0x39cc29(0x16e)]=!![];if(_0x461ff1[_0x39cc29(0xb0)])_0x4df002[_0x39cc29(0xb0)]=!![];_0x461ff1['attribute']&&(_0x4df002[_0x39cc29(0x135)]=_0x461ff1[_0x39cc29(0x135)]);_0x461ff1['behavior']&&(_0x4df002['behavior']=_0x461ff1[_0x39cc29(0x115)]);if(_0x461ff1['interval'])_0x4df002[_0x39cc29(0x110)]=_0x461ff1['interval'];let _0x4fc0e9;try{_0x4fc0e9=await _0x10b081[_0x39cc29(0x197)]['validateParentYaml'](_0x2943e7,_0x4df002),_0x1e69ce['stop']();}catch(_0x49b96e){_0x1e69ce['stop']();throw _0x49b96e;}const _0x1bdcad=_0x461ff1[_0x39cc29(0x110)]||'-1d';return this[_0x39cc29(0x8f)](_0x4fc0e9,_0x4df002,_0x189259,_0x1bdcad),_0x4fc0e9[_0x39cc29(0x72)]?0x0:0x1;}[a23_0x5aec6d(0x8f)](_0x412b9e,_0x5895c9,_0x8684d,_0x4056d3){const _0x448e24=a23_0x5aec6d;console['error']('\x0a'+a23_0x2e85c1[_0x448e24(0xfd)]('Validate:')+'\x20'+_0x412b9e[_0x448e24(0x130)]),console[_0x448e24(0xd5)]('═'[_0x448e24(0x198)](0x3c)),this['displayMasterInfo'](_0x412b9e);if(typeof _0x5895c9[_0x448e24(0x135)]===_0x448e24(0xb8)){this['displayAttributesStats'](_0x412b9e),this[_0x448e24(0x101)](_0x412b9e),this[_0x448e24(0x191)](_0x8684d,_0x4056d3,_0x448e24(0x135),_0x5895c9['attribute']);return;}if(_0x5895c9['attribute']===!![]){this[_0x448e24(0x122)](_0x412b9e),this[_0x448e24(0x101)](_0x412b9e),this[_0x448e24(0x191)](_0x8684d,_0x4056d3,_0x448e24(0x15b));return;}if(typeof _0x5895c9[_0x448e24(0x115)]===_0x448e24(0xb8)){this[_0x448e24(0xcc)](_0x412b9e,_0x4056d3),this[_0x448e24(0x101)](_0x412b9e),this[_0x448e24(0x191)](_0x8684d,_0x4056d3,_0x448e24(0x115),_0x5895c9[_0x448e24(0x115)]);return;}if(_0x5895c9[_0x448e24(0x115)]===!![]){this['displayBehaviorsStats'](_0x412b9e,_0x4056d3),this[_0x448e24(0x101)](_0x412b9e),this[_0x448e24(0x191)](_0x8684d,_0x4056d3,_0x448e24(0x149));return;}this[_0x448e24(0x122)](_0x412b9e),this[_0x448e24(0xcc)](_0x412b9e,_0x4056d3),this['displaySummary'](_0x412b9e),this[_0x448e24(0x191)](_0x8684d,_0x4056d3,'all');}[a23_0x5aec6d(0x191)](_0x38c2e4,_0x195295,_0x56085b,_0xa0bdd){const _0x101f1f=a23_0x5aec6d;console['error']('\x0a'+a23_0x2e85c1[_0x101f1f(0x108)](_0x101f1f(0xee)));const _0x22f197=_0x195295!==_0x101f1f(0x199)?'\x20--interval\x20'+_0x195295:'';if(_0x56085b===_0x101f1f(0x135)&&_0xa0bdd)console[_0x101f1f(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x101f1f(0x108)](_0x101f1f(0x166)+_0x38c2e4+_0x101f1f(0x196)+_0xa0bdd+'\x22'+_0x22f197));else{if(_0x56085b===_0x101f1f(0x115)&&_0xa0bdd)console[_0x101f1f(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x101f1f(0x108)](_0x101f1f(0x166)+_0x38c2e4+_0x101f1f(0x9a)+_0xa0bdd+'\x22'+_0x22f197));else(_0x56085b==='attributes'||_0x56085b===_0x101f1f(0x138))&&console[_0x101f1f(0xd5)]('\x20\x20'+a23_0x2e85c1['dim'](_0x101f1f(0x166)+_0x38c2e4+_0x101f1f(0xe3)+_0x22f197));}(_0x56085b===_0x101f1f(0x149)||_0x56085b===_0x101f1f(0x138))&&console[_0x101f1f(0xd5)]('\x20\x20'+a23_0x2e85c1['dim'](_0x101f1f(0x166)+_0x38c2e4+_0x101f1f(0x17f)+_0x22f197)),_0x56085b==='all'&&console[_0x101f1f(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x101f1f(0x108)](_0x101f1f(0x166)+_0x38c2e4+_0x101f1f(0xbe)+_0x22f197));}[a23_0x5aec6d(0xfb)](_0x5c95ad){const _0x3303f5=a23_0x5aec6d,{master:_0x15d461}=_0x5c95ad,_0x2c0030=_0x15d461[_0x3303f5(0x148)]?a23_0x2e85c1['green']('✔'):a23_0x2e85c1[_0x3303f5(0xda)]('✘');console['error']('\x0a'+a23_0x2e85c1[_0x3303f5(0x108)](_0x3303f5(0x162))),console[_0x3303f5(0xd5)](_0x2c0030+'\x20'+a23_0x2e85c1['bold'](_0x15d461[_0x3303f5(0x17e)]+'.'+_0x15d461[_0x3303f5(0x190)])),_0x15d461[_0x3303f5(0x148)]?_0x15d461[_0x3303f5(0x113)]!==undefined&&console['error']('\x20\x20'+a23_0x2e85c1['dim'](_0x3303f5(0xdb))+'\x20'+a23_0x2e85c1[_0x3303f5(0xd6)](formatRows(_0x15d461[_0x3303f5(0x113)]))):console[_0x3303f5(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x3303f5(0xda)]('Error:')+'\x20'+_0x15d461['schemaError']);}[a23_0x5aec6d(0x122)](_0x234596){const _0x23b3c4=a23_0x5aec6d;if(_0x234596[_0x23b3c4(0x15b)][_0x23b3c4(0x11f)]===0x0)return;console[_0x23b3c4(0xd5)]('\x0a'+a23_0x2e85c1['dim'](_0x23b3c4(0x167)));for(const _0x40f144 of _0x234596['attributes']){const _0x4e73eb=_0x40f144[_0x23b3c4(0x148)]?a23_0x2e85c1[_0x23b3c4(0x12b)]('✔'):a23_0x2e85c1[_0x23b3c4(0xda)]('✘');let _0x351aca='';if(_0x40f144[_0x23b3c4(0x148)]&&_0x40f144['matchedCount']!==undefined&&_0x40f144['coveragePercent']!==undefined){const _0x3209db=_0x40f144[_0x23b3c4(0x79)][_0x23b3c4(0xf6)](0x1),_0x872f6b=_0x40f144['coveragePercent']>=0x50?a23_0x2e85c1['green']:_0x40f144[_0x23b3c4(0x79)]>=0x32?a23_0x2e85c1['yellow']:a23_0x2e85c1[_0x23b3c4(0xda)];_0x351aca='\x20'+a23_0x2e85c1['dim']('Coverage:')+'\x20'+_0x872f6b(_0x3209db+'%')+'\x20('+formatRows(_0x40f144[_0x23b3c4(0x16b)])+'\x20rows)';}console[_0x23b3c4(0xd5)](_0x4e73eb+'\x20'+a23_0x2e85c1[_0x23b3c4(0xfd)](_0x40f144[_0x23b3c4(0x130)])+_0x351aca),console[_0x23b3c4(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x23b3c4(0x108)](_0x23b3c4(0xc3))+'\x20'+a23_0x2e85c1[_0x23b3c4(0xfd)](_0x40f144[_0x23b3c4(0x17e)]+'.'+_0x40f144[_0x23b3c4(0x190)]));const _0x9c0702=_0x40f144[_0x23b3c4(0x173)]===_0x40f144[_0x23b3c4(0x100)]?a23_0x2e85c1[_0x23b3c4(0x108)](_0x23b3c4(0xb5))+'\x20'+_0x40f144['joinKey']:a23_0x2e85c1[_0x23b3c4(0x108)](_0x23b3c4(0x157))+'\x20'+_0x40f144[_0x23b3c4(0x173)]+_0x23b3c4(0x11a)+_0x40f144[_0x23b3c4(0x100)];console[_0x23b3c4(0xd5)]('\x20\x20'+_0x9c0702),console['error']('\x20\x20'+a23_0x2e85c1['dim']('Columns:')),this[_0x23b3c4(0x77)](_0x40f144[_0x23b3c4(0x168)]),!_0x40f144['schemaValid']&&console[_0x23b3c4(0xd5)]('\x20\x20'+a23_0x2e85c1['red'](_0x23b3c4(0xc6))+'\x20'+_0x40f144[_0x23b3c4(0x155)]);}}[a23_0x5aec6d(0xcc)](_0x17b788,_0x297cd8){const _0x2acc64=a23_0x5aec6d;if(_0x17b788[_0x2acc64(0x149)][_0x2acc64(0x11f)]===0x0)return;console['error']('\x0a'+a23_0x2e85c1[_0x2acc64(0x108)](_0x2acc64(0x18e))+'\x20'+a23_0x2e85c1[_0x2acc64(0x108)]('('+_0x297cd8+')'));for(const _0x456432 of _0x17b788[_0x2acc64(0x149)]){const _0x5b5242=_0x456432['schemaValid']?a23_0x2e85c1[_0x2acc64(0x12b)]('✔'):a23_0x2e85c1[_0x2acc64(0xda)]('✘');let _0x485839='';if(_0x456432[_0x2acc64(0x148)]&&_0x456432[_0x2acc64(0x85)]!==undefined&&_0x456432[_0x2acc64(0x104)]!==undefined){const _0x51063c=_0x456432[_0x2acc64(0x89)]?.[_0x2acc64(0xf6)](0x1)||'?',_0x5200dd=(_0x456432[_0x2acc64(0x89)]??0x0)>=0x32?a23_0x2e85c1[_0x2acc64(0x12b)]:(_0x456432[_0x2acc64(0x89)]??0x0)>=0x14?a23_0x2e85c1[_0x2acc64(0x97)]:a23_0x2e85c1[_0x2acc64(0xda)];_0x485839='\x20'+a23_0x2e85c1['dim']('Customers:')+'\x20'+_0x5200dd(formatRows(_0x456432['customersWithEvents']))+'\x20('+_0x51063c+_0x2acc64(0x12a)+a23_0x2e85c1['dim'](_0x2acc64(0xa7))+'\x20'+a23_0x2e85c1[_0x2acc64(0xd6)](formatRows(_0x456432[_0x2acc64(0x104)]));}console[_0x2acc64(0xd5)](_0x5b5242+'\x20'+a23_0x2e85c1[_0x2acc64(0xfd)](_0x456432[_0x2acc64(0x130)])+_0x485839),console[_0x2acc64(0xd5)]('\x20\x20'+a23_0x2e85c1['dim']('Source:')+'\x20'+a23_0x2e85c1['bold'](_0x456432['database']+'.'+_0x456432[_0x2acc64(0x190)]));const _0x2d1489=_0x456432['joinKey']===_0x456432['foreignKey']?a23_0x2e85c1[_0x2acc64(0x108)]('Join\x20on:')+'\x20'+_0x456432['joinKey']:a23_0x2e85c1[_0x2acc64(0x108)](_0x2acc64(0x157))+'\x20'+_0x456432['joinKey']+'\x20=\x20'+_0x456432['foreignKey'];console[_0x2acc64(0xd5)]('\x20\x20'+_0x2d1489),console[_0x2acc64(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x2acc64(0x108)](_0x2acc64(0x9d))),this[_0x2acc64(0x77)](_0x456432['columns']),!_0x456432[_0x2acc64(0x148)]&&console[_0x2acc64(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x2acc64(0xda)](_0x2acc64(0xc6))+'\x20'+_0x456432['schemaError']);}}[a23_0x5aec6d(0x77)](_0x1f15b8){const _0x48b75e=a23_0x5aec6d;for(const _0x47f548 of _0x1f15b8){_0x47f548[_0x48b75e(0x71)]===_0x47f548[_0x48b75e(0x16a)]||_0x47f548[_0x48b75e(0x16a)]==='*'?console[_0x48b75e(0xd5)](_0x48b75e(0x8c)+_0x47f548[_0x48b75e(0x71)]):console[_0x48b75e(0xd5)](_0x48b75e(0x8c)+_0x47f548[_0x48b75e(0x71)]+'\x20'+a23_0x2e85c1[_0x48b75e(0x108)]('('+_0x47f548[_0x48b75e(0x16a)]+')'));}}['displaySummary'](_0x410ad5){const _0x1c573f=a23_0x5aec6d;console[_0x1c573f(0xd5)]('─'[_0x1c573f(0x198)](0x3c));if(_0x410ad5['errors'][_0x1c573f(0x11f)]>0x0){console[_0x1c573f(0xd5)]('\x0a'+a23_0x2e85c1[_0x1c573f(0xda)](_0x1c573f(0x15e)));for(const _0x4eb7d5 of _0x410ad5[_0x1c573f(0x123)]){console['error']('\x20\x20'+a23_0x2e85c1[_0x1c573f(0xda)]('•')+'\x20'+_0x4eb7d5);}}_0x410ad5[_0x1c573f(0x72)]&&console[_0x1c573f(0xd5)]('\x0a'+a23_0x2e85c1['green']('✔')+_0x1c573f(0xff));}}function a23_0x3c75(){const _0x419718=['/app/dw/parentSegments/','.yml','\x20--attribute\x20\x22<name>\x22','36104404AhDxjD','SELECT\x20*\x20FROM\x20(\x0a','runParent','Error\x20reading\x20file:\x20','scheduleOption','jsonl','replace','pullParentYaml','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','To\x20view\x20sample\x20data:','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Attribute:','toLocaleString','Error:\x20--attribute\x20requires\x20a\x20name\x0a','.yaml','✔\x20Updated\x20parent\x20segment\x20\x27','YAML\x20file:\x20','toFixed','varchar','limit','apply','Error:\x20--behavior\x20requires\x20a\x20name\x0a','displayMasterInfo','Resolving\x20parent\x20segment\x20\x27','bold','✔\x20Found\x20','\x20Configuration\x20is\x20valid','foreignKey','displaySummary','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','darwin','totalEvents','getParentSQL','Error:\x20File\x20not\x20found:\x20','\x20Context\x20set:\x20','dim','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Analyzing\x20changes...','Get\x20SQL\x20query\x20for\x20parent\x20segment','Created','\x0aNew\x20parent\x20segment\x20\x27','Listing\x20parent\x20segments...','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','interval','createParent','map','rowCount','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','behavior','behaviorsFile','✔\x20Renamed\x20directory\x20to\x20','/sessions/','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20=\x20','FINISHED','/\x20directory.\x0a','isDirectory','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','length','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','displayAttributesStats','errors','/attempt/','Pattern:\x20','platform','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','text','segment:parent:validate','%)\x20','green','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','number','No\x20parent\x20segments\x20found','query','name','Master:','Fetching\x20parent\x20segment\x20\x27','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','using\x20the\x20default\x20path:\x20','attribute','Listing\x20parent\x20segments\x20matching\x20\x27','To\x20cancel:','all','2QmVZvq','addBehaviorsFile','✔\x20Created\x20parent\x20segment\x20\x27','12ZxPxMl','Database:\x20','segment:parent:fields','\x20tdx\x20wf\x20attempt\x20','addAttributesFile','customerGroupFile','open','pushParentYaml','segment:parent:push','execute','\x5c$&','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','schemaValid','behaviors','keys','session','9129659QnFGeh','13uPtSvN','parent_segment','yes','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20parent\x20segment','attributesFile','/\x20directories\x20exist.','`\x20to\x20download\x20the\x20configuration\x20first','schemaError','utf-8','Join:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Session:','workflowSessionId','attributes','status','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Errors:','data','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:run','Master\x20Table','unref','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','tdx\x20segment\x20parent\x20preview\x20','Attributes','columns','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','column','matchedCount','timezone','\x0aNo\x20sample\x20data\x20available','master','endsWith','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','joinKey','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Output\x20file:\x20','\x20\x20No\x20sample\x20data\x20available','dirname','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','displayPreviewResults','elapsedTimeMillis','resolveParentId','👥\x20','getParentFull','database','\x20--behavior\x20\x22<name>\x22','description','\x0aUsage:\x20tdx\x20ps\x20preview\x20','match','segment:parent:view','\x0a⚠️\x20\x20Migrating:\x20','workflowAttemptId','\x0aChanges\x20to\x20\x27','Available\x20attributes:','\x20No\x20changes\x20-\x20','stats','stop','364629DqwqjZ','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','message','Behaviors','1600067AutTik','table','displayPreviewHints','run','Executing\x20parent\x20segment\x20query...','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20--attribute\x20\x22','segment','repeat','-1d','/app/workflows/','Attempt:','information_schema','label','allValid','SQL\x20query:\x0a','Site:\x20','addAttributes','jobId','displayColumns','output','coveragePercent','10764zxQgwo','Create\x20parent\x20segment\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','Master\x20+\x20Attributes','segment:parent:preview','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Error:\x20--database\x20and\x20--table\x20are\x20required','use','Audience\x20ID:','win32','filter','customersWithEvents','\x20rows\x20','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Options\x20(one\x20required):\x0a','customerPercent','double','previewParentYaml','\x20\x20\x20\x20-\x20','parentSegment','Found\x20YAML\x20file:\x20','displayValidateResults','log','\x27\x20and\x20run\x20workflow?','/{name}.yml\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','segment:parent:sql','join','start','yellow','test','segment:parent:pull','\x20--behavior\x20\x22','Name:\x20','\x20field','Columns:','258OqEQSi','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','displaySampleData','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','/\x20and\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','updateParent','Listing\x20fields\x20for\x20\x27','Updating\x20parent\x20segment\x20\x27','Events:','Available\x20behaviors:','\x27\x20with\x20ID:\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','8SURDnA','1279730ImrxUw','\x20parent\x20segment\x20\x27','web','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','enriched','\x20is\x20already\x20up\x20to\x20date','workflowId','Options:\x0a','37165wkcHqa','Join\x20on:','Creating\x20parent\x20segment\x20\x27','customerGroup','string','Status:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','audienceId','Aborted.','\x20--enriched','scheduleType','format','verbose','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Source:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','24LosRLN','Error:','site','listFields','setJobId','Updated','json','displayBehaviorsStats','✘\x20Failed\x20to\x20rename\x20directory:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Parent\x20segment:\x20','\x0a⚠️\x20\x20Both\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','sampleData','Options:','segment:parent:create','error','cyan','1630Npltjc','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Fetching\x20SQL\x20for\x20\x27','red','Rows:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Validating\x20configuration...','population'];a23_0x3c75=function(){return _0x419718;};return a23_0x3c75();}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0x7e);[a23_0x5aec6d(0x180)]=a23_0x5aec6d(0xba);async[a23_0x5aec6d(0x145)](_0x46f7e8){const _0x1e77e9=a23_0x5aec6d,{options:_0x1195aa,args:_0x2145ea,tdx:_0x3c53dc}=_0x46f7e8,_0x1b078f=_0x1195aa,_0x142722=_0x2145ea[0x0]||_0x1195aa[_0x1e77e9(0x8d)];if(!_0x142722)return showParentSegmentNotSetError(_0x1e77e9(0x121)+_0x1e77e9(0xd8)+_0x1e77e9(0x88)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x1e77e9(0x12c)+_0x1e77e9(0xed)+_0x1e77e9(0x120)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x1b078f[_0x1e77e9(0x16e)]&&!_0x1b078f[_0x1e77e9(0x135)]&&!_0x1b078f[_0x1e77e9(0x115)]&&!_0x1b078f[_0x1e77e9(0xb0)])return console['error'](a23_0x2e85c1['red'](_0x1e77e9(0xc4))),console[_0x1e77e9(0xd5)](_0x1e77e9(0xef)),console['error'](_0x1e77e9(0xd3)),console[_0x1e77e9(0xd5)](_0x1e77e9(0x114)),console['error'](_0x1e77e9(0x150)),console[_0x1e77e9(0xd5)](_0x1e77e9(0x102)),console[_0x1e77e9(0xd5)](_0x1e77e9(0xc2)),0x1;const _0x40fc6f=resolveYamlFile(_0x142722);if(!existsSync(_0x40fc6f))return showFileNotFoundError(_0x40fc6f,_0x142722),0x1;_0x1b078f[_0x1e77e9(0xc1)]&&(console[_0x1e77e9(0xd5)](_0x1e77e9(0x74)+_0x1b078f['site']),console[_0x1e77e9(0xd5)](_0x1e77e9(0xf5)+_0x40fc6f));let _0x5b7192;try{_0x5b7192=readFileSync(_0x40fc6f,'utf-8');}catch(_0x1edcd2){const _0x4d519d=_0x1edcd2 instanceof Error?_0x1edcd2[_0x1e77e9(0x18d)]:String(_0x1edcd2);return console[_0x1e77e9(0xd5)](_0x1e77e9(0xe7)+_0x4d519d),0x1;}let _0xd69e80;try{_0xd69e80=parseDef(_0x5b7192);}catch(_0x566438){const _0x215ef5=_0x566438 instanceof Error?_0x566438[_0x1e77e9(0x18d)]:String(_0x566438);return console['error'](a23_0x2e85c1[_0x1e77e9(0xda)]('Error\x20parsing\x20YAML:\x20'+_0x215ef5)),0x1;}if(_0x1b078f['attribute']===!![]||_0x1b078f['attribute']===''){const _0x42b2d4=_0xd69e80['attributes']?.[_0x1e77e9(0x112)](_0x77e901=>_0x77e901[_0x1e77e9(0x130)])||[];if(_0x42b2d4['length']===0x0)console[_0x1e77e9(0xd5)](a23_0x2e85c1[_0x1e77e9(0xda)](_0x1e77e9(0x174)));else{console['error'](a23_0x2e85c1['red'](_0x1e77e9(0xf2))),console[_0x1e77e9(0xd5)](_0x1e77e9(0x187));for(const _0x22d833 of _0x42b2d4){console[_0x1e77e9(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x1e77e9(0xd6)](_0x22d833));}console[_0x1e77e9(0xd5)](_0x1e77e9(0x181)+_0x142722+'\x20--attribute\x20\x22'+_0x42b2d4[0x0]+'\x22');}return 0x1;}if(_0x1b078f[_0x1e77e9(0x115)]===!![]||_0x1b078f['behavior']===''){const _0x38dde0=_0xd69e80[_0x1e77e9(0x149)]?.[_0x1e77e9(0x112)](_0xa627cf=>_0xa627cf[_0x1e77e9(0x130)])||[];if(_0x38dde0['length']===0x0)console[_0x1e77e9(0xd5)](a23_0x2e85c1[_0x1e77e9(0xda)](_0x1e77e9(0x10f)));else{console[_0x1e77e9(0xd5)](a23_0x2e85c1[_0x1e77e9(0xda)](_0x1e77e9(0xfa))),console[_0x1e77e9(0xd5)](_0x1e77e9(0xa8));for(const _0x10a03e of _0x38dde0){console[_0x1e77e9(0xd5)]('\x20\x20'+a23_0x2e85c1[_0x1e77e9(0xd6)](_0x10a03e));}console[_0x1e77e9(0xd5)](_0x1e77e9(0x181)+_0x142722+_0x1e77e9(0x9a)+_0x38dde0[0x0]+'\x22');}return 0x1;}const _0x25baa1=createCommandSpinner(a23_0x2e85c1[_0x1e77e9(0x108)]('Fetching\x20sample\x20data...'),{'verbose':_0x1b078f[_0x1e77e9(0xc1)]});_0x25baa1[_0x1e77e9(0x96)]();const _0x2bbbd0={'onProgress':_0x481128=>{const _0x539707=_0x1e77e9;_0x25baa1[_0x539707(0x128)]=formatProgressMessage(_0x481128);}};if(_0x1b078f['master'])_0x2bbbd0['master']=!![];if(_0x1b078f[_0x1e77e9(0x135)]&&typeof _0x1b078f[_0x1e77e9(0x135)]===_0x1e77e9(0xb8))_0x2bbbd0[_0x1e77e9(0x135)]=_0x1b078f[_0x1e77e9(0x135)];if(_0x1b078f[_0x1e77e9(0x115)]&&typeof _0x1b078f[_0x1e77e9(0x115)]==='string')_0x2bbbd0[_0x1e77e9(0x115)]=_0x1b078f[_0x1e77e9(0x115)];if(_0x1b078f[_0x1e77e9(0xb0)])_0x2bbbd0[_0x1e77e9(0xb0)]=!![];if(_0x1b078f[_0x1e77e9(0x110)])_0x2bbbd0[_0x1e77e9(0x110)]=_0x1b078f[_0x1e77e9(0x110)];let _0x1fef7e;try{_0x1fef7e=await _0x3c53dc[_0x1e77e9(0x197)][_0x1e77e9(0x8b)](_0x5b7192,_0x2bbbd0),_0x25baa1[_0x1e77e9(0x18a)]();}catch(_0x5ecfcd){_0x25baa1[_0x1e77e9(0x18a)]();throw _0x5ecfcd;}return await this[_0x1e77e9(0x179)](_0x1fef7e,{'master':_0x1b078f[_0x1e77e9(0x16e)],'attribute':typeof _0x1b078f['attribute']===_0x1e77e9(0xb8)?_0x1b078f['attribute']:undefined,'behavior':typeof _0x1b078f[_0x1e77e9(0x115)]===_0x1e77e9(0xb8)?_0x1b078f['behavior']:undefined,'enriched':_0x1b078f[_0x1e77e9(0xb0)]}),_0x1fef7e['allValid']?0x0:0x1;}async[a23_0x5aec6d(0x179)](_0x54979c,_0x4666ae){const _0x3d49be=a23_0x5aec6d;console[_0x3d49be(0xd5)]('\x0a'+a23_0x2e85c1[_0x3d49be(0xfd)]('Preview:')+'\x20'+_0x54979c[_0x3d49be(0x130)]),console[_0x3d49be(0xd5)]('═'[_0x3d49be(0x198)](0x3c));if(_0x4666ae['master']&&_0x54979c[_0x3d49be(0xd2)]){const _0x4bf41e=a23_0x2e85c1[_0x3d49be(0x108)](_0x3d49be(0x131))+'\x20'+a23_0x2e85c1[_0x3d49be(0xfd)](_0x54979c[_0x3d49be(0x16e)][_0x3d49be(0x17e)]+'.'+_0x54979c[_0x3d49be(0x16e)]['table']);await this['displaySampleData'](_0x4bf41e,_0x54979c[_0x3d49be(0xd2)]);}else{if(_0x4666ae[_0x3d49be(0x135)]&&_0x54979c['sampleData']){const _0x1720a5=a23_0x2e85c1[_0x3d49be(0x108)](_0x3d49be(0xf0))+'\x20'+a23_0x2e85c1[_0x3d49be(0xfd)](_0x4666ae['attribute']);await this[_0x3d49be(0xa0)](_0x1720a5,_0x54979c[_0x3d49be(0xd2)]);}else{if(_0x4666ae[_0x3d49be(0x115)]&&_0x54979c['sampleData']){const _0x9d8c19=a23_0x2e85c1[_0x3d49be(0x108)]('Behavior:')+'\x20'+a23_0x2e85c1[_0x3d49be(0xfd)](_0x4666ae['behavior']);await this[_0x3d49be(0xa0)](_0x9d8c19,_0x54979c['sampleData']);}else{if(_0x4666ae[_0x3d49be(0xb0)]&&_0x54979c[_0x3d49be(0xd2)]){const _0x4f38f3=a23_0x2e85c1[_0x3d49be(0x108)]('Enriched:')+'\x20'+a23_0x2e85c1[_0x3d49be(0xfd)](_0x3d49be(0x7d));await this[_0x3d49be(0xa0)](_0x4f38f3,_0x54979c[_0x3d49be(0xd2)]);}else!_0x54979c['sampleData']&&console[_0x3d49be(0xd5)](_0x3d49be(0x16d));}}}if(_0x54979c[_0x3d49be(0x123)]['length']>0x0){console[_0x3d49be(0xd5)]('─'[_0x3d49be(0x198)](0x3c)),console['error']('\x0a'+a23_0x2e85c1[_0x3d49be(0xda)](_0x3d49be(0x15e)));for(const _0x1a02c3 of _0x54979c[_0x3d49be(0x123)]){console[_0x3d49be(0xd5)]('\x20\x20'+a23_0x2e85c1['red']('•')+'\x20'+_0x1a02c3);}}}async['displaySampleData'](_0x347a79,_0x1ee589){const _0x193ff5=a23_0x5aec6d;if(_0x1ee589[_0x193ff5(0x11f)]===0x0){console['error']('\x0a'+_0x347a79),console[_0x193ff5(0xd5)](_0x193ff5(0x176));return;}console[_0x193ff5(0xd5)]('\x0a'+_0x347a79);const _0xbd82dc=Object[_0x193ff5(0x14a)](_0x1ee589[0x0])[_0x193ff5(0x112)](_0x2a8fa0=>({'name':_0x2a8fa0,'type':typeof _0x1ee589[0x0][_0x2a8fa0]===_0x193ff5(0x12d)?_0x193ff5(0x8a):_0x193ff5(0xf7)})),_0x585642={'queryId':'preview','columns':_0xbd82dc,'data':_0x1ee589,'stats':{'state':_0x193ff5(0x11b),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1ee589[_0x193ff5(0x11f)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x40e688=formatAsTable(_0x585642,_0x1ee589[_0x193ff5(0x11f)],!![]);await writeOutput(_0x40e688,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0x161);[a23_0x5aec6d(0x180)]=a23_0x5aec6d(0x119);async[a23_0x5aec6d(0x145)](_0x5f1f66){const _0xe744ea=a23_0x5aec6d,{options:_0x28521a,args:_0x3cf1b5,tdx:_0x60c331}=_0x5f1f66,_0x2fe619=_0x28521a,_0x6af844=_0x3cf1b5[0x0]||_0x28521a[_0xe744ea(0x8d)];if(!_0x6af844)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 _0x1e4846=resolveYamlFile(_0x6af844);if(existsSync(_0x1e4846)){_0x2fe619['verbose']&&console[_0xe744ea(0xd5)](_0xe744ea(0x8e)+_0x1e4846);let _0x466527;try{_0x466527=readFileSync(_0x1e4846,_0xe744ea(0x156));}catch(_0xecfb0e){const _0x11cfb9=_0xecfb0e instanceof Error?_0xecfb0e[_0xe744ea(0x18d)]:String(_0xecfb0e);return console[_0xe744ea(0xd5)]('Error\x20reading\x20file:\x20'+_0x11cfb9),0x1;}const _0x484aab=await withSpinner(_0xe744ea(0x10a),()=>_0x60c331[_0xe744ea(0x197)][_0xe744ea(0x143)](_0x466527),{'verbose':_0x2fe619[_0xe744ea(0xc1)]}),_0x28bf12=_0x484aab['data'],{isNew:_0x1a916c,name:_0x22407d,hasChanges:_0x86b760,diffFormatted:_0x53d6d1}=_0x28bf12;if(_0x86b760){_0x1a916c?console[_0xe744ea(0xd5)](_0xe744ea(0x10d)+_0x22407d+'\x27:'):console[_0xe744ea(0xd5)](_0xe744ea(0xd1)+_0x22407d+'\x27:');console[_0xe744ea(0xd5)]('─'[_0xe744ea(0x198)](0x3c)),console[_0xe744ea(0xd5)](_0x53d6d1),console[_0xe744ea(0xd5)]('─'[_0xe744ea(0x198)](0x3c));const _0x2bc48d=_0x1a916c?'Create\x20parent\x20segment\x20\x27'+_0x22407d+_0xe744ea(0x91):'Apply\x20changes\x20to\x20\x27'+_0x22407d+_0xe744ea(0x91);if(!_0x2fe619['yes']){const _0x179b12=await confirmKey(_0x2bc48d);if(!_0x179b12)return console[_0xe744ea(0xd5)](_0xe744ea(0xbd)),0x1;}const _0x5abedd=_0x1a916c?'Creating':'Updating';await withSpinner(_0x5abedd+'\x20parent\x20segment\x20\x27'+_0x22407d+_0xe744ea(0x194),()=>_0x28bf12[_0xe744ea(0xf9)](),{'verbose':_0x2fe619[_0xe744ea(0xc1)]});const _0x1a6471=_0x1a916c?_0xe744ea(0x10c):_0xe744ea(0xca);console[_0xe744ea(0xd5)]('✔\x20'+_0x1a6471+_0xe744ea(0xad)+_0x22407d+'\x27');}else console[_0xe744ea(0xd5)]('✔\x20No\x20changes\x20-\x20\x27'+_0x22407d+'\x27\x20is\x20up\x20to\x20date');}const _0xc82ba8=await withSpinner(_0xe744ea(0x147)+_0x6af844+_0xe744ea(0x194),()=>_0x60c331['segment'][_0xe744ea(0xe6)](_0x6af844),{'verbose':_0x2fe619['verbose']}),_0x50820b=_0xc82ba8['data'],_0x5f3ce1=getConsoleUrl(_0x2fe619[_0xe744ea(0xc7)],_0xe744ea(0x19a)+_0x50820b[_0xe744ea(0xb2)]+_0xe744ea(0x118)+_0x50820b[_0xe744ea(0x15a)]+_0xe744ea(0x124)+_0x50820b[_0xe744ea(0x185)]);return console['error'](_0xe744ea(0x170)),console[_0xe744ea(0xd5)]('\x20\x20'+a23_0x2e85c1[_0xe744ea(0x108)](_0xe744ea(0x82))+'\x20'+_0x50820b[_0xe744ea(0xbc)]),console['error']('\x20\x20'+a23_0x2e85c1['dim'](_0xe744ea(0xb9))+'\x20'+_0x50820b[_0xe744ea(0x15c)]),console['error']('\x20\x20'+a23_0x2e85c1[_0xe744ea(0x108)](_0xe744ea(0x159))+'\x20'+_0x50820b[_0xe744ea(0x15a)]),console[_0xe744ea(0xd5)]('\x20\x20'+a23_0x2e85c1[_0xe744ea(0x108)](_0xe744ea(0x19b))+'\x20'+_0x50820b['workflowAttemptId']),console[_0xe744ea(0xd5)]('\x20\x20'+_0x5f3ce1),console['error']('\x0a'+a23_0x2e85c1[_0xe744ea(0x108)](_0xe744ea(0x137))+_0xe744ea(0x13f)+_0x50820b[_0xe744ea(0x185)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0x13e);[a23_0x5aec6d(0x180)]='List\x20available\x20fields\x20for\x20segmentation';async[a23_0x5aec6d(0x145)](_0x294911){const _0x50d73e=a23_0x5aec6d,{options:_0x497c50,args:_0x25ecae,tdx:_0x57a031}=_0x294911,_0x1a40f8=_0x25ecae[0x0]||_0x497c50['parentSegment'];if(!_0x1a40f8)return showParentSegmentNotSetError(_0x50d73e(0x172)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x497c50[_0x50d73e(0xc1)]&&(console[_0x50d73e(0xd5)]('Site:\x20'+_0x497c50['site']),console[_0x50d73e(0xd5)](_0x50d73e(0xcf)+_0x1a40f8));const _0x49d694=await withSpinner(_0x50d73e(0xa5)+_0x1a40f8+'\x27...',()=>_0x57a031[_0x50d73e(0x197)][_0x50d73e(0xc8)](_0x1a40f8),{'verbose':_0x497c50[_0x50d73e(0xc1)]}),_0x58f2c7=_0x49d694['data'];console[_0x50d73e(0xd5)](_0x50d73e(0xfe)+_0x58f2c7[_0x50d73e(0x11f)]+_0x50d73e(0x9c)+(_0x58f2c7[_0x50d73e(0x11f)]!==0x1?'s':''));if(_0x497c50[_0x50d73e(0xcb)]||_0x497c50[_0x50d73e(0xe9)])return await handleSDKOutput(_0x58f2c7,_0x497c50),0x0;return displayFieldsHumanReadable(_0x58f2c7,_0x1a40f8),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0x183);[a23_0x5aec6d(0x180)]='Show\x20parent\x20segment\x20details';async[a23_0x5aec6d(0x145)](_0x315449){const _0x1eb4c4=a23_0x5aec6d,{options:_0x1a0bb5,args:_0x90a52b,tdx:_0x5059c9}=_0x315449,_0x44280f=_0x1a0bb5,_0x2d8e73=_0x90a52b[0x0]||_0x1a0bb5[_0x1eb4c4(0x8d)];if(!_0x2d8e73)return showParentSegmentNotSetError(_0x1eb4c4(0x165)+_0x1eb4c4(0x7c)+_0x1eb4c4(0xb3)+_0x1eb4c4(0x160)),0x1;_0x1a0bb5[_0x1eb4c4(0xc1)]&&(console[_0x1eb4c4(0xd5)](_0x1eb4c4(0x74)+_0x1a0bb5[_0x1eb4c4(0xc7)]),console[_0x1eb4c4(0xd5)](_0x1eb4c4(0xcf)+_0x2d8e73));const _0x11ada4=await withSpinner(_0x1eb4c4(0x132)+_0x2d8e73+_0x1eb4c4(0x194),()=>_0x5059c9[_0x1eb4c4(0x197)][_0x1eb4c4(0x17d)](_0x2d8e73),{'verbose':_0x1a0bb5[_0x1eb4c4(0xc1)]}),_0x523ea3=_0x11ada4[_0x1eb4c4(0x15f)];if(_0x44280f[_0x1eb4c4(0xae)]){const _0x348733=getConsoleNextUrl(_0x44280f['site'],_0x1eb4c4(0xe1)+_0x523ea3['id']);return console['error'](a23_0x2e85c1[_0x1eb4c4(0x12b)]('✔')+'\x20Opening\x20'+a23_0x2e85c1['cyan'](_0x348733)),openBrowser(_0x348733),0x0;}return await handleSingleObjectOutput(_0x523ea3,_0x1a0bb5),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x5aec6d(0x130)]='segment:parent:desc';[a23_0x5aec6d(0x180)]=a23_0x5aec6d(0xaa);async[a23_0x5aec6d(0x145)](_0x51bed8){const _0x441fa1=a23_0x5aec6d,{options:_0x3cae73,args:_0x6c8146,tdx:_0x59f1df}=_0x51bed8,_0x443fcd=_0x6c8146[0x0]||_0x3cae73[_0x441fa1(0x8d)];if(!_0x443fcd)return showParentSegmentNotSetError(_0x441fa1(0xaf)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x3cae73['verbose']&&(console[_0x441fa1(0xd5)](_0x441fa1(0x74)+_0x3cae73[_0x441fa1(0xc7)]),console[_0x441fa1(0xd5)](_0x441fa1(0xcf)+_0x443fcd));const _0x470ccb=await withSpinner(_0x441fa1(0xfc)+_0x443fcd+'\x27...',()=>_0x59f1df[_0x441fa1(0x197)][_0x441fa1(0x17b)](_0x443fcd),{'verbose':_0x3cae73[_0x441fa1(0xc1)]}),_0x1d5db1=_0x470ccb[_0x441fa1(0x15f)],_0xa39a4c=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x443fcd+_0x441fa1(0x194),()=>_0x59f1df[_0x441fa1(0x197)]['getParentSQL'](_0x1d5db1),{'verbose':_0x3cae73[_0x441fa1(0xc1)]}),_0x130acf=await executeSchemaQuery(_0xa39a4c[_0x441fa1(0x15f)],_0x59f1df,_0x3cae73);return await handleQueryOutput(_0x130acf,_0x3cae73),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x5aec6d(0x130)]=a23_0x5aec6d(0x94);[a23_0x5aec6d(0x180)]=a23_0x5aec6d(0x10b);async[a23_0x5aec6d(0x145)](_0x3c61f2){const _0x24915c=a23_0x5aec6d,{options:_0x5c3a79,args:_0x528b11,tdx:_0x56aefb}=_0x3c61f2,_0x1e76ca=_0x528b11[0x0]||_0x5c3a79[_0x24915c(0x8d)];if(!_0x1e76ca)return showParentSegmentNotSetError(_0x24915c(0x164)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x5c3a79[_0x24915c(0xc1)]&&(console[_0x24915c(0xd5)](_0x24915c(0x74)+_0x5c3a79[_0x24915c(0xc7)]),console[_0x24915c(0xd5)](_0x24915c(0xcf)+_0x1e76ca));const _0x30edc6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1e76ca+_0x24915c(0x194),()=>_0x56aefb[_0x24915c(0x197)][_0x24915c(0x17b)](_0x1e76ca),{'verbose':_0x5c3a79[_0x24915c(0xc1)]}),_0x1cdd6a=_0x30edc6[_0x24915c(0x15f)],_0x2e1293=await withSpinner(_0x24915c(0xd9)+_0x1e76ca+_0x24915c(0x194),()=>_0x56aefb[_0x24915c(0x197)][_0x24915c(0x105)](_0x1cdd6a),{'verbose':_0x5c3a79[_0x24915c(0xc1)]}),_0x973e10=_0x2e1293['data'];return _0x5c3a79[_0x24915c(0xc0)]===_0x24915c(0xcb)||_0x5c3a79[_0x24915c(0xc0)]===_0x24915c(0xe9)?await handleSDKOutput([{'sql':_0x973e10}],_0x5c3a79):console[_0x24915c(0x90)](_0x973e10),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x5aec6d(0x130)]='segment:parent:show';[a23_0x5aec6d(0x180)]=a23_0x5aec6d(0xec);async[a23_0x5aec6d(0x145)](_0x3cbcce){const _0xd39fb3=a23_0x5aec6d,{options:_0x2c9150,args:_0x2ce154,tdx:_0x32b2b5}=_0x3cbcce,_0x2bf98d=_0x2ce154[0x0]||_0x2c9150[_0xd39fb3(0x8d)];if(!_0x2bf98d)return showParentSegmentNotSetError(_0xd39fb3(0xde)+_0xd39fb3(0xa3)),0x1;_0x2c9150[_0xd39fb3(0xc1)]&&(console[_0xd39fb3(0xd5)](_0xd39fb3(0x74)+_0x2c9150[_0xd39fb3(0xc7)]),console[_0xd39fb3(0xd5)](_0xd39fb3(0xcf)+_0x2bf98d));const _0x1cf586=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2bf98d+'\x27...',()=>_0x32b2b5[_0xd39fb3(0x197)][_0xd39fb3(0x17b)](_0x2bf98d),{'verbose':_0x2c9150['verbose']}),_0x2835cf=_0x1cf586[_0xd39fb3(0x15f)],_0x265c1d=await withSpinner(_0xd39fb3(0xd9)+_0x2bf98d+'\x27...',()=>_0x32b2b5[_0xd39fb3(0x197)][_0xd39fb3(0x105)](_0x2835cf),{'verbose':_0x2c9150['verbose']});let _0x558391=_0x265c1d[_0xd39fb3(0x15f)];const _0x51b6d7=resolveLimit(_0x2c9150[_0xd39fb3(0xf8)],DEFAULT_DISPLAY_LIMIT),_0x5b2c7c=/\bLIMIT\s+\d+/i[_0xd39fb3(0x98)](_0x558391);!_0x5b2c7c&&(_0x558391=_0x558391['trim']()[_0xd39fb3(0xea)](/;+$/,''),_0x558391=_0xd39fb3(0xe5)+_0x558391+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x51b6d7);_0x2c9150['verbose']&&console[_0xd39fb3(0xd5)](_0xd39fb3(0x73)+_0x558391);const _0x2b62cc=await withProgressSpinner(_0xd39fb3(0x193),async _0x22889a=>{const _0x5c02a4=_0xd39fb3,_0x16adca=await _0x32b2b5[_0x5c02a4(0x12f)]['execute'](_0x558391,{'catalog':'td','schema':_0x5c02a4(0x19c),'onJobId':_0x5f3472=>{const _0x4419be=_0x5c02a4;_0x22889a[_0x4419be(0xc9)](_0x5f3472);}});return _0x16adca;},{'verbose':_0x2c9150[_0xd39fb3(0xc1)]}),_0x2fb0f2=_0x2b62cc['data'],_0x4f67b8=_0x2fb0f2[_0xd39fb3(0x76)]?'\x20[Job\x20ID:\x20'+_0x2fb0f2[_0xd39fb3(0x76)]+']':'';return console[_0xd39fb3(0xd5)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x2fb0f2[_0xd39fb3(0x189)]['processedRows'][_0xd39fb3(0xf1)]()+_0xd39fb3(0x86)+('in\x20'+formatElapsed(_0x2fb0f2['stats'][_0xd39fb3(0x17a)])+_0x4f67b8)),await handleQueryOutput(_0x2fb0f2,_0x2c9150),0x0;}}
1
+ const a23_0x38ac8f=a23_0x390b;(function(_0x2b62e7,_0x2c9782){const _0x440748=a23_0x390b,_0x4a32d2=_0x2b62e7();while(!![]){try{const _0x1bb003=parseInt(_0x440748(0x230))/0x1*(-parseInt(_0x440748(0x1f4))/0x2)+-parseInt(_0x440748(0x1e8))/0x3+parseInt(_0x440748(0x1ec))/0x4*(-parseInt(_0x440748(0x20c))/0x5)+-parseInt(_0x440748(0x24e))/0x6+-parseInt(_0x440748(0x2fe))/0x7*(-parseInt(_0x440748(0x29c))/0x8)+-parseInt(_0x440748(0x220))/0x9+parseInt(_0x440748(0x29b))/0xa*(parseInt(_0x440748(0x29f))/0xb);if(_0x1bb003===_0x2c9782)break;else _0x4a32d2['push'](_0x4a32d2['shift']());}catch(_0x2f5c22){_0x4a32d2['push'](_0x4a32d2['shift']());}}}(a23_0x1723,0x9748b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';function a23_0x390b(_0x2cef7a,_0x49650b){_0x2cef7a=_0x2cef7a-0x1e2;const _0x17233e=a23_0x1723();let _0x390b87=_0x17233e[_0x2cef7a];return _0x390b87;}import{spawn}from'child_process';import a23_0x4959a7 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x1b60d0 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x38ac8f(0x291),LEGACY_PARENT_SEGMENT_DIR=a23_0x38ac8f(0x2df);function openBrowser(_0x24282c){const _0x12fc8d=a23_0x38ac8f,_0x518c2d=process['platform'],_0x4b55e0=_0x518c2d===_0x12fc8d(0x22a)?'open':_0x518c2d===_0x12fc8d(0x2fb)?_0x12fc8d(0x1fc):_0x12fc8d(0x23b);spawn(_0x4b55e0,[_0x24282c],{'detached':!![],'stdio':_0x12fc8d(0x2ff)})['unref']();}function a23_0x1723(){const _0x226a17=['utf-8','workflowSessionId','behavior','displaySampleData','win32','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','segment:parent:desc','7Ryrado','ignore','error','/sessions/','\x20No\x20changes\x20-\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','execute','segment:parent:show','pushParentYaml','Fetching\x20current\x20configuration\x20for\x20\x27','Updating\x20parent\x20segment\x20\x27','master','allValid','segment','✔\x20Found\x20','segment:parent:create','\x20--behavior\x20\x22<name>\x22','schemaError','\x27\x20is\x20already\x20up\x20to\x20date','varchar','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','/\x20and\x20','Database:\x20','Source:','1425102tPbStx','✔\x20Created\x20parent\x20segment\x20\x27','join','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','112GCdRDp','length','errors','customerGroup','Attribute:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Customers:','✔\x20Query\x20completed:\x20Processed\x20','142JWYYHv','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','interval','✔\x20Renamed\x20directory\x20to\x20','yellow','\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','stats','start','👥\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','dim','/{name}.yml\x0a','addBehaviors','yes','No\x20parent\x20segments\x20match\x20pattern:\x20','Fetching\x20SQL\x20for\x20\x27','validateParentYaml','bold','Fetching\x20sample\x20data...','name','listParents','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','using\x20the\x20default\x20path:\x20','66190hrCGtw','preview','output','message','attributes','Options\x20(one\x20required):\x0a','Available\x20behaviors:','schemaValid','Apply\x20changes\x20to\x20\x27','\x0a✔\x20Workflow\x20started','Listing\x20parent\x20segments...','Error:\x20--attribute\x20requires\x20a\x20name\x0a','addAttributes','displayAttributesStats','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','segment:parent:validate','displaySummary','toFixed','repeat','test','2992212iyecHX','/attempt/','number','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','rowCount','updateParent','use','column','\x20Configuration\x20is\x20valid','\x20Opening\x20','darwin','\x20\x20\x20\x20-\x20','listFields','string','double','Rows:','1663koijrG','To\x20view\x20sample\x20data:','\x5c$&','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20kill','Analyzing\x20changes...','coveragePercent','totalEvents','Available\x20attributes:','\x0aNo\x20sample\x20data\x20available','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','xdg-open','/app/workflows/','Error:\x20--database\x20and\x20--table\x20are\x20required','segment:parent:run','Attributes','segment:parent:update','Overwrite\x20\x27','map','\x20Context\x20set:\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','.yml','Session:','Updated','✔\x20No\x20changes\x20-\x20\x27','\x0aNew\x20parent\x20segment\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','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','in\x20','red','5968116InBdfO','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Options:','behaviors','Created','isDirectory','segment:parent:push','segment:parent:view','scheduleOption','displayPreviewResults','parentSegment','segment:parent:list','toLocaleString','database','\x20--attribute\x20\x22<name>\x22','sort','segment:parent:fields','resolveParentId','List\x20parent\x20segments','\x0a⚠️\x20\x20Both\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Error:','elapsedTimeMillis','\x20=\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','data','Name:\x20','/\x20→\x20','attribute','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','SQL\x20query:\x0a','web','Join:','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','workflowAttemptId','limit','stop','pullParentYaml','population','Options:\x0a','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20parent\x20segment','\x20field','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','displayColumns','\x20[Job\x20ID:\x20','behaviorsFile','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','log','tdx\x20segment\x20parent\x20preview\x20','site','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','matchedCount','table','runParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','all','green','\x27\x20and\x20run\x20workflow?','segment:parent:sql','filter','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','To\x20cancel:','foreignKey','parent_segments','No\x20parent\x20segments\x20found','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','enriched','Updating','query','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','processedRows','Resolving\x20parent\x20segment\x20\x27','410WndBUm','5273864ajtvHh','Listing\x20fields\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','604021NYHRLo','session','information_schema','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Status:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','columns','timezone','Master\x20Table','keys','workflowId','segment:parent:preview','displayMasterInfo','Master\x20+\x20Attributes','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x27\x20with\x20ID:\x20','%)\x20','\x20--attribute\x20\x22','Enriched:','\x27...','Columns:','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20No\x20sample\x20data\x20available','Coverage:','match','/app/dw/parentSegments/','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Preview:','replace','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Validate:','Error\x20reading\x20file:\x20','customersWithEvents','joinKey','Master:','/\x20directories\x20exist.','\x20--interval\x20','Behavior:','text','-1d','\x20--enriched','displayPreviewHints','Executing\x20parent\x20segment\x20query...','Behaviors','Pattern:\x20','jobId','scheduleType','Site:\x20','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','displayBehaviorsStats','label','displayValidateResults','\x20tdx\x20wf\x20attempt\x20','Show\x20parent\x20segment\x20details','Error:\x20File\x20not\x20found:\x20','verbose','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','getParentFull','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x0aChanges\x20to\x20apply\x20to\x20\x27','parent_segment','createParent','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','json','run','Join\x20on:','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','sampleData','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','jsonl','previewParentYaml','format','cyan','description','customerPercent','Found\x20YAML\x20file:\x20','customerGroupFile','Fetching\x20parent\x20segment\x20\x27','Creating','Creating\x20parent\x20segment\x20\x27','getParentSQL','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Table:\x20','Aborted.'];a23_0x1723=function(){return _0x226a17;};return a23_0x1723();}function migrateLegacyDirectory(){const _0x3d2eca=a23_0x38ac8f;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x145f41=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x145f41[_0x3d2eca(0x253)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a23_0x1b60d0[_0x3d2eca(0x1f8)](_0x3d2eca(0x261)+LEGACY_PARENT_SEGMENT_DIR+_0x3d2eca(0x1e5)+PARENT_SEGMENT_DIR+_0x3d2eca(0x2c5))),console[_0x3d2eca(0x300)](a23_0x1b60d0[_0x3d2eca(0x1ff)](_0x3d2eca(0x21a)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x3d2eca(0x300)](a23_0x1b60d0[_0x3d2eca(0x1f8)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3d2eca(0x269)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a23_0x1b60d0[_0x3d2eca(0x28a)](_0x3d2eca(0x1f7)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x149b8e){const _0x1e25fb=_0x149b8e instanceof Error?_0x149b8e[_0x3d2eca(0x20f)]:String(_0x149b8e);return console[_0x3d2eca(0x300)](a23_0x1b60d0[_0x3d2eca(0x24d)](_0x3d2eca(0x233)+_0x1e25fb+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x38ac8f(0x2e3)](_0x568a5a){const _0x461061=a23_0x38ac8f;return migrateLegacyDirectory(),super[_0x461061(0x2e3)](_0x568a5a);}}function resolveYamlFile(_0x2f8319){const _0x2a53a5=a23_0x38ac8f;if(_0x2f8319['endsWith']('.yml')||_0x2f8319['endsWith']('.yaml'))return _0x2f8319;return a23_0x4959a7[_0x2a53a5(0x1ea)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2f8319)+_0x2a53a5(0x245));}function formatProgressMessage(_0x3f4a1f){const _0x15ba3f=a23_0x38ac8f,_0x3e5fc5=_0x3f4a1f[_0x15ba3f(0x2ba)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3e5fc5){const [,_0x1062e5,_0x29fb06,_0x1923df='']=_0x3e5fc5;return a23_0x1b60d0[_0x15ba3f(0x1ff)](_0x1062e5+':')+'\x20'+_0x29fb06+a23_0x1b60d0[_0x15ba3f(0x1ff)](_0x1923df);}return a23_0x1b60d0[_0x15ba3f(0x1ff)](_0x3f4a1f);}function showFileNotFoundError(_0x236525,_0x367ad6){const _0x112e26=a23_0x38ac8f;console['error'](a23_0x1b60d0[_0x112e26(0x24d)](_0x112e26(0x2d9)+_0x236525+'\x0a')),console[_0x112e26(0x300)](a23_0x1b60d0[_0x112e26(0x2eb)](_0x112e26(0x1f5)+_0x367ad6+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x56a915){const _0x2ac203=a23_0x38ac8f;console[_0x2ac203(0x300)](a23_0x1b60d0[_0x2ac203(0x1f8)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x2ac203(0x300)](_0x56a915);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x259);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x260);async['execute'](_0x2dd3ea){const _0x214a94=a23_0x38ac8f,{options:_0x371299,args:_0x39cdc6,tdx:_0x58d0a9}=_0x2dd3ea,_0x466be0=_0x39cdc6[0x0];_0x371299[_0x214a94(0x2da)]&&(console[_0x214a94(0x300)]('Site:\x20'+_0x371299['site']),_0x466be0&&console[_0x214a94(0x300)](_0x214a94(0x2ce)+_0x466be0));const _0x579228=await withSpinner(_0x466be0?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x466be0+_0x214a94(0x2b4):_0x214a94(0x216),()=>_0x58d0a9['segment'][_0x214a94(0x209)](),{'verbose':_0x371299[_0x214a94(0x2da)]});let _0x1c58dc=_0x579228[_0x214a94(0x267)];if(_0x466be0){const _0x1f1218=_0x466be0[_0x214a94(0x2be)](/[.+^${}()|[\]\\]/g,_0x214a94(0x232))[_0x214a94(0x2be)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x513de7=new RegExp('^'+_0x1f1218+'$','i');_0x1c58dc=_0x1c58dc[_0x214a94(0x28d)](_0x483297=>_0x513de7[_0x214a94(0x21f)](_0x483297[_0x214a94(0x210)][_0x214a94(0x208)]));}_0x1c58dc[_0x214a94(0x25d)]((_0x252fe3,_0x31f495)=>_0x252fe3[_0x214a94(0x210)][_0x214a94(0x208)]['localeCompare'](_0x31f495[_0x214a94(0x210)][_0x214a94(0x208)])),console[_0x214a94(0x300)](_0x214a94(0x30c)+_0x1c58dc['length']+_0x214a94(0x278)+(_0x1c58dc[_0x214a94(0x1ed)]!==0x1?'s':''));const _0x398e6d=_0x23e54c=>{const _0x58d74b=_0x214a94;return getConsoleNextUrl(_0x371299[_0x58d74b(0x282)],'/app/dw/parentSegments/'+_0x23e54c);};if(_0x371299[_0x214a94(0x2ea)]===_0x214a94(0x2e2)||_0x371299[_0x214a94(0x2ea)]===_0x214a94(0x2e8)){const _0x4f6206=_0x1c58dc['map'](_0x18fc68=>({..._0x18fc68,'url':_0x398e6d(_0x18fc68['id'])}));await handleSDKOutput(_0x4f6206,_0x371299);}else{if(_0x1c58dc[_0x214a94(0x1ed)]===0x0)_0x466be0?console[_0x214a94(0x280)](_0x214a94(0x203)+_0x466be0):console[_0x214a94(0x280)](_0x214a94(0x292));else for(const _0x1965b5 of _0x1c58dc){const _0x124dc1=_0x1965b5['attributes']['population']?a23_0x1b60d0['dim']('\x20('+formatRows(_0x1965b5[_0x214a94(0x210)][_0x214a94(0x275)])+')'):'',_0x644118=hyperlink(_0x1965b5[_0x214a94(0x210)]['name'],_0x398e6d(_0x1965b5['id']));console['log'](_0x214a94(0x1fd)+_0x644118+_0x124dc1);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x30d);[a23_0x38ac8f(0x2ec)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x38ac8f(0x304)](_0x35e48c){const _0x185495=a23_0x38ac8f,{options:_0x2db7b8,args:_0x14a0e6,tdx:_0x4a028a}=_0x35e48c;console[_0x185495(0x300)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x185495(0x2b7)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xf2235f=_0x2db7b8;if(_0x14a0e6[_0x185495(0x1ed)]===0x0)return console[_0x185495(0x300)](a23_0x1b60d0[_0x185495(0x24d)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x185495(0x27b)),0x1;const _0x44cb64=_0x14a0e6[0x0];if(!_0xf2235f[_0x185495(0x25b)]||!_0xf2235f[_0x185495(0x286)])return console['error'](_0x185495(0x23d)),console[_0x185495(0x300)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0xf2235f[_0x185495(0x2da)]&&(console[_0x185495(0x300)]('Site:\x20'+_0xf2235f[_0x185495(0x282)]),console['error'](_0x185495(0x268)+_0x44cb64),console[_0x185495(0x300)](_0x185495(0x1e6)+_0xf2235f[_0x185495(0x25b)]),console['error'](_0x185495(0x2f5)+_0xf2235f[_0x185495(0x286)]));const _0x42a6c1=await loadJSONFromOptions(_0xf2235f[_0x185495(0x210)],_0xf2235f['attributesFile']),_0x2e6d2b=await loadJSONFromOptions(_0xf2235f[_0x185495(0x251)],_0xf2235f[_0x185495(0x27e)]),_0x399a90=await loadJSONFromOptions(_0xf2235f[_0x185495(0x1ef)],_0xf2235f[_0x185495(0x2ef)]),_0x28d1fa={'name':_0x44cb64,'description':_0xf2235f[_0x185495(0x2ec)],'scheduleType':_0xf2235f[_0x185495(0x2d0)],'scheduleOption':_0xf2235f[_0x185495(0x256)],'timezone':_0xf2235f[_0x185495(0x2a8)],'master':{'parentDatabaseName':_0xf2235f[_0x185495(0x25b)],'parentTableName':_0xf2235f[_0x185495(0x286)]},'attributes':_0x42a6c1,'behaviors':_0x2e6d2b,'customerGroup':_0x399a90},_0x35e14f=await withSpinner(_0x185495(0x2f2)+_0x44cb64+_0x185495(0x2b4),()=>_0x4a028a[_0x185495(0x30b)][_0x185495(0x2e0)](_0x28d1fa),{'verbose':_0x2db7b8[_0x185495(0x2da)]}),_0x3f655b=_0x35e14f['data'];return console[_0x185495(0x300)](_0x185495(0x1e9)+_0x3f655b[_0x185495(0x208)]+_0x185495(0x2b0)+_0x3f655b['id']),await handleSDKOutput([_0x3f655b],_0x2db7b8),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a23_0x38ac8f(0x240);['description']='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x38ac8f(0x304)](_0x4ff9d7){const _0x3b9bdf=a23_0x38ac8f,{options:_0x5707d5,args:_0xf78e9d,tdx:_0x2da693}=_0x4ff9d7;console[_0x3b9bdf(0x300)](_0x3b9bdf(0x2db)+_0x3b9bdf(0x2b7)+_0x3b9bdf(0x283));const _0x2663a6=_0x5707d5;if(_0xf78e9d[_0x3b9bdf(0x1ed)]===0x0)return console['error'](a23_0x1b60d0[_0x3b9bdf(0x24d)](_0x3b9bdf(0x2a6))),console['error'](_0x3b9bdf(0x223)),0x1;const _0x3ac2e1=_0xf78e9d[0x0];_0x2663a6[_0x3b9bdf(0x2da)]&&(console[_0x3b9bdf(0x300)](_0x3b9bdf(0x2d1)+_0x2663a6[_0x3b9bdf(0x282)]),console[_0x3b9bdf(0x300)](_0x3b9bdf(0x2d2)+_0x3ac2e1));const _0x562ab9=await withSpinner(_0x3b9bdf(0x307)+_0x3ac2e1+_0x3b9bdf(0x2b4),()=>_0x2da693[_0x3b9bdf(0x30b)][_0x3b9bdf(0x2dc)](_0x3ac2e1),{'verbose':_0x2663a6[_0x3b9bdf(0x2da)]}),_0x5248bd=_0x562ab9[_0x3b9bdf(0x267)],_0x459ada=await loadJSONFromOptions(_0x2663a6[_0x3b9bdf(0x218)],_0x2663a6['addAttributesFile']),_0x32956b=await loadJSONFromOptions(_0x2663a6[_0x3b9bdf(0x201)],_0x2663a6['addBehaviorsFile']),_0x1159c8={'name':_0x5248bd[_0x3b9bdf(0x208)],'description':_0x2663a6[_0x3b9bdf(0x2ec)]!==undefined?_0x2663a6[_0x3b9bdf(0x2ec)]:_0x5248bd[_0x3b9bdf(0x2ec)],'scheduleType':_0x2663a6[_0x3b9bdf(0x2d0)]!==undefined?_0x2663a6[_0x3b9bdf(0x2d0)]:_0x5248bd[_0x3b9bdf(0x2d0)],'scheduleOption':_0x2663a6[_0x3b9bdf(0x256)]!==undefined?_0x2663a6[_0x3b9bdf(0x256)]:_0x5248bd[_0x3b9bdf(0x256)],'timezone':_0x2663a6[_0x3b9bdf(0x2a8)]!==undefined?_0x2663a6[_0x3b9bdf(0x2a8)]:_0x5248bd[_0x3b9bdf(0x2a8)],'master':_0x5248bd[_0x3b9bdf(0x309)],'attributes':_0x459ada?[..._0x5248bd['attributes']||[],..._0x459ada]:_0x5248bd[_0x3b9bdf(0x210)],'behaviors':_0x32956b?[..._0x5248bd[_0x3b9bdf(0x251)]||[],..._0x32956b]:_0x5248bd[_0x3b9bdf(0x251)],'customerGroup':_0x5248bd[_0x3b9bdf(0x1ef)]},_0x3f0d0a=await withSpinner(_0x3b9bdf(0x308)+_0x3ac2e1+_0x3b9bdf(0x2b4),()=>_0x2da693[_0x3b9bdf(0x30b)][_0x3b9bdf(0x225)](_0x3ac2e1,_0x1159c8),{'verbose':_0x2663a6['verbose']}),_0x5cfd10=_0x3f0d0a[_0x3b9bdf(0x267)];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x5cfd10[_0x3b9bdf(0x208)]+'\x27'),await handleSDKOutput([_0x5cfd10],_0x2663a6),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x38ac8f(0x208)]='segment:parent:pull';[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x298);async['execute'](_0x501737){const _0x375914=a23_0x38ac8f,{options:_0x4b0bad,args:_0x468780,tdx:_0x49d355}=_0x501737,_0x4c5339=_0x4b0bad,_0x4a05f6=_0x468780[0x0]||_0x4b0bad['parentSegment'];if(!_0x4a05f6)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'+_0x375914(0x2d3)),0x1;if(_0x4c5339[_0x375914(0x226)]&&_0x4c5339['output'])return console[_0x375914(0x300)](a23_0x1b60d0[_0x375914(0x24d)](_0x375914(0x27f))),console[_0x375914(0x300)](a23_0x1b60d0[_0x375914(0x1ff)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a23_0x1b60d0[_0x375914(0x1ff)](_0x375914(0x20b)+PARENT_SEGMENT_DIR+_0x375914(0x200))),console['error'](a23_0x1b60d0[_0x375914(0x2eb)](_0x375914(0x28e))),0x1;const _0x2c5e28=_0x4c5339[_0x375914(0x20e)]||a23_0x4959a7[_0x375914(0x1ea)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4a05f6)+_0x375914(0x245));_0x4c5339['verbose']&&(console['error'](_0x375914(0x2d1)+_0x4c5339['site']),console[_0x375914(0x300)](_0x375914(0x2d2)+_0x4a05f6),console[_0x375914(0x300)]('Output\x20file:\x20'+_0x2c5e28));const _0x3f99d6=await withSpinner(_0x375914(0x2f0)+_0x4a05f6+_0x375914(0x2b4),()=>_0x49d355[_0x375914(0x30b)][_0x375914(0x274)](_0x4a05f6),{'verbose':_0x4c5339[_0x375914(0x2da)]}),_0xce0597=_0x3f99d6[_0x375914(0x267)];if(existsSync(_0x2c5e28)){const _0x907c93=readFileSync(_0x2c5e28,_0x375914(0x2f7)),_0x2a12ba=generateDiff(_0x907c93,_0xce0597);if(!hasChanges(_0x2a12ba))console['error'](a23_0x1b60d0[_0x375914(0x28a)]('✔')+_0x375914(0x302)+a23_0x1b60d0['cyan'](_0x2c5e28)+'\x20is\x20already\x20up\x20to\x20date');else{console['error']('\x0aChanges\x20to\x20\x27'+_0x2c5e28+'\x27:'),console[_0x375914(0x300)]('─'[_0x375914(0x21e)](0x3c)),console[_0x375914(0x300)](formatDiffWithColors(_0x2a12ba)),console['error']('─'[_0x375914(0x21e)](0x3c));if(!_0x4c5339[_0x375914(0x202)]){const _0x12c804=await confirmKey(_0x375914(0x241)+_0x2c5e28+'\x27?');if(!_0x12c804)return console[_0x375914(0x300)](_0x375914(0x2f6)),0x1;}writeFileSync(_0x2c5e28,_0xce0597,_0x375914(0x2f7)),console[_0x375914(0x300)](a23_0x1b60d0['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x1b60d0['cyan'](_0x2c5e28));}}else{const _0x1ccb22=a23_0x4959a7['dirname'](_0x2c5e28);!existsSync(_0x1ccb22)&&mkdirSync(_0x1ccb22,{'recursive':!![]}),writeFileSync(_0x2c5e28,_0xce0597,_0x375914(0x2f7)),console[_0x375914(0x300)](a23_0x1b60d0[_0x375914(0x28a)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x1b60d0[_0x375914(0x2eb)](_0x2c5e28));}return saveSessionContext({'parent_segment':_0x4a05f6},_0x4c5339[_0x375914(0x2a0)]),console[_0x375914(0x300)](a23_0x1b60d0[_0x375914(0x28a)]('✔')+_0x375914(0x243)+a23_0x1b60d0[_0x375914(0x1ff)]('parent_segment')+_0x375914(0x265)+a23_0x1b60d0[_0x375914(0x2eb)](_0x4a05f6)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x254);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x24b);async['execute'](_0x437a77){const _0x19b801=a23_0x38ac8f,{options:_0x136c6c,args:_0x4b3129,tdx:_0x4d27f9}=_0x437a77,_0x3bd5a8=_0x136c6c,_0x4503f9=_0x4b3129[0x0]||_0x136c6c[_0x19b801(0x258)];if(!_0x4503f9)return showParentSegmentNotSetError(_0x19b801(0x1fe)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x510d3f=resolveYamlFile(_0x4503f9);if(!existsSync(_0x510d3f))return showFileNotFoundError(_0x510d3f,_0x4503f9),0x1;_0x3bd5a8[_0x19b801(0x2da)]&&(console[_0x19b801(0x300)](_0x19b801(0x2d1)+_0x3bd5a8[_0x19b801(0x282)]),console['error']('YAML\x20file:\x20'+_0x510d3f));let _0x254823;try{_0x254823=readFileSync(_0x510d3f,'utf-8');}catch(_0x3a9a09){const _0x7fdd8a=_0x3a9a09 instanceof Error?_0x3a9a09[_0x19b801(0x20f)]:String(_0x3a9a09);return console[_0x19b801(0x300)](_0x19b801(0x2c1)+_0x7fdd8a),0x1;}const _0x3eac17=await withSpinner('Analyzing\x20changes...',()=>_0x4d27f9[_0x19b801(0x30b)][_0x19b801(0x306)](_0x254823),{'verbose':_0x3bd5a8[_0x19b801(0x2da)]}),_0x19dee0=_0x3eac17[_0x19b801(0x267)],{isNew:_0x3be344,name:_0xe1f25c,hasChanges:_0x408509,diffFormatted:_0x3beaa1}=_0x19dee0;if(!_0x408509)return console[_0x19b801(0x300)](_0x19b801(0x248)+_0xe1f25c+_0x19b801(0x1e2)),0x0;_0x3be344?console['error'](_0x19b801(0x249)+_0xe1f25c+'\x27:'):console[_0x19b801(0x300)](_0x19b801(0x2de)+_0xe1f25c+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x19b801(0x300)](_0x3beaa1),console[_0x19b801(0x300)]('─'[_0x19b801(0x21e)](0x3c));const _0x481507=_0x3be344?_0x19b801(0x1fa)+_0xe1f25c+'\x27?':_0x19b801(0x214)+_0xe1f25c+'\x27?';if(!_0x3bd5a8['yes']){const _0x49b31d=await confirmKey(_0x481507);if(!_0x49b31d)return console['error'](_0x19b801(0x2f6)),0x1;}const _0x285e90=_0x3be344?_0x19b801(0x2f1):'Updating',_0x6c17e=await withSpinner(_0x285e90+_0x19b801(0x1f9)+_0xe1f25c+_0x19b801(0x2b4),()=>_0x19dee0['apply'](),{'verbose':_0x3bd5a8['verbose']}),_0x4cbd34=_0x6c17e[_0x19b801(0x267)],_0x18d34e=getConsoleNextUrl(_0x3bd5a8[_0x19b801(0x282)],_0x19b801(0x2bb)+_0x4cbd34['id']),_0x2724b7=_0x3be344?_0x19b801(0x252):_0x19b801(0x247);return console['error']('✔\x20'+_0x2724b7+_0x19b801(0x1f9)+_0x4cbd34['name']+'\x27'),console[_0x19b801(0x300)]('\x20\x20'+_0x18d34e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x38ac8f(0x21b);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x303);async[a23_0x38ac8f(0x304)](_0x2874a8){const _0x445b11=a23_0x38ac8f,{options:_0x50520b,args:_0x8d4e1f,tdx:_0x3b80d2}=_0x2874a8,_0x438f41=_0x50520b,_0x394c0c=_0x8d4e1f[0x0]||_0x50520b['parentSegment'];if(!_0x394c0c)return showParentSegmentNotSetError(_0x445b11(0x26b)+_0x445b11(0x262)+_0x445b11(0x276)+_0x445b11(0x26f)+_0x445b11(0x2e1)+_0x445b11(0x2fc)),0x1;const _0x19c74a=resolveYamlFile(_0x394c0c);if(!existsSync(_0x19c74a))return showFileNotFoundError(_0x19c74a,_0x394c0c),0x1;_0x438f41[_0x445b11(0x2da)]&&(console[_0x445b11(0x300)]('Site:\x20'+_0x438f41[_0x445b11(0x282)]),console[_0x445b11(0x300)]('YAML\x20file:\x20'+_0x19c74a));let _0x541287;try{_0x541287=readFileSync(_0x19c74a,_0x445b11(0x2f7));}catch(_0x1bc5b9){const _0x3593ce=_0x1bc5b9 instanceof Error?_0x1bc5b9[_0x445b11(0x20f)]:String(_0x1bc5b9);return console[_0x445b11(0x300)](_0x445b11(0x2c1)+_0x3593ce),0x1;}const _0x3addc5=createCommandSpinner(a23_0x1b60d0[_0x445b11(0x1ff)]('Validating\x20configuration...'),{'verbose':_0x438f41['verbose']});_0x3addc5[_0x445b11(0x1fc)]();const _0x54580c={'onProgress':_0x273fcf=>{const _0x19b48b=_0x445b11;_0x3addc5[_0x19b48b(0x2c8)]=formatProgressMessage(_0x273fcf);}};if(_0x438f41['master'])_0x54580c[_0x445b11(0x309)]=!![];if(_0x438f41[_0x445b11(0x295)])_0x54580c[_0x445b11(0x295)]=!![];_0x438f41[_0x445b11(0x26a)]&&(_0x54580c[_0x445b11(0x26a)]=_0x438f41['attribute']);_0x438f41[_0x445b11(0x2f9)]&&(_0x54580c[_0x445b11(0x2f9)]=_0x438f41[_0x445b11(0x2f9)]);if(_0x438f41[_0x445b11(0x1f6)])_0x54580c[_0x445b11(0x1f6)]=_0x438f41[_0x445b11(0x1f6)];let _0x3b8ccc;try{_0x3b8ccc=await _0x3b80d2['segment'][_0x445b11(0x205)](_0x541287,_0x54580c),_0x3addc5['stop']();}catch(_0x1dce1b){_0x3addc5[_0x445b11(0x273)]();throw _0x1dce1b;}const _0x59bdbc=_0x438f41['interval']||_0x445b11(0x2c9);return this['displayValidateResults'](_0x3b8ccc,_0x54580c,_0x19c74a,_0x59bdbc),_0x3b8ccc['allValid']?0x0:0x1;}[a23_0x38ac8f(0x2d6)](_0x2ce5a1,_0xd56e2c,_0x572e7a,_0x20984f){const _0x5d4228=a23_0x38ac8f;console[_0x5d4228(0x300)]('\x0a'+a23_0x1b60d0[_0x5d4228(0x206)](_0x5d4228(0x2c0))+'\x20'+_0x2ce5a1['name']),console[_0x5d4228(0x300)]('═'[_0x5d4228(0x21e)](0x3c)),this[_0x5d4228(0x2ad)](_0x2ce5a1);if(typeof _0xd56e2c[_0x5d4228(0x26a)]==='string'){this['displayAttributesStats'](_0x2ce5a1),this[_0x5d4228(0x21c)](_0x2ce5a1),this[_0x5d4228(0x2cb)](_0x572e7a,_0x20984f,'attribute',_0xd56e2c['attribute']);return;}if(_0xd56e2c['attribute']===!![]){this[_0x5d4228(0x219)](_0x2ce5a1),this[_0x5d4228(0x21c)](_0x2ce5a1),this[_0x5d4228(0x2cb)](_0x572e7a,_0x20984f,_0x5d4228(0x210));return;}if(typeof _0xd56e2c['behavior']===_0x5d4228(0x22d)){this[_0x5d4228(0x2d4)](_0x2ce5a1,_0x20984f),this[_0x5d4228(0x21c)](_0x2ce5a1),this[_0x5d4228(0x2cb)](_0x572e7a,_0x20984f,_0x5d4228(0x2f9),_0xd56e2c['behavior']);return;}if(_0xd56e2c['behavior']===!![]){this[_0x5d4228(0x2d4)](_0x2ce5a1,_0x20984f),this['displaySummary'](_0x2ce5a1),this['displayPreviewHints'](_0x572e7a,_0x20984f,'behaviors');return;}this[_0x5d4228(0x219)](_0x2ce5a1),this['displayBehaviorsStats'](_0x2ce5a1,_0x20984f),this[_0x5d4228(0x21c)](_0x2ce5a1),this[_0x5d4228(0x2cb)](_0x572e7a,_0x20984f,'all');}[a23_0x38ac8f(0x2cb)](_0x2987eb,_0x4759c0,_0x4b55c2,_0x5a9746){const _0x3de8f9=a23_0x38ac8f;console[_0x3de8f9(0x300)]('\x0a'+a23_0x1b60d0[_0x3de8f9(0x1ff)](_0x3de8f9(0x231)));const _0x5a2269=_0x4759c0!=='-1d'?_0x3de8f9(0x2c6)+_0x4759c0:'';if(_0x4b55c2==='attribute'&&_0x5a9746)console[_0x3de8f9(0x300)]('\x20\x20'+a23_0x1b60d0['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x2987eb+'\x20--attribute\x20\x22'+_0x5a9746+'\x22'+_0x5a2269));else{if(_0x4b55c2==='behavior'&&_0x5a9746)console[_0x3de8f9(0x300)]('\x20\x20'+a23_0x1b60d0[_0x3de8f9(0x1ff)](_0x3de8f9(0x281)+_0x2987eb+'\x20--behavior\x20\x22'+_0x5a9746+'\x22'+_0x5a2269));else(_0x4b55c2==='attributes'||_0x4b55c2===_0x3de8f9(0x289))&&console[_0x3de8f9(0x300)]('\x20\x20'+a23_0x1b60d0[_0x3de8f9(0x1ff)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2987eb+_0x3de8f9(0x25c)+_0x5a2269));}(_0x4b55c2===_0x3de8f9(0x251)||_0x4b55c2==='all')&&console[_0x3de8f9(0x300)]('\x20\x20'+a23_0x1b60d0[_0x3de8f9(0x1ff)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2987eb+_0x3de8f9(0x30e)+_0x5a2269)),_0x4b55c2==='all'&&console[_0x3de8f9(0x300)]('\x20\x20'+a23_0x1b60d0[_0x3de8f9(0x1ff)](_0x3de8f9(0x281)+_0x2987eb+_0x3de8f9(0x2ca)+_0x5a2269));}[a23_0x38ac8f(0x2ad)](_0x2844ca){const _0x58efbe=a23_0x38ac8f,{master:_0x3dc610}=_0x2844ca,_0x41f8fd=_0x3dc610[_0x58efbe(0x213)]?a23_0x1b60d0[_0x58efbe(0x28a)]('✔'):a23_0x1b60d0[_0x58efbe(0x24d)]('✘');console[_0x58efbe(0x300)]('\x0a'+a23_0x1b60d0[_0x58efbe(0x1ff)](_0x58efbe(0x2a9))),console[_0x58efbe(0x300)](_0x41f8fd+'\x20'+a23_0x1b60d0[_0x58efbe(0x206)](_0x3dc610[_0x58efbe(0x25b)]+'.'+_0x3dc610['table'])),_0x3dc610[_0x58efbe(0x213)]?_0x3dc610['rowCount']!==undefined&&console[_0x58efbe(0x300)]('\x20\x20'+a23_0x1b60d0[_0x58efbe(0x1ff)](_0x58efbe(0x22f))+'\x20'+a23_0x1b60d0['cyan'](formatRows(_0x3dc610[_0x58efbe(0x224)]))):console[_0x58efbe(0x300)]('\x20\x20'+a23_0x1b60d0[_0x58efbe(0x24d)](_0x58efbe(0x263))+'\x20'+_0x3dc610[_0x58efbe(0x30f)]);}[a23_0x38ac8f(0x219)](_0x3715af){const _0x113208=a23_0x38ac8f;if(_0x3715af[_0x113208(0x210)][_0x113208(0x1ed)]===0x0)return;console['error']('\x0a'+a23_0x1b60d0[_0x113208(0x1ff)](_0x113208(0x23f)));for(const _0x29de76 of _0x3715af[_0x113208(0x210)]){const _0x368f81=_0x29de76['schemaValid']?a23_0x1b60d0['green']('✔'):a23_0x1b60d0['red']('✘');let _0x3f06bc='';if(_0x29de76['schemaValid']&&_0x29de76[_0x113208(0x285)]!==undefined&&_0x29de76[_0x113208(0x236)]!==undefined){const _0x10ac16=_0x29de76[_0x113208(0x236)][_0x113208(0x21d)](0x1),_0x1b08fe=_0x29de76[_0x113208(0x236)]>=0x50?a23_0x1b60d0['green']:_0x29de76[_0x113208(0x236)]>=0x32?a23_0x1b60d0['yellow']:a23_0x1b60d0[_0x113208(0x24d)];_0x3f06bc='\x20'+a23_0x1b60d0[_0x113208(0x1ff)](_0x113208(0x2b9))+'\x20'+_0x1b08fe(_0x10ac16+'%')+'\x20('+formatRows(_0x29de76[_0x113208(0x285)])+'\x20rows)';}console[_0x113208(0x300)](_0x368f81+'\x20'+a23_0x1b60d0['bold'](_0x29de76['name'])+_0x3f06bc),console[_0x113208(0x300)]('\x20\x20'+a23_0x1b60d0[_0x113208(0x1ff)](_0x113208(0x1e7))+'\x20'+a23_0x1b60d0[_0x113208(0x206)](_0x29de76[_0x113208(0x25b)]+'.'+_0x29de76[_0x113208(0x286)]));const _0x4f62a9=_0x29de76[_0x113208(0x2c3)]===_0x29de76[_0x113208(0x290)]?a23_0x1b60d0[_0x113208(0x1ff)](_0x113208(0x2e4))+'\x20'+_0x29de76[_0x113208(0x2c3)]:a23_0x1b60d0[_0x113208(0x1ff)](_0x113208(0x26e))+'\x20'+_0x29de76[_0x113208(0x2c3)]+'\x20=\x20'+_0x29de76['foreignKey'];console[_0x113208(0x300)]('\x20\x20'+_0x4f62a9),console[_0x113208(0x300)]('\x20\x20'+a23_0x1b60d0[_0x113208(0x1ff)](_0x113208(0x2b5))),this[_0x113208(0x27c)](_0x29de76[_0x113208(0x2a7)]),!_0x29de76[_0x113208(0x213)]&&console[_0x113208(0x300)]('\x20\x20'+a23_0x1b60d0['red'](_0x113208(0x263))+'\x20'+_0x29de76['schemaError']);}}[a23_0x38ac8f(0x2d4)](_0x5bb485,_0x2991f3){const _0x157538=a23_0x38ac8f;if(_0x5bb485[_0x157538(0x251)][_0x157538(0x1ed)]===0x0)return;console['error']('\x0a'+a23_0x1b60d0[_0x157538(0x1ff)](_0x157538(0x2cd))+'\x20'+a23_0x1b60d0[_0x157538(0x1ff)]('('+_0x2991f3+')'));for(const _0x35d4a2 of _0x5bb485[_0x157538(0x251)]){const _0x4214d7=_0x35d4a2[_0x157538(0x213)]?a23_0x1b60d0[_0x157538(0x28a)]('✔'):a23_0x1b60d0[_0x157538(0x24d)]('✘');let _0x2d4e0c='';if(_0x35d4a2['schemaValid']&&_0x35d4a2[_0x157538(0x2c2)]!==undefined&&_0x35d4a2[_0x157538(0x237)]!==undefined){const _0x4cf840=_0x35d4a2[_0x157538(0x2ed)]?.[_0x157538(0x21d)](0x1)||'?',_0x800041=(_0x35d4a2[_0x157538(0x2ed)]??0x0)>=0x32?a23_0x1b60d0[_0x157538(0x28a)]:(_0x35d4a2['customerPercent']??0x0)>=0x14?a23_0x1b60d0['yellow']:a23_0x1b60d0['red'];_0x2d4e0c='\x20'+a23_0x1b60d0[_0x157538(0x1ff)](_0x157538(0x1f2))+'\x20'+_0x800041(formatRows(_0x35d4a2[_0x157538(0x2c2)]))+'\x20('+_0x4cf840+_0x157538(0x2b1)+a23_0x1b60d0[_0x157538(0x1ff)]('Events:')+'\x20'+a23_0x1b60d0[_0x157538(0x2eb)](formatRows(_0x35d4a2[_0x157538(0x237)]));}console['error'](_0x4214d7+'\x20'+a23_0x1b60d0[_0x157538(0x206)](_0x35d4a2[_0x157538(0x208)])+_0x2d4e0c),console[_0x157538(0x300)]('\x20\x20'+a23_0x1b60d0[_0x157538(0x1ff)](_0x157538(0x1e7))+'\x20'+a23_0x1b60d0[_0x157538(0x206)](_0x35d4a2['database']+'.'+_0x35d4a2['table']));const _0x462f27=_0x35d4a2['joinKey']===_0x35d4a2['foreignKey']?a23_0x1b60d0['dim'](_0x157538(0x2e4))+'\x20'+_0x35d4a2[_0x157538(0x2c3)]:a23_0x1b60d0[_0x157538(0x1ff)](_0x157538(0x26e))+'\x20'+_0x35d4a2['joinKey']+'\x20=\x20'+_0x35d4a2[_0x157538(0x290)];console[_0x157538(0x300)]('\x20\x20'+_0x462f27),console['error']('\x20\x20'+a23_0x1b60d0[_0x157538(0x1ff)]('Columns:')),this['displayColumns'](_0x35d4a2[_0x157538(0x2a7)]),!_0x35d4a2['schemaValid']&&console[_0x157538(0x300)]('\x20\x20'+a23_0x1b60d0[_0x157538(0x24d)](_0x157538(0x263))+'\x20'+_0x35d4a2[_0x157538(0x30f)]);}}[a23_0x38ac8f(0x27c)](_0x40f9ef){const _0x2bfc09=a23_0x38ac8f;for(const _0x3128f0 of _0x40f9ef){_0x3128f0[_0x2bfc09(0x2d5)]===_0x3128f0[_0x2bfc09(0x227)]||_0x3128f0[_0x2bfc09(0x227)]==='*'?console[_0x2bfc09(0x300)](_0x2bfc09(0x22b)+_0x3128f0['label']):console[_0x2bfc09(0x300)](_0x2bfc09(0x22b)+_0x3128f0[_0x2bfc09(0x2d5)]+'\x20'+a23_0x1b60d0[_0x2bfc09(0x1ff)]('('+_0x3128f0['column']+')'));}}['displaySummary'](_0x45b179){const _0x3c9306=a23_0x38ac8f;console[_0x3c9306(0x300)]('─'[_0x3c9306(0x21e)](0x3c));if(_0x45b179[_0x3c9306(0x1ee)]['length']>0x0){console[_0x3c9306(0x300)]('\x0a'+a23_0x1b60d0[_0x3c9306(0x24d)]('Errors:'));for(const _0x46cade of _0x45b179[_0x3c9306(0x1ee)]){console[_0x3c9306(0x300)]('\x20\x20'+a23_0x1b60d0[_0x3c9306(0x24d)]('•')+'\x20'+_0x46cade);}}_0x45b179[_0x3c9306(0x30a)]&&console[_0x3c9306(0x300)]('\x0a'+a23_0x1b60d0[_0x3c9306(0x28a)]('✔')+_0x3c9306(0x228));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x2ac);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x2bf);async[a23_0x38ac8f(0x304)](_0x2360da){const _0x11a162=a23_0x38ac8f,{options:_0x4fe89f,args:_0x305aa7,tdx:_0x47f059}=_0x2360da,_0x2c2454=_0x4fe89f,_0x4fac25=_0x305aa7[0x0]||_0x4fe89f[_0x11a162(0x258)];if(!_0x4fac25)return showParentSegmentNotSetError(_0x11a162(0x23a)+_0x11a162(0x288)+_0x11a162(0x211)+_0x11a162(0x2e5)+_0x11a162(0x27a)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x11a162(0x2fc)),0x1;if(!_0x2c2454[_0x11a162(0x309)]&&!_0x2c2454[_0x11a162(0x26a)]&&!_0x2c2454[_0x11a162(0x2f9)]&&!_0x2c2454[_0x11a162(0x295)])return console[_0x11a162(0x300)](a23_0x1b60d0[_0x11a162(0x24d)](_0x11a162(0x244))),console[_0x11a162(0x300)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x11a162(0x250)),console[_0x11a162(0x300)](_0x11a162(0x293)),console[_0x11a162(0x300)](_0x11a162(0x1f1)),console[_0x11a162(0x300)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x11a162(0x300)](_0x11a162(0x24f)),0x1;const _0x3bc897=resolveYamlFile(_0x4fac25);if(!existsSync(_0x3bc897))return showFileNotFoundError(_0x3bc897,_0x4fac25),0x1;_0x2c2454[_0x11a162(0x2da)]&&(console[_0x11a162(0x300)](_0x11a162(0x2d1)+_0x2c2454[_0x11a162(0x282)]),console[_0x11a162(0x300)]('YAML\x20file:\x20'+_0x3bc897));let _0x42c09f;try{_0x42c09f=readFileSync(_0x3bc897,_0x11a162(0x2f7));}catch(_0x323973){const _0x5b244c=_0x323973 instanceof Error?_0x323973['message']:String(_0x323973);return console['error'](_0x11a162(0x2c1)+_0x5b244c),0x1;}let _0x34e3a1;try{_0x34e3a1=parseDef(_0x42c09f);}catch(_0x44321f){const _0xece319=_0x44321f instanceof Error?_0x44321f[_0x11a162(0x20f)]:String(_0x44321f);return console[_0x11a162(0x300)](a23_0x1b60d0[_0x11a162(0x24d)]('Error\x20parsing\x20YAML:\x20'+_0xece319)),0x1;}if(_0x2c2454['attribute']===!![]||_0x2c2454['attribute']===''){const _0x180f4e=_0x34e3a1[_0x11a162(0x210)]?.[_0x11a162(0x242)](_0x37a2fd=>_0x37a2fd[_0x11a162(0x208)])||[];if(_0x180f4e[_0x11a162(0x1ed)]===0x0)console[_0x11a162(0x300)](a23_0x1b60d0[_0x11a162(0x24d)](_0x11a162(0x2e7)));else{console[_0x11a162(0x300)](a23_0x1b60d0['red'](_0x11a162(0x217))),console[_0x11a162(0x300)](_0x11a162(0x238));for(const _0x4cf7eb of _0x180f4e){console['error']('\x20\x20'+a23_0x1b60d0['cyan'](_0x4cf7eb));}console['error'](_0x11a162(0x2a2)+_0x4fac25+_0x11a162(0x2b2)+_0x180f4e[0x0]+'\x22');}return 0x1;}if(_0x2c2454[_0x11a162(0x2f9)]===!![]||_0x2c2454['behavior']===''){const _0x165159=_0x34e3a1[_0x11a162(0x251)]?.['map'](_0x56be71=>_0x56be71[_0x11a162(0x208)])||[];if(_0x165159[_0x11a162(0x1ed)]===0x0)console[_0x11a162(0x300)](a23_0x1b60d0[_0x11a162(0x24d)](_0x11a162(0x2b6)));else{console[_0x11a162(0x300)](a23_0x1b60d0[_0x11a162(0x24d)](_0x11a162(0x2af))),console['error'](_0x11a162(0x212));for(const _0x140e93 of _0x165159){console[_0x11a162(0x300)]('\x20\x20'+a23_0x1b60d0[_0x11a162(0x2eb)](_0x140e93));}console['error'](_0x11a162(0x2a2)+_0x4fac25+'\x20--behavior\x20\x22'+_0x165159[0x0]+'\x22');}return 0x1;}const _0x7a6a7a=createCommandSpinner(a23_0x1b60d0[_0x11a162(0x1ff)](_0x11a162(0x207)),{'verbose':_0x2c2454['verbose']});_0x7a6a7a[_0x11a162(0x1fc)]();const _0x3a5728={'onProgress':_0x1acd82=>{_0x7a6a7a['text']=formatProgressMessage(_0x1acd82);}};if(_0x2c2454['master'])_0x3a5728['master']=!![];if(_0x2c2454[_0x11a162(0x26a)]&&typeof _0x2c2454[_0x11a162(0x26a)]===_0x11a162(0x22d))_0x3a5728[_0x11a162(0x26a)]=_0x2c2454[_0x11a162(0x26a)];if(_0x2c2454[_0x11a162(0x2f9)]&&typeof _0x2c2454[_0x11a162(0x2f9)]===_0x11a162(0x22d))_0x3a5728[_0x11a162(0x2f9)]=_0x2c2454[_0x11a162(0x2f9)];if(_0x2c2454[_0x11a162(0x295)])_0x3a5728[_0x11a162(0x295)]=!![];if(_0x2c2454[_0x11a162(0x1f6)])_0x3a5728[_0x11a162(0x1f6)]=_0x2c2454['interval'];let _0x56d954;try{_0x56d954=await _0x47f059[_0x11a162(0x30b)][_0x11a162(0x2e9)](_0x42c09f,_0x3a5728),_0x7a6a7a[_0x11a162(0x273)]();}catch(_0x4dfdea){_0x7a6a7a[_0x11a162(0x273)]();throw _0x4dfdea;}return await this[_0x11a162(0x257)](_0x56d954,{'master':_0x2c2454[_0x11a162(0x309)],'attribute':typeof _0x2c2454['attribute']==='string'?_0x2c2454['attribute']:undefined,'behavior':typeof _0x2c2454[_0x11a162(0x2f9)]===_0x11a162(0x22d)?_0x2c2454[_0x11a162(0x2f9)]:undefined,'enriched':_0x2c2454[_0x11a162(0x295)]}),_0x56d954[_0x11a162(0x30a)]?0x0:0x1;}async[a23_0x38ac8f(0x257)](_0xb0fb85,_0x2e056a){const _0x54f2ed=a23_0x38ac8f;console['error']('\x0a'+a23_0x1b60d0[_0x54f2ed(0x206)](_0x54f2ed(0x2bd))+'\x20'+_0xb0fb85[_0x54f2ed(0x208)]),console['error']('═'[_0x54f2ed(0x21e)](0x3c));if(_0x2e056a[_0x54f2ed(0x309)]&&_0xb0fb85[_0x54f2ed(0x2e6)]){const _0x3fb739=a23_0x1b60d0[_0x54f2ed(0x1ff)](_0x54f2ed(0x2c4))+'\x20'+a23_0x1b60d0[_0x54f2ed(0x206)](_0xb0fb85[_0x54f2ed(0x309)][_0x54f2ed(0x25b)]+'.'+_0xb0fb85[_0x54f2ed(0x309)][_0x54f2ed(0x286)]);await this[_0x54f2ed(0x2fa)](_0x3fb739,_0xb0fb85[_0x54f2ed(0x2e6)]);}else{if(_0x2e056a[_0x54f2ed(0x26a)]&&_0xb0fb85['sampleData']){const _0x7eb77=a23_0x1b60d0[_0x54f2ed(0x1ff)](_0x54f2ed(0x1f0))+'\x20'+a23_0x1b60d0[_0x54f2ed(0x206)](_0x2e056a[_0x54f2ed(0x26a)]);await this[_0x54f2ed(0x2fa)](_0x7eb77,_0xb0fb85[_0x54f2ed(0x2e6)]);}else{if(_0x2e056a[_0x54f2ed(0x2f9)]&&_0xb0fb85[_0x54f2ed(0x2e6)]){const _0xd78c45=a23_0x1b60d0[_0x54f2ed(0x1ff)](_0x54f2ed(0x2c7))+'\x20'+a23_0x1b60d0[_0x54f2ed(0x206)](_0x2e056a[_0x54f2ed(0x2f9)]);await this[_0x54f2ed(0x2fa)](_0xd78c45,_0xb0fb85[_0x54f2ed(0x2e6)]);}else{if(_0x2e056a[_0x54f2ed(0x295)]&&_0xb0fb85[_0x54f2ed(0x2e6)]){const _0x1ef835=a23_0x1b60d0[_0x54f2ed(0x1ff)](_0x54f2ed(0x2b3))+'\x20'+a23_0x1b60d0[_0x54f2ed(0x206)](_0x54f2ed(0x2ae));await this[_0x54f2ed(0x2fa)](_0x1ef835,_0xb0fb85['sampleData']);}else!_0xb0fb85['sampleData']&&console['error'](_0x54f2ed(0x239));}}}if(_0xb0fb85[_0x54f2ed(0x1ee)][_0x54f2ed(0x1ed)]>0x0){console[_0x54f2ed(0x300)]('─'[_0x54f2ed(0x21e)](0x3c)),console['error']('\x0a'+a23_0x1b60d0[_0x54f2ed(0x24d)]('Errors:'));for(const _0x318d63 of _0xb0fb85[_0x54f2ed(0x1ee)]){console['error']('\x20\x20'+a23_0x1b60d0['red']('•')+'\x20'+_0x318d63);}}}async[a23_0x38ac8f(0x2fa)](_0x3d9ec3,_0x2e6677){const _0x5a2622=a23_0x38ac8f;if(_0x2e6677[_0x5a2622(0x1ed)]===0x0){console[_0x5a2622(0x300)]('\x0a'+_0x3d9ec3),console[_0x5a2622(0x300)](_0x5a2622(0x2b8));return;}console[_0x5a2622(0x300)]('\x0a'+_0x3d9ec3);const _0x5f0abf=Object[_0x5a2622(0x2aa)](_0x2e6677[0x0])[_0x5a2622(0x242)](_0x1da7e5=>({'name':_0x1da7e5,'type':typeof _0x2e6677[0x0][_0x1da7e5]===_0x5a2622(0x222)?_0x5a2622(0x22e):_0x5a2622(0x1e3)})),_0x441dcd={'queryId':_0x5a2622(0x20d),'columns':_0x5f0abf,'data':_0x2e6677,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2e6677['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x165513=formatAsTable(_0x441dcd,_0x2e6677['length'],!![]);await writeOutput(_0x165513,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x23e);[a23_0x38ac8f(0x2ec)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a23_0x38ac8f(0x304)](_0x22bce1){const _0x16eead=a23_0x38ac8f,{options:_0x177559,args:_0x1d6c81,tdx:_0x3d104c}=_0x22bce1,_0x1dc8b5=_0x177559,_0x447582=_0x1d6c81[0x0]||_0x177559[_0x16eead(0x258)];if(!_0x447582)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'+_0x16eead(0x1eb)),0x1;const _0x1f6dbc=resolveYamlFile(_0x447582);if(existsSync(_0x1f6dbc)){_0x1dc8b5[_0x16eead(0x2da)]&&console[_0x16eead(0x300)](_0x16eead(0x2ee)+_0x1f6dbc);let _0x3ac86e;try{_0x3ac86e=readFileSync(_0x1f6dbc,_0x16eead(0x2f7));}catch(_0x373e74){const _0x292f21=_0x373e74 instanceof Error?_0x373e74[_0x16eead(0x20f)]:String(_0x373e74);return console['error'](_0x16eead(0x2c1)+_0x292f21),0x1;}const _0x1dc0bc=await withSpinner(_0x16eead(0x235),()=>_0x3d104c[_0x16eead(0x30b)][_0x16eead(0x306)](_0x3ac86e),{'verbose':_0x1dc8b5[_0x16eead(0x2da)]}),_0x2a5646=_0x1dc0bc[_0x16eead(0x267)],{isNew:_0x2554f2,name:_0x52c46d,hasChanges:_0x542913,diffFormatted:_0x22fd3e}=_0x2a5646;if(_0x542913){_0x2554f2?console[_0x16eead(0x300)](_0x16eead(0x249)+_0x52c46d+'\x27:'):console[_0x16eead(0x300)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x52c46d+'\x27:');console[_0x16eead(0x300)]('─'[_0x16eead(0x21e)](0x3c)),console[_0x16eead(0x300)](_0x22fd3e),console[_0x16eead(0x300)]('─'[_0x16eead(0x21e)](0x3c));const _0x1865eb=_0x2554f2?_0x16eead(0x1fa)+_0x52c46d+_0x16eead(0x28b):_0x16eead(0x214)+_0x52c46d+'\x27\x20and\x20run\x20workflow?';if(!_0x1dc8b5['yes']){const _0x4c3a09=await confirmKey(_0x1865eb);if(!_0x4c3a09)return console[_0x16eead(0x300)](_0x16eead(0x2f6)),0x1;}const _0x4e0130=_0x2554f2?_0x16eead(0x2f1):_0x16eead(0x296);await withSpinner(_0x4e0130+_0x16eead(0x1f9)+_0x52c46d+_0x16eead(0x2b4),()=>_0x2a5646['apply'](),{'verbose':_0x1dc8b5['verbose']});const _0x12c674=_0x2554f2?'Created':_0x16eead(0x247);console[_0x16eead(0x300)]('✔\x20'+_0x12c674+_0x16eead(0x1f9)+_0x52c46d+'\x27');}else console[_0x16eead(0x300)]('✔\x20No\x20changes\x20-\x20\x27'+_0x52c46d+'\x27\x20is\x20up\x20to\x20date');}const _0x2234a7=await withSpinner(_0x16eead(0x277)+_0x447582+_0x16eead(0x2b4),()=>_0x3d104c['segment'][_0x16eead(0x287)](_0x447582),{'verbose':_0x1dc8b5[_0x16eead(0x2da)]}),_0x55fb7e=_0x2234a7[_0x16eead(0x267)],_0x4bd5f9=getConsoleUrl(_0x1dc8b5[_0x16eead(0x282)],_0x16eead(0x23c)+_0x55fb7e[_0x16eead(0x2ab)]+_0x16eead(0x301)+_0x55fb7e[_0x16eead(0x2f8)]+_0x16eead(0x221)+_0x55fb7e['workflowAttemptId']);return console[_0x16eead(0x300)](_0x16eead(0x215)),console['error']('\x20\x20'+a23_0x1b60d0['dim']('Audience\x20ID:')+'\x20'+_0x55fb7e['audienceId']),console[_0x16eead(0x300)]('\x20\x20'+a23_0x1b60d0[_0x16eead(0x1ff)](_0x16eead(0x2a4))+'\x20'+_0x55fb7e['status']),console[_0x16eead(0x300)]('\x20\x20'+a23_0x1b60d0['dim'](_0x16eead(0x246))+'\x20'+_0x55fb7e['workflowSessionId']),console['error']('\x20\x20'+a23_0x1b60d0[_0x16eead(0x1ff)]('Attempt:')+'\x20'+_0x55fb7e[_0x16eead(0x271)]),console['error']('\x20\x20'+_0x4bd5f9),console[_0x16eead(0x300)]('\x0a'+a23_0x1b60d0[_0x16eead(0x1ff)](_0x16eead(0x28f))+_0x16eead(0x2d7)+_0x55fb7e[_0x16eead(0x271)]+_0x16eead(0x234)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x25e);['description']='List\x20available\x20fields\x20for\x20segmentation';async[a23_0x38ac8f(0x304)](_0x1d0b25){const _0x2e93ac=a23_0x38ac8f,{options:_0x288746,args:_0x4fedee,tdx:_0x211488}=_0x1d0b25,_0x5540ae=_0x4fedee[0x0]||_0x288746[_0x2e93ac(0x258)];if(!_0x5540ae)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x2e93ac(0x20a)),0x1;_0x288746['verbose']&&(console[_0x2e93ac(0x300)](_0x2e93ac(0x2d1)+_0x288746[_0x2e93ac(0x282)]),console[_0x2e93ac(0x300)](_0x2e93ac(0x2d2)+_0x5540ae));const _0x5670f3=await withSpinner(_0x2e93ac(0x29d)+_0x5540ae+_0x2e93ac(0x2b4),()=>_0x211488[_0x2e93ac(0x30b)][_0x2e93ac(0x22c)](_0x5540ae),{'verbose':_0x288746[_0x2e93ac(0x2da)]}),_0x329be3=_0x5670f3[_0x2e93ac(0x267)];console['error'](_0x2e93ac(0x30c)+_0x329be3[_0x2e93ac(0x1ed)]+_0x2e93ac(0x279)+(_0x329be3[_0x2e93ac(0x1ed)]!==0x1?'s':''));if(_0x288746[_0x2e93ac(0x2e2)]||_0x288746[_0x2e93ac(0x2e8)])return await handleSDKOutput(_0x329be3,_0x288746),0x0;return displayFieldsHumanReadable(_0x329be3,_0x5540ae),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a23_0x38ac8f(0x255);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x2d8);async[a23_0x38ac8f(0x304)](_0xf43b81){const _0x3d0733=a23_0x38ac8f,{options:_0x43967d,args:_0x19d940,tdx:_0x43e577}=_0xf43b81,_0x240e45=_0x43967d,_0x1267b3=_0x19d940[0x0]||_0x43967d[_0x3d0733(0x258)];if(!_0x1267b3)return showParentSegmentNotSetError(_0x3d0733(0x284)+_0x3d0733(0x2a5)+_0x3d0733(0x276)+_0x3d0733(0x2dd)),0x1;_0x43967d[_0x3d0733(0x2da)]&&(console[_0x3d0733(0x300)](_0x3d0733(0x2d1)+_0x43967d[_0x3d0733(0x282)]),console[_0x3d0733(0x300)](_0x3d0733(0x2d2)+_0x1267b3));const _0x4680ae=await withSpinner(_0x3d0733(0x2f0)+_0x1267b3+'\x27...',()=>_0x43e577[_0x3d0733(0x30b)][_0x3d0733(0x2dc)](_0x1267b3),{'verbose':_0x43967d[_0x3d0733(0x2da)]}),_0x23e19e=_0x4680ae['data'];if(_0x240e45[_0x3d0733(0x26d)]){const _0x382be1=getConsoleNextUrl(_0x240e45['site'],_0x3d0733(0x2bb)+_0x23e19e['id']);return console[_0x3d0733(0x300)](a23_0x1b60d0[_0x3d0733(0x28a)]('✔')+_0x3d0733(0x229)+a23_0x1b60d0[_0x3d0733(0x2eb)](_0x382be1)),openBrowser(_0x382be1),0x0;}return await handleSingleObjectOutput(_0x23e19e,_0x43967d),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x2fd);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x2f4);async[a23_0x38ac8f(0x304)](_0x8a2b92){const _0x14ecbb=a23_0x38ac8f,{options:_0x25d95a,args:_0x150470,tdx:_0x6405d7}=_0x8a2b92,_0x55369a=_0x150470[0x0]||_0x25d95a[_0x14ecbb(0x258)];if(!_0x55369a)return showParentSegmentNotSetError(_0x14ecbb(0x24a)+_0x14ecbb(0x29e)),0x1;_0x25d95a['verbose']&&(console[_0x14ecbb(0x300)](_0x14ecbb(0x2d1)+_0x25d95a['site']),console[_0x14ecbb(0x300)]('Parent\x20segment:\x20'+_0x55369a));const _0x24164f=await withSpinner(_0x14ecbb(0x29a)+_0x55369a+_0x14ecbb(0x2b4),()=>_0x6405d7[_0x14ecbb(0x30b)][_0x14ecbb(0x25f)](_0x55369a),{'verbose':_0x25d95a['verbose']}),_0x481dbf=_0x24164f[_0x14ecbb(0x267)],_0x402a5f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x55369a+_0x14ecbb(0x2b4),()=>_0x6405d7[_0x14ecbb(0x30b)][_0x14ecbb(0x2f3)](_0x481dbf),{'verbose':_0x25d95a[_0x14ecbb(0x2da)]}),_0xfacdbe=await executeSchemaQuery(_0x402a5f[_0x14ecbb(0x267)],_0x6405d7,_0x25d95a);return await handleQueryOutput(_0xfacdbe,_0x25d95a),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x28c);[a23_0x38ac8f(0x2ec)]=a23_0x38ac8f(0x270);async['execute'](_0x53139d){const _0x3ba753=a23_0x38ac8f,{options:_0x395d25,args:_0x9f93d3,tdx:_0x22cc8a}=_0x53139d,_0x294078=_0x9f93d3[0x0]||_0x395d25['parentSegment'];if(!_0x294078)return showParentSegmentNotSetError(_0x3ba753(0x2a3)+_0x3ba753(0x266)),0x1;_0x395d25[_0x3ba753(0x2da)]&&(console['error'](_0x3ba753(0x2d1)+_0x395d25[_0x3ba753(0x282)]),console[_0x3ba753(0x300)](_0x3ba753(0x2d2)+_0x294078));const _0x597e75=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x294078+_0x3ba753(0x2b4),()=>_0x22cc8a[_0x3ba753(0x30b)][_0x3ba753(0x25f)](_0x294078),{'verbose':_0x395d25['verbose']}),_0x59aa41=_0x597e75[_0x3ba753(0x267)],_0x23b76b=await withSpinner(_0x3ba753(0x204)+_0x294078+_0x3ba753(0x2b4),()=>_0x22cc8a[_0x3ba753(0x30b)]['getParentSQL'](_0x59aa41),{'verbose':_0x395d25[_0x3ba753(0x2da)]}),_0xe2d0fb=_0x23b76b['data'];return _0x395d25[_0x3ba753(0x2ea)]===_0x3ba753(0x2e2)||_0x395d25[_0x3ba753(0x2ea)]===_0x3ba753(0x2e8)?await handleSDKOutput([{'sql':_0xe2d0fb}],_0x395d25):console['log'](_0xe2d0fb),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x38ac8f(0x208)]=a23_0x38ac8f(0x305);['description']=a23_0x38ac8f(0x2bc);async[a23_0x38ac8f(0x304)](_0x4c7e8d){const _0x52b05b=a23_0x38ac8f,{options:_0x2409df,args:_0x156178,tdx:_0x2c6220}=_0x4c7e8d,_0x38923d=_0x156178[0x0]||_0x2409df[_0x52b05b(0x258)];if(!_0x38923d)return showParentSegmentNotSetError(_0x52b05b(0x1e4)+_0x52b05b(0x294)),0x1;_0x2409df[_0x52b05b(0x2da)]&&(console[_0x52b05b(0x300)](_0x52b05b(0x2d1)+_0x2409df[_0x52b05b(0x282)]),console[_0x52b05b(0x300)](_0x52b05b(0x2d2)+_0x38923d));const _0x40cda8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x38923d+_0x52b05b(0x2b4),()=>_0x2c6220[_0x52b05b(0x30b)]['resolveParentId'](_0x38923d),{'verbose':_0x2409df[_0x52b05b(0x2da)]}),_0x248ff1=_0x40cda8[_0x52b05b(0x267)],_0x34dbbd=await withSpinner(_0x52b05b(0x204)+_0x38923d+_0x52b05b(0x2b4),()=>_0x2c6220['segment']['getParentSQL'](_0x248ff1),{'verbose':_0x2409df[_0x52b05b(0x2da)]});let _0x50c870=_0x34dbbd[_0x52b05b(0x267)];const _0x579382=resolveLimit(_0x2409df[_0x52b05b(0x272)],DEFAULT_DISPLAY_LIMIT),_0xae772c=/\bLIMIT\s+\d+/i['test'](_0x50c870);!_0xae772c&&(_0x50c870=_0x50c870['trim']()['replace'](/;+$/,''),_0x50c870='SELECT\x20*\x20FROM\x20(\x0a'+_0x50c870+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x579382);_0x2409df[_0x52b05b(0x2da)]&&console[_0x52b05b(0x300)](_0x52b05b(0x26c)+_0x50c870);const _0x376deb=await withProgressSpinner(_0x52b05b(0x2cc),async _0x4486db=>{const _0x34f222=_0x52b05b,_0x4f5ef4=await _0x2c6220[_0x34f222(0x297)][_0x34f222(0x304)](_0x50c870,{'catalog':'td','schema':_0x34f222(0x2a1),'onJobId':_0xdea942=>{_0x4486db['setJobId'](_0xdea942);}});return _0x4f5ef4;},{'verbose':_0x2409df[_0x52b05b(0x2da)]}),_0x577b2a=_0x376deb[_0x52b05b(0x267)],_0x50702d=_0x577b2a[_0x52b05b(0x2cf)]?_0x52b05b(0x27d)+_0x577b2a['jobId']+']':'';return console[_0x52b05b(0x300)](_0x52b05b(0x1f3)+_0x577b2a[_0x52b05b(0x1fb)][_0x52b05b(0x299)][_0x52b05b(0x25a)]()+'\x20rows\x20'+(_0x52b05b(0x24c)+formatElapsed(_0x577b2a['stats'][_0x52b05b(0x264)])+_0x50702d)),await handleQueryOutput(_0x577b2a,_0x2409df),0x0;}}
@@ -1 +1 @@
1
- const a24_0x324bc6=a24_0xd17e;(function(_0x3e95b2,_0xeaa0d7){const _0xf6d66d=a24_0xd17e,_0x7ab3d4=_0x3e95b2();while(!![]){try{const _0x433b7e=parseInt(_0xf6d66d(0x22c))/0x1+parseInt(_0xf6d66d(0x1f8))/0x2+parseInt(_0xf6d66d(0x239))/0x3*(parseInt(_0xf6d66d(0x1e1))/0x4)+parseInt(_0xf6d66d(0x218))/0x5*(-parseInt(_0xf6d66d(0x232))/0x6)+-parseInt(_0xf6d66d(0x1e2))/0x7*(-parseInt(_0xf6d66d(0x227))/0x8)+-parseInt(_0xf6d66d(0x21d))/0x9+-parseInt(_0xf6d66d(0x205))/0xa*(-parseInt(_0xf6d66d(0x244))/0xb);if(_0x433b7e===_0xeaa0d7)break;else _0x7ab3d4['push'](_0x7ab3d4['shift']());}catch(_0x4778d2){_0x7ab3d4['push'](_0x7ab3d4['shift']());}}}(a24_0x55a3,0x63e3f));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a24_0x55a3(){const _0x25927a=['5717934dzazNH','Site\x20was\x20not\x20changed.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','apiKey','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','execute','logLevel','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','green','1616gHBasm','tdx:\x20profile\x20set','Validating\x20API\x20key...','parent_segment','tdx:\x20profile\x20remove','152206zszsVS','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Enter\x20description\x20(optional):','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','llm_agent','591846nvGwJX','trim','password','default','Changing\x20site\x20to\x20\x27','VALID_KEYS','split','75jrEzer','Session\x20profile\x20set\x20to:\x20','ERROR','log','email','\x20\x20(no\x20profiles\x20found)','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','warn','profile','select','includes','22209BfnpLl','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Remove\x20a\x20profile','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','length','create','\x0aOperation\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','profile:remove','\x27\x20removed\x20from\x20configuration','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','text','19996lgKXsa','13160jJgEmX','config','\x20\x20-\x20','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','message','confirm','\x27\x20created','\x27\x20requires\x20API\x20key\x20validation.','site','dim','error','test','\x0aSetup\x20cancelled','validate','Set\x20session\x20profile','\x27\x20updated:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27.\x0a\x0aValid\x20keys:\x20','\x0aAvailable\x20profiles:','Create\x20a\x20new\x20profile','Site\x20name\x20cannot\x20be\x20empty','\x0aSaved\x20to:\x20','108222ltGzYo','description','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','status','us01','Enter\x20your\x20TD\x20API\x20key:','\x27\x20does\x20not\x20exist.','getUserInfo','red','Removal\x20cancelled','\x20Profile\x20\x27','profile:use','2140whGmpX','\x27\x20does\x20not\x20exist.\x20Create\x20it?','API\x20key\x20cannot\x20be\x20empty','Default\x20profile\x20set\x20to:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','bold','\x20\x20tdx\x20--profile\x20','join','Enter\x20site\x20name:','session','\x20--default\x27\x20to\x20save\x20permanently','Profile\x20\x27','name','/app/mp/ak','customSite','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','jobs','Unknown\x20key\x20\x27','llm_project','5WeRLYD','yellow','profileName','You\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20profile\x20name:'];a24_0x55a3=function(){return _0x25927a;};return a24_0x55a3();}import{getConfigDir}from'../core/config.js';function a24_0xd17e(_0x38d244,_0x1feb9e){_0x38d244=_0x38d244-0x1d8;const _0x55a3cd=a24_0x55a3();let _0xd17e58=_0x55a3cd[_0x38d244];return _0xd17e58;}import*as a24_0x20b66f from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x212fa5 from'prompts';import a24_0x74f3b5 from'chalk';function validateProfileName(_0x5ba0a5){const _0x72011e=a24_0xd17e;if(!_0x5ba0a5||!_0x5ba0a5[_0x72011e(0x233)]())return _0x72011e(0x1dc);const _0x407158=_0x5ba0a5[_0x72011e(0x233)]();if(!/^[a-zA-Z0-9_-]+$/[_0x72011e(0x1ed)](_0x407158))return _0x72011e(0x22f);if(profileExists(_0x407158))return _0x72011e(0x210)+_0x407158+_0x72011e(0x22d);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x324bc6(0x1f9)]=a24_0x324bc6(0x1f5);async[a24_0x324bc6(0x223)](_0x2d5462){const _0x1fe268=a24_0x324bc6,{options:_0x4dcf12,args:_0x14a24a}=_0x2d5462;console[_0x1fe268(0x23c)](a24_0x74f3b5[_0x1fe268(0x20a)]('tdx:\x20profile\x20create'));let _0x3af633;if(_0x14a24a[_0x1fe268(0x1d8)]>0x0&&_0x14a24a[0x0]){const _0x4df1aa=_0x14a24a[0x0][_0x1fe268(0x233)](),_0x11920e=validateProfileName(_0x4df1aa);if(_0x11920e!==!![])return console['error'](a24_0x74f3b5[_0x1fe268(0x201)](_0x11920e)),0x1;_0x3af633=_0x4df1aa;}else{const _0x34b245=await a24_0x212fa5({'type':'text','name':_0x1fe268(0x21a),'message':_0x1fe268(0x21c),'validate':validateProfileName});if(!_0x34b245['profileName'])return console[_0x1fe268(0x23c)](_0x1fe268(0x1ee)),0x1;_0x3af633=_0x34b245[_0x1fe268(0x21a)][_0x1fe268(0x233)]();}const _0x538ac9=await a24_0x212fa5({'type':_0x1fe268(0x1e0),'name':_0x1fe268(0x1f9),'message':_0x1fe268(0x22e)}),_0x2a33ef=_0x538ac9[_0x1fe268(0x1f9)]?.[_0x1fe268(0x233)]()||undefined,_0x105f22=_0x4dcf12['site']||_0x1fe268(0x1fd),{choices:_0x50be3b,initialIndex:_0x326c27}=buildSiteChoices(_0x105f22),_0x122a22=await a24_0x212fa5({'type':_0x1fe268(0x242),'name':_0x1fe268(0x1ea),'message':_0x1fe268(0x1df)+_0x3af633+'\x27:','choices':_0x50be3b,'initial':_0x326c27});if(!_0x122a22[_0x1fe268(0x1ea)])return console[_0x1fe268(0x23c)](_0x1fe268(0x1ee)),0x1;let _0x486139;if(_0x122a22[_0x1fe268(0x1ea)]==='other'){const _0x5f42e6=await a24_0x212fa5({'type':_0x1fe268(0x1e0),'name':_0x1fe268(0x213),'message':_0x1fe268(0x20d),'initial':'us01','validate':_0x2b332c=>{const _0x558e90=_0x1fe268;if(!_0x2b332c||!_0x2b332c[_0x558e90(0x233)]())return _0x558e90(0x1f6);if(!/^[a-z0-9-]+$/[_0x558e90(0x1ed)](_0x2b332c[_0x558e90(0x233)]()))return _0x558e90(0x230);return!![];}});if(!_0x5f42e6[_0x1fe268(0x213)])return console[_0x1fe268(0x23c)]('\x0aSetup\x20cancelled'),0x1;_0x486139=_0x5f42e6['customSite'];}else _0x486139=_0x122a22['site'];const _0x630233=resolveSite(_0x486139);console['log'](_0x1fe268(0x225)+_0x630233),console['log'](_0x1fe268(0x21b)),console['log']('\x20\x20'+getConsoleUrl(_0x630233,_0x1fe268(0x212)));const _0xd07d88=await a24_0x212fa5({'type':_0x1fe268(0x234),'name':'apiKey','message':_0x1fe268(0x1fe),'validate':_0x2bb8ae=>{const _0x15c919=_0x1fe268;if(!_0x2bb8ae||!_0x2bb8ae[_0x15c919(0x233)]())return _0x15c919(0x207);return!![];}});if(!_0xd07d88[_0x1fe268(0x220)])return console[_0x1fe268(0x23c)](_0x1fe268(0x1ee)),0x1;const _0x5e2e03=_0xd07d88[_0x1fe268(0x220)];console[_0x1fe268(0x23c)](_0x1fe268(0x229));try{const _0x1b97b2=TDX[_0x1fe268(0x1d9)]({'site':_0x630233,'apiKey':_0x5e2e03[_0x1fe268(0x233)](),'logLevel':_0x4dcf12[_0x1fe268(0x224)]??LogLevel[_0x1fe268(0x23b)]}),_0x5217ac=await _0x1b97b2['jobs'][_0x1fe268(0x200)]();console[_0x1fe268(0x23c)](a24_0x74f3b5[_0x1fe268(0x226)]('✓')+_0x1fe268(0x1fa)+_0x5217ac[_0x1fe268(0x23d)]+')');const _0x737224=await isKeychainAvailable();_0x737224?(await saveAPIKeyAsync(_0x5e2e03[_0x1fe268(0x233)](),_0x630233,_0x3af633),console[_0x1fe268(0x23c)](a24_0x74f3b5['green']('✓')+_0x1fe268(0x214)+_0x3af633+')')):(console['warn'](a24_0x74f3b5[_0x1fe268(0x219)](_0x1fe268(0x245))),console[_0x1fe268(0x240)](a24_0x74f3b5['yellow'](_0x1fe268(0x222))));const _0x3c4301={'site':_0x630233,..._0x2a33ef&&{'description':_0x2a33ef}};return saveProfileToUserConfig(_0x3af633,_0x3c4301),console[_0x1fe268(0x23c)](a24_0x74f3b5['green']('✓')+_0x1fe268(0x203)+_0x3af633+_0x1fe268(0x1e8)),console['log'](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x1fe268(0x20b)+_0x3af633+_0x1fe268(0x23f)),console['log'](_0x1fe268(0x20b)+_0x3af633+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x192ddb){if(_0x192ddb instanceof HTTPClientError&&_0x192ddb[_0x1fe268(0x1fc)]===0x191)return printAuthError(_0x192ddb),0x1;return console[_0x1fe268(0x1ec)](a24_0x74f3b5[_0x1fe268(0x201)]('✗\x20Validation\x20failed:\x20'+(_0x192ddb instanceof Error?_0x192ddb[_0x1fe268(0x1e6)]:String(_0x192ddb)))),console[_0x1fe268(0x1ec)](_0x1fe268(0x1f2)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x324bc6(0x1dd);[a24_0x324bc6(0x1f9)]=a24_0x324bc6(0x246);['validate'](_0x5d0287){const _0xe293a2=a24_0x324bc6,{args:_0x477389}=_0x5d0287;if(_0x477389['length']===0x0)return _0xe293a2(0x21f);return undefined;}async[a24_0x324bc6(0x223)](_0x545664){const _0x2d812b=a24_0x324bc6,{args:_0x48cd1c}=_0x545664,_0x5c7ce0=_0x48cd1c[0x0];console[_0x2d812b(0x23c)](a24_0x74f3b5['bold'](_0x2d812b(0x22b)));if(!profileExists(_0x5c7ce0)){console['error'](a24_0x74f3b5[_0x2d812b(0x201)](_0x2d812b(0x210)+_0x5c7ce0+_0x2d812b(0x1ff))),console[_0x2d812b(0x23c)]('\x0aAvailable\x20profiles:');const _0x56404c=listProfiles();if(_0x56404c[_0x2d812b(0x1d8)]===0x0)console[_0x2d812b(0x23c)](_0x2d812b(0x23e));else for(const _0x322b2b of _0x56404c){console[_0x2d812b(0x23c)](_0x2d812b(0x1e4)+_0x322b2b['name']);}return 0x1;}const _0x3ffe5a=await a24_0x212fa5({'type':_0x2d812b(0x1e7),'name':'confirm','message':_0x2d812b(0x1db)+_0x5c7ce0+'\x27?','initial':![]});if(!_0x3ffe5a[_0x2d812b(0x1e7)])return console['log'](_0x2d812b(0x202)),0x0;try{removeProfileFromUserConfig(_0x5c7ce0),console[_0x2d812b(0x23c)](a24_0x74f3b5[_0x2d812b(0x226)]('✓')+_0x2d812b(0x203)+_0x5c7ce0+_0x2d812b(0x1de));}catch(_0x45c31f){return console[_0x2d812b(0x1ec)](a24_0x74f3b5[_0x2d812b(0x201)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x45c31f instanceof Error?_0x45c31f[_0x2d812b(0x1e6)]:String(_0x45c31f)))),0x1;}const _0x3f4a66=await isKeychainAvailable();if(_0x3f4a66){const _0xa69c96=await deleteKeychainAPIKey(_0x5c7ce0);_0xa69c96&&console[_0x2d812b(0x23c)](a24_0x74f3b5['green']('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';['description']='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x324bc6(0x237)]=[a24_0x324bc6(0x1ea),'database',a24_0x324bc6(0x22a),a24_0x324bc6(0x217),a24_0x324bc6(0x231),'description'];[a24_0x324bc6(0x1ef)](_0x55743c){const _0xc1d38a=a24_0x324bc6,{args:_0x5a8d1a,options:_0x36d96f}=_0x55743c,_0x5daa08=_0x36d96f[_0xc1d38a(0x241)]||getActiveProfile();if(!_0x5daa08)return _0xc1d38a(0x1e5);if(_0x5a8d1a['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0xc1d38a(0x20c)](',\x20');const _0x45a9a9=_0x5a8d1a[0x0];if(!_0x45a9a9[_0xc1d38a(0x243)]('='))return _0xc1d38a(0x247)+ProfileSetCommand['VALID_KEYS'][_0xc1d38a(0x20c)](',\x20');const [_0x3d678b]=_0x45a9a9['split']('=',0x2);if(!ProfileSetCommand[_0xc1d38a(0x237)][_0xc1d38a(0x243)](_0x3d678b))return _0xc1d38a(0x216)+_0x3d678b+_0xc1d38a(0x1f3)+ProfileSetCommand[_0xc1d38a(0x237)][_0xc1d38a(0x20c)](',\x20');return undefined;}async[a24_0x324bc6(0x223)](_0xbae31f){const _0x5c7173=a24_0x324bc6,{args:_0x1ed051,options:_0x57c7fe}=_0xbae31f,_0x384f12=_0x57c7fe[_0x5c7173(0x241)]||getActiveProfile(),[_0x50971c,..._0x2b5cdb]=_0x1ed051[0x0][_0x5c7173(0x238)]('='),_0xd9d4c4=_0x2b5cdb[_0x5c7173(0x20c)]('=');console[_0x5c7173(0x23c)](a24_0x74f3b5[_0x5c7173(0x20a)](_0x5c7173(0x228)));if(!profileExists(_0x384f12)){const _0x464fc3=await a24_0x212fa5({'type':'confirm','name':_0x5c7173(0x1d9),'message':_0x5c7173(0x210)+_0x384f12+_0x5c7173(0x206),'initial':!![]});if(!_0x464fc3['create'])return console[_0x5c7173(0x23c)]('Operation\x20cancelled'),0x1;}const _0x171c44=loadProfile(_0x384f12),_0x290989=_0x171c44?.[_0x5c7173(0x1e3)]||{};if(_0x50971c===_0x5c7173(0x1ea)){const _0x3e1d5a=resolveSite(_0xd9d4c4);console[_0x5c7173(0x23c)](_0x5c7173(0x236)+_0x3e1d5a+_0x5c7173(0x1e9)),console[_0x5c7173(0x23c)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x5c7173(0x23c)]('\x20\x20'+getConsoleUrl(_0x3e1d5a,_0x5c7173(0x212)));const _0x36f8f9=await a24_0x212fa5({'type':'password','name':_0x5c7173(0x220),'message':_0x5c7173(0x221),'validate':_0x5d7ed0=>{const _0x565790=_0x5c7173;if(!_0x5d7ed0||!_0x5d7ed0[_0x565790(0x233)]())return _0x565790(0x207);return!![];}});if(!_0x36f8f9[_0x5c7173(0x220)])return console[_0x5c7173(0x23c)](_0x5c7173(0x1da)),0x1;console[_0x5c7173(0x23c)]('Validating\x20API\x20key...');try{const _0x207467=TDX[_0x5c7173(0x1d9)]({'site':_0x3e1d5a,'apiKey':_0x36f8f9[_0x5c7173(0x220)][_0x5c7173(0x233)](),'logLevel':_0x57c7fe[_0x5c7173(0x224)]??LogLevel[_0x5c7173(0x23b)]}),_0xea1b52=await _0x207467[_0x5c7173(0x215)][_0x5c7173(0x200)]();console[_0x5c7173(0x23c)](a24_0x74f3b5[_0x5c7173(0x226)]('✓')+_0x5c7173(0x1fa)+_0xea1b52['email']+')');const _0x5a7f88=await isKeychainAvailable();_0x5a7f88?(await saveAPIKeyAsync(_0x36f8f9[_0x5c7173(0x220)][_0x5c7173(0x233)](),_0x3e1d5a,_0x384f12),console[_0x5c7173(0x23c)](a24_0x74f3b5[_0x5c7173(0x226)]('✓')+_0x5c7173(0x209))):console['warn'](a24_0x74f3b5[_0x5c7173(0x219)](_0x5c7173(0x245))),_0x290989[_0x5c7173(0x1ea)]=_0x3e1d5a;}catch(_0x28e601){if(_0x28e601 instanceof HTTPClientError&&_0x28e601['status']===0x191)return printAuthError(_0x28e601),0x1;return console[_0x5c7173(0x1ec)](a24_0x74f3b5[_0x5c7173(0x201)]('✗\x20Validation\x20failed:\x20'+(_0x28e601 instanceof Error?_0x28e601[_0x5c7173(0x1e6)]:String(_0x28e601)))),console['error'](_0x5c7173(0x21e)),0x1;}}else _0x290989[_0x50971c]=_0xd9d4c4||undefined;return saveProfileToUserConfig(_0x384f12,_0x290989),console[_0x5c7173(0x23c)](a24_0x74f3b5['green']('✓')+_0x5c7173(0x203)+_0x384f12+_0x5c7173(0x1f1)+_0x50971c+'='+(_0xd9d4c4||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x324bc6(0x211)]=a24_0x324bc6(0x204);['description']=a24_0x324bc6(0x1f0);[a24_0x324bc6(0x1ef)](_0x3f7ee0){const _0x533dae=a24_0x324bc6,{args:_0x2b482a}=_0x3f7ee0;if(_0x2b482a[_0x533dae(0x1d8)]===0x0)return _0x533dae(0x1fb);return undefined;}async['execute'](_0x291824){const _0x3ff0e3=a24_0x324bc6,{args:_0x21e9a6,options:_0x3b00ef}=_0x291824,_0x31686c=_0x21e9a6[0x0],_0x1dd1ca=_0x3b00ef[_0x3ff0e3(0x235)];cleanExpiredSessions();if(!profileExists(_0x31686c)){console[_0x3ff0e3(0x1ec)](a24_0x74f3b5['red'](_0x3ff0e3(0x210)+_0x31686c+_0x3ff0e3(0x1ff))),console[_0x3ff0e3(0x23c)](_0x3ff0e3(0x1f4));const _0x26b812=listProfiles();if(_0x26b812[_0x3ff0e3(0x1d8)]===0x0)console[_0x3ff0e3(0x23c)](_0x3ff0e3(0x23e));else for(const _0x3e709b of _0x26b812){console[_0x3ff0e3(0x23c)](_0x3ff0e3(0x1e4)+_0x3e709b[_0x3ff0e3(0x211)]);}return 0x1;}if(_0x1dd1ca){const _0x136323=a24_0x20b66f[_0x3ff0e3(0x20c)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x31686c),console[_0x3ff0e3(0x23c)](_0x3ff0e3(0x208)+a24_0x74f3b5['green'](_0x31686c)),console[_0x3ff0e3(0x23c)](a24_0x74f3b5[_0x3ff0e3(0x1eb)](_0x3ff0e3(0x1f7)+_0x136323)),0x0;}const _0x28a08e=_0x3b00ef[_0x3ff0e3(0x20e)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x31686c},_0x3b00ef[_0x3ff0e3(0x20e)]),console[_0x3ff0e3(0x23c)](_0x3ff0e3(0x23a)+a24_0x74f3b5[_0x3ff0e3(0x226)](_0x31686c)+'\x20'+a24_0x74f3b5[_0x3ff0e3(0x1eb)]('(session:\x20'+_0x28a08e+')')),console[_0x3ff0e3(0x23c)](a24_0x74f3b5[_0x3ff0e3(0x1eb)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x31686c+_0x3ff0e3(0x20f))),0x0;}}
1
+ const a24_0x358b7a=a24_0x54e6;(function(_0x314bd5,_0x4186e0){const _0x5e6d84=a24_0x54e6,_0x3c93b5=_0x314bd5();while(!![]){try{const _0x48c406=parseInt(_0x5e6d84(0x20f))/0x1*(-parseInt(_0x5e6d84(0x1f4))/0x2)+-parseInt(_0x5e6d84(0x220))/0x3*(-parseInt(_0x5e6d84(0x1e4))/0x4)+-parseInt(_0x5e6d84(0x1fb))/0x5+parseInt(_0x5e6d84(0x22a))/0x6+-parseInt(_0x5e6d84(0x1fa))/0x7*(-parseInt(_0x5e6d84(0x1d5))/0x8)+-parseInt(_0x5e6d84(0x217))/0x9*(-parseInt(_0x5e6d84(0x1cd))/0xa)+parseInt(_0x5e6d84(0x1fe))/0xb*(-parseInt(_0x5e6d84(0x1e5))/0xc);if(_0x48c406===_0x4186e0)break;else _0x3c93b5['push'](_0x3c93b5['shift']());}catch(_0x366ee6){_0x3c93b5['push'](_0x3c93b5['shift']());}}}(a24_0x2be1,0x248b5));function a24_0x2be1(){const _0x25aff7=['12YszcaR','Removal\x20cancelled','config','profile:remove','Unknown\x20key\x20\x27','Site\x20name\x20cannot\x20be\x20empty','\x20API\x20key\x20removed\x20from\x20system\x20keychain','warn','includes','other','database','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20does\x20not\x20exist.','Operation\x20cancelled','ERROR','28vpdKne','Remove\x20a\x20profile','/app/mp/ak','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','execute','llm_project','98SuQYna','747240tBpCuN','\x0aSetup\x20cancelled','validate','3863211vlXmWK','\x20\x20(no\x20profiles\x20found)','description','log','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','dim','text','profileName','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','default','\x27.\x0a\x0aValid\x20keys:\x20','yellow','green','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','red','error','2853JunhNR','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','getUserInfo','logLevel','join','bold','email','jobs','90ocVagH','Session\x20profile\x20set\x20to:\x20','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','apiKey','status','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','(session:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','name','653757dSbdcS','llm_agent','\x0aSaved\x20to:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Site\x20was\x20not\x20changed.','password','us01','\x27\x20updated:\x20','Validating\x20API\x20key...','440466DsNKAs','customSite','test','\x27\x20does\x20not\x20exist.\x20Create\x20it?','✗\x20Validation\x20failed:\x20','Profile\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','profile:create','Changing\x20site\x20to\x20\x27','confirm','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Enter\x20site\x20name:','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20removed\x20from\x20configuration','trim','\x20\x20tdx\x20--profile\x20','toString','length','Failed\x20to\x20remove\x20profile:\x20','split','229560pmzLnY','Default\x20profile\x20set\x20to:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','site','parent_segment','profile','Create\x20a\x20new\x20profile','96792WHPNLf','\x0aOperation\x20cancelled','\x27\x20created','\x20\x20-\x20','tdx.json','create','tdx:\x20profile\x20create','select','profile:use','message','session','VALID_KEYS','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20Profile\x20\x27','API\x20key\x20cannot\x20be\x20empty','4iktosC'];a24_0x2be1=function(){return _0x25aff7;};return a24_0x2be1();}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0x3fec83 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x2a6681 from'prompts';import a24_0x3eee1f from'chalk';function validateProfileName(_0x557046){const _0x1e0371=a24_0x54e6;if(!_0x557046||!_0x557046[_0x1e0371(0x1c7)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x16e0fb=_0x557046[_0x1e0371(0x1c7)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x16e0fb))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x16e0fb))return _0x1e0371(0x22f)+_0x16e0fb+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x358b7a(0x21f)]=a24_0x358b7a(0x1c0);[a24_0x358b7a(0x200)]=a24_0x358b7a(0x1d4);async[a24_0x358b7a(0x1f8)](_0x118829){const _0x2a108e=a24_0x358b7a,{options:_0x202d8b,args:_0x23ba8a}=_0x118829;console['log'](a24_0x3eee1f['bold'](_0x2a108e(0x1db)));let _0x98f417;if(_0x23ba8a['length']>0x0&&_0x23ba8a[0x0]){const _0x51ddf6=_0x23ba8a[0x0]['trim'](),_0x5dd1f5=validateProfileName(_0x51ddf6);if(_0x5dd1f5!==!![])return console[_0x2a108e(0x20e)](a24_0x3eee1f[_0x2a108e(0x20d)](_0x5dd1f5)),0x1;_0x98f417=_0x51ddf6;}else{const _0x3f3513=await a24_0x2a6681({'type':'text','name':_0x2a108e(0x206),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x3f3513[_0x2a108e(0x206)])return console[_0x2a108e(0x201)]('\x0aSetup\x20cancelled'),0x1;_0x98f417=_0x3f3513[_0x2a108e(0x206)][_0x2a108e(0x1c7)]();}const _0x1a2f49=await a24_0x2a6681({'type':_0x2a108e(0x205),'name':_0x2a108e(0x200),'message':'Enter\x20description\x20(optional):'}),_0x59c1cd=_0x1a2f49[_0x2a108e(0x200)]?.[_0x2a108e(0x1c7)]()||undefined,_0x6d5520=_0x202d8b[_0x2a108e(0x1d1)]||_0x2a108e(0x227),{choices:_0x52a4b9,initialIndex:_0x2ae34e}=buildSiteChoices(_0x6d5520),_0x9854e9=await a24_0x2a6681({'type':_0x2a108e(0x1dc),'name':_0x2a108e(0x1d1),'message':_0x2a108e(0x219)+_0x98f417+'\x27:','choices':_0x52a4b9,'initial':_0x2ae34e});if(!_0x9854e9[_0x2a108e(0x1d1)])return console['log'](_0x2a108e(0x1fc)),0x1;let _0x3ec780;if(_0x9854e9[_0x2a108e(0x1d1)]===_0x2a108e(0x1ee)){const _0x222cad=await a24_0x2a6681({'type':_0x2a108e(0x205),'name':'customSite','message':_0x2a108e(0x1c4),'initial':'us01','validate':_0xfc48bd=>{const _0x2b86ff=_0x2a108e;if(!_0xfc48bd||!_0xfc48bd[_0x2b86ff(0x1c7)]())return _0x2b86ff(0x1ea);if(!/^[a-z0-9-]+$/[_0x2b86ff(0x22c)](_0xfc48bd[_0x2b86ff(0x1c7)]()))return _0x2b86ff(0x224);return!![];}});if(!_0x222cad[_0x2a108e(0x22b)])return console['log'](_0x2a108e(0x1fc)),0x1;_0x3ec780=_0x222cad[_0x2a108e(0x22b)];}else _0x3ec780=_0x9854e9['site'];const _0x56fe27=resolveSite(_0x3ec780);console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x56fe27),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x56fe27,_0x2a108e(0x1f6)));const _0x1b12a=await a24_0x2a6681({'type':_0x2a108e(0x226),'name':_0x2a108e(0x21a),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x510129=>{const _0x12eed9=_0x2a108e;if(!_0x510129||!_0x510129[_0x12eed9(0x1c7)]())return _0x12eed9(0x1e3);return!![];}});if(!_0x1b12a[_0x2a108e(0x21a)])return console[_0x2a108e(0x201)](_0x2a108e(0x1fc)),0x1;const _0x2f452b=_0x1b12a[_0x2a108e(0x21a)];console['log'](_0x2a108e(0x229));try{const _0x13ed9f=TDX[_0x2a108e(0x1da)]({'site':_0x56fe27,'apiKey':_0x2f452b['trim'](),'logLevel':_0x202d8b[_0x2a108e(0x212)]??LogLevel[_0x2a108e(0x1f3)]}),_0x35953c=await _0x13ed9f[_0x2a108e(0x216)]['getUserInfo']();console[_0x2a108e(0x201)](a24_0x3eee1f['green']('✓')+_0x2a108e(0x223)+_0x35953c[_0x2a108e(0x215)]+')');const _0x5f34df=await isKeychainAvailable();_0x5f34df?(await saveAPIKeyAsync(_0x2f452b['trim'](),_0x56fe27,_0x98f417),console['log'](a24_0x3eee1f[_0x2a108e(0x20b)]('✓')+_0x2a108e(0x1c5)+_0x98f417+')')):(console[_0x2a108e(0x1ec)](a24_0x3eee1f[_0x2a108e(0x20a)](_0x2a108e(0x1d0))),console[_0x2a108e(0x1ec)](a24_0x3eee1f['yellow'](_0x2a108e(0x1f0))));const _0x311c5e={'site':_0x56fe27,..._0x59c1cd&&{'description':_0x59c1cd}};return saveProfileToUserConfig(_0x98f417,_0x311c5e),console['log'](a24_0x3eee1f[_0x2a108e(0x20b)]('✓')+_0x2a108e(0x1e2)+_0x98f417+_0x2a108e(0x1d7)),console[_0x2a108e(0x201)](),console[_0x2a108e(0x201)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x2a108e(0x1c8)+_0x98f417+_0x2a108e(0x1c3)),console[_0x2a108e(0x201)](_0x2a108e(0x1c8)+_0x98f417+_0x2a108e(0x203)),0x0;}catch(_0x48ac26){if(_0x48ac26 instanceof HTTPClientError&&_0x48ac26[_0x2a108e(0x21b)]===0x191)return printAuthError(_0x48ac26),0x1;return console[_0x2a108e(0x20e)](a24_0x3eee1f[_0x2a108e(0x20d)]('✗\x20Validation\x20failed:\x20'+(_0x48ac26 instanceof Error?_0x48ac26[_0x2a108e(0x1de)]:String(_0x48ac26)))),console[_0x2a108e(0x20e)](_0x2a108e(0x1f7)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x358b7a(0x1e8);[a24_0x358b7a(0x200)]=a24_0x358b7a(0x1f5);[a24_0x358b7a(0x1fd)](_0x4c3cf1){const _0x4c15df=a24_0x358b7a,{args:_0x29dc7b}=_0x4c3cf1;if(_0x29dc7b[_0x4c15df(0x1ca)]===0x0)return _0x4c15df(0x1e1);return undefined;}async['execute'](_0x13c7b5){const _0x2ffe1a=a24_0x358b7a,{args:_0x37e738}=_0x13c7b5,_0x4a485c=_0x37e738[0x0];console[_0x2ffe1a(0x201)](a24_0x3eee1f[_0x2ffe1a(0x214)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x4a485c)){console[_0x2ffe1a(0x20e)](a24_0x3eee1f[_0x2ffe1a(0x20d)](_0x2ffe1a(0x22f)+_0x4a485c+_0x2ffe1a(0x1f1))),console['log']('\x0aAvailable\x20profiles:');const _0x41ec60=listProfiles();if(_0x41ec60[_0x2ffe1a(0x1ca)]===0x0)console[_0x2ffe1a(0x201)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x38b65a of _0x41ec60){console[_0x2ffe1a(0x201)](_0x2ffe1a(0x1d8)+_0x38b65a['name']);}return 0x1;}const _0x415b91=await a24_0x2a6681({'type':_0x2ffe1a(0x1c2),'name':'confirm','message':_0x2ffe1a(0x20c)+_0x4a485c+'\x27?','initial':![]});if(!_0x415b91[_0x2ffe1a(0x1c2)])return console[_0x2ffe1a(0x201)](_0x2ffe1a(0x1e6)),0x0;try{removeProfileFromUserConfig(_0x4a485c),console[_0x2ffe1a(0x201)](a24_0x3eee1f[_0x2ffe1a(0x20b)]('✓')+_0x2ffe1a(0x1e2)+_0x4a485c+_0x2ffe1a(0x1c6));}catch(_0x1e248b){return console[_0x2ffe1a(0x20e)](a24_0x3eee1f[_0x2ffe1a(0x20d)](_0x2ffe1a(0x1cb)+(_0x1e248b instanceof Error?_0x1e248b[_0x2ffe1a(0x1de)]:String(_0x1e248b)))),0x1;}const _0x397d9d=await isKeychainAvailable();if(_0x397d9d){const _0x5659ec=await deleteKeychainAPIKey(_0x4a485c);_0x5659ec&&console[_0x2ffe1a(0x201)](a24_0x3eee1f[_0x2ffe1a(0x20b)]('✓')+_0x2ffe1a(0x1eb));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x358b7a(0x21f)]='profile:set';[a24_0x358b7a(0x200)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a24_0x358b7a(0x1d1),a24_0x358b7a(0x1ef),a24_0x358b7a(0x1d2),a24_0x358b7a(0x1f9),a24_0x358b7a(0x221),a24_0x358b7a(0x200)];[a24_0x358b7a(0x1fd)](_0x3d3d58){const _0x35b49d=a24_0x358b7a,{args:_0x31e57b,options:_0x46a670}=_0x3d3d58,_0x577957=_0x46a670['profile']||getActiveProfile();if(!_0x577957)return _0x35b49d(0x207);if(_0x31e57b['length']===0x0)return _0x35b49d(0x21e)+ProfileSetCommand[_0x35b49d(0x1e0)][_0x35b49d(0x213)](',\x20');const _0x2de672=_0x31e57b[0x0];if(!_0x2de672[_0x35b49d(0x1ed)]('='))return _0x35b49d(0x21c)+ProfileSetCommand[_0x35b49d(0x1e0)][_0x35b49d(0x213)](',\x20');const [_0x13c0a8]=_0x2de672[_0x35b49d(0x1cc)]('=',0x2);if(!ProfileSetCommand[_0x35b49d(0x1e0)][_0x35b49d(0x1ed)](_0x13c0a8))return _0x35b49d(0x1e9)+_0x13c0a8+_0x35b49d(0x209)+ProfileSetCommand['VALID_KEYS'][_0x35b49d(0x213)](',\x20');return undefined;}async[a24_0x358b7a(0x1f8)](_0x5cc5ac){const _0x3d442c=a24_0x358b7a,{args:_0x3eb8fa,options:_0x3703dc}=_0x5cc5ac,_0x34e0fd=_0x3703dc[_0x3d442c(0x1d3)]||getActiveProfile(),[_0x1d92cf,..._0x258288]=_0x3eb8fa[0x0][_0x3d442c(0x1cc)]('='),_0x388a8d=_0x258288[_0x3d442c(0x213)]('=');console[_0x3d442c(0x201)](a24_0x3eee1f[_0x3d442c(0x214)]('tdx:\x20profile\x20set'));if(!profileExists(_0x34e0fd)){const _0x44aaf0=await a24_0x2a6681({'type':'confirm','name':_0x3d442c(0x1da),'message':'Profile\x20\x27'+_0x34e0fd+_0x3d442c(0x22d),'initial':!![]});if(!_0x44aaf0['create'])return console[_0x3d442c(0x201)](_0x3d442c(0x1f2)),0x1;}const _0x3c3a5e=loadProfile(_0x34e0fd),_0x2dc46a=_0x3c3a5e?.[_0x3d442c(0x1e7)]||{};if(_0x1d92cf===_0x3d442c(0x1d1)){const _0x6c6b1=resolveSite(_0x388a8d);console['log'](_0x3d442c(0x1c1)+_0x6c6b1+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x3d442c(0x201)](_0x3d442c(0x1cf)),console[_0x3d442c(0x201)]('\x20\x20'+getConsoleUrl(_0x6c6b1,_0x3d442c(0x1f6)));const _0x5508be=await a24_0x2a6681({'type':_0x3d442c(0x226),'name':'apiKey','message':_0x3d442c(0x210),'validate':_0x2399b7=>{const _0x34ef6a=_0x3d442c;if(!_0x2399b7||!_0x2399b7[_0x34ef6a(0x1c7)]())return _0x34ef6a(0x1e3);return!![];}});if(!_0x5508be[_0x3d442c(0x21a)])return console[_0x3d442c(0x201)](_0x3d442c(0x1d6)),0x1;console[_0x3d442c(0x201)](_0x3d442c(0x229));try{const _0x207f73=TDX[_0x3d442c(0x1da)]({'site':_0x6c6b1,'apiKey':_0x5508be['apiKey']['trim'](),'logLevel':_0x3703dc[_0x3d442c(0x212)]??LogLevel[_0x3d442c(0x1f3)]}),_0x57fe45=await _0x207f73['jobs'][_0x3d442c(0x211)]();console['log'](a24_0x3eee1f[_0x3d442c(0x20b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x57fe45[_0x3d442c(0x215)]+')');const _0x176ed0=await isKeychainAvailable();_0x176ed0?(await saveAPIKeyAsync(_0x5508be[_0x3d442c(0x21a)][_0x3d442c(0x1c7)](),_0x6c6b1,_0x34e0fd),console['log'](a24_0x3eee1f['green']('✓')+_0x3d442c(0x202))):console['warn'](a24_0x3eee1f[_0x3d442c(0x20a)](_0x3d442c(0x1d0))),_0x2dc46a[_0x3d442c(0x1d1)]=_0x6c6b1;}catch(_0x521a57){if(_0x521a57 instanceof HTTPClientError&&_0x521a57['status']===0x191)return printAuthError(_0x521a57),0x1;return console[_0x3d442c(0x20e)](a24_0x3eee1f['red'](_0x3d442c(0x22e)+(_0x521a57 instanceof Error?_0x521a57[_0x3d442c(0x1de)]:String(_0x521a57)))),console[_0x3d442c(0x20e)](_0x3d442c(0x225)),0x1;}}else _0x2dc46a[_0x1d92cf]=_0x388a8d||undefined;return saveProfileToUserConfig(_0x34e0fd,_0x2dc46a),console['log'](a24_0x3eee1f[_0x3d442c(0x20b)]('✓')+_0x3d442c(0x1e2)+_0x34e0fd+_0x3d442c(0x228)+_0x1d92cf+'='+(_0x388a8d||'(cleared)')),0x0;}}function a24_0x54e6(_0x3f57fd,_0x16c06c){_0x3f57fd=_0x3f57fd-0x1c0;const _0x2be188=a24_0x2be1();let _0x54e6e7=_0x2be188[_0x3f57fd];return _0x54e6e7;}export class ProfileUseCommand extends BaseCommand{[a24_0x358b7a(0x21f)]=a24_0x358b7a(0x1dd);[a24_0x358b7a(0x200)]='Set\x20session\x20profile';[a24_0x358b7a(0x1fd)](_0x31e9b3){const _0x139252=a24_0x358b7a,{args:_0x2288ed}=_0x31e9b3;if(_0x2288ed[_0x139252(0x1ca)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x358b7a(0x1f8)](_0x16b8fc){const _0x304f4f=a24_0x358b7a,{args:_0x2e7de7,options:_0x28dd29}=_0x16b8fc,_0x229a77=_0x2e7de7[0x0],_0x2a45fa=_0x28dd29[_0x304f4f(0x208)];cleanExpiredSessions();if(!profileExists(_0x229a77)){console['error'](a24_0x3eee1f[_0x304f4f(0x20d)](_0x304f4f(0x22f)+_0x229a77+'\x27\x20does\x20not\x20exist.')),console[_0x304f4f(0x201)]('\x0aAvailable\x20profiles:');const _0x2bca5c=listProfiles();if(_0x2bca5c[_0x304f4f(0x1ca)]===0x0)console[_0x304f4f(0x201)](_0x304f4f(0x1ff));else for(const _0x55e396 of _0x2bca5c){console[_0x304f4f(0x201)]('\x20\x20-\x20'+_0x55e396[_0x304f4f(0x21f)]);}return 0x1;}if(_0x2a45fa){const _0x4fd957=a24_0x3fec83[_0x304f4f(0x213)](getConfigDir(),_0x304f4f(0x1d9));return saveActiveProfileToUserConfig(_0x229a77),console[_0x304f4f(0x201)](_0x304f4f(0x1ce)+a24_0x3eee1f[_0x304f4f(0x20b)](_0x229a77)),console['log'](a24_0x3eee1f[_0x304f4f(0x204)](_0x304f4f(0x222)+_0x4fd957)),0x0;}const _0x20be61=_0x28dd29[_0x304f4f(0x1df)]||getCurrentSessionPID()[_0x304f4f(0x1c9)]();return saveSessionContext({'profile':_0x229a77},_0x28dd29[_0x304f4f(0x1df)]),console[_0x304f4f(0x201)](_0x304f4f(0x218)+a24_0x3eee1f['green'](_0x229a77)+'\x20'+a24_0x3eee1f['dim'](_0x304f4f(0x21d)+_0x20be61+')')),console[_0x304f4f(0x201)](a24_0x3eee1f[_0x304f4f(0x204)](_0x304f4f(0x230)+_0x229a77+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- function a25_0x4d23(_0x3cf888,_0x5be17c){_0x3cf888=_0x3cf888-0xce;const _0x561a13=a25_0x561a();let _0x4d23fc=_0x561a13[_0x3cf888];return _0x4d23fc;}const a25_0x2fb55e=a25_0x4d23;(function(_0x285b98,_0x3731a1){const _0x133a0e=a25_0x4d23,_0x120fba=_0x285b98();while(!![]){try{const _0x5d76c2=-parseInt(_0x133a0e(0xde))/0x1+parseInt(_0x133a0e(0xe0))/0x2+-parseInt(_0x133a0e(0xcf))/0x3+-parseInt(_0x133a0e(0xd1))/0x4*(parseInt(_0x133a0e(0xd2))/0x5)+parseInt(_0x133a0e(0xd7))/0x6+-parseInt(_0x133a0e(0xd5))/0x7+parseInt(_0x133a0e(0xda))/0x8;if(_0x5d76c2===_0x3731a1)break;else _0x120fba['push'](_0x120fba['shift']());}catch(_0x1e31f8){_0x120fba['push'](_0x120fba['shift']());}}}(a25_0x561a,0x8a287));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a25_0x2fb55e(0xd0)]='profiles';['description']=a25_0x2fb55e(0xd4);async[a25_0x2fb55e(0xdd)](_0x4b1068){const _0x1dd2b2=a25_0x2fb55e,{options:_0x175c92}=_0x4b1068;try{const _0x74115a=listProfiles(),_0x29f25e=getActiveProfile();if(_0x74115a[_0x1dd2b2(0xd6)]===0x0)return console[_0x1dd2b2(0xdb)](_0x1dd2b2(0xd3)),console[_0x1dd2b2(0xdb)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log'](_0x1dd2b2(0xdf)),0x0;const _0x497d9a=_0x74115a['map'](_0x2967cf=>{const _0x6e8142=_0x1dd2b2,_0x1c0cfa=_0x2967cf[_0x6e8142(0xd0)]===_0x29f25e,_0x775247=getProfileParams(_0x2967cf[_0x6e8142(0xd8)]);return{'name':_0x2967cf[_0x6e8142(0xd0)],'active':_0x1c0cfa,'scope':_0x2967cf['scope'],'description':_0x2967cf[_0x6e8142(0xd8)][_0x6e8142(0xd9)]||'','params':_0x775247};});return await handleSDKOutput(_0x497d9a,_0x175c92),0x0;}catch(_0x478f4c){return _0x478f4c instanceof Error&&console[_0x1dd2b2(0xce)](_0x1dd2b2(0xdc)+_0x478f4c['message']),0x1;}}}function a25_0x561a(){const _0x432a16=['4996300SafcMj','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','List\x20all\x20available\x20profiles','7480382TJQOMb','length','718134oCnvGh','config','description','29558296yuwIAc','log','Error:\x20','execute','1068867myHmVc','\x20\x20Global:\x20~/.config/tdx/tdx.json','357920xozGkD','error','872364SRhmcl','name','4tYyyVh'];a25_0x561a=function(){return _0x432a16;};return a25_0x561a();}
1
+ const a25_0xc505a2=a25_0x3e72;function a25_0x580d(){const _0x218782=['22802aZwqCS','profiles','52pjdZJj','scope','List\x20all\x20available\x20profiles','execute','37773PTIudP','1805425unNimq','31505518leoMRL','error','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','12HULPfA','map','1064898vpcWkt','2730zeUhNe','3225966XqjxvF','82120hHCrSQ','name','config','description','175PkNZVG','Error:\x20','log'];a25_0x580d=function(){return _0x218782;};return a25_0x580d();}(function(_0x4e79f3,_0xb84f1c){const _0x350db8=a25_0x3e72,_0x1551e1=_0x4e79f3();while(!![]){try{const _0x5b6d24=-parseInt(_0x350db8(0x95))/0x1*(-parseInt(_0x350db8(0x7f))/0x2)+-parseInt(_0x350db8(0x8b))/0x3+-parseInt(_0x350db8(0x89))/0x4*(parseInt(_0x350db8(0x84))/0x5)+-parseInt(_0x350db8(0x8d))/0x6+-parseInt(_0x350db8(0x92))/0x7*(-parseInt(_0x350db8(0x8e))/0x8)+-parseInt(_0x350db8(0x83))/0x9*(parseInt(_0x350db8(0x8c))/0xa)+parseInt(_0x350db8(0x85))/0xb;if(_0x5b6d24===_0xb84f1c)break;else _0x1551e1['push'](_0x1551e1['shift']());}catch(_0x490352){_0x1551e1['push'](_0x1551e1['shift']());}}}(a25_0x580d,0x90850));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x3e72(_0x1fc4e6,_0x498000){_0x1fc4e6=_0x1fc4e6-0x7f;const _0x580d25=a25_0x580d();let _0x3e7273=_0x580d25[_0x1fc4e6];return _0x3e7273;}export class ProfilesCommand extends BaseCommand{['name']=a25_0xc505a2(0x96);[a25_0xc505a2(0x91)]=a25_0xc505a2(0x81);async[a25_0xc505a2(0x82)](_0xef68fd){const _0x5e8c46=a25_0xc505a2,{options:_0x5b2ba6}=_0xef68fd;try{const _0x38f869=listProfiles(),_0x147110=getActiveProfile();if(_0x38f869[_0x5e8c46(0x87)]===0x0)return console['log'](_0x5e8c46(0x88)),console[_0x5e8c46(0x94)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x5e8c46(0x94)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x4a0088=_0x38f869[_0x5e8c46(0x8a)](_0x4d13ea=>{const _0x2fe4c7=_0x5e8c46,_0x43c568=_0x4d13ea[_0x2fe4c7(0x8f)]===_0x147110,_0x413d63=getProfileParams(_0x4d13ea[_0x2fe4c7(0x90)]);return{'name':_0x4d13ea[_0x2fe4c7(0x8f)],'active':_0x43c568,'scope':_0x4d13ea[_0x2fe4c7(0x80)],'description':_0x4d13ea[_0x2fe4c7(0x90)][_0x2fe4c7(0x91)]||'','params':_0x413d63};});return await handleSDKOutput(_0x4a0088,_0x5b2ba6),0x0;}catch(_0x133e9e){return _0x133e9e instanceof Error&&console[_0x5e8c46(0x86)](_0x5e8c46(0x93)+_0x133e9e['message']),0x1;}}}
@@ -1 +1 @@
1
- const a26_0x440d2e=a26_0x1de2;(function(_0x5d294f,_0x5ce1b4){const _0x593985=a26_0x1de2,_0x48975b=_0x5d294f();while(!![]){try{const _0x2293ce=parseInt(_0x593985(0x1f5))/0x1+-parseInt(_0x593985(0x1f6))/0x2+parseInt(_0x593985(0x1d6))/0x3+-parseInt(_0x593985(0x1f1))/0x4+-parseInt(_0x593985(0x1e4))/0x5*(-parseInt(_0x593985(0x1f8))/0x6)+parseInt(_0x593985(0x1cb))/0x7*(parseInt(_0x593985(0x1d8))/0x8)+-parseInt(_0x593985(0x1cf))/0x9*(-parseInt(_0x593985(0x1db))/0xa);if(_0x2293ce===_0x5ce1b4)break;else _0x48975b['push'](_0x48975b['shift']());}catch(_0x533f74){_0x48975b['push'](_0x48975b['shift']());}}}(a26_0x3a27,0x635d2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x1de2(_0x2cf790,_0x58afaf){_0x2cf790=_0x2cf790-0x1c8;const _0x3a27ac=a26_0x3a27();let _0x1de2a4=_0x3a27ac[_0x2cf790];return _0x1de2a4;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a26_0x3a27(){const _0x184d88=['Executing\x20statement\x20','originalMessage','completedSplits','catalog','message','elapsedTimeMillis','validate','No\x20SQL\x20provided','2772220DXRwjX','\x0aAll\x20results\x20saved\x20to\x20','site','Executing\x20query...','200980ENSyKJ','1456144VkfLNO','file','762RJXaEJ','jobId','database','Run\x20Trino\x20queries\x20(streaming)','processedRows','Site:\x20','328587XQAHCC','data','args','push','10740726ijiPOj','Catalog:\x20','Executing\x20query\x20[','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','output','information_schema','\x20splits','618195uEtfAl','verbose','8PGwFTB','options','length','10wNTQyi','totalSplits','stats','state','name','error','setExtra','setJobId','execute','7115noJxNT','\x20rows\x20','Statement\x20','join','SQL:\x20'];a26_0x3a27=function(){return _0x184d88;};return a26_0x3a27();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a26_0x440d2e(0x1df)]='query';['description']=a26_0x440d2e(0x1c8);async[a26_0x440d2e(0x1e3)](_0x1ea5b3){const _0x342416=a26_0x440d2e,{options:_0xba77b6,args:_0x228fb3,tdx:_0x90f06d}=_0x1ea5b3,_0x5ddda2=_0x228fb3[0x0],_0x270477=_0xba77b6[_0x342416(0x1f7)];let _0x3aa67b;try{if(_0x270477)_0x3aa67b=readSqlStatementsFromFile(_0x270477);else{if(_0x5ddda2==='-')_0x3aa67b=await readSqlStatementsFromStdin();else{if(_0x5ddda2&&isSqlFilePath(_0x5ddda2))_0x3aa67b=readSqlStatementsFromFile(_0x5ddda2);else{if(_0x5ddda2)_0x3aa67b=splitSqlStatements(_0x5ddda2);else throw new Error(_0x342416(0x1f0));}}}}catch(_0x4a7347){return console['error']('Error:\x20'+_0x4a7347['message']),0x1;}const _0x5f3830=_0xba77b6[_0x342416(0x1fa)]||_0x342416(0x1d4),_0x43c86c=_0xba77b6[_0x342416(0x1ec)];try{const _0x4cfe42=[],_0x42f6e0=!!_0xba77b6[_0x342416(0x1d3)];for(let _0x592b1c=0x0;_0x592b1c<_0x3aa67b[_0x342416(0x1da)];_0x592b1c++){const _0x475a96=_0x3aa67b[_0x592b1c],_0x1c064e=_0x592b1c+0x1,_0x3e0a45=_0x3aa67b[_0x342416(0x1da)],_0x4e3fec=_0x3e0a45>0x1;_0xba77b6['verbose']&&(console[_0x342416(0x1e0)]('\x0a'+(_0x4e3fec?_0x342416(0x1e6)+_0x1c064e+'/'+_0x3e0a45+':':'')),console[_0x342416(0x1e0)](_0x342416(0x1ca)+_0xba77b6[_0x342416(0x1f3)]),console['error'](_0x342416(0x1d0)+(_0x43c86c||'td')),console[_0x342416(0x1e0)]('Schema:\x20'+_0x5f3830),console[_0x342416(0x1e0)](_0x342416(0x1e8)+_0x475a96));const _0x36a635=_0x4e3fec?_0x342416(0x1e9)+_0x1c064e+'/'+_0x3e0a45+'...':_0x342416(0x1f4);try{const _0xf5ede8=await withProgressSpinner(_0x36a635,async _0x19ccac=>{const _0x26bf6d=_0x342416,_0x2ea7e5=await _0x90f06d['query'][_0x26bf6d(0x1e3)](_0x475a96,{'catalog':_0x43c86c,'schema':_0x5f3830,'onJobId':_0x21bc85=>{const _0x193bcc=_0x26bf6d;_0x19ccac[_0x193bcc(0x1e2)](_0x21bc85);},'onProgress':_0x3bd79c=>{const _0x30e556=_0x26bf6d;_0x19ccac['setPhase'](_0x30e556(0x1d1)+_0x3bd79c[_0x30e556(0x1de)]+']'),_0x19ccac[_0x30e556(0x1e1)](formatRows(_0x3bd79c[_0x30e556(0x1c9)])+_0x30e556(0x1e5)+_0x3bd79c[_0x30e556(0x1eb)]+'/'+_0x3bd79c[_0x30e556(0x1dc)]+_0x30e556(0x1d5));}});return _0x2ea7e5;},{'verbose':_0xba77b6[_0x342416(0x1d7)]}),_0x1ad60d=_0xf5ede8[_0x342416(0x1cc)],_0x54fe9a=_0x1ad60d[_0x342416(0x1f9)]?'\x20[Job\x20ID:\x20'+_0x1ad60d['jobId']+']':'',_0x37df5e=_0x4e3fec?_0x342416(0x1e6)+_0x1c064e+'/'+_0x3e0a45+'\x20-\x20':'';console['error']('✔\x20'+_0x37df5e+'Query\x20completed:\x20Processed\x20'+formatRows(_0x1ad60d[_0x342416(0x1dd)][_0x342416(0x1c9)])+_0x342416(0x1e5)+('in\x20'+formatElapsed(_0x1ad60d[_0x342416(0x1dd)][_0x342416(0x1ee)])+_0x54fe9a));if(_0x4e3fec&&_0x42f6e0){const _0xb1f94b=resolveOutputOptions(_0xba77b6),_0x5ba853=await formatQueryOutput(_0x1ad60d,_0xb1f94b);_0x4cfe42[_0x342416(0x1ce)](_0x5ba853);}else await handleQueryOutput(_0x1ad60d,_0xba77b6);}catch(_0x28f4ee){const _0x61da86=_0x4e3fec?_0x342416(0x1e6)+_0x1c064e+'/'+_0x3e0a45+':\x0a':'',_0x4c3259=_0x28f4ee instanceof SDKError?_0x28f4ee[_0x342416(0x1ea)]:_0x28f4ee[_0x342416(0x1ed)];return console['error'](''+_0x61da86+_0x4c3259),0x1;}}if(_0x3aa67b[_0x342416(0x1da)]>0x1&&_0x42f6e0&&_0x4cfe42[_0x342416(0x1da)]>0x0){const _0x5af751=_0x4cfe42[_0x342416(0x1e7)]('\x0a');writeFileSync(_0xba77b6[_0x342416(0x1d3)],_0x5af751),console[_0x342416(0x1e0)](_0x342416(0x1f2)+_0xba77b6[_0x342416(0x1d3)]);}return 0x0;}catch(_0x28ce6f){throw _0x28ce6f;}}[a26_0x440d2e(0x1ef)](_0x2d154a){const _0x59be2f=a26_0x440d2e,_0x2c707c=_0x2d154a[_0x59be2f(0x1cd)][0x0],_0x3cd33=_0x2d154a[_0x59be2f(0x1d9)][_0x59be2f(0x1f7)];if(!_0x2c707c&&!_0x3cd33)return _0x59be2f(0x1d2);if(_0x2c707c&&_0x3cd33)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a26_0x1cbeda=a26_0x5d2e;(function(_0xe8d8c4,_0x450c2b){const _0x4bd219=a26_0x5d2e,_0x28dbc9=_0xe8d8c4();while(!![]){try{const _0x3f5803=parseInt(_0x4bd219(0xfe))/0x1*(parseInt(_0x4bd219(0x10b))/0x2)+parseInt(_0x4bd219(0x113))/0x3*(parseInt(_0x4bd219(0xf2))/0x4)+parseInt(_0x4bd219(0xe4))/0x5+-parseInt(_0x4bd219(0x109))/0x6*(-parseInt(_0x4bd219(0xe2))/0x7)+-parseInt(_0x4bd219(0xe9))/0x8*(-parseInt(_0x4bd219(0x10d))/0x9)+-parseInt(_0x4bd219(0x103))/0xa+-parseInt(_0x4bd219(0x107))/0xb;if(_0x3f5803===_0x450c2b)break;else _0x28dbc9['push'](_0x28dbc9['shift']());}catch(_0x3f89d0){_0x28dbc9['push'](_0x28dbc9['shift']());}}}(a26_0x4f9e,0x6caeb));function a26_0x5d2e(_0x247543,_0x18d3b6){_0x247543=_0x247543-0xe1;const _0x4f9e5a=a26_0x4f9e();let _0x5d2e72=_0x4f9e5a[_0x247543];return _0x5d2e72;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x4f9e(){const _0x4b9ffb=['1671AYdQOm','setJobId','236201UxEKfk','Site:\x20','3129445CzdWUM','Executing\x20query\x20[','validate','message','\x20splits','8FdxOgc','Statement\x20','processedRows','Executing\x20query...','totalSplits','length','description','Query\x20completed:\x20Processed\x20','output','6244EAbTZN','...','in\x20','information_schema','jobId','options','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','\x20rows\x20','file','query','elapsedTimeMillis','push','510593HMbSlP','join','error','stats','No\x20SQL\x20provided','145360girAdD','completedSplits','\x20-\x20','catalog','21597752LFUYhf','site','6VWFLYl','data','2uqkzPO','verbose','3450861TKzzUO','execute','Catalog:\x20','setExtra','Executing\x20statement\x20','originalMessage'];a26_0x4f9e=function(){return _0x4b9ffb;};return a26_0x4f9e();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x1cbeda(0xfb);[a26_0x1cbeda(0xef)]='Run\x20Trino\x20queries\x20(streaming)';async[a26_0x1cbeda(0x10e)](_0x2815b3){const _0x3fe0bb=a26_0x1cbeda,{options:_0x22849b,args:_0x3a8728,tdx:_0x589d10}=_0x2815b3,_0x4cfbc3=_0x3a8728[0x0],_0x6732b1=_0x22849b[_0x3fe0bb(0xfa)];let _0x4b7baa;try{if(_0x6732b1)_0x4b7baa=readSqlStatementsFromFile(_0x6732b1);else{if(_0x4cfbc3==='-')_0x4b7baa=await readSqlStatementsFromStdin();else{if(_0x4cfbc3&&isSqlFilePath(_0x4cfbc3))_0x4b7baa=readSqlStatementsFromFile(_0x4cfbc3);else{if(_0x4cfbc3)_0x4b7baa=splitSqlStatements(_0x4cfbc3);else throw new Error(_0x3fe0bb(0x102));}}}}catch(_0x4a064d){return console[_0x3fe0bb(0x100)]('Error:\x20'+_0x4a064d[_0x3fe0bb(0xe7)]),0x1;}const _0x45b48a=_0x22849b['database']||_0x3fe0bb(0xf5),_0x127589=_0x22849b[_0x3fe0bb(0x106)];try{const _0x198d7c=[],_0x244dc7=!!_0x22849b[_0x3fe0bb(0xf1)];for(let _0x600e2a=0x0;_0x600e2a<_0x4b7baa['length'];_0x600e2a++){const _0x593b5b=_0x4b7baa[_0x600e2a],_0x50f0db=_0x600e2a+0x1,_0x31b1b8=_0x4b7baa['length'],_0x4b6b7c=_0x31b1b8>0x1;_0x22849b[_0x3fe0bb(0x10c)]&&(console['error']('\x0a'+(_0x4b6b7c?_0x3fe0bb(0xea)+_0x50f0db+'/'+_0x31b1b8+':':'')),console[_0x3fe0bb(0x100)](_0x3fe0bb(0xe3)+_0x22849b[_0x3fe0bb(0x108)]),console[_0x3fe0bb(0x100)](_0x3fe0bb(0x10f)+(_0x127589||'td')),console[_0x3fe0bb(0x100)]('Schema:\x20'+_0x45b48a),console[_0x3fe0bb(0x100)]('SQL:\x20'+_0x593b5b));const _0x257b0d=_0x4b6b7c?_0x3fe0bb(0x111)+_0x50f0db+'/'+_0x31b1b8+_0x3fe0bb(0xf3):_0x3fe0bb(0xec);try{const _0x48280a=await withProgressSpinner(_0x257b0d,async _0x187d3a=>{const _0x4b1490=_0x3fe0bb,_0x41f159=await _0x589d10[_0x4b1490(0xfb)][_0x4b1490(0x10e)](_0x593b5b,{'catalog':_0x127589,'schema':_0x45b48a,'onJobId':_0x144b02=>{const _0x162810=_0x4b1490;_0x187d3a[_0x162810(0xe1)](_0x144b02);},'onProgress':_0x25de37=>{const _0x5518f7=_0x4b1490;_0x187d3a['setPhase'](_0x5518f7(0xe5)+_0x25de37['state']+']'),_0x187d3a[_0x5518f7(0x110)](formatRows(_0x25de37['processedRows'])+_0x5518f7(0xf9)+_0x25de37[_0x5518f7(0x104)]+'/'+_0x25de37[_0x5518f7(0xed)]+_0x5518f7(0xe8));}});return _0x41f159;},{'verbose':_0x22849b[_0x3fe0bb(0x10c)]}),_0xb5472f=_0x48280a[_0x3fe0bb(0x10a)],_0x18af5b=_0xb5472f[_0x3fe0bb(0xf6)]?'\x20[Job\x20ID:\x20'+_0xb5472f[_0x3fe0bb(0xf6)]+']':'',_0x332def=_0x4b6b7c?_0x3fe0bb(0xea)+_0x50f0db+'/'+_0x31b1b8+_0x3fe0bb(0x105):'';console[_0x3fe0bb(0x100)]('✔\x20'+_0x332def+_0x3fe0bb(0xf0)+formatRows(_0xb5472f[_0x3fe0bb(0x101)][_0x3fe0bb(0xeb)])+_0x3fe0bb(0xf9)+(_0x3fe0bb(0xf4)+formatElapsed(_0xb5472f['stats'][_0x3fe0bb(0xfc)])+_0x18af5b));if(_0x4b6b7c&&_0x244dc7){const _0x43b31f=resolveOutputOptions(_0x22849b),_0x20bb70=await formatQueryOutput(_0xb5472f,_0x43b31f);_0x198d7c[_0x3fe0bb(0xfd)](_0x20bb70);}else await handleQueryOutput(_0xb5472f,_0x22849b);}catch(_0xba4b37){const _0x25f3d6=_0x4b6b7c?_0x3fe0bb(0xea)+_0x50f0db+'/'+_0x31b1b8+':\x0a':'',_0x1a0a92=_0xba4b37 instanceof SDKError?_0xba4b37[_0x3fe0bb(0x112)]:_0xba4b37[_0x3fe0bb(0xe7)];return console[_0x3fe0bb(0x100)](''+_0x25f3d6+_0x1a0a92),0x1;}}if(_0x4b7baa[_0x3fe0bb(0xee)]>0x1&&_0x244dc7&&_0x198d7c[_0x3fe0bb(0xee)]>0x0){const _0x484a34=_0x198d7c[_0x3fe0bb(0xff)]('\x0a');writeFileSync(_0x22849b['output'],_0x484a34),console[_0x3fe0bb(0x100)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x22849b[_0x3fe0bb(0xf1)]);}return 0x0;}catch(_0x33c6e4){throw _0x33c6e4;}}[a26_0x1cbeda(0xe6)](_0x28a938){const _0x21f0a1=a26_0x1cbeda,_0x423df7=_0x28a938['args'][0x0],_0x1f5c84=_0x28a938[_0x21f0a1(0xf7)]['file'];if(!_0x423df7&&!_0x1f5c84)return _0x21f0a1(0xf8);if(_0x423df7&&_0x1f5c84)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}