@treasuredata/tdx 0.16.12 → 0.16.13

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 (167) 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.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/anthropic-adapter.js +1 -1
  65. package/dist/proxy/claude-usage-tracker.js +1 -1
  66. package/dist/proxy/context-signature.js +1 -1
  67. package/dist/proxy/conversation-utils.js +1 -1
  68. package/dist/proxy/passthrough-server.js +1 -1
  69. package/dist/proxy/server.js +1 -1
  70. package/dist/proxy/session-cache.js +1 -1
  71. package/dist/proxy/sse-usage-parser.js +1 -1
  72. package/dist/sdk/agent/agent-config.js +1 -1
  73. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  74. package/dist/sdk/agent/agent-yaml.js +1 -1
  75. package/dist/sdk/agent/test/evaluator.js +1 -1
  76. package/dist/sdk/agent/test/executor.js +1 -1
  77. package/dist/sdk/agent/test/index.js +1 -1
  78. package/dist/sdk/agent/test/output.js +1 -1
  79. package/dist/sdk/agent/test/parser.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/endpoints.js +1 -1
  83. package/dist/sdk/client/engage-api-client.js +1 -1
  84. package/dist/sdk/client/http-client.js +1 -1
  85. package/dist/sdk/client/llm-api-client.js +1 -1
  86. package/dist/sdk/client/rate-limiter.js +1 -1
  87. package/dist/sdk/client/td-api-client.js +1 -1
  88. package/dist/sdk/client/trino-api-client.js +1 -1
  89. package/dist/sdk/client/workflow-client.js +1 -1
  90. package/dist/sdk/connection-validator.js +1 -1
  91. package/dist/sdk/connection.js +1 -1
  92. package/dist/sdk/engage.js +1 -1
  93. package/dist/sdk/errors.js +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/io/index.js +1 -1
  96. package/dist/sdk/io/node-filesystem.js +1 -1
  97. package/dist/sdk/job.js +1 -1
  98. package/dist/sdk/journey.js +1 -1
  99. package/dist/sdk/llm/chat-cache.js +1 -1
  100. package/dist/sdk/llm/index.js +1 -1
  101. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  102. package/dist/sdk/llm/model-aliases.js +1 -1
  103. package/dist/sdk/llm/model-factors.js +1 -1
  104. package/dist/sdk/query/index.js +1 -1
  105. package/dist/sdk/query/sql-parser.js +1 -1
  106. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  107. package/dist/sdk/segment/fields-display.js +1 -1
  108. package/dist/sdk/segment/file-discovery.js +1 -1
  109. package/dist/sdk/segment/journey-utils.js +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/pull-workflow.js +1 -1
  114. package/dist/sdk/segment/push-workflow.js +1 -1
  115. package/dist/sdk/segment/resolution-context.js +1 -1
  116. package/dist/sdk/segment/segment-path-parser.js +1 -1
  117. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  118. package/dist/sdk/segment/target-resolution.js +1 -1
  119. package/dist/sdk/segment/tdx-config.js +1 -1
  120. package/dist/sdk/segment/validate-files.js +1 -1
  121. package/dist/sdk/segment/yaml-validator.js +1 -1
  122. package/dist/sdk/segment.js +1 -1
  123. package/dist/sdk/types/index.js +1 -1
  124. package/dist/sdk/types/progress.js +1 -1
  125. package/dist/sdk/user.js +1 -1
  126. package/dist/sdk/util/format-detector.js +1 -1
  127. package/dist/sdk/util/formatters.js +1 -1
  128. package/dist/sdk/util/index.js +1 -1
  129. package/dist/sdk/util/tree-formatter.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.js +1 -1
  148. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  149. package/dist/utils/logger/formatters/index.js +1 -1
  150. package/dist/utils/logger/handlers/console-handler.js +1 -1
  151. package/dist/utils/logger/handlers/file-handler.js +1 -1
  152. package/dist/utils/logger/handlers/index.js +1 -1
  153. package/dist/utils/logger/handlers/null-handler.js +1 -1
  154. package/dist/utils/logger/index.js +1 -1
  155. package/dist/utils/logger/logger.js +1 -1
  156. package/dist/utils/logger/types.js +1 -1
  157. package/dist/utils/option-validation.js +1 -1
  158. package/dist/utils/port.js +1 -1
  159. package/dist/utils/process.js +1 -1
  160. package/dist/utils/prompt.js +1 -1
  161. package/dist/utils/spinner.js +1 -1
  162. package/dist/utils/sse-parser.js +1 -1
  163. package/dist/utils/string-utils.js +1 -1
  164. package/dist/utils/table-ref-parser.js +1 -1
  165. package/dist/utils/tdx-logger.js +1 -1
  166. package/dist/utils/version-check.js +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- const a22_0x201026=a22_0x1e2a;(function(_0x6854f,_0x45ed85){const _0xccf25f=a22_0x1e2a,_0x37f366=_0x6854f();while(!![]){try{const _0x175a70=parseInt(_0xccf25f(0x168))/0x1+parseInt(_0xccf25f(0x165))/0x2*(-parseInt(_0xccf25f(0x162))/0x3)+-parseInt(_0xccf25f(0x171))/0x4+-parseInt(_0xccf25f(0x15c))/0x5+-parseInt(_0xccf25f(0x16a))/0x6+parseInt(_0xccf25f(0x15f))/0x7*(parseInt(_0xccf25f(0x167))/0x8)+parseInt(_0xccf25f(0x166))/0x9;if(_0x175a70===_0x45ed85)break;else _0x37f366['push'](_0x37f366['shift']());}catch(_0x4d5483){_0x37f366['push'](_0x37f366['shift']());}}}(a22_0x590f,0xcb1db));import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{[a22_0x201026(0x16c)]=a22_0x201026(0x15d);[a22_0x201026(0x16e)]='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async[a22_0x201026(0x169)](_0x1bc559){const _0x5e8746=a22_0x201026,{tdx:_0x38a2ae}=_0x1bc559,_0x467f6b={};if(process[_0x5e8746(0x15e)][_0x5e8746(0x16f)])_0x467f6b[_0x5e8746(0x16f)]=process['env'][_0x5e8746(0x16f)];else{if(process[_0x5e8746(0x15e)]['TDX_API_KEY'])_0x467f6b['TDX_API_KEY']=process[_0x5e8746(0x15e)][_0x5e8746(0x161)],process[_0x5e8746(0x15e)][_0x5e8746(0x16b)]&&(_0x467f6b[_0x5e8746(0x16b)]=process[_0x5e8746(0x15e)]['TDX_SITE']);else _0x38a2ae[_0x5e8746(0x15a)][_0x5e8746(0x163)]&&(_0x467f6b[_0x5e8746(0x161)]=_0x38a2ae[_0x5e8746(0x15a)][_0x5e8746(0x163)],_0x467f6b[_0x5e8746(0x16b)]=_0x38a2ae[_0x5e8746(0x15a)]['site']);}_0x38a2ae[_0x5e8746(0x15a)]['profile']&&(_0x467f6b[_0x5e8746(0x16f)]=_0x38a2ae[_0x5e8746(0x15a)][_0x5e8746(0x160)]);try{const {startMCPServer:_0x41b713}=await import(_0x5e8746(0x170));return await _0x41b713({'env':_0x467f6b}),0x0;}catch(_0x16ee3d){const _0x39b114=_0x16ee3d instanceof Error?_0x16ee3d[_0x5e8746(0x164)]:String(_0x16ee3d);return console[_0x5e8746(0x16d)](_0x5e8746(0x15b)+_0x39b114),0x1;}}}function a22_0x1e2a(_0x456cbd,_0x415294){_0x456cbd=_0x456cbd-0x15a;const _0x590faf=a22_0x590f();let _0x1e2a7b=_0x590faf[_0x456cbd];return _0x1e2a7b;}function a22_0x590f(){const _0x35b828=['TDX_SITE','name','error','description','TDX_PROFILE','../mcp/server.js','1222912mXbBJH','context','MCP\x20server\x20error:\x20','7334310HiuIXn','mcp','env','2947jZLqjf','profile','TDX_API_KEY','12VNZeuw','apiKey','message','89368yPvujy','18045144SjfCjP','12856ZcmrKl','1189692hICYAf','execute','6527796dpWYno'];a22_0x590f=function(){return _0x35b828;};return a22_0x590f();}
1
+ const a22_0x3ee33e=a22_0x2466;(function(_0x321025,_0x2d7074){const _0x430ec0=a22_0x2466,_0x22b4e2=_0x321025();while(!![]){try{const _0x2875af=-parseInt(_0x430ec0(0x6b))/0x1*(-parseInt(_0x430ec0(0x75))/0x2)+-parseInt(_0x430ec0(0x76))/0x3+parseInt(_0x430ec0(0x72))/0x4*(-parseInt(_0x430ec0(0x77))/0x5)+-parseInt(_0x430ec0(0x68))/0x6*(-parseInt(_0x430ec0(0x7d))/0x7)+-parseInt(_0x430ec0(0x7c))/0x8*(-parseInt(_0x430ec0(0x6c))/0x9)+-parseInt(_0x430ec0(0x7f))/0xa+-parseInt(_0x430ec0(0x6f))/0xb*(parseInt(_0x430ec0(0x79))/0xc);if(_0x2875af===_0x2d7074)break;else _0x22b4e2['push'](_0x22b4e2['shift']());}catch(_0x4aa9f0){_0x22b4e2['push'](_0x22b4e2['shift']());}}}(a22_0x1284,0x65e6d));function a22_0x2466(_0x4e9cfc,_0x137438){_0x4e9cfc=_0x4e9cfc-0x67;const _0x12840e=a22_0x1284();let _0x2466e4=_0x12840e[_0x4e9cfc];return _0x2466e4;}function a22_0x1284(){const _0x41c956=['TDX_API_KEY','site','apiKey','10854wnmMzr','mcp','context','115603HIFAIS','9htmbJf','env','name','22UjYHvU','message','TDX_PROFILE','306184xKsPdU','TDX_SITE','profile','14QJzwRQ','326640jSkYAW','25EAbyRA','execute','1527996FmXLfB','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','MCP\x20server\x20error:\x20','1922168ayiPVT','2569EXaeTL','error','5497300OKWFEn','../mcp/server.js'];a22_0x1284=function(){return _0x41c956;};return a22_0x1284();}import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{[a22_0x3ee33e(0x6e)]=a22_0x3ee33e(0x69);['description']=a22_0x3ee33e(0x7a);async[a22_0x3ee33e(0x78)](_0x2024f4){const _0x198a52=a22_0x3ee33e,{tdx:_0x32c046}=_0x2024f4,_0x4fc446={};if(process[_0x198a52(0x6d)][_0x198a52(0x71)])_0x4fc446[_0x198a52(0x71)]=process[_0x198a52(0x6d)][_0x198a52(0x71)];else{if(process['env'][_0x198a52(0x81)])_0x4fc446[_0x198a52(0x81)]=process['env'][_0x198a52(0x81)],process['env'][_0x198a52(0x73)]&&(_0x4fc446[_0x198a52(0x73)]=process[_0x198a52(0x6d)][_0x198a52(0x73)]);else _0x32c046[_0x198a52(0x6a)][_0x198a52(0x67)]&&(_0x4fc446[_0x198a52(0x81)]=_0x32c046['context'][_0x198a52(0x67)],_0x4fc446[_0x198a52(0x73)]=_0x32c046['context'][_0x198a52(0x82)]);}_0x32c046[_0x198a52(0x6a)][_0x198a52(0x74)]&&(_0x4fc446[_0x198a52(0x71)]=_0x32c046['context']['profile']);try{const {startMCPServer:_0x39db84}=await import(_0x198a52(0x80));return await _0x39db84({'env':_0x4fc446}),0x0;}catch(_0x554d55){const _0x5aa3ce=_0x554d55 instanceof Error?_0x554d55[_0x198a52(0x70)]:String(_0x554d55);return console[_0x198a52(0x7e)](_0x198a52(0x7b)+_0x5aa3ce),0x1;}}}
@@ -1 +1 @@
1
- const a23_0xaf433d=a23_0x9e58;(function(_0x234bcb,_0x29a3cc){const _0x4263a3=a23_0x9e58,_0x2695a2=_0x234bcb();while(!![]){try{const _0x1497c4=parseInt(_0x4263a3(0x168))/0x1*(parseInt(_0x4263a3(0x1bd))/0x2)+-parseInt(_0x4263a3(0x1ba))/0x3+-parseInt(_0x4263a3(0x1c6))/0x4*(parseInt(_0x4263a3(0x17b))/0x5)+-parseInt(_0x4263a3(0xff))/0x6*(-parseInt(_0x4263a3(0xea))/0x7)+-parseInt(_0x4263a3(0x15e))/0x8*(-parseInt(_0x4263a3(0x17a))/0x9)+parseInt(_0x4263a3(0x1e5))/0xa+-parseInt(_0x4263a3(0x198))/0xb;if(_0x1497c4===_0x29a3cc)break;else _0x2695a2['push'](_0x2695a2['shift']());}catch(_0x430130){_0x2695a2['push'](_0x2695a2['shift']());}}}(a23_0x1ece,0x6d23d));function a23_0x9e58(_0x31b62b,_0x8c58eb){_0x31b62b=_0x31b62b-0xcd;const _0x1ecedf=a23_0x1ece();let _0x9e5803=_0x1ecedf[_0x31b62b];return _0x9e5803;}import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x3b8c55 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_0x27ece7 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_0xaf433d(0x17f),LEGACY_PARENT_SEGMENT_DIR=a23_0xaf433d(0x1ce);function openBrowser(_0xb4b6ba){const _0x5b2556=a23_0xaf433d,_0x88c302=process[_0x5b2556(0x1d9)],_0x56df49=_0x88c302===_0x5b2556(0x147)?_0x5b2556(0xe5):_0x88c302===_0x5b2556(0x14a)?_0x5b2556(0x165):'xdg-open';spawn(_0x56df49,[_0xb4b6ba],{'detached':!![],'stdio':'ignore'})[_0x5b2556(0xd6)]();}function migrateLegacyDirectory(){const _0x87a126=a23_0xaf433d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4519b0=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4519b0['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x87a126(0x11a)](a23_0x27ece7[_0x87a126(0x144)](_0x87a126(0x16f)+LEGACY_PARENT_SEGMENT_DIR+_0x87a126(0x19d)+PARENT_SEGMENT_DIR+_0x87a126(0x157))),console[_0x87a126(0x11a)](a23_0x27ece7[_0x87a126(0x1a0)](_0x87a126(0x156)+LEGACY_PARENT_SEGMENT_DIR+_0x87a126(0x115))),![];console['error'](a23_0x27ece7[_0x87a126(0x144)](_0x87a126(0x1a5)+LEGACY_PARENT_SEGMENT_DIR+_0x87a126(0xfc)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a23_0x27ece7['green'](_0x87a126(0x117)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x52a723){const _0x2ddcb3=_0x52a723 instanceof Error?_0x52a723[_0x87a126(0x1c7)]:String(_0x52a723);return console['error'](a23_0x27ece7[_0x87a126(0xe9)](_0x87a126(0x14d)+_0x2ddcb3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x1f22d3){const _0x3a37fc=a23_0xaf433d;return migrateLegacyDirectory(),super[_0x3a37fc(0x1a7)](_0x1f22d3);}}function resolveYamlFile(_0x52f5a5){const _0x3fc447=a23_0xaf433d;if(_0x52f5a5['endsWith'](_0x3fc447(0xdd))||_0x52f5a5[_0x3fc447(0x185)](_0x3fc447(0xfd)))return _0x52f5a5;return a23_0x3b8c55[_0x3fc447(0x123)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x52f5a5)+'.yml');}function formatProgressMessage(_0x46a1b1){const _0xed5aeb=a23_0xaf433d,_0x32cbba=_0x46a1b1['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x32cbba){const [,_0x5318df,_0x373053,_0x5e5002='']=_0x32cbba;return a23_0x27ece7[_0xed5aeb(0x1a0)](_0x5318df+':')+'\x20'+_0x373053+a23_0x27ece7[_0xed5aeb(0x1a0)](_0x5e5002);}return a23_0x27ece7[_0xed5aeb(0x1a0)](_0x46a1b1);}function showFileNotFoundError(_0x48aa38,_0x2a339b){const _0x4936d0=a23_0xaf433d;console[_0x4936d0(0x11a)](a23_0x27ece7[_0x4936d0(0xe9)](_0x4936d0(0x183)+_0x48aa38+'\x0a')),console['error'](a23_0x27ece7[_0x4936d0(0x103)](_0x4936d0(0x130)+_0x2a339b+_0x4936d0(0x1b4)));}function showParentSegmentNotSetError(_0x29365b){const _0xa5f25b=a23_0xaf433d;console[_0xa5f25b(0x11a)](a23_0x27ece7['yellow'](_0xa5f25b(0x121))),console[_0xa5f25b(0x11a)](_0x29365b);}export class ParentSegmentListCommand extends BaseCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0x17e);[a23_0xaf433d(0x1a4)]='List\x20parent\x20segments';async[a23_0xaf433d(0x109)](_0x49060e){const _0x190259=a23_0xaf433d,{options:_0x3e0004,args:_0x571d1b,tdx:_0x57d743}=_0x49060e,_0x1a195c=_0x571d1b[0x0];_0x3e0004[_0x190259(0x1bf)]&&(console[_0x190259(0x11a)]('Site:\x20'+_0x3e0004[_0x190259(0x12e)]),_0x1a195c&&console[_0x190259(0x11a)]('Pattern:\x20'+_0x1a195c));const _0x4b0673=await withSpinner(_0x1a195c?_0x190259(0x100)+_0x1a195c+'\x27...':'Listing\x20parent\x20segments...',()=>_0x57d743[_0x190259(0x1e7)][_0x190259(0x155)](),{'verbose':_0x3e0004[_0x190259(0x1bf)]});let _0x4b86f3=_0x4b0673[_0x190259(0x1f3)];if(_0x1a195c){const _0x56f5a4=_0x1a195c['replace'](/[.+^${}()|[\]\\]/g,_0x190259(0x172))[_0x190259(0x154)](/\*/g,'.*')[_0x190259(0x154)](/\?/g,'.'),_0x4b601e=new RegExp('^'+_0x56f5a4+'$','i');_0x4b86f3=_0x4b86f3['filter'](_0x5e4d4c=>_0x4b601e[_0x190259(0x101)](_0x5e4d4c['attributes'][_0x190259(0x107)]));}_0x4b86f3[_0x190259(0x169)]((_0x55aece,_0x5861aa)=>_0x55aece['attributes'][_0x190259(0x107)][_0x190259(0x1bb)](_0x5861aa[_0x190259(0x122)]['name'])),console['error'](_0x190259(0x181)+_0x4b86f3['length']+'\x20parent\x20segment'+(_0x4b86f3[_0x190259(0x1e2)]!==0x1?'s':''));const _0x1bff0f=_0x1abd07=>{const _0x597436=_0x190259;return getConsoleNextUrl(_0x3e0004[_0x597436(0x12e)],_0x597436(0x18f)+_0x1abd07);};if(_0x3e0004[_0x190259(0xd9)]===_0x190259(0x186)||_0x3e0004[_0x190259(0xd9)]===_0x190259(0x1b1)){const _0x2f5ee3=_0x4b86f3['map'](_0x181e6a=>({..._0x181e6a,'url':_0x1bff0f(_0x181e6a['id'])}));await handleSDKOutput(_0x2f5ee3,_0x3e0004);}else{if(_0x4b86f3[_0x190259(0x1e2)]===0x0)_0x1a195c?console[_0x190259(0x1e6)](_0x190259(0x16e)+_0x1a195c):console['log']('No\x20parent\x20segments\x20found');else for(const _0x4ec216 of _0x4b86f3){const _0xa351c2=_0x4ec216[_0x190259(0x122)][_0x190259(0x138)]?a23_0x27ece7[_0x190259(0x1a0)]('\x20('+formatRows(_0x4ec216[_0x190259(0x122)][_0x190259(0x138)])+')'):'',_0xc1a73b=hyperlink(_0x4ec216[_0x190259(0x122)][_0x190259(0x107)],_0x1bff0f(_0x4ec216['id']));console[_0x190259(0x1e6)](_0x190259(0x131)+_0xc1a73b+_0xa351c2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0x1aa);['description']=a23_0xaf433d(0x1f0);async[a23_0xaf433d(0x109)](_0xd20736){const _0x5da03a=a23_0xaf433d,{options:_0x24bab,args:_0x550f7b,tdx:_0x1adc64}=_0xd20736;console[_0x5da03a(0x11a)](_0x5da03a(0x18a)+_0x5da03a(0x1f2)+_0x5da03a(0xdf));const _0x58667f=_0x24bab;if(_0x550f7b[_0x5da03a(0x1e2)]===0x0)return console[_0x5da03a(0x11a)](a23_0x27ece7['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x5da03a(0x11a)](_0x5da03a(0x10f)),0x1;const _0x52f6ec=_0x550f7b[0x0];if(!_0x58667f[_0x5da03a(0x1f4)]||!_0x58667f['table'])return console[_0x5da03a(0x11a)](_0x5da03a(0x1c8)),console['error'](_0x5da03a(0x10f)),0x1;_0x58667f[_0x5da03a(0x1bf)]&&(console['error'](_0x5da03a(0x1c9)+_0x58667f['site']),console[_0x5da03a(0x11a)](_0x5da03a(0xeb)+_0x52f6ec),console[_0x5da03a(0x11a)]('Database:\x20'+_0x58667f[_0x5da03a(0x1f4)]),console[_0x5da03a(0x11a)](_0x5da03a(0x133)+_0x58667f[_0x5da03a(0x137)]));const _0x4a321a=await loadJSONFromOptions(_0x58667f[_0x5da03a(0x122)],_0x58667f[_0x5da03a(0x180)]),_0x86c000=await loadJSONFromOptions(_0x58667f[_0x5da03a(0x1d1)],_0x58667f[_0x5da03a(0x1b8)]),_0x3c41cc=await loadJSONFromOptions(_0x58667f[_0x5da03a(0x10e)],_0x58667f['customerGroupFile']),_0x18d44b={'name':_0x52f6ec,'description':_0x58667f[_0x5da03a(0x1a4)],'scheduleType':_0x58667f[_0x5da03a(0xf4)],'scheduleOption':_0x58667f[_0x5da03a(0x134)],'timezone':_0x58667f[_0x5da03a(0xd8)],'master':{'parentDatabaseName':_0x58667f[_0x5da03a(0x1f4)],'parentTableName':_0x58667f[_0x5da03a(0x137)]},'attributes':_0x4a321a,'behaviors':_0x86c000,'customerGroup':_0x3c41cc},_0x185a41=await withSpinner(_0x5da03a(0x1ed)+_0x52f6ec+'\x27...',()=>_0x1adc64[_0x5da03a(0x1e7)]['createParent'](_0x18d44b),{'verbose':_0x24bab['verbose']}),_0x1ba085=_0x185a41['data'];return console['error'](_0x5da03a(0x1c5)+_0x1ba085[_0x5da03a(0x107)]+_0x5da03a(0x1e3)+_0x1ba085['id']),await handleSDKOutput([_0x1ba085],_0x24bab),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a23_0xaf433d(0x143);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0xe8);async[a23_0xaf433d(0x109)](_0x296f88){const _0x180691=a23_0xaf433d,{options:_0x1eaf74,args:_0xc1ceab,tdx:_0x5342ac}=_0x296f88;console['error'](_0x180691(0xf9)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x180691(0xdf));const _0x257ddb=_0x1eaf74;if(_0xc1ceab['length']===0x0)return console['error'](a23_0x27ece7[_0x180691(0xe9)](_0x180691(0xde))),console[_0x180691(0x11a)](_0x180691(0x1dc)),0x1;const _0x480c79=_0xc1ceab[0x0];_0x257ddb[_0x180691(0x1bf)]&&(console['error'](_0x180691(0x1c9)+_0x257ddb['site']),console[_0x180691(0x11a)](_0x180691(0xdc)+_0x480c79));const _0x292bab=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x480c79+_0x180691(0x148),()=>_0x5342ac[_0x180691(0x1e7)][_0x180691(0x178)](_0x480c79),{'verbose':_0x257ddb[_0x180691(0x1bf)]}),_0x332e6c=_0x292bab[_0x180691(0x1f3)],_0x1faa17=await loadJSONFromOptions(_0x257ddb[_0x180691(0x1c4)],_0x257ddb[_0x180691(0x108)]),_0x34bcd0=await loadJSONFromOptions(_0x257ddb[_0x180691(0x120)],_0x257ddb[_0x180691(0x16a)]),_0x164ecf={'name':_0x332e6c[_0x180691(0x107)],'description':_0x257ddb[_0x180691(0x1a4)]!==undefined?_0x257ddb[_0x180691(0x1a4)]:_0x332e6c[_0x180691(0x1a4)],'scheduleType':_0x257ddb[_0x180691(0xf4)]!==undefined?_0x257ddb[_0x180691(0xf4)]:_0x332e6c[_0x180691(0xf4)],'scheduleOption':_0x257ddb[_0x180691(0x134)]!==undefined?_0x257ddb[_0x180691(0x134)]:_0x332e6c['scheduleOption'],'timezone':_0x257ddb[_0x180691(0xd8)]!==undefined?_0x257ddb[_0x180691(0xd8)]:_0x332e6c['timezone'],'master':_0x332e6c[_0x180691(0x1d6)],'attributes':_0x1faa17?[..._0x332e6c['attributes']||[],..._0x1faa17]:_0x332e6c[_0x180691(0x122)],'behaviors':_0x34bcd0?[..._0x332e6c[_0x180691(0x1d1)]||[],..._0x34bcd0]:_0x332e6c['behaviors'],'customerGroup':_0x332e6c[_0x180691(0x10e)]},_0x382a91=await withSpinner(_0x180691(0x1f7)+_0x480c79+_0x180691(0x148),()=>_0x5342ac[_0x180691(0x1e7)][_0x180691(0xf8)](_0x480c79,_0x164ecf),{'verbose':_0x257ddb[_0x180691(0x1bf)]}),_0x334d86=_0x382a91[_0x180691(0x1f3)];return console[_0x180691(0x11a)](_0x180691(0x10d)+_0x334d86[_0x180691(0x107)]+'\x27'),await handleSDKOutput([_0x334d86],_0x257ddb),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0x14b);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x13d);async['execute'](_0xb7a17e){const _0x399f4c=a23_0xaf433d,{options:_0x4a3d8c,args:_0x153428,tdx:_0x24ce9b}=_0xb7a17e,_0x4abfe2=_0x4a3d8c,_0x5ce779=_0x153428[0x0]||_0x4a3d8c[_0x399f4c(0x1d2)];if(!_0x5ce779)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'+_0x399f4c(0x15d)),0x1;if(_0x4abfe2[_0x399f4c(0x15b)]&&_0x4abfe2[_0x399f4c(0x161)])return console[_0x399f4c(0x11a)](a23_0x27ece7['red'](_0x399f4c(0xe7))),console[_0x399f4c(0x11a)](a23_0x27ece7[_0x399f4c(0x1a0)](_0x399f4c(0x1e4))),console[_0x399f4c(0x11a)](a23_0x27ece7['dim'](_0x399f4c(0x182)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a23_0x27ece7[_0x399f4c(0x103)](_0x399f4c(0x10b))),0x1;const _0xe077c0=_0x4abfe2[_0x399f4c(0x161)]||a23_0x3b8c55[_0x399f4c(0x123)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5ce779)+_0x399f4c(0xdd));_0x4abfe2[_0x399f4c(0x1bf)]&&(console[_0x399f4c(0x11a)](_0x399f4c(0x1c9)+_0x4abfe2[_0x399f4c(0x12e)]),console[_0x399f4c(0x11a)](_0x399f4c(0xdc)+_0x5ce779),console[_0x399f4c(0x11a)](_0x399f4c(0x173)+_0xe077c0));const _0x3c5f8d=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x5ce779+_0x399f4c(0x148),()=>_0x24ce9b[_0x399f4c(0x1e7)][_0x399f4c(0x164)](_0x5ce779),{'verbose':_0x4abfe2[_0x399f4c(0x1bf)]}),_0x4aad03=_0x3c5f8d[_0x399f4c(0x1f3)];if(existsSync(_0xe077c0)){const _0x4b0fb7=readFileSync(_0xe077c0,_0x399f4c(0x12f)),_0x4741a1=generateDiff(_0x4b0fb7,_0x4aad03);if(!hasChanges(_0x4741a1))console['error'](a23_0x27ece7[_0x399f4c(0x16d)]('✔')+_0x399f4c(0x1ac)+a23_0x27ece7['cyan'](_0xe077c0)+_0x399f4c(0x162));else{console[_0x399f4c(0x11a)](_0x399f4c(0x12b)+_0xe077c0+'\x27:'),console[_0x399f4c(0x11a)]('─'[_0x399f4c(0x1a1)](0x3c)),console['error'](formatDiffWithColors(_0x4741a1)),console[_0x399f4c(0x11a)]('─'['repeat'](0x3c));if(!_0x4abfe2[_0x399f4c(0x1af)]){const _0x1b7808=await confirmKey(_0x399f4c(0x18c)+_0xe077c0+'\x27?');if(!_0x1b7808)return console[_0x399f4c(0x11a)](_0x399f4c(0x1cd)),0x1;}writeFileSync(_0xe077c0,_0x4aad03,_0x399f4c(0x12f)),console[_0x399f4c(0x11a)](a23_0x27ece7[_0x399f4c(0x16d)]('✔')+_0x399f4c(0x195)+a23_0x27ece7[_0x399f4c(0x103)](_0xe077c0));}}else{const _0x300f28=a23_0x3b8c55[_0x399f4c(0x1ee)](_0xe077c0);!existsSync(_0x300f28)&&mkdirSync(_0x300f28,{'recursive':!![]}),writeFileSync(_0xe077c0,_0x4aad03,_0x399f4c(0x12f)),console[_0x399f4c(0x11a)](a23_0x27ece7[_0x399f4c(0x16d)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x27ece7[_0x399f4c(0x103)](_0xe077c0));}return saveSessionContext({'parent_segment':_0x5ce779},_0x4abfe2[_0x399f4c(0x1d7)]),console['error'](a23_0x27ece7[_0x399f4c(0x16d)]('✔')+_0x399f4c(0x1ea)+a23_0x27ece7[_0x399f4c(0x1a0)](_0x399f4c(0x1ce))+_0x399f4c(0xd1)+a23_0x27ece7[_0x399f4c(0x103)](_0x5ce779)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0x151);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x1ca);async[a23_0xaf433d(0x109)](_0x26104b){const _0x3f93d3=a23_0xaf433d,{options:_0x264bae,args:_0x5cb0da,tdx:_0x3faf0f}=_0x26104b,_0x32cc0f=_0x264bae,_0x87596=_0x5cb0da[0x0]||_0x264bae[_0x3f93d3(0x1d2)];if(!_0x87596)return showParentSegmentNotSetError(_0x3f93d3(0x1e0)+_0x3f93d3(0x1ec)),0x1;const _0x575b33=resolveYamlFile(_0x87596);if(!existsSync(_0x575b33))return showFileNotFoundError(_0x575b33,_0x87596),0x1;_0x32cc0f[_0x3f93d3(0x1bf)]&&(console[_0x3f93d3(0x11a)](_0x3f93d3(0x1c9)+_0x32cc0f['site']),console['error']('YAML\x20file:\x20'+_0x575b33));let _0x142a9e;try{_0x142a9e=readFileSync(_0x575b33,_0x3f93d3(0x12f));}catch(_0x4cf37e){const _0x3788c1=_0x4cf37e instanceof Error?_0x4cf37e[_0x3f93d3(0x1c7)]:String(_0x4cf37e);return console[_0x3f93d3(0x11a)]('Error\x20reading\x20file:\x20'+_0x3788c1),0x1;}const _0x3b53cd=await withSpinner(_0x3f93d3(0x14c),()=>_0x3faf0f[_0x3f93d3(0x1e7)][_0x3f93d3(0x1d4)](_0x142a9e),{'verbose':_0x32cc0f['verbose']}),_0x44e472=_0x3b53cd[_0x3f93d3(0x1f3)],{isNew:_0x5457c8,name:_0x4c9c26,hasChanges:_0x4038d9,diffFormatted:_0x21658d}=_0x44e472;if(!_0x4038d9)return console[_0x3f93d3(0x11a)](_0x3f93d3(0x1d5)+_0x4c9c26+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x5457c8?console[_0x3f93d3(0x11a)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x4c9c26+'\x27:'):console[_0x3f93d3(0x11a)](_0x3f93d3(0x1a9)+_0x4c9c26+'\x27:');console[_0x3f93d3(0x11a)]('─'[_0x3f93d3(0x1a1)](0x3c)),console[_0x3f93d3(0x11a)](_0x21658d),console[_0x3f93d3(0x11a)]('─'[_0x3f93d3(0x1a1)](0x3c));const _0x3faf89=_0x5457c8?_0x3f93d3(0x104)+_0x4c9c26+'\x27?':_0x3f93d3(0x199)+_0x4c9c26+'\x27?';if(!_0x32cc0f[_0x3f93d3(0x1af)]){const _0x56fe92=await confirmKey(_0x3faf89);if(!_0x56fe92)return console[_0x3f93d3(0x11a)](_0x3f93d3(0x1cd)),0x1;}const _0x2e223a=_0x5457c8?_0x3f93d3(0xf1):_0x3f93d3(0xf6),_0x7b8f83=await withSpinner(_0x2e223a+'\x20parent\x20segment\x20\x27'+_0x4c9c26+_0x3f93d3(0x148),()=>_0x44e472['apply'](),{'verbose':_0x32cc0f['verbose']}),_0x5aa193=_0x7b8f83['data'],_0x4e86c1=getConsoleNextUrl(_0x32cc0f['site'],_0x3f93d3(0x18f)+_0x5aa193['id']),_0x2e473a=_0x5457c8?'Created':'Updated';return console['error']('✔\x20'+_0x2e473a+_0x3f93d3(0x152)+_0x5aa193[_0x3f93d3(0x107)]+'\x27'),console[_0x3f93d3(0x11a)]('\x20\x20'+_0x4e86c1),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0xaf433d(0x146);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x1ad);async[a23_0xaf433d(0x109)](_0x5d1eab){const _0x221f9f=a23_0xaf433d,{options:_0x1f0568,args:_0x5e37fb,tdx:_0x339879}=_0x5d1eab,_0x1f9387=_0x1f0568,_0x421061=_0x5e37fb[0x0]||_0x1f0568['parentSegment'];if(!_0x421061)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x221f9f(0xf2)+'Options:\x0a'+_0x221f9f(0x141)+_0x221f9f(0x139)+_0x221f9f(0x1be)),0x1;const _0x5d5a91=resolveYamlFile(_0x421061);if(!existsSync(_0x5d5a91))return showFileNotFoundError(_0x5d5a91,_0x421061),0x1;_0x1f9387[_0x221f9f(0x1bf)]&&(console[_0x221f9f(0x11a)](_0x221f9f(0x1c9)+_0x1f9387[_0x221f9f(0x12e)]),console[_0x221f9f(0x11a)]('YAML\x20file:\x20'+_0x5d5a91));let _0x24758c;try{_0x24758c=readFileSync(_0x5d5a91,_0x221f9f(0x12f));}catch(_0x5316c2){const _0x2e8f5d=_0x5316c2 instanceof Error?_0x5316c2[_0x221f9f(0x1c7)]:String(_0x5316c2);return console[_0x221f9f(0x11a)](_0x221f9f(0x184)+_0x2e8f5d),0x1;}const _0x59f766=createCommandSpinner(a23_0x27ece7[_0x221f9f(0x1a0)](_0x221f9f(0x118)),{'verbose':_0x1f9387['verbose']});_0x59f766['start']();const _0x1886d0={'onProgress':_0x4a8bcb=>{_0x59f766['text']=formatProgressMessage(_0x4a8bcb);}};if(_0x1f9387[_0x221f9f(0x1d6)])_0x1886d0[_0x221f9f(0x1d6)]=!![];if(_0x1f9387[_0x221f9f(0x175)])_0x1886d0[_0x221f9f(0x175)]=!![];_0x1f9387['attribute']&&(_0x1886d0[_0x221f9f(0x13c)]=_0x1f9387['attribute']);_0x1f9387['behavior']&&(_0x1886d0[_0x221f9f(0xda)]=_0x1f9387[_0x221f9f(0xda)]);if(_0x1f9387[_0x221f9f(0x113)])_0x1886d0['interval']=_0x1f9387['interval'];let _0x49babc;try{_0x49babc=await _0x339879[_0x221f9f(0x1e7)][_0x221f9f(0x19b)](_0x24758c,_0x1886d0),_0x59f766[_0x221f9f(0x116)]();}catch(_0x24caff){_0x59f766['stop']();throw _0x24caff;}const _0x270b2b=_0x1f9387['interval']||_0x221f9f(0x174);return this[_0x221f9f(0x1a3)](_0x49babc,_0x1886d0,_0x5d5a91,_0x270b2b),_0x49babc[_0x221f9f(0x160)]?0x0:0x1;}[a23_0xaf433d(0x1a3)](_0x181cee,_0x6b6b86,_0x52bb06,_0x537529){const _0x174d96=a23_0xaf433d;console[_0x174d96(0x11a)]('\x0a'+a23_0x27ece7[_0x174d96(0x1b6)](_0x174d96(0x1eb))+'\x20'+_0x181cee[_0x174d96(0x107)]),console['error']('═'[_0x174d96(0x1a1)](0x3c)),this['displayMasterInfo'](_0x181cee);if(typeof _0x6b6b86[_0x174d96(0x13c)]===_0x174d96(0x124)){this[_0x174d96(0x106)](_0x181cee),this[_0x174d96(0x1cb)](_0x181cee),this[_0x174d96(0x1f1)](_0x52bb06,_0x537529,_0x174d96(0x13c),_0x6b6b86[_0x174d96(0x13c)]);return;}if(_0x6b6b86[_0x174d96(0x13c)]===!![]){this['displayAttributesStats'](_0x181cee),this[_0x174d96(0x1cb)](_0x181cee),this['displayPreviewHints'](_0x52bb06,_0x537529,_0x174d96(0x122));return;}if(typeof _0x6b6b86[_0x174d96(0xda)]==='string'){this['displayBehaviorsStats'](_0x181cee,_0x537529),this['displaySummary'](_0x181cee),this[_0x174d96(0x1f1)](_0x52bb06,_0x537529,_0x174d96(0xda),_0x6b6b86[_0x174d96(0xda)]);return;}if(_0x6b6b86[_0x174d96(0xda)]===!![]){this[_0x174d96(0x1ef)](_0x181cee,_0x537529),this[_0x174d96(0x1cb)](_0x181cee),this[_0x174d96(0x1f1)](_0x52bb06,_0x537529,_0x174d96(0x1d1));return;}this[_0x174d96(0x106)](_0x181cee),this[_0x174d96(0x1ef)](_0x181cee,_0x537529),this[_0x174d96(0x1cb)](_0x181cee),this[_0x174d96(0x1f1)](_0x52bb06,_0x537529,_0x174d96(0x1a8));}['displayPreviewHints'](_0x43438a,_0x41b435,_0x16aa6f,_0x6f5be0){const _0x8ab015=a23_0xaf433d;console['error']('\x0a'+a23_0x27ece7['dim']('To\x20view\x20sample\x20data:'));const _0x4083c9=_0x41b435!==_0x8ab015(0x174)?_0x8ab015(0x1b2)+_0x41b435:'';if(_0x16aa6f==='attribute'&&_0x6f5be0)console[_0x8ab015(0x11a)]('\x20\x20'+a23_0x27ece7[_0x8ab015(0x1a0)](_0x8ab015(0x132)+_0x43438a+_0x8ab015(0x119)+_0x6f5be0+'\x22'+_0x4083c9));else{if(_0x16aa6f===_0x8ab015(0xda)&&_0x6f5be0)console[_0x8ab015(0x11a)]('\x20\x20'+a23_0x27ece7[_0x8ab015(0x1a0)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43438a+_0x8ab015(0x136)+_0x6f5be0+'\x22'+_0x4083c9));else(_0x16aa6f===_0x8ab015(0x122)||_0x16aa6f===_0x8ab015(0x1a8))&&console[_0x8ab015(0x11a)]('\x20\x20'+a23_0x27ece7['dim'](_0x8ab015(0x132)+_0x43438a+'\x20--attribute\x20\x22<name>\x22'+_0x4083c9));}(_0x16aa6f==='behaviors'||_0x16aa6f===_0x8ab015(0x1a8))&&console[_0x8ab015(0x11a)]('\x20\x20'+a23_0x27ece7[_0x8ab015(0x1a0)](_0x8ab015(0x132)+_0x43438a+_0x8ab015(0xcd)+_0x4083c9)),_0x16aa6f===_0x8ab015(0x1a8)&&console[_0x8ab015(0x11a)]('\x20\x20'+a23_0x27ece7[_0x8ab015(0x1a0)](_0x8ab015(0x132)+_0x43438a+_0x8ab015(0x12a)+_0x4083c9));}[a23_0xaf433d(0x127)](_0x3d4962){const _0xcd7b6f=a23_0xaf433d,{master:_0x17e7bd}=_0x3d4962,_0x26fc05=_0x17e7bd[_0xcd7b6f(0xfb)]?a23_0x27ece7[_0xcd7b6f(0x16d)]('✔'):a23_0x27ece7[_0xcd7b6f(0xe9)]('✘');console['error']('\x0a'+a23_0x27ece7[_0xcd7b6f(0x1a0)](_0xcd7b6f(0x126))),console[_0xcd7b6f(0x11a)](_0x26fc05+'\x20'+a23_0x27ece7[_0xcd7b6f(0x1b6)](_0x17e7bd[_0xcd7b6f(0x1f4)]+'.'+_0x17e7bd[_0xcd7b6f(0x137)])),_0x17e7bd[_0xcd7b6f(0xfb)]?_0x17e7bd['rowCount']!==undefined&&console[_0xcd7b6f(0x11a)]('\x20\x20'+a23_0x27ece7[_0xcd7b6f(0x1a0)]('Rows:')+'\x20'+a23_0x27ece7[_0xcd7b6f(0x103)](formatRows(_0x17e7bd[_0xcd7b6f(0x13e)]))):console[_0xcd7b6f(0x11a)]('\x20\x20'+a23_0x27ece7[_0xcd7b6f(0xe9)]('Error:')+'\x20'+_0x17e7bd[_0xcd7b6f(0x18d)]);}[a23_0xaf433d(0x106)](_0x4ba1d4){const _0x14c468=a23_0xaf433d;if(_0x4ba1d4['attributes'][_0x14c468(0x1e2)]===0x0)return;console[_0x14c468(0x11a)]('\x0a'+a23_0x27ece7[_0x14c468(0x1a0)](_0x14c468(0x105)));for(const _0x395d37 of _0x4ba1d4[_0x14c468(0x122)]){const _0x467906=_0x395d37[_0x14c468(0xfb)]?a23_0x27ece7[_0x14c468(0x16d)]('✔'):a23_0x27ece7['red']('✘');let _0x3e86ec='';if(_0x395d37['schemaValid']&&_0x395d37['matchedCount']!==undefined&&_0x395d37['coveragePercent']!==undefined){const _0x53092e=_0x395d37[_0x14c468(0x19f)][_0x14c468(0xdb)](0x1),_0x351e54=_0x395d37[_0x14c468(0x19f)]>=0x50?a23_0x27ece7['green']:_0x395d37[_0x14c468(0x19f)]>=0x32?a23_0x27ece7[_0x14c468(0x144)]:a23_0x27ece7['red'];_0x3e86ec='\x20'+a23_0x27ece7[_0x14c468(0x1a0)](_0x14c468(0x1c1))+'\x20'+_0x351e54(_0x53092e+'%')+'\x20('+formatRows(_0x395d37[_0x14c468(0x167)])+_0x14c468(0x170);}console['error'](_0x467906+'\x20'+a23_0x27ece7[_0x14c468(0x1b6)](_0x395d37[_0x14c468(0x107)])+_0x3e86ec),console[_0x14c468(0x11a)]('\x20\x20'+a23_0x27ece7[_0x14c468(0x1a0)](_0x14c468(0x1c3))+'\x20'+a23_0x27ece7[_0x14c468(0x1b6)](_0x395d37[_0x14c468(0x1f4)]+'.'+_0x395d37[_0x14c468(0x137)]));const _0x3344c2=_0x395d37[_0x14c468(0xe2)]===_0x395d37[_0x14c468(0xd3)]?a23_0x27ece7['dim']('Join\x20on:')+'\x20'+_0x395d37['joinKey']:a23_0x27ece7[_0x14c468(0x1a0)](_0x14c468(0xef))+'\x20'+_0x395d37[_0x14c468(0xe2)]+_0x14c468(0xd1)+_0x395d37['foreignKey'];console['error']('\x20\x20'+_0x3344c2),console[_0x14c468(0x11a)]('\x20\x20'+a23_0x27ece7[_0x14c468(0x1a0)](_0x14c468(0x159))),this[_0x14c468(0x166)](_0x395d37[_0x14c468(0x1f8)]),!_0x395d37['schemaValid']&&console['error']('\x20\x20'+a23_0x27ece7[_0x14c468(0xe9)](_0x14c468(0x17d))+'\x20'+_0x395d37[_0x14c468(0x18d)]);}}[a23_0xaf433d(0x1ef)](_0x42d00e,_0x6a4c3f){const _0x1bb2c9=a23_0xaf433d;if(_0x42d00e[_0x1bb2c9(0x1d1)][_0x1bb2c9(0x1e2)]===0x0)return;console[_0x1bb2c9(0x11a)]('\x0a'+a23_0x27ece7[_0x1bb2c9(0x1a0)](_0x1bb2c9(0x114))+'\x20'+a23_0x27ece7[_0x1bb2c9(0x1a0)]('('+_0x6a4c3f+')'));for(const _0xeeb780 of _0x42d00e[_0x1bb2c9(0x1d1)]){const _0x333b65=_0xeeb780[_0x1bb2c9(0xfb)]?a23_0x27ece7[_0x1bb2c9(0x16d)]('✔'):a23_0x27ece7['red']('✘');let _0xe6d36b='';if(_0xeeb780[_0x1bb2c9(0xfb)]&&_0xeeb780[_0x1bb2c9(0x102)]!==undefined&&_0xeeb780['totalEvents']!==undefined){const _0x2d313a=_0xeeb780[_0x1bb2c9(0x1e8)]?.[_0x1bb2c9(0xdb)](0x1)||'?',_0x2b0fe5=(_0xeeb780[_0x1bb2c9(0x1e8)]??0x0)>=0x32?a23_0x27ece7['green']:(_0xeeb780['customerPercent']??0x0)>=0x14?a23_0x27ece7[_0x1bb2c9(0x144)]:a23_0x27ece7[_0x1bb2c9(0xe9)];_0xe6d36b='\x20'+a23_0x27ece7[_0x1bb2c9(0x1a0)](_0x1bb2c9(0xf7))+'\x20'+_0x2b0fe5(formatRows(_0xeeb780[_0x1bb2c9(0x102)]))+'\x20('+_0x2d313a+'%)\x20'+a23_0x27ece7[_0x1bb2c9(0x1a0)]('Events:')+'\x20'+a23_0x27ece7[_0x1bb2c9(0x103)](formatRows(_0xeeb780[_0x1bb2c9(0x1f5)]));}console['error'](_0x333b65+'\x20'+a23_0x27ece7[_0x1bb2c9(0x1b6)](_0xeeb780[_0x1bb2c9(0x107)])+_0xe6d36b),console[_0x1bb2c9(0x11a)]('\x20\x20'+a23_0x27ece7[_0x1bb2c9(0x1a0)]('Source:')+'\x20'+a23_0x27ece7[_0x1bb2c9(0x1b6)](_0xeeb780[_0x1bb2c9(0x1f4)]+'.'+_0xeeb780[_0x1bb2c9(0x137)]));const _0x34e9ce=_0xeeb780['joinKey']===_0xeeb780[_0x1bb2c9(0xd3)]?a23_0x27ece7['dim'](_0x1bb2c9(0x1b3))+'\x20'+_0xeeb780[_0x1bb2c9(0xe2)]:a23_0x27ece7[_0x1bb2c9(0x1a0)](_0x1bb2c9(0xef))+'\x20'+_0xeeb780['joinKey']+'\x20=\x20'+_0xeeb780[_0x1bb2c9(0xd3)];console[_0x1bb2c9(0x11a)]('\x20\x20'+_0x34e9ce),console[_0x1bb2c9(0x11a)]('\x20\x20'+a23_0x27ece7[_0x1bb2c9(0x1a0)](_0x1bb2c9(0x159))),this['displayColumns'](_0xeeb780[_0x1bb2c9(0x1f8)]),!_0xeeb780[_0x1bb2c9(0xfb)]&&console[_0x1bb2c9(0x11a)]('\x20\x20'+a23_0x27ece7[_0x1bb2c9(0xe9)](_0x1bb2c9(0x17d))+'\x20'+_0xeeb780[_0x1bb2c9(0x18d)]);}}[a23_0xaf433d(0x166)](_0x51af09){const _0x45e6e6=a23_0xaf433d;for(const _0x34d8da of _0x51af09){_0x34d8da[_0x45e6e6(0x1d3)]===_0x34d8da['column']||_0x34d8da[_0x45e6e6(0x150)]==='*'?console['error'](_0x45e6e6(0x13b)+_0x34d8da[_0x45e6e6(0x1d3)]):console[_0x45e6e6(0x11a)]('\x20\x20\x20\x20-\x20'+_0x34d8da[_0x45e6e6(0x1d3)]+'\x20'+a23_0x27ece7[_0x45e6e6(0x1a0)]('('+_0x34d8da['column']+')'));}}[a23_0xaf433d(0x1cb)](_0x189bc7){const _0x5c0991=a23_0xaf433d;console['error']('─'[_0x5c0991(0x1a1)](0x3c));if(_0x189bc7[_0x5c0991(0x179)][_0x5c0991(0x1e2)]>0x0){console['error']('\x0a'+a23_0x27ece7[_0x5c0991(0xe9)]('Errors:'));for(const _0x29765f of _0x189bc7[_0x5c0991(0x179)]){console[_0x5c0991(0x11a)]('\x20\x20'+a23_0x27ece7[_0x5c0991(0xe9)]('•')+'\x20'+_0x29765f);}}_0x189bc7[_0x5c0991(0x160)]&&console[_0x5c0991(0x11a)]('\x0a'+a23_0x27ece7[_0x5c0991(0x16d)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a23_0xaf433d(0x135);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x1b9);async[a23_0xaf433d(0x109)](_0x33d640){const _0x4c2111=a23_0xaf433d,{options:_0x6f9e8,args:_0x238db7,tdx:_0x31b063}=_0x33d640,_0x716d6d=_0x6f9e8,_0x3ca4ac=_0x238db7[0x0]||_0x6f9e8[_0x4c2111(0x1d2)];if(!_0x3ca4ac)return showParentSegmentNotSetError(_0x4c2111(0x142)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x4c2111(0x194)+_0x4c2111(0x1dd)+_0x4c2111(0xd4)+_0x4c2111(0x11b)+_0x4c2111(0x19c)+_0x4c2111(0x1be)),0x1;if(!_0x716d6d[_0x4c2111(0x1d6)]&&!_0x716d6d[_0x4c2111(0x13c)]&&!_0x716d6d[_0x4c2111(0xda)]&&!_0x716d6d[_0x4c2111(0x175)])return console[_0x4c2111(0x11a)](a23_0x27ece7[_0x4c2111(0xe9)](_0x4c2111(0x11d))),console[_0x4c2111(0x11a)](_0x4c2111(0x189)),console[_0x4c2111(0x11a)]('Options:'),console[_0x4c2111(0x11a)](_0x4c2111(0x187)),console[_0x4c2111(0x11a)](_0x4c2111(0x1b7)),console[_0x4c2111(0x11a)](_0x4c2111(0x1bc)),console[_0x4c2111(0x11a)](_0x4c2111(0x112)),0x1;const _0x18fe93=resolveYamlFile(_0x3ca4ac);if(!existsSync(_0x18fe93))return showFileNotFoundError(_0x18fe93,_0x3ca4ac),0x1;_0x716d6d[_0x4c2111(0x1bf)]&&(console['error'](_0x4c2111(0x1c9)+_0x716d6d['site']),console[_0x4c2111(0x11a)](_0x4c2111(0x1cc)+_0x18fe93));let _0x4b7cc9;try{_0x4b7cc9=readFileSync(_0x18fe93,_0x4c2111(0x12f));}catch(_0x2927fa){const _0x549e38=_0x2927fa instanceof Error?_0x2927fa[_0x4c2111(0x1c7)]:String(_0x2927fa);return console[_0x4c2111(0x11a)](_0x4c2111(0x184)+_0x549e38),0x1;}let _0x27b994;try{_0x27b994=parseDef(_0x4b7cc9);}catch(_0x5c8ac6){const _0x514f0a=_0x5c8ac6 instanceof Error?_0x5c8ac6[_0x4c2111(0x1c7)]:String(_0x5c8ac6);return console[_0x4c2111(0x11a)](a23_0x27ece7[_0x4c2111(0xe9)](_0x4c2111(0x153)+_0x514f0a)),0x1;}if(_0x716d6d['attribute']===!![]||_0x716d6d[_0x4c2111(0x13c)]===''){const _0x4f6202=_0x27b994['attributes']?.[_0x4c2111(0x176)](_0x465ac1=>_0x465ac1[_0x4c2111(0x107)])||[];if(_0x4f6202[_0x4c2111(0x1e2)]===0x0)console[_0x4c2111(0x11a)](a23_0x27ece7[_0x4c2111(0xe9)](_0x4c2111(0xf0)));else{console[_0x4c2111(0x11a)](a23_0x27ece7[_0x4c2111(0xe9)](_0x4c2111(0x111))),console[_0x4c2111(0x11a)](_0x4c2111(0x1da));for(const _0x2d29a6 of _0x4f6202){console[_0x4c2111(0x11a)]('\x20\x20'+a23_0x27ece7[_0x4c2111(0x103)](_0x2d29a6));}console[_0x4c2111(0x11a)](_0x4c2111(0x196)+_0x3ca4ac+_0x4c2111(0x119)+_0x4f6202[0x0]+'\x22');}return 0x1;}if(_0x716d6d[_0x4c2111(0xda)]===!![]||_0x716d6d[_0x4c2111(0xda)]===''){const _0x40297d=_0x27b994[_0x4c2111(0x1d1)]?.['map'](_0x1d5a13=>_0x1d5a13['name'])||[];if(_0x40297d['length']===0x0)console[_0x4c2111(0x11a)](a23_0x27ece7[_0x4c2111(0xe9)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x4c2111(0x11a)](a23_0x27ece7[_0x4c2111(0xe9)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x4c2111(0x11a)](_0x4c2111(0xee));for(const _0x2dff05 of _0x40297d){console[_0x4c2111(0x11a)]('\x20\x20'+a23_0x27ece7[_0x4c2111(0x103)](_0x2dff05));}console['error'](_0x4c2111(0x196)+_0x3ca4ac+'\x20--behavior\x20\x22'+_0x40297d[0x0]+'\x22');}return 0x1;}const _0x4f9677=createCommandSpinner(a23_0x27ece7[_0x4c2111(0x1a0)](_0x4c2111(0xe6)),{'verbose':_0x716d6d[_0x4c2111(0x1bf)]});_0x4f9677['start']();const _0x18b999={'onProgress':_0x190377=>{_0x4f9677['text']=formatProgressMessage(_0x190377);}};if(_0x716d6d[_0x4c2111(0x1d6)])_0x18b999['master']=!![];if(_0x716d6d[_0x4c2111(0x13c)]&&typeof _0x716d6d[_0x4c2111(0x13c)]==='string')_0x18b999[_0x4c2111(0x13c)]=_0x716d6d[_0x4c2111(0x13c)];if(_0x716d6d[_0x4c2111(0xda)]&&typeof _0x716d6d[_0x4c2111(0xda)]===_0x4c2111(0x124))_0x18b999[_0x4c2111(0xda)]=_0x716d6d['behavior'];if(_0x716d6d['enriched'])_0x18b999['enriched']=!![];if(_0x716d6d[_0x4c2111(0x113)])_0x18b999['interval']=_0x716d6d[_0x4c2111(0x113)];let _0x2d3611;try{_0x2d3611=await _0x31b063[_0x4c2111(0x1e7)][_0x4c2111(0x193)](_0x4b7cc9,_0x18b999),_0x4f9677['stop']();}catch(_0x3db7bc){_0x4f9677[_0x4c2111(0x116)]();throw _0x3db7bc;}return await this[_0x4c2111(0x10c)](_0x2d3611,{'master':_0x716d6d[_0x4c2111(0x1d6)],'attribute':typeof _0x716d6d[_0x4c2111(0x13c)]===_0x4c2111(0x124)?_0x716d6d[_0x4c2111(0x13c)]:undefined,'behavior':typeof _0x716d6d[_0x4c2111(0xda)]===_0x4c2111(0x124)?_0x716d6d['behavior']:undefined,'enriched':_0x716d6d[_0x4c2111(0x175)]}),_0x2d3611[_0x4c2111(0x160)]?0x0:0x1;}async[a23_0xaf433d(0x10c)](_0x5f2902,_0x55500c){const _0x515da7=a23_0xaf433d;console[_0x515da7(0x11a)]('\x0a'+a23_0x27ece7[_0x515da7(0x1b6)](_0x515da7(0x171))+'\x20'+_0x5f2902[_0x515da7(0x107)]),console[_0x515da7(0x11a)]('═'[_0x515da7(0x1a1)](0x3c));if(_0x55500c[_0x515da7(0x1d6)]&&_0x5f2902[_0x515da7(0x191)]){const _0x463b15=a23_0x27ece7[_0x515da7(0x1a0)](_0x515da7(0x1c0))+'\x20'+a23_0x27ece7['bold'](_0x5f2902['master'][_0x515da7(0x1f4)]+'.'+_0x5f2902['master'][_0x515da7(0x137)]);await this[_0x515da7(0xe0)](_0x463b15,_0x5f2902[_0x515da7(0x191)]);}else{if(_0x55500c[_0x515da7(0x13c)]&&_0x5f2902[_0x515da7(0x191)]){const _0x9a29f=a23_0x27ece7[_0x515da7(0x1a0)](_0x515da7(0x1d8))+'\x20'+a23_0x27ece7[_0x515da7(0x1b6)](_0x55500c['attribute']);await this[_0x515da7(0xe0)](_0x9a29f,_0x5f2902[_0x515da7(0x191)]);}else{if(_0x55500c[_0x515da7(0xda)]&&_0x5f2902[_0x515da7(0x191)]){const _0x1052db=a23_0x27ece7[_0x515da7(0x1a0)]('Behavior:')+'\x20'+a23_0x27ece7[_0x515da7(0x1b6)](_0x55500c['behavior']);await this[_0x515da7(0xe0)](_0x1052db,_0x5f2902['sampleData']);}else{if(_0x55500c[_0x515da7(0x175)]&&_0x5f2902[_0x515da7(0x191)]){const _0x5e2323=a23_0x27ece7['dim']('Enriched:')+'\x20'+a23_0x27ece7[_0x515da7(0x1b6)]('Master\x20+\x20Attributes');await this[_0x515da7(0xe0)](_0x5e2323,_0x5f2902[_0x515da7(0x191)]);}else!_0x5f2902['sampleData']&&console[_0x515da7(0x11a)](_0x515da7(0x163));}}}if(_0x5f2902['errors'][_0x515da7(0x1e2)]>0x0){console[_0x515da7(0x11a)]('─'['repeat'](0x3c)),console['error']('\x0a'+a23_0x27ece7[_0x515da7(0xe9)](_0x515da7(0x12c)));for(const _0x13ee20 of _0x5f2902[_0x515da7(0x179)]){console[_0x515da7(0x11a)]('\x20\x20'+a23_0x27ece7[_0x515da7(0xe9)]('•')+'\x20'+_0x13ee20);}}}async[a23_0xaf433d(0xe0)](_0x291a50,_0x3c42de){const _0x431bac=a23_0xaf433d;if(_0x3c42de['length']===0x0){console['error']('\x0a'+_0x291a50),console[_0x431bac(0x11a)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x431bac(0x11a)]('\x0a'+_0x291a50);const _0x2190ab=Object['keys'](_0x3c42de[0x0])['map'](_0x5df2f9=>({'name':_0x5df2f9,'type':typeof _0x3c42de[0x0][_0x5df2f9]===_0x431bac(0x110)?_0x431bac(0x13a):_0x431bac(0xd0)})),_0x3e409d={'queryId':'preview','columns':_0x2190ab,'data':_0x3c42de,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3c42de[_0x431bac(0x1e2)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4af5d7=formatAsTable(_0x3e409d,_0x3c42de[_0x431bac(0x1e2)],!![]);await writeOutput(_0x4af5d7,undefined,_0x431bac(0x137));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0x15f);['description']=a23_0xaf433d(0x1b0);async[a23_0xaf433d(0x109)](_0x4696b2){const _0x44ba98=a23_0xaf433d,{options:_0xc0df00,args:_0x27e6de,tdx:_0x3cf8e0}=_0x4696b2,_0x53a898=_0xc0df00,_0x1863eb=_0x27e6de[0x0]||_0xc0df00[_0x44ba98(0x1d2)];if(!_0x1863eb)return showParentSegmentNotSetError(_0x44ba98(0x129)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x181b7f=resolveYamlFile(_0x1863eb);if(existsSync(_0x181b7f)){_0x53a898[_0x44ba98(0x1bf)]&&console[_0x44ba98(0x11a)](_0x44ba98(0x11e)+_0x181b7f);let _0x4b9856;try{_0x4b9856=readFileSync(_0x181b7f,_0x44ba98(0x12f));}catch(_0x418f4d){const _0xc9eaf6=_0x418f4d instanceof Error?_0x418f4d[_0x44ba98(0x1c7)]:String(_0x418f4d);return console['error'](_0x44ba98(0x184)+_0xc9eaf6),0x1;}const _0x16024d=await withSpinner(_0x44ba98(0x14c),()=>_0x3cf8e0['segment'][_0x44ba98(0x1d4)](_0x4b9856),{'verbose':_0x53a898[_0x44ba98(0x1bf)]}),_0x2043da=_0x16024d[_0x44ba98(0x1f3)],{isNew:_0x2322ca,name:_0x435852,hasChanges:_0x30778c,diffFormatted:_0x56833e}=_0x2043da;if(_0x30778c){_0x2322ca?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x435852+'\x27:'):console['error'](_0x44ba98(0x1a9)+_0x435852+'\x27:');console[_0x44ba98(0x11a)]('─'[_0x44ba98(0x1a1)](0x3c)),console[_0x44ba98(0x11a)](_0x56833e),console[_0x44ba98(0x11a)]('─'[_0x44ba98(0x1a1)](0x3c));const _0x3ee9d0=_0x2322ca?_0x44ba98(0x104)+_0x435852+_0x44ba98(0x1ae):_0x44ba98(0x199)+_0x435852+_0x44ba98(0x1ae);if(!_0x53a898[_0x44ba98(0x1af)]){const _0x37143c=await confirmKey(_0x3ee9d0);if(!_0x37143c)return console['error'](_0x44ba98(0x1cd)),0x1;}const _0x28cb1d=_0x2322ca?_0x44ba98(0xf1):_0x44ba98(0xf6);await withSpinner(_0x28cb1d+_0x44ba98(0x152)+_0x435852+_0x44ba98(0x148),()=>_0x2043da[_0x44ba98(0x1c2)](),{'verbose':_0x53a898[_0x44ba98(0x1bf)]});const _0x30cd11=_0x2322ca?_0x44ba98(0xcf):_0x44ba98(0x177);console[_0x44ba98(0x11a)]('✔\x20'+_0x30cd11+_0x44ba98(0x152)+_0x435852+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x435852+_0x44ba98(0x12d));}const _0x318ab8=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x1863eb+_0x44ba98(0x148),()=>_0x3cf8e0[_0x44ba98(0x1e7)][_0x44ba98(0x158)](_0x1863eb),{'verbose':_0x53a898[_0x44ba98(0x1bf)]}),_0x208ce1=_0x318ab8[_0x44ba98(0x1f3)],_0x5a5b69=getConsoleUrl(_0x53a898[_0x44ba98(0x12e)],'/app/workflows/'+_0x208ce1['workflowId']+_0x44ba98(0x11f)+_0x208ce1[_0x44ba98(0x1d0)]+_0x44ba98(0x192)+_0x208ce1[_0x44ba98(0x1a2)]);return console['error'](_0x44ba98(0xe4)),console['error']('\x20\x20'+a23_0x27ece7['dim'](_0x44ba98(0xd2))+'\x20'+_0x208ce1[_0x44ba98(0x14e)]),console['error']('\x20\x20'+a23_0x27ece7['dim']('Status:')+'\x20'+_0x208ce1[_0x44ba98(0x15c)]),console[_0x44ba98(0x11a)]('\x20\x20'+a23_0x27ece7[_0x44ba98(0x1a0)]('Session:')+'\x20'+_0x208ce1[_0x44ba98(0x1d0)]),console[_0x44ba98(0x11a)]('\x20\x20'+a23_0x27ece7[_0x44ba98(0x1a0)]('Attempt:')+'\x20'+_0x208ce1['workflowAttemptId']),console[_0x44ba98(0x11a)]('\x20\x20'+_0x5a5b69),console[_0x44ba98(0x11a)]('\x0a'+a23_0x27ece7[_0x44ba98(0x1a0)]('To\x20cancel:')+_0x44ba98(0xec)+_0x208ce1[_0x44ba98(0x1a2)]+_0x44ba98(0x145)),0x0;}}function a23_0x1ece(){const _0x29917b=['\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','length','\x27\x20with\x20ID:\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','8562760Bgksza','log','segment','customerPercent','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20Context\x20set:\x20','Validate:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Creating\x20parent\x20segment\x20\x27','dirname','displayBehaviorsStats','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','displayPreviewHints','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','data','database','totalEvents','listFields','Updating\x20parent\x20segment\x20\x27','columns','\x20--behavior\x20\x22<name>\x22','\x20rows\x20','Created','varchar','\x20=\x20','Audience\x20ID:','foreignKey','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','segment:parent:fields','unref','segment:parent:desc','timezone','format','behavior','toFixed','Parent\x20segment:\x20','.yml','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','displaySampleData','segment:parent:view','joinKey','toLocaleString','\x0a✔\x20Workflow\x20started','open','Fetching\x20sample\x20data...','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','red','3270869vsbXil','Name:\x20','\x20tdx\x20wf\x20attempt\x20','stats','Available\x20behaviors:','Join:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Creating','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Options:\x0a','scheduleType','query','Updating','Customers:','updateParent','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','SELECT\x20*\x20FROM\x20(\x0a','schemaValid','/\x20→\x20','.yaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','6GCovzj','Listing\x20parent\x20segments\x20matching\x20\x27','test','customersWithEvents','cyan','Create\x20parent\x20segment\x20\x27','Attributes','displayAttributesStats','name','addAttributesFile','execute','Executing\x20parent\x20segment\x20query...','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displayPreviewResults','✔\x20Updated\x20parent\x20segment\x20\x27','customerGroup','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','number','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','interval','Behaviors','/\x20directory.\x0a','stop','✔\x20Renamed\x20directory\x20to\x20','Validating\x20configuration...','\x20--attribute\x20\x22','error','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Found\x20YAML\x20file:\x20','/sessions/','addBehaviors','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','attributes','join','string','segment:parent:show','Master\x20Table','displayMasterInfo','in\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20--enriched','\x0aChanges\x20to\x20\x27','Errors:','\x27\x20is\x20up\x20to\x20date','site','utf-8','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','👥\x20','tdx\x20segment\x20parent\x20preview\x20','Table:\x20','scheduleOption','segment:parent:preview','\x20--behavior\x20\x22','table','population','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','double','\x20\x20\x20\x20-\x20','attribute','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','rowCount','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','List\x20available\x20fields\x20for\x20segmentation','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','segment:parent:update','yellow','\x20kill','segment:parent:validate','darwin','\x27...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','win32','segment:parent:pull','Analyzing\x20changes...','✘\x20Failed\x20to\x20rename\x20directory:\x20','audienceId','Show\x20parent\x20segment\x20schema\x20(column\x20types)','column','segment:parent:push','\x20parent\x20segment\x20\x27','Error\x20parsing\x20YAML:\x20','replace','listParents','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','/\x20directories\x20exist.','runParent','Columns:','Get\x20SQL\x20query\x20for\x20parent\x20segment','use','status','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','1913944aGJVQJ','segment:parent:run','allValid','output','\x20is\x20already\x20up\x20to\x20date','\x0aNo\x20sample\x20data\x20available','pullParentYaml','start','displayColumns','matchedCount','7662Fcauhe','sort','addBehaviorsFile','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','getParentSQL','green','No\x20parent\x20segments\x20match\x20pattern:\x20','\x0a⚠️\x20\x20Both\x20','\x20rows)','Preview:','\x5c$&','Output\x20file:\x20','-1d','enriched','map','Updated','getParentFull','errors','18bIaFJz','22355nHwHRQ','information_schema','Error:','segment:parent:list','parent_segments','attributesFile','✔\x20Found\x20','using\x20the\x20default\x20path:\x20','Error:\x20File\x20not\x20found:\x20','Error\x20reading\x20file:\x20','endsWith','json','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','SQL\x20query:\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Listing\x20fields\x20for\x20\x27','Overwrite\x20\x27','schemaError','trim','/app/dw/parentSegments/','Fetching\x20SQL\x20for\x20\x27','sampleData','/attempt/','previewParentYaml','Options\x20(one\x20required):\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20field','13402906bcUQde','Apply\x20changes\x20to\x20\x27','resolveParentId','validateParentYaml','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','/\x20and\x20','elapsedTimeMillis','coveragePercent','dim','repeat','workflowAttemptId','displayValidateResults','description','\x0a⚠️\x20\x20Migrating:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','run','all','\x0aChanges\x20to\x20apply\x20to\x20\x27','segment:parent:create','setJobId','\x20No\x20changes\x20-\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x27\x20and\x20run\x20workflow?','yes','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','jsonl','\x20--interval\x20','Join\x20on:','`\x20to\x20download\x20the\x20configuration\x20first','Fetching\x20parent\x20segment\x20\x27','bold','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','behaviorsFile','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','2593254xjpsdT','localeCompare','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','204xeACaL','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','verbose','Master:','Coverage:','apply','Source:','addAttributes','✔\x20Created\x20parent\x20segment\x20\x27','48JTFnua','message','Error:\x20--database\x20and\x20--table\x20are\x20required','Site:\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','displaySummary','YAML\x20file:\x20','Aborted.','parent_segment','\x20[Job\x20ID:\x20','workflowSessionId','behaviors','parentSegment','label','pushParentYaml','✔\x20No\x20changes\x20-\x20\x27','master','session','Attribute:','platform','Available\x20attributes:','segment:parent:sql','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Resolving\x20parent\x20segment\x20\x27','jobId','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'];a23_0x1ece=function(){return _0x29917b;};return a23_0x1ece();}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0xd5);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x140);async[a23_0xaf433d(0x109)](_0x4aa764){const _0x49ad16=a23_0xaf433d,{options:_0x1f4658,args:_0x3081bd,tdx:_0x367867}=_0x4aa764,_0x4f181a=_0x3081bd[0x0]||_0x1f4658['parentSegment'];if(!_0x4f181a)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x1f4658[_0x49ad16(0x1bf)]&&(console[_0x49ad16(0x11a)](_0x49ad16(0x1c9)+_0x1f4658['site']),console[_0x49ad16(0x11a)]('Parent\x20segment:\x20'+_0x4f181a));const _0x5ccb29=await withSpinner(_0x49ad16(0x18b)+_0x4f181a+_0x49ad16(0x148),()=>_0x367867[_0x49ad16(0x1e7)][_0x49ad16(0x1f6)](_0x4f181a),{'verbose':_0x1f4658[_0x49ad16(0x1bf)]}),_0x110d77=_0x5ccb29[_0x49ad16(0x1f3)];console[_0x49ad16(0x11a)](_0x49ad16(0x181)+_0x110d77[_0x49ad16(0x1e2)]+_0x49ad16(0x197)+(_0x110d77['length']!==0x1?'s':''));if(_0x1f4658[_0x49ad16(0x186)]||_0x1f4658[_0x49ad16(0x1b1)])return await handleSDKOutput(_0x110d77,_0x1f4658),0x0;return displayFieldsHumanReadable(_0x110d77,_0x4f181a),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0xaf433d(0x107)]=a23_0xaf433d(0xe1);[a23_0xaf433d(0x1a4)]='Show\x20parent\x20segment\x20details';async[a23_0xaf433d(0x109)](_0x39ec92){const _0x44e409=a23_0xaf433d,{options:_0x5d9ac9,args:_0x208168,tdx:_0x1615f6}=_0x39ec92,_0x3305dd=_0x5d9ac9,_0x188c3f=_0x208168[0x0]||_0x5d9ac9[_0x44e409(0x1d2)];if(!_0x188c3f)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x44e409(0xf3)+_0x44e409(0x1e9)),0x1;_0x5d9ac9['verbose']&&(console['error'](_0x44e409(0x1c9)+_0x5d9ac9['site']),console[_0x44e409(0x11a)](_0x44e409(0xdc)+_0x188c3f));const _0x41ec8b=await withSpinner(_0x44e409(0x1b5)+_0x188c3f+'\x27...',()=>_0x1615f6[_0x44e409(0x1e7)][_0x44e409(0x178)](_0x188c3f),{'verbose':_0x5d9ac9[_0x44e409(0x1bf)]}),_0x5645ea=_0x41ec8b[_0x44e409(0x1f3)];if(_0x3305dd['web']){const _0x342013=getConsoleNextUrl(_0x3305dd[_0x44e409(0x12e)],'/app/dw/parentSegments/'+_0x5645ea['id']);return console[_0x44e409(0x11a)](a23_0x27ece7[_0x44e409(0x16d)]('✔')+'\x20Opening\x20'+a23_0x27ece7[_0x44e409(0x103)](_0x342013)),openBrowser(_0x342013),0x0;}return await handleSingleObjectOutput(_0x5645ea,_0x5d9ac9),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a23_0xaf433d(0xd7);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x14f);async['execute'](_0x2c44cf){const _0x286236=a23_0xaf433d,{options:_0x25c66a,args:_0x17d11c,tdx:_0x5a016f}=_0x2c44cf,_0x32c347=_0x17d11c[0x0]||_0x25c66a[_0x286236(0x1d2)];if(!_0x32c347)return showParentSegmentNotSetError(_0x286236(0x1a6)+_0x286236(0x1e1)),0x1;_0x25c66a['verbose']&&(console[_0x286236(0x11a)]('Site:\x20'+_0x25c66a[_0x286236(0x12e)]),console[_0x286236(0x11a)](_0x286236(0xdc)+_0x32c347));const _0x4dbca4=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x32c347+_0x286236(0x148),()=>_0x5a016f[_0x286236(0x1e7)][_0x286236(0x19a)](_0x32c347),{'verbose':_0x25c66a[_0x286236(0x1bf)]}),_0xd6e980=_0x4dbca4[_0x286236(0x1f3)],_0x552257=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x32c347+_0x286236(0x148),()=>_0x5a016f[_0x286236(0x1e7)]['getParentSQL'](_0xd6e980),{'verbose':_0x25c66a[_0x286236(0x1bf)]}),_0x48cde0=await executeSchemaQuery(_0x552257['data'],_0x5a016f,_0x25c66a);return await handleQueryOutput(_0x48cde0,_0x25c66a),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a23_0xaf433d(0x1db);[a23_0xaf433d(0x1a4)]=a23_0xaf433d(0x15a);async[a23_0xaf433d(0x109)](_0x491da2){const _0x564322=a23_0xaf433d,{options:_0x4cc657,args:_0x568ab4,tdx:_0xe3773b}=_0x491da2,_0x2028e9=_0x568ab4[0x0]||_0x4cc657[_0x564322(0x1d2)];if(!_0x2028e9)return showParentSegmentNotSetError(_0x564322(0x11c)+_0x564322(0xfe)),0x1;_0x4cc657[_0x564322(0x1bf)]&&(console[_0x564322(0x11a)](_0x564322(0x1c9)+_0x4cc657[_0x564322(0x12e)]),console[_0x564322(0x11a)](_0x564322(0xdc)+_0x2028e9));const _0x36c76a=await withSpinner(_0x564322(0x1de)+_0x2028e9+_0x564322(0x148),()=>_0xe3773b['segment']['resolveParentId'](_0x2028e9),{'verbose':_0x4cc657[_0x564322(0x1bf)]}),_0x5e3b53=_0x36c76a[_0x564322(0x1f3)],_0x46f384=await withSpinner(_0x564322(0x190)+_0x2028e9+'\x27...',()=>_0xe3773b[_0x564322(0x1e7)][_0x564322(0x16c)](_0x5e3b53),{'verbose':_0x4cc657[_0x564322(0x1bf)]}),_0x15fd68=_0x46f384[_0x564322(0x1f3)];return _0x4cc657['format']===_0x564322(0x186)||_0x4cc657[_0x564322(0xd9)]===_0x564322(0x1b1)?await handleSDKOutput([{'sql':_0x15fd68}],_0x4cc657):console[_0x564322(0x1e6)](_0x15fd68),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a23_0xaf433d(0x125);[a23_0xaf433d(0x1a4)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a23_0xaf433d(0x109)](_0x5ded5d){const _0x1bf998=a23_0xaf433d,{options:_0x1e4347,args:_0x107a84,tdx:_0x433e7c}=_0x5ded5d,_0xbbed2=_0x107a84[0x0]||_0x1e4347['parentSegment'];if(!_0xbbed2)return showParentSegmentNotSetError(_0x1bf998(0x16b)+_0x1bf998(0x149)),0x1;_0x1e4347['verbose']&&(console[_0x1bf998(0x11a)]('Site:\x20'+_0x1e4347['site']),console['error'](_0x1bf998(0xdc)+_0xbbed2));const _0x3851ae=await withSpinner(_0x1bf998(0x1de)+_0xbbed2+_0x1bf998(0x148),()=>_0x433e7c[_0x1bf998(0x1e7)][_0x1bf998(0x19a)](_0xbbed2),{'verbose':_0x1e4347['verbose']}),_0x5c8768=_0x3851ae[_0x1bf998(0x1f3)],_0x12a44a=await withSpinner(_0x1bf998(0x190)+_0xbbed2+'\x27...',()=>_0x433e7c[_0x1bf998(0x1e7)][_0x1bf998(0x16c)](_0x5c8768),{'verbose':_0x1e4347[_0x1bf998(0x1bf)]});let _0x55419e=_0x12a44a['data'];const _0x1f1c03=resolveLimit(_0x1e4347['limit'],DEFAULT_DISPLAY_LIMIT),_0x3fc3eb=/\bLIMIT\s+\d+/i[_0x1bf998(0x101)](_0x55419e);!_0x3fc3eb&&(_0x55419e=_0x55419e[_0x1bf998(0x18e)]()[_0x1bf998(0x154)](/;+$/,''),_0x55419e=_0x1bf998(0xfa)+_0x55419e+_0x1bf998(0x13f)+_0x1f1c03);_0x1e4347[_0x1bf998(0x1bf)]&&console['error'](_0x1bf998(0x188)+_0x55419e);const _0x3c448b=await withProgressSpinner(_0x1bf998(0x10a),async _0x1ef7ca=>{const _0xa37687=_0x1bf998,_0x4adf98=await _0x433e7c[_0xa37687(0xf5)][_0xa37687(0x109)](_0x55419e,{'catalog':'td','schema':_0xa37687(0x17c),'onJobId':_0x315b31=>{const _0x25cbe8=_0xa37687;_0x1ef7ca[_0x25cbe8(0x1ab)](_0x315b31);}});return _0x4adf98;},{'verbose':_0x1e4347[_0x1bf998(0x1bf)]}),_0x2ffcf3=_0x3c448b['data'],_0x18f869=_0x2ffcf3['jobId']?_0x1bf998(0x1cf)+_0x2ffcf3[_0x1bf998(0x1df)]+']':'';return console[_0x1bf998(0x11a)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x2ffcf3[_0x1bf998(0xed)]['processedRows'][_0x1bf998(0xe3)]()+_0x1bf998(0xce)+(_0x1bf998(0x128)+formatElapsed(_0x2ffcf3['stats'][_0x1bf998(0x19e)])+_0x18f869)),await handleQueryOutput(_0x2ffcf3,_0x1e4347),0x0;}}
1
+ const a23_0x10be0a=a23_0x5a71;(function(_0x4583af,_0xd6454f){const _0x483526=a23_0x5a71,_0x2f25de=_0x4583af();while(!![]){try{const _0x33cfd9=parseInt(_0x483526(0x133))/0x1*(parseInt(_0x483526(0x1f8))/0x2)+-parseInt(_0x483526(0x137))/0x3+parseInt(_0x483526(0x21c))/0x4+parseInt(_0x483526(0x1e5))/0x5+parseInt(_0x483526(0x233))/0x6+-parseInt(_0x483526(0x141))/0x7*(-parseInt(_0x483526(0x1be))/0x8)+-parseInt(_0x483526(0x1d0))/0x9;if(_0x33cfd9===_0xd6454f)break;else _0x2f25de['push'](_0x2f25de['shift']());}catch(_0x4f6f03){_0x2f25de['push'](_0x2f25de['shift']());}}}(a23_0x4d6f,0xed3f4));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x4c65ce 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';function a23_0x5a71(_0xcccca1,_0x15d271){_0xcccca1=_0xcccca1-0x124;const _0x4d6f6b=a23_0x4d6f();let _0x5a7195=_0x4d6f6b[_0xcccca1];return _0x5a7195;}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_0x59aa95 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_0x10be0a(0x147),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x36a7e3){const _0x569526=a23_0x10be0a,_0x4eb0bc=process[_0x569526(0x203)],_0x4d2f69=_0x4eb0bc==='darwin'?_0x569526(0x173):_0x4eb0bc===_0x569526(0x23c)?_0x569526(0x1b4):_0x569526(0x186);spawn(_0x4d2f69,[_0x36a7e3],{'detached':!![],'stdio':_0x569526(0x1ff)})[_0x569526(0x164)]();}function migrateLegacyDirectory(){const _0x5af79d=a23_0x10be0a;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x19c331=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x19c331[_0x5af79d(0x1ce)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5af79d(0x214)](a23_0x59aa95['yellow'](_0x5af79d(0x1f2)+LEGACY_PARENT_SEGMENT_DIR+_0x5af79d(0x1cc)+PARENT_SEGMENT_DIR+_0x5af79d(0x228))),console[_0x5af79d(0x214)](a23_0x59aa95['dim']('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5af79d(0x12b))),![];console[_0x5af79d(0x214)](a23_0x59aa95[_0x5af79d(0x215)](_0x5af79d(0x247)+LEGACY_PARENT_SEGMENT_DIR+_0x5af79d(0x1a4)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5af79d(0x214)](a23_0x59aa95[_0x5af79d(0x143)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x438abc){const _0x20bad3=_0x438abc instanceof Error?_0x438abc[_0x5af79d(0x191)]:String(_0x438abc);return console[_0x5af79d(0x214)](a23_0x59aa95[_0x5af79d(0x1e0)](_0x5af79d(0x232)+_0x20bad3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x57f2be){const _0x51d13f=a23_0x10be0a;return migrateLegacyDirectory(),super[_0x51d13f(0x12a)](_0x57f2be);}}function resolveYamlFile(_0x5c878b){const _0x2c696e=a23_0x10be0a;if(_0x5c878b[_0x2c696e(0x1d7)](_0x2c696e(0x1ef))||_0x5c878b[_0x2c696e(0x1d7)](_0x2c696e(0x239)))return _0x5c878b;return a23_0x4c65ce[_0x2c696e(0x14c)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5c878b)+_0x2c696e(0x1ef));}function formatProgressMessage(_0x200be2){const _0x457457=a23_0x10be0a,_0x28a4d6=_0x200be2[_0x457457(0x20f)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x28a4d6){const [,_0x3ee626,_0x149453,_0x579c4e='']=_0x28a4d6;return a23_0x59aa95[_0x457457(0x248)](_0x3ee626+':')+'\x20'+_0x149453+a23_0x59aa95[_0x457457(0x248)](_0x579c4e);}return a23_0x59aa95[_0x457457(0x248)](_0x200be2);}function showFileNotFoundError(_0x21aafd,_0x4529d0){const _0x2aee74=a23_0x10be0a;console[_0x2aee74(0x214)](a23_0x59aa95[_0x2aee74(0x1e0)](_0x2aee74(0x1cb)+_0x21aafd+'\x0a')),console[_0x2aee74(0x214)](a23_0x59aa95[_0x2aee74(0x23b)](_0x2aee74(0x1b3)+_0x4529d0+_0x2aee74(0x158)));}function showParentSegmentNotSetError(_0x171cca){const _0x57779a=a23_0x10be0a;console[_0x57779a(0x214)](a23_0x59aa95[_0x57779a(0x215)](_0x57779a(0x1c5))),console[_0x57779a(0x214)](_0x171cca);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x18d);[a23_0x10be0a(0x157)]=a23_0x10be0a(0x1c1);async[a23_0x10be0a(0x20d)](_0x2fe0ae){const _0x3394c8=a23_0x10be0a,{options:_0x2a475b,args:_0x563c38,tdx:_0x3c9f72}=_0x2fe0ae,_0x1a7b4f=_0x563c38[0x0];_0x2a475b[_0x3394c8(0x229)]&&(console[_0x3394c8(0x214)](_0x3394c8(0x23a)+_0x2a475b['site']),_0x1a7b4f&&console['error'](_0x3394c8(0x17b)+_0x1a7b4f));const _0x7971d2=await withSpinner(_0x1a7b4f?_0x3394c8(0x1f1)+_0x1a7b4f+_0x3394c8(0x17c):_0x3394c8(0x18e),()=>_0x3c9f72['segment']['listParents'](),{'verbose':_0x2a475b['verbose']});let _0x52e65c=_0x7971d2['data'];if(_0x1a7b4f){const _0x12d074=_0x1a7b4f[_0x3394c8(0x210)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x3394c8(0x210)](/\*/g,'.*')[_0x3394c8(0x210)](/\?/g,'.'),_0x312580=new RegExp('^'+_0x12d074+'$','i');_0x52e65c=_0x52e65c[_0x3394c8(0x15f)](_0x5be0b3=>_0x312580['test'](_0x5be0b3[_0x3394c8(0x15e)]['name']));}_0x52e65c[_0x3394c8(0x231)]((_0x5ca4b4,_0x469bf3)=>_0x5ca4b4['attributes'][_0x3394c8(0x1a9)][_0x3394c8(0x134)](_0x469bf3['attributes'][_0x3394c8(0x1a9)])),console[_0x3394c8(0x214)](_0x3394c8(0x222)+_0x52e65c['length']+_0x3394c8(0x23e)+(_0x52e65c['length']!==0x1?'s':''));const _0x5ec8db=_0x2e000d=>{const _0x582205=_0x3394c8;return getConsoleNextUrl(_0x2a475b['site'],_0x582205(0x22e)+_0x2e000d);};if(_0x2a475b[_0x3394c8(0x1c0)]==='json'||_0x2a475b[_0x3394c8(0x1c0)]===_0x3394c8(0x1b2)){const _0x2815c7=_0x52e65c[_0x3394c8(0x124)](_0x15d50c=>({..._0x15d50c,'url':_0x5ec8db(_0x15d50c['id'])}));await handleSDKOutput(_0x2815c7,_0x2a475b);}else{if(_0x52e65c[_0x3394c8(0x1d2)]===0x0)_0x1a7b4f?console[_0x3394c8(0x19e)](_0x3394c8(0x16e)+_0x1a7b4f):console[_0x3394c8(0x19e)]('No\x20parent\x20segments\x20found');else for(const _0xdb7866 of _0x52e65c){const _0x18d466=_0xdb7866[_0x3394c8(0x15e)][_0x3394c8(0x242)]?a23_0x59aa95[_0x3394c8(0x248)]('\x20('+formatRows(_0xdb7866[_0x3394c8(0x15e)][_0x3394c8(0x242)])+')'):'',_0x495f0a=hyperlink(_0xdb7866[_0x3394c8(0x15e)][_0x3394c8(0x1a9)],_0x5ec8db(_0xdb7866['id']));console[_0x3394c8(0x19e)]('👥\x20'+_0x495f0a+_0x18d466);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x162);['description']='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x10be0a(0x20d)](_0x2273ec){const _0x2a29a8=a23_0x10be0a,{options:_0x425c76,args:_0x40f0da,tdx:_0x20e30a}=_0x2273ec;console[_0x2a29a8(0x214)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x2a29a8(0x16f)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5333aa=_0x425c76;if(_0x40f0da['length']===0x0)return console[_0x2a29a8(0x214)](a23_0x59aa95[_0x2a29a8(0x1e0)](_0x2a29a8(0x1af))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x5efe82=_0x40f0da[0x0];if(!_0x5333aa['database']||!_0x5333aa['table'])return console[_0x2a29a8(0x214)](_0x2a29a8(0x22a)),console['error'](_0x2a29a8(0x180)),0x1;_0x5333aa['verbose']&&(console['error']('Site:\x20'+_0x5333aa[_0x2a29a8(0x245)]),console[_0x2a29a8(0x214)](_0x2a29a8(0x24c)+_0x5efe82),console[_0x2a29a8(0x214)]('Database:\x20'+_0x5333aa[_0x2a29a8(0x1e2)]),console[_0x2a29a8(0x214)](_0x2a29a8(0x200)+_0x5333aa[_0x2a29a8(0x1a6)]));const _0x507978=await loadJSONFromOptions(_0x5333aa['attributes'],_0x5333aa[_0x2a29a8(0x1dc)]),_0x4aa54c=await loadJSONFromOptions(_0x5333aa[_0x2a29a8(0x205)],_0x5333aa['behaviorsFile']),_0x230ffb=await loadJSONFromOptions(_0x5333aa['customerGroup'],_0x5333aa[_0x2a29a8(0x199)]),_0x220bf4={'name':_0x5efe82,'description':_0x5333aa[_0x2a29a8(0x157)],'scheduleType':_0x5333aa[_0x2a29a8(0x12c)],'scheduleOption':_0x5333aa[_0x2a29a8(0x156)],'timezone':_0x5333aa[_0x2a29a8(0x1c8)],'master':{'parentDatabaseName':_0x5333aa[_0x2a29a8(0x1e2)],'parentTableName':_0x5333aa[_0x2a29a8(0x1a6)]},'attributes':_0x507978,'behaviors':_0x4aa54c,'customerGroup':_0x230ffb},_0x325a32=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x5efe82+_0x2a29a8(0x17c),()=>_0x20e30a[_0x2a29a8(0x168)][_0x2a29a8(0x219)](_0x220bf4),{'verbose':_0x425c76[_0x2a29a8(0x229)]}),_0x206dc5=_0x325a32[_0x2a29a8(0x1fc)];return console[_0x2a29a8(0x214)](_0x2a29a8(0x1d4)+_0x206dc5[_0x2a29a8(0x1a9)]+_0x2a29a8(0x21a)+_0x206dc5['id']),await handleSDKOutput([_0x206dc5],_0x425c76),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]='segment:parent:update';[a23_0x10be0a(0x157)]=a23_0x10be0a(0x1ac);async['execute'](_0x231bdf){const _0x850c9c=a23_0x10be0a,{options:_0x1ecc39,args:_0xe991d9,tdx:_0x3b08b6}=_0x231bdf;console['error'](_0x850c9c(0x132)+_0x850c9c(0x16f)+_0x850c9c(0x19c));const _0x3ee4cd=_0x1ecc39;if(_0xe991d9[_0x850c9c(0x1d2)]===0x0)return console[_0x850c9c(0x214)](a23_0x59aa95[_0x850c9c(0x1e0)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x850c9c(0x214)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x508cba=_0xe991d9[0x0];_0x3ee4cd[_0x850c9c(0x229)]&&(console[_0x850c9c(0x214)](_0x850c9c(0x23a)+_0x3ee4cd['site']),console[_0x850c9c(0x214)](_0x850c9c(0x1c7)+_0x508cba));const _0x213956=await withSpinner(_0x850c9c(0x13a)+_0x508cba+_0x850c9c(0x17c),()=>_0x3b08b6[_0x850c9c(0x168)]['getParentFull'](_0x508cba),{'verbose':_0x3ee4cd[_0x850c9c(0x229)]}),_0x1a63b4=_0x213956[_0x850c9c(0x1fc)],_0x575d47=await loadJSONFromOptions(_0x3ee4cd[_0x850c9c(0x204)],_0x3ee4cd[_0x850c9c(0x14a)]),_0x2d26fd=await loadJSONFromOptions(_0x3ee4cd[_0x850c9c(0x1d9)],_0x3ee4cd['addBehaviorsFile']),_0x5abc8e={'name':_0x1a63b4[_0x850c9c(0x1a9)],'description':_0x3ee4cd['description']!==undefined?_0x3ee4cd[_0x850c9c(0x157)]:_0x1a63b4[_0x850c9c(0x157)],'scheduleType':_0x3ee4cd[_0x850c9c(0x12c)]!==undefined?_0x3ee4cd[_0x850c9c(0x12c)]:_0x1a63b4[_0x850c9c(0x12c)],'scheduleOption':_0x3ee4cd[_0x850c9c(0x156)]!==undefined?_0x3ee4cd[_0x850c9c(0x156)]:_0x1a63b4[_0x850c9c(0x156)],'timezone':_0x3ee4cd[_0x850c9c(0x1c8)]!==undefined?_0x3ee4cd['timezone']:_0x1a63b4[_0x850c9c(0x1c8)],'master':_0x1a63b4[_0x850c9c(0x19b)],'attributes':_0x575d47?[..._0x1a63b4['attributes']||[],..._0x575d47]:_0x1a63b4[_0x850c9c(0x15e)],'behaviors':_0x2d26fd?[..._0x1a63b4[_0x850c9c(0x205)]||[],..._0x2d26fd]:_0x1a63b4[_0x850c9c(0x205)],'customerGroup':_0x1a63b4[_0x850c9c(0x237)]},_0x39025f=await withSpinner(_0x850c9c(0x1bc)+_0x508cba+_0x850c9c(0x17c),()=>_0x3b08b6[_0x850c9c(0x168)][_0x850c9c(0x1ee)](_0x508cba,_0x5abc8e),{'verbose':_0x3ee4cd[_0x850c9c(0x229)]}),_0x450128=_0x39025f[_0x850c9c(0x1fc)];return console[_0x850c9c(0x214)](_0x850c9c(0x1bf)+_0x450128[_0x850c9c(0x1a9)]+'\x27'),await handleSDKOutput([_0x450128],_0x3ee4cd),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';['description']=a23_0x10be0a(0x189);async[a23_0x10be0a(0x20d)](_0x39cd36){const _0x1e039a=a23_0x10be0a,{options:_0x314c06,args:_0x33662e,tdx:_0x3397f4}=_0x39cd36,_0x188597=_0x314c06,_0x414bb1=_0x33662e[0x0]||_0x314c06[_0x1e039a(0x18f)];if(!_0x414bb1)return showParentSegmentNotSetError(_0x1e039a(0x21b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x188597[_0x1e039a(0x19d)]&&_0x188597[_0x1e039a(0x1aa)])return console[_0x1e039a(0x214)](a23_0x59aa95[_0x1e039a(0x1e0)](_0x1e039a(0x128))),console['error'](a23_0x59aa95['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x1e039a(0x214)](a23_0x59aa95[_0x1e039a(0x248)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x1e039a(0x1ae))),console[_0x1e039a(0x214)](a23_0x59aa95['cyan'](_0x1e039a(0x187))),0x1;const _0xc1f3ad=_0x188597[_0x1e039a(0x1aa)]||a23_0x4c65ce[_0x1e039a(0x14c)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x414bb1)+_0x1e039a(0x1ef));_0x188597[_0x1e039a(0x229)]&&(console[_0x1e039a(0x214)]('Site:\x20'+_0x188597['site']),console['error'](_0x1e039a(0x1c7)+_0x414bb1),console[_0x1e039a(0x214)]('Output\x20file:\x20'+_0xc1f3ad));const _0xcc5cf4=await withSpinner(_0x1e039a(0x183)+_0x414bb1+_0x1e039a(0x17c),()=>_0x3397f4[_0x1e039a(0x168)]['pullParentYaml'](_0x414bb1),{'verbose':_0x188597[_0x1e039a(0x229)]}),_0x53e4a8=_0xcc5cf4[_0x1e039a(0x1fc)];if(existsSync(_0xc1f3ad)){const _0xf2bbb1=readFileSync(_0xc1f3ad,_0x1e039a(0x19a)),_0xe6621f=generateDiff(_0xf2bbb1,_0x53e4a8);if(!hasChanges(_0xe6621f))console[_0x1e039a(0x214)](a23_0x59aa95[_0x1e039a(0x143)]('✔')+_0x1e039a(0x1e9)+a23_0x59aa95[_0x1e039a(0x23b)](_0xc1f3ad)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x1e039a(0x214)]('\x0aChanges\x20to\x20\x27'+_0xc1f3ad+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x1e039a(0x214)](formatDiffWithColors(_0xe6621f)),console[_0x1e039a(0x214)]('─'[_0x1e039a(0x16d)](0x3c));if(!_0x188597[_0x1e039a(0x1b5)]){const _0x57e6a3=await confirmKey('Overwrite\x20\x27'+_0xc1f3ad+'\x27?');if(!_0x57e6a3)return console[_0x1e039a(0x214)](_0x1e039a(0x221)),0x1;}writeFileSync(_0xc1f3ad,_0x53e4a8,_0x1e039a(0x19a)),console[_0x1e039a(0x214)](a23_0x59aa95[_0x1e039a(0x143)]('✔')+_0x1e039a(0x216)+a23_0x59aa95[_0x1e039a(0x23b)](_0xc1f3ad));}}else{const _0x1fc6c5=a23_0x4c65ce[_0x1e039a(0x169)](_0xc1f3ad);!existsSync(_0x1fc6c5)&&mkdirSync(_0x1fc6c5,{'recursive':!![]}),writeFileSync(_0xc1f3ad,_0x53e4a8,'utf-8'),console['error'](a23_0x59aa95[_0x1e039a(0x143)]('✔')+_0x1e039a(0x216)+a23_0x59aa95[_0x1e039a(0x23b)](_0xc1f3ad));}return saveSessionContext({'parent_segment':_0x414bb1},_0x188597['session']),console[_0x1e039a(0x214)](a23_0x59aa95[_0x1e039a(0x143)]('✔')+_0x1e039a(0x153)+a23_0x59aa95['dim'](_0x1e039a(0x235))+_0x1e039a(0x139)+a23_0x59aa95[_0x1e039a(0x23b)](_0x414bb1)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x244);[a23_0x10be0a(0x157)]=a23_0x10be0a(0x1e6);async['execute'](_0x2e9daa){const _0xcd7166=a23_0x10be0a,{options:_0x17e0ca,args:_0xdae6f9,tdx:_0x157373}=_0x2e9daa,_0x37ec07=_0x17e0ca,_0x3ae1a0=_0xdae6f9[0x0]||_0x17e0ca[_0xcd7166(0x18f)];if(!_0x3ae1a0)return showParentSegmentNotSetError(_0xcd7166(0x1e8)+_0xcd7166(0x16c)),0x1;const _0x4c277c=resolveYamlFile(_0x3ae1a0);if(!existsSync(_0x4c277c))return showFileNotFoundError(_0x4c277c,_0x3ae1a0),0x1;_0x37ec07[_0xcd7166(0x229)]&&(console['error']('Site:\x20'+_0x37ec07['site']),console[_0xcd7166(0x214)](_0xcd7166(0x1ec)+_0x4c277c));let _0x1dd8f8;try{_0x1dd8f8=readFileSync(_0x4c277c,'utf-8');}catch(_0x186ce1){const _0xcd5f32=_0x186ce1 instanceof Error?_0x186ce1[_0xcd7166(0x191)]:String(_0x186ce1);return console[_0xcd7166(0x214)](_0xcd7166(0x188)+_0xcd5f32),0x1;}const _0xdb41cf=await withSpinner(_0xcd7166(0x125),()=>_0x157373[_0xcd7166(0x168)][_0xcd7166(0x249)](_0x1dd8f8),{'verbose':_0x37ec07['verbose']}),_0x1be882=_0xdb41cf[_0xcd7166(0x1fc)],{isNew:_0x262aad,name:_0x50f53d,hasChanges:_0x5932e0,diffFormatted:_0x3e0c50}=_0x1be882;if(!_0x5932e0)return console['error'](_0xcd7166(0x154)+_0x50f53d+_0xcd7166(0x17d)),0x0;_0x262aad?console['error'](_0xcd7166(0x206)+_0x50f53d+'\x27:'):console[_0xcd7166(0x214)](_0xcd7166(0x14b)+_0x50f53d+'\x27:');console[_0xcd7166(0x214)]('─'[_0xcd7166(0x16d)](0x3c)),console['error'](_0x3e0c50),console[_0xcd7166(0x214)]('─'[_0xcd7166(0x16d)](0x3c));const _0x29bd87=_0x262aad?_0xcd7166(0x1df)+_0x50f53d+'\x27?':_0xcd7166(0x13c)+_0x50f53d+'\x27?';if(!_0x37ec07[_0xcd7166(0x1b5)]){const _0x29c484=await confirmKey(_0x29bd87);if(!_0x29c484)return console[_0xcd7166(0x214)](_0xcd7166(0x221)),0x1;}const _0x41f915=_0x262aad?_0xcd7166(0x1da):_0xcd7166(0x185),_0xcf40b8=await withSpinner(_0x41f915+_0xcd7166(0x1f3)+_0x50f53d+_0xcd7166(0x17c),()=>_0x1be882[_0xcd7166(0x1ea)](),{'verbose':_0x37ec07[_0xcd7166(0x229)]}),_0x43d307=_0xcf40b8[_0xcd7166(0x1fc)],_0x2af260=getConsoleNextUrl(_0x37ec07['site'],_0xcd7166(0x22e)+_0x43d307['id']),_0x698fb3=_0x262aad?'Created':_0xcd7166(0x1bb);return console[_0xcd7166(0x214)]('✔\x20'+_0x698fb3+_0xcd7166(0x1f3)+_0x43d307[_0xcd7166(0x1a9)]+'\x27'),console[_0xcd7166(0x214)]('\x20\x20'+_0x2af260),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x10be0a(0x1a9)]='segment:parent:validate';[a23_0x10be0a(0x157)]=a23_0x10be0a(0x1dd);async['execute'](_0x2520ea){const _0x235c31=a23_0x10be0a,{options:_0x2df04a,args:_0x18359b,tdx:_0x30a148}=_0x2520ea,_0x12ccdc=_0x2df04a,_0x10c542=_0x18359b[0x0]||_0x2df04a[_0x235c31(0x18f)];if(!_0x10c542)return showParentSegmentNotSetError(_0x235c31(0x1c3)+_0x235c31(0x1a8)+_0x235c31(0x177)+_0x235c31(0x131)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x235c31(0x20c)),0x1;const _0x4ff0ab=resolveYamlFile(_0x10c542);if(!existsSync(_0x4ff0ab))return showFileNotFoundError(_0x4ff0ab,_0x10c542),0x1;_0x12ccdc[_0x235c31(0x229)]&&(console[_0x235c31(0x214)](_0x235c31(0x23a)+_0x12ccdc[_0x235c31(0x245)]),console[_0x235c31(0x214)](_0x235c31(0x1ec)+_0x4ff0ab));let _0x2b32ab;try{_0x2b32ab=readFileSync(_0x4ff0ab,_0x235c31(0x19a));}catch(_0x49707d){const _0x5c0396=_0x49707d instanceof Error?_0x49707d[_0x235c31(0x191)]:String(_0x49707d);return console['error'](_0x235c31(0x188)+_0x5c0396),0x1;}const _0x116a24=createCommandSpinner(a23_0x59aa95['dim']('Validating\x20configuration...'),{'verbose':_0x12ccdc[_0x235c31(0x229)]});_0x116a24[_0x235c31(0x1b4)]();const _0x2a1c3f={'onProgress':_0x5d105f=>{_0x116a24['text']=formatProgressMessage(_0x5d105f);}};if(_0x12ccdc[_0x235c31(0x19b)])_0x2a1c3f[_0x235c31(0x19b)]=!![];if(_0x12ccdc[_0x235c31(0x151)])_0x2a1c3f[_0x235c31(0x151)]=!![];_0x12ccdc['attribute']&&(_0x2a1c3f[_0x235c31(0x1c6)]=_0x12ccdc[_0x235c31(0x1c6)]);_0x12ccdc['behavior']&&(_0x2a1c3f[_0x235c31(0x127)]=_0x12ccdc[_0x235c31(0x127)]);if(_0x12ccdc[_0x235c31(0x1a0)])_0x2a1c3f[_0x235c31(0x1a0)]=_0x12ccdc[_0x235c31(0x1a0)];let _0x5d7292;try{_0x5d7292=await _0x30a148[_0x235c31(0x168)][_0x235c31(0x21e)](_0x2b32ab,_0x2a1c3f),_0x116a24['stop']();}catch(_0x18783a){_0x116a24[_0x235c31(0x208)]();throw _0x18783a;}const _0x1e8834=_0x12ccdc['interval']||_0x235c31(0x1a3);return this[_0x235c31(0x184)](_0x5d7292,_0x2a1c3f,_0x4ff0ab,_0x1e8834),_0x5d7292[_0x235c31(0x1cf)]?0x0:0x1;}[a23_0x10be0a(0x184)](_0x13e502,_0x522b25,_0x136698,_0x5aede4){const _0x496fbc=a23_0x10be0a;console[_0x496fbc(0x214)]('\x0a'+a23_0x59aa95[_0x496fbc(0x152)](_0x496fbc(0x13d))+'\x20'+_0x13e502[_0x496fbc(0x1a9)]),console[_0x496fbc(0x214)]('═'[_0x496fbc(0x16d)](0x3c)),this[_0x496fbc(0x1a7)](_0x13e502);if(typeof _0x522b25[_0x496fbc(0x1c6)]===_0x496fbc(0x175)){this['displayAttributesStats'](_0x13e502),this[_0x496fbc(0x1a5)](_0x13e502),this[_0x496fbc(0x15b)](_0x136698,_0x5aede4,_0x496fbc(0x1c6),_0x522b25[_0x496fbc(0x1c6)]);return;}if(_0x522b25[_0x496fbc(0x1c6)]===!![]){this[_0x496fbc(0x129)](_0x13e502),this[_0x496fbc(0x1a5)](_0x13e502),this[_0x496fbc(0x15b)](_0x136698,_0x5aede4,_0x496fbc(0x15e));return;}if(typeof _0x522b25[_0x496fbc(0x127)]===_0x496fbc(0x175)){this[_0x496fbc(0x218)](_0x13e502,_0x5aede4),this[_0x496fbc(0x1a5)](_0x13e502),this[_0x496fbc(0x15b)](_0x136698,_0x5aede4,_0x496fbc(0x127),_0x522b25[_0x496fbc(0x127)]);return;}if(_0x522b25[_0x496fbc(0x127)]===!![]){this['displayBehaviorsStats'](_0x13e502,_0x5aede4),this[_0x496fbc(0x1a5)](_0x13e502),this[_0x496fbc(0x15b)](_0x136698,_0x5aede4,'behaviors');return;}this['displayAttributesStats'](_0x13e502),this[_0x496fbc(0x218)](_0x13e502,_0x5aede4),this[_0x496fbc(0x1a5)](_0x13e502),this[_0x496fbc(0x15b)](_0x136698,_0x5aede4,_0x496fbc(0x1d3));}[a23_0x10be0a(0x15b)](_0x5aabc8,_0x499b0f,_0x2650da,_0x4d2f78){const _0x41674c=a23_0x10be0a;console[_0x41674c(0x214)]('\x0a'+a23_0x59aa95[_0x41674c(0x248)](_0x41674c(0x140)));const _0x3884ba=_0x499b0f!==_0x41674c(0x1a3)?_0x41674c(0x181)+_0x499b0f:'';if(_0x2650da==='attribute'&&_0x4d2f78)console[_0x41674c(0x214)]('\x20\x20'+a23_0x59aa95[_0x41674c(0x248)](_0x41674c(0x192)+_0x5aabc8+'\x20--attribute\x20\x22'+_0x4d2f78+'\x22'+_0x3884ba));else{if(_0x2650da==='behavior'&&_0x4d2f78)console[_0x41674c(0x214)]('\x20\x20'+a23_0x59aa95[_0x41674c(0x248)](_0x41674c(0x192)+_0x5aabc8+_0x41674c(0x146)+_0x4d2f78+'\x22'+_0x3884ba));else(_0x2650da===_0x41674c(0x15e)||_0x2650da===_0x41674c(0x1d3))&&console[_0x41674c(0x214)]('\x20\x20'+a23_0x59aa95['dim'](_0x41674c(0x192)+_0x5aabc8+'\x20--attribute\x20\x22<name>\x22'+_0x3884ba));}(_0x2650da===_0x41674c(0x205)||_0x2650da===_0x41674c(0x1d3))&&console[_0x41674c(0x214)]('\x20\x20'+a23_0x59aa95[_0x41674c(0x248)]('tdx\x20segment\x20parent\x20preview\x20'+_0x5aabc8+_0x41674c(0x24b)+_0x3884ba)),_0x2650da===_0x41674c(0x1d3)&&console['error']('\x20\x20'+a23_0x59aa95[_0x41674c(0x248)](_0x41674c(0x192)+_0x5aabc8+_0x41674c(0x246)+_0x3884ba));}['displayMasterInfo'](_0x4ee65a){const _0x1fdefa=a23_0x10be0a,{master:_0x2b160d}=_0x4ee65a,_0x308356=_0x2b160d[_0x1fdefa(0x243)]?a23_0x59aa95['green']('✔'):a23_0x59aa95[_0x1fdefa(0x1e0)]('✘');console['error']('\x0a'+a23_0x59aa95[_0x1fdefa(0x248)](_0x1fdefa(0x17e))),console[_0x1fdefa(0x214)](_0x308356+'\x20'+a23_0x59aa95[_0x1fdefa(0x152)](_0x2b160d[_0x1fdefa(0x1e2)]+'.'+_0x2b160d[_0x1fdefa(0x1a6)])),_0x2b160d[_0x1fdefa(0x243)]?_0x2b160d[_0x1fdefa(0x172)]!==undefined&&console[_0x1fdefa(0x214)]('\x20\x20'+a23_0x59aa95[_0x1fdefa(0x248)](_0x1fdefa(0x22f))+'\x20'+a23_0x59aa95[_0x1fdefa(0x23b)](formatRows(_0x2b160d[_0x1fdefa(0x172)]))):console[_0x1fdefa(0x214)]('\x20\x20'+a23_0x59aa95[_0x1fdefa(0x1e0)](_0x1fdefa(0x23d))+'\x20'+_0x2b160d[_0x1fdefa(0x23f)]);}[a23_0x10be0a(0x129)](_0x34789e){const _0x250607=a23_0x10be0a;if(_0x34789e[_0x250607(0x15e)][_0x250607(0x1d2)]===0x0)return;console[_0x250607(0x214)]('\x0a'+a23_0x59aa95[_0x250607(0x248)](_0x250607(0x170)));for(const _0x39e80c of _0x34789e[_0x250607(0x15e)]){const _0x183afd=_0x39e80c['schemaValid']?a23_0x59aa95['green']('✔'):a23_0x59aa95['red']('✘');let _0x5aef99='';if(_0x39e80c['schemaValid']&&_0x39e80c[_0x250607(0x16a)]!==undefined&&_0x39e80c['coveragePercent']!==undefined){const _0x4cfb6d=_0x39e80c[_0x250607(0x18b)][_0x250607(0x212)](0x1),_0x495fee=_0x39e80c[_0x250607(0x18b)]>=0x50?a23_0x59aa95[_0x250607(0x143)]:_0x39e80c[_0x250607(0x18b)]>=0x32?a23_0x59aa95[_0x250607(0x215)]:a23_0x59aa95[_0x250607(0x1e0)];_0x5aef99='\x20'+a23_0x59aa95['dim'](_0x250607(0x1b9))+'\x20'+_0x495fee(_0x4cfb6d+'%')+'\x20('+formatRows(_0x39e80c['matchedCount'])+_0x250607(0x194);}console[_0x250607(0x214)](_0x183afd+'\x20'+a23_0x59aa95[_0x250607(0x152)](_0x39e80c['name'])+_0x5aef99),console['error']('\x20\x20'+a23_0x59aa95[_0x250607(0x248)]('Source:')+'\x20'+a23_0x59aa95[_0x250607(0x152)](_0x39e80c[_0x250607(0x1e2)]+'.'+_0x39e80c[_0x250607(0x1a6)]));const _0x4aa2c7=_0x39e80c[_0x250607(0x217)]===_0x39e80c['foreignKey']?a23_0x59aa95[_0x250607(0x248)]('Join\x20on:')+'\x20'+_0x39e80c['joinKey']:a23_0x59aa95[_0x250607(0x248)]('Join:')+'\x20'+_0x39e80c[_0x250607(0x217)]+'\x20=\x20'+_0x39e80c['foreignKey'];console[_0x250607(0x214)]('\x20\x20'+_0x4aa2c7),console[_0x250607(0x214)]('\x20\x20'+a23_0x59aa95[_0x250607(0x248)](_0x250607(0x190))),this[_0x250607(0x1d1)](_0x39e80c[_0x250607(0x1c4)]),!_0x39e80c[_0x250607(0x243)]&&console[_0x250607(0x214)]('\x20\x20'+a23_0x59aa95['red']('Error:')+'\x20'+_0x39e80c['schemaError']);}}['displayBehaviorsStats'](_0x6c525b,_0x224f0b){const _0x1749f5=a23_0x10be0a;if(_0x6c525b[_0x1749f5(0x205)][_0x1749f5(0x1d2)]===0x0)return;console['error']('\x0a'+a23_0x59aa95[_0x1749f5(0x248)](_0x1749f5(0x1c9))+'\x20'+a23_0x59aa95[_0x1749f5(0x248)]('('+_0x224f0b+')'));for(const _0x1e6fd3 of _0x6c525b['behaviors']){const _0x37e6bd=_0x1e6fd3['schemaValid']?a23_0x59aa95[_0x1749f5(0x143)]('✔'):a23_0x59aa95[_0x1749f5(0x1e0)]('✘');let _0x2c420c='';if(_0x1e6fd3['schemaValid']&&_0x1e6fd3[_0x1749f5(0x1a1)]!==undefined&&_0x1e6fd3['totalEvents']!==undefined){const _0x54c8ab=_0x1e6fd3[_0x1749f5(0x1b6)]?.[_0x1749f5(0x212)](0x1)||'?',_0x706615=(_0x1e6fd3[_0x1749f5(0x1b6)]??0x0)>=0x32?a23_0x59aa95['green']:(_0x1e6fd3[_0x1749f5(0x1b6)]??0x0)>=0x14?a23_0x59aa95['yellow']:a23_0x59aa95[_0x1749f5(0x1e0)];_0x2c420c='\x20'+a23_0x59aa95['dim'](_0x1749f5(0x202))+'\x20'+_0x706615(formatRows(_0x1e6fd3[_0x1749f5(0x1a1)]))+'\x20('+_0x54c8ab+_0x1749f5(0x1fd)+a23_0x59aa95[_0x1749f5(0x248)](_0x1749f5(0x155))+'\x20'+a23_0x59aa95[_0x1749f5(0x23b)](formatRows(_0x1e6fd3[_0x1749f5(0x226)]));}console[_0x1749f5(0x214)](_0x37e6bd+'\x20'+a23_0x59aa95['bold'](_0x1e6fd3[_0x1749f5(0x1a9)])+_0x2c420c),console[_0x1749f5(0x214)]('\x20\x20'+a23_0x59aa95[_0x1749f5(0x248)]('Source:')+'\x20'+a23_0x59aa95[_0x1749f5(0x152)](_0x1e6fd3[_0x1749f5(0x1e2)]+'.'+_0x1e6fd3[_0x1749f5(0x1a6)]));const _0x1599e8=_0x1e6fd3[_0x1749f5(0x217)]===_0x1e6fd3[_0x1749f5(0x135)]?a23_0x59aa95[_0x1749f5(0x248)](_0x1749f5(0x1e4))+'\x20'+_0x1e6fd3[_0x1749f5(0x217)]:a23_0x59aa95['dim'](_0x1749f5(0x163))+'\x20'+_0x1e6fd3['joinKey']+_0x1749f5(0x139)+_0x1e6fd3[_0x1749f5(0x135)];console['error']('\x20\x20'+_0x1599e8),console[_0x1749f5(0x214)]('\x20\x20'+a23_0x59aa95['dim'](_0x1749f5(0x190))),this[_0x1749f5(0x1d1)](_0x1e6fd3[_0x1749f5(0x1c4)]),!_0x1e6fd3[_0x1749f5(0x243)]&&console[_0x1749f5(0x214)]('\x20\x20'+a23_0x59aa95[_0x1749f5(0x1e0)](_0x1749f5(0x23d))+'\x20'+_0x1e6fd3[_0x1749f5(0x23f)]);}}[a23_0x10be0a(0x1d1)](_0x62268a){const _0x28b0b2=a23_0x10be0a;for(const _0x145c85 of _0x62268a){_0x145c85[_0x28b0b2(0x1e3)]===_0x145c85[_0x28b0b2(0x22b)]||_0x145c85[_0x28b0b2(0x22b)]==='*'?console[_0x28b0b2(0x214)](_0x28b0b2(0x20a)+_0x145c85[_0x28b0b2(0x1e3)]):console[_0x28b0b2(0x214)](_0x28b0b2(0x20a)+_0x145c85[_0x28b0b2(0x1e3)]+'\x20'+a23_0x59aa95['dim']('('+_0x145c85[_0x28b0b2(0x22b)]+')'));}}[a23_0x10be0a(0x1a5)](_0xb00c4e){const _0x2eafa5=a23_0x10be0a;console[_0x2eafa5(0x214)]('─'[_0x2eafa5(0x16d)](0x3c));if(_0xb00c4e[_0x2eafa5(0x1ba)][_0x2eafa5(0x1d2)]>0x0){console[_0x2eafa5(0x214)]('\x0a'+a23_0x59aa95['red'](_0x2eafa5(0x195)));for(const _0x1ac4e0 of _0xb00c4e[_0x2eafa5(0x1ba)]){console['error']('\x20\x20'+a23_0x59aa95[_0x2eafa5(0x1e0)]('•')+'\x20'+_0x1ac4e0);}}_0xb00c4e[_0x2eafa5(0x1cf)]&&console[_0x2eafa5(0x214)]('\x0a'+a23_0x59aa95[_0x2eafa5(0x143)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x142);[a23_0x10be0a(0x157)]=a23_0x10be0a(0x14f);async['execute'](_0x5d1bd0){const _0x5cfd7c=a23_0x10be0a,{options:_0x211177,args:_0x514962,tdx:_0xc80667}=_0x5d1bd0,_0x1500c4=_0x211177,_0x2f67a7=_0x514962[0x0]||_0x211177[_0x5cfd7c(0x18f)];if(!_0x2f67a7)return showParentSegmentNotSetError(_0x5cfd7c(0x1e1)+_0x5cfd7c(0x1ab)+_0x5cfd7c(0x1a2)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x5cfd7c(0x24a)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x5cfd7c(0x20c)),0x1;if(!_0x1500c4[_0x5cfd7c(0x19b)]&&!_0x1500c4[_0x5cfd7c(0x1c6)]&&!_0x1500c4[_0x5cfd7c(0x127)]&&!_0x1500c4['enriched'])return console[_0x5cfd7c(0x214)](a23_0x59aa95[_0x5cfd7c(0x1e0)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x5cfd7c(0x214)](_0x5cfd7c(0x130)),console[_0x5cfd7c(0x214)](_0x5cfd7c(0x166)),console[_0x5cfd7c(0x214)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x5cfd7c(0x214)](_0x5cfd7c(0x144)),console['error']('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x5cfd7c(0x15a)),0x1;const _0x4db28b=resolveYamlFile(_0x2f67a7);if(!existsSync(_0x4db28b))return showFileNotFoundError(_0x4db28b,_0x2f67a7),0x1;_0x1500c4[_0x5cfd7c(0x229)]&&(console[_0x5cfd7c(0x214)](_0x5cfd7c(0x23a)+_0x1500c4[_0x5cfd7c(0x245)]),console['error']('YAML\x20file:\x20'+_0x4db28b));let _0x5f4433;try{_0x5f4433=readFileSync(_0x4db28b,'utf-8');}catch(_0x4f8579){const _0x570aa5=_0x4f8579 instanceof Error?_0x4f8579['message']:String(_0x4f8579);return console[_0x5cfd7c(0x214)](_0x5cfd7c(0x188)+_0x570aa5),0x1;}let _0x423902;try{_0x423902=parseDef(_0x5f4433);}catch(_0x4c725){const _0xe5c667=_0x4c725 instanceof Error?_0x4c725['message']:String(_0x4c725);return console['error'](a23_0x59aa95['red'](_0x5cfd7c(0x236)+_0xe5c667)),0x1;}if(_0x1500c4['attribute']===!![]||_0x1500c4[_0x5cfd7c(0x1c6)]===''){const _0x1fc4cf=_0x423902[_0x5cfd7c(0x15e)]?.[_0x5cfd7c(0x124)](_0x5700bc=>_0x5700bc[_0x5cfd7c(0x1a9)])||[];if(_0x1fc4cf['length']===0x0)console['error'](a23_0x59aa95[_0x5cfd7c(0x1e0)](_0x5cfd7c(0x1f7)));else{console[_0x5cfd7c(0x214)](a23_0x59aa95[_0x5cfd7c(0x1e0)](_0x5cfd7c(0x22d))),console['error'](_0x5cfd7c(0x1ad));for(const _0x1fe60c of _0x1fc4cf){console[_0x5cfd7c(0x214)]('\x20\x20'+a23_0x59aa95[_0x5cfd7c(0x23b)](_0x1fe60c));}console['error'](_0x5cfd7c(0x176)+_0x2f67a7+_0x5cfd7c(0x1bd)+_0x1fc4cf[0x0]+'\x22');}return 0x1;}if(_0x1500c4[_0x5cfd7c(0x127)]===!![]||_0x1500c4[_0x5cfd7c(0x127)]===''){const _0x22f987=_0x423902[_0x5cfd7c(0x205)]?.[_0x5cfd7c(0x124)](_0x47e032=>_0x47e032[_0x5cfd7c(0x1a9)])||[];if(_0x22f987[_0x5cfd7c(0x1d2)]===0x0)console[_0x5cfd7c(0x214)](a23_0x59aa95[_0x5cfd7c(0x1e0)](_0x5cfd7c(0x1e7)));else{console[_0x5cfd7c(0x214)](a23_0x59aa95[_0x5cfd7c(0x1e0)](_0x5cfd7c(0x148))),console[_0x5cfd7c(0x214)]('Available\x20behaviors:');for(const _0x251776 of _0x22f987){console[_0x5cfd7c(0x214)]('\x20\x20'+a23_0x59aa95[_0x5cfd7c(0x23b)](_0x251776));}console[_0x5cfd7c(0x214)](_0x5cfd7c(0x176)+_0x2f67a7+'\x20--behavior\x20\x22'+_0x22f987[0x0]+'\x22');}return 0x1;}const _0xc3ef3e=createCommandSpinner(a23_0x59aa95[_0x5cfd7c(0x248)]('Fetching\x20sample\x20data...'),{'verbose':_0x1500c4[_0x5cfd7c(0x229)]});_0xc3ef3e[_0x5cfd7c(0x1b4)]();const _0x3e0128={'onProgress':_0x42ead3=>{_0xc3ef3e['text']=formatProgressMessage(_0x42ead3);}};if(_0x1500c4[_0x5cfd7c(0x19b)])_0x3e0128[_0x5cfd7c(0x19b)]=!![];if(_0x1500c4[_0x5cfd7c(0x1c6)]&&typeof _0x1500c4[_0x5cfd7c(0x1c6)]===_0x5cfd7c(0x175))_0x3e0128[_0x5cfd7c(0x1c6)]=_0x1500c4['attribute'];if(_0x1500c4[_0x5cfd7c(0x127)]&&typeof _0x1500c4[_0x5cfd7c(0x127)]===_0x5cfd7c(0x175))_0x3e0128[_0x5cfd7c(0x127)]=_0x1500c4['behavior'];if(_0x1500c4['enriched'])_0x3e0128[_0x5cfd7c(0x151)]=!![];if(_0x1500c4[_0x5cfd7c(0x1a0)])_0x3e0128[_0x5cfd7c(0x1a0)]=_0x1500c4[_0x5cfd7c(0x1a0)];let _0x5797a6;try{_0x5797a6=await _0xc80667['segment'][_0x5cfd7c(0x209)](_0x5f4433,_0x3e0128),_0xc3ef3e[_0x5cfd7c(0x208)]();}catch(_0x35a718){_0xc3ef3e[_0x5cfd7c(0x208)]();throw _0x35a718;}return await this[_0x5cfd7c(0x126)](_0x5797a6,{'master':_0x1500c4[_0x5cfd7c(0x19b)],'attribute':typeof _0x1500c4[_0x5cfd7c(0x1c6)]==='string'?_0x1500c4[_0x5cfd7c(0x1c6)]:undefined,'behavior':typeof _0x1500c4[_0x5cfd7c(0x127)]===_0x5cfd7c(0x175)?_0x1500c4['behavior']:undefined,'enriched':_0x1500c4['enriched']}),_0x5797a6[_0x5cfd7c(0x1cf)]?0x0:0x1;}async['displayPreviewResults'](_0x35926d,_0x430f0a){const _0x494c77=a23_0x10be0a;console[_0x494c77(0x214)]('\x0a'+a23_0x59aa95[_0x494c77(0x152)]('Preview:')+'\x20'+_0x35926d[_0x494c77(0x1a9)]),console[_0x494c77(0x214)]('═'['repeat'](0x3c));if(_0x430f0a[_0x494c77(0x19b)]&&_0x35926d[_0x494c77(0x182)]){const _0x5f525e=a23_0x59aa95[_0x494c77(0x248)](_0x494c77(0x17f))+'\x20'+a23_0x59aa95[_0x494c77(0x152)](_0x35926d['master'][_0x494c77(0x1e2)]+'.'+_0x35926d['master'][_0x494c77(0x1a6)]);await this[_0x494c77(0x22c)](_0x5f525e,_0x35926d[_0x494c77(0x182)]);}else{if(_0x430f0a[_0x494c77(0x1c6)]&&_0x35926d[_0x494c77(0x182)]){const _0x426f30=a23_0x59aa95[_0x494c77(0x248)](_0x494c77(0x1fe))+'\x20'+a23_0x59aa95[_0x494c77(0x152)](_0x430f0a[_0x494c77(0x1c6)]);await this['displaySampleData'](_0x426f30,_0x35926d[_0x494c77(0x182)]);}else{if(_0x430f0a[_0x494c77(0x127)]&&_0x35926d[_0x494c77(0x182)]){const _0x1ed830=a23_0x59aa95[_0x494c77(0x248)](_0x494c77(0x1f5))+'\x20'+a23_0x59aa95['bold'](_0x430f0a[_0x494c77(0x127)]);await this['displaySampleData'](_0x1ed830,_0x35926d[_0x494c77(0x182)]);}else{if(_0x430f0a[_0x494c77(0x151)]&&_0x35926d[_0x494c77(0x182)]){const _0x3de4e4=a23_0x59aa95[_0x494c77(0x248)](_0x494c77(0x19f))+'\x20'+a23_0x59aa95['bold'](_0x494c77(0x1ca));await this[_0x494c77(0x22c)](_0x3de4e4,_0x35926d[_0x494c77(0x182)]);}else!_0x35926d[_0x494c77(0x182)]&&console[_0x494c77(0x214)](_0x494c77(0x165));}}}if(_0x35926d[_0x494c77(0x1ba)][_0x494c77(0x1d2)]>0x0){console[_0x494c77(0x214)]('─'[_0x494c77(0x16d)](0x3c)),console[_0x494c77(0x214)]('\x0a'+a23_0x59aa95[_0x494c77(0x1e0)](_0x494c77(0x195)));for(const _0xce58f9 of _0x35926d[_0x494c77(0x1ba)]){console[_0x494c77(0x214)]('\x20\x20'+a23_0x59aa95[_0x494c77(0x1e0)]('•')+'\x20'+_0xce58f9);}}}async[a23_0x10be0a(0x22c)](_0x5552e5,_0x49f532){const _0x5383be=a23_0x10be0a;if(_0x49f532[_0x5383be(0x1d2)]===0x0){console['error']('\x0a'+_0x5552e5),console[_0x5383be(0x214)](_0x5383be(0x1fb));return;}console['error']('\x0a'+_0x5552e5);const _0x514ac8=Object[_0x5383be(0x21d)](_0x49f532[0x0])[_0x5383be(0x124)](_0x42d829=>({'name':_0x42d829,'type':typeof _0x49f532[0x0][_0x42d829]===_0x5383be(0x1f9)?_0x5383be(0x178):_0x5383be(0x1eb)})),_0x52dd7e={'queryId':_0x5383be(0x160),'columns':_0x514ac8,'data':_0x49f532,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x49f532[_0x5383be(0x1d2)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x158d14=formatAsTable(_0x52dd7e,_0x49f532[_0x5383be(0x1d2)],!![]);await writeOutput(_0x158d14,undefined,_0x5383be(0x1a6));}}function a23_0x4d6f(){const _0x5b8b9d=['displayColumns','length','all','✔\x20Created\x20parent\x20segment\x20\x27','Found\x20YAML\x20file:\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','endsWith','Show\x20parent\x20segment\x20schema\x20(column\x20types)','addBehaviors','Creating','\x20Opening\x20','attributesFile','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','runParent','Create\x20parent\x20segment\x20\x27','red','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','database','label','Join\x20on:','675770DqruRn','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20No\x20changes\x20-\x20','apply','varchar','YAML\x20file:\x20','jobId','updateParent','.yml','workflowId','Listing\x20parent\x20segments\x20matching\x20\x27','\x0a⚠️\x20\x20Both\x20','\x20parent\x20segment\x20\x27','audienceId','Behavior:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','241550DAMWOn','number','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20No\x20sample\x20data\x20available','data','%)\x20','Attribute:','ignore','Table:\x20','getParentFull','Customers:','platform','addAttributes','behaviors','\x0aNew\x20parent\x20segment\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','stop','previewParentYaml','\x20\x20\x20\x20-\x20','Attempt:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','execute','json','match','replace','\x20kill','toFixed','status','error','yellow','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','joinKey','displayBehaviorsStats','createParent','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','2896960cTrSMm','keys','validateParentYaml','elapsedTimeMillis','web','Aborted.','✔\x20Found\x20','limit','To\x20cancel:','✔\x20Query\x20completed:\x20Processed\x20','totalEvents','in\x20','/\x20directories\x20exist.','verbose','Error:\x20--database\x20and\x20--table\x20are\x20required','column','displaySampleData','Error:\x20--attribute\x20requires\x20a\x20name\x0a','/app/dw/parentSegments/','Rows:','test','sort','✘\x20Failed\x20to\x20rename\x20directory:\x20','6757620servWw','trim','parent_segment','Error\x20parsing\x20YAML:\x20','customerGroup','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','.yaml','Site:\x20','cyan','win32','Error:','\x20parent\x20segment','schemaError','Status:','\x20rows\x20','population','schemaValid','segment:parent:push','site','\x20--enriched','\x0a⚠️\x20\x20Migrating:\x20','dim','pushParentYaml','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20--behavior\x20\x22<name>\x22','Name:\x20','stats','map','Analyzing\x20changes...','displayPreviewResults','behavior','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','displayAttributesStats','run','/\x20directory.\x0a','scheduleType','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','10tgxbwe','localeCompare','foreignKey','getParentSQL','5448900NeFTQJ','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20=\x20','Fetching\x20current\x20configuration\x20for\x20\x27','segment:parent:view','Apply\x20changes\x20to\x20\x27','Validate:','workflowSessionId','workflowAttemptId','To\x20view\x20sample\x20data:','35tVsigZ','segment:parent:preview','green','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20--behavior\x20\x22','parent_segments','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','addAttributesFile','\x0aChanges\x20to\x20apply\x20to\x20\x27','join','\x27\x20and\x20run\x20workflow?','/attempt/','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','enriched','bold','\x20Context\x20set:\x20','✔\x20No\x20changes\x20-\x20\x27','Events:','scheduleOption','description','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','displayPreviewHints','/sessions/','/app/workflows/','attributes','filter','preview','segment:parent:sql','segment:parent:create','Join:','unref','\x0aNo\x20sample\x20data\x20available','Options:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','segment','dirname','matchedCount','segment:parent:desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','repeat','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Attributes','Created','rowCount','open','Resolving\x20parent\x20segment\x20\x27','string','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Options:\x0a','double','resolveParentId','Listing\x20fields\x20for\x20\x27','Pattern:\x20','\x27...','\x27\x20is\x20already\x20up\x20to\x20date','Master\x20Table','Master:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20--interval\x20','sampleData','Fetching\x20parent\x20segment\x20\x27','displayValidateResults','Updating','xdg-open','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Error\x20reading\x20file:\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20tdx\x20wf\x20attempt\x20','coveragePercent','segment:parent:fields','segment:parent:list','Listing\x20parent\x20segments...','parentSegment','Columns:','message','tdx\x20segment\x20parent\x20preview\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20rows)','Errors:','\x0a✔\x20Workflow\x20started','segment:parent:run','\x20[Job\x20ID:\x20','customerGroupFile','utf-8','master','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','use','log','Enriched:','interval','customersWithEvents','Options\x20(one\x20required):\x0a','-1d','/\x20→\x20','displaySummary','table','displayMasterInfo','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','name','output','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Available\x20attributes:','/{name}.yml\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','jsonl','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','start','yes','customerPercent','listFields','\x27\x20is\x20up\x20to\x20date','Coverage:','errors','Updated','Updating\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','192368NUUlwb','✔\x20Updated\x20parent\x20segment\x20\x27','format','List\x20parent\x20segments','query','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','columns','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','attribute','Parent\x20segment:\x20','timezone','Behaviors','Master\x20+\x20Attributes','Error:\x20File\x20not\x20found:\x20','/\x20and\x20','Fetching\x20SQL\x20for\x20\x27','isDirectory','allValid','4730220jOZgvF'];a23_0x4d6f=function(){return _0x5b8b9d;};return a23_0x4d6f();}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x197);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0x4d6937){const _0x3132ef=a23_0x10be0a,{options:_0x59500b,args:_0x101ea0,tdx:_0x494b6e}=_0x4d6937,_0x51075a=_0x59500b,_0x54d0b4=_0x101ea0[0x0]||_0x59500b[_0x3132ef(0x18f)];if(!_0x54d0b4)return showParentSegmentNotSetError(_0x3132ef(0x149)+_0x3132ef(0x1f6)),0x1;const _0x4fc616=resolveYamlFile(_0x54d0b4);if(existsSync(_0x4fc616)){_0x51075a['verbose']&&console[_0x3132ef(0x214)](_0x3132ef(0x1d5)+_0x4fc616);let _0x2a22a0;try{_0x2a22a0=readFileSync(_0x4fc616,_0x3132ef(0x19a));}catch(_0x567ee8){const _0xa768fb=_0x567ee8 instanceof Error?_0x567ee8[_0x3132ef(0x191)]:String(_0x567ee8);return console[_0x3132ef(0x214)]('Error\x20reading\x20file:\x20'+_0xa768fb),0x1;}const _0x3af50d=await withSpinner(_0x3132ef(0x125),()=>_0x494b6e[_0x3132ef(0x168)]['pushParentYaml'](_0x2a22a0),{'verbose':_0x51075a[_0x3132ef(0x229)]}),_0x39875e=_0x3af50d[_0x3132ef(0x1fc)],{isNew:_0x5c49c8,name:_0x5a79e7,hasChanges:_0x3ca858,diffFormatted:_0x4cb9be}=_0x39875e;if(_0x3ca858){_0x5c49c8?console[_0x3132ef(0x214)](_0x3132ef(0x206)+_0x5a79e7+'\x27:'):console[_0x3132ef(0x214)](_0x3132ef(0x14b)+_0x5a79e7+'\x27:');console[_0x3132ef(0x214)]('─'[_0x3132ef(0x16d)](0x3c)),console[_0x3132ef(0x214)](_0x4cb9be),console[_0x3132ef(0x214)]('─'[_0x3132ef(0x16d)](0x3c));const _0x46a128=_0x5c49c8?_0x3132ef(0x1df)+_0x5a79e7+_0x3132ef(0x14d):_0x3132ef(0x13c)+_0x5a79e7+_0x3132ef(0x14d);if(!_0x51075a[_0x3132ef(0x1b5)]){const _0xcda0c9=await confirmKey(_0x46a128);if(!_0xcda0c9)return console[_0x3132ef(0x214)](_0x3132ef(0x221)),0x1;}const _0x33cb7c=_0x5c49c8?_0x3132ef(0x1da):_0x3132ef(0x185);await withSpinner(_0x33cb7c+_0x3132ef(0x1f3)+_0x5a79e7+_0x3132ef(0x17c),()=>_0x39875e[_0x3132ef(0x1ea)](),{'verbose':_0x51075a[_0x3132ef(0x229)]});const _0x50a0d7=_0x5c49c8?_0x3132ef(0x171):_0x3132ef(0x1bb);console[_0x3132ef(0x214)]('✔\x20'+_0x50a0d7+'\x20parent\x20segment\x20\x27'+_0x5a79e7+'\x27');}else console[_0x3132ef(0x214)](_0x3132ef(0x154)+_0x5a79e7+_0x3132ef(0x1b8));}const _0x49f039=await withSpinner(_0x3132ef(0x145)+_0x54d0b4+_0x3132ef(0x17c),()=>_0x494b6e[_0x3132ef(0x168)][_0x3132ef(0x1de)](_0x54d0b4),{'verbose':_0x51075a['verbose']}),_0x27dbe7=_0x49f039[_0x3132ef(0x1fc)],_0x27627a=getConsoleUrl(_0x51075a['site'],_0x3132ef(0x15d)+_0x27dbe7[_0x3132ef(0x1f0)]+_0x3132ef(0x15c)+_0x27dbe7['workflowSessionId']+_0x3132ef(0x14e)+_0x27dbe7[_0x3132ef(0x13f)]);return console['error'](_0x3132ef(0x196)),console['error']('\x20\x20'+a23_0x59aa95[_0x3132ef(0x248)](_0x3132ef(0x1b0))+'\x20'+_0x27dbe7[_0x3132ef(0x1f4)]),console[_0x3132ef(0x214)]('\x20\x20'+a23_0x59aa95[_0x3132ef(0x248)](_0x3132ef(0x240))+'\x20'+_0x27dbe7[_0x3132ef(0x213)]),console[_0x3132ef(0x214)]('\x20\x20'+a23_0x59aa95['dim']('Session:')+'\x20'+_0x27dbe7[_0x3132ef(0x13e)]),console['error']('\x20\x20'+a23_0x59aa95[_0x3132ef(0x248)](_0x3132ef(0x20b))+'\x20'+_0x27dbe7[_0x3132ef(0x13f)]),console[_0x3132ef(0x214)]('\x20\x20'+_0x27627a),console[_0x3132ef(0x214)]('\x0a'+a23_0x59aa95['dim'](_0x3132ef(0x224))+_0x3132ef(0x18a)+_0x27dbe7[_0x3132ef(0x13f)]+_0x3132ef(0x211)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x18c);[a23_0x10be0a(0x157)]='List\x20available\x20fields\x20for\x20segmentation';async[a23_0x10be0a(0x20d)](_0x5bc638){const _0x1919eb=a23_0x10be0a,{options:_0x362284,args:_0x3237e8,tdx:_0x4eb770}=_0x5bc638,_0x403e4b=_0x3237e8[0x0]||_0x362284[_0x1919eb(0x18f)];if(!_0x403e4b)return showParentSegmentNotSetError(_0x1919eb(0x1fa)+_0x1919eb(0x138)),0x1;_0x362284[_0x1919eb(0x229)]&&(console[_0x1919eb(0x214)](_0x1919eb(0x23a)+_0x362284['site']),console[_0x1919eb(0x214)](_0x1919eb(0x1c7)+_0x403e4b));const _0xa78a73=await withSpinner(_0x1919eb(0x17a)+_0x403e4b+_0x1919eb(0x17c),()=>_0x4eb770[_0x1919eb(0x168)][_0x1919eb(0x1b7)](_0x403e4b),{'verbose':_0x362284[_0x1919eb(0x229)]}),_0x43ac41=_0xa78a73['data'];console[_0x1919eb(0x214)](_0x1919eb(0x222)+_0x43ac41['length']+'\x20field'+(_0x43ac41[_0x1919eb(0x1d2)]!==0x1?'s':''));if(_0x362284[_0x1919eb(0x20e)]||_0x362284['jsonl'])return await handleSDKOutput(_0x43ac41,_0x362284),0x0;return displayFieldsHumanReadable(_0x43ac41,_0x403e4b),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x13b);['description']='Show\x20parent\x20segment\x20details';async[a23_0x10be0a(0x20d)](_0x54d098){const _0x57d399=a23_0x10be0a,{options:_0x34b608,args:_0x1a7da7,tdx:_0x148bec}=_0x54d098,_0x176072=_0x34b608,_0x3d0f12=_0x1a7da7[0x0]||_0x34b608['parentSegment'];if(!_0x3d0f12)return showParentSegmentNotSetError(_0x57d399(0x238)+_0x57d399(0x159)+_0x57d399(0x177)+_0x57d399(0x12f)),0x1;_0x34b608[_0x57d399(0x229)]&&(console[_0x57d399(0x214)](_0x57d399(0x23a)+_0x34b608[_0x57d399(0x245)]),console[_0x57d399(0x214)](_0x57d399(0x1c7)+_0x3d0f12));const _0x395174=await withSpinner(_0x57d399(0x183)+_0x3d0f12+_0x57d399(0x17c),()=>_0x148bec['segment'][_0x57d399(0x201)](_0x3d0f12),{'verbose':_0x34b608[_0x57d399(0x229)]}),_0x1ab116=_0x395174[_0x57d399(0x1fc)];if(_0x176072[_0x57d399(0x220)]){const _0x3a3263=getConsoleNextUrl(_0x176072[_0x57d399(0x245)],'/app/dw/parentSegments/'+_0x1ab116['id']);return console[_0x57d399(0x214)](a23_0x59aa95[_0x57d399(0x143)]('✔')+_0x57d399(0x1db)+a23_0x59aa95['cyan'](_0x3a3263)),openBrowser(_0x3a3263),0x0;}return await handleSingleObjectOutput(_0x1ab116,_0x34b608),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x16b);[a23_0x10be0a(0x157)]=a23_0x10be0a(0x1d8);async['execute'](_0x338925){const _0x1b9981=a23_0x10be0a,{options:_0x321ba9,args:_0x44a2a3,tdx:_0x1b2152}=_0x338925,_0x33a18f=_0x44a2a3[0x0]||_0x321ba9[_0x1b9981(0x18f)];if(!_0x33a18f)return showParentSegmentNotSetError(_0x1b9981(0x193)+_0x1b9981(0x12e)),0x1;_0x321ba9[_0x1b9981(0x229)]&&(console['error'](_0x1b9981(0x23a)+_0x321ba9['site']),console[_0x1b9981(0x214)](_0x1b9981(0x1c7)+_0x33a18f));const _0x44dfc1=await withSpinner(_0x1b9981(0x174)+_0x33a18f+_0x1b9981(0x17c),()=>_0x1b2152[_0x1b9981(0x168)][_0x1b9981(0x179)](_0x33a18f),{'verbose':_0x321ba9['verbose']}),_0x12814a=_0x44dfc1[_0x1b9981(0x1fc)],_0x34f977=await withSpinner(_0x1b9981(0x1cd)+_0x33a18f+_0x1b9981(0x17c),()=>_0x1b2152[_0x1b9981(0x168)][_0x1b9981(0x136)](_0x12814a),{'verbose':_0x321ba9[_0x1b9981(0x229)]}),_0xb30615=await executeSchemaQuery(_0x34f977[_0x1b9981(0x1fc)],_0x1b2152,_0x321ba9);return await handleQueryOutput(_0xb30615,_0x321ba9),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]=a23_0x10be0a(0x161);[a23_0x10be0a(0x157)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a23_0x10be0a(0x20d)](_0x87c73f){const _0x3adefd=a23_0x10be0a,{options:_0x48f927,args:_0x1f4d15,tdx:_0x441242}=_0x87c73f,_0x3faa06=_0x1f4d15[0x0]||_0x48f927['parentSegment'];if(!_0x3faa06)return showParentSegmentNotSetError(_0x3adefd(0x1d6)+_0x3adefd(0x1b1)),0x1;_0x48f927['verbose']&&(console[_0x3adefd(0x214)]('Site:\x20'+_0x48f927[_0x3adefd(0x245)]),console['error'](_0x3adefd(0x1c7)+_0x3faa06));const _0x540436=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3faa06+_0x3adefd(0x17c),()=>_0x441242['segment'][_0x3adefd(0x179)](_0x3faa06),{'verbose':_0x48f927[_0x3adefd(0x229)]}),_0x2c93b4=_0x540436[_0x3adefd(0x1fc)],_0x15c867=await withSpinner(_0x3adefd(0x1cd)+_0x3faa06+'\x27...',()=>_0x441242['segment'][_0x3adefd(0x136)](_0x2c93b4),{'verbose':_0x48f927[_0x3adefd(0x229)]}),_0x50f2f7=_0x15c867[_0x3adefd(0x1fc)];return _0x48f927['format']===_0x3adefd(0x20e)||_0x48f927[_0x3adefd(0x1c0)]===_0x3adefd(0x1b2)?await handleSDKOutput([{'sql':_0x50f2f7}],_0x48f927):console[_0x3adefd(0x19e)](_0x50f2f7),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x10be0a(0x1a9)]='segment:parent:show';[a23_0x10be0a(0x157)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a23_0x10be0a(0x20d)](_0x340744){const _0x1f0c1c=a23_0x10be0a,{options:_0x175818,args:_0x4d741a,tdx:_0x271e37}=_0x340744,_0x1d4af9=_0x4d741a[0x0]||_0x175818['parentSegment'];if(!_0x1d4af9)return showParentSegmentNotSetError(_0x1f0c1c(0x150)+_0x1f0c1c(0x167)),0x1;_0x175818[_0x1f0c1c(0x229)]&&(console['error'](_0x1f0c1c(0x23a)+_0x175818[_0x1f0c1c(0x245)]),console[_0x1f0c1c(0x214)](_0x1f0c1c(0x1c7)+_0x1d4af9));const _0x513269=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1d4af9+_0x1f0c1c(0x17c),()=>_0x271e37[_0x1f0c1c(0x168)][_0x1f0c1c(0x179)](_0x1d4af9),{'verbose':_0x175818[_0x1f0c1c(0x229)]}),_0x3d9cd9=_0x513269['data'],_0xc83217=await withSpinner(_0x1f0c1c(0x1cd)+_0x1d4af9+_0x1f0c1c(0x17c),()=>_0x271e37['segment'][_0x1f0c1c(0x136)](_0x3d9cd9),{'verbose':_0x175818[_0x1f0c1c(0x229)]});let _0x495ab4=_0xc83217['data'];const _0x2b6913=resolveLimit(_0x175818[_0x1f0c1c(0x223)],DEFAULT_DISPLAY_LIMIT),_0x8d3a3=/\bLIMIT\s+\d+/i[_0x1f0c1c(0x230)](_0x495ab4);!_0x8d3a3&&(_0x495ab4=_0x495ab4[_0x1f0c1c(0x234)]()[_0x1f0c1c(0x210)](/;+$/,''),_0x495ab4=_0x1f0c1c(0x207)+_0x495ab4+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x2b6913);_0x175818[_0x1f0c1c(0x229)]&&console[_0x1f0c1c(0x214)]('SQL\x20query:\x0a'+_0x495ab4);const _0x3aa3a6=await withProgressSpinner(_0x1f0c1c(0x12d),async _0x1d8153=>{const _0x1b1e2f=_0x1f0c1c,_0x3c4576=await _0x271e37[_0x1b1e2f(0x1c2)][_0x1b1e2f(0x20d)](_0x495ab4,{'catalog':'td','schema':'information_schema','onJobId':_0xe72254=>{_0x1d8153['setJobId'](_0xe72254);}});return _0x3c4576;},{'verbose':_0x175818[_0x1f0c1c(0x229)]}),_0x421944=_0x3aa3a6['data'],_0x268e5a=_0x421944[_0x1f0c1c(0x1ed)]?_0x1f0c1c(0x198)+_0x421944['jobId']+']':'';return console[_0x1f0c1c(0x214)](_0x1f0c1c(0x225)+_0x421944[_0x1f0c1c(0x24d)]['processedRows']['toLocaleString']()+_0x1f0c1c(0x241)+(_0x1f0c1c(0x227)+formatElapsed(_0x421944[_0x1f0c1c(0x24d)][_0x1f0c1c(0x21f)])+_0x268e5a)),await handleQueryOutput(_0x421944,_0x175818),0x0;}}
@@ -1 +1 @@
1
- const a24_0x30fec6=a24_0x3ec9;(function(_0x526fc9,_0xe19da){const _0x52214d=a24_0x3ec9,_0x3751a6=_0x526fc9();while(!![]){try{const _0x22baa0=parseInt(_0x52214d(0x12c))/0x1*(-parseInt(_0x52214d(0x127))/0x2)+-parseInt(_0x52214d(0xfb))/0x3*(-parseInt(_0x52214d(0x129))/0x4)+parseInt(_0x52214d(0x156))/0x5*(parseInt(_0x52214d(0xe6))/0x6)+parseInt(_0x52214d(0xed))/0x7+parseInt(_0x52214d(0xe9))/0x8+-parseInt(_0x52214d(0x142))/0x9+-parseInt(_0x52214d(0x152))/0xa;if(_0x22baa0===_0xe19da)break;else _0x3751a6['push'](_0x3751a6['shift']());}catch(_0x3d7ee2){_0x3751a6['push'](_0x3751a6['shift']());}}}(a24_0x50a6,0xbab75));import{BaseCommand,printAuthError}from'./command.js';function a24_0x50a6(){const _0x37ec63=['execute','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>','tdx:\x20profile\x20create','profile:set','Profile\x20name\x20cannot\x20be\x20empty','create','database','email','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Unknown\x20key\x20\x27','parent_segment','Session\x20profile\x20set\x20to:\x20','/app/mp/ak','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','jobs','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','default','ERROR','\x20\x20-\x20','\x0aSetup\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20--default\x27\x20to\x20save\x20permanently','VALID_KEYS','\x20\x20(no\x20profiles\x20found)','\x0aAvailable\x20profiles:','password','\x20API\x20key\x20is\x20valid\x20(User:\x20','(session:\x20','(cleared)','Validating\x20API\x20key...','\x0aSaved\x20to:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx.json','validate','Enter\x20your\x20TD\x20API\x20key:','toString','1256646bDWElG','Operation\x20cancelled','4voMZTc','customSite','Site\x20was\x20not\x20changed.','1oCeJmY','Failed\x20to\x20remove\x20profile:\x20','\x27\x20created','Enter\x20profile\x20name:','red','text','\x27\x20requires\x20API\x20key\x20validation.','green','Profile\x20\x27','\x27\x20updated:\x20','Removal\x20cancelled','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','tdx:\x20profile\x20remove','\x27\x20removed\x20from\x20configuration','You\x20can\x20find\x20your\x20API\x20key\x20at:','Create\x20a\x20new\x20profile','dim','Remove\x20a\x20profile','test','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','error','3068649NMBbTV','\x20Profile\x20\x27','includes','site','message','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','split','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','us01','✗\x20Validation\x20failed:\x20','logLevel','\x27\x20does\x20not\x20exist.','llm_agent','profile:use','description','bold','20561940lfPPUh','getUserInfo','length','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','815BYKjvN','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profileName','10326rBiYuD','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','9855456WdwjLW','Site\x20name\x20cannot\x20be\x20empty','join','name','10659691LhyFBk','log','select','trim','profile:create','API\x20key\x20cannot\x20be\x20empty','status','warn','yellow','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x20\x20tdx\x20--profile\x20','2264997bKCxLy','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','apiKey','confirm','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','profile','Set\x20a\x20profile\x20configuration\x20value'];a24_0x50a6=function(){return _0x37ec63;};return a24_0x50a6();}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0xdad399 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';function a24_0x3ec9(_0x5ac1a7,_0x5ba679){_0x5ac1a7=_0x5ac1a7-0xe5;const _0x50a68c=a24_0x50a6();let _0x3ec91d=_0x50a68c[_0x5ac1a7];return _0x3ec91d;}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_0x7b2869 from'prompts';import a24_0x446ada from'chalk';function validateProfileName(_0x655d1f){const _0x54438c=a24_0x3ec9;if(!_0x655d1f||!_0x655d1f[_0x54438c(0xf0)]())return _0x54438c(0x107);const _0x3d55b1=_0x655d1f['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x54438c(0x13f)](_0x3d55b1))return _0x54438c(0x10b);if(profileExists(_0x3d55b1))return _0x54438c(0x134)+_0x3d55b1+_0x54438c(0x140);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a24_0x30fec6(0xf1);[a24_0x30fec6(0x150)]=a24_0x30fec6(0x13c);async['execute'](_0x39c85b){const _0x254f21=a24_0x30fec6,{options:_0x119af2,args:_0x73206a}=_0x39c85b;console[_0x254f21(0xee)](a24_0x446ada[_0x254f21(0x151)](_0x254f21(0x105)));let _0x17dccd;if(_0x73206a[_0x254f21(0x154)]>0x0&&_0x73206a[0x0]){const _0x2eba83=_0x73206a[0x0][_0x254f21(0xf0)](),_0x417a2b=validateProfileName(_0x2eba83);if(_0x417a2b!==!![])return console['error'](a24_0x446ada[_0x254f21(0x130)](_0x417a2b)),0x1;_0x17dccd=_0x2eba83;}else{const _0x2446c6=await a24_0x7b2869({'type':'text','name':_0x254f21(0xe5),'message':_0x254f21(0x12f),'validate':validateProfileName});if(!_0x2446c6[_0x254f21(0xe5)])return console[_0x254f21(0xee)](_0x254f21(0x116)),0x1;_0x17dccd=_0x2446c6[_0x254f21(0xe5)][_0x254f21(0xf0)]();}const _0x40aef6=await a24_0x7b2869({'type':_0x254f21(0x131),'name':_0x254f21(0x150),'message':'Enter\x20description\x20(optional):'}),_0x56424e=_0x40aef6[_0x254f21(0x150)]?.['trim']()||undefined,_0x1bd4a9=_0x119af2[_0x254f21(0x145)]||_0x254f21(0x14a),{choices:_0x79d427,initialIndex:_0x2e90f6}=buildSiteChoices(_0x1bd4a9),_0x3d87d6=await a24_0x7b2869({'type':_0x254f21(0xef),'name':_0x254f21(0x145),'message':_0x254f21(0x110)+_0x17dccd+'\x27:','choices':_0x79d427,'initial':_0x2e90f6});if(!_0x3d87d6[_0x254f21(0x145)])return console[_0x254f21(0xee)](_0x254f21(0x116)),0x1;let _0x42ed07;if(_0x3d87d6[_0x254f21(0x145)]==='other'){const _0x508d22=await a24_0x7b2869({'type':_0x254f21(0x131),'name':_0x254f21(0x12a),'message':'Enter\x20site\x20name:','initial':_0x254f21(0x14a),'validate':_0x334e29=>{const _0x1cbad5=_0x254f21;if(!_0x334e29||!_0x334e29[_0x1cbad5(0xf0)]())return _0x1cbad5(0xea);if(!/^[a-z0-9-]+$/[_0x1cbad5(0x13f)](_0x334e29[_0x1cbad5(0xf0)]()))return _0x1cbad5(0x157);return!![];}});if(!_0x508d22['customSite'])return console['log'](_0x254f21(0x116)),0x1;_0x42ed07=_0x508d22[_0x254f21(0x12a)];}else _0x42ed07=_0x3d87d6[_0x254f21(0x145)];const _0x23267b=resolveSite(_0x42ed07);console['log'](_0x254f21(0xe7)+_0x23267b),console[_0x254f21(0xee)](_0x254f21(0x13b)),console['log']('\x20\x20'+getConsoleUrl(_0x23267b,_0x254f21(0x10f)));const _0x43c6a7=await a24_0x7b2869({'type':_0x254f21(0x11c),'name':'apiKey','message':_0x254f21(0x125),'validate':_0x5d44c0=>{const _0x238c30=_0x254f21;if(!_0x5d44c0||!_0x5d44c0[_0x238c30(0xf0)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x43c6a7[_0x254f21(0xfd)])return console[_0x254f21(0xee)]('\x0aSetup\x20cancelled'),0x1;const _0x10c15f=_0x43c6a7[_0x254f21(0xfd)];console['log']('Validating\x20API\x20key...');try{const _0x368a5f=TDX[_0x254f21(0x108)]({'site':_0x23267b,'apiKey':_0x10c15f['trim'](),'logLevel':_0x119af2[_0x254f21(0x14c)]??LogLevel[_0x254f21(0x114)]}),_0x515869=await _0x368a5f['jobs'][_0x254f21(0x153)]();console[_0x254f21(0xee)](a24_0x446ada[_0x254f21(0x133)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x515869[_0x254f21(0x10a)]+')');const _0x194304=await isKeychainAvailable();_0x194304?(await saveAPIKeyAsync(_0x10c15f['trim'](),_0x23267b,_0x17dccd),console['log'](a24_0x446ada[_0x254f21(0x133)]('✓')+_0x254f21(0x147)+_0x17dccd+')')):(console[_0x254f21(0xf4)](a24_0x446ada[_0x254f21(0xf5)](_0x254f21(0x112))),console['warn'](a24_0x446ada['yellow'](_0x254f21(0xf7))));const _0x262969={'site':_0x23267b,..._0x56424e&&{'description':_0x56424e}};return saveProfileToUserConfig(_0x17dccd,_0x262969),console['log'](a24_0x446ada[_0x254f21(0x133)]('✓')+_0x254f21(0x143)+_0x17dccd+_0x254f21(0x12e)),console[_0x254f21(0xee)](),console[_0x254f21(0xee)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x254f21(0xee)](_0x254f21(0xfa)+_0x17dccd+_0x254f21(0x137)),console['log'](_0x254f21(0xfa)+_0x17dccd+_0x254f21(0xff)),0x0;}catch(_0x1ff7a0){if(_0x1ff7a0 instanceof HTTPClientError&&_0x1ff7a0[_0x254f21(0xf3)]===0x191)return printAuthError(_0x1ff7a0),0x1;return console[_0x254f21(0x141)](a24_0x446ada['red'](_0x254f21(0x14b)+(_0x1ff7a0 instanceof Error?_0x1ff7a0['message']:String(_0x1ff7a0)))),console[_0x254f21(0x141)](_0x254f21(0x149)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x30fec6(0xec)]='profile:remove';[a24_0x30fec6(0x150)]=a24_0x30fec6(0x13e);[a24_0x30fec6(0x124)](_0x41016b){const _0x3031f3=a24_0x30fec6,{args:_0x131e42}=_0x41016b;if(_0x131e42[_0x3031f3(0x154)]===0x0)return _0x3031f3(0xf6);return undefined;}async[a24_0x30fec6(0x103)](_0x135200){const _0x572464=a24_0x30fec6,{args:_0x830b32}=_0x135200,_0x2d230b=_0x830b32[0x0];console[_0x572464(0xee)](a24_0x446ada[_0x572464(0x151)](_0x572464(0x139)));if(!profileExists(_0x2d230b)){console['error'](a24_0x446ada['red'](_0x572464(0x134)+_0x2d230b+_0x572464(0x14d))),console['log'](_0x572464(0x11b));const _0x1230a5=listProfiles();if(_0x1230a5['length']===0x0)console[_0x572464(0xee)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x53fde6 of _0x1230a5){console[_0x572464(0xee)](_0x572464(0x115)+_0x53fde6['name']);}return 0x1;}const _0x3c2076=await a24_0x7b2869({'type':_0x572464(0xfe),'name':_0x572464(0xfe),'message':_0x572464(0xfc)+_0x2d230b+'\x27?','initial':![]});if(!_0x3c2076[_0x572464(0xfe)])return console['log'](_0x572464(0x136)),0x0;try{removeProfileFromUserConfig(_0x2d230b),console['log'](a24_0x446ada[_0x572464(0x133)]('✓')+_0x572464(0x143)+_0x2d230b+_0x572464(0x13a));}catch(_0x25d869){return console[_0x572464(0x141)](a24_0x446ada[_0x572464(0x130)](_0x572464(0x12d)+(_0x25d869 instanceof Error?_0x25d869[_0x572464(0x146)]:String(_0x25d869)))),0x1;}const _0x193ac6=await isKeychainAvailable();if(_0x193ac6){const _0x439fb9=await deleteKeychainAPIKey(_0x2d230b);_0x439fb9&&console[_0x572464(0xee)](a24_0x446ada['green']('✓')+_0x572464(0xf9));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x30fec6(0xec)]=a24_0x30fec6(0x106);[a24_0x30fec6(0x150)]=a24_0x30fec6(0x102);static [a24_0x30fec6(0x119)]=['site',a24_0x30fec6(0x109),a24_0x30fec6(0x10d),'llm_project',a24_0x30fec6(0x14e),a24_0x30fec6(0x150)];['validate'](_0x13ec1d){const _0x888f2b=a24_0x30fec6,{args:_0x1387ee,options:_0x5632e2}=_0x13ec1d,_0x3d32fc=_0x5632e2[_0x888f2b(0x101)]||getActiveProfile();if(!_0x3d32fc)return _0x888f2b(0x104);if(_0x1387ee[_0x888f2b(0x154)]===0x0)return _0x888f2b(0x100)+ProfileSetCommand[_0x888f2b(0x119)][_0x888f2b(0xeb)](',\x20');const _0x5a5e91=_0x1387ee[0x0];if(!_0x5a5e91[_0x888f2b(0x144)]('='))return _0x888f2b(0x122)+ProfileSetCommand[_0x888f2b(0x119)][_0x888f2b(0xeb)](',\x20');const [_0x5a0b48]=_0x5a5e91[_0x888f2b(0x148)]('=',0x2);if(!ProfileSetCommand[_0x888f2b(0x119)][_0x888f2b(0x144)](_0x5a0b48))return _0x888f2b(0x10c)+_0x5a0b48+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x888f2b(0xeb)](',\x20');return undefined;}async['execute'](_0x3a382d){const _0xe54be7=a24_0x30fec6,{args:_0x390da0,options:_0x45b157}=_0x3a382d,_0x34b8aa=_0x45b157[_0xe54be7(0x101)]||getActiveProfile(),[_0x4f01b9,..._0x23d0cc]=_0x390da0[0x0][_0xe54be7(0x148)]('='),_0x261b47=_0x23d0cc[_0xe54be7(0xeb)]('=');console['log'](a24_0x446ada[_0xe54be7(0x151)]('tdx:\x20profile\x20set'));if(!profileExists(_0x34b8aa)){const _0x588981=await a24_0x7b2869({'type':'confirm','name':_0xe54be7(0x108),'message':_0xe54be7(0x134)+_0x34b8aa+_0xe54be7(0xf8),'initial':!![]});if(!_0x588981['create'])return console[_0xe54be7(0xee)](_0xe54be7(0x128)),0x1;}const _0x32fcbb=loadProfile(_0x34b8aa),_0x144a25=_0x32fcbb?.['config']||{};if(_0x4f01b9===_0xe54be7(0x145)){const _0x281864=resolveSite(_0x261b47);console[_0xe54be7(0xee)]('Changing\x20site\x20to\x20\x27'+_0x281864+_0xe54be7(0x132)),console[_0xe54be7(0xee)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xe54be7(0xee)]('\x20\x20'+getConsoleUrl(_0x281864,_0xe54be7(0x10f)));const _0x9114e5=await a24_0x7b2869({'type':_0xe54be7(0x11c),'name':_0xe54be7(0xfd),'message':_0xe54be7(0x138),'validate':_0x5b6456=>{const _0x3d2bae=_0xe54be7;if(!_0x5b6456||!_0x5b6456[_0x3d2bae(0xf0)]())return _0x3d2bae(0xf2);return!![];}});if(!_0x9114e5[_0xe54be7(0xfd)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0xe54be7(0xee)](_0xe54be7(0x120));try{const _0x52ca19=TDX['create']({'site':_0x281864,'apiKey':_0x9114e5[_0xe54be7(0xfd)]['trim'](),'logLevel':_0x45b157[_0xe54be7(0x14c)]??LogLevel[_0xe54be7(0x114)]}),_0x40359a=await _0x52ca19[_0xe54be7(0x111)][_0xe54be7(0x153)]();console[_0xe54be7(0xee)](a24_0x446ada['green']('✓')+_0xe54be7(0x11d)+_0x40359a[_0xe54be7(0x10a)]+')');const _0x5a5a31=await isKeychainAvailable();_0x5a5a31?(await saveAPIKeyAsync(_0x9114e5[_0xe54be7(0xfd)][_0xe54be7(0xf0)](),_0x281864,_0x34b8aa),console[_0xe54be7(0xee)](a24_0x446ada[_0xe54be7(0x133)]('✓')+_0xe54be7(0xe8))):console[_0xe54be7(0xf4)](a24_0x446ada[_0xe54be7(0xf5)](_0xe54be7(0x112))),_0x144a25[_0xe54be7(0x145)]=_0x281864;}catch(_0x52ca5a){if(_0x52ca5a instanceof HTTPClientError&&_0x52ca5a[_0xe54be7(0xf3)]===0x191)return printAuthError(_0x52ca5a),0x1;return console['error'](a24_0x446ada['red']('✗\x20Validation\x20failed:\x20'+(_0x52ca5a instanceof Error?_0x52ca5a['message']:String(_0x52ca5a)))),console[_0xe54be7(0x141)](_0xe54be7(0x12b)),0x1;}}else _0x144a25[_0x4f01b9]=_0x261b47||undefined;return saveProfileToUserConfig(_0x34b8aa,_0x144a25),console[_0xe54be7(0xee)](a24_0x446ada[_0xe54be7(0x133)]('✓')+_0xe54be7(0x143)+_0x34b8aa+_0xe54be7(0x135)+_0x4f01b9+'='+(_0x261b47||_0xe54be7(0x11f))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x30fec6(0xec)]=a24_0x30fec6(0x14f);[a24_0x30fec6(0x150)]='Set\x20session\x20profile';[a24_0x30fec6(0x124)](_0x17eee9){const _0xccb23a=a24_0x30fec6,{args:_0x4dfa9c}=_0x17eee9;if(_0x4dfa9c['length']===0x0)return _0xccb23a(0x155);return undefined;}async[a24_0x30fec6(0x103)](_0x586513){const _0x53290e=a24_0x30fec6,{args:_0xa2807c,options:_0x5acadd}=_0x586513,_0x1598ab=_0xa2807c[0x0],_0x2e61cc=_0x5acadd[_0x53290e(0x113)];cleanExpiredSessions();if(!profileExists(_0x1598ab)){console[_0x53290e(0x141)](a24_0x446ada[_0x53290e(0x130)](_0x53290e(0x134)+_0x1598ab+_0x53290e(0x14d))),console[_0x53290e(0xee)]('\x0aAvailable\x20profiles:');const _0x3d776b=listProfiles();if(_0x3d776b[_0x53290e(0x154)]===0x0)console[_0x53290e(0xee)](_0x53290e(0x11a));else for(const _0x57f678 of _0x3d776b){console[_0x53290e(0xee)](_0x53290e(0x115)+_0x57f678['name']);}return 0x1;}if(_0x2e61cc){const _0x4b3f48=a24_0xdad399[_0x53290e(0xeb)](getConfigDir(),_0x53290e(0x123));return saveActiveProfileToUserConfig(_0x1598ab),console[_0x53290e(0xee)]('Default\x20profile\x20set\x20to:\x20'+a24_0x446ada[_0x53290e(0x133)](_0x1598ab)),console[_0x53290e(0xee)](a24_0x446ada[_0x53290e(0x13d)](_0x53290e(0x121)+_0x4b3f48)),0x0;}const _0x5a9ab2=_0x5acadd['session']||getCurrentSessionPID()[_0x53290e(0x126)]();return saveSessionContext({'profile':_0x1598ab},_0x5acadd['session']),console[_0x53290e(0xee)](_0x53290e(0x10e)+a24_0x446ada['green'](_0x1598ab)+'\x20'+a24_0x446ada[_0x53290e(0x13d)](_0x53290e(0x11e)+_0x5a9ab2+')')),console[_0x53290e(0xee)](a24_0x446ada[_0x53290e(0x13d)](_0x53290e(0x117)+_0x1598ab+_0x53290e(0x118))),0x0;}}
1
+ const a24_0x5079c6=a24_0x30e9;(function(_0x4a51f9,_0x25a08c){const _0x24c011=a24_0x30e9,_0x3d14e2=_0x4a51f9();while(!![]){try{const _0x4eaab3=-parseInt(_0x24c011(0xc2))/0x1+parseInt(_0x24c011(0x7a))/0x2+-parseInt(_0x24c011(0xba))/0x3*(parseInt(_0x24c011(0x8c))/0x4)+-parseInt(_0x24c011(0xb0))/0x5+parseInt(_0x24c011(0xaf))/0x6*(-parseInt(_0x24c011(0xd6))/0x7)+-parseInt(_0x24c011(0xde))/0x8*(parseInt(_0x24c011(0xd5))/0x9)+parseInt(_0x24c011(0xdd))/0xa*(parseInt(_0x24c011(0xc7))/0xb);if(_0x4eaab3===_0x25a08c)break;else _0x3d14e2['push'](_0x3d14e2['shift']());}catch(_0x26749f){_0x3d14e2['push'](_0x3d14e2['shift']());}}}(a24_0x2cf4,0x2f3f9));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_0x429985 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_0x4eb85c from'prompts';import a24_0x378e6f from'chalk';function validateProfileName(_0x5e2d47){const _0x26bf4b=a24_0x30e9;if(!_0x5e2d47||!_0x5e2d47['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x8a9a29=_0x5e2d47['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x8a9a29))return _0x26bf4b(0xa9);if(profileExists(_0x8a9a29))return'Profile\x20\x27'+_0x8a9a29+_0x26bf4b(0x85);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x5079c6(0xa4)]=a24_0x5079c6(0xb2);[a24_0x5079c6(0x76)]=a24_0x5079c6(0xd7);async['execute'](_0xf15a98){const _0x3d16d5=a24_0x5079c6,{options:_0x1ec172,args:_0x13ddad}=_0xf15a98;console[_0x3d16d5(0x88)](a24_0x378e6f[_0x3d16d5(0xb7)]('tdx:\x20profile\x20create'));let _0x19b6fc;if(_0x13ddad[_0x3d16d5(0xb4)]>0x0&&_0x13ddad[0x0]){const _0x3e7ff7=_0x13ddad[0x0]['trim'](),_0xffb0f9=validateProfileName(_0x3e7ff7);if(_0xffb0f9!==!![])return console[_0x3d16d5(0xdc)](a24_0x378e6f[_0x3d16d5(0xc0)](_0xffb0f9)),0x1;_0x19b6fc=_0x3e7ff7;}else{const _0x3a37f2=await a24_0x4eb85c({'type':_0x3d16d5(0xd0),'name':_0x3d16d5(0xbe),'message':_0x3d16d5(0xbf),'validate':validateProfileName});if(!_0x3a37f2[_0x3d16d5(0xbe)])return console[_0x3d16d5(0x88)](_0x3d16d5(0x93)),0x1;_0x19b6fc=_0x3a37f2[_0x3d16d5(0xbe)][_0x3d16d5(0xb6)]();}const _0x4ccc53=await a24_0x4eb85c({'type':_0x3d16d5(0xd0),'name':_0x3d16d5(0x76),'message':_0x3d16d5(0x78)}),_0x4f9efe=_0x4ccc53[_0x3d16d5(0x76)]?.[_0x3d16d5(0xb6)]()||undefined,_0x585a4a=_0x1ec172['site']||_0x3d16d5(0xa8),{choices:_0x4b4821,initialIndex:_0x2a4b9b}=buildSiteChoices(_0x585a4a),_0x2053f1=await a24_0x4eb85c({'type':_0x3d16d5(0xb1),'name':_0x3d16d5(0xca),'message':_0x3d16d5(0xaa)+_0x19b6fc+'\x27:','choices':_0x4b4821,'initial':_0x2a4b9b});if(!_0x2053f1[_0x3d16d5(0xca)])return console[_0x3d16d5(0x88)]('\x0aSetup\x20cancelled'),0x1;let _0x23ccf5;if(_0x2053f1[_0x3d16d5(0xca)]===_0x3d16d5(0x94)){const _0x5d02a2=await a24_0x4eb85c({'type':_0x3d16d5(0xd0),'name':_0x3d16d5(0xdb),'message':'Enter\x20site\x20name:','initial':_0x3d16d5(0xa8),'validate':_0x22eb4d=>{const _0x2ebe5b=_0x3d16d5;if(!_0x22eb4d||!_0x22eb4d['trim']())return _0x2ebe5b(0x8d);if(!/^[a-z0-9-]+$/[_0x2ebe5b(0xab)](_0x22eb4d['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x5d02a2['customSite'])return console[_0x3d16d5(0x88)](_0x3d16d5(0x93)),0x1;_0x23ccf5=_0x5d02a2[_0x3d16d5(0xdb)];}else _0x23ccf5=_0x2053f1['site'];const _0x46f4e3=resolveSite(_0x23ccf5);console[_0x3d16d5(0x88)](_0x3d16d5(0xb5)+_0x46f4e3),console['log'](_0x3d16d5(0xb9)),console[_0x3d16d5(0x88)]('\x20\x20'+getConsoleUrl(_0x46f4e3,_0x3d16d5(0x71)));const _0x3e9b0c=await a24_0x4eb85c({'type':_0x3d16d5(0x8a),'name':_0x3d16d5(0xc5),'message':_0x3d16d5(0xd2),'validate':_0x5b07d2=>{const _0x5ac564=_0x3d16d5;if(!_0x5b07d2||!_0x5b07d2[_0x5ac564(0xb6)]())return _0x5ac564(0x9f);return!![];}});if(!_0x3e9b0c['apiKey'])return console[_0x3d16d5(0x88)](_0x3d16d5(0x93)),0x1;const _0x4728af=_0x3e9b0c[_0x3d16d5(0xc5)];console['log'](_0x3d16d5(0x7e));try{const _0x19b14f=TDX[_0x3d16d5(0xe0)]({'site':_0x46f4e3,'apiKey':_0x4728af['trim'](),'logLevel':_0x1ec172[_0x3d16d5(0x72)]??LogLevel[_0x3d16d5(0xbb)]}),_0x520872=await _0x19b14f[_0x3d16d5(0x79)][_0x3d16d5(0x77)]();console[_0x3d16d5(0x88)](a24_0x378e6f['green']('✓')+_0x3d16d5(0xce)+_0x520872[_0x3d16d5(0x9a)]+')');const _0x537ba5=await isKeychainAvailable();_0x537ba5?(await saveAPIKeyAsync(_0x4728af[_0x3d16d5(0xb6)](),_0x46f4e3,_0x19b6fc),console[_0x3d16d5(0x88)](a24_0x378e6f[_0x3d16d5(0x81)]('✓')+_0x3d16d5(0xcb)+_0x19b6fc+')')):(console[_0x3d16d5(0xa2)](a24_0x378e6f['yellow'](_0x3d16d5(0x87))),console[_0x3d16d5(0xa2)](a24_0x378e6f[_0x3d16d5(0x98)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xab8862={'site':_0x46f4e3,..._0x4f9efe&&{'description':_0x4f9efe}};return saveProfileToUserConfig(_0x19b6fc,_0xab8862),console[_0x3d16d5(0x88)](a24_0x378e6f[_0x3d16d5(0x81)]('✓')+_0x3d16d5(0x8e)+_0x19b6fc+_0x3d16d5(0x80)),console[_0x3d16d5(0x88)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x3d16d5(0xa1)+_0x19b6fc+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x3d16d5(0x88)]('\x20\x20tdx\x20--profile\x20'+_0x19b6fc+_0x3d16d5(0xcd)),0x0;}catch(_0x1d305a){if(_0x1d305a instanceof HTTPClientError&&_0x1d305a[_0x3d16d5(0xc4)]===0x191)return printAuthError(_0x1d305a),0x1;return console[_0x3d16d5(0xdc)](a24_0x378e6f[_0x3d16d5(0xc0)](_0x3d16d5(0x7f)+(_0x1d305a instanceof Error?_0x1d305a[_0x3d16d5(0xc8)]:String(_0x1d305a)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x5079c6(0xd1);[a24_0x5079c6(0x76)]=a24_0x5079c6(0x9c);['validate'](_0x5a3820){const _0x5ac806=a24_0x5079c6,{args:_0x88905d}=_0x5a3820;if(_0x88905d[_0x5ac806(0xb4)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a24_0x5079c6(0x73)](_0x4ac185){const _0xb43a39=a24_0x5079c6,{args:_0x3fdbd4}=_0x4ac185,_0x471f45=_0x3fdbd4[0x0];console[_0xb43a39(0x88)](a24_0x378e6f[_0xb43a39(0xb7)](_0xb43a39(0x96)));if(!profileExists(_0x471f45)){console[_0xb43a39(0xdc)](a24_0x378e6f[_0xb43a39(0xc0)](_0xb43a39(0xae)+_0x471f45+_0xb43a39(0x75))),console[_0xb43a39(0x88)](_0xb43a39(0xd8));const _0x2ae396=listProfiles();if(_0x2ae396[_0xb43a39(0xb4)]===0x0)console[_0xb43a39(0x88)](_0xb43a39(0xad));else for(const _0x4081ad of _0x2ae396){console[_0xb43a39(0x88)](_0xb43a39(0x9e)+_0x4081ad[_0xb43a39(0xa4)]);}return 0x1;}const _0x3565cc=await a24_0x4eb85c({'type':_0xb43a39(0xc1),'name':_0xb43a39(0xc1),'message':_0xb43a39(0x9b)+_0x471f45+'\x27?','initial':![]});if(!_0x3565cc['confirm'])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x471f45),console[_0xb43a39(0x88)](a24_0x378e6f[_0xb43a39(0x81)]('✓')+_0xb43a39(0x8e)+_0x471f45+_0xb43a39(0x7d));}catch(_0x111392){return console[_0xb43a39(0xdc)](a24_0x378e6f[_0xb43a39(0xc0)](_0xb43a39(0xe1)+(_0x111392 instanceof Error?_0x111392['message']:String(_0x111392)))),0x1;}const _0x58aacb=await isKeychainAvailable();if(_0x58aacb){const _0x3b0daa=await deleteKeychainAPIKey(_0x471f45);_0x3b0daa&&console[_0xb43a39(0x88)](a24_0x378e6f[_0xb43a39(0x81)]('✓')+_0xb43a39(0xbd));}return 0x0;}}function a24_0x2cf4(){const _0x948f0e=['\x27\x20requires\x20API\x20key\x20validation.','\x27\x20removed\x20from\x20configuration','Validating\x20API\x20key...','✗\x20Validation\x20failed:\x20','\x27\x20created','green','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20--default\x27\x20to\x20save\x20permanently','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','(cleared)','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','log','validate','password','VALID_KEYS','127012GKGAGD','Site\x20name\x20cannot\x20be\x20empty','\x20Profile\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20set','parent_segment','Operation\x20cancelled','\x0aSetup\x20cancelled','other','\x0aOperation\x20cancelled','tdx:\x20profile\x20remove','Default\x20profile\x20set\x20to:\x20','yellow','\x0aSaved\x20to:\x20','email','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Remove\x20a\x20profile','toString','\x20\x20-\x20','API\x20key\x20cannot\x20be\x20empty','Unknown\x20key\x20\x27','\x20\x20tdx\x20--profile\x20','warn','tdx.json','name','\x27\x20updated:\x20','Set\x20a\x20profile\x20configuration\x20value','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','us01','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','test','config','\x20\x20(no\x20profiles\x20found)','Profile\x20\x27','114FRHLAA','667600peCwEW','select','profile:create','includes','length','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','trim','bold','split','You\x20can\x20find\x20your\x20API\x20key\x20at:','9ElDQKd','ERROR','profile','\x20API\x20key\x20removed\x20from\x20system\x20keychain','profileName','Enter\x20profile\x20name:','red','confirm','111748MagLPq','Changing\x20site\x20to\x20\x27','status','apiKey','(session:\x20','52712pqeETa','message','Site\x20was\x20not\x20changed.','site','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','llm_project','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20API\x20key\x20is\x20valid\x20(User:\x20','join','text','profile:remove','Enter\x20your\x20TD\x20API\x20key:','session','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','3330GMmvRR','7623ZbFjCl','Create\x20a\x20new\x20profile','\x0aAvailable\x20profiles:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','default','customSite','error','1180MTSnUF','1048KjJdpJ','dim','create','Failed\x20to\x20remove\x20profile:\x20','/app/mp/ak','logLevel','execute','database','\x27\x20does\x20not\x20exist.','description','getUserInfo','Enter\x20description\x20(optional):','jobs','75522ACHmkz','profile:set'];a24_0x2cf4=function(){return _0x948f0e;};return a24_0x2cf4();}export class ProfileSetCommand extends BaseCommand{[a24_0x5079c6(0xa4)]=a24_0x5079c6(0x7b);['description']=a24_0x5079c6(0xa6);static [a24_0x5079c6(0x8b)]=[a24_0x5079c6(0xca),a24_0x5079c6(0x74),a24_0x5079c6(0x91),a24_0x5079c6(0xcc),'llm_agent',a24_0x5079c6(0x76)];[a24_0x5079c6(0x89)](_0x5a94bc){const _0x534432=a24_0x5079c6,{args:_0x23fba9,options:_0x9eb08b}=_0x5a94bc,_0xb26c7f=_0x9eb08b[_0x534432(0xbc)]||getActiveProfile();if(!_0xb26c7f)return'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>';if(_0x23fba9['length']===0x0)return _0x534432(0x8f)+ProfileSetCommand['VALID_KEYS'][_0x534432(0xcf)](',\x20');const _0x2f7f61=_0x23fba9[0x0];if(!_0x2f7f61[_0x534432(0xb3)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x534432(0x8b)][_0x534432(0xcf)](',\x20');const [_0x3ca626]=_0x2f7f61[_0x534432(0xb8)]('=',0x2);if(!ProfileSetCommand[_0x534432(0x8b)]['includes'](_0x3ca626))return _0x534432(0xa0)+_0x3ca626+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x534432(0x8b)][_0x534432(0xcf)](',\x20');return undefined;}async['execute'](_0x216ff6){const _0x1bcc48=a24_0x5079c6,{args:_0x2460a3,options:_0x53990a}=_0x216ff6,_0x5092b7=_0x53990a[_0x1bcc48(0xbc)]||getActiveProfile(),[_0xb3cee2,..._0x4f3a97]=_0x2460a3[0x0][_0x1bcc48(0xb8)]('='),_0x217c46=_0x4f3a97['join']('=');console[_0x1bcc48(0x88)](a24_0x378e6f['bold'](_0x1bcc48(0x90)));if(!profileExists(_0x5092b7)){const _0x493481=await a24_0x4eb85c({'type':_0x1bcc48(0xc1),'name':_0x1bcc48(0xe0),'message':_0x1bcc48(0xae)+_0x5092b7+_0x1bcc48(0xd9),'initial':!![]});if(!_0x493481[_0x1bcc48(0xe0)])return console[_0x1bcc48(0x88)](_0x1bcc48(0x92)),0x1;}const _0x4de8bf=loadProfile(_0x5092b7),_0x3ab107=_0x4de8bf?.[_0x1bcc48(0xac)]||{};if(_0xb3cee2==='site'){const _0x3e9a3f=resolveSite(_0x217c46);console[_0x1bcc48(0x88)](_0x1bcc48(0xc3)+_0x3e9a3f+_0x1bcc48(0x7c)),console[_0x1bcc48(0x88)](_0x1bcc48(0xd4)),console[_0x1bcc48(0x88)]('\x20\x20'+getConsoleUrl(_0x3e9a3f,_0x1bcc48(0x71)));const _0x2e253d=await a24_0x4eb85c({'type':_0x1bcc48(0x8a),'name':_0x1bcc48(0xc5),'message':_0x1bcc48(0x84),'validate':_0x4f40f5=>{const _0x4782bb=_0x1bcc48;if(!_0x4f40f5||!_0x4f40f5[_0x4782bb(0xb6)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2e253d[_0x1bcc48(0xc5)])return console[_0x1bcc48(0x88)](_0x1bcc48(0x95)),0x1;console[_0x1bcc48(0x88)]('Validating\x20API\x20key...');try{const _0x212a3e=TDX[_0x1bcc48(0xe0)]({'site':_0x3e9a3f,'apiKey':_0x2e253d[_0x1bcc48(0xc5)][_0x1bcc48(0xb6)](),'logLevel':_0x53990a['logLevel']??LogLevel[_0x1bcc48(0xbb)]}),_0x348664=await _0x212a3e['jobs'][_0x1bcc48(0x77)]();console[_0x1bcc48(0x88)](a24_0x378e6f[_0x1bcc48(0x81)]('✓')+_0x1bcc48(0xce)+_0x348664[_0x1bcc48(0x9a)]+')');const _0x55d492=await isKeychainAvailable();_0x55d492?(await saveAPIKeyAsync(_0x2e253d[_0x1bcc48(0xc5)]['trim'](),_0x3e9a3f,_0x5092b7),console[_0x1bcc48(0x88)](a24_0x378e6f[_0x1bcc48(0x81)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x1bcc48(0xa2)](a24_0x378e6f[_0x1bcc48(0x98)](_0x1bcc48(0x87))),_0x3ab107[_0x1bcc48(0xca)]=_0x3e9a3f;}catch(_0x1e69d4){if(_0x1e69d4 instanceof HTTPClientError&&_0x1e69d4[_0x1bcc48(0xc4)]===0x191)return printAuthError(_0x1e69d4),0x1;return console[_0x1bcc48(0xdc)](a24_0x378e6f[_0x1bcc48(0xc0)](_0x1bcc48(0x7f)+(_0x1e69d4 instanceof Error?_0x1e69d4['message']:String(_0x1e69d4)))),console['error'](_0x1bcc48(0xc9)),0x1;}}else _0x3ab107[_0xb3cee2]=_0x217c46||undefined;return saveProfileToUserConfig(_0x5092b7,_0x3ab107),console['log'](a24_0x378e6f['green']('✓')+_0x1bcc48(0x8e)+_0x5092b7+_0x1bcc48(0xa5)+_0xb3cee2+'='+(_0x217c46||_0x1bcc48(0x86))),0x0;}}function a24_0x30e9(_0x3fae2d,_0x25d21c){_0x3fae2d=_0x3fae2d-0x71;const _0x2cf417=a24_0x2cf4();let _0x30e9e7=_0x2cf417[_0x3fae2d];return _0x30e9e7;}export class ProfileUseCommand extends BaseCommand{[a24_0x5079c6(0xa4)]='profile:use';[a24_0x5079c6(0x76)]='Set\x20session\x20profile';['validate'](_0x6e5808){const _0x1ee858=a24_0x5079c6,{args:_0x2ab708}=_0x6e5808;if(_0x2ab708[_0x1ee858(0xb4)]===0x0)return _0x1ee858(0xa7);return undefined;}async[a24_0x5079c6(0x73)](_0x33b540){const _0x22999e=a24_0x5079c6,{args:_0x2093e4,options:_0x407db2}=_0x33b540,_0x4c7ba1=_0x2093e4[0x0],_0x4491c6=_0x407db2[_0x22999e(0xda)];cleanExpiredSessions();if(!profileExists(_0x4c7ba1)){console[_0x22999e(0xdc)](a24_0x378e6f[_0x22999e(0xc0)](_0x22999e(0xae)+_0x4c7ba1+_0x22999e(0x75))),console[_0x22999e(0x88)](_0x22999e(0xd8));const _0x3a2060=listProfiles();if(_0x3a2060[_0x22999e(0xb4)]===0x0)console[_0x22999e(0x88)](_0x22999e(0xad));else for(const _0x17b09f of _0x3a2060){console[_0x22999e(0x88)](_0x22999e(0x9e)+_0x17b09f[_0x22999e(0xa4)]);}return 0x1;}if(_0x4491c6){const _0x1d3f19=a24_0x429985[_0x22999e(0xcf)](getConfigDir(),_0x22999e(0xa3));return saveActiveProfileToUserConfig(_0x4c7ba1),console[_0x22999e(0x88)](_0x22999e(0x97)+a24_0x378e6f['green'](_0x4c7ba1)),console[_0x22999e(0x88)](a24_0x378e6f[_0x22999e(0xdf)](_0x22999e(0x99)+_0x1d3f19)),0x0;}const _0x29bd87=_0x407db2[_0x22999e(0xd3)]||getCurrentSessionPID()[_0x22999e(0x9d)]();return saveSessionContext({'profile':_0x4c7ba1},_0x407db2[_0x22999e(0xd3)]),console[_0x22999e(0x88)]('Session\x20profile\x20set\x20to:\x20'+a24_0x378e6f[_0x22999e(0x81)](_0x4c7ba1)+'\x20'+a24_0x378e6f['dim'](_0x22999e(0xc6)+_0x29bd87+')')),console['log'](a24_0x378e6f['dim'](_0x22999e(0x82)+_0x4c7ba1+_0x22999e(0x83))),0x0;}}
@@ -1 +1 @@
1
- const a25_0x634d50=a25_0xef88;(function(_0x5680c0,_0x17f3bc){const _0x49a116=a25_0xef88,_0x545181=_0x5680c0();while(!![]){try{const _0x177923=-parseInt(_0x49a116(0x178))/0x1+-parseInt(_0x49a116(0x179))/0x2*(-parseInt(_0x49a116(0x17e))/0x3)+parseInt(_0x49a116(0x18b))/0x4*(parseInt(_0x49a116(0x18a))/0x5)+parseInt(_0x49a116(0x174))/0x6+parseInt(_0x49a116(0x188))/0x7+-parseInt(_0x49a116(0x182))/0x8+-parseInt(_0x49a116(0x177))/0x9;if(_0x177923===_0x17f3bc)break;else _0x545181['push'](_0x545181['shift']());}catch(_0x31e607){_0x545181['push'](_0x545181['shift']());}}}(a25_0x3ed0,0x84b4b));function a25_0x3ed0(){const _0x3d4323=['3264558wBUiWW','Error:\x20','description','7536015fAbcSs','64913TAsgYp','4EgvHCU','length','name','message','error','99906PZcQgr','profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','scope','877520EuPZxh','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','log','config','List\x20all\x20available\x20profiles','5662223fWuTUw','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','1275zPuJjo','2132cMRwSq'];a25_0x3ed0=function(){return _0x3d4323;};return a25_0x3ed0();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0xef88(_0x12515b,_0x46a410){_0x12515b=_0x12515b-0x174;const _0x3ed082=a25_0x3ed0();let _0xef887f=_0x3ed082[_0x12515b];return _0xef887f;}export class ProfilesCommand extends BaseCommand{[a25_0x634d50(0x17b)]=a25_0x634d50(0x17f);[a25_0x634d50(0x176)]=a25_0x634d50(0x187);async['execute'](_0x4a4028){const _0x35c1fb=a25_0x634d50,{options:_0xcc0efd}=_0x4a4028;try{const _0x4d86c8=listProfiles(),_0x1c35bd=getActiveProfile();if(_0x4d86c8[_0x35c1fb(0x17a)]===0x0)return console[_0x35c1fb(0x185)](_0x35c1fb(0x189)),console[_0x35c1fb(0x185)](_0x35c1fb(0x180)),console[_0x35c1fb(0x185)](_0x35c1fb(0x184)),0x0;const _0x147adf=_0x4d86c8[_0x35c1fb(0x183)](_0x374abc=>{const _0x63d42b=_0x35c1fb,_0x39b5b1=_0x374abc[_0x63d42b(0x17b)]===_0x1c35bd,_0x2f98b9=getProfileParams(_0x374abc[_0x63d42b(0x186)]);return{'name':_0x374abc[_0x63d42b(0x17b)],'active':_0x39b5b1,'scope':_0x374abc[_0x63d42b(0x181)],'description':_0x374abc[_0x63d42b(0x186)]['description']||'','params':_0x2f98b9};});return await handleSDKOutput(_0x147adf,_0xcc0efd),0x0;}catch(_0x46a655){return _0x46a655 instanceof Error&&console[_0x35c1fb(0x17d)](_0x35c1fb(0x175)+_0x46a655[_0x35c1fb(0x17c)]),0x1;}}}
1
+ function a25_0x2509(_0x4e0bc6,_0x1a683f){_0x4e0bc6=_0x4e0bc6-0xa7;const _0x1d5d8f=a25_0x1d5d();let _0x250952=_0x1d5d8f[_0x4e0bc6];return _0x250952;}const a25_0x32c4e3=a25_0x2509;function a25_0x1d5d(){const _0x6b052a=['error','3334170NAjAEn','config','List\x20all\x20available\x20profiles','length','log','283RABBIC','11247032EBlBxV','9003861JxBqyG','map','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','10qpAyTM','5424764SPrSMJ','message','profiles','634gAgxrW','description','5ApbBUL','3376572BYkAhc','391344RrsTmz','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a25_0x1d5d=function(){return _0x6b052a;};return a25_0x1d5d();}(function(_0x191878,_0x1fc116){const _0x3f5052=a25_0x2509,_0x3311bd=_0x191878();while(!![]){try{const _0x566e47=-parseInt(_0x3f5052(0xb6))/0x1*(-parseInt(_0x3f5052(0xaa))/0x2)+-parseInt(_0x3f5052(0xae))/0x3+parseInt(_0x3f5052(0xa7))/0x4*(-parseInt(_0x3f5052(0xac))/0x5)+-parseInt(_0x3f5052(0xad))/0x6+parseInt(_0x3f5052(0xb1))/0x7+parseInt(_0x3f5052(0xb7))/0x8+-parseInt(_0x3f5052(0xb8))/0x9*(-parseInt(_0x3f5052(0xbc))/0xa);if(_0x566e47===_0x1fc116)break;else _0x3311bd['push'](_0x3311bd['shift']());}catch(_0x22bae7){_0x3311bd['push'](_0x3311bd['shift']());}}}(a25_0x1d5d,0xe1530));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a25_0x32c4e3(0xbb)]=a25_0x32c4e3(0xa9);[a25_0x32c4e3(0xab)]=a25_0x32c4e3(0xb3);async['execute'](_0x5db34f){const _0x58c88e=a25_0x32c4e3,{options:_0x604d23}=_0x5db34f;try{const _0x417005=listProfiles(),_0xf0c42=getActiveProfile();if(_0x417005[_0x58c88e(0xb4)]===0x0)return console[_0x58c88e(0xb5)](_0x58c88e(0xaf)),console['log'](_0x58c88e(0xba)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x4c1a26=_0x417005[_0x58c88e(0xb9)](_0x201099=>{const _0x34b2c3=_0x58c88e,_0x5c9c3d=_0x201099[_0x34b2c3(0xbb)]===_0xf0c42,_0x4f741f=getProfileParams(_0x201099[_0x34b2c3(0xb2)]);return{'name':_0x201099[_0x34b2c3(0xbb)],'active':_0x5c9c3d,'scope':_0x201099['scope'],'description':_0x201099[_0x34b2c3(0xb2)][_0x34b2c3(0xab)]||'','params':_0x4f741f};});return await handleSDKOutput(_0x4c1a26,_0x604d23),0x0;}catch(_0x2c8d14){return _0x2c8d14 instanceof Error&&console[_0x58c88e(0xb0)]('Error:\x20'+_0x2c8d14[_0x58c88e(0xa8)]),0x1;}}}
@@ -1 +1 @@
1
- const a26_0x54c06b=a26_0x2986;(function(_0x471f3d,_0x4fef89){const _0x461f7f=a26_0x2986,_0x18f604=_0x471f3d();while(!![]){try{const _0x4fbe30=parseInt(_0x461f7f(0x12f))/0x1*(parseInt(_0x461f7f(0x14f))/0x2)+-parseInt(_0x461f7f(0x13b))/0x3*(parseInt(_0x461f7f(0x156))/0x4)+-parseInt(_0x461f7f(0x155))/0x5*(parseInt(_0x461f7f(0x128))/0x6)+-parseInt(_0x461f7f(0x152))/0x7+-parseInt(_0x461f7f(0x133))/0x8*(-parseInt(_0x461f7f(0x120))/0x9)+-parseInt(_0x461f7f(0x157))/0xa*(parseInt(_0x461f7f(0x140))/0xb)+parseInt(_0x461f7f(0x137))/0xc;if(_0x4fbe30===_0x4fef89)break;else _0x18f604['push'](_0x18f604['shift']());}catch(_0x349404){_0x18f604['push'](_0x18f604['shift']());}}}(a26_0x4a6b,0xab752));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';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';function a26_0x4a6b(){const _0x3401e0=['25yDpuTS','676524MRwjrD','227260hNRiuo','output','63117wvpMdG','error','length','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','setExtra','SQL:\x20','Statement\x20','Executing\x20query\x20[','1622412iVkQYj','\x20-\x20','originalMessage','setJobId','catalog','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','information_schema','40147tBUzZp','options','data','stats','1256HCcivV','message','args','processedRows','26104464vGMXQt','...','setPhase','jobId','21FQGSuu','Site:\x20','execute','Schema:\x20','Executing\x20statement\x20','550dIyLke','in\x20','\x20rows\x20','join','file','elapsedTimeMillis','No\x20SQL\x20provided','completedSplits','verbose','site','totalSplits','\x20splits','\x0aAll\x20results\x20saved\x20to\x20','validate','database','66etcOrN','\x20[Job\x20ID:\x20','query','1587229WuAEFn','description','Error:\x20'];a26_0x4a6b=function(){return _0x3401e0;};return a26_0x4a6b();}function a26_0x2986(_0x755fa7,_0x27fadc){_0x755fa7=_0x755fa7-0x11f;const _0x4a6b8d=a26_0x4a6b();let _0x2986bf=_0x4a6b8d[_0x755fa7];return _0x2986bf;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x54c06b(0x151);[a26_0x54c06b(0x153)]='Run\x20Trino\x20queries\x20(streaming)';async[a26_0x54c06b(0x13d)](_0x43c371){const _0x301257=a26_0x54c06b,{options:_0x215b0e,args:_0x576b1e,tdx:_0x2b03fb}=_0x43c371,_0x4d8b8a=_0x576b1e[0x0],_0x2e1afe=_0x215b0e[_0x301257(0x144)];let _0x2fae93;try{if(_0x2e1afe)_0x2fae93=readSqlStatementsFromFile(_0x2e1afe);else{if(_0x4d8b8a==='-')_0x2fae93=await readSqlStatementsFromStdin();else{if(_0x4d8b8a&&isSqlFilePath(_0x4d8b8a))_0x2fae93=readSqlStatementsFromFile(_0x4d8b8a);else{if(_0x4d8b8a)_0x2fae93=splitSqlStatements(_0x4d8b8a);else throw new Error(_0x301257(0x146));}}}}catch(_0x31fe71){return console[_0x301257(0x121)](_0x301257(0x154)+_0x31fe71[_0x301257(0x134)]),0x1;}const _0x28cd84=_0x215b0e[_0x301257(0x14e)]||_0x301257(0x12e),_0x4bf99c=_0x215b0e[_0x301257(0x12c)];try{const _0x3cbc39=[],_0x2e26cf=!!_0x215b0e[_0x301257(0x11f)];for(let _0x3d73ef=0x0;_0x3d73ef<_0x2fae93[_0x301257(0x122)];_0x3d73ef++){const _0x43fdfd=_0x2fae93[_0x3d73ef],_0x268ed0=_0x3d73ef+0x1,_0x592e51=_0x2fae93['length'],_0x41b77a=_0x592e51>0x1;_0x215b0e[_0x301257(0x148)]&&(console[_0x301257(0x121)]('\x0a'+(_0x41b77a?'Statement\x20'+_0x268ed0+'/'+_0x592e51+':':'')),console[_0x301257(0x121)](_0x301257(0x13c)+_0x215b0e[_0x301257(0x149)]),console[_0x301257(0x121)]('Catalog:\x20'+(_0x4bf99c||'td')),console[_0x301257(0x121)](_0x301257(0x13e)+_0x28cd84),console[_0x301257(0x121)](_0x301257(0x125)+_0x43fdfd));const _0x4108cf=_0x41b77a?_0x301257(0x13f)+_0x268ed0+'/'+_0x592e51+_0x301257(0x138):'Executing\x20query...';try{const _0x814a53=await withProgressSpinner(_0x4108cf,async _0x32b34e=>{const _0x42e3ee=_0x301257,_0xd4c450=await _0x2b03fb[_0x42e3ee(0x151)]['execute'](_0x43fdfd,{'catalog':_0x4bf99c,'schema':_0x28cd84,'onJobId':_0xec1b22=>{const _0x19c069=_0x42e3ee;_0x32b34e[_0x19c069(0x12b)](_0xec1b22);},'onProgress':_0x1fb180=>{const _0x38fbc9=_0x42e3ee;_0x32b34e[_0x38fbc9(0x139)](_0x38fbc9(0x127)+_0x1fb180['state']+']'),_0x32b34e[_0x38fbc9(0x124)](formatRows(_0x1fb180[_0x38fbc9(0x136)])+_0x38fbc9(0x142)+_0x1fb180[_0x38fbc9(0x147)]+'/'+_0x1fb180[_0x38fbc9(0x14a)]+_0x38fbc9(0x14b));}});return _0xd4c450;},{'verbose':_0x215b0e[_0x301257(0x148)]}),_0x418588=_0x814a53[_0x301257(0x131)],_0x249254=_0x418588['jobId']?_0x301257(0x150)+_0x418588[_0x301257(0x13a)]+']':'',_0x4b6481=_0x41b77a?_0x301257(0x126)+_0x268ed0+'/'+_0x592e51+_0x301257(0x129):'';console[_0x301257(0x121)]('✔\x20'+_0x4b6481+'Query\x20completed:\x20Processed\x20'+formatRows(_0x418588[_0x301257(0x132)][_0x301257(0x136)])+_0x301257(0x142)+(_0x301257(0x141)+formatElapsed(_0x418588[_0x301257(0x132)][_0x301257(0x145)])+_0x249254));if(_0x41b77a&&_0x2e26cf){const _0x225e6a=resolveOutputOptions(_0x215b0e),_0x48a414=await formatQueryOutput(_0x418588,_0x225e6a);_0x3cbc39['push'](_0x48a414);}else await handleQueryOutput(_0x418588,_0x215b0e);}catch(_0x385440){const _0x4750a6=_0x41b77a?_0x301257(0x126)+_0x268ed0+'/'+_0x592e51+':\x0a':'',_0x2ed9f9=_0x385440 instanceof SDKError?_0x385440[_0x301257(0x12a)]:_0x385440[_0x301257(0x134)];return console[_0x301257(0x121)](''+_0x4750a6+_0x2ed9f9),0x1;}}if(_0x2fae93['length']>0x1&&_0x2e26cf&&_0x3cbc39[_0x301257(0x122)]>0x0){const _0xec7b2d=_0x3cbc39[_0x301257(0x143)]('\x0a');writeFileSync(_0x215b0e['output'],_0xec7b2d),console[_0x301257(0x121)](_0x301257(0x14c)+_0x215b0e['output']);}return 0x0;}catch(_0x390df0){throw _0x390df0;}}[a26_0x54c06b(0x14d)](_0x1bd101){const _0x1f1343=a26_0x54c06b,_0x477519=_0x1bd101[_0x1f1343(0x135)][0x0],_0x58da34=_0x1bd101[_0x1f1343(0x130)]['file'];if(!_0x477519&&!_0x58da34)return _0x1f1343(0x123);if(_0x477519&&_0x58da34)return _0x1f1343(0x12d);return undefined;}}
1
+ const a26_0x22e002=a26_0x44f1;(function(_0x63f59,_0xd40ce5){const _0x53b283=a26_0x44f1,_0x1b101e=_0x63f59();while(!![]){try{const _0x4426cb=parseInt(_0x53b283(0x1fc))/0x1*(parseInt(_0x53b283(0x1e1))/0x2)+parseInt(_0x53b283(0x1f8))/0x3*(parseInt(_0x53b283(0x1e2))/0x4)+parseInt(_0x53b283(0x1ff))/0x5*(parseInt(_0x53b283(0x1f5))/0x6)+parseInt(_0x53b283(0x1d9))/0x7+-parseInt(_0x53b283(0x1ef))/0x8+parseInt(_0x53b283(0x1d6))/0x9+parseInt(_0x53b283(0x1e0))/0xa*(-parseInt(_0x53b283(0x209))/0xb);if(_0x4426cb===_0xd40ce5)break;else _0x1b101e['push'](_0x1b101e['shift']());}catch(_0x2c3edb){_0x1b101e['push'](_0x1b101e['shift']());}}}(a26_0x1a37,0x46968));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';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';function a26_0x1a37(){const _0xd2a887=['Site:\x20','155Zvlrhg','jobId','output','args','stats','setPhase','Executing\x20statement\x20','setJobId','SQL:\x20','catalog','604571RMAOvS','Statement\x20','validate','setExtra','202293NuLMkB','message','push','3667909EwwcvZ','query','Executing\x20query\x20[','Schema:\x20','state','\x20splits','processedRows','150ATqPmu','4570ZNSgBx','333472hZCaKL','originalMessage','\x20rows\x20','site','No\x20SQL\x20provided','Query\x20completed:\x20Processed\x20','Executing\x20query...','elapsedTimeMillis','options','data','verbose','completedSplits','length','2419592PqNEsS','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','...','database','Error:\x20','execute','102426TNxmcu','description','file','12yMFJcf','Run\x20Trino\x20queries\x20(streaming)','information_schema','error','3SWaIcz','in\x20'];a26_0x1a37=function(){return _0xd2a887;};return a26_0x1a37();}function a26_0x44f1(_0x3bc0d5,_0x5cd6d8){_0x3bc0d5=_0x3bc0d5-0x1d6;const _0x1a372f=a26_0x1a37();let _0x44f11e=_0x1a372f[_0x3bc0d5];return _0x44f11e;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x22e002(0x1da);[a26_0x22e002(0x1f6)]=a26_0x22e002(0x1f9);async['execute'](_0x439514){const _0x5233b0=a26_0x22e002,{options:_0x18d648,args:_0x363a2a,tdx:_0x40dc6f}=_0x439514,_0x183994=_0x363a2a[0x0],_0x385b10=_0x18d648[_0x5233b0(0x1f7)];let _0x398a5a;try{if(_0x385b10)_0x398a5a=readSqlStatementsFromFile(_0x385b10);else{if(_0x183994==='-')_0x398a5a=await readSqlStatementsFromStdin();else{if(_0x183994&&isSqlFilePath(_0x183994))_0x398a5a=readSqlStatementsFromFile(_0x183994);else{if(_0x183994)_0x398a5a=splitSqlStatements(_0x183994);else throw new Error(_0x5233b0(0x1e6));}}}}catch(_0x296802){return console[_0x5233b0(0x1fb)](_0x5233b0(0x1f3)+_0x296802[_0x5233b0(0x1d7)]),0x1;}const _0x283df5=_0x18d648[_0x5233b0(0x1f2)]||_0x5233b0(0x1fa),_0x176d96=_0x18d648[_0x5233b0(0x208)];try{const _0x2da619=[],_0x4e1c97=!!_0x18d648[_0x5233b0(0x201)];for(let _0x3b4f9b=0x0;_0x3b4f9b<_0x398a5a[_0x5233b0(0x1ee)];_0x3b4f9b++){const _0x4bb4cc=_0x398a5a[_0x3b4f9b],_0x359fbd=_0x3b4f9b+0x1,_0x205970=_0x398a5a['length'],_0xd1f258=_0x205970>0x1;_0x18d648[_0x5233b0(0x1ec)]&&(console[_0x5233b0(0x1fb)]('\x0a'+(_0xd1f258?_0x5233b0(0x20a)+_0x359fbd+'/'+_0x205970+':':'')),console[_0x5233b0(0x1fb)](_0x5233b0(0x1fe)+_0x18d648[_0x5233b0(0x1e5)]),console['error']('Catalog:\x20'+(_0x176d96||'td')),console['error'](_0x5233b0(0x1dc)+_0x283df5),console[_0x5233b0(0x1fb)](_0x5233b0(0x207)+_0x4bb4cc));const _0x4f2dcc=_0xd1f258?_0x5233b0(0x205)+_0x359fbd+'/'+_0x205970+_0x5233b0(0x1f1):_0x5233b0(0x1e8);try{const _0x281f48=await withProgressSpinner(_0x4f2dcc,async _0x32d18d=>{const _0x7d1a01=_0x5233b0,_0x56d9f1=await _0x40dc6f['query'][_0x7d1a01(0x1f4)](_0x4bb4cc,{'catalog':_0x176d96,'schema':_0x283df5,'onJobId':_0x931fd5=>{const _0x10ccd0=_0x7d1a01;_0x32d18d[_0x10ccd0(0x206)](_0x931fd5);},'onProgress':_0x3ee7cb=>{const _0x992ea1=_0x7d1a01;_0x32d18d[_0x992ea1(0x204)](_0x992ea1(0x1db)+_0x3ee7cb[_0x992ea1(0x1dd)]+']'),_0x32d18d[_0x992ea1(0x20c)](formatRows(_0x3ee7cb[_0x992ea1(0x1df)])+'\x20rows\x20'+_0x3ee7cb[_0x992ea1(0x1ed)]+'/'+_0x3ee7cb['totalSplits']+_0x992ea1(0x1de));}});return _0x56d9f1;},{'verbose':_0x18d648[_0x5233b0(0x1ec)]}),_0x182102=_0x281f48[_0x5233b0(0x1eb)],_0x52a7b5=_0x182102[_0x5233b0(0x200)]?'\x20[Job\x20ID:\x20'+_0x182102[_0x5233b0(0x200)]+']':'',_0x16c961=_0xd1f258?_0x5233b0(0x20a)+_0x359fbd+'/'+_0x205970+'\x20-\x20':'';console['error']('✔\x20'+_0x16c961+_0x5233b0(0x1e7)+formatRows(_0x182102[_0x5233b0(0x203)][_0x5233b0(0x1df)])+_0x5233b0(0x1e4)+(_0x5233b0(0x1fd)+formatElapsed(_0x182102['stats'][_0x5233b0(0x1e9)])+_0x52a7b5));if(_0xd1f258&&_0x4e1c97){const _0x25520f=resolveOutputOptions(_0x18d648),_0x3d37cd=await formatQueryOutput(_0x182102,_0x25520f);_0x2da619[_0x5233b0(0x1d8)](_0x3d37cd);}else await handleQueryOutput(_0x182102,_0x18d648);}catch(_0x139d29){const _0x4ad1f8=_0xd1f258?_0x5233b0(0x20a)+_0x359fbd+'/'+_0x205970+':\x0a':'',_0x2ec65a=_0x139d29 instanceof SDKError?_0x139d29[_0x5233b0(0x1e3)]:_0x139d29[_0x5233b0(0x1d7)];return console['error'](''+_0x4ad1f8+_0x2ec65a),0x1;}}if(_0x398a5a[_0x5233b0(0x1ee)]>0x1&&_0x4e1c97&&_0x2da619[_0x5233b0(0x1ee)]>0x0){const _0x1fef4a=_0x2da619['join']('\x0a');writeFileSync(_0x18d648[_0x5233b0(0x201)],_0x1fef4a),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x18d648[_0x5233b0(0x201)]);}return 0x0;}catch(_0x2f5b4e){throw _0x2f5b4e;}}[a26_0x22e002(0x20b)](_0x5e17dd){const _0x486514=a26_0x22e002,_0x4177e2=_0x5e17dd[_0x486514(0x202)][0x0],_0x4d8416=_0x5e17dd[_0x486514(0x1ea)]['file'];if(!_0x4177e2&&!_0x4d8416)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(_0x4177e2&&_0x4d8416)return _0x486514(0x1f0);return undefined;}}