@treasuredata/tdx 0.16.18 → 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_0x31cdc4=a21_0x4f71;(function(_0x310c30,_0xae65ce){const _0x8345b3=a21_0x4f71,_0x23f516=_0x310c30();while(!![]){try{const _0x463e93=parseInt(_0x8345b3(0xf3))/0x1*(-parseInt(_0x8345b3(0xdf))/0x2)+parseInt(_0x8345b3(0xd5))/0x3+parseInt(_0x8345b3(0x113))/0x4+parseInt(_0x8345b3(0xef))/0x5*(parseInt(_0x8345b3(0xee))/0x6)+-parseInt(_0x8345b3(0xe8))/0x7*(parseInt(_0x8345b3(0xec))/0x8)+parseInt(_0x8345b3(0xfe))/0x9+-parseInt(_0x8345b3(0xf2))/0xa*(parseInt(_0x8345b3(0x101))/0xb);if(_0x463e93===_0xae65ce)break;else _0x23f516['push'](_0x23f516['shift']());}catch(_0x1262bd){_0x23f516['push'](_0x23f516['shift']());}}}(a21_0x1b71,0x37c9d));import a21_0x5e625c from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a21_0x4f71(_0x19dc00,_0x176dd8){_0x19dc00=_0x19dc00-0xd5;const _0x1b711c=a21_0x1b71();let _0x4f71d0=_0x1b711c[_0x19dc00];return _0x4f71d0;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';function a21_0x1b71(){const _0x28496b=['init','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','285523nCLCIY','dim','\x20\x20\x20\x20\x22env\x22:\x20{','find','72kYGpzI','stop','6OdcbKw','2012215PEVITp','SIGINT','SIGTERM','183550ciDnyy','409tpldYA','project','\x0aClaude\x20Code\x20Configuration:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','cyan','Port\x20','bold','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','port','description','2435661VyZMcb','llm','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','220yQSRfn','projects','close','name','green','\x20\x20Agents:','yellow','server','Starting\x20proxy\x20server...','Project\x20\x27','log','execute','http://0.0.0.0:','exit','logger','Resolving\x20project...','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','Server\x20Configuration:','983012ApIbEs','NOT_FOUND','221226YNCLKQ','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','white','logLevel','created\x20on-demand\x20per\x20model','\x20\x20}','start','\x20is\x20unavailable,\x20using\x20port\x20','attributes','site','146FHTUQA','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20Site:','\x20\x20{','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'];a21_0x1b71=function(){return _0x28496b;};return a21_0x1b71();}async function getProjectIdOrDefault(_0x47d22c,_0x344928){const _0x57e4ef=a21_0x4f71,{tdx:_0x556418,options:_0x2f1ead}=_0x47d22c,_0x51c52e=_0x344928||_0x2f1ead['llmProject'];if(_0x51c52e){const _0x36e920=await _0x556418[_0x57e4ef(0xff)][_0x57e4ef(0x102)](),_0x32ec37=_0x36e920[_0x57e4ef(0xeb)](_0x44eab1=>_0x44eab1[_0x57e4ef(0xdd)][_0x57e4ef(0x104)]===_0x51c52e);if(!_0x32ec37)throw new SDKError(ErrorCode[_0x57e4ef(0x114)],_0x57e4ef(0x10a)+_0x51c52e+'\x27\x20not\x20found',undefined,{'helpText':_0x57e4ef(0xe1)});return _0x32ec37['id'];}const _0x270a0d=await _0x556418[_0x57e4ef(0xff)]['getOrCreateDefaultProject']();return _0x270a0d['id'];}export class LLMProxyCommand extends BaseCommand{['name']='llm:proxy';[a21_0x31cdc4(0xfd)]=a21_0x31cdc4(0x111);[a21_0x31cdc4(0x108)];[a21_0x31cdc4(0x10f)];async[a21_0x31cdc4(0x10c)](_0x4e477c){const _0xa65385=a21_0x31cdc4,{tdx:_0x15739a,options:_0x3a8973}=_0x4e477c;try{const _0x49a4c7=_0x3a8973,_0x94dc57=_0x49a4c7[_0xa65385(0xfc)]||0xfa0,_0x4295f0=_0x49a4c7[_0xa65385(0xf4)],_0x243163=await findAvailablePort(_0x94dc57);console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0x110)));const _0x49b89d=await getProjectIdOrDefault(_0x4e477c,_0x4295f0),_0x2d9f28=await _0x15739a[_0xa65385(0xff)][_0xa65385(0x102)](),_0x2cf88e=_0x2d9f28['find'](_0x13e626=>_0x13e626['id']===_0x49b89d);this[_0xa65385(0x10f)]=new TDXLogger(_0x3a8973[_0xa65385(0xd8)]),await this[_0xa65385(0x10f)][_0xa65385(0xe6)](),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0x109)));_0x243163!==_0x94dc57&&console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)](_0xa65385(0xf9)+_0x94dc57+_0xa65385(0xdc)+_0x243163));this[_0xa65385(0x108)]=new ProxyServer({'port':_0x243163,'projectId':_0x49b89d,'tdx':_0x15739a,'logger':this[_0xa65385(0x10f)],'site':_0x3a8973[_0xa65385(0xde)]}),await this[_0xa65385(0x108)][_0xa65385(0xdb)](),console[_0xa65385(0x10b)](a21_0x5e625c['yellow']['bold']('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)](_0xa65385(0xd6))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)]('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x105)][_0xa65385(0xfa)](_0xa65385(0xe7))),console['log'](a21_0x5e625c[_0xa65385(0xf8)](_0xa65385(0x112))),console['log'](a21_0x5e625c['dim']('\x20\x20Address:'),a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0x10d)+_0x243163)),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)]('\x20\x20Project:'),a21_0x5e625c[_0xa65385(0xd7)](_0x2cf88e?.[_0xa65385(0xdd)][_0xa65385(0x104)]||_0x49b89d)),console['log'](a21_0x5e625c['dim'](_0xa65385(0x106)),a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xd9))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0xe3)),a21_0x5e625c[_0xa65385(0xd7)](_0x3a8973['site'])),console['log'](a21_0x5e625c[_0xa65385(0xf8)](_0xa65385(0xf5))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0xf6))),console[_0xa65385(0x10b)](a21_0x5e625c['white'](_0xa65385(0xe4))),console[_0xa65385(0x10b)](a21_0x5e625c['white'](_0xa65385(0xea))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xd7)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x243163+'\x22,')),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xfb))),console['log'](a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xe0))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xd7)]('\x20\x20\x20\x20}')),console['log'](a21_0x5e625c[_0xa65385(0xd7)](_0xa65385(0xda))),console['log'](a21_0x5e625c[_0xa65385(0xf8)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0x100))),console[_0xa65385(0x10b)](a21_0x5e625c['dim'](_0xa65385(0xe2))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0xe9)](_0xa65385(0xf7))),console[_0xa65385(0x10b)](a21_0x5e625c[_0xa65385(0x107)](_0xa65385(0xe5)));const _0x557da9=async()=>{const _0x55d94b=_0xa65385;console['log'](a21_0x5e625c[_0x55d94b(0xe9)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x55d94b(0x108)]&&await this[_0x55d94b(0x108)][_0x55d94b(0xed)](),this[_0x55d94b(0x10f)]&&await this['logger']['close'](),console['log'](a21_0x5e625c[_0x55d94b(0x105)]('✓\x20Proxy\x20server\x20stopped')),process[_0x55d94b(0x10e)](0x0);};return process['on'](_0xa65385(0xf0),_0x557da9),process['on'](_0xa65385(0xf1),_0x557da9),await new Promise(()=>{}),0x0;}catch(_0x1377a7){this[_0xa65385(0x108)]&&await this[_0xa65385(0x108)][_0xa65385(0xed)]();this[_0xa65385(0x10f)]&&await this[_0xa65385(0x10f)][_0xa65385(0x103)]();throw _0x1377a7;}}}
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
- const a22_0x307767=a22_0x5570;function a22_0x5570(_0x53f5fa,_0x39dd64){_0x53f5fa=_0x53f5fa-0xbe;const _0x184c3a=a22_0x184c();let _0x55703a=_0x184c3a[_0x53f5fa];return _0x55703a;}(function(_0x41fec1,_0x1b2f58){const _0x16345f=a22_0x5570,_0x7e2813=_0x41fec1();while(!![]){try{const _0x4b2f0a=parseInt(_0x16345f(0xc5))/0x1*(parseInt(_0x16345f(0xcb))/0x2)+-parseInt(_0x16345f(0xcf))/0x3+-parseInt(_0x16345f(0xc0))/0x4+parseInt(_0x16345f(0xd3))/0x5*(parseInt(_0x16345f(0xc3))/0x6)+parseInt(_0x16345f(0xd5))/0x7*(-parseInt(_0x16345f(0xbf))/0x8)+parseInt(_0x16345f(0xc9))/0x9*(-parseInt(_0x16345f(0xd6))/0xa)+parseInt(_0x16345f(0xcd))/0xb*(parseInt(_0x16345f(0xd4))/0xc);if(_0x4b2f0a===_0x1b2f58)break;else _0x7e2813['push'](_0x7e2813['shift']());}catch(_0x25c963){_0x7e2813['push'](_0x7e2813['shift']());}}}(a22_0x184c,0x23eeb));import{BaseCommand}from'./command.js';function a22_0x184c(){const _0x44079b=['3324wCXsZi','1563569QrySkm','10KAIpTm','TDX_API_KEY','context','error','8NkQsBw','506084TeTPEq','../mcp/server.js','MCP\x20server\x20error:\x20','960yjQKKG','site','19427tfreVO','env','name','TDX_SITE','973278Esywqf','TDX_PROFILE','30bNSqcR','description','12056xojums','profile','326004vgOafn','apiKey','execute','mcp','3715kyxzvZ'];a22_0x184c=function(){return _0x44079b;};return a22_0x184c();}export class MCPCommand extends BaseCommand{[a22_0x307767(0xc7)]=a22_0x307767(0xd2);[a22_0x307767(0xcc)]='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async[a22_0x307767(0xd1)](_0x130f15){const _0x4dc45f=a22_0x307767,{tdx:_0x11bac3}=_0x130f15,_0x4cbf08={};if(process[_0x4dc45f(0xc6)]['TDX_PROFILE'])_0x4cbf08['TDX_PROFILE']=process[_0x4dc45f(0xc6)][_0x4dc45f(0xca)];else{if(process[_0x4dc45f(0xc6)][_0x4dc45f(0xd7)])_0x4cbf08['TDX_API_KEY']=process['env'][_0x4dc45f(0xd7)],process[_0x4dc45f(0xc6)][_0x4dc45f(0xc8)]&&(_0x4cbf08[_0x4dc45f(0xc8)]=process[_0x4dc45f(0xc6)][_0x4dc45f(0xc8)]);else _0x11bac3['context'][_0x4dc45f(0xd0)]&&(_0x4cbf08[_0x4dc45f(0xd7)]=_0x11bac3['context']['apiKey'],_0x4cbf08[_0x4dc45f(0xc8)]=_0x11bac3[_0x4dc45f(0xd8)][_0x4dc45f(0xc4)]);}_0x11bac3[_0x4dc45f(0xd8)][_0x4dc45f(0xce)]&&(_0x4cbf08[_0x4dc45f(0xca)]=_0x11bac3[_0x4dc45f(0xd8)][_0x4dc45f(0xce)]);try{const {startMCPServer:_0x4ebcc5}=await import(_0x4dc45f(0xc1));return await _0x4ebcc5({'env':_0x4cbf08}),0x0;}catch(_0x117d50){const _0x4a2a3e=_0x117d50 instanceof Error?_0x117d50['message']:String(_0x117d50);return console[_0x4dc45f(0xbe)](_0x4dc45f(0xc2)+_0x4a2a3e),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_0x495ffd=a23_0x4751;(function(_0x15c5dc,_0xc5c51a){const _0x5c747d=a23_0x4751,_0x588666=_0x15c5dc();while(!![]){try{const _0x4ce8ae=-parseInt(_0x5c747d(0x108))/0x1+parseInt(_0x5c747d(0x13f))/0x2*(parseInt(_0x5c747d(0x1b6))/0x3)+parseInt(_0x5c747d(0x173))/0x4*(-parseInt(_0x5c747d(0xff))/0x5)+-parseInt(_0x5c747d(0x1d9))/0x6*(parseInt(_0x5c747d(0x187))/0x7)+-parseInt(_0x5c747d(0x153))/0x8*(-parseInt(_0x5c747d(0xe8))/0x9)+-parseInt(_0x5c747d(0x1a3))/0xa*(-parseInt(_0x5c747d(0x135))/0xb)+parseInt(_0x5c747d(0x111))/0xc;if(_0x4ce8ae===_0xc5c51a)break;else _0x588666['push'](_0x588666['shift']());}catch(_0x2050da){_0x588666['push'](_0x588666['shift']());}}}(a23_0x4e13,0x9db01));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x1ccbd2 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_0x3fcb40 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x4751(_0x159bb4,_0x3f927d){_0x159bb4=_0x159bb4-0xc3;const _0x4e1355=a23_0x4e13();let _0x475141=_0x4e1355[_0x159bb4];return _0x475141;}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x495ffd(0x154),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x225b74){const _0x3ba25f=a23_0x495ffd,_0x33bbda=process['platform'],_0x49f7b8=_0x33bbda===_0x3ba25f(0x120)?'open':_0x33bbda==='win32'?_0x3ba25f(0x181):_0x3ba25f(0x133);spawn(_0x49f7b8,[_0x225b74],{'detached':!![],'stdio':_0x3ba25f(0x168)})[_0x3ba25f(0x1c1)]();}function migrateLegacyDirectory(){const _0x277155=a23_0x495ffd;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3803e5=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3803e5['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x277155(0x13c)](a23_0x3fcb40[_0x277155(0x1b9)](_0x277155(0xfc)+LEGACY_PARENT_SEGMENT_DIR+_0x277155(0x19b)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x277155(0x13c)](a23_0x3fcb40[_0x277155(0x176)](_0x277155(0x1da)+LEGACY_PARENT_SEGMENT_DIR+_0x277155(0x1a7))),![];console[_0x277155(0x13c)](a23_0x3fcb40[_0x277155(0x1b9)](_0x277155(0x139)+LEGACY_PARENT_SEGMENT_DIR+_0x277155(0x10f)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x277155(0x13c)](a23_0x3fcb40['green'](_0x277155(0x147)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x368d59){const _0x11c7fa=_0x368d59 instanceof Error?_0x368d59[_0x277155(0x1cf)]:String(_0x368d59);return console[_0x277155(0x13c)](a23_0x3fcb40[_0x277155(0x1de)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x11c7fa+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x495ffd(0x137)](_0x26f260){return migrateLegacyDirectory(),super['run'](_0x26f260);}}function resolveYamlFile(_0x5ab396){const _0x3595fb=a23_0x495ffd;if(_0x5ab396[_0x3595fb(0x182)](_0x3595fb(0xf4))||_0x5ab396[_0x3595fb(0x182)](_0x3595fb(0x10c)))return _0x5ab396;return a23_0x1ccbd2[_0x3595fb(0xca)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5ab396)+_0x3595fb(0xf4));}function formatProgressMessage(_0x4fdaca){const _0x122747=a23_0x495ffd,_0x4dcc04=_0x4fdaca[_0x122747(0xc9)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4dcc04){const [,_0x125684,_0x4ea0e3,_0x36752c='']=_0x4dcc04;return a23_0x3fcb40['dim'](_0x125684+':')+'\x20'+_0x4ea0e3+a23_0x3fcb40[_0x122747(0x176)](_0x36752c);}return a23_0x3fcb40[_0x122747(0x176)](_0x4fdaca);}function showFileNotFoundError(_0x18331a,_0x2f74a6){const _0x472598=a23_0x495ffd;console['error'](a23_0x3fcb40[_0x472598(0x1de)]('Error:\x20File\x20not\x20found:\x20'+_0x18331a+'\x0a')),console[_0x472598(0x13c)](a23_0x3fcb40['cyan'](_0x472598(0xc8)+_0x2f74a6+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x13b9af){const _0x4dd7ad=a23_0x495ffd;console[_0x4dd7ad(0x13c)](a23_0x3fcb40[_0x4dd7ad(0x1b9)](_0x4dd7ad(0x16f))),console[_0x4dd7ad(0x13c)](_0x13b9af);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x1cd);[a23_0x495ffd(0x132)]=a23_0x495ffd(0x19d);async['execute'](_0x1f545d){const _0x1c94d4=a23_0x495ffd,{options:_0x473812,args:_0x562a82,tdx:_0x305011}=_0x1f545d,_0x1de7ec=_0x562a82[0x0];_0x473812[_0x1c94d4(0x1d2)]&&(console['error'](_0x1c94d4(0x1a9)+_0x473812[_0x1c94d4(0x142)]),_0x1de7ec&&console['error'](_0x1c94d4(0x19f)+_0x1de7ec));const _0x5999f8=await withSpinner(_0x1de7ec?_0x1c94d4(0x1aa)+_0x1de7ec+_0x1c94d4(0xe3):_0x1c94d4(0x11c),()=>_0x305011['segment'][_0x1c94d4(0x197)](),{'verbose':_0x473812[_0x1c94d4(0x1d2)]});let _0x4888e3=_0x5999f8[_0x1c94d4(0x178)];if(_0x1de7ec){const _0x4560bc=_0x1de7ec[_0x1c94d4(0x19e)](/[.+^${}()|[\]\\]/g,_0x1c94d4(0xd2))[_0x1c94d4(0x19e)](/\*/g,'.*')[_0x1c94d4(0x19e)](/\?/g,'.'),_0x4efeca=new RegExp('^'+_0x4560bc+'$','i');_0x4888e3=_0x4888e3[_0x1c94d4(0x11e)](_0x4a7fa8=>_0x4efeca[_0x1c94d4(0xd1)](_0x4a7fa8['attributes'][_0x1c94d4(0x177)]));}_0x4888e3[_0x1c94d4(0x140)]((_0x283a0e,_0x4d2e15)=>_0x283a0e['attributes'][_0x1c94d4(0x177)][_0x1c94d4(0x103)](_0x4d2e15[_0x1c94d4(0xf7)][_0x1c94d4(0x177)])),console[_0x1c94d4(0x13c)](_0x1c94d4(0x145)+_0x4888e3[_0x1c94d4(0x15d)]+_0x1c94d4(0x141)+(_0x4888e3[_0x1c94d4(0x15d)]!==0x1?'s':''));const _0x354470=_0x176549=>{const _0x2ee98b=_0x1c94d4;return getConsoleNextUrl(_0x473812[_0x2ee98b(0x142)],'/app/dw/parentSegments/'+_0x176549);};if(_0x473812[_0x1c94d4(0x10a)]===_0x1c94d4(0x15f)||_0x473812[_0x1c94d4(0x10a)]===_0x1c94d4(0x18f)){const _0x2d8adb=_0x4888e3['map'](_0x31d2da=>({..._0x31d2da,'url':_0x354470(_0x31d2da['id'])}));await handleSDKOutput(_0x2d8adb,_0x473812);}else{if(_0x4888e3['length']===0x0)_0x1de7ec?console['log'](_0x1c94d4(0x114)+_0x1de7ec):console[_0x1c94d4(0x128)](_0x1c94d4(0xdb));else for(const _0x5a9449 of _0x4888e3){const _0x37b0e5=_0x5a9449[_0x1c94d4(0xf7)][_0x1c94d4(0x130)]?a23_0x3fcb40['dim']('\x20('+formatRows(_0x5a9449[_0x1c94d4(0xf7)]['population'])+')'):'',_0xea3507=hyperlink(_0x5a9449[_0x1c94d4(0xf7)][_0x1c94d4(0x177)],_0x354470(_0x5a9449['id']));console[_0x1c94d4(0x128)]('👥\x20'+_0xea3507+_0x37b0e5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x495ffd(0x177)]='segment:parent:create';['description']=a23_0x495ffd(0x1d5);async[a23_0x495ffd(0x1cc)](_0x5d1723){const _0xa7be12=a23_0x495ffd,{options:_0x5f1489,args:_0x214633,tdx:_0x224c99}=_0x5d1723;console[_0xa7be12(0x13c)](_0xa7be12(0x1c8)+_0xa7be12(0x17c)+_0xa7be12(0x1b3));const _0x439bdb=_0x5f1489;if(_0x214633['length']===0x0)return console[_0xa7be12(0x13c)](a23_0x3fcb40['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0xa7be12(0x13c)](_0xa7be12(0xf1)),0x1;const _0x8f292f=_0x214633[0x0];if(!_0x439bdb[_0xa7be12(0xc7)]||!_0x439bdb['table'])return console[_0xa7be12(0x13c)](_0xa7be12(0x158)),console[_0xa7be12(0x13c)](_0xa7be12(0xf1)),0x1;_0x439bdb['verbose']&&(console[_0xa7be12(0x13c)](_0xa7be12(0x1a9)+_0x439bdb[_0xa7be12(0x142)]),console[_0xa7be12(0x13c)](_0xa7be12(0x1dc)+_0x8f292f),console['error']('Database:\x20'+_0x439bdb[_0xa7be12(0xc7)]),console[_0xa7be12(0x13c)](_0xa7be12(0xef)+_0x439bdb[_0xa7be12(0xf3)]));const _0x381860=await loadJSONFromOptions(_0x439bdb[_0xa7be12(0xf7)],_0x439bdb[_0xa7be12(0xd7)]),_0x552abc=await loadJSONFromOptions(_0x439bdb['behaviors'],_0x439bdb[_0xa7be12(0x14d)]),_0x3d7521=await loadJSONFromOptions(_0x439bdb['customerGroup'],_0x439bdb[_0xa7be12(0x113)]),_0x1be80b={'name':_0x8f292f,'description':_0x439bdb['description'],'scheduleType':_0x439bdb['scheduleType'],'scheduleOption':_0x439bdb[_0xa7be12(0x193)],'timezone':_0x439bdb['timezone'],'master':{'parentDatabaseName':_0x439bdb[_0xa7be12(0xc7)],'parentTableName':_0x439bdb['table']},'attributes':_0x381860,'behaviors':_0x552abc,'customerGroup':_0x3d7521},_0x13b57a=await withSpinner(_0xa7be12(0x1d7)+_0x8f292f+_0xa7be12(0xe3),()=>_0x224c99[_0xa7be12(0x1a2)][_0xa7be12(0xd3)](_0x1be80b),{'verbose':_0x5f1489[_0xa7be12(0x1d2)]}),_0x282b8d=_0x13b57a[_0xa7be12(0x178)];return console['error'](_0xa7be12(0x16c)+_0x282b8d[_0xa7be12(0x177)]+_0xa7be12(0x1b0)+_0x282b8d['id']),await handleSDKOutput([_0x282b8d],_0x5f1489),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x1ce);[a23_0x495ffd(0x132)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x495ffd(0x1cc)](_0x6ebf4d){const _0x30198f=a23_0x495ffd,{options:_0x428eac,args:_0xcf4df7,tdx:_0x3ea144}=_0x6ebf4d;console[_0x30198f(0x13c)](_0x30198f(0x175)+_0x30198f(0x17c)+_0x30198f(0x1b3));const _0x164138=_0x428eac;if(_0xcf4df7['length']===0x0)return console['error'](a23_0x3fcb40[_0x30198f(0x1de)](_0x30198f(0xeb))),console[_0x30198f(0x13c)](_0x30198f(0x1bf)),0x1;const _0x4e29ee=_0xcf4df7[0x0];_0x164138[_0x30198f(0x1d2)]&&(console[_0x30198f(0x13c)](_0x30198f(0x1a9)+_0x164138[_0x30198f(0x142)]),console[_0x30198f(0x13c)](_0x30198f(0x1e3)+_0x4e29ee));const _0x3b564c=await withSpinner(_0x30198f(0x1b2)+_0x4e29ee+_0x30198f(0xe3),()=>_0x3ea144[_0x30198f(0x1a2)][_0x30198f(0x1d6)](_0x4e29ee),{'verbose':_0x164138[_0x30198f(0x1d2)]}),_0x5befcd=_0x3b564c['data'],_0x43c504=await loadJSONFromOptions(_0x164138[_0x30198f(0xe6)],_0x164138[_0x30198f(0x138)]),_0x15064d=await loadJSONFromOptions(_0x164138['addBehaviors'],_0x164138[_0x30198f(0x1c4)]),_0x2e1e39={'name':_0x5befcd[_0x30198f(0x177)],'description':_0x164138[_0x30198f(0x132)]!==undefined?_0x164138['description']:_0x5befcd[_0x30198f(0x132)],'scheduleType':_0x164138[_0x30198f(0x16e)]!==undefined?_0x164138['scheduleType']:_0x5befcd['scheduleType'],'scheduleOption':_0x164138['scheduleOption']!==undefined?_0x164138[_0x30198f(0x193)]:_0x5befcd[_0x30198f(0x193)],'timezone':_0x164138[_0x30198f(0x150)]!==undefined?_0x164138[_0x30198f(0x150)]:_0x5befcd[_0x30198f(0x150)],'master':_0x5befcd[_0x30198f(0x159)],'attributes':_0x43c504?[..._0x5befcd[_0x30198f(0xf7)]||[],..._0x43c504]:_0x5befcd[_0x30198f(0xf7)],'behaviors':_0x15064d?[..._0x5befcd['behaviors']||[],..._0x15064d]:_0x5befcd[_0x30198f(0x1a6)],'customerGroup':_0x5befcd['customerGroup']},_0x13a32a=await withSpinner(_0x30198f(0x11a)+_0x4e29ee+_0x30198f(0xe3),()=>_0x3ea144[_0x30198f(0x1a2)]['updateParent'](_0x4e29ee,_0x2e1e39),{'verbose':_0x164138['verbose']}),_0x123667=_0x13a32a[_0x30198f(0x178)];return console['error'](_0x30198f(0x115)+_0x123667[_0x30198f(0x177)]+'\x27'),await handleSDKOutput([_0x123667],_0x164138),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x495ffd(0x177)]='segment:parent:pull';[a23_0x495ffd(0x132)]=a23_0x495ffd(0x10b);async[a23_0x495ffd(0x1cc)](_0x423777){const _0x269b13=a23_0x495ffd,{options:_0x4f62e0,args:_0x5f2525,tdx:_0x4dbc36}=_0x423777,_0x26d9a6=_0x4f62e0,_0x4781b2=_0x5f2525[0x0]||_0x4f62e0[_0x269b13(0x179)];if(!_0x4781b2)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x26d9a6[_0x269b13(0x16a)]&&_0x26d9a6[_0x269b13(0x18b)])return console['error'](a23_0x3fcb40[_0x269b13(0x1de)](_0x269b13(0x1b4))),console['error'](a23_0x3fcb40[_0x269b13(0x176)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a23_0x3fcb40[_0x269b13(0x176)](_0x269b13(0x131)+PARENT_SEGMENT_DIR+_0x269b13(0x12f))),console[_0x269b13(0x13c)](a23_0x3fcb40[_0x269b13(0x1e2)](_0x269b13(0x116))),0x1;const _0x3548f8=_0x26d9a6[_0x269b13(0x18b)]||a23_0x1ccbd2[_0x269b13(0xca)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4781b2)+_0x269b13(0xf4));_0x26d9a6[_0x269b13(0x1d2)]&&(console[_0x269b13(0x13c)](_0x269b13(0x1a9)+_0x26d9a6[_0x269b13(0x142)]),console['error'](_0x269b13(0x1e3)+_0x4781b2),console[_0x269b13(0x13c)]('Output\x20file:\x20'+_0x3548f8));const _0x10b62c=await withSpinner(_0x269b13(0x109)+_0x4781b2+_0x269b13(0xe3),()=>_0x4dbc36[_0x269b13(0x1a2)][_0x269b13(0x1a1)](_0x4781b2),{'verbose':_0x26d9a6['verbose']}),_0x1d17e4=_0x10b62c['data'];if(existsSync(_0x3548f8)){const _0x16c1fe=readFileSync(_0x3548f8,_0x269b13(0xce)),_0x2de94f=generateDiff(_0x16c1fe,_0x1d17e4);if(!hasChanges(_0x2de94f))console[_0x269b13(0x13c)](a23_0x3fcb40[_0x269b13(0x149)]('✔')+_0x269b13(0x106)+a23_0x3fcb40[_0x269b13(0x1e2)](_0x3548f8)+_0x269b13(0x11b));else{console[_0x269b13(0x13c)](_0x269b13(0x198)+_0x3548f8+'\x27:'),console[_0x269b13(0x13c)]('─'[_0x269b13(0x167)](0x3c)),console[_0x269b13(0x13c)](formatDiffWithColors(_0x2de94f)),console[_0x269b13(0x13c)]('─'[_0x269b13(0x167)](0x3c));if(!_0x26d9a6[_0x269b13(0xfd)]){const _0x1141a4=await confirmKey(_0x269b13(0x19a)+_0x3548f8+'\x27?');if(!_0x1141a4)return console[_0x269b13(0x13c)](_0x269b13(0x1ca)),0x1;}writeFileSync(_0x3548f8,_0x1d17e4,_0x269b13(0xce)),console[_0x269b13(0x13c)](a23_0x3fcb40['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x3fcb40[_0x269b13(0x1e2)](_0x3548f8));}}else{const _0x3c488e=a23_0x1ccbd2['dirname'](_0x3548f8);!existsSync(_0x3c488e)&&mkdirSync(_0x3c488e,{'recursive':!![]}),writeFileSync(_0x3548f8,_0x1d17e4,_0x269b13(0xce)),console['error'](a23_0x3fcb40[_0x269b13(0x149)]('✔')+_0x269b13(0x189)+a23_0x3fcb40[_0x269b13(0x1e2)](_0x3548f8));}return saveSessionContext({'parent_segment':_0x4781b2},_0x26d9a6[_0x269b13(0x122)]),console['error'](a23_0x3fcb40[_0x269b13(0x149)]('✔')+_0x269b13(0x163)+a23_0x3fcb40[_0x269b13(0x176)](_0x269b13(0x16d))+_0x269b13(0x118)+a23_0x3fcb40['cyan'](_0x4781b2)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x16b);[a23_0x495ffd(0x132)]=a23_0x495ffd(0x1e1);async['execute'](_0x59350b){const _0x349cf1=a23_0x495ffd,{options:_0x17500c,args:_0x1cd3aa,tdx:_0x3518a6}=_0x59350b,_0x42ad38=_0x17500c,_0x3e34c2=_0x1cd3aa[0x0]||_0x17500c['parentSegment'];if(!_0x3e34c2)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x349cf1(0x191)),0x1;const _0x38654f=resolveYamlFile(_0x3e34c2);if(!existsSync(_0x38654f))return showFileNotFoundError(_0x38654f,_0x3e34c2),0x1;_0x42ad38[_0x349cf1(0x1d2)]&&(console[_0x349cf1(0x13c)](_0x349cf1(0x1a9)+_0x42ad38[_0x349cf1(0x142)]),console[_0x349cf1(0x13c)]('YAML\x20file:\x20'+_0x38654f));let _0x5456b1;try{_0x5456b1=readFileSync(_0x38654f,_0x349cf1(0xce));}catch(_0x184299){const _0x301def=_0x184299 instanceof Error?_0x184299['message']:String(_0x184299);return console[_0x349cf1(0x13c)](_0x349cf1(0x1d8)+_0x301def),0x1;}const _0x1988bc=await withSpinner(_0x349cf1(0x18a),()=>_0x3518a6[_0x349cf1(0x1a2)][_0x349cf1(0x15e)](_0x5456b1),{'verbose':_0x42ad38[_0x349cf1(0x1d2)]}),_0x14ca6c=_0x1988bc[_0x349cf1(0x178)],{isNew:_0x4c16cc,name:_0x3b5fba,hasChanges:_0x560b88,diffFormatted:_0x4ba70b}=_0x14ca6c;if(!_0x560b88)return console[_0x349cf1(0x13c)]('✔\x20No\x20changes\x20-\x20\x27'+_0x3b5fba+_0x349cf1(0x148)),0x0;_0x4c16cc?console['error'](_0x349cf1(0x171)+_0x3b5fba+'\x27:'):console[_0x349cf1(0x13c)](_0x349cf1(0x10d)+_0x3b5fba+'\x27:');console[_0x349cf1(0x13c)]('─'[_0x349cf1(0x167)](0x3c)),console[_0x349cf1(0x13c)](_0x4ba70b),console[_0x349cf1(0x13c)]('─'['repeat'](0x3c));const _0x5f1a4d=_0x4c16cc?_0x349cf1(0x13d)+_0x3b5fba+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x3b5fba+'\x27?';if(!_0x42ad38[_0x349cf1(0xfd)]){const _0x23569a=await confirmKey(_0x5f1a4d);if(!_0x23569a)return console[_0x349cf1(0x13c)](_0x349cf1(0x1ca)),0x1;}const _0x3c7b98=_0x4c16cc?_0x349cf1(0x134):_0x349cf1(0xd9),_0x2278c3=await withSpinner(_0x3c7b98+_0x349cf1(0x1c5)+_0x3b5fba+_0x349cf1(0xe3),()=>_0x14ca6c[_0x349cf1(0x1c6)](),{'verbose':_0x42ad38[_0x349cf1(0x1d2)]}),_0x329f49=_0x2278c3[_0x349cf1(0x178)],_0x54318c=getConsoleNextUrl(_0x42ad38['site'],_0x349cf1(0x143)+_0x329f49['id']),_0x1e4684=_0x4c16cc?_0x349cf1(0xe1):_0x349cf1(0xdf);return console[_0x349cf1(0x13c)]('✔\x20'+_0x1e4684+'\x20parent\x20segment\x20\x27'+_0x329f49[_0x349cf1(0x177)]+'\x27'),console['error']('\x20\x20'+_0x54318c),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x136);[a23_0x495ffd(0x132)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a23_0x495ffd(0x1cc)](_0x51438e){const _0x2c94c5=a23_0x495ffd,{options:_0x513070,args:_0x398aed,tdx:_0x6be8fe}=_0x51438e,_0x3f1cec=_0x513070,_0x4cc061=_0x398aed[0x0]||_0x513070[_0x2c94c5(0x179)];if(!_0x4cc061)return showParentSegmentNotSetError(_0x2c94c5(0x13e)+_0x2c94c5(0xe4)+_0x2c94c5(0x12c)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x2c94c5(0x1ab)),0x1;const _0x9d2cad=resolveYamlFile(_0x4cc061);if(!existsSync(_0x9d2cad))return showFileNotFoundError(_0x9d2cad,_0x4cc061),0x1;_0x3f1cec[_0x2c94c5(0x1d2)]&&(console[_0x2c94c5(0x13c)](_0x2c94c5(0x1a9)+_0x3f1cec[_0x2c94c5(0x142)]),console[_0x2c94c5(0x13c)](_0x2c94c5(0x101)+_0x9d2cad));let _0x1b1bf9;try{_0x1b1bf9=readFileSync(_0x9d2cad,_0x2c94c5(0xce));}catch(_0x569790){const _0x4b08e9=_0x569790 instanceof Error?_0x569790[_0x2c94c5(0x1cf)]:String(_0x569790);return console[_0x2c94c5(0x13c)](_0x2c94c5(0x1d8)+_0x4b08e9),0x1;}const _0x41d1ef=createCommandSpinner(a23_0x3fcb40['dim'](_0x2c94c5(0x15c)),{'verbose':_0x3f1cec[_0x2c94c5(0x1d2)]});_0x41d1ef[_0x2c94c5(0x181)]();const _0x20d67e={'onProgress':_0x237769=>{const _0x5c0653=_0x2c94c5;_0x41d1ef[_0x5c0653(0x1bc)]=formatProgressMessage(_0x237769);}};if(_0x3f1cec['master'])_0x20d67e[_0x2c94c5(0x159)]=!![];if(_0x3f1cec[_0x2c94c5(0x194)])_0x20d67e[_0x2c94c5(0x194)]=!![];_0x3f1cec[_0x2c94c5(0xcd)]&&(_0x20d67e[_0x2c94c5(0xcd)]=_0x3f1cec[_0x2c94c5(0xcd)]);_0x3f1cec[_0x2c94c5(0xcc)]&&(_0x20d67e[_0x2c94c5(0xcc)]=_0x3f1cec['behavior']);if(_0x3f1cec[_0x2c94c5(0x17d)])_0x20d67e[_0x2c94c5(0x17d)]=_0x3f1cec['interval'];let _0x354935;try{_0x354935=await _0x6be8fe[_0x2c94c5(0x1a2)][_0x2c94c5(0x184)](_0x1b1bf9,_0x20d67e),_0x41d1ef[_0x2c94c5(0x112)]();}catch(_0x496ff1){_0x41d1ef[_0x2c94c5(0x112)]();throw _0x496ff1;}const _0x35b928=_0x3f1cec['interval']||_0x2c94c5(0x19c);return this[_0x2c94c5(0x17a)](_0x354935,_0x20d67e,_0x9d2cad,_0x35b928),_0x354935[_0x2c94c5(0x104)]?0x0:0x1;}[a23_0x495ffd(0x17a)](_0x59c4ce,_0x5592db,_0x6b37ee,_0x2c4cfb){const _0x13deb8=a23_0x495ffd;console[_0x13deb8(0x13c)]('\x0a'+a23_0x3fcb40[_0x13deb8(0x1b1)]('Validate:')+'\x20'+_0x59c4ce[_0x13deb8(0x177)]),console[_0x13deb8(0x13c)]('═'[_0x13deb8(0x167)](0x3c)),this[_0x13deb8(0x199)](_0x59c4ce);if(typeof _0x5592db[_0x13deb8(0xcd)]===_0x13deb8(0x190)){this[_0x13deb8(0x192)](_0x59c4ce),this['displaySummary'](_0x59c4ce),this[_0x13deb8(0xe9)](_0x6b37ee,_0x2c4cfb,_0x13deb8(0xcd),_0x5592db[_0x13deb8(0xcd)]);return;}if(_0x5592db[_0x13deb8(0xcd)]===!![]){this[_0x13deb8(0x192)](_0x59c4ce),this[_0x13deb8(0xf6)](_0x59c4ce),this[_0x13deb8(0xe9)](_0x6b37ee,_0x2c4cfb,'attributes');return;}if(typeof _0x5592db[_0x13deb8(0xcc)]===_0x13deb8(0x190)){this[_0x13deb8(0x1b7)](_0x59c4ce,_0x2c4cfb),this[_0x13deb8(0xf6)](_0x59c4ce),this[_0x13deb8(0xe9)](_0x6b37ee,_0x2c4cfb,_0x13deb8(0xcc),_0x5592db['behavior']);return;}if(_0x5592db[_0x13deb8(0xcc)]===!![]){this[_0x13deb8(0x1b7)](_0x59c4ce,_0x2c4cfb),this[_0x13deb8(0xf6)](_0x59c4ce),this[_0x13deb8(0xe9)](_0x6b37ee,_0x2c4cfb,_0x13deb8(0x1a6));return;}this[_0x13deb8(0x192)](_0x59c4ce),this[_0x13deb8(0x1b7)](_0x59c4ce,_0x2c4cfb),this[_0x13deb8(0xf6)](_0x59c4ce),this[_0x13deb8(0xe9)](_0x6b37ee,_0x2c4cfb,_0x13deb8(0xdc));}['displayPreviewHints'](_0xaf95f3,_0x27455e,_0x1d0d88,_0x4713c3){const _0x3aebe8=a23_0x495ffd;console['error']('\x0a'+a23_0x3fcb40['dim']('To\x20view\x20sample\x20data:'));const _0x2c80a8=_0x27455e!==_0x3aebe8(0x19c)?_0x3aebe8(0x14f)+_0x27455e:'';if(_0x1d0d88===_0x3aebe8(0xcd)&&_0x4713c3)console[_0x3aebe8(0x13c)]('\x20\x20'+a23_0x3fcb40['dim'](_0x3aebe8(0x157)+_0xaf95f3+_0x3aebe8(0x1e5)+_0x4713c3+'\x22'+_0x2c80a8));else{if(_0x1d0d88===_0x3aebe8(0xcc)&&_0x4713c3)console[_0x3aebe8(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x3aebe8(0x176)](_0x3aebe8(0x157)+_0xaf95f3+_0x3aebe8(0x13a)+_0x4713c3+'\x22'+_0x2c80a8));else(_0x1d0d88===_0x3aebe8(0xf7)||_0x1d0d88===_0x3aebe8(0xdc))&&console[_0x3aebe8(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x3aebe8(0x176)](_0x3aebe8(0x157)+_0xaf95f3+_0x3aebe8(0x13b)+_0x2c80a8));}(_0x1d0d88===_0x3aebe8(0x1a6)||_0x1d0d88===_0x3aebe8(0xdc))&&console['error']('\x20\x20'+a23_0x3fcb40[_0x3aebe8(0x176)](_0x3aebe8(0x157)+_0xaf95f3+'\x20--behavior\x20\x22<name>\x22'+_0x2c80a8)),_0x1d0d88===_0x3aebe8(0xdc)&&console[_0x3aebe8(0x13c)]('\x20\x20'+a23_0x3fcb40['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0xaf95f3+_0x3aebe8(0x18d)+_0x2c80a8));}[a23_0x495ffd(0x199)](_0x104a11){const _0x52e6f0=a23_0x495ffd,{master:_0x4b97cb}=_0x104a11,_0x18c398=_0x4b97cb[_0x52e6f0(0x126)]?a23_0x3fcb40['green']('✔'):a23_0x3fcb40[_0x52e6f0(0x1de)]('✘');console[_0x52e6f0(0x13c)]('\x0a'+a23_0x3fcb40[_0x52e6f0(0x176)](_0x52e6f0(0xe5))),console[_0x52e6f0(0x13c)](_0x18c398+'\x20'+a23_0x3fcb40[_0x52e6f0(0x1b1)](_0x4b97cb['database']+'.'+_0x4b97cb['table'])),_0x4b97cb[_0x52e6f0(0x126)]?_0x4b97cb[_0x52e6f0(0x1a4)]!==undefined&&console[_0x52e6f0(0x13c)]('\x20\x20'+a23_0x3fcb40['dim']('Rows:')+'\x20'+a23_0x3fcb40[_0x52e6f0(0x1e2)](formatRows(_0x4b97cb[_0x52e6f0(0x1a4)]))):console[_0x52e6f0(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x52e6f0(0x1de)](_0x52e6f0(0x1d1))+'\x20'+_0x4b97cb[_0x52e6f0(0x188)]);}['displayAttributesStats'](_0xf34751){const _0x394791=a23_0x495ffd;if(_0xf34751[_0x394791(0xf7)][_0x394791(0x15d)]===0x0)return;console['error']('\x0a'+a23_0x3fcb40[_0x394791(0x176)](_0x394791(0x1c3)));for(const _0x344073 of _0xf34751[_0x394791(0xf7)]){const _0x16e8f4=_0x344073[_0x394791(0x126)]?a23_0x3fcb40[_0x394791(0x149)]('✔'):a23_0x3fcb40[_0x394791(0x1de)]('✘');let _0x5a15b3='';if(_0x344073['schemaValid']&&_0x344073[_0x394791(0xd4)]!==undefined&&_0x344073[_0x394791(0x1df)]!==undefined){const _0x1e5e77=_0x344073['coveragePercent'][_0x394791(0xcb)](0x1),_0x5c9834=_0x344073[_0x394791(0x1df)]>=0x50?a23_0x3fcb40[_0x394791(0x149)]:_0x344073[_0x394791(0x1df)]>=0x32?a23_0x3fcb40[_0x394791(0x1b9)]:a23_0x3fcb40[_0x394791(0x1de)];_0x5a15b3='\x20'+a23_0x3fcb40['dim'](_0x394791(0x14e))+'\x20'+_0x5c9834(_0x1e5e77+'%')+'\x20('+formatRows(_0x344073['matchedCount'])+'\x20rows)';}console['error'](_0x16e8f4+'\x20'+a23_0x3fcb40[_0x394791(0x1b1)](_0x344073[_0x394791(0x177)])+_0x5a15b3),console['error']('\x20\x20'+a23_0x3fcb40[_0x394791(0x176)](_0x394791(0x1ac))+'\x20'+a23_0x3fcb40['bold'](_0x344073[_0x394791(0xc7)]+'.'+_0x344073[_0x394791(0xf3)]));const _0x3fe360=_0x344073['joinKey']===_0x344073[_0x394791(0xec)]?a23_0x3fcb40[_0x394791(0x176)](_0x394791(0xf0))+'\x20'+_0x344073[_0x394791(0x11d)]:a23_0x3fcb40[_0x394791(0x176)](_0x394791(0xd5))+'\x20'+_0x344073[_0x394791(0x11d)]+_0x394791(0x118)+_0x344073['foreignKey'];console[_0x394791(0x13c)]('\x20\x20'+_0x3fe360),console[_0x394791(0x13c)]('\x20\x20'+a23_0x3fcb40['dim'](_0x394791(0x15a))),this['displayColumns'](_0x344073[_0x394791(0x1be)]),!_0x344073[_0x394791(0x126)]&&console[_0x394791(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x394791(0x1de)]('Error:')+'\x20'+_0x344073[_0x394791(0x188)]);}}[a23_0x495ffd(0x1b7)](_0x1b9a37,_0x55f1c4){const _0x2f48a5=a23_0x495ffd;if(_0x1b9a37[_0x2f48a5(0x1a6)]['length']===0x0)return;console['error']('\x0a'+a23_0x3fcb40[_0x2f48a5(0x176)](_0x2f48a5(0x1b8))+'\x20'+a23_0x3fcb40['dim']('('+_0x55f1c4+')'));for(const _0x1d34b6 of _0x1b9a37[_0x2f48a5(0x1a6)]){const _0x4e8b2c=_0x1d34b6['schemaValid']?a23_0x3fcb40[_0x2f48a5(0x149)]('✔'):a23_0x3fcb40['red']('✘');let _0x1fd727='';if(_0x1d34b6[_0x2f48a5(0x126)]&&_0x1d34b6[_0x2f48a5(0x14c)]!==undefined&&_0x1d34b6[_0x2f48a5(0x17e)]!==undefined){const _0x129091=_0x1d34b6[_0x2f48a5(0x107)]?.[_0x2f48a5(0xcb)](0x1)||'?',_0x12b116=(_0x1d34b6['customerPercent']??0x0)>=0x32?a23_0x3fcb40[_0x2f48a5(0x149)]:(_0x1d34b6['customerPercent']??0x0)>=0x14?a23_0x3fcb40[_0x2f48a5(0x1b9)]:a23_0x3fcb40[_0x2f48a5(0x1de)];_0x1fd727='\x20'+a23_0x3fcb40[_0x2f48a5(0x176)]('Customers:')+'\x20'+_0x12b116(formatRows(_0x1d34b6[_0x2f48a5(0x14c)]))+'\x20('+_0x129091+_0x2f48a5(0x1b5)+a23_0x3fcb40['dim'](_0x2f48a5(0x125))+'\x20'+a23_0x3fcb40[_0x2f48a5(0x1e2)](formatRows(_0x1d34b6[_0x2f48a5(0x17e)]));}console['error'](_0x4e8b2c+'\x20'+a23_0x3fcb40[_0x2f48a5(0x1b1)](_0x1d34b6[_0x2f48a5(0x177)])+_0x1fd727),console[_0x2f48a5(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x2f48a5(0x176)](_0x2f48a5(0x1ac))+'\x20'+a23_0x3fcb40[_0x2f48a5(0x1b1)](_0x1d34b6[_0x2f48a5(0xc7)]+'.'+_0x1d34b6[_0x2f48a5(0xf3)]));const _0x38b679=_0x1d34b6[_0x2f48a5(0x11d)]===_0x1d34b6[_0x2f48a5(0xec)]?a23_0x3fcb40[_0x2f48a5(0x176)](_0x2f48a5(0xf0))+'\x20'+_0x1d34b6[_0x2f48a5(0x11d)]:a23_0x3fcb40['dim']('Join:')+'\x20'+_0x1d34b6[_0x2f48a5(0x11d)]+'\x20=\x20'+_0x1d34b6['foreignKey'];console['error']('\x20\x20'+_0x38b679),console[_0x2f48a5(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x2f48a5(0x176)]('Columns:')),this[_0x2f48a5(0xf9)](_0x1d34b6['columns']),!_0x1d34b6[_0x2f48a5(0x126)]&&console[_0x2f48a5(0x13c)]('\x20\x20'+a23_0x3fcb40['red'](_0x2f48a5(0x1d1))+'\x20'+_0x1d34b6[_0x2f48a5(0x188)]);}}[a23_0x495ffd(0xf9)](_0x42d162){const _0x15dea0=a23_0x495ffd;for(const _0x28e9cf of _0x42d162){_0x28e9cf[_0x15dea0(0xed)]===_0x28e9cf[_0x15dea0(0x169)]||_0x28e9cf[_0x15dea0(0x169)]==='*'?console['error'](_0x15dea0(0x10e)+_0x28e9cf[_0x15dea0(0xed)]):console[_0x15dea0(0x13c)](_0x15dea0(0x10e)+_0x28e9cf[_0x15dea0(0xed)]+'\x20'+a23_0x3fcb40['dim']('('+_0x28e9cf[_0x15dea0(0x169)]+')'));}}['displaySummary'](_0x3aac63){const _0x522c17=a23_0x495ffd;console[_0x522c17(0x13c)]('─'['repeat'](0x3c));if(_0x3aac63['errors'][_0x522c17(0x15d)]>0x0){console[_0x522c17(0x13c)]('\x0a'+a23_0x3fcb40['red'](_0x522c17(0x12b)));for(const _0x1528ae of _0x3aac63[_0x522c17(0x1a5)]){console[_0x522c17(0x13c)]('\x20\x20'+a23_0x3fcb40['red']('•')+'\x20'+_0x1528ae);}}_0x3aac63[_0x522c17(0x104)]&&console[_0x522c17(0x13c)]('\x0a'+a23_0x3fcb40[_0x522c17(0x149)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']='segment:parent:preview';[a23_0x495ffd(0x132)]=a23_0x495ffd(0x121);async[a23_0x495ffd(0x1cc)](_0xfed244){const _0x49ae4f=a23_0x495ffd,{options:_0x49fe5e,args:_0x5725bb,tdx:_0x45cc8a}=_0xfed244,_0x480462=_0x49fe5e,_0x2ae7c5=_0x5725bb[0x0]||_0x49fe5e['parentSegment'];if(!_0x2ae7c5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x49ae4f(0x1bd)+_0x49ae4f(0xc3)+_0x49ae4f(0x1ad)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x49ae4f(0xc4)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x480462[_0x49ae4f(0x159)]&&!_0x480462['attribute']&&!_0x480462[_0x49ae4f(0xcc)]&&!_0x480462[_0x49ae4f(0x194)])return console['error'](a23_0x3fcb40['red'](_0x49ae4f(0x1c0))),console[_0x49ae4f(0x13c)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x49ae4f(0x13c)](_0x49ae4f(0x123)),console[_0x49ae4f(0x13c)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x49ae4f(0x13c)](_0x49ae4f(0x124)),console[_0x49ae4f(0x13c)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x49ae4f(0x13c)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x200bea=resolveYamlFile(_0x2ae7c5);if(!existsSync(_0x200bea))return showFileNotFoundError(_0x200bea,_0x2ae7c5),0x1;_0x480462[_0x49ae4f(0x1d2)]&&(console[_0x49ae4f(0x13c)]('Site:\x20'+_0x480462['site']),console[_0x49ae4f(0x13c)](_0x49ae4f(0x101)+_0x200bea));let _0x21fb78;try{_0x21fb78=readFileSync(_0x200bea,_0x49ae4f(0xce));}catch(_0x32dd1b){const _0x2a1264=_0x32dd1b instanceof Error?_0x32dd1b[_0x49ae4f(0x1cf)]:String(_0x32dd1b);return console[_0x49ae4f(0x13c)](_0x49ae4f(0x1d8)+_0x2a1264),0x1;}let _0x440062;try{_0x440062=parseDef(_0x21fb78);}catch(_0x5e4417){const _0x4edb3c=_0x5e4417 instanceof Error?_0x5e4417[_0x49ae4f(0x1cf)]:String(_0x5e4417);return console[_0x49ae4f(0x13c)](a23_0x3fcb40[_0x49ae4f(0x1de)]('Error\x20parsing\x20YAML:\x20'+_0x4edb3c)),0x1;}if(_0x480462['attribute']===!![]||_0x480462['attribute']===''){const _0x41ccc4=_0x440062[_0x49ae4f(0xf7)]?.[_0x49ae4f(0x1d4)](_0x5c4093=>_0x5c4093[_0x49ae4f(0x177)])||[];if(_0x41ccc4[_0x49ae4f(0x15d)]===0x0)console['error'](a23_0x3fcb40[_0x49ae4f(0x1de)](_0x49ae4f(0x1dd)));else{console[_0x49ae4f(0x13c)](a23_0x3fcb40[_0x49ae4f(0x1de)](_0x49ae4f(0x1d3))),console[_0x49ae4f(0x13c)](_0x49ae4f(0xf5));for(const _0x2cee34 of _0x41ccc4){console[_0x49ae4f(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x49ae4f(0x1e2)](_0x2cee34));}console['error'](_0x49ae4f(0x144)+_0x2ae7c5+_0x49ae4f(0x1e5)+_0x41ccc4[0x0]+'\x22');}return 0x1;}if(_0x480462[_0x49ae4f(0xcc)]===!![]||_0x480462[_0x49ae4f(0xcc)]===''){const _0x1363f2=_0x440062['behaviors']?.[_0x49ae4f(0x1d4)](_0xc4daf=>_0xc4daf[_0x49ae4f(0x177)])||[];if(_0x1363f2[_0x49ae4f(0x15d)]===0x0)console['error'](a23_0x3fcb40[_0x49ae4f(0x1de)](_0x49ae4f(0x156)));else{console[_0x49ae4f(0x13c)](a23_0x3fcb40['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x49ae4f(0x13c)](_0x49ae4f(0xf8));for(const _0x55428e of _0x1363f2){console['error']('\x20\x20'+a23_0x3fcb40[_0x49ae4f(0x1e2)](_0x55428e));}console[_0x49ae4f(0x13c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2ae7c5+_0x49ae4f(0x13a)+_0x1363f2[0x0]+'\x22');}return 0x1;}const _0x56abaf=createCommandSpinner(a23_0x3fcb40[_0x49ae4f(0x176)](_0x49ae4f(0x196)),{'verbose':_0x480462[_0x49ae4f(0x1d2)]});_0x56abaf[_0x49ae4f(0x181)]();const _0x54229d={'onProgress':_0x2288bf=>{const _0x2d1ce0=_0x49ae4f;_0x56abaf[_0x2d1ce0(0x1bc)]=formatProgressMessage(_0x2288bf);}};if(_0x480462[_0x49ae4f(0x159)])_0x54229d['master']=!![];if(_0x480462['attribute']&&typeof _0x480462[_0x49ae4f(0xcd)]===_0x49ae4f(0x190))_0x54229d[_0x49ae4f(0xcd)]=_0x480462[_0x49ae4f(0xcd)];if(_0x480462[_0x49ae4f(0xcc)]&&typeof _0x480462['behavior']===_0x49ae4f(0x190))_0x54229d[_0x49ae4f(0xcc)]=_0x480462[_0x49ae4f(0xcc)];if(_0x480462['enriched'])_0x54229d[_0x49ae4f(0x194)]=!![];if(_0x480462[_0x49ae4f(0x17d)])_0x54229d[_0x49ae4f(0x17d)]=_0x480462['interval'];let _0x50bcd2;try{_0x50bcd2=await _0x45cc8a['segment'][_0x49ae4f(0xe2)](_0x21fb78,_0x54229d),_0x56abaf[_0x49ae4f(0x112)]();}catch(_0x4ecfb4){_0x56abaf['stop']();throw _0x4ecfb4;}return await this[_0x49ae4f(0x155)](_0x50bcd2,{'master':_0x480462[_0x49ae4f(0x159)],'attribute':typeof _0x480462[_0x49ae4f(0xcd)]===_0x49ae4f(0x190)?_0x480462['attribute']:undefined,'behavior':typeof _0x480462['behavior']===_0x49ae4f(0x190)?_0x480462['behavior']:undefined,'enriched':_0x480462[_0x49ae4f(0x194)]}),_0x50bcd2[_0x49ae4f(0x104)]?0x0:0x1;}async[a23_0x495ffd(0x155)](_0x458228,_0x2bf191){const _0xf3476c=a23_0x495ffd;console[_0xf3476c(0x13c)]('\x0a'+a23_0x3fcb40[_0xf3476c(0x1b1)](_0xf3476c(0x14a))+'\x20'+_0x458228[_0xf3476c(0x177)]),console[_0xf3476c(0x13c)]('═'[_0xf3476c(0x167)](0x3c));if(_0x2bf191['master']&&_0x458228[_0xf3476c(0xda)]){const _0xd3551c=a23_0x3fcb40[_0xf3476c(0x176)](_0xf3476c(0x1a8))+'\x20'+a23_0x3fcb40['bold'](_0x458228[_0xf3476c(0x159)][_0xf3476c(0xc7)]+'.'+_0x458228[_0xf3476c(0x159)][_0xf3476c(0xf3)]);await this[_0xf3476c(0x195)](_0xd3551c,_0x458228[_0xf3476c(0xda)]);}else{if(_0x2bf191[_0xf3476c(0xcd)]&&_0x458228['sampleData']){const _0x48d90e=a23_0x3fcb40[_0xf3476c(0x176)]('Attribute:')+'\x20'+a23_0x3fcb40[_0xf3476c(0x1b1)](_0x2bf191[_0xf3476c(0xcd)]);await this[_0xf3476c(0x195)](_0x48d90e,_0x458228[_0xf3476c(0xda)]);}else{if(_0x2bf191['behavior']&&_0x458228[_0xf3476c(0xda)]){const _0x1bd4db=a23_0x3fcb40[_0xf3476c(0x176)]('Behavior:')+'\x20'+a23_0x3fcb40[_0xf3476c(0x1b1)](_0x2bf191[_0xf3476c(0xcc)]);await this[_0xf3476c(0x195)](_0x1bd4db,_0x458228['sampleData']);}else{if(_0x2bf191[_0xf3476c(0x194)]&&_0x458228[_0xf3476c(0xda)]){const _0x1ca643=a23_0x3fcb40['dim']('Enriched:')+'\x20'+a23_0x3fcb40[_0xf3476c(0x1b1)](_0xf3476c(0x1c7));await this[_0xf3476c(0x195)](_0x1ca643,_0x458228['sampleData']);}else!_0x458228['sampleData']&&console[_0xf3476c(0x13c)](_0xf3476c(0x100));}}}if(_0x458228[_0xf3476c(0x1a5)]['length']>0x0){console[_0xf3476c(0x13c)]('─'[_0xf3476c(0x167)](0x3c)),console[_0xf3476c(0x13c)]('\x0a'+a23_0x3fcb40[_0xf3476c(0x1de)](_0xf3476c(0x12b)));for(const _0xedaeed of _0x458228[_0xf3476c(0x1a5)]){console[_0xf3476c(0x13c)]('\x20\x20'+a23_0x3fcb40[_0xf3476c(0x1de)]('•')+'\x20'+_0xedaeed);}}}async[a23_0x495ffd(0x195)](_0x4a0931,_0x1bb36f){const _0x135463=a23_0x495ffd;if(_0x1bb36f[_0x135463(0x15d)]===0x0){console[_0x135463(0x13c)]('\x0a'+_0x4a0931),console[_0x135463(0x13c)](_0x135463(0xea));return;}console[_0x135463(0x13c)]('\x0a'+_0x4a0931);const _0x59618e=Object[_0x135463(0xc6)](_0x1bb36f[0x0])[_0x135463(0x1d4)](_0x1f4cc5=>({'name':_0x1f4cc5,'type':typeof _0x1bb36f[0x0][_0x1f4cc5]===_0x135463(0x127)?_0x135463(0x1e0):_0x135463(0x1cb)})),_0x24ce1f={'queryId':_0x135463(0xd8),'columns':_0x59618e,'data':_0x1bb36f,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1bb36f['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x26d127=formatAsTable(_0x24ce1f,_0x1bb36f[_0x135463(0x15d)],!![]);await writeOutput(_0x26d127,undefined,_0x135463(0xf3));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x495ffd(0x177)]='segment:parent:run';[a23_0x495ffd(0x132)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a23_0x495ffd(0x1cc)](_0xf92e85){const _0x4e8abb=a23_0x495ffd,{options:_0xa92ab5,args:_0x19671a,tdx:_0x2e4e0d}=_0xf92e85,_0x47f2e4=_0xa92ab5,_0x334060=_0x19671a[0x0]||_0xa92ab5[_0x4e8abb(0x179)];if(!_0x334060)return showParentSegmentNotSetError(_0x4e8abb(0x174)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x4b95a8=resolveYamlFile(_0x334060);if(existsSync(_0x4b95a8)){_0x47f2e4[_0x4e8abb(0x1d2)]&&console['error'](_0x4e8abb(0x11f)+_0x4b95a8);let _0x55cfc3;try{_0x55cfc3=readFileSync(_0x4b95a8,'utf-8');}catch(_0x57aece){const _0x37dd4c=_0x57aece instanceof Error?_0x57aece[_0x4e8abb(0x1cf)]:String(_0x57aece);return console['error'](_0x4e8abb(0x1d8)+_0x37dd4c),0x1;}const _0x4bb926=await withSpinner('Analyzing\x20changes...',()=>_0x2e4e0d[_0x4e8abb(0x1a2)]['pushParentYaml'](_0x55cfc3),{'verbose':_0x47f2e4[_0x4e8abb(0x1d2)]}),_0xdfb918=_0x4bb926['data'],{isNew:_0x5adda7,name:_0xfdddf0,hasChanges:_0x4d070b,diffFormatted:_0x5b8467}=_0xdfb918;if(_0x4d070b){_0x5adda7?console[_0x4e8abb(0x13c)](_0x4e8abb(0x171)+_0xfdddf0+'\x27:'):console[_0x4e8abb(0x13c)](_0x4e8abb(0x10d)+_0xfdddf0+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x4e8abb(0x13c)](_0x5b8467),console[_0x4e8abb(0x13c)]('─'[_0x4e8abb(0x167)](0x3c));const _0x503fd1=_0x5adda7?_0x4e8abb(0x13d)+_0xfdddf0+_0x4e8abb(0xd6):_0x4e8abb(0xfb)+_0xfdddf0+_0x4e8abb(0xd6);if(!_0x47f2e4['yes']){const _0x341472=await confirmKey(_0x503fd1);if(!_0x341472)return console['error'](_0x4e8abb(0x1ca)),0x1;}const _0x85c215=_0x5adda7?_0x4e8abb(0x134):_0x4e8abb(0xd9);await withSpinner(_0x85c215+'\x20parent\x20segment\x20\x27'+_0xfdddf0+_0x4e8abb(0xe3),()=>_0xdfb918[_0x4e8abb(0x1c6)](),{'verbose':_0x47f2e4['verbose']});const _0x971f3d=_0x5adda7?_0x4e8abb(0xe1):'Updated';console[_0x4e8abb(0x13c)]('✔\x20'+_0x971f3d+_0x4e8abb(0x1c5)+_0xfdddf0+'\x27');}else console['error'](_0x4e8abb(0x129)+_0xfdddf0+_0x4e8abb(0x152));}const _0x1f8b69=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x334060+'\x27...',()=>_0x2e4e0d['segment']['runParent'](_0x334060),{'verbose':_0x47f2e4[_0x4e8abb(0x1d2)]}),_0x4314b8=_0x1f8b69[_0x4e8abb(0x178)],_0x259e83=getConsoleUrl(_0x47f2e4[_0x4e8abb(0x142)],'/app/workflows/'+_0x4314b8[_0x4e8abb(0xd0)]+_0x4e8abb(0x1af)+_0x4314b8[_0x4e8abb(0x1c2)]+_0x4e8abb(0x180)+_0x4314b8[_0x4e8abb(0x17f)]);return console[_0x4e8abb(0x13c)]('\x0a✔\x20Workflow\x20started'),console[_0x4e8abb(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x4e8abb(0x176)]('Audience\x20ID:')+'\x20'+_0x4314b8[_0x4e8abb(0xfe)]),console[_0x4e8abb(0x13c)]('\x20\x20'+a23_0x3fcb40['dim'](_0x4e8abb(0x12e))+'\x20'+_0x4314b8[_0x4e8abb(0x164)]),console[_0x4e8abb(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x4e8abb(0x176)]('Session:')+'\x20'+_0x4314b8[_0x4e8abb(0x1c2)]),console[_0x4e8abb(0x13c)]('\x20\x20'+a23_0x3fcb40[_0x4e8abb(0x176)](_0x4e8abb(0x119))+'\x20'+_0x4314b8[_0x4e8abb(0x17f)]),console[_0x4e8abb(0x13c)]('\x20\x20'+_0x259e83),console[_0x4e8abb(0x13c)]('\x0a'+a23_0x3fcb40['dim'](_0x4e8abb(0xfa))+_0x4e8abb(0x185)+_0x4314b8[_0x4e8abb(0x17f)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x1db);[a23_0x495ffd(0x132)]=a23_0x495ffd(0x117);async[a23_0x495ffd(0x1cc)](_0x31fc6){const _0x46946e=a23_0x495ffd,{options:_0x393046,args:_0x44cb8a,tdx:_0x2eceda}=_0x31fc6,_0x12f094=_0x44cb8a[0x0]||_0x393046['parentSegment'];if(!_0x12f094)return showParentSegmentNotSetError(_0x46946e(0xf2)+_0x46946e(0x183)),0x1;_0x393046[_0x46946e(0x1d2)]&&(console[_0x46946e(0x13c)](_0x46946e(0x1a9)+_0x393046[_0x46946e(0x142)]),console['error'](_0x46946e(0x1e3)+_0x12f094));const _0x108031=await withSpinner(_0x46946e(0x165)+_0x12f094+_0x46946e(0xe3),()=>_0x2eceda[_0x46946e(0x1a2)][_0x46946e(0x1a0)](_0x12f094),{'verbose':_0x393046[_0x46946e(0x1d2)]}),_0x47c645=_0x108031[_0x46946e(0x178)];console[_0x46946e(0x13c)](_0x46946e(0x145)+_0x47c645[_0x46946e(0x15d)]+_0x46946e(0x172)+(_0x47c645[_0x46946e(0x15d)]!==0x1?'s':''));if(_0x393046[_0x46946e(0x15f)]||_0x393046[_0x46946e(0x18f)])return await handleSDKOutput(_0x47c645,_0x393046),0x0;return displayFieldsHumanReadable(_0x47c645,_0x12f094),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x1ba);['description']=a23_0x495ffd(0xe7);async['execute'](_0x23e8bf){const _0x250d6a=a23_0x495ffd,{options:_0xa7608f,args:_0x4b4d3a,tdx:_0x12d9d2}=_0x23e8bf,_0x5d0e56=_0xa7608f,_0x16470c=_0x4b4d3a[0x0]||_0xa7608f['parentSegment'];if(!_0x16470c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x250d6a(0xe0)+_0x250d6a(0x12c)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0xa7608f[_0x250d6a(0x1d2)]&&(console[_0x250d6a(0x13c)](_0x250d6a(0x1a9)+_0xa7608f[_0x250d6a(0x142)]),console[_0x250d6a(0x13c)](_0x250d6a(0x1e3)+_0x16470c));const _0x269f2c=await withSpinner(_0x250d6a(0x109)+_0x16470c+_0x250d6a(0xe3),()=>_0x12d9d2[_0x250d6a(0x1a2)]['getParentFull'](_0x16470c),{'verbose':_0xa7608f['verbose']}),_0x370af3=_0x269f2c[_0x250d6a(0x178)];if(_0x5d0e56[_0x250d6a(0x1ae)]){const _0x1cf5cd=getConsoleNextUrl(_0x5d0e56[_0x250d6a(0x142)],_0x250d6a(0x143)+_0x370af3['id']);return console[_0x250d6a(0x13c)](a23_0x3fcb40[_0x250d6a(0x149)]('✔')+'\x20Opening\x20'+a23_0x3fcb40['cyan'](_0x1cf5cd)),openBrowser(_0x1cf5cd),0x0;}return await handleSingleObjectOutput(_0x370af3,_0xa7608f),0x0;}}function a23_0x4e13(){const _0x4739f5=['matchedCount','Join:','\x27\x20and\x20run\x20workflow?','attributesFile','preview','Updating','sampleData','No\x20parent\x20segments\x20found','all','\x20[Job\x20ID:\x20','elapsedTimeMillis','Updated','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Created','previewParentYaml','\x27...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Master\x20Table','addAttributes','Show\x20parent\x20segment\x20details','13941HjszsA','displayPreviewHints','\x20\x20No\x20sample\x20data\x20available','Error:\x20Parent\x20segment\x20name\x20is\x20required','foreignKey','label','Fetching\x20SQL\x20for\x20\x27','Table:\x20','Join\x20on:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','table','.yml','Available\x20attributes:','displaySummary','attributes','Available\x20behaviors:','displayColumns','To\x20cancel:','Apply\x20changes\x20to\x20\x27','\x0a⚠️\x20\x20Both\x20','yes','audienceId','2764525TMMseN','\x0aNo\x20sample\x20data\x20available','YAML\x20file:\x20','processedRows','localeCompare','allValid','resolveParentId','\x20No\x20changes\x20-\x20','customerPercent','57224aekGBY','Fetching\x20parent\x20segment\x20\x27','format','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','.yaml','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20-\x20','/\x20→\x20','segment:parent:show','9012732hcpkPH','stop','customerGroupFile','No\x20parent\x20segments\x20match\x20pattern:\x20','✔\x20Updated\x20parent\x20segment\x20\x27','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','List\x20available\x20fields\x20for\x20segmentation','\x20=\x20','Attempt:','Updating\x20parent\x20segment\x20\x27','\x20is\x20already\x20up\x20to\x20date','Listing\x20parent\x20segments...','joinKey','filter','Found\x20YAML\x20file:\x20','darwin','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','session','Options:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Events:','schemaValid','number','log','✔\x20No\x20changes\x20-\x20\x27','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Errors:','Options:\x0a','segment:parent:sql','Status:','/{name}.yml\x0a','population','using\x20the\x20default\x20path:\x20','description','xdg-open','Creating','3245arVrpL','segment:parent:validate','run','addAttributesFile','\x0a⚠️\x20\x20Migrating:\x20','\x20--behavior\x20\x22','\x20--attribute\x20\x22<name>\x22','error','Create\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','770342pwkupG','sort','\x20parent\x20segment','site','/app/dw/parentSegments/','\x0aUsage:\x20tdx\x20ps\x20preview\x20','✔\x20Found\x20','\x20rows\x20','✔\x20Renamed\x20directory\x20to\x20','\x27\x20is\x20already\x20up\x20to\x20date','green','Preview:','query','customersWithEvents','behaviorsFile','Coverage:','\x20--interval\x20','timezone','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','584XsmoFy','parent_segments','displayPreviewResults','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','tdx\x20segment\x20parent\x20preview\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','master','Columns:','getParentSQL','Validating\x20configuration...','length','pushParentYaml','json','jobId','Resolving\x20parent\x20segment\x20\x27','in\x20','\x20Context\x20set:\x20','status','Listing\x20fields\x20for\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','repeat','ignore','column','use','segment:parent:push','✔\x20Created\x20parent\x20segment\x20\x27','parent_segment','scheduleType','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','✔\x20Query\x20completed:\x20Processed\x20','\x0aNew\x20parent\x20segment\x20\x27','\x20field','8jodvzX','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','dim','name','data','parentSegment','displayValidateResults','information_schema','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','interval','totalEvents','workflowAttemptId','/attempt/','start','endsWith','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','validateParentYaml','\x20tdx\x20wf\x20attempt\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','1519pBWTGx','schemaError','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Analyzing\x20changes...','output','segment:parent:desc','\x20--enriched','trim','jsonl','string','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayAttributesStats','scheduleOption','enriched','displaySampleData','Fetching\x20sample\x20data...','listParents','\x0aChanges\x20to\x20\x27','displayMasterInfo','Overwrite\x20\x27','/\x20and\x20','-1d','List\x20parent\x20segments','replace','Pattern:\x20','listFields','pullParentYaml','segment','27010dgHIge','rowCount','errors','behaviors','/\x20directory.\x0a','Master:','Site:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Source:','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','web','/sessions/','\x27\x20with\x20ID:\x20','bold','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','%)\x20','3pslckQ','displayBehaviorsStats','Behaviors','yellow','segment:parent:view','SQL\x20query:\x0a','text','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','columns','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','unref','workflowSessionId','Attributes','addBehaviorsFile','\x20parent\x20segment\x20\x27','apply','Master\x20+\x20Attributes','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','toLocaleString','Aborted.','varchar','execute','segment:parent:list','segment:parent:update','message','Executing\x20parent\x20segment\x20query...','Error:','verbose','Error:\x20--attribute\x20requires\x20a\x20name\x0a','map','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','getParentFull','Creating\x20parent\x20segment\x20\x27','Error\x20reading\x20file:\x20','6558kMmMZd','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','segment:parent:fields','Name:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','red','coveragePercent','double','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','cyan','Parent\x20segment:\x20','stats','\x20--attribute\x20\x22','Options\x20(one\x20required):\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','keys','database','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','match','join','toFixed','behavior','attribute','utf-8','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','workflowId','test','\x5c$&','createParent'];a23_0x4e13=function(){return _0x4739f5;};return a23_0x4e13();}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x18c);[a23_0x495ffd(0x132)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a23_0x495ffd(0x1cc)](_0x3a105e){const _0x4d1785=a23_0x495ffd,{options:_0x4ddd6c,args:_0x5264a9,tdx:_0x5b77e5}=_0x3a105e,_0x149e9c=_0x5264a9[0x0]||_0x4ddd6c[_0x4d1785(0x179)];if(!_0x149e9c)return showParentSegmentNotSetError(_0x4d1785(0x151)+_0x4d1785(0xc5)),0x1;_0x4ddd6c[_0x4d1785(0x1d2)]&&(console[_0x4d1785(0x13c)](_0x4d1785(0x1a9)+_0x4ddd6c[_0x4d1785(0x142)]),console[_0x4d1785(0x13c)](_0x4d1785(0x1e3)+_0x149e9c));const _0x545257=await withSpinner(_0x4d1785(0x161)+_0x149e9c+_0x4d1785(0xe3),()=>_0x5b77e5[_0x4d1785(0x1a2)][_0x4d1785(0x105)](_0x149e9c),{'verbose':_0x4ddd6c[_0x4d1785(0x1d2)]}),_0x3be9d0=_0x545257[_0x4d1785(0x178)],_0x240c09=await withSpinner(_0x4d1785(0xee)+_0x149e9c+'\x27...',()=>_0x5b77e5[_0x4d1785(0x1a2)][_0x4d1785(0x15b)](_0x3be9d0),{'verbose':_0x4ddd6c[_0x4d1785(0x1d2)]}),_0xde5da6=await executeSchemaQuery(_0x240c09[_0x4d1785(0x178)],_0x5b77e5,_0x4ddd6c);return await handleQueryOutput(_0xde5da6,_0x4ddd6c),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x12d);[a23_0x495ffd(0x132)]=a23_0x495ffd(0x186);async['execute'](_0x363b9a){const _0x181f1a=a23_0x495ffd,{options:_0x411543,args:_0x5dca76,tdx:_0x34cffb}=_0x363b9a,_0x5b8259=_0x5dca76[0x0]||_0x411543[_0x181f1a(0x179)];if(!_0x5b8259)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x181f1a(0xcf)),0x1;_0x411543[_0x181f1a(0x1d2)]&&(console[_0x181f1a(0x13c)]('Site:\x20'+_0x411543[_0x181f1a(0x142)]),console['error']('Parent\x20segment:\x20'+_0x5b8259));const _0x2cbeb1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5b8259+_0x181f1a(0xe3),()=>_0x34cffb[_0x181f1a(0x1a2)][_0x181f1a(0x105)](_0x5b8259),{'verbose':_0x411543[_0x181f1a(0x1d2)]}),_0x3904a7=_0x2cbeb1['data'],_0x3f38ca=await withSpinner(_0x181f1a(0xee)+_0x5b8259+_0x181f1a(0xe3),()=>_0x34cffb['segment'][_0x181f1a(0x15b)](_0x3904a7),{'verbose':_0x411543[_0x181f1a(0x1d2)]}),_0x5ebe4e=_0x3f38ca[_0x181f1a(0x178)];return _0x411543['format']===_0x181f1a(0x15f)||_0x411543[_0x181f1a(0x10a)]==='jsonl'?await handleSDKOutput([{'sql':_0x5ebe4e}],_0x411543):console[_0x181f1a(0x128)](_0x5ebe4e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x495ffd(0x177)]=a23_0x495ffd(0x110);['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a23_0x495ffd(0x1cc)](_0x258ef4){const _0x451da7=a23_0x495ffd,{options:_0x3984a3,args:_0x59259b,tdx:_0x251bf3}=_0x258ef4,_0x43765c=_0x59259b[0x0]||_0x3984a3[_0x451da7(0x179)];if(!_0x43765c)return showParentSegmentNotSetError(_0x451da7(0x12a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x3984a3['verbose']&&(console[_0x451da7(0x13c)]('Site:\x20'+_0x3984a3['site']),console[_0x451da7(0x13c)](_0x451da7(0x1e3)+_0x43765c));const _0x48a6c4=await withSpinner(_0x451da7(0x161)+_0x43765c+_0x451da7(0xe3),()=>_0x251bf3['segment'][_0x451da7(0x105)](_0x43765c),{'verbose':_0x3984a3[_0x451da7(0x1d2)]}),_0x2fedcf=_0x48a6c4['data'],_0xa2850a=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x43765c+_0x451da7(0xe3),()=>_0x251bf3[_0x451da7(0x1a2)][_0x451da7(0x15b)](_0x2fedcf),{'verbose':_0x3984a3[_0x451da7(0x1d2)]});let _0x5333bb=_0xa2850a['data'];const _0x74120c=resolveLimit(_0x3984a3['limit'],DEFAULT_DISPLAY_LIMIT),_0xccd456=/\bLIMIT\s+\d+/i['test'](_0x5333bb);!_0xccd456&&(_0x5333bb=_0x5333bb[_0x451da7(0x18e)]()[_0x451da7(0x19e)](/;+$/,''),_0x5333bb='SELECT\x20*\x20FROM\x20(\x0a'+_0x5333bb+_0x451da7(0x166)+_0x74120c);_0x3984a3[_0x451da7(0x1d2)]&&console['error'](_0x451da7(0x1bb)+_0x5333bb);const _0x2a4dc9=await withProgressSpinner(_0x451da7(0x1d0),async _0x193124=>{const _0x2300ae=_0x451da7,_0x108343=await _0x251bf3[_0x2300ae(0x14b)][_0x2300ae(0x1cc)](_0x5333bb,{'catalog':'td','schema':_0x2300ae(0x17b),'onJobId':_0x40b952=>{_0x193124['setJobId'](_0x40b952);}});return _0x108343;},{'verbose':_0x3984a3[_0x451da7(0x1d2)]}),_0x23d19d=_0x2a4dc9[_0x451da7(0x178)],_0x4b76fc=_0x23d19d[_0x451da7(0x160)]?_0x451da7(0xdd)+_0x23d19d[_0x451da7(0x160)]+']':'';return console['error'](_0x451da7(0x170)+_0x23d19d[_0x451da7(0x1e4)][_0x451da7(0x102)][_0x451da7(0x1c9)]()+_0x451da7(0x146)+(_0x451da7(0x162)+formatElapsed(_0x23d19d['stats'][_0x451da7(0xde)])+_0x4b76fc)),await handleQueryOutput(_0x23d19d,_0x3984a3),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_0x39fcef=a24_0x35d8;(function(_0x414cd6,_0x3501f1){const _0x3911de=a24_0x35d8,_0x2d2b37=_0x414cd6();while(!![]){try{const _0x5e64a8=-parseInt(_0x3911de(0x19a))/0x1*(parseInt(_0x3911de(0x1ed))/0x2)+-parseInt(_0x3911de(0x187))/0x3*(-parseInt(_0x3911de(0x1dd))/0x4)+parseInt(_0x3911de(0x1c3))/0x5*(parseInt(_0x3911de(0x1d7))/0x6)+-parseInt(_0x3911de(0x194))/0x7+-parseInt(_0x3911de(0x1c0))/0x8+parseInt(_0x3911de(0x18b))/0x9+parseInt(_0x3911de(0x1a5))/0xa;if(_0x5e64a8===_0x3501f1)break;else _0x2d2b37['push'](_0x2d2b37['shift']());}catch(_0x320b24){_0x2d2b37['push'](_0x2d2b37['shift']());}}}(a24_0xbeb6,0x2011b));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_0xf84f53 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_0x33929c from'prompts';import a24_0x3c30e4 from'chalk';function validateProfileName(_0x29e670){const _0x33227a=a24_0x35d8;if(!_0x29e670||!_0x29e670[_0x33227a(0x1cf)]())return _0x33227a(0x18f);const _0x1cdfab=_0x29e670['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x33227a(0x1bc)](_0x1cdfab))return _0x33227a(0x1c6);if(profileExists(_0x1cdfab))return _0x33227a(0x195)+_0x1cdfab+_0x33227a(0x189);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x39fcef(0x1f0)]='profile:create';[a24_0x39fcef(0x1a2)]='Create\x20a\x20new\x20profile';async[a24_0x39fcef(0x199)](_0x3327fc){const _0x41a8ac=a24_0x39fcef,{options:_0x116954,args:_0x16ff18}=_0x3327fc;console['log'](a24_0x3c30e4[_0x41a8ac(0x1a7)](_0x41a8ac(0x1c1)));let _0x16fbe3;if(_0x16ff18[_0x41a8ac(0x1e4)]>0x0&&_0x16ff18[0x0]){const _0x3e0808=_0x16ff18[0x0][_0x41a8ac(0x1cf)](),_0x489c10=validateProfileName(_0x3e0808);if(_0x489c10!==!![])return console[_0x41a8ac(0x1d2)](a24_0x3c30e4[_0x41a8ac(0x18d)](_0x489c10)),0x1;_0x16fbe3=_0x3e0808;}else{const _0x490039=await a24_0x33929c({'type':_0x41a8ac(0x1e8),'name':_0x41a8ac(0x19f),'message':_0x41a8ac(0x192),'validate':validateProfileName});if(!_0x490039['profileName'])return console[_0x41a8ac(0x1a4)](_0x41a8ac(0x188)),0x1;_0x16fbe3=_0x490039[_0x41a8ac(0x19f)]['trim']();}const _0x5def53=await a24_0x33929c({'type':'text','name':_0x41a8ac(0x1a2),'message':_0x41a8ac(0x1d1)}),_0x3981ae=_0x5def53[_0x41a8ac(0x1a2)]?.[_0x41a8ac(0x1cf)]()||undefined,_0x18a608=_0x116954['site']||_0x41a8ac(0x1ad),{choices:_0x5237b7,initialIndex:_0x1a42d0}=buildSiteChoices(_0x18a608),_0x30c33c=await a24_0x33929c({'type':_0x41a8ac(0x1e3),'name':_0x41a8ac(0x1bd),'message':_0x41a8ac(0x1e1)+_0x16fbe3+'\x27:','choices':_0x5237b7,'initial':_0x1a42d0});if(!_0x30c33c[_0x41a8ac(0x1bd)])return console['log'](_0x41a8ac(0x188)),0x1;let _0x4c667f;if(_0x30c33c['site']===_0x41a8ac(0x1d5)){const _0x4108fb=await a24_0x33929c({'type':_0x41a8ac(0x1e8),'name':_0x41a8ac(0x19c),'message':_0x41a8ac(0x193),'initial':_0x41a8ac(0x1ad),'validate':_0x266a55=>{const _0x26d18a=_0x41a8ac;if(!_0x266a55||!_0x266a55[_0x26d18a(0x1cf)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x26d18a(0x1bc)](_0x266a55[_0x26d18a(0x1cf)]()))return _0x26d18a(0x1d6);return!![];}});if(!_0x4108fb['customSite'])return console[_0x41a8ac(0x1a4)](_0x41a8ac(0x188)),0x1;_0x4c667f=_0x4108fb[_0x41a8ac(0x19c)];}else _0x4c667f=_0x30c33c[_0x41a8ac(0x1bd)];const _0x77f6a0=resolveSite(_0x4c667f);console['log'](_0x41a8ac(0x1ba)+_0x77f6a0),console[_0x41a8ac(0x1a4)](_0x41a8ac(0x1a8)),console[_0x41a8ac(0x1a4)]('\x20\x20'+getConsoleUrl(_0x77f6a0,_0x41a8ac(0x1a9)));const _0x5e96e7=await a24_0x33929c({'type':_0x41a8ac(0x1aa),'name':'apiKey','message':_0x41a8ac(0x1d0),'validate':_0x4dda51=>{const _0x5b6607=_0x41a8ac;if(!_0x4dda51||!_0x4dda51[_0x5b6607(0x1cf)]())return _0x5b6607(0x1e9);return!![];}});if(!_0x5e96e7['apiKey'])return console[_0x41a8ac(0x1a4)](_0x41a8ac(0x188)),0x1;const _0x277a83=_0x5e96e7[_0x41a8ac(0x186)];console['log'](_0x41a8ac(0x1d8));try{const _0x42f7ab=TDX[_0x41a8ac(0x19b)]({'site':_0x77f6a0,'apiKey':_0x277a83[_0x41a8ac(0x1cf)](),'logLevel':_0x116954['logLevel']??LogLevel[_0x41a8ac(0x1b2)]}),_0x4daaae=await _0x42f7ab[_0x41a8ac(0x1c2)][_0x41a8ac(0x1e5)]();console['log'](a24_0x3c30e4[_0x41a8ac(0x19e)]('✓')+_0x41a8ac(0x1c7)+_0x4daaae[_0x41a8ac(0x1ac)]+')');const _0x503293=await isKeychainAvailable();_0x503293?(await saveAPIKeyAsync(_0x277a83[_0x41a8ac(0x1cf)](),_0x77f6a0,_0x16fbe3),console['log'](a24_0x3c30e4['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x16fbe3+')')):(console[_0x41a8ac(0x1bb)](a24_0x3c30e4[_0x41a8ac(0x1ca)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a24_0x3c30e4[_0x41a8ac(0x1ca)](_0x41a8ac(0x1ae))));const _0x2265f1={'site':_0x77f6a0,..._0x3981ae&&{'description':_0x3981ae}};return saveProfileToUserConfig(_0x16fbe3,_0x2265f1),console['log'](a24_0x3c30e4[_0x41a8ac(0x19e)]('✓')+_0x41a8ac(0x1b4)+_0x16fbe3+_0x41a8ac(0x1da)),console[_0x41a8ac(0x1a4)](),console[_0x41a8ac(0x1a4)](_0x41a8ac(0x1d3)),console['log'](_0x41a8ac(0x1cb)+_0x16fbe3+_0x41a8ac(0x1b5)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x16fbe3+_0x41a8ac(0x1e0)),0x0;}catch(_0x57968b){if(_0x57968b instanceof HTTPClientError&&_0x57968b[_0x41a8ac(0x1cd)]===0x191)return printAuthError(_0x57968b),0x1;return console[_0x41a8ac(0x1d2)](a24_0x3c30e4[_0x41a8ac(0x18d)]('✗\x20Validation\x20failed:\x20'+(_0x57968b instanceof Error?_0x57968b[_0x41a8ac(0x1a3)]:String(_0x57968b)))),console[_0x41a8ac(0x1d2)](_0x41a8ac(0x1c4)),0x1;}}}function a24_0xbeb6(){const _0x1c4388=['jobs','5NUFGUF','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','parent_segment','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20API\x20key\x20is\x20valid\x20(User:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','yellow','\x20\x20tdx\x20--profile\x20','Failed\x20to\x20remove\x20profile:\x20','status','split','trim','Enter\x20your\x20TD\x20API\x20key:','Enter\x20description\x20(optional):','error','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Set\x20session\x20profile','other','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','178302qRufmp','Validating\x20API\x20key...','Changing\x20site\x20to\x20\x27','\x27\x20created','profile','\x27\x20updated:\x20','56VpceKT','\x27\x20removed\x20from\x20configuration','join','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Remove\x20a\x20profile','select','length','getUserInfo','Set\x20a\x20profile\x20configuration\x20value','Session\x20profile\x20set\x20to:\x20','text','API\x20key\x20cannot\x20be\x20empty','(cleared)','profile:remove','confirm','4RtNLnT','\x27\x20does\x20not\x20exist.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','name','tdx:\x20profile\x20remove','llm_project','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','apiKey','28557jUMrjt','\x0aSetup\x20cancelled','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','profile:use','1288215sooJQb','includes','red','logLevel','Profile\x20name\x20cannot\x20be\x20empty','\x20--default\x27\x20to\x20save\x20permanently','config','Enter\x20profile\x20name:','Enter\x20site\x20name:','830494dgVLRu','Profile\x20\x27','\x20\x20-\x20','session','default','execute','31696lElrCO','create','customSite','tdx:\x20profile\x20set','green','profileName','dim','profile:set','description','message','log','773820Erwlcd','VALID_KEYS','bold','You\x20can\x20find\x20your\x20API\x20key\x20at:','/app/mp/ak','password','\x20\x20(no\x20profiles\x20found)','email','us01','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','validate','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','ERROR','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>','\x20Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','\x0aSaved\x20to:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','warn','test','site','Site\x20was\x20not\x20changed.','Default\x20profile\x20set\x20to:\x20','560888olUIYW','tdx:\x20profile\x20create'];a24_0xbeb6=function(){return _0x1c4388;};return a24_0xbeb6();}export class ProfileRemoveCommand extends BaseCommand{[a24_0x39fcef(0x1f0)]=a24_0x39fcef(0x1eb);[a24_0x39fcef(0x1a2)]=a24_0x39fcef(0x1e2);['validate'](_0x3fa0c8){const _0x58f17f=a24_0x39fcef,{args:_0x55ad9c}=_0x3fa0c8;if(_0x55ad9c[_0x58f17f(0x1e4)]===0x0)return _0x58f17f(0x185);return undefined;}async[a24_0x39fcef(0x199)](_0x1bb74a){const _0x85afea=a24_0x39fcef,{args:_0xbe5e02}=_0x1bb74a,_0x39085e=_0xbe5e02[0x0];console[_0x85afea(0x1a4)](a24_0x3c30e4['bold'](_0x85afea(0x1f1)));if(!profileExists(_0x39085e)){console[_0x85afea(0x1d2)](a24_0x3c30e4[_0x85afea(0x18d)](_0x85afea(0x195)+_0x39085e+_0x85afea(0x1ee))),console[_0x85afea(0x1a4)]('\x0aAvailable\x20profiles:');const _0x38772c=listProfiles();if(_0x38772c['length']===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x201555 of _0x38772c){console['log']('\x20\x20-\x20'+_0x201555[_0x85afea(0x1f0)]);}return 0x1;}const _0xbff26e=await a24_0x33929c({'type':_0x85afea(0x1ec),'name':_0x85afea(0x1ec),'message':_0x85afea(0x1b9)+_0x39085e+'\x27?','initial':![]});if(!_0xbff26e[_0x85afea(0x1ec)])return console[_0x85afea(0x1a4)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x39085e),console[_0x85afea(0x1a4)](a24_0x3c30e4[_0x85afea(0x19e)]('✓')+_0x85afea(0x1b4)+_0x39085e+_0x85afea(0x1de));}catch(_0x490bb2){return console['error'](a24_0x3c30e4['red'](_0x85afea(0x1cc)+(_0x490bb2 instanceof Error?_0x490bb2[_0x85afea(0x1a3)]:String(_0x490bb2)))),0x1;}const _0x16fa78=await isKeychainAvailable();if(_0x16fa78){const _0x1fb17f=await deleteKeychainAPIKey(_0x39085e);_0x1fb17f&&console[_0x85afea(0x1a4)](a24_0x3c30e4[_0x85afea(0x19e)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a24_0x39fcef(0x1a1);[a24_0x39fcef(0x1a2)]=a24_0x39fcef(0x1e6);static [a24_0x39fcef(0x1a6)]=[a24_0x39fcef(0x1bd),a24_0x39fcef(0x1c9),a24_0x39fcef(0x1c5),a24_0x39fcef(0x184),'llm_agent',a24_0x39fcef(0x1a2)];[a24_0x39fcef(0x1af)](_0x2a695e){const _0x3e21b7=a24_0x39fcef,{args:_0x1b3e6b,options:_0x37fd99}=_0x2a695e,_0x24a6d2=_0x37fd99['profile']||getActiveProfile();if(!_0x24a6d2)return _0x3e21b7(0x1b3);if(_0x1b3e6b['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[_0x3e21b7(0x1a6)]['join'](',\x20');const _0x300a6f=_0x1b3e6b[0x0];if(!_0x300a6f['includes']('='))return _0x3e21b7(0x1c8)+ProfileSetCommand['VALID_KEYS'][_0x3e21b7(0x1df)](',\x20');const [_0x53219f]=_0x300a6f[_0x3e21b7(0x1ce)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x3e21b7(0x18c)](_0x53219f))return'Unknown\x20key\x20\x27'+_0x53219f+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3e21b7(0x1a6)][_0x3e21b7(0x1df)](',\x20');return undefined;}async[a24_0x39fcef(0x199)](_0x37614c){const _0x343e73=a24_0x39fcef,{args:_0x50d16b,options:_0xbdb32e}=_0x37614c,_0x3ad663=_0xbdb32e[_0x343e73(0x1db)]||getActiveProfile(),[_0x32e04b,..._0x2b542f]=_0x50d16b[0x0][_0x343e73(0x1ce)]('='),_0x316511=_0x2b542f[_0x343e73(0x1df)]('=');console[_0x343e73(0x1a4)](a24_0x3c30e4[_0x343e73(0x1a7)](_0x343e73(0x19d)));if(!profileExists(_0x3ad663)){const _0x530d17=await a24_0x33929c({'type':_0x343e73(0x1ec),'name':_0x343e73(0x19b),'message':'Profile\x20\x27'+_0x3ad663+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x530d17[_0x343e73(0x19b)])return console['log']('Operation\x20cancelled'),0x1;}const _0x29e108=loadProfile(_0x3ad663),_0x4b9f5b=_0x29e108?.[_0x343e73(0x191)]||{};if(_0x32e04b===_0x343e73(0x1bd)){const _0x1f042d=resolveSite(_0x316511);console[_0x343e73(0x1a4)](_0x343e73(0x1d9)+_0x1f042d+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x343e73(0x1a4)](_0x343e73(0x1b1)),console[_0x343e73(0x1a4)]('\x20\x20'+getConsoleUrl(_0x1f042d,_0x343e73(0x1a9)));const _0x1dd583=await a24_0x33929c({'type':_0x343e73(0x1aa),'name':_0x343e73(0x186),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x3bf165=>{const _0x567bb6=_0x343e73;if(!_0x3bf165||!_0x3bf165[_0x567bb6(0x1cf)]())return _0x567bb6(0x1e9);return!![];}});if(!_0x1dd583['apiKey'])return console[_0x343e73(0x1a4)](_0x343e73(0x1b7)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x5c59b4=TDX['create']({'site':_0x1f042d,'apiKey':_0x1dd583[_0x343e73(0x186)]['trim'](),'logLevel':_0xbdb32e[_0x343e73(0x18e)]??LogLevel[_0x343e73(0x1b2)]}),_0x770eee=await _0x5c59b4['jobs'][_0x343e73(0x1e5)]();console[_0x343e73(0x1a4)](a24_0x3c30e4[_0x343e73(0x19e)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x770eee['email']+')');const _0x4603cd=await isKeychainAvailable();_0x4603cd?(await saveAPIKeyAsync(_0x1dd583['apiKey'][_0x343e73(0x1cf)](),_0x1f042d,_0x3ad663),console[_0x343e73(0x1a4)](a24_0x3c30e4[_0x343e73(0x19e)]('✓')+_0x343e73(0x1ef))):console[_0x343e73(0x1bb)](a24_0x3c30e4[_0x343e73(0x1ca)](_0x343e73(0x1b0))),_0x4b9f5b[_0x343e73(0x1bd)]=_0x1f042d;}catch(_0x3910e4){if(_0x3910e4 instanceof HTTPClientError&&_0x3910e4[_0x343e73(0x1cd)]===0x191)return printAuthError(_0x3910e4),0x1;return console[_0x343e73(0x1d2)](a24_0x3c30e4[_0x343e73(0x18d)]('✗\x20Validation\x20failed:\x20'+(_0x3910e4 instanceof Error?_0x3910e4[_0x343e73(0x1a3)]:String(_0x3910e4)))),console[_0x343e73(0x1d2)](_0x343e73(0x1be)),0x1;}}else _0x4b9f5b[_0x32e04b]=_0x316511||undefined;return saveProfileToUserConfig(_0x3ad663,_0x4b9f5b),console['log'](a24_0x3c30e4[_0x343e73(0x19e)]('✓')+'\x20Profile\x20\x27'+_0x3ad663+_0x343e73(0x1dc)+_0x32e04b+'='+(_0x316511||_0x343e73(0x1ea))),0x0;}}function a24_0x35d8(_0x22b8c4,_0x4421c9){_0x22b8c4=_0x22b8c4-0x184;const _0xbeb6ec=a24_0xbeb6();let _0x35d898=_0xbeb6ec[_0x22b8c4];return _0x35d898;}export class ProfileUseCommand extends BaseCommand{[a24_0x39fcef(0x1f0)]=a24_0x39fcef(0x18a);['description']=a24_0x39fcef(0x1d4);[a24_0x39fcef(0x1af)](_0x385e6b){const _0x474643=a24_0x39fcef,{args:_0x3c9f32}=_0x385e6b;if(_0x3c9f32[_0x474643(0x1e4)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x39fcef(0x199)](_0x4588a5){const _0x55c636=a24_0x39fcef,{args:_0x1299bf,options:_0x1ba8f9}=_0x4588a5,_0x4b59f4=_0x1299bf[0x0],_0x597d5f=_0x1ba8f9[_0x55c636(0x198)];cleanExpiredSessions();if(!profileExists(_0x4b59f4)){console['error'](a24_0x3c30e4[_0x55c636(0x18d)](_0x55c636(0x195)+_0x4b59f4+_0x55c636(0x1ee))),console['log'](_0x55c636(0x1b6));const _0x528b30=listProfiles();if(_0x528b30[_0x55c636(0x1e4)]===0x0)console[_0x55c636(0x1a4)](_0x55c636(0x1ab));else for(const _0x7eee5 of _0x528b30){console[_0x55c636(0x1a4)](_0x55c636(0x196)+_0x7eee5['name']);}return 0x1;}if(_0x597d5f){const _0x532a86=a24_0xf84f53['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x4b59f4),console[_0x55c636(0x1a4)](_0x55c636(0x1bf)+a24_0x3c30e4[_0x55c636(0x19e)](_0x4b59f4)),console[_0x55c636(0x1a4)](a24_0x3c30e4['dim'](_0x55c636(0x1b8)+_0x532a86)),0x0;}const _0x536237=_0x1ba8f9[_0x55c636(0x197)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x4b59f4},_0x1ba8f9[_0x55c636(0x197)]),console[_0x55c636(0x1a4)](_0x55c636(0x1e7)+a24_0x3c30e4[_0x55c636(0x19e)](_0x4b59f4)+'\x20'+a24_0x3c30e4[_0x55c636(0x1a0)]('(session:\x20'+_0x536237+')')),console[_0x55c636(0x1a4)](a24_0x3c30e4['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4b59f4+_0x55c636(0x190))),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
- const a25_0x1e4549=a25_0x55cf;function a25_0x55cf(_0x2f0183,_0x5e68da){_0x2f0183=_0x2f0183-0x10d;const _0x2fc054=a25_0x2fc0();let _0x55cf6f=_0x2fc054[_0x2f0183];return _0x55cf6f;}(function(_0x2f3982,_0x5268c8){const _0x34cc9a=a25_0x55cf,_0x183abf=_0x2f3982();while(!![]){try{const _0x1bf709=parseInt(_0x34cc9a(0x113))/0x1+parseInt(_0x34cc9a(0x110))/0x2+parseInt(_0x34cc9a(0x123))/0x3*(-parseInt(_0x34cc9a(0x10e))/0x4)+-parseInt(_0x34cc9a(0x117))/0x5+-parseInt(_0x34cc9a(0x120))/0x6*(-parseInt(_0x34cc9a(0x121))/0x7)+parseInt(_0x34cc9a(0x11e))/0x8*(-parseInt(_0x34cc9a(0x10d))/0x9)+-parseInt(_0x34cc9a(0x124))/0xa*(-parseInt(_0x34cc9a(0x118))/0xb);if(_0x1bf709===_0x5268c8)break;else _0x183abf['push'](_0x183abf['shift']());}catch(_0x41a65a){_0x183abf['push'](_0x183abf['shift']());}}}(a25_0x2fc0,0x31fc1));import{BaseCommand}from'./command.js';function a25_0x2fc0(){const _0x598986=['No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','8LKZDmB','execute','1848FRdONF','4683iHiSTh','message','145419dzYLth','733090dnrNeK','2648007vgbUON','20GzKWbd','error','67170QLcCED','name','config','135438VpJkxM','List\x20all\x20available\x20profiles','profiles','log','1475cEprgp','55YbknxF','length','description','\x20\x20Global:\x20~/.config/tdx/tdx.json','map'];a25_0x2fc0=function(){return _0x598986;};return a25_0x2fc0();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a25_0x1e4549(0x111)]=a25_0x1e4549(0x115);[a25_0x1e4549(0x11a)]=a25_0x1e4549(0x114);async[a25_0x1e4549(0x11f)](_0x4a6f76){const _0x4ad0c3=a25_0x1e4549,{options:_0x3f024b}=_0x4a6f76;try{const _0x1a5d87=listProfiles(),_0x3e996d=getActiveProfile();if(_0x1a5d87[_0x4ad0c3(0x119)]===0x0)return console['log'](_0x4ad0c3(0x11d)),console[_0x4ad0c3(0x116)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x4ad0c3(0x116)](_0x4ad0c3(0x11b)),0x0;const _0x22fdb1=_0x1a5d87[_0x4ad0c3(0x11c)](_0x444d9f=>{const _0x5dd28b=_0x4ad0c3,_0x4d6ad1=_0x444d9f['name']===_0x3e996d,_0x4091c2=getProfileParams(_0x444d9f[_0x5dd28b(0x112)]);return{'name':_0x444d9f[_0x5dd28b(0x111)],'active':_0x4d6ad1,'scope':_0x444d9f['scope'],'description':_0x444d9f[_0x5dd28b(0x112)][_0x5dd28b(0x11a)]||'','params':_0x4091c2};});return await handleSDKOutput(_0x22fdb1,_0x3f024b),0x0;}catch(_0x12af28){return _0x12af28 instanceof Error&&console[_0x4ad0c3(0x10f)]('Error:\x20'+_0x12af28[_0x4ad0c3(0x122)]),0x1;}}}
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_0x1087e9=a26_0x1287;(function(_0x98ca73,_0x303e46){const _0x337a33=a26_0x1287,_0x4c39b3=_0x98ca73();while(!![]){try{const _0x747c4e=parseInt(_0x337a33(0x17c))/0x1*(parseInt(_0x337a33(0x17f))/0x2)+-parseInt(_0x337a33(0x192))/0x3*(-parseInt(_0x337a33(0x183))/0x4)+-parseInt(_0x337a33(0x18d))/0x5*(parseInt(_0x337a33(0x17a))/0x6)+-parseInt(_0x337a33(0x186))/0x7+-parseInt(_0x337a33(0x172))/0x8*(-parseInt(_0x337a33(0x16f))/0x9)+-parseInt(_0x337a33(0x195))/0xa+-parseInt(_0x337a33(0x19d))/0xb;if(_0x747c4e===_0x303e46)break;else _0x4c39b3['push'](_0x4c39b3['shift']());}catch(_0x12a33d){_0x4c39b3['push'](_0x4c39b3['shift']());}}}(a26_0x381b,0xa003f));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x381b(){const _0x47b86d=['args','Executing\x20query\x20[','\x20[Job\x20ID:\x20','\x20rows\x20','2099598bMAjnS','Query\x20completed:\x20Processed\x20','1LiEUgj','message','validate','737614jkumVV','data','execute','options','512hNFyQy','jobId','\x20splits','5389139DalWxM','SQL:\x20','setJobId','information_schema','processedRows','Run\x20Trino\x20queries\x20(streaming)','output','10bumHyL','...','No\x20SQL\x20provided','query','Catalog:\x20','27150AgrcVB','\x0aAll\x20results\x20saved\x20to\x20','join','2671390CXTnTQ','length','verbose','elapsedTimeMillis','push','Schema:\x20','setPhase','file','769054DDQUoL','state','error','stats','name','in\x20','Error:\x20','36mLMtGj','totalSplits','database','1870024CbwdYf','site','Statement\x20','catalog'];a26_0x381b=function(){return _0x47b86d;};return a26_0x381b();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a26_0x1287(_0x292265,_0x7d6a81){_0x292265=_0x292265-0x16c;const _0x381bc3=a26_0x381b();let _0x128719=_0x381bc3[_0x292265];return _0x128719;}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_0x1087e9(0x16c)]=a26_0x1087e9(0x190);['description']=a26_0x1087e9(0x18b);async[a26_0x1087e9(0x181)](_0x559d05){const _0x166a3d=a26_0x1087e9,{options:_0x508649,args:_0x3a627b,tdx:_0x161b3b}=_0x559d05,_0x34b9be=_0x3a627b[0x0],_0x30cd27=_0x508649[_0x166a3d(0x19c)];let _0x4d0248;try{if(_0x30cd27)_0x4d0248=readSqlStatementsFromFile(_0x30cd27);else{if(_0x34b9be==='-')_0x4d0248=await readSqlStatementsFromStdin();else{if(_0x34b9be&&isSqlFilePath(_0x34b9be))_0x4d0248=readSqlStatementsFromFile(_0x34b9be);else{if(_0x34b9be)_0x4d0248=splitSqlStatements(_0x34b9be);else throw new Error(_0x166a3d(0x18f));}}}}catch(_0xa2307c){return console[_0x166a3d(0x19f)](_0x166a3d(0x16e)+_0xa2307c[_0x166a3d(0x17d)]),0x1;}const _0x774e7=_0x508649[_0x166a3d(0x171)]||_0x166a3d(0x189),_0x2064f5=_0x508649[_0x166a3d(0x175)];try{const _0x4ee592=[],_0x15a8f9=!!_0x508649['output'];for(let _0x4ab8b8=0x0;_0x4ab8b8<_0x4d0248[_0x166a3d(0x196)];_0x4ab8b8++){const _0x47e395=_0x4d0248[_0x4ab8b8],_0x48c110=_0x4ab8b8+0x1,_0x45face=_0x4d0248[_0x166a3d(0x196)],_0x68f977=_0x45face>0x1;_0x508649[_0x166a3d(0x197)]&&(console[_0x166a3d(0x19f)]('\x0a'+(_0x68f977?'Statement\x20'+_0x48c110+'/'+_0x45face+':':'')),console[_0x166a3d(0x19f)]('Site:\x20'+_0x508649[_0x166a3d(0x173)]),console[_0x166a3d(0x19f)](_0x166a3d(0x191)+(_0x2064f5||'td')),console[_0x166a3d(0x19f)](_0x166a3d(0x19a)+_0x774e7),console['error'](_0x166a3d(0x187)+_0x47e395));const _0x272d6c=_0x68f977?'Executing\x20statement\x20'+_0x48c110+'/'+_0x45face+_0x166a3d(0x18e):'Executing\x20query...';try{const _0x5eca51=await withProgressSpinner(_0x272d6c,async _0x240a71=>{const _0x4dbb61=_0x166a3d,_0x366cbd=await _0x161b3b['query'][_0x4dbb61(0x181)](_0x47e395,{'catalog':_0x2064f5,'schema':_0x774e7,'onJobId':_0x8d2267=>{const _0x191ee9=_0x4dbb61;_0x240a71[_0x191ee9(0x188)](_0x8d2267);},'onProgress':_0x19b296=>{const _0x3c6467=_0x4dbb61;_0x240a71[_0x3c6467(0x19b)](_0x3c6467(0x177)+_0x19b296[_0x3c6467(0x19e)]+']'),_0x240a71['setExtra'](formatRows(_0x19b296[_0x3c6467(0x18a)])+_0x3c6467(0x179)+_0x19b296['completedSplits']+'/'+_0x19b296[_0x3c6467(0x170)]+_0x3c6467(0x185));}});return _0x366cbd;},{'verbose':_0x508649[_0x166a3d(0x197)]}),_0x880942=_0x5eca51[_0x166a3d(0x180)],_0x33a198=_0x880942[_0x166a3d(0x184)]?_0x166a3d(0x178)+_0x880942[_0x166a3d(0x184)]+']':'',_0x3764be=_0x68f977?_0x166a3d(0x174)+_0x48c110+'/'+_0x45face+'\x20-\x20':'';console[_0x166a3d(0x19f)]('✔\x20'+_0x3764be+_0x166a3d(0x17b)+formatRows(_0x880942[_0x166a3d(0x1a0)]['processedRows'])+_0x166a3d(0x179)+(_0x166a3d(0x16d)+formatElapsed(_0x880942['stats'][_0x166a3d(0x198)])+_0x33a198));if(_0x68f977&&_0x15a8f9){const _0x1fd9ab=resolveOutputOptions(_0x508649),_0x4777e7=await formatQueryOutput(_0x880942,_0x1fd9ab);_0x4ee592[_0x166a3d(0x199)](_0x4777e7);}else await handleQueryOutput(_0x880942,_0x508649);}catch(_0x473619){const _0x2a87ce=_0x68f977?'Statement\x20'+_0x48c110+'/'+_0x45face+':\x0a':'',_0x54b4c3=_0x473619 instanceof SDKError?_0x473619['originalMessage']:_0x473619[_0x166a3d(0x17d)];return console[_0x166a3d(0x19f)](''+_0x2a87ce+_0x54b4c3),0x1;}}if(_0x4d0248['length']>0x1&&_0x15a8f9&&_0x4ee592[_0x166a3d(0x196)]>0x0){const _0x3dda48=_0x4ee592[_0x166a3d(0x194)]('\x0a');writeFileSync(_0x508649[_0x166a3d(0x18c)],_0x3dda48),console[_0x166a3d(0x19f)](_0x166a3d(0x193)+_0x508649[_0x166a3d(0x18c)]);}return 0x0;}catch(_0x24e5e8){throw _0x24e5e8;}}[a26_0x1087e9(0x17e)](_0x50991b){const _0x5fb2d0=a26_0x1087e9,_0x599144=_0x50991b[_0x5fb2d0(0x176)][0x0],_0x2d2490=_0x50991b[_0x5fb2d0(0x182)][_0x5fb2d0(0x19c)];if(!_0x599144&&!_0x2d2490)return'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';if(_0x599144&&_0x2d2490)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;}}