@treasuredata/tdx 2026.3.3 → 2026.3.5

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 (197) 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/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/engage-template-pull-command.js +1 -1
  24. package/dist/commands/engage-template-push-command.js +1 -1
  25. package/dist/commands/engage-template-validate-command.js +1 -1
  26. package/dist/commands/job-command.js +1 -1
  27. package/dist/commands/journey-command.js +1 -1
  28. package/dist/commands/journey-validate-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/mcp-command.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profile-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/schedule-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segment-validate-command.js +1 -1
  44. package/dist/commands/segments.js +1 -1
  45. package/dist/commands/show.js +1 -1
  46. package/dist/commands/status-command.js +1 -1
  47. package/dist/commands/tables.js +1 -1
  48. package/dist/commands/unset-command.js +1 -1
  49. package/dist/commands/upgrade-command.js +1 -1
  50. package/dist/commands/use-command.js +1 -1
  51. package/dist/commands/user-command.js +1 -1
  52. package/dist/commands/workflow-command.js +1 -1
  53. package/dist/core/auth.js +1 -1
  54. package/dist/core/command-output.js +1 -1
  55. package/dist/core/config.js +1 -1
  56. package/dist/core/connection-cache.js +1 -1
  57. package/dist/core/constants.js +1 -1
  58. package/dist/core/credential-cache.js +1 -1
  59. package/dist/core/global-context.js +1 -1
  60. package/dist/core/keychain.js +1 -1
  61. package/dist/core/profile.js +1 -1
  62. package/dist/core/project-config.js +1 -1
  63. package/dist/core/session.js +1 -1
  64. package/dist/core/user-cache.js +1 -1
  65. package/dist/core/version.js +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/mcp/server.js +1 -1
  68. package/dist/mcp/tools/index.js +1 -1
  69. package/dist/mcp/tools/tdx-run.js +1 -1
  70. package/dist/mcp/tools/tdx-search.js +1 -1
  71. package/dist/mcp/utils.js +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/passthrough-server.js +1 -1
  74. package/dist/proxy/sse-usage-parser.js +1 -1
  75. package/dist/sdk/agent/agent-config.js +1 -1
  76. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  77. package/dist/sdk/agent/agent-yaml.js +1 -1
  78. package/dist/sdk/agent/test/evaluator.js +1 -1
  79. package/dist/sdk/agent/test/executor.js +1 -1
  80. package/dist/sdk/agent/test/index.js +1 -1
  81. package/dist/sdk/agent/test/output.js +1 -1
  82. package/dist/sdk/agent/test/parser.js +1 -1
  83. package/dist/sdk/agent/tool-target-registry.js +1 -1
  84. package/dist/sdk/api.js +1 -1
  85. package/dist/sdk/client/cdp-api-client.js +1 -1
  86. package/dist/sdk/client/delivery-api-client.js +1 -1
  87. package/dist/sdk/client/endpoints.js +1 -1
  88. package/dist/sdk/client/engage-api-client.js +1 -1
  89. package/dist/sdk/client/http-client.js +1 -1
  90. package/dist/sdk/client/llm-api-client.js +1 -1
  91. package/dist/sdk/client/rate-limiter.js +1 -1
  92. package/dist/sdk/client/td-api-client.js +1 -1
  93. package/dist/sdk/client/trino-api-client.js +1 -1
  94. package/dist/sdk/client/workflow-client.js +1 -1
  95. package/dist/sdk/connection-validator.js +1 -1
  96. package/dist/sdk/connection.js +1 -1
  97. package/dist/sdk/delivery.js +1 -1
  98. package/dist/sdk/engage/campaign-pull.js +1 -1
  99. package/dist/sdk/engage/campaign-push.js +1 -1
  100. package/dist/sdk/engage/campaign-validator.js +1 -1
  101. package/dist/sdk/engage/campaign-yaml.js +1 -1
  102. package/dist/sdk/engage/template-pull.js +1 -1
  103. package/dist/sdk/engage/template-push.js +1 -1
  104. package/dist/sdk/engage/template-validator.js +1 -1
  105. package/dist/sdk/engage/template-yaml.js +1 -1
  106. package/dist/sdk/engage/types/campaign-def.js +1 -1
  107. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  108. package/dist/sdk/engage/types/template-schema.js +1 -1
  109. package/dist/sdk/engage.js +1 -1
  110. package/dist/sdk/errors.js +1 -1
  111. package/dist/sdk/index.js +1 -1
  112. package/dist/sdk/io/index.js +1 -1
  113. package/dist/sdk/io/node-filesystem.js +1 -1
  114. package/dist/sdk/job.js +1 -1
  115. package/dist/sdk/journey.js +1 -1
  116. package/dist/sdk/llm/chat-cache.js +1 -1
  117. package/dist/sdk/llm/index.js +1 -1
  118. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  119. package/dist/sdk/llm/model-factors.js +1 -1
  120. package/dist/sdk/personalization.js +1 -1
  121. package/dist/sdk/query/index.js +1 -1
  122. package/dist/sdk/query/sql-parser.js +1 -1
  123. package/dist/sdk/realtime.js +1 -1
  124. package/dist/sdk/schedule.js +1 -1
  125. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  126. package/dist/sdk/segment/fields-display.js +1 -1
  127. package/dist/sdk/segment/file-discovery.js +1 -1
  128. package/dist/sdk/segment/journey-utils.js +1 -1
  129. package/dist/sdk/segment/journey-validator.js +1 -1
  130. package/dist/sdk/segment/journey-yaml.js +1 -1
  131. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  132. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  133. package/dist/sdk/segment/pull-workflow.js +1 -1
  134. package/dist/sdk/segment/push-recovery.js +1 -1
  135. package/dist/sdk/segment/push-workflow.js +1 -1
  136. package/dist/sdk/segment/resolution-context.js +1 -1
  137. package/dist/sdk/segment/segment-path-parser.js +1 -1
  138. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  139. package/dist/sdk/segment/segment-validator.js +1 -1
  140. package/dist/sdk/segment/target-resolution.js +1 -1
  141. package/dist/sdk/segment/tdx-config.js +1 -1
  142. package/dist/sdk/segment/types/activation-schema.js +1 -1
  143. package/dist/sdk/segment/types/journey-def.js +1 -1
  144. package/dist/sdk/segment/types/journey-schema.js +1 -1
  145. package/dist/sdk/segment/types/segment-def.js +1 -1
  146. package/dist/sdk/segment/types/segment-schema.js +1 -1
  147. package/dist/sdk/segment/validate-files.js +1 -1
  148. package/dist/sdk/segment/yaml-validator.js +1 -1
  149. package/dist/sdk/segment.js +1 -1
  150. package/dist/sdk/types/index.js +1 -1
  151. package/dist/sdk/types/progress.js +1 -1
  152. package/dist/sdk/user.js +1 -1
  153. package/dist/sdk/util/format-detector.js +1 -1
  154. package/dist/sdk/util/formatters.js +1 -1
  155. package/dist/sdk/util/index.js +1 -1
  156. package/dist/sdk/util/paginate.js +1 -1
  157. package/dist/sdk/util/tree-formatter.js +1 -1
  158. package/dist/sdk/workflow/archive-validation.js +1 -1
  159. package/dist/sdk/workflow/clone-workflow.js +1 -1
  160. package/dist/sdk/workflow/index.js +1 -1
  161. package/dist/sdk/workflow/pull-workflow.js +1 -1
  162. package/dist/sdk/workflow/push-workflow.js +1 -1
  163. package/dist/sdk/workflow/tdx-config.js +1 -1
  164. package/dist/sdk/workflow/workflow-utils.js +1 -1
  165. package/dist/test-utils/command-runner.js +1 -1
  166. package/dist/test-utils/factories.js +1 -1
  167. package/dist/test-utils/fixtures.js +1 -1
  168. package/dist/test-utils/http-mock.js +1 -1
  169. package/dist/test-utils/index.js +1 -1
  170. package/dist/utils/async.js +1 -1
  171. package/dist/utils/colors.js +1 -1
  172. package/dist/utils/diff.js +1 -1
  173. package/dist/utils/file-permissions.js +1 -1
  174. package/dist/utils/file-reader.js +1 -1
  175. package/dist/utils/github-releases.js +1 -1
  176. package/dist/utils/global-cache.js +1 -1
  177. package/dist/utils/json-loader.js +1 -1
  178. package/dist/utils/local-cache.js +1 -1
  179. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  180. package/dist/utils/logger/formatters/index.js +1 -1
  181. package/dist/utils/logger/handlers/console-handler.js +1 -1
  182. package/dist/utils/logger/handlers/file-handler.js +1 -1
  183. package/dist/utils/logger/handlers/index.js +1 -1
  184. package/dist/utils/logger/handlers/null-handler.js +1 -1
  185. package/dist/utils/logger/index.js +1 -1
  186. package/dist/utils/logger/logger.js +1 -1
  187. package/dist/utils/logger/types.js +1 -1
  188. package/dist/utils/option-validation.js +1 -1
  189. package/dist/utils/process.js +1 -1
  190. package/dist/utils/prompt.js +1 -1
  191. package/dist/utils/spinner.js +1 -1
  192. package/dist/utils/sse-parser.js +1 -1
  193. package/dist/utils/string-utils.js +1 -1
  194. package/dist/utils/table-ref-parser.js +1 -1
  195. package/dist/utils/tdx-logger.js +1 -1
  196. package/dist/utils/version-check.js +1 -1
  197. package/package.json +1 -1
@@ -1 +1 @@
1
- const a29_0x438648=a29_0x39c8;(function(_0x2800da,_0x302fa){const _0x2c318e=a29_0x39c8,_0x3c7213=_0x2800da();while(!![]){try{const _0x509347=-parseInt(_0x2c318e(0x229))/0x1+parseInt(_0x2c318e(0x2cb))/0x2*(parseInt(_0x2c318e(0x1c0))/0x3)+parseInt(_0x2c318e(0x1df))/0x4+-parseInt(_0x2c318e(0x1af))/0x5+-parseInt(_0x2c318e(0x260))/0x6+-parseInt(_0x2c318e(0x255))/0x7+parseInt(_0x2c318e(0x2f7))/0x8*(parseInt(_0x2c318e(0x2ea))/0x9);if(_0x509347===_0x302fa)break;else _0x3c7213['push'](_0x3c7213['shift']());}catch(_0x4a79b5){_0x3c7213['push'](_0x3c7213['shift']());}}}(a29_0x3243,0xa311f));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x253e2f 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,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a29_0x219842 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=a29_0x438648(0x20d),LEGACY_PARENT_SEGMENT_DIR=a29_0x438648(0x228);function openBrowser(_0x6aebf7){const _0x5afb17=a29_0x438648,_0x35b865=process['platform'],_0x46ceb3=_0x35b865==='darwin'?_0x5afb17(0x1bc):_0x35b865===_0x5afb17(0x1fd)?_0x5afb17(0x2a6):_0x5afb17(0x1fc);spawn(_0x46ceb3,[_0x6aebf7],{'detached':!![],'stdio':_0x5afb17(0x2aa)})[_0x5afb17(0x2d8)]();}function migrateLegacyDirectory(){const _0x43ec64=a29_0x438648;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x509693=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x509693['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x43ec64(0x1cf)](a29_0x219842[_0x43ec64(0x20b)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x43ec64(0x26f))),console[_0x43ec64(0x1cf)](a29_0x219842['dim']('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x43ec64(0x204))),![];console[_0x43ec64(0x1cf)](a29_0x219842[_0x43ec64(0x20b)](_0x43ec64(0x17d)+LEGACY_PARENT_SEGMENT_DIR+_0x43ec64(0x280)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x43ec64(0x1cf)](a29_0x219842[_0x43ec64(0x297)](_0x43ec64(0x183)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x1a25e7){const _0x3b8ccf=_0x1a25e7 instanceof Error?_0x1a25e7[_0x43ec64(0x207)]:String(_0x1a25e7);return console[_0x43ec64(0x1cf)](a29_0x219842[_0x43ec64(0x1c5)](_0x43ec64(0x2ed)+_0x3b8ccf+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x438648(0x1a3)](_0x376a28){const _0x26e307=a29_0x438648;return migrateLegacyDirectory(),super[_0x26e307(0x1a3)](_0x376a28);}}function resolveYamlFile(_0x109068){const _0x1b3071=a29_0x438648;if(_0x109068['endsWith'](_0x1b3071(0x1fe))||_0x109068[_0x1b3071(0x2f4)](_0x1b3071(0x2bb)))return _0x109068;return a29_0x253e2f[_0x1b3071(0x2df)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x109068)+_0x1b3071(0x1fe));}function formatProgressMessage(_0x245bd4){const _0xc74f81=a29_0x438648,_0x338283=_0x245bd4[_0xc74f81(0x2b5)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x338283){const [,_0xa99af0,_0x7c9898,_0x234735='']=_0x338283;return a29_0x219842[_0xc74f81(0x17a)](_0xa99af0+':')+'\x20'+_0x7c9898+a29_0x219842[_0xc74f81(0x17a)](_0x234735);}return a29_0x219842[_0xc74f81(0x17a)](_0x245bd4);}function showFileNotFoundError(_0x2650e6,_0x19cb18){const _0x3c4d09=a29_0x438648;console[_0x3c4d09(0x1cf)](a29_0x219842['red'](_0x3c4d09(0x24d)+_0x2650e6+'\x0a')),console[_0x3c4d09(0x1cf)](a29_0x219842[_0x3c4d09(0x24f)](_0x3c4d09(0x19e)+_0x19cb18+_0x3c4d09(0x1eb)));}function displayRealtimeValidation(_0x25a60c){const _0xe7a13d=a29_0x438648;if(!_0x25a60c['realtime'])return;const _0x54cffc=_0x25a60c[_0xe7a13d(0x27a)],_0x2c434e=_0x54cffc[_0xe7a13d(0x2e6)]?a29_0x219842['green']('⚡\x20Enabled'):a29_0x219842[_0xe7a13d(0x20b)](_0xe7a13d(0x25e));console['error']('\x0a'+a29_0x219842[_0xe7a13d(0x17a)](_0xe7a13d(0x2f2))+'\x20'+_0x2c434e);if(_0x54cffc[_0xe7a13d(0x1da)]&&_0x54cffc[_0xe7a13d(0x1da)]['length']>0x0){console[_0xe7a13d(0x1cf)]('\x20\x20'+a29_0x219842[_0xe7a13d(0x17a)](_0xe7a13d(0x2c7))+'\x20'+_0x54cffc[_0xe7a13d(0x1da)][_0xe7a13d(0x1a1)]+_0xe7a13d(0x299));for(const _0x53f225 of _0x54cffc[_0xe7a13d(0x1da)]){const _0x172434=_0x53f225['sourceTableValid']===![]?a29_0x219842[_0xe7a13d(0x1c5)]('✘'):a29_0x219842[_0xe7a13d(0x297)]('✔');console['error'](_0xe7a13d(0x2c3)+_0x172434+'\x20'+_0x53f225[_0xe7a13d(0x2bd)]),_0x53f225[_0xe7a13d(0x180)]&&console['error'](_0xe7a13d(0x282)+a29_0x219842[_0xe7a13d(0x1c5)](_0x53f225['sourceTableError']));}}if(_0x54cffc[_0xe7a13d(0x18e)]&&_0x54cffc[_0xe7a13d(0x18e)][_0xe7a13d(0x1a1)]>0x0){console[_0xe7a13d(0x1cf)]('\x20\x20'+a29_0x219842[_0xe7a13d(0x17a)](_0xe7a13d(0x2bf))+'\x20'+_0x54cffc[_0xe7a13d(0x18e)]['length']+_0xe7a13d(0x299));for(const _0x34450e of _0x54cffc[_0xe7a13d(0x18e)]){const _0x44c091=_0x34450e[_0xe7a13d(0x1c3)]?a29_0x219842[_0xe7a13d(0x297)]('✔'):a29_0x219842[_0xe7a13d(0x1c5)]('✘');console['error'](_0xe7a13d(0x2c3)+_0x44c091+'\x20'+_0x34450e['name']+'\x20'+a29_0x219842[_0xe7a13d(0x17a)]('('+_0x34450e[_0xe7a13d(0x250)]+')'));}}if(_0x54cffc[_0xe7a13d(0x1ca)]){const _0x100cfa=_0x54cffc['idStitching']['stitchingKeys']?.['length']?_0xe7a13d(0x22a)+_0x54cffc[_0xe7a13d(0x1ca)]['stitchingKeys']['join'](',\x20')+']':'';console[_0xe7a13d(0x1cf)]('\x20\x20'+a29_0x219842[_0xe7a13d(0x17a)](_0xe7a13d(0x1ea))+'\x20'+_0x54cffc[_0xe7a13d(0x1ca)][_0xe7a13d(0x1db)]+_0x100cfa);}if(_0x54cffc[_0xe7a13d(0x1aa)]&&_0x54cffc['personalizationServices'][_0xe7a13d(0x1a1)]>0x0){console['error']('\x20\x20'+a29_0x219842['dim'](_0xe7a13d(0x252))+'\x20'+_0x54cffc[_0xe7a13d(0x1aa)][_0xe7a13d(0x1a1)]+_0xe7a13d(0x1d2)+(_0x54cffc[_0xe7a13d(0x1aa)][_0xe7a13d(0x1a1)]!==0x1?'s':''));for(const _0x3694bc of _0x54cffc[_0xe7a13d(0x1aa)]){console[_0xe7a13d(0x1cf)](_0xe7a13d(0x247)+_0x3694bc[_0xe7a13d(0x2bd)]);}}}function showParentSegmentNotSetError(_0x16ca66){const _0x3aee9f=a29_0x438648;console[_0x3aee9f(0x1cf)](a29_0x219842[_0x3aee9f(0x20b)](_0x3aee9f(0x249))),console[_0x3aee9f(0x1cf)](_0x16ca66);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x438648(0x25d);['description']=a29_0x438648(0x1bb);async['execute'](_0x1308e4){const _0x21a8f6=a29_0x438648,{options:_0x4308a0,args:_0x1f8523,tdx:_0x1d7a78}=_0x1308e4,_0x3bf8dc=_0x1f8523[0x0];_0x4308a0[_0x21a8f6(0x211)]&&(console['error'](_0x21a8f6(0x1e4)+_0x4308a0[_0x21a8f6(0x300)]),_0x3bf8dc&&console['error'](_0x21a8f6(0x19d)+_0x3bf8dc));const _0x385f7d=await withSpinner(_0x3bf8dc?_0x21a8f6(0x2c0)+_0x3bf8dc+'\x27...':_0x21a8f6(0x2e0),()=>_0x1d7a78[_0x21a8f6(0x28e)][_0x21a8f6(0x186)](),{'verbose':_0x4308a0[_0x21a8f6(0x211)]});let _0x1eaf16=_0x385f7d[_0x21a8f6(0x1e7)];if(_0x3bf8dc){const _0x5d456f=_0x3bf8dc[_0x21a8f6(0x1ab)](/[.+^${}()|[\]\\]/g,_0x21a8f6(0x2b6))[_0x21a8f6(0x1ab)](/\*/g,'.*')[_0x21a8f6(0x1ab)](/\?/g,'.'),_0x461bad=new RegExp('^'+_0x5d456f+'$','i');_0x1eaf16=_0x1eaf16[_0x21a8f6(0x1c7)](_0x2fe30d=>_0x461bad['test'](_0x2fe30d[_0x21a8f6(0x18e)]['name']));}_0x1eaf16[_0x21a8f6(0x25c)]((_0x26f528,_0x3444a7)=>_0x26f528[_0x21a8f6(0x18e)][_0x21a8f6(0x2bd)][_0x21a8f6(0x284)](_0x3444a7['attributes'][_0x21a8f6(0x2bd)])),console[_0x21a8f6(0x1cf)](_0x21a8f6(0x2b8)+_0x1eaf16['length']+_0x21a8f6(0x241)+(_0x1eaf16[_0x21a8f6(0x1a1)]!==0x1?'s':''));const _0x5f2180=_0x477c79=>{const _0x3292f1=_0x21a8f6;return getConsoleNextUrl(_0x4308a0['site'],_0x3292f1(0x19b)+_0x477c79);};if(_0x4308a0[_0x21a8f6(0x18d)]===_0x21a8f6(0x23d)||_0x4308a0[_0x21a8f6(0x18d)]===_0x21a8f6(0x1dc)){const _0x2d1352=_0x1eaf16[_0x21a8f6(0x267)](_0x2e40fe=>({..._0x2e40fe,'url':_0x5f2180(_0x2e40fe['id'])}));await handleSDKOutput(_0x2d1352,_0x4308a0);}else{if(_0x1eaf16[_0x21a8f6(0x1a1)]===0x0)_0x3bf8dc?console[_0x21a8f6(0x294)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x3bf8dc):console['log'](_0x21a8f6(0x271));else for(const _0x41d769 of _0x1eaf16){const _0xf4a115=_0x41d769[_0x21a8f6(0x18e)]['population']?a29_0x219842['dim']('\x20('+formatRows(_0x41d769['attributes'][_0x21a8f6(0x213)])+')'):'',_0x4a9be5=hyperlink(_0x41d769[_0x21a8f6(0x18e)][_0x21a8f6(0x2bd)],_0x5f2180(_0x41d769['id']));console[_0x21a8f6(0x294)](_0x21a8f6(0x24a)+_0x4a9be5+_0xf4a115);}}return 0x0;}}function a29_0x3243(){const _0x3787bd=['Coverage:','Fetching\x20customers\x20schema...','sort','segment:parent:list','⚡\x20Not\x20enabled','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','4456518CXCLZQ','formatSchemaJson','column','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','displayBehaviorsStats','FINISHED','\x27...','map','Fetching\x20behavior\x20list...','segment:parent:desc','keys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','Found\x20YAML\x20file:\x20','YAML\x20file:\x20','/\x20directories\x20exist.','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','No\x20parent\x20segments\x20found','Personalization\x20service\x20description','Table:\x20','Validating\x20RT\x20configuration...','Listing\x20personalization\x20services\x20for\x20\x27','database','parentSegment','Options:\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','realtime','segment:parent:push','Output\x20file:\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','SQL\x20query:\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','/\x20→\x20','/attempt/','\x20\x20\x20\x20\x20\x20','Aborted.','localeCompare','customerPercent','repeat','column_name','behaviors','displayRealtimeInfo','Columns:','segment:parent:preview','\x20RT\x20configuration\x20is\x20valid','single','segment','allValid','Errors:','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Enriched:','columns','log','realtime:','Analyzing\x20changes...','green','Resolving\x20parent\x20segment\x20\x27','\x20configured','\x20\x20Columns:\x20','segment:parent:view','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','SELECT\x20*\x20FROM\x20(\x0a','tdx\x20ps\x20push\x20','collectSchema','Get\x20SQL\x20query\x20for\x20parent\x20segment','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','table','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','start','SELECT\x20*\x20FROM\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','ignore','timezone','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Master:','ps:rt:validate','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','scheduleType','ps:pz:list','jobId','setJobId','Name:\x20','match','\x5c$&','description','✔\x20Found\x20','\x0a✔\x20Workflow\x20started','\x20Opening\x20','.yaml','workflowSessionId','name','.customers)','Attributes:','Listing\x20parent\x20segments\x20matching\x20\x27','parent_id','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20\x20\x20\x20','Database:\x20','/app/workflows/','segment:parent:fields','Events:','segment:parent:validate','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','preview','29398ZUeONn','personalization_services','Session:','✔\x20No\x20changes\x20-\x20\x27','Error\x20reading\x20file:\x20','Apply\x20changes\x20to\x20\x27','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Source:','\x20kill','Available\x20behaviors:','\x20\x20\x20','toFixed','interval','unref','displayPreviewHints','addBehaviorsFile','\x0aUsage:\x20tdx\x20ps\x20preview\x20','-1d','Fetching\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','join','Listing\x20parent\x20segments...','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20trigger=','apply','dirname','ps:rt:list','enabled','displayAttributesStats','Updating','\x20=\x20','7731ZdhzZz','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','✘\x20Failed\x20to\x20rename\x20directory:\x20','trim','Behaviors','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','number','RT\x202.0:','information_schema','endsWith','Validate:','Attempt:','13592SAjiFl','\x20field','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','output','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','behavior_','\x27\x20and\x20run\x20workflow?','displayValidateResults','Updated','site','master','runParent','query','dim','Master\x20+\x20Attributes','reduce','\x0a⚠️\x20\x20Migrating:\x20','realtime_enabled','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','sourceTableError','enriched','RT\x202.0\x20Validate:','✔\x20Renamed\x20directory\x20to\x20','\x20parent\x20segment\x20\x27','Error\x20parsing\x20YAML:\x20','listParents','\x20--behavior\x20\x22','\x20total','last_page_viewed','utf-8','segment:parent:create','behavior','format','attributes','No\x20personalization\x20services\x20configured','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','To\x20view\x20sample\x20data:','errors','trigger_event','\x20Configuration\x20is\x20valid','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20Added\x20RT\x202.0\x20template\x20section','execute','yes','Fetching\x20sample\x20data...','displaySampleData','/app/dw/parentSegments/','workflowAttemptId','Pattern:\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','workflowId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','length','all','run','✔\x20Query\x20completed:\x20Processed\x20','segment:parent:show','Creating','matchedCount','bold','Create\x20parent\x20segment\x20\x27','personalizationServices','replace','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','varchar','customerGroup','955vTgVHS','✔\x20Created\x20parent\x20segment\x20\x27','getParentSQL','totalEvents','schemaError','audienceId','\x20\x20No\x20sample\x20data\x20available','\x20--attribute\x20\x22<name>\x22','\x20\x202.\x20Run\x20','Output\x20Database:','scheduleOption','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','List\x20parent\x20segments','open','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','toLowerCase','255Pksedp','\x20--attribute\x20\x22','getParentFull','valid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','red','using\x20the\x20default\x20path:\x20','filter','Listing\x20fields\x20for\x20\x27','test','idStitching','addBehaviors','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','resolveParentId','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','error','\x20--behavior\x20\x22<name>\x22','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20service','text','behaviorsFile','Master\x20Table','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Updating\x20parent\x20segment\x20\x27','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','%)\x20','events','primaryKey','jsonl','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','segment:parent:update','410244dqgPaV','attribute','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20service(s)\x20configured','Site:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x20rows\x20','data','\x20tdx\x20wf\x20attempt\x20','Parent\x20segment:\x20','ID\x20Stitching:','`\x20to\x20download\x20the\x20configuration\x20first','status','column_type','Creating\x20parent\x20segment\x20\x27','schemaValid','\x20No\x20changes\x20-\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','pushParentYaml','\x22\x20}','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','label','toLocaleString','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Join\x20on:','Status:','\x0a\x20\x20\x20\x20]','xdg-open','win32','.yml','\x20section','Default','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','in\x20','/\x20directory.\x0a','Join:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','message','\x27\x20with\x20ID:\x20','sampleData','user_id','yellow','\x0aError:','parent_segments','Fetching\x20current\x20configuration\x20for\x20\x27','stop','rowCount','verbose','td_client_id','population','foreignKey','Options\x20(one\x20required):\x0a','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','getBehaviorNames','web','\x20personalization\x20service','previewParentYaml','coveragePercent','\x20to\x20configure\x20your\x20personalization\x20service','displaySummary','indexOf','Customers:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','string','segment:parent:run','displayColumns','Schema\x20saved\x20to\x20','displayPreviewResults','customersWithEvents','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','parent_segment','828855qTmXcb','\x20+\x20[','Error:\x20Parent\x20segment\x20name\x20is\x20required','joinKey','Rows:','segment:parent:pull','\x20is\x20already\x20up\x20to\x20date','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20RT-enabled\x20parent\x20segment','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x0aChanges\x20to\x20apply\x20to\x20\x27','Validating\x20configuration...','\x20--enriched','Attribute:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Overwrite\x20\x27','\x0a\x20\x20\x20\x20}','Show\x20parent\x20segment\x20details','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','json','/{name}.yml\x0a','No\x20RT-enabled\x20parent\x20segments\x20found','\x0aNew\x20parent\x20segment\x20\x27','\x20parent\x20segment','displayMasterInfo','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20Added\x20personalization\x20template\x20to\x20','createParent','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20\x20\x20-\x20','customers','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','👥\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Error:','Error:\x20File\x20not\x20found:\x20','tdx\x20ps\x20preview\x20','cyan','type','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Personalization:','list','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','4001781OdFgrn','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','processedRows','customerGroupFile','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'];a29_0x3243=function(){return _0x3787bd;};return a29_0x3243();}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x18b);['description']=a29_0x438648(0x2e1);async[a29_0x438648(0x197)](_0x4a0dff){const _0x19158c=a29_0x438648,{options:_0x3a7a7b,args:_0x5bd26f,tdx:_0x31ffca}=_0x4a0dff;console[_0x19158c(0x1cf)](_0x19158c(0x1e2)+_0x19158c(0x23c)+_0x19158c(0x17f));const _0x3e15bf=_0x3a7a7b;if(_0x5bd26f[_0x19158c(0x1a1)]===0x0)return console[_0x19158c(0x1cf)](a29_0x219842[_0x19158c(0x1c5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x19158c(0x1cf)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x12cae0=_0x5bd26f[0x0];if(!_0x3e15bf[_0x19158c(0x276)]||!_0x3e15bf[_0x19158c(0x2a3)])return console[_0x19158c(0x1cf)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x3e15bf['verbose']&&(console['error'](_0x19158c(0x1e4)+_0x3e15bf['site']),console[_0x19158c(0x1cf)](_0x19158c(0x2b4)+_0x12cae0),console[_0x19158c(0x1cf)](_0x19158c(0x2c4)+_0x3e15bf[_0x19158c(0x276)]),console[_0x19158c(0x1cf)](_0x19158c(0x273)+_0x3e15bf[_0x19158c(0x2a3)]));const _0x39b491=await loadJSONFromOptions(_0x3e15bf[_0x19158c(0x18e)],_0x3e15bf['attributesFile']),_0x51f1fd=await loadJSONFromOptions(_0x3e15bf[_0x19158c(0x288)],_0x3e15bf[_0x19158c(0x1d4)]),_0x59b4de=await loadJSONFromOptions(_0x3e15bf[_0x19158c(0x1ae)],_0x3e15bf[_0x19158c(0x258)]),_0x10470d={'name':_0x12cae0,'description':_0x3e15bf[_0x19158c(0x2b7)],'scheduleType':_0x3e15bf[_0x19158c(0x2b0)],'scheduleOption':_0x3e15bf['scheduleOption'],'timezone':_0x3e15bf['timezone'],'master':{'parentDatabaseName':_0x3e15bf[_0x19158c(0x276)],'parentTableName':_0x3e15bf[_0x19158c(0x2a3)]},'attributes':_0x39b491,'behaviors':_0x51f1fd,'customerGroup':_0x59b4de},_0x4d20bf=await withSpinner(_0x19158c(0x1ee)+_0x12cae0+_0x19158c(0x266),()=>_0x31ffca[_0x19158c(0x28e)][_0x19158c(0x245)](_0x10470d),{'verbose':_0x3a7a7b[_0x19158c(0x211)]}),_0x447e8e=_0x4d20bf[_0x19158c(0x1e7)];return console['error'](_0x19158c(0x1b0)+_0x447e8e[_0x19158c(0x2bd)]+_0x19158c(0x208)+_0x447e8e['id']),await handleSDKOutput([_0x447e8e],_0x3a7a7b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x1de);[a29_0x438648(0x2b7)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a29_0x438648(0x197)](_0x10f236){const _0x5074f6=a29_0x438648,{options:_0x5818cc,args:_0x384071,tdx:_0x369e3c}=_0x10f236;console[_0x5074f6(0x1cf)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x5074f6(0x23c)+_0x5074f6(0x17f));const _0x18ad77=_0x5818cc;if(_0x384071[_0x5074f6(0x1a1)]===0x0)return console[_0x5074f6(0x1cf)](a29_0x219842['red'](_0x5074f6(0x22b))),console[_0x5074f6(0x1cf)](_0x5074f6(0x202)),0x1;const _0x4fa7b4=_0x384071[0x0];_0x18ad77['verbose']&&(console[_0x5074f6(0x1cf)]('Site:\x20'+_0x18ad77['site']),console['error'](_0x5074f6(0x1e9)+_0x4fa7b4));const _0x58d917=await withSpinner(_0x5074f6(0x20e)+_0x4fa7b4+_0x5074f6(0x266),()=>_0x369e3c[_0x5074f6(0x28e)][_0x5074f6(0x1c2)](_0x4fa7b4),{'verbose':_0x18ad77[_0x5074f6(0x211)]}),_0x40f055=_0x58d917['data'],_0x1db0ac=await loadJSONFromOptions(_0x18ad77['addAttributes'],_0x18ad77['addAttributesFile']),_0x210240=await loadJSONFromOptions(_0x18ad77[_0x5074f6(0x1cb)],_0x18ad77[_0x5074f6(0x2da)]),_0x5d3972={'name':_0x40f055['name'],'description':_0x18ad77[_0x5074f6(0x2b7)]!==undefined?_0x18ad77['description']:_0x40f055[_0x5074f6(0x2b7)],'scheduleType':_0x18ad77['scheduleType']!==undefined?_0x18ad77[_0x5074f6(0x2b0)]:_0x40f055[_0x5074f6(0x2b0)],'scheduleOption':_0x18ad77[_0x5074f6(0x1b9)]!==undefined?_0x18ad77['scheduleOption']:_0x40f055[_0x5074f6(0x1b9)],'timezone':_0x18ad77[_0x5074f6(0x2ab)]!==undefined?_0x18ad77[_0x5074f6(0x2ab)]:_0x40f055['timezone'],'master':_0x40f055[_0x5074f6(0x177)],'attributes':_0x1db0ac?[..._0x40f055[_0x5074f6(0x18e)]||[],..._0x1db0ac]:_0x40f055[_0x5074f6(0x18e)],'behaviors':_0x210240?[..._0x40f055[_0x5074f6(0x288)]||[],..._0x210240]:_0x40f055[_0x5074f6(0x288)],'customerGroup':_0x40f055['customerGroup']},_0x5833c0=await withSpinner(_0x5074f6(0x1d7)+_0x4fa7b4+_0x5074f6(0x266),()=>_0x369e3c['segment']['updateParent'](_0x4fa7b4,_0x5d3972),{'verbose':_0x18ad77[_0x5074f6(0x211)]}),_0x451d2a=_0x5833c0[_0x5074f6(0x1e7)];return console['error'](_0x5074f6(0x2a2)+_0x451d2a[_0x5074f6(0x2bd)]+'\x27'),await handleSDKOutput([_0x451d2a],_0x18ad77),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a29_0x438648(0x22e);[a29_0x438648(0x2b7)]=a29_0x438648(0x279);async['execute'](_0x3843f8){const _0x29dc64=a29_0x438648,{options:_0x2513f3,args:_0x48fc76,tdx:_0x56d01d}=_0x3843f8,_0x89c311=_0x2513f3,_0x7f92f9=_0x48fc76[0x0]||_0x2513f3[_0x29dc64(0x277)];if(!_0x7f92f9)return showParentSegmentNotSetError(_0x29dc64(0x1d1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x89c311['use']&&_0x89c311[_0x29dc64(0x2fa)])return console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x1c5)](_0x29dc64(0x1ba))),console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x17a)](_0x29dc64(0x230))),console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x17a)](_0x29dc64(0x1c6)+PARENT_SEGMENT_DIR+_0x29dc64(0x23e))),console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x24f)](_0x29dc64(0x27d))),0x1;const _0x3987d7=_0x89c311[_0x29dc64(0x2fa)]||a29_0x253e2f[_0x29dc64(0x2df)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x7f92f9)+_0x29dc64(0x1fe));_0x89c311[_0x29dc64(0x211)]&&(console[_0x29dc64(0x1cf)](_0x29dc64(0x1e4)+_0x89c311[_0x29dc64(0x300)]),console[_0x29dc64(0x1cf)]('Parent\x20segment:\x20'+_0x7f92f9),console[_0x29dc64(0x1cf)](_0x29dc64(0x27c)+_0x3987d7));const _0x7288a4=await withSpinner(_0x29dc64(0x2dd)+_0x7f92f9+_0x29dc64(0x266),()=>_0x56d01d['segment']['pullParentYaml'](_0x7f92f9),{'verbose':_0x89c311[_0x29dc64(0x211)]}),_0x1ef9f9=_0x7288a4[_0x29dc64(0x1e7)];if(existsSync(_0x3987d7)){const _0x3bdddc=readFileSync(_0x3987d7,'utf-8'),_0x313058=generateDiff(_0x3bdddc,_0x1ef9f9);if(!hasChanges(_0x313058))console['error'](a29_0x219842[_0x29dc64(0x297)]('✔')+_0x29dc64(0x1f0)+a29_0x219842[_0x29dc64(0x24f)](_0x3987d7)+_0x29dc64(0x22f));else{console[_0x29dc64(0x1cf)]('\x0aChanges\x20to\x20\x27'+_0x3987d7+'\x27:'),console[_0x29dc64(0x1cf)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x313058)),console[_0x29dc64(0x1cf)]('─'['repeat'](0x3c));if(!_0x89c311['yes']){if(!isInteractive())return console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x1c5)]('\x0aError:'),_0x29dc64(0x1f5)),console['error'](a29_0x219842['dim'](_0x29dc64(0x1cc))),0x1;const _0x5c1917=await confirmKey(_0x29dc64(0x238)+_0x3987d7+'\x27?');if(!_0x5c1917)return console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x20b)](_0x29dc64(0x283))),0x1;}writeFileSync(_0x3987d7,_0x1ef9f9,_0x29dc64(0x18a)),console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x297)]('✔')+_0x29dc64(0x1dd)+a29_0x219842[_0x29dc64(0x24f)](_0x3987d7));}}else{const _0x1bcca8=a29_0x253e2f[_0x29dc64(0x2e4)](_0x3987d7);!existsSync(_0x1bcca8)&&mkdirSync(_0x1bcca8,{'recursive':!![]}),writeFileSync(_0x3987d7,_0x1ef9f9,'utf-8'),console[_0x29dc64(0x1cf)](a29_0x219842[_0x29dc64(0x297)]('✔')+_0x29dc64(0x1dd)+a29_0x219842[_0x29dc64(0x24f)](_0x3987d7));}return saveSessionContext({'parent_segment':_0x7f92f9},_0x89c311['session']),console[_0x29dc64(0x1cf)](a29_0x219842['green']('✔')+_0x29dc64(0x2de)+a29_0x219842['dim']('parent_segment')+_0x29dc64(0x2e9)+a29_0x219842['cyan'](_0x7f92f9)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a29_0x438648(0x27b);[a29_0x438648(0x2b7)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a29_0x438648(0x197)](_0x1bc4a9){const _0x5bb284=a29_0x438648,{options:_0x178f04,args:_0x1c8677,tdx:_0x3643b3}=_0x1bc4a9,_0x3973e6=_0x178f04,_0x11caf6=_0x1c8677[0x0]||_0x178f04[_0x5bb284(0x277)];if(!_0x11caf6)return showParentSegmentNotSetError(_0x5bb284(0x2fb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x1cb5df=resolveYamlFile(_0x11caf6);if(!existsSync(_0x1cb5df))return showFileNotFoundError(_0x1cb5df,_0x11caf6),0x1;_0x3973e6[_0x5bb284(0x211)]&&(console[_0x5bb284(0x1cf)](_0x5bb284(0x1e4)+_0x3973e6[_0x5bb284(0x300)]),console[_0x5bb284(0x1cf)](_0x5bb284(0x26e)+_0x1cb5df));let _0x466272;try{_0x466272=readFileSync(_0x1cb5df,_0x5bb284(0x18a));}catch(_0x4d71f6){const _0x19de56=_0x4d71f6 instanceof Error?_0x4d71f6[_0x5bb284(0x207)]:String(_0x4d71f6);return console[_0x5bb284(0x1cf)]('Error\x20reading\x20file:\x20'+_0x19de56),0x1;}const _0x576bfb=await withSpinner(_0x5bb284(0x296),()=>_0x3643b3[_0x5bb284(0x28e)][_0x5bb284(0x1f3)](_0x466272),{'verbose':_0x3973e6[_0x5bb284(0x211)]}),_0x71c3c2=_0x576bfb[_0x5bb284(0x1e7)],{isNew:_0x27bf64,name:_0x2c1d5c,hasChanges:_0x347630,diffFormatted:_0x375f9d}=_0x71c3c2;if(!_0x347630)return console[_0x5bb284(0x1cf)](_0x5bb284(0x2ce)+_0x2c1d5c+_0x5bb284(0x246)),0x0;_0x27bf64?console[_0x5bb284(0x1cf)](_0x5bb284(0x240)+_0x2c1d5c+'\x27:'):console[_0x5bb284(0x1cf)](_0x5bb284(0x233)+_0x2c1d5c+'\x27:');console[_0x5bb284(0x1cf)]('─'['repeat'](0x3c)),console['error'](_0x375f9d),console[_0x5bb284(0x1cf)]('─'[_0x5bb284(0x286)](0x3c));const _0x13ae57=_0x27bf64?_0x5bb284(0x1a9)+_0x2c1d5c+'\x27?':_0x5bb284(0x2d0)+_0x2c1d5c+'\x27?';if(!_0x3973e6[_0x5bb284(0x198)]){if(!isInteractive())return console[_0x5bb284(0x1cf)](a29_0x219842[_0x5bb284(0x1c5)](_0x5bb284(0x20c)),_0x5bb284(0x1f5)),console[_0x5bb284(0x1cf)](a29_0x219842[_0x5bb284(0x17a)](_0x5bb284(0x1cc))),0x1;const _0x5526be=await confirmKey(_0x13ae57);if(!_0x5526be)return console['error'](a29_0x219842[_0x5bb284(0x20b)](_0x5bb284(0x283))),0x1;}const _0x1230db=_0x27bf64?_0x5bb284(0x1a6):_0x5bb284(0x2e8),_0x49e0c6=await withSpinner(_0x1230db+_0x5bb284(0x184)+_0x2c1d5c+'\x27...',()=>_0x71c3c2['apply'](),{'verbose':_0x3973e6[_0x5bb284(0x211)]}),_0x388b83=_0x49e0c6[_0x5bb284(0x1e7)],_0x277bde=getConsoleNextUrl(_0x3973e6[_0x5bb284(0x300)],_0x5bb284(0x19b)+_0x388b83['id']),_0x4762c7=_0x27bf64?'Created':_0x5bb284(0x2ff);return console[_0x5bb284(0x1cf)]('✔\x20'+_0x4762c7+'\x20parent\x20segment\x20\x27'+_0x388b83[_0x5bb284(0x2bd)]+'\x27'),console[_0x5bb284(0x1cf)]('\x20\x20'+_0x277bde),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a29_0x438648(0x2c8);[a29_0x438648(0x2b7)]=a29_0x438648(0x2a4);async[a29_0x438648(0x197)](_0xf374d7){const _0x46ab05=a29_0x438648,{options:_0x443bdb,args:_0x2795e3,tdx:_0x890dc4}=_0xf374d7,_0x3e6f5b=_0x443bdb,_0x37ccbc=_0x2795e3[0x0]||_0x443bdb['parentSegment'];if(!_0x37ccbc)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'+_0x46ab05(0x1c4)+_0x46ab05(0x278)+_0x46ab05(0x259)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x46ab05(0x251)),0x1;const _0x20f502=resolveYamlFile(_0x37ccbc);if(!existsSync(_0x20f502))return showFileNotFoundError(_0x20f502,_0x37ccbc),0x1;_0x3e6f5b[_0x46ab05(0x211)]&&(console[_0x46ab05(0x1cf)](_0x46ab05(0x1e4)+_0x3e6f5b[_0x46ab05(0x300)]),console['error'](_0x46ab05(0x26e)+_0x20f502));let _0x553efe;try{_0x553efe=readFileSync(_0x20f502,'utf-8');}catch(_0x4b1ebc){const _0x18d070=_0x4b1ebc instanceof Error?_0x4b1ebc['message']:String(_0x4b1ebc);return console[_0x46ab05(0x1cf)](_0x46ab05(0x2cf)+_0x18d070),0x1;}const _0x533b2e=createCommandSpinner(a29_0x219842[_0x46ab05(0x17a)](_0x46ab05(0x234)),{'verbose':_0x3e6f5b['verbose']});_0x533b2e['start']();const _0x1bf3f1={'onProgress':_0x25cdf3=>{_0x533b2e['text']=formatProgressMessage(_0x25cdf3);}};if(_0x3e6f5b[_0x46ab05(0x177)])_0x1bf3f1[_0x46ab05(0x177)]=!![];if(_0x3e6f5b['enriched'])_0x1bf3f1[_0x46ab05(0x181)]=!![];_0x3e6f5b['attribute']&&(_0x1bf3f1['attribute']=_0x3e6f5b[_0x46ab05(0x1e0)]);_0x3e6f5b['behavior']&&(_0x1bf3f1['behavior']=_0x3e6f5b[_0x46ab05(0x18c)]);if(_0x3e6f5b[_0x46ab05(0x2d7)])_0x1bf3f1['interval']=_0x3e6f5b['interval'];let _0x56f386;try{_0x56f386=await _0x890dc4['segment']['validateParentYaml'](_0x553efe,_0x1bf3f1),_0x533b2e[_0x46ab05(0x20f)]();}catch(_0x4fd950){_0x533b2e[_0x46ab05(0x20f)]();throw _0x4fd950;}const _0x1064db=_0x3e6f5b[_0x46ab05(0x2d7)]||_0x46ab05(0x2dc);return this[_0x46ab05(0x2fe)](_0x56f386,_0x1bf3f1,_0x20f502,_0x1064db),_0x56f386[_0x46ab05(0x28f)]?0x0:0x1;}[a29_0x438648(0x2fe)](_0xa35a55,_0x10890d,_0x1e74ad,_0x2db468){const _0x44e803=a29_0x438648;console[_0x44e803(0x1cf)]('\x0a'+a29_0x219842[_0x44e803(0x1a8)](_0x44e803(0x2f5))+'\x20'+_0xa35a55[_0x44e803(0x2bd)]),console['error']('═'[_0x44e803(0x286)](0x3c)),this[_0x44e803(0x242)](_0xa35a55);if(typeof _0x10890d[_0x44e803(0x1e0)]==='string'){this[_0x44e803(0x2e7)](_0xa35a55),this['displaySummary'](_0xa35a55),this[_0x44e803(0x2d9)](_0x1e74ad,_0x2db468,_0x44e803(0x1e0),_0x10890d[_0x44e803(0x1e0)]);return;}if(_0x10890d[_0x44e803(0x1e0)]===!![]){this[_0x44e803(0x2e7)](_0xa35a55),this[_0x44e803(0x21d)](_0xa35a55),this['displayPreviewHints'](_0x1e74ad,_0x2db468,_0x44e803(0x18e));return;}if(typeof _0x10890d[_0x44e803(0x18c)]===_0x44e803(0x221)){this[_0x44e803(0x264)](_0xa35a55,_0x2db468),this[_0x44e803(0x21d)](_0xa35a55),this[_0x44e803(0x2d9)](_0x1e74ad,_0x2db468,_0x44e803(0x18c),_0x10890d[_0x44e803(0x18c)]);return;}if(_0x10890d[_0x44e803(0x18c)]===!![]){this[_0x44e803(0x264)](_0xa35a55,_0x2db468),this[_0x44e803(0x21d)](_0xa35a55),this[_0x44e803(0x2d9)](_0x1e74ad,_0x2db468,_0x44e803(0x288));return;}this[_0x44e803(0x2e7)](_0xa35a55),this[_0x44e803(0x264)](_0xa35a55,_0x2db468),this['displayRealtimeInfo'](_0xa35a55),this[_0x44e803(0x21d)](_0xa35a55),this[_0x44e803(0x2d9)](_0x1e74ad,_0x2db468,_0x44e803(0x1a2));}[a29_0x438648(0x289)](_0xefc7c7){displayRealtimeValidation(_0xefc7c7);}['displayPreviewHints'](_0x18826c,_0x19988f,_0x393a92,_0x337c25){const _0x3779ce=a29_0x438648;console[_0x3779ce(0x1cf)]('\x0a'+a29_0x219842[_0x3779ce(0x17a)](_0x3779ce(0x191)));const _0x148a6a=_0x19988f!=='-1d'?'\x20--interval\x20'+_0x19988f:'';if(_0x393a92===_0x3779ce(0x1e0)&&_0x337c25)console[_0x3779ce(0x1cf)]('\x20\x20'+a29_0x219842[_0x3779ce(0x17a)](_0x3779ce(0x24e)+_0x18826c+_0x3779ce(0x1c1)+_0x337c25+'\x22'+_0x148a6a));else{if(_0x393a92===_0x3779ce(0x18c)&&_0x337c25)console[_0x3779ce(0x1cf)]('\x20\x20'+a29_0x219842[_0x3779ce(0x17a)]('tdx\x20ps\x20preview\x20'+_0x18826c+_0x3779ce(0x187)+_0x337c25+'\x22'+_0x148a6a));else(_0x393a92==='attributes'||_0x393a92===_0x3779ce(0x1a2))&&console[_0x3779ce(0x1cf)]('\x20\x20'+a29_0x219842[_0x3779ce(0x17a)]('tdx\x20ps\x20preview\x20'+_0x18826c+_0x3779ce(0x1b6)+_0x148a6a));}(_0x393a92===_0x3779ce(0x288)||_0x393a92==='all')&&console[_0x3779ce(0x1cf)]('\x20\x20'+a29_0x219842['dim'](_0x3779ce(0x24e)+_0x18826c+_0x3779ce(0x1d0)+_0x148a6a)),_0x393a92==='all'&&console[_0x3779ce(0x1cf)]('\x20\x20'+a29_0x219842[_0x3779ce(0x17a)](_0x3779ce(0x24e)+_0x18826c+_0x3779ce(0x235)+_0x148a6a));}['displayMasterInfo'](_0x33aac0){const _0x29993a=a29_0x438648,{master:_0x1c5fb2}=_0x33aac0,_0x197ebf=_0x1c5fb2['schemaValid']?a29_0x219842['green']('✔'):a29_0x219842['red']('✘');console[_0x29993a(0x1cf)]('\x0a'+a29_0x219842[_0x29993a(0x17a)](_0x29993a(0x1d5))),console[_0x29993a(0x1cf)](_0x197ebf+'\x20'+a29_0x219842['bold'](_0x1c5fb2[_0x29993a(0x276)]+'.'+_0x1c5fb2[_0x29993a(0x2a3)])),_0x1c5fb2[_0x29993a(0x1ef)]?_0x1c5fb2[_0x29993a(0x210)]!==undefined&&console[_0x29993a(0x1cf)]('\x20\x20'+a29_0x219842[_0x29993a(0x17a)](_0x29993a(0x22d))+'\x20'+a29_0x219842['cyan'](formatRows(_0x1c5fb2[_0x29993a(0x210)]))):console['error']('\x20\x20'+a29_0x219842[_0x29993a(0x1c5)]('Error:')+'\x20'+_0x1c5fb2[_0x29993a(0x1b3)]);}['displayAttributesStats'](_0xc9c3d){const _0x43b183=a29_0x438648;if(_0xc9c3d[_0x43b183(0x18e)][_0x43b183(0x1a1)]===0x0)return;console[_0x43b183(0x1cf)]('\x0a'+a29_0x219842[_0x43b183(0x17a)]('Attributes'));for(const _0x534970 of _0xc9c3d[_0x43b183(0x18e)]){const _0x43244c=_0x534970[_0x43b183(0x1ef)]?a29_0x219842[_0x43b183(0x297)]('✔'):a29_0x219842[_0x43b183(0x1c5)]('✘');let _0x3da69d='';if(_0x534970[_0x43b183(0x1ef)]&&_0x534970[_0x43b183(0x1a7)]!==undefined&&_0x534970[_0x43b183(0x21b)]!==undefined){const _0x1a7eba=_0x534970[_0x43b183(0x21b)][_0x43b183(0x2d6)](0x1),_0x56e1b6=_0x534970[_0x43b183(0x21b)]>=0x50?a29_0x219842[_0x43b183(0x297)]:_0x534970[_0x43b183(0x21b)]>=0x32?a29_0x219842[_0x43b183(0x20b)]:a29_0x219842[_0x43b183(0x1c5)];_0x3da69d='\x20'+a29_0x219842[_0x43b183(0x17a)](_0x43b183(0x25a))+'\x20'+_0x56e1b6(_0x1a7eba+'%')+'\x20('+formatRows(_0x534970[_0x43b183(0x1a7)])+'\x20rows)';}console[_0x43b183(0x1cf)](_0x43244c+'\x20'+a29_0x219842[_0x43b183(0x1a8)](_0x534970[_0x43b183(0x2bd)])+_0x3da69d),console[_0x43b183(0x1cf)]('\x20\x20'+a29_0x219842[_0x43b183(0x17a)](_0x43b183(0x2d2))+'\x20'+a29_0x219842[_0x43b183(0x1a8)](_0x534970['database']+'.'+_0x534970[_0x43b183(0x2a3)]));const _0x5552d5=_0x534970['joinKey']===_0x534970[_0x43b183(0x214)]?a29_0x219842[_0x43b183(0x17a)](_0x43b183(0x1f9))+'\x20'+_0x534970[_0x43b183(0x22c)]:a29_0x219842['dim'](_0x43b183(0x205))+'\x20'+_0x534970['joinKey']+'\x20=\x20'+_0x534970['foreignKey'];console[_0x43b183(0x1cf)]('\x20\x20'+_0x5552d5),console['error']('\x20\x20'+a29_0x219842[_0x43b183(0x17a)](_0x43b183(0x28a))),this[_0x43b183(0x223)](_0x534970[_0x43b183(0x293)]),!_0x534970[_0x43b183(0x1ef)]&&console[_0x43b183(0x1cf)]('\x20\x20'+a29_0x219842[_0x43b183(0x1c5)](_0x43b183(0x24c))+'\x20'+_0x534970[_0x43b183(0x1b3)]);}}[a29_0x438648(0x264)](_0x47a582,_0x53fc31){const _0x5528ff=a29_0x438648;if(_0x47a582[_0x5528ff(0x288)][_0x5528ff(0x1a1)]===0x0)return;console[_0x5528ff(0x1cf)]('\x0a'+a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x2ef))+'\x20'+a29_0x219842[_0x5528ff(0x17a)]('('+_0x53fc31+')'));for(const _0x4b3518 of _0x47a582[_0x5528ff(0x288)]){const _0x565c09=_0x4b3518[_0x5528ff(0x1ef)]?a29_0x219842[_0x5528ff(0x297)]('✔'):a29_0x219842[_0x5528ff(0x1c5)]('✘');let _0x1d49bb='';if(_0x4b3518[_0x5528ff(0x1ef)]&&_0x4b3518['customersWithEvents']!==undefined&&_0x4b3518['totalEvents']!==undefined){const _0x2904e5=_0x4b3518[_0x5528ff(0x285)]?.['toFixed'](0x1)||'?',_0x57c421=(_0x4b3518[_0x5528ff(0x285)]??0x0)>=0x32?a29_0x219842[_0x5528ff(0x297)]:(_0x4b3518['customerPercent']??0x0)>=0x14?a29_0x219842['yellow']:a29_0x219842[_0x5528ff(0x1c5)];_0x1d49bb='\x20'+a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x21f))+'\x20'+_0x57c421(formatRows(_0x4b3518[_0x5528ff(0x226)]))+'\x20('+_0x2904e5+_0x5528ff(0x1d9)+a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x2c7))+'\x20'+a29_0x219842[_0x5528ff(0x24f)](formatRows(_0x4b3518[_0x5528ff(0x1b2)]));}console[_0x5528ff(0x1cf)](_0x565c09+'\x20'+a29_0x219842['bold'](_0x4b3518[_0x5528ff(0x2bd)])+_0x1d49bb),console[_0x5528ff(0x1cf)]('\x20\x20'+a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x2d2))+'\x20'+a29_0x219842[_0x5528ff(0x1a8)](_0x4b3518[_0x5528ff(0x276)]+'.'+_0x4b3518[_0x5528ff(0x2a3)]));const _0x232097=_0x4b3518[_0x5528ff(0x22c)]===_0x4b3518[_0x5528ff(0x214)]?a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x1f9))+'\x20'+_0x4b3518[_0x5528ff(0x22c)]:a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x205))+'\x20'+_0x4b3518['joinKey']+'\x20=\x20'+_0x4b3518[_0x5528ff(0x214)];console[_0x5528ff(0x1cf)]('\x20\x20'+_0x232097),console['error']('\x20\x20'+a29_0x219842[_0x5528ff(0x17a)](_0x5528ff(0x28a))),this[_0x5528ff(0x223)](_0x4b3518[_0x5528ff(0x293)]),!_0x4b3518[_0x5528ff(0x1ef)]&&console['error']('\x20\x20'+a29_0x219842[_0x5528ff(0x1c5)](_0x5528ff(0x24c))+'\x20'+_0x4b3518[_0x5528ff(0x1b3)]);}}[a29_0x438648(0x223)](_0x2812dc){const _0x1debef=a29_0x438648;for(const _0x1b8dba of _0x2812dc){_0x1b8dba[_0x1debef(0x1f6)]===_0x1b8dba[_0x1debef(0x262)]||_0x1b8dba[_0x1debef(0x262)]==='*'?console[_0x1debef(0x1cf)](_0x1debef(0x247)+_0x1b8dba[_0x1debef(0x1f6)]):console[_0x1debef(0x1cf)](_0x1debef(0x247)+_0x1b8dba[_0x1debef(0x1f6)]+'\x20'+a29_0x219842[_0x1debef(0x17a)]('('+_0x1b8dba[_0x1debef(0x262)]+')'));}}[a29_0x438648(0x21d)](_0x4ac36c){const _0x3ae5cb=a29_0x438648;console[_0x3ae5cb(0x1cf)]('─'[_0x3ae5cb(0x286)](0x3c));if(_0x4ac36c[_0x3ae5cb(0x192)]['length']>0x0){console[_0x3ae5cb(0x1cf)]('\x0a'+a29_0x219842[_0x3ae5cb(0x1c5)](_0x3ae5cb(0x290)));for(const _0x21bf26 of _0x4ac36c[_0x3ae5cb(0x192)]){console[_0x3ae5cb(0x1cf)]('\x20\x20'+a29_0x219842[_0x3ae5cb(0x1c5)]('•')+'\x20'+_0x21bf26);}}_0x4ac36c[_0x3ae5cb(0x28f)]&&console[_0x3ae5cb(0x1cf)]('\x0a'+a29_0x219842['green']('✔')+_0x3ae5cb(0x194));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a29_0x438648(0x28b);[a29_0x438648(0x2b7)]=a29_0x438648(0x206);async[a29_0x438648(0x197)](_0x400591){const _0x44177d=a29_0x438648,{options:_0x267cd2,args:_0xeae4d6,tdx:_0x1777d5}=_0x400591,_0xdd7694=_0x267cd2,_0x25b82c=_0xeae4d6[0x0]||_0x267cd2[_0x44177d(0x277)];if(!_0x25b82c)return showParentSegmentNotSetError(_0x44177d(0x23b)+_0x44177d(0x237)+_0x44177d(0x215)+_0x44177d(0x2f0)+_0x44177d(0x2ac)+_0x44177d(0x1f8)+_0x44177d(0x24b)+_0x44177d(0x251)),0x1;if(!_0xdd7694[_0x44177d(0x177)]&&!_0xdd7694['attribute']&&!_0xdd7694['behavior']&&!_0xdd7694[_0x44177d(0x181)])return console['error'](a29_0x219842[_0x44177d(0x1c5)](_0x44177d(0x27f))),console[_0x44177d(0x1cf)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x44177d(0x1cf)]('Options:'),console[_0x44177d(0x1cf)](_0x44177d(0x270)),console[_0x44177d(0x1cf)](_0x44177d(0x2eb)),console[_0x44177d(0x1cf)](_0x44177d(0x1f2)),console['error'](_0x44177d(0x2d1)),0x1;const _0x15c9af=resolveYamlFile(_0x25b82c);if(!existsSync(_0x15c9af))return showFileNotFoundError(_0x15c9af,_0x25b82c),0x1;_0xdd7694[_0x44177d(0x211)]&&(console[_0x44177d(0x1cf)]('Site:\x20'+_0xdd7694[_0x44177d(0x300)]),console['error'](_0x44177d(0x26e)+_0x15c9af));let _0x82a0df;try{_0x82a0df=readFileSync(_0x15c9af,'utf-8');}catch(_0x1c2262){const _0x17fcf6=_0x1c2262 instanceof Error?_0x1c2262[_0x44177d(0x207)]:String(_0x1c2262);return console[_0x44177d(0x1cf)]('Error\x20reading\x20file:\x20'+_0x17fcf6),0x1;}let _0x376a99;try{_0x376a99=parseDef(_0x82a0df);}catch(_0x4dcdc8){const _0x3c4fe2=_0x4dcdc8 instanceof Error?_0x4dcdc8[_0x44177d(0x207)]:String(_0x4dcdc8);return console['error'](a29_0x219842[_0x44177d(0x1c5)]('Error\x20parsing\x20YAML:\x20'+_0x3c4fe2)),0x1;}if(_0xdd7694[_0x44177d(0x1e0)]===!![]||_0xdd7694[_0x44177d(0x1e0)]===''){const _0x312401=_0x376a99[_0x44177d(0x18e)]?.[_0x44177d(0x267)](_0x58ec43=>_0x58ec43[_0x44177d(0x2bd)])||[];if(_0x312401[_0x44177d(0x1a1)]===0x0)console['error'](a29_0x219842[_0x44177d(0x1c5)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a29_0x219842['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x44177d(0x1cf)]('Available\x20attributes:');for(const _0x25e606 of _0x312401){console['error']('\x20\x20'+a29_0x219842[_0x44177d(0x24f)](_0x25e606));}console[_0x44177d(0x1cf)](_0x44177d(0x2db)+_0x25b82c+_0x44177d(0x1c1)+_0x312401[0x0]+'\x22');}return 0x1;}if(_0xdd7694['behavior']===!![]||_0xdd7694[_0x44177d(0x18c)]===''){const _0x8a4e0c=_0x376a99[_0x44177d(0x288)]?.[_0x44177d(0x267)](_0x4b88c5=>_0x4b88c5['name'])||[];if(_0x8a4e0c[_0x44177d(0x1a1)]===0x0)console[_0x44177d(0x1cf)](a29_0x219842['red'](_0x44177d(0x1be)));else{console[_0x44177d(0x1cf)](a29_0x219842[_0x44177d(0x1c5)](_0x44177d(0x291))),console['error'](_0x44177d(0x2d4));for(const _0x1638d1 of _0x8a4e0c){console[_0x44177d(0x1cf)]('\x20\x20'+a29_0x219842['cyan'](_0x1638d1));}console[_0x44177d(0x1cf)](_0x44177d(0x2db)+_0x25b82c+'\x20--behavior\x20\x22'+_0x8a4e0c[0x0]+'\x22');}return 0x1;}const _0x274ad7=createCommandSpinner(a29_0x219842[_0x44177d(0x17a)](_0x44177d(0x199)),{'verbose':_0xdd7694['verbose']});_0x274ad7[_0x44177d(0x2a6)]();const _0x525dba={'onProgress':_0x23bfce=>{const _0x58e6f9=_0x44177d;_0x274ad7[_0x58e6f9(0x1d3)]=formatProgressMessage(_0x23bfce);}};if(_0xdd7694[_0x44177d(0x177)])_0x525dba[_0x44177d(0x177)]=!![];if(_0xdd7694[_0x44177d(0x1e0)]&&typeof _0xdd7694[_0x44177d(0x1e0)]==='string')_0x525dba['attribute']=_0xdd7694[_0x44177d(0x1e0)];if(_0xdd7694[_0x44177d(0x18c)]&&typeof _0xdd7694[_0x44177d(0x18c)]==='string')_0x525dba['behavior']=_0xdd7694[_0x44177d(0x18c)];if(_0xdd7694[_0x44177d(0x181)])_0x525dba['enriched']=!![];if(_0xdd7694['interval'])_0x525dba[_0x44177d(0x2d7)]=_0xdd7694[_0x44177d(0x2d7)];let _0x325ca9;try{_0x325ca9=await _0x1777d5[_0x44177d(0x28e)][_0x44177d(0x21a)](_0x82a0df,_0x525dba),_0x274ad7[_0x44177d(0x20f)]();}catch(_0x1fc393){_0x274ad7[_0x44177d(0x20f)]();throw _0x1fc393;}return await this[_0x44177d(0x225)](_0x325ca9,{'master':_0xdd7694[_0x44177d(0x177)],'attribute':typeof _0xdd7694['attribute']==='string'?_0xdd7694['attribute']:undefined,'behavior':typeof _0xdd7694['behavior']===_0x44177d(0x221)?_0xdd7694[_0x44177d(0x18c)]:undefined,'enriched':_0xdd7694[_0x44177d(0x181)]}),_0x325ca9[_0x44177d(0x28f)]?0x0:0x1;}async[a29_0x438648(0x225)](_0x18585e,_0x562d2e){const _0x5972b8=a29_0x438648;console['error']('\x0a'+a29_0x219842['bold']('Preview:')+'\x20'+_0x18585e['name']),console[_0x5972b8(0x1cf)]('═'[_0x5972b8(0x286)](0x3c));if(_0x562d2e[_0x5972b8(0x177)]&&_0x18585e[_0x5972b8(0x209)]){const _0x538765=a29_0x219842['dim'](_0x5972b8(0x2ad))+'\x20'+a29_0x219842[_0x5972b8(0x1a8)](_0x18585e[_0x5972b8(0x177)][_0x5972b8(0x276)]+'.'+_0x18585e['master']['table']);await this['displaySampleData'](_0x538765,_0x18585e[_0x5972b8(0x209)]);}else{if(_0x562d2e['attribute']&&_0x18585e[_0x5972b8(0x209)]){const _0xa13e2=a29_0x219842[_0x5972b8(0x17a)](_0x5972b8(0x236))+'\x20'+a29_0x219842[_0x5972b8(0x1a8)](_0x562d2e[_0x5972b8(0x1e0)]);await this['displaySampleData'](_0xa13e2,_0x18585e[_0x5972b8(0x209)]);}else{if(_0x562d2e[_0x5972b8(0x18c)]&&_0x18585e['sampleData']){const _0x23ad21=a29_0x219842[_0x5972b8(0x17a)]('Behavior:')+'\x20'+a29_0x219842[_0x5972b8(0x1a8)](_0x562d2e[_0x5972b8(0x18c)]);await this[_0x5972b8(0x19a)](_0x23ad21,_0x18585e['sampleData']);}else{if(_0x562d2e[_0x5972b8(0x181)]&&_0x18585e['sampleData']){const _0x4ebde3=a29_0x219842[_0x5972b8(0x17a)](_0x5972b8(0x292))+'\x20'+a29_0x219842[_0x5972b8(0x1a8)](_0x5972b8(0x17b));await this[_0x5972b8(0x19a)](_0x4ebde3,_0x18585e['sampleData']);}else!_0x18585e[_0x5972b8(0x209)]&&console[_0x5972b8(0x1cf)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x18585e['errors'][_0x5972b8(0x1a1)]>0x0){console['error']('─'['repeat'](0x3c)),console[_0x5972b8(0x1cf)]('\x0a'+a29_0x219842['red'](_0x5972b8(0x290)));for(const _0x3bd714 of _0x18585e['errors']){console[_0x5972b8(0x1cf)]('\x20\x20'+a29_0x219842[_0x5972b8(0x1c5)]('•')+'\x20'+_0x3bd714);}}}async[a29_0x438648(0x19a)](_0x51a5a0,_0x5183cd){const _0x255bc8=a29_0x438648;if(_0x5183cd[_0x255bc8(0x1a1)]===0x0){console[_0x255bc8(0x1cf)]('\x0a'+_0x51a5a0),console[_0x255bc8(0x1cf)](_0x255bc8(0x1b5));return;}console[_0x255bc8(0x1cf)]('\x0a'+_0x51a5a0);const _0x417be2=Object[_0x255bc8(0x26a)](_0x5183cd[0x0])[_0x255bc8(0x267)](_0x477c77=>({'name':_0x477c77,'type':typeof _0x5183cd[0x0][_0x477c77]===_0x255bc8(0x2f1)?'double':_0x255bc8(0x1ad)})),_0x9e8c95={'queryId':_0x255bc8(0x2ca),'columns':_0x417be2,'data':_0x5183cd,'stats':{'state':_0x255bc8(0x265),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5183cd[_0x255bc8(0x1a1)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1fdfbe=formatAsTable(_0x9e8c95,_0x5183cd[_0x255bc8(0x1a1)],!![]);await writeOutput(_0x1fdfbe,undefined,_0x255bc8(0x2a3));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x222);['description']=a29_0x438648(0x195);async['execute'](_0x5aae7b){const _0x383c8f=a29_0x438648,{options:_0x191df6,args:_0x194f13,tdx:_0x4ddfcf}=_0x5aae7b,_0x1d7c53=_0x191df6,_0x58af96=_0x194f13[0x0]||_0x191df6[_0x383c8f(0x277)];if(!_0x58af96)return showParentSegmentNotSetError(_0x383c8f(0x243)+_0x383c8f(0x1a0)),0x1;const _0x2a8efc=resolveYamlFile(_0x58af96);if(existsSync(_0x2a8efc)){_0x1d7c53['verbose']&&console['error'](_0x383c8f(0x26d)+_0x2a8efc);let _0x365c42;try{_0x365c42=readFileSync(_0x2a8efc,_0x383c8f(0x18a));}catch(_0x5d2211){const _0x1ddfbb=_0x5d2211 instanceof Error?_0x5d2211[_0x383c8f(0x207)]:String(_0x5d2211);return console[_0x383c8f(0x1cf)]('Error\x20reading\x20file:\x20'+_0x1ddfbb),0x1;}const _0x38c943=await withSpinner(_0x383c8f(0x296),()=>_0x4ddfcf[_0x383c8f(0x28e)][_0x383c8f(0x1f3)](_0x365c42),{'verbose':_0x1d7c53[_0x383c8f(0x211)]}),_0x3878c0=_0x38c943['data'],{isNew:_0x37b41d,name:_0x35404e,hasChanges:_0xf4faa5,diffFormatted:_0x1efe3a}=_0x3878c0;if(_0xf4faa5){_0x37b41d?console[_0x383c8f(0x1cf)](_0x383c8f(0x240)+_0x35404e+'\x27:'):console[_0x383c8f(0x1cf)](_0x383c8f(0x233)+_0x35404e+'\x27:');console[_0x383c8f(0x1cf)]('─'[_0x383c8f(0x286)](0x3c)),console[_0x383c8f(0x1cf)](_0x1efe3a),console[_0x383c8f(0x1cf)]('─'['repeat'](0x3c));const _0x11fd22=_0x37b41d?'Create\x20parent\x20segment\x20\x27'+_0x35404e+_0x383c8f(0x2fd):'Apply\x20changes\x20to\x20\x27'+_0x35404e+_0x383c8f(0x2fd);if(!_0x1d7c53['yes']){if(!isInteractive())return console[_0x383c8f(0x1cf)](a29_0x219842[_0x383c8f(0x1c5)](_0x383c8f(0x20c)),_0x383c8f(0x1f5)),console[_0x383c8f(0x1cf)](a29_0x219842[_0x383c8f(0x17a)](_0x383c8f(0x1cc))),0x1;const _0x4cd922=await confirmKey(_0x11fd22);if(!_0x4cd922)return console[_0x383c8f(0x1cf)](a29_0x219842[_0x383c8f(0x20b)](_0x383c8f(0x283))),0x1;}const _0x456987=_0x37b41d?_0x383c8f(0x1a6):_0x383c8f(0x2e8);await withSpinner(_0x456987+_0x383c8f(0x184)+_0x35404e+_0x383c8f(0x266),()=>_0x3878c0[_0x383c8f(0x2e3)](),{'verbose':_0x1d7c53[_0x383c8f(0x211)]});const _0x1512a5=_0x37b41d?'Created':_0x383c8f(0x2ff);console['error']('✔\x20'+_0x1512a5+_0x383c8f(0x184)+_0x35404e+'\x27');}else console['error'](_0x383c8f(0x2ce)+_0x35404e+'\x27\x20is\x20up\x20to\x20date');}const _0x111a33=await withSpinner(_0x383c8f(0x2a9)+_0x58af96+'\x27...',()=>_0x4ddfcf[_0x383c8f(0x28e)][_0x383c8f(0x178)](_0x58af96),{'verbose':_0x1d7c53[_0x383c8f(0x211)]}),_0x29f3eb=_0x111a33[_0x383c8f(0x1e7)],_0x220c1d=getConsoleUrl(_0x1d7c53['site'],_0x383c8f(0x2c5)+_0x29f3eb[_0x383c8f(0x19f)]+'/sessions/'+_0x29f3eb[_0x383c8f(0x2bc)]+_0x383c8f(0x281)+_0x29f3eb['workflowAttemptId']);return console[_0x383c8f(0x1cf)](_0x383c8f(0x2b9)),console[_0x383c8f(0x1cf)]('\x20\x20'+a29_0x219842[_0x383c8f(0x17a)]('Audience\x20ID:')+'\x20'+_0x29f3eb[_0x383c8f(0x1b4)]),console[_0x383c8f(0x1cf)]('\x20\x20'+a29_0x219842[_0x383c8f(0x17a)](_0x383c8f(0x1fa))+'\x20'+_0x29f3eb[_0x383c8f(0x1ec)]),console[_0x383c8f(0x1cf)]('\x20\x20'+a29_0x219842[_0x383c8f(0x17a)](_0x383c8f(0x2cd))+'\x20'+_0x29f3eb[_0x383c8f(0x2bc)]),console['error']('\x20\x20'+a29_0x219842[_0x383c8f(0x17a)](_0x383c8f(0x2f6))+'\x20'+_0x29f3eb[_0x383c8f(0x19c)]),console['error']('\x20\x20'+_0x220c1d),console[_0x383c8f(0x1cf)]('\x0a'+a29_0x219842[_0x383c8f(0x17a)]('To\x20cancel:')+_0x383c8f(0x1e8)+_0x29f3eb[_0x383c8f(0x19c)]+_0x383c8f(0x2d3)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a29_0x438648(0x2c6);['description']='List\x20available\x20fields\x20for\x20segmentation';async[a29_0x438648(0x197)](_0x4ec7ea){const _0x26bef1=a29_0x438648,{options:_0x428665,args:_0x554843,tdx:_0x5bdc99}=_0x4ec7ea,_0x7aa559=_0x554843[0x0]||_0x428665[_0x26bef1(0x277)];if(!_0x7aa559)return showParentSegmentNotSetError(_0x26bef1(0x1d6)+_0x26bef1(0x2f9)),0x1;_0x428665[_0x26bef1(0x211)]&&(console[_0x26bef1(0x1cf)](_0x26bef1(0x1e4)+_0x428665[_0x26bef1(0x300)]),console[_0x26bef1(0x1cf)]('Parent\x20segment:\x20'+_0x7aa559));const _0x2b40dc=await withSpinner(_0x26bef1(0x1c8)+_0x7aa559+'\x27...',()=>_0x5bdc99[_0x26bef1(0x28e)]['listFields'](_0x7aa559),{'verbose':_0x428665['verbose']}),_0x471774=_0x2b40dc[_0x26bef1(0x1e7)];console[_0x26bef1(0x1cf)]('✔\x20Found\x20'+_0x471774[_0x26bef1(0x1a1)]+_0x26bef1(0x2f8)+(_0x471774['length']!==0x1?'s':''));if(_0x428665[_0x26bef1(0x23d)]||_0x428665[_0x26bef1(0x1dc)])return await handleSDKOutput(_0x471774,_0x428665),0x0;return displayFieldsHumanReadable(_0x471774,_0x7aa559),0x0;}}function a29_0x39c8(_0x2ea7f5,_0x589a6f){_0x2ea7f5=_0x2ea7f5-0x177;const _0x32437b=a29_0x3243();let _0x39c89c=_0x32437b[_0x2ea7f5];return _0x39c89c;}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x438648(0x29b);[a29_0x438648(0x2b7)]=a29_0x438648(0x23a);async[a29_0x438648(0x197)](_0x4b98ec){const _0x1a698b=a29_0x438648,{options:_0x484725,args:_0x3bd91c,tdx:_0x3e2633}=_0x4b98ec,_0x4f8446=_0x484725,_0x22b9cf=_0x3bd91c[0x0]||_0x484725[_0x1a698b(0x277)];if(!_0x22b9cf)return showParentSegmentNotSetError(_0x1a698b(0x227)+_0x1a698b(0x26b)+'Options:\x0a'+_0x1a698b(0x1ac)),0x1;_0x484725[_0x1a698b(0x211)]&&(console['error'](_0x1a698b(0x1e4)+_0x484725['site']),console['error'](_0x1a698b(0x1e9)+_0x22b9cf));const _0x5432d6=await withSpinner(_0x1a698b(0x2dd)+_0x22b9cf+'\x27...',()=>_0x3e2633[_0x1a698b(0x28e)][_0x1a698b(0x1c2)](_0x22b9cf),{'verbose':_0x484725[_0x1a698b(0x211)]}),_0x4788a1=_0x5432d6[_0x1a698b(0x1e7)];if(_0x4f8446[_0x1a698b(0x218)]){const _0x2187d8=getConsoleNextUrl(_0x4f8446[_0x1a698b(0x300)],_0x1a698b(0x19b)+_0x4788a1['id']);return console['error'](a29_0x219842[_0x1a698b(0x297)]('✔')+_0x1a698b(0x2ba)+a29_0x219842[_0x1a698b(0x24f)](_0x2187d8)),openBrowser(_0x2187d8),0x0;}return await handleSingleObjectOutput(_0x4788a1,_0x484725),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x269);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x59c0f3){const _0x377172=a29_0x438648,{options:_0x41ca40,args:_0x2fdaef,tdx:_0x525e6f}=_0x59c0f3,_0x3a4198=_0x41ca40,_0x3be864=_0x2fdaef[0x0]||_0x41ca40[_0x377172(0x277)];if(!_0x3be864)return showParentSegmentNotSetError(_0x377172(0x254)+_0x377172(0x2a8)+'Options:\x0a'+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x41ca40[_0x377172(0x211)]&&(console[_0x377172(0x1cf)](_0x377172(0x1e4)+_0x41ca40['site']),console[_0x377172(0x1cf)](_0x377172(0x1e9)+_0x3be864));const _0x22efb7=await withSpinner(_0x377172(0x298)+_0x3be864+_0x377172(0x266),()=>_0x525e6f[_0x377172(0x28e)]['resolveParentId'](_0x3be864),{'verbose':_0x41ca40['verbose']}),_0x5f4465=_0x22efb7[_0x377172(0x1e7)],_0x247876=_0x525e6f[_0x377172(0x28e)]['getOutputDatabaseName'](_0x5f4465);if(_0x3a4198[_0x377172(0x2fa)]){const _0x2c8be5=await this['collectSchema'](_0x59c0f3,_0x3be864,_0x5f4465,_0x247876),_0x34af49=this[_0x377172(0x261)](_0x2c8be5);writeFileSync(_0x3a4198[_0x377172(0x2fa)],_0x34af49);const _0x22edc6=_0x2c8be5[_0x377172(0x248)]['columns'][_0x377172(0x1a1)]+_0x2c8be5[_0x377172(0x288)][_0x377172(0x17c)]((_0x43eee8,_0x47c1f9)=>_0x43eee8+_0x47c1f9[_0x377172(0x293)]['length'],0x0),_0x34719e=_0x2c8be5[_0x377172(0x288)][_0x377172(0x1c7)](_0x44d3f2=>_0x44d3f2[_0x377172(0x293)][_0x377172(0x1a1)]===0x0)['length'];return console[_0x377172(0x294)](_0x377172(0x224)+_0x3a4198[_0x377172(0x2fa)]),console[_0x377172(0x294)]('\x20\x20Database:\x20'+_0x247876),console[_0x377172(0x294)](_0x377172(0x1f1)+_0x2c8be5[_0x377172(0x288)][_0x377172(0x1a1)]+'\x20behaviors'),console[_0x377172(0x294)](_0x377172(0x29a)+_0x22edc6+_0x377172(0x188)),_0x34719e>0x0&&console[_0x377172(0x294)]('\x20\x20Note:\x20'+_0x34719e+_0x377172(0x2c9)),0x0;}console[_0x377172(0x1cf)]('\x0a'+a29_0x219842[_0x377172(0x1a8)](_0x377172(0x1b8))+'\x20'+a29_0x219842[_0x377172(0x24f)](_0x247876));const _0x5ed65e=await withSpinner(_0x377172(0x25b),()=>_0x525e6f[_0x377172(0x28e)][_0x377172(0x1b1)](_0x5f4465),{'verbose':_0x41ca40[_0x377172(0x211)]});console['error']('\x0a'+a29_0x219842['bold']('customers')+'\x20'+a29_0x219842[_0x377172(0x17a)]('('+_0x247876+_0x377172(0x2be)));const _0x2cb76c=await executeSchemaQuery(_0x5ed65e[_0x377172(0x1e7)],_0x525e6f,_0x41ca40);await handleQueryOutput(_0x2cb76c,_0x41ca40);const _0x2a7384=await withSpinner(_0x377172(0x268),()=>_0x525e6f[_0x377172(0x28e)][_0x377172(0x217)](_0x5f4465),{'verbose':_0x41ca40[_0x377172(0x211)]});for(const _0x22757c of _0x2a7384['data']){const _0x36955f='behavior_'+_0x22757c[_0x377172(0x1bf)]()[_0x377172(0x1ab)](/\s+/g,'_'),_0x537fd9=_0x377172(0x2a7)+_0x247876+'.'+_0x36955f;console[_0x377172(0x1cf)]('\x0a'+a29_0x219842['bold'](_0x22757c)+'\x20'+a29_0x219842['dim']('('+_0x247876+'.'+_0x36955f+')'));try{const _0x39900a=await executeSchemaQuery(_0x537fd9,_0x525e6f,_0x41ca40);await handleQueryOutput(_0x39900a,_0x41ca40);}catch{console['error'](a29_0x219842[_0x377172(0x20b)](_0x377172(0x1ce)));}}return 0x0;}async[a29_0x438648(0x29f)](_0x58f7d2,_0x766b57,_0x5c65a6,_0x1a33b3){const _0x39a854=a29_0x438648,{options:_0x1ae9a1,tdx:_0x1e8f2a}=_0x58f7d2,_0x487b04=await withSpinner(_0x39a854(0x25b),()=>_0x1e8f2a[_0x39a854(0x28e)][_0x39a854(0x1b1)](_0x5c65a6),{'verbose':_0x1ae9a1['verbose']}),_0x5cfb80=await executeSchemaQuery(_0x487b04[_0x39a854(0x1e7)],_0x1e8f2a,_0x1ae9a1),_0x129477=_0x5cfb80[_0x39a854(0x1e7)][_0x39a854(0x267)](_0x1fff83=>({'name':_0x1fff83[_0x39a854(0x287)],'type':_0x1fff83[_0x39a854(0x1ed)]})),_0x37fa39=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x1e8f2a[_0x39a854(0x28e)][_0x39a854(0x217)](_0x5c65a6),{'verbose':_0x1ae9a1[_0x39a854(0x211)]}),_0xa591e0=[];for(const _0x19cc5d of _0x37fa39[_0x39a854(0x1e7)]){const _0x2f4af2=_0x39a854(0x2fc)+_0x19cc5d[_0x39a854(0x1bf)]()['replace'](/\s+/g,'_'),_0x26ccd1=_0x39a854(0x2a7)+_0x1a33b3+'.'+_0x2f4af2;let _0x2d65d5=[];try{const _0xc3a3c1=await executeSchemaQuery(_0x26ccd1,_0x1e8f2a,_0x1ae9a1);_0x2d65d5=_0xc3a3c1['data'][_0x39a854(0x267)](_0x41317e=>({'name':_0x41317e['column_name'],'type':_0x41317e['column_type']}));}catch{}_0xa591e0['push']({'table':_0x2f4af2,'columns':_0x2d65d5});}return{'database':_0x1a33b3,'parent_segment':_0x766b57,'parent_id':_0x5c65a6,'customers':{'table':'customers','columns':_0x129477},'behaviors':_0xa591e0};}[a29_0x438648(0x261)](_0x3a1d7f){const _0x5a3ac4=a29_0x438648,_0x586007=_0x5a06c4=>{const _0x39a039=a29_0x39c8;if(_0x5a06c4[_0x39a039(0x1a1)]===0x0)return'[]';const _0x11cba0=_0x5a06c4[_0x39a039(0x267)](_0x1f6166=>_0x39a039(0x2af)+_0x1f6166[_0x39a039(0x2bd)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x1f6166[_0x39a039(0x250)]+_0x39a039(0x1f4));return'[\x0a'+_0x11cba0[_0x39a039(0x2df)](',\x0a')+_0x39a039(0x1fb);},_0x4c95a2=_0x3a1d7f[_0x5a3ac4(0x288)][_0x5a3ac4(0x267)](_0x1eaefe=>{const _0x4e79bf=_0x5a3ac4;return _0x4e79bf(0x1e1)+_0x1eaefe[_0x4e79bf(0x2a3)]+_0x4e79bf(0x25f)+_0x586007(_0x1eaefe[_0x4e79bf(0x293)])[_0x4e79bf(0x1ab)](/^/gm,'\x20\x20')['trim']()+_0x4e79bf(0x239);})[_0x5a3ac4(0x2df)](',\x0a');return _0x5a3ac4(0x2c2)+_0x3a1d7f['database']+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x3a1d7f['parent_segment']+_0x5a3ac4(0x2ec)+_0x3a1d7f[_0x5a3ac4(0x2c1)]+_0x5a3ac4(0x256)+_0x3a1d7f[_0x5a3ac4(0x248)][_0x5a3ac4(0x2a3)]+_0x5a3ac4(0x216)+_0x586007(_0x3a1d7f['customers'][_0x5a3ac4(0x293)])[_0x5a3ac4(0x1ab)](/^/gm,'\x20\x20')['trim']()+_0x5a3ac4(0x1e5)+_0x4c95a2+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x438648(0x2bd)]='segment:parent:sql';[a29_0x438648(0x2b7)]=a29_0x438648(0x2a0);async[a29_0x438648(0x197)](_0x26d892){const _0x186a02=a29_0x438648,{options:_0x1b18d7,args:_0x41d124,tdx:_0x52b931}=_0x26d892,_0x4241f0=_0x41d124[0x0]||_0x1b18d7[_0x186a02(0x277)];if(!_0x4241f0)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x1b18d7['verbose']&&(console[_0x186a02(0x1cf)](_0x186a02(0x1e4)+_0x1b18d7[_0x186a02(0x300)]),console['error'](_0x186a02(0x1e9)+_0x4241f0));const _0x379128=await withSpinner(_0x186a02(0x298)+_0x4241f0+'\x27...',()=>_0x52b931[_0x186a02(0x28e)]['resolveParentId'](_0x4241f0),{'verbose':_0x1b18d7[_0x186a02(0x211)]}),_0x5c2ab1=_0x379128[_0x186a02(0x1e7)],_0x12b8f5=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4241f0+_0x186a02(0x266),()=>_0x52b931[_0x186a02(0x28e)][_0x186a02(0x1b1)](_0x5c2ab1),{'verbose':_0x1b18d7['verbose']}),_0x3fe5a4=_0x12b8f5[_0x186a02(0x1e7)];return _0x1b18d7[_0x186a02(0x18d)]===_0x186a02(0x23d)||_0x1b18d7[_0x186a02(0x18d)]===_0x186a02(0x1dc)?await handleSDKOutput([{'sql':_0x3fe5a4}],_0x1b18d7):console[_0x186a02(0x294)](_0x3fe5a4),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x1a5);[a29_0x438648(0x2b7)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a29_0x438648(0x197)](_0x4ceaef){const _0x5d2e24=a29_0x438648,{options:_0x470123,args:_0xbe685f,tdx:_0x475ae8}=_0x4ceaef,_0x2b3e52=_0xbe685f[0x0]||_0x470123[_0x5d2e24(0x277)];if(!_0x2b3e52)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x5d2e24(0x201)),0x1;_0x470123[_0x5d2e24(0x211)]&&(console[_0x5d2e24(0x1cf)](_0x5d2e24(0x1e4)+_0x470123[_0x5d2e24(0x300)]),console[_0x5d2e24(0x1cf)](_0x5d2e24(0x1e9)+_0x2b3e52));const _0x42f96a=await withSpinner(_0x5d2e24(0x298)+_0x2b3e52+_0x5d2e24(0x266),()=>_0x475ae8['segment'][_0x5d2e24(0x1cd)](_0x2b3e52),{'verbose':_0x470123[_0x5d2e24(0x211)]}),_0x165272=_0x42f96a[_0x5d2e24(0x1e7)],_0xf9445c=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2b3e52+_0x5d2e24(0x266),()=>_0x475ae8[_0x5d2e24(0x28e)][_0x5d2e24(0x1b1)](_0x165272),{'verbose':_0x470123[_0x5d2e24(0x211)]});let _0x29cf28=_0xf9445c['data'];const _0x316c96=resolveLimit(_0x470123['limit'],DEFAULT_DISPLAY_LIMIT),_0x1b8562=/\bLIMIT\s+\d+/i[_0x5d2e24(0x1c9)](_0x29cf28);!_0x1b8562&&(_0x29cf28=_0x29cf28[_0x5d2e24(0x2ee)]()['replace'](/;+$/,''),_0x29cf28=_0x5d2e24(0x29d)+_0x29cf28+_0x5d2e24(0x220)+_0x316c96);_0x470123[_0x5d2e24(0x211)]&&console[_0x5d2e24(0x1cf)](_0x5d2e24(0x27e)+_0x29cf28);const _0x424c54=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x36d84b=>{const _0x2cabe9=_0x5d2e24,_0x24194c=await _0x475ae8[_0x2cabe9(0x179)]['execute'](_0x29cf28,{'catalog':'td','schema':_0x2cabe9(0x2f3),'onJobId':_0x200b9a=>{const _0x1cae53=_0x2cabe9;_0x36d84b[_0x1cae53(0x2b3)](_0x200b9a);}});return _0x24194c;},{'verbose':_0x470123[_0x5d2e24(0x211)]}),_0x41fea5=_0x424c54['data'],_0x538e50=_0x41fea5[_0x5d2e24(0x2b2)]?'\x20[Job\x20ID:\x20'+_0x41fea5['jobId']+']':'';return console[_0x5d2e24(0x1cf)](_0x5d2e24(0x1a4)+_0x41fea5['stats'][_0x5d2e24(0x257)][_0x5d2e24(0x1f7)]()+_0x5d2e24(0x1e6)+(_0x5d2e24(0x203)+formatElapsed(_0x41fea5['stats']['elapsedTimeMillis'])+_0x538e50)),await handleQueryOutput(_0x41fea5,_0x470123),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a29_0x438648(0x2e5);[a29_0x438648(0x2b7)]=a29_0x438648(0x2a5);async[a29_0x438648(0x197)](_0x486c5d){const _0x2fcccb=a29_0x438648,{options:_0x20673e,args:_0xa739fc,tdx:_0xdaf854}=_0x486c5d,_0x1a06c0=_0xa739fc[0x0],_0x1a2401=await withSpinner(_0x1a06c0?_0x2fcccb(0x190)+_0x1a06c0+_0x2fcccb(0x266):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0xdaf854[_0x2fcccb(0x27a)]['list'](),{'verbose':_0x20673e[_0x2fcccb(0x211)]});let _0x109692=_0x1a2401[_0x2fcccb(0x1e7)]['filter'](_0x25d087=>_0x25d087[_0x2fcccb(0x17e)]);if(_0x1a06c0){const _0x849f78=_0x1a06c0[_0x2fcccb(0x1ab)](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x5cb9f4=new RegExp('^'+_0x849f78+'$','i');_0x109692=_0x109692[_0x2fcccb(0x1c7)](_0x325cd6=>_0x5cb9f4[_0x2fcccb(0x1c9)](_0x325cd6[_0x2fcccb(0x2bd)]));}_0x109692[_0x2fcccb(0x25c)]((_0xfbdfe3,_0x129243)=>_0xfbdfe3[_0x2fcccb(0x2bd)][_0x2fcccb(0x284)](_0x129243[_0x2fcccb(0x2bd)])),console[_0x2fcccb(0x1cf)]('✔\x20Found\x20'+_0x109692[_0x2fcccb(0x1a1)]+_0x2fcccb(0x231)+(_0x109692[_0x2fcccb(0x1a1)]!==0x1?'s':''));const _0x55ead6=_0x48783a=>{const _0x4dc74e=_0x2fcccb;return getConsoleNextUrl(_0x20673e[_0x4dc74e(0x300)],'/app/dw/parentSegments/'+_0x48783a);};if(_0x20673e[_0x2fcccb(0x18d)]===_0x2fcccb(0x23d)||_0x20673e[_0x2fcccb(0x18d)]===_0x2fcccb(0x1dc)){const _0x5af6b7=_0x109692[_0x2fcccb(0x267)](_0x2cd564=>({..._0x2cd564,'url':_0x55ead6(_0x2cd564['id'])}));await handleSDKOutput(_0x5af6b7,_0x20673e);}else{if(_0x109692[_0x2fcccb(0x1a1)]===0x0)console[_0x2fcccb(0x294)](_0x2fcccb(0x23f));else for(const _0xd7e568 of _0x109692){const _0x43b2fc=_0xd7e568[_0x2fcccb(0x213)]?a29_0x219842[_0x2fcccb(0x17a)]('\x20('+formatRows(_0xd7e568['population'])+')'):'',_0x131c38=hyperlink(_0xd7e568[_0x2fcccb(0x2bd)],_0x55ead6(_0xd7e568['id']));console[_0x2fcccb(0x294)]('⚡\x20'+_0x131c38+_0x43b2fc);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x2ae);[a29_0x438648(0x2b7)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a29_0x438648(0x197)](_0x5116e4){const _0x34dff4=a29_0x438648,{options:_0x2dcab6,args:_0x3db57d,tdx:_0x5c8a71}=_0x5116e4,_0x3419ab=_0x3db57d[0x0]||_0x2dcab6[_0x34dff4(0x277)];if(!_0x3419ab)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x4f1469=resolveYamlFile(_0x3419ab);if(!existsSync(_0x4f1469))return showFileNotFoundError(_0x4f1469,_0x3419ab),0x1;let _0x47ee4d;try{_0x47ee4d=readFileSync(_0x4f1469,'utf-8');}catch(_0x199cd7){const _0x5afa91=_0x199cd7 instanceof Error?_0x199cd7['message']:String(_0x199cd7);return console[_0x34dff4(0x1cf)]('Error\x20reading\x20file:\x20'+_0x5afa91),0x1;}const _0x4533cd=createCommandSpinner(a29_0x219842[_0x34dff4(0x17a)](_0x34dff4(0x274)),{'verbose':_0x2dcab6[_0x34dff4(0x211)]});_0x4533cd['start']();const _0x1b8223={'realtime':!![],'onProgress':_0x5ccd5c=>{const _0x2d7262=_0x34dff4;_0x4533cd[_0x2d7262(0x1d3)]=formatProgressMessage(_0x5ccd5c);}};let _0x5081cd;try{_0x5081cd=await _0x5c8a71[_0x34dff4(0x28e)]['validateParentYaml'](_0x47ee4d,_0x1b8223),_0x4533cd[_0x34dff4(0x20f)]();}catch(_0x59f1c8){_0x4533cd['stop']();throw _0x59f1c8;}console[_0x34dff4(0x1cf)]('\x0a'+a29_0x219842[_0x34dff4(0x1a8)](_0x34dff4(0x182))+'\x20'+_0x5081cd[_0x34dff4(0x2bd)]),console[_0x34dff4(0x1cf)]('═'[_0x34dff4(0x286)](0x3c)),displayRealtimeValidation(_0x5081cd),console['error']('─'[_0x34dff4(0x286)](0x3c));if(_0x5081cd[_0x34dff4(0x192)][_0x34dff4(0x1a1)]>0x0){console[_0x34dff4(0x1cf)]('\x0a'+a29_0x219842[_0x34dff4(0x1c5)](_0x34dff4(0x290)));for(const _0x6a3abc of _0x5081cd['errors']){console['error']('\x20\x20'+a29_0x219842['red']('•')+'\x20'+_0x6a3abc);}}return _0x5081cd[_0x34dff4(0x28f)]&&console['error']('\x0a'+a29_0x219842[_0x34dff4(0x297)]('✔')+_0x34dff4(0x28c)),_0x5081cd['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x438648(0x2bd)]=a29_0x438648(0x2b1);[a29_0x438648(0x2b7)]=a29_0x438648(0x232);async[a29_0x438648(0x197)](_0x210c01){const _0x240698=a29_0x438648,{options:_0x24fca0,args:_0x9a3f03,tdx:_0x298c87}=_0x210c01,_0x536ffd=_0x9a3f03[0x0]||_0x24fca0[_0x240698(0x277)];if(!_0x536ffd)return showParentSegmentNotSetError(_0x240698(0x2a1)+_0x240698(0x29c)),0x1;const _0x3e0fac=await withSpinner(_0x240698(0x298)+_0x536ffd+_0x240698(0x266),()=>_0x298c87[_0x240698(0x28e)]['resolveParentId'](_0x536ffd),{'verbose':_0x24fca0['verbose']}),_0x5e0c61=_0x3e0fac[_0x240698(0x1e7)],_0x1180a3=await withSpinner(_0x240698(0x275)+_0x536ffd+_0x240698(0x266),()=>_0x298c87['personalization'][_0x240698(0x253)](_0x5e0c61),{'verbose':_0x24fca0[_0x240698(0x211)]}),_0x4c14b3=_0x1180a3[_0x240698(0x1e7)];console[_0x240698(0x1cf)]('✔\x20Found\x20'+_0x4c14b3[_0x240698(0x1a1)]+_0x240698(0x219)+(_0x4c14b3['length']!==0x1?'s':''));if(_0x24fca0[_0x240698(0x18d)]===_0x240698(0x23d)||_0x24fca0[_0x240698(0x18d)]===_0x240698(0x1dc))await handleSDKOutput(_0x4c14b3,_0x24fca0);else{if(_0x4c14b3['length']===0x0)console['log'](_0x240698(0x18f)),console['error'](a29_0x219842[_0x240698(0x24f)](_0x240698(0x1bd)));else for(const _0x33dc36 of _0x4c14b3){const _0x221f41=_0x33dc36['sections']?.[_0x240698(0x1a1)]||0x0,_0x20bbf7=_0x33dc36[_0x240698(0x193)]?a29_0x219842['dim'](_0x240698(0x2e2)+_0x33dc36[_0x240698(0x193)]):'',_0x149c80=a29_0x219842[_0x240698(0x17a)]('\x20('+_0x221f41+_0x240698(0x1ff)+(_0x221f41!==0x1?'s':'')+')');console[_0x240698(0x294)]('\x20\x20'+_0x33dc36[_0x240698(0x2bd)]+_0x20bbf7+_0x149c80),_0x33dc36['description']&&console[_0x240698(0x294)](_0x240698(0x2c3)+a29_0x219842[_0x240698(0x17a)](_0x33dc36[_0x240698(0x2b7)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']='ps:pz:init';[a29_0x438648(0x2b7)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async[a29_0x438648(0x197)](_0x1e004c){const _0x53a49a=a29_0x438648,{options:_0x222f5c,args:_0x367a07}=_0x1e004c,_0x4c0903=_0x367a07[0x0]||_0x222f5c[_0x53a49a(0x277)];if(!_0x4c0903)return showParentSegmentNotSetError(_0x53a49a(0x263)+_0x53a49a(0x26c)),0x1;const _0x2106d7=resolveYamlFile(_0x4c0903);if(!existsSync(_0x2106d7))return showFileNotFoundError(_0x2106d7,_0x4c0903),0x1;let _0x4fc5dd;try{_0x4fc5dd=readFileSync(_0x2106d7,_0x53a49a(0x18a));}catch(_0x487e79){const _0x35bb21=_0x487e79 instanceof Error?_0x487e79[_0x53a49a(0x207)]:String(_0x487e79);return console[_0x53a49a(0x1cf)]('Error\x20reading\x20file:\x20'+_0x35bb21),0x1;}let _0xc960dc;try{_0xc960dc=parseDef(_0x4fc5dd);}catch(_0x525a17){const _0x285491=_0x525a17 instanceof Error?_0x525a17[_0x53a49a(0x207)]:String(_0x525a17);return console[_0x53a49a(0x1cf)](a29_0x219842['red'](_0x53a49a(0x185)+_0x285491)),0x1;}if(_0xc960dc[_0x53a49a(0x2cc)]&&_0xc960dc['personalization_services'][_0x53a49a(0x1a1)]>0x0)return console[_0x53a49a(0x1cf)](a29_0x219842[_0x53a49a(0x20b)](_0x53a49a(0x1d8)+_0x2106d7)),console[_0x53a49a(0x1cf)](a29_0x219842[_0x53a49a(0x17a)](_0x53a49a(0x2d5)+_0xc960dc[_0x53a49a(0x2cc)]['length']+_0x53a49a(0x1e3))),0x1;!_0xc960dc[_0x53a49a(0x27a)]&&(_0xc960dc[_0x53a49a(0x27a)]={'events':[{'name':'page_view','source_table':'<database>.<table>'}],'attributes':[{'name':_0x53a49a(0x189),'type':_0x53a49a(0x28d)}],'id_stitching':{'primary_key':_0xc960dc[_0x53a49a(0x177)]['table']===_0x53a49a(0x248)?_0x53a49a(0x212):_0x53a49a(0x20a)}});_0xc960dc['personalization_services']=[{'name':'My\x20Service','description':_0x53a49a(0x272),'trigger_event':'page_view','sections':[{'name':_0x53a49a(0x200),'criteria':'true','attributes':[_0x53a49a(0x189)]}]}];const _0x2aed31=serializeDef(_0xc960dc);return writeFileSync(_0x2106d7,_0x2aed31,_0x53a49a(0x18a)),console[_0x53a49a(0x1cf)](a29_0x219842[_0x53a49a(0x297)]('✔')+_0x53a49a(0x244)+a29_0x219842[_0x53a49a(0x24f)](_0x2106d7)),(!_0xc960dc['realtime']||_0x4fc5dd[_0x53a49a(0x21e)](_0x53a49a(0x295))===-0x1)&&console[_0x53a49a(0x1cf)](a29_0x219842[_0x53a49a(0x297)]('✔')+_0x53a49a(0x196)),console[_0x53a49a(0x1cf)]('\x0a'+a29_0x219842[_0x53a49a(0x17a)]('Next\x20steps:')),console[_0x53a49a(0x1cf)]('\x20\x201.\x20Edit\x20'+_0x2106d7+_0x53a49a(0x21c)),console[_0x53a49a(0x1cf)](_0x53a49a(0x1b7)+a29_0x219842[_0x53a49a(0x17a)](_0x53a49a(0x29e)+_0x4c0903)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
1
+ const a29_0x4cec4b=a29_0x5785;(function(_0x8eeb4a,_0x4e7f65){const _0xade2a8=a29_0x5785,_0x5115be=_0x8eeb4a();while(!![]){try{const _0x269576=-parseInt(_0xade2a8(0x22b))/0x1+parseInt(_0xade2a8(0x1fd))/0x2*(parseInt(_0xade2a8(0x335))/0x3)+parseInt(_0xade2a8(0x29e))/0x4*(parseInt(_0xade2a8(0x294))/0x5)+parseInt(_0xade2a8(0x296))/0x6+-parseInt(_0xade2a8(0x21a))/0x7*(-parseInt(_0xade2a8(0x1f0))/0x8)+parseInt(_0xade2a8(0x308))/0x9*(parseInt(_0xade2a8(0x324))/0xa)+-parseInt(_0xade2a8(0x216))/0xb;if(_0x269576===_0x4e7f65)break;else _0x5115be['push'](_0x5115be['shift']());}catch(_0x2ad167){_0x5115be['push'](_0x5115be['shift']());}}}(a29_0x2649,0x20939));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x4e119f 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';function a29_0x2649(){const _0xd54934=['listFields','\x0aError:','limit','formatSchemaJson','jobId','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','interval','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','Error\x20reading\x20file:\x20','query','join','segment:parent:push','Name:\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','open','\x20field','behaviors','Attempt:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','table','1971IgblKH','.yml','yes','bold','errors','getBehaviorNames','\x20\x20Database:\x20','\x27\x20with\x20ID:\x20','Default','name','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','single','Show\x20parent\x20segment\x20details','platform','\x20\x20\x20\x20','site','\x20parent\x20segment\x20\x27','/app/dw/parentSegments/','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x201.\x20Edit\x20','stitchingKeys','No\x20personalization\x20services\x20configured','Site:\x20','green','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','getParentFull','collectSchema','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','11150ZANvcW','✔\x20Renamed\x20directory\x20to\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x0a\x20\x20\x20\x20]','number','Listing\x20personalization\x20services\x20for\x20\x27','/sessions/','Listing\x20fields\x20for\x20\x27','\x20\x20\x20\x20-\x20','elapsedTimeMillis','ps:pz:init','length','xdg-open','\x20parent\x20segment','Options:\x0a','createParent','rowCount','24sBFHFP','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','segment:parent:desc','My\x20Service','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Created','validateParentYaml','trigger_event','Creating\x20parent\x20segment\x20\x27','✘\x20Failed\x20to\x20rename\x20directory:\x20','population','behaviorsFile','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20personalization\x20service','sort','execute','previewParentYaml','audienceId','segment:parent:run','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','in\x20','getOutputDatabaseName','use','utf-8','Error:','foreignKey','Errors:','✔\x20Found\x20','trim','\x0a⚠️\x20\x20Both\x20','yellow','ps:rt:list','Table:\x20','parent_id','Parent\x20segment:\x20','label','sections','column_name','cyan','Updating','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','No\x20parent\x20segments\x20match\x20pattern:\x20','\x22,\x20\x22type\x22:\x20\x22','behavior','Fetching\x20behavior\x20list...','realtime','segment:parent:validate','\x20=\x20','status','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','type','328hDWaQI','displayValidateResults','\x20to\x20push\x20the\x20configuration','log','Get\x20SQL\x20query\x20for\x20parent\x20segment','personalizationServices','Found\x20YAML\x20file:\x20','allValid','\x20[Job\x20ID:\x20','/\x20→\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x0aChanges\x20to\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','9496mtNimk','output','last_page_viewed','database','displayAttributesStats','valid','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Customers:','red','displayBehaviorsStats','runParent','toLocaleString','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','resolveParentId','parent_segments','List\x20parent\x20segments','List\x20available\x20fields\x20for\x20segmentation','endsWith','list','\x20\x20Columns:\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20service(s)\x20configured','\x20rows\x20','attributes','\x27\x20and\x20run\x20workflow?','4435607rMllFf','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','sourceTableError','\x20section','22820nrgUXS','tdx\x20ps\x20preview\x20','segment:parent:preview','session','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Status:','YAML\x20file:\x20','Listing\x20parent\x20segments...','Resolving\x20parent\x20segment\x20\x27','Overwrite\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','To\x20view\x20sample\x20data:','%)\x20','Audience\x20ID:','RT\x202.0\x20Validate:','all','\x20kill','69461TAbvcf','No\x20parent\x20segments\x20found','\x27\x20is\x20up\x20to\x20date','\x0a⚠️\x20\x20Migrating:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','workflowId','customerGroup','RT\x202.0:','\x20RT-enabled\x20parent\x20segment','displayMasterInfo','matchedCount','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x0aNew\x20parent\x20segment\x20\x27','/\x20directories\x20exist.','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Apply\x20changes\x20to\x20\x27','column','segment','td_client_id','\x20\x20\x20\x20\x20\x20','events','Behavior:','web','pushParentYaml','customerPercent','parentSegment','SELECT\x20*\x20FROM\x20','Error\x20parsing\x20YAML:\x20','addBehaviors','\x0a\x20\x20\x20\x20}','behavior_','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','idStitching','verbose','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','segment:parent:pull','user_id','match','using\x20the\x20default\x20path:\x20','addAttributesFile','displayRealtimeInfo','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Aborted.','customers','\x0a✔\x20Workflow\x20started','schemaValid','test','columns','scheduleOption','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','getParentSQL','No\x20RT-enabled\x20parent\x20segments\x20found','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','joinKey','.yaml','\x20Context\x20set:\x20','data','totalEvents','✔\x20No\x20changes\x20-\x20\x27','/attempt/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x27\x20is\x20already\x20up\x20to\x20date','map','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20tdx\x20wf\x20attempt\x20','darwin','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','jsonl','repeat','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20service','true','Attributes:','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Available\x20behaviors:','coveragePercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Attributes','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20Opening\x20','Creating','\x0aNo\x20sample\x20data\x20available','To\x20cancel:','addBehaviorsFile','\x20rows)','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','Next\x20steps:','Source:','\x20behaviors','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','processedRows','segment:parent:create','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','customersWithEvents','displayPreviewHints','toFixed','\x27...','Fetching\x20customers\x20schema...','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','91195amGtCU','✔\x20Query\x20completed:\x20Processed\x20','375774yeZXuR','Columns:','stats','apply','Enriched:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','displaySummary','Options\x20(one\x20required):\x0a','28PfjHSL','parent_segment','scheduleType','Available\x20attributes:','✔\x20Updated\x20parent\x20segment\x20\x27','description','text','message','Executing\x20parent\x20segment\x20query...','format','string','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','timezone','\x20is\x20already\x20up\x20to\x20date','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','displayPreviewResults','Fetching\x20sample\x20data...','Fetching\x20SQL\x20for\x20\x27','master','localeCompare','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','ps:rt:validate','attribute','\x20\x202.\x20Run\x20','\x20--interval\x20','displaySampleData','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20\x20','Preview:','sampleData','workflowAttemptId','Master\x20+\x20Attributes','FINISHED','\x20No\x20changes\x20-\x20','displayColumns','\x20configured','Create\x20parent\x20segment\x20\x27','pullParentYaml','/{name}.yml\x0a','.customers)','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Fetching\x20parent\x20segment\x20\x27','schemaError','\x20RT\x20configuration\x20is\x20valid','error','information_schema','\x20total','workflowSessionId','<database>.<table>','tdx\x20ps\x20push\x20','Database:\x20','page_view','segment:parent:list','Updating\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','Validating\x20configuration...','varchar','Options:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','reduce','\x5c$&','Rows:','enriched','Validate:','toLowerCase','push','ps:pz:list','replace','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','filter','Events:','Validating\x20RT\x20configuration...','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','personalization_services','/\x20directory.\x0a','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','start','indexOf','json','stop','\x20--behavior\x20\x22','segment:parent:view','segment:parent:sql'];a29_0x2649=function(){return _0xd54934;};return a29_0x2649();}import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a29_0x483110 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=a29_0x4cec4b(0x20b),LEGACY_PARENT_SEGMENT_DIR=a29_0x4cec4b(0x29f);function openBrowser(_0x5225c6){const _0x49992e=a29_0x4cec4b,_0x413338=process[_0x49992e(0x315)],_0x3e1263=_0x413338===_0x49992e(0x26d)?_0x49992e(0x302):_0x413338==='win32'?_0x49992e(0x2ec):_0x49992e(0x330);spawn(_0x3e1263,[_0x5225c6],{'detached':!![],'stdio':'ignore'})['unref']();}function migrateLegacyDirectory(){const _0x535b35=a29_0x4cec4b;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x27c456=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x27c456['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x483110[_0x535b35(0x1db)](_0x535b35(0x1da)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x535b35(0x239))),console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x28a)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x535b35(0x2ea))),![];console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x1db)](_0x535b35(0x22e)+LEGACY_PARENT_SEGMENT_DIR+_0x535b35(0x1f9)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x31f)](_0x535b35(0x325)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x28b5c5){const _0x5adace=_0x28b5c5 instanceof Error?_0x28b5c5[_0x535b35(0x2a5)]:String(_0x28b5c5);return console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x205)](_0x535b35(0x33e)+_0x5adace+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0xaa439d){return migrateLegacyDirectory(),super['run'](_0xaa439d);}}function resolveYamlFile(_0x203b86){const _0x2429be=a29_0x4cec4b;if(_0x203b86[_0x2429be(0x20e)](_0x2429be(0x309))||_0x203b86[_0x2429be(0x20e)](_0x2429be(0x262)))return _0x203b86;return a29_0x4e119f[_0x2429be(0x2fd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x203b86)+_0x2429be(0x309));}function formatProgressMessage(_0x50446b){const _0x36cad9=a29_0x4cec4b,_0x1fbc9c=_0x50446b[_0x36cad9(0x251)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1fbc9c){const [,_0x1cd480,_0x272f62,_0x441415='']=_0x1fbc9c;return a29_0x483110[_0x36cad9(0x28a)](_0x1cd480+':')+'\x20'+_0x272f62+a29_0x483110[_0x36cad9(0x28a)](_0x441415);}return a29_0x483110[_0x36cad9(0x28a)](_0x50446b);}function showFileNotFoundError(_0x328d0f,_0x2c3cb4){const _0x2e632b=a29_0x4cec4b;console[_0x2e632b(0x2cb)](a29_0x483110[_0x2e632b(0x205)]('Error:\x20File\x20not\x20found:\x20'+_0x328d0f+'\x0a')),console[_0x2e632b(0x2cb)](a29_0x483110[_0x2e632b(0x1e3)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x2c3cb4+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x3e251d){const _0x3edb09=a29_0x4cec4b;if(!_0x3e251d['realtime'])return;const _0x586de0=_0x3e251d[_0x3edb09(0x1ea)],_0xbd7dc0=_0x586de0['enabled']?a29_0x483110[_0x3edb09(0x31f)]('⚡\x20Enabled'):a29_0x483110[_0x3edb09(0x1db)]('⚡\x20Not\x20enabled');console[_0x3edb09(0x2cb)]('\x0a'+a29_0x483110[_0x3edb09(0x28a)](_0x3edb09(0x232))+'\x20'+_0xbd7dc0);if(_0x586de0[_0x3edb09(0x240)]&&_0x586de0[_0x3edb09(0x240)][_0x3edb09(0x32f)]>0x0){console[_0x3edb09(0x2cb)]('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)](_0x3edb09(0x2e5))+'\x20'+_0x586de0['events'][_0x3edb09(0x32f)]+_0x3edb09(0x2c2));for(const _0xec9c82 of _0x586de0[_0x3edb09(0x240)]){const _0x7c7352=_0xec9c82['sourceTableValid']===![]?a29_0x483110[_0x3edb09(0x205)]('✘'):a29_0x483110[_0x3edb09(0x31f)]('✔');console[_0x3edb09(0x2cb)](_0x3edb09(0x316)+_0x7c7352+'\x20'+_0xec9c82[_0x3edb09(0x311)]),_0xec9c82[_0x3edb09(0x218)]&&console['error'](_0x3edb09(0x23f)+a29_0x483110[_0x3edb09(0x205)](_0xec9c82['sourceTableError']));}}if(_0x586de0[_0x3edb09(0x214)]&&_0x586de0['attributes']['length']>0x0){console['error']('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)](_0x3edb09(0x274))+'\x20'+_0x586de0[_0x3edb09(0x214)][_0x3edb09(0x32f)]+_0x3edb09(0x2c2));for(const _0x3b5792 of _0x586de0[_0x3edb09(0x214)]){const _0x2d5d48=_0x3b5792[_0x3edb09(0x202)]?a29_0x483110[_0x3edb09(0x31f)]('✔'):a29_0x483110[_0x3edb09(0x205)]('✘');console[_0x3edb09(0x2cb)]('\x20\x20\x20\x20'+_0x2d5d48+'\x20'+_0x3b5792[_0x3edb09(0x311)]+'\x20'+a29_0x483110[_0x3edb09(0x28a)]('('+_0x3b5792[_0x3edb09(0x1ef)]+')'));}}if(_0x586de0[_0x3edb09(0x24c)]){const _0x49d854=_0x586de0[_0x3edb09(0x24c)][_0x3edb09(0x31c)]?.[_0x3edb09(0x32f)]?'\x20+\x20['+_0x586de0[_0x3edb09(0x24c)][_0x3edb09(0x31c)][_0x3edb09(0x2fd)](',\x20')+']':'';console['error']('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)]('ID\x20Stitching:')+'\x20'+_0x586de0['idStitching']['primaryKey']+_0x49d854);}if(_0x586de0[_0x3edb09(0x1f5)]&&_0x586de0['personalizationServices'][_0x3edb09(0x32f)]>0x0){console[_0x3edb09(0x2cb)]('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)]('Personalization:')+'\x20'+_0x586de0[_0x3edb09(0x1f5)][_0x3edb09(0x32f)]+_0x3edb09(0x272)+(_0x586de0[_0x3edb09(0x1f5)][_0x3edb09(0x32f)]!==0x1?'s':''));for(const _0x4bbb98 of _0x586de0[_0x3edb09(0x1f5)]){console[_0x3edb09(0x2cb)](_0x3edb09(0x32c)+_0x4bbb98[_0x3edb09(0x311)]);}}}function showParentSegmentNotSetError(_0x14a5d8){const _0x3dc52d=a29_0x4cec4b;console[_0x3dc52d(0x2cb)](a29_0x483110[_0x3dc52d(0x1db)](_0x3dc52d(0x2d9))),console[_0x3dc52d(0x2cb)](_0x14a5d8);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2d3);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x20c);async[a29_0x4cec4b(0x1cb)](_0x3036c9){const _0x36ab7a=a29_0x4cec4b,{options:_0xdbe509,args:_0x290c72,tdx:_0x2eb7b7}=_0x3036c9,_0x2e6b8d=_0x290c72[0x0];_0xdbe509['verbose']&&(console[_0x36ab7a(0x2cb)](_0x36ab7a(0x31e)+_0xdbe509[_0x36ab7a(0x317)]),_0x2e6b8d&&console[_0x36ab7a(0x2cb)]('Pattern:\x20'+_0x2e6b8d));const _0x2ac92b=await withSpinner(_0x2e6b8d?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x2e6b8d+_0x36ab7a(0x291):_0x36ab7a(0x221),()=>_0x2eb7b7[_0x36ab7a(0x23d)]['listParents'](),{'verbose':_0xdbe509['verbose']});let _0x139311=_0x2ac92b[_0x36ab7a(0x264)];if(_0x2e6b8d){const _0x927b2f=_0x2e6b8d['replace'](/[.+^${}()|[\]\\]/g,_0x36ab7a(0x2db))[_0x36ab7a(0x2e2)](/\*/g,'.*')[_0x36ab7a(0x2e2)](/\?/g,'.'),_0x14af5b=new RegExp('^'+_0x927b2f+'$','i');_0x139311=_0x139311[_0x36ab7a(0x2e4)](_0x58dd73=>_0x14af5b[_0x36ab7a(0x25a)](_0x58dd73[_0x36ab7a(0x214)][_0x36ab7a(0x311)]));}_0x139311['sort']((_0x5687cc,_0x96225c)=>_0x5687cc[_0x36ab7a(0x214)]['name'][_0x36ab7a(0x2b2)](_0x96225c['attributes'][_0x36ab7a(0x311)])),console['error'](_0x36ab7a(0x1d8)+_0x139311[_0x36ab7a(0x32f)]+_0x36ab7a(0x331)+(_0x139311[_0x36ab7a(0x32f)]!==0x1?'s':''));const _0x15c54b=_0x1f76bf=>{const _0x429099=_0x36ab7a;return getConsoleNextUrl(_0xdbe509['site'],_0x429099(0x319)+_0x1f76bf);};if(_0xdbe509[_0x36ab7a(0x2a7)]==='json'||_0xdbe509['format']===_0x36ab7a(0x26f)){const _0xaeb087=_0x139311[_0x36ab7a(0x26a)](_0x134bab=>({..._0x134bab,'url':_0x15c54b(_0x134bab['id'])}));await handleSDKOutput(_0xaeb087,_0xdbe509);}else{if(_0x139311[_0x36ab7a(0x32f)]===0x0)_0x2e6b8d?console[_0x36ab7a(0x1f3)](_0x36ab7a(0x1e6)+_0x2e6b8d):console[_0x36ab7a(0x1f3)](_0x36ab7a(0x22c));else for(const _0x21bb02 of _0x139311){const _0x580699=_0x21bb02[_0x36ab7a(0x214)][_0x36ab7a(0x1c6)]?a29_0x483110[_0x36ab7a(0x28a)]('\x20('+formatRows(_0x21bb02[_0x36ab7a(0x214)]['population'])+')'):'',_0x399cef=hyperlink(_0x21bb02[_0x36ab7a(0x214)][_0x36ab7a(0x311)],_0x15c54b(_0x21bb02['id']));console[_0x36ab7a(0x1f3)]('👥\x20'+_0x399cef+_0x580699);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x288);[a29_0x4cec4b(0x2a3)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a29_0x4cec4b(0x1cb)](_0x1bc8bc){const _0x13ccf8=a29_0x4cec4b,{options:_0x5167dc,args:_0xca9c4a,tdx:_0x2bc5fb}=_0x1bc8bc;console[_0x13ccf8(0x2cb)](_0x13ccf8(0x312)+_0x13ccf8(0x209)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5e0c8a=_0x5167dc;if(_0xca9c4a[_0x13ccf8(0x32f)]===0x0)return console['error'](a29_0x483110[_0x13ccf8(0x205)](_0x13ccf8(0x1fc))),console[_0x13ccf8(0x2cb)](_0x13ccf8(0x26e)),0x1;const _0x4ef240=_0xca9c4a[0x0];if(!_0x5e0c8a[_0x13ccf8(0x200)]||!_0x5e0c8a[_0x13ccf8(0x307)])return console[_0x13ccf8(0x2cb)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x5e0c8a[_0x13ccf8(0x24d)]&&(console[_0x13ccf8(0x2cb)]('Site:\x20'+_0x5e0c8a[_0x13ccf8(0x317)]),console[_0x13ccf8(0x2cb)](_0x13ccf8(0x2ff)+_0x4ef240),console['error'](_0x13ccf8(0x2d1)+_0x5e0c8a[_0x13ccf8(0x200)]),console[_0x13ccf8(0x2cb)](_0x13ccf8(0x1dd)+_0x5e0c8a[_0x13ccf8(0x307)]));const _0xa3306b=await loadJSONFromOptions(_0x5e0c8a[_0x13ccf8(0x214)],_0x5e0c8a['attributesFile']),_0x472cfc=await loadJSONFromOptions(_0x5e0c8a[_0x13ccf8(0x304)],_0x5e0c8a[_0x13ccf8(0x1c7)]),_0x1ccc02=await loadJSONFromOptions(_0x5e0c8a[_0x13ccf8(0x231)],_0x5e0c8a['customerGroupFile']),_0x19eee8={'name':_0x4ef240,'description':_0x5e0c8a[_0x13ccf8(0x2a3)],'scheduleType':_0x5e0c8a[_0x13ccf8(0x2a0)],'scheduleOption':_0x5e0c8a[_0x13ccf8(0x25c)],'timezone':_0x5e0c8a['timezone'],'master':{'parentDatabaseName':_0x5e0c8a[_0x13ccf8(0x200)],'parentTableName':_0x5e0c8a[_0x13ccf8(0x307)]},'attributes':_0xa3306b,'behaviors':_0x472cfc,'customerGroup':_0x1ccc02},_0x4e258c=await withSpinner(_0x13ccf8(0x33d)+_0x4ef240+_0x13ccf8(0x291),()=>_0x2bc5fb['segment'][_0x13ccf8(0x333)](_0x19eee8),{'verbose':_0x5167dc[_0x13ccf8(0x24d)]}),_0x23b852=_0x4e258c[_0x13ccf8(0x264)];return console[_0x13ccf8(0x2cb)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x23b852['name']+_0x13ccf8(0x30f)+_0x23b852['id']),await handleSDKOutput([_0x23b852],_0x5167dc),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x4cec4b(0x311)]='segment:parent:update';[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x2f8);async[a29_0x4cec4b(0x1cb)](_0x3f6d80){const _0x338b33=a29_0x4cec4b,{options:_0x345542,args:_0x13a510,tdx:_0x486e7d}=_0x3f6d80;console[_0x338b33(0x2cb)](_0x338b33(0x2e8)+_0x338b33(0x209)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xca2f30=_0x345542;if(_0x13a510[_0x338b33(0x32f)]===0x0)return console[_0x338b33(0x2cb)](a29_0x483110[_0x338b33(0x205)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x338b33(0x2cb)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x2ef51b=_0x13a510[0x0];_0xca2f30['verbose']&&(console[_0x338b33(0x2cb)](_0x338b33(0x31e)+_0xca2f30['site']),console[_0x338b33(0x2cb)](_0x338b33(0x1df)+_0x2ef51b));const _0x15b9ca=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x2ef51b+_0x338b33(0x291),()=>_0x486e7d[_0x338b33(0x23d)][_0x338b33(0x321)](_0x2ef51b),{'verbose':_0xca2f30[_0x338b33(0x24d)]}),_0x14dd5f=_0x15b9ca[_0x338b33(0x264)],_0x5e4202=await loadJSONFromOptions(_0xca2f30['addAttributes'],_0xca2f30[_0x338b33(0x253)]),_0x481ee3=await loadJSONFromOptions(_0xca2f30[_0x338b33(0x248)],_0xca2f30[_0x338b33(0x27f)]),_0x286676={'name':_0x14dd5f[_0x338b33(0x311)],'description':_0xca2f30[_0x338b33(0x2a3)]!==undefined?_0xca2f30[_0x338b33(0x2a3)]:_0x14dd5f[_0x338b33(0x2a3)],'scheduleType':_0xca2f30[_0x338b33(0x2a0)]!==undefined?_0xca2f30[_0x338b33(0x2a0)]:_0x14dd5f[_0x338b33(0x2a0)],'scheduleOption':_0xca2f30[_0x338b33(0x25c)]!==undefined?_0xca2f30[_0x338b33(0x25c)]:_0x14dd5f[_0x338b33(0x25c)],'timezone':_0xca2f30[_0x338b33(0x2aa)]!==undefined?_0xca2f30[_0x338b33(0x2aa)]:_0x14dd5f[_0x338b33(0x2aa)],'master':_0x14dd5f[_0x338b33(0x2b1)],'attributes':_0x5e4202?[..._0x14dd5f[_0x338b33(0x214)]||[],..._0x5e4202]:_0x14dd5f[_0x338b33(0x214)],'behaviors':_0x481ee3?[..._0x14dd5f[_0x338b33(0x304)]||[],..._0x481ee3]:_0x14dd5f[_0x338b33(0x304)],'customerGroup':_0x14dd5f[_0x338b33(0x231)]},_0x1b0adf=await withSpinner(_0x338b33(0x2d4)+_0x2ef51b+_0x338b33(0x291),()=>_0x486e7d[_0x338b33(0x23d)]['updateParent'](_0x2ef51b,_0x286676),{'verbose':_0xca2f30[_0x338b33(0x24d)]}),_0x1b3d3f=_0x1b0adf['data'];return console['error'](_0x338b33(0x2a2)+_0x1b3d3f[_0x338b33(0x311)]+'\x27'),await handleSDKOutput([_0x1b3d3f],_0xca2f30),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x24f);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x289);async['execute'](_0x4b60a9){const _0x194bf5=a29_0x4cec4b,{options:_0x297132,args:_0x408cb3,tdx:_0x3b5b3e}=_0x4b60a9,_0x1b6e57=_0x297132,_0x31f128=_0x408cb3[0x0]||_0x297132['parentSegment'];if(!_0x31f128)return showParentSegmentNotSetError(_0x194bf5(0x2c7)+_0x194bf5(0x1d0)),0x1;if(_0x1b6e57[_0x194bf5(0x1d3)]&&_0x1b6e57['output'])return console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x205)](_0x194bf5(0x281))),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x28a)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a29_0x483110[_0x194bf5(0x28a)](_0x194bf5(0x252)+PARENT_SEGMENT_DIR+_0x194bf5(0x2c5))),console[_0x194bf5(0x2cb)](a29_0x483110['cyan'](_0x194bf5(0x306))),0x1;const _0x242c45=_0x1b6e57[_0x194bf5(0x1fe)]||a29_0x4e119f['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31f128)+_0x194bf5(0x309));_0x1b6e57[_0x194bf5(0x24d)]&&(console[_0x194bf5(0x2cb)](_0x194bf5(0x31e)+_0x1b6e57[_0x194bf5(0x317)]),console[_0x194bf5(0x2cb)](_0x194bf5(0x1df)+_0x31f128),console[_0x194bf5(0x2cb)]('Output\x20file:\x20'+_0x242c45));const _0x45533c=await withSpinner(_0x194bf5(0x2c8)+_0x31f128+_0x194bf5(0x291),()=>_0x3b5b3e[_0x194bf5(0x23d)][_0x194bf5(0x2c4)](_0x31f128),{'verbose':_0x1b6e57[_0x194bf5(0x24d)]}),_0x1466cd=_0x45533c[_0x194bf5(0x264)];if(existsSync(_0x242c45)){const _0x4a8ec6=readFileSync(_0x242c45,'utf-8'),_0x3cc97d=generateDiff(_0x4a8ec6,_0x1466cd);if(!hasChanges(_0x3cc97d))console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x2c0)+a29_0x483110[_0x194bf5(0x1e3)](_0x242c45)+_0x194bf5(0x2ab));else{console['error'](_0x194bf5(0x1fb)+_0x242c45+'\x27:'),console[_0x194bf5(0x2cb)]('─'[_0x194bf5(0x270)](0x3c)),console[_0x194bf5(0x2cb)](formatDiffWithColors(_0x3cc97d)),console[_0x194bf5(0x2cb)]('─'['repeat'](0x3c));if(!_0x1b6e57[_0x194bf5(0x30a)]){if(!isInteractive())return console['error'](a29_0x483110['red'](_0x194bf5(0x2f4)),_0x194bf5(0x1ee)),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x28a)](_0x194bf5(0x2b9))),0x1;const _0x264c57=await confirmKey(_0x194bf5(0x223)+_0x242c45+'\x27?');if(!_0x264c57)return console['error'](a29_0x483110[_0x194bf5(0x1db)](_0x194bf5(0x256))),0x1;}writeFileSync(_0x242c45,_0x1466cd,_0x194bf5(0x1d4)),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x203)+a29_0x483110[_0x194bf5(0x1e3)](_0x242c45));}}else{const _0x3146e7=a29_0x4e119f['dirname'](_0x242c45);!existsSync(_0x3146e7)&&mkdirSync(_0x3146e7,{'recursive':!![]}),writeFileSync(_0x242c45,_0x1466cd,_0x194bf5(0x1d4)),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x203)+a29_0x483110[_0x194bf5(0x1e3)](_0x242c45));}return saveSessionContext({'parent_segment':_0x31f128},_0x1b6e57[_0x194bf5(0x21d)]),console['error'](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x263)+a29_0x483110[_0x194bf5(0x28a)](_0x194bf5(0x29f))+_0x194bf5(0x1ec)+a29_0x483110[_0x194bf5(0x1e3)](_0x31f128)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a29_0x4cec4b(0x2fe);[a29_0x4cec4b(0x2a3)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x3af0f1){const _0xa51385=a29_0x4cec4b,{options:_0x4c4993,args:_0x413820,tdx:_0x46aa7c}=_0x3af0f1,_0x50c7e0=_0x4c4993,_0x39b596=_0x413820[0x0]||_0x4c4993['parentSegment'];if(!_0x39b596)return showParentSegmentNotSetError(_0xa51385(0x27a)+_0xa51385(0x2ac)),0x1;const _0x1a7739=resolveYamlFile(_0x39b596);if(!existsSync(_0x1a7739))return showFileNotFoundError(_0x1a7739,_0x39b596),0x1;_0x50c7e0[_0xa51385(0x24d)]&&(console[_0xa51385(0x2cb)]('Site:\x20'+_0x50c7e0[_0xa51385(0x317)]),console['error'](_0xa51385(0x220)+_0x1a7739));let _0xc1ce7;try{_0xc1ce7=readFileSync(_0x1a7739,_0xa51385(0x1d4));}catch(_0x32dc26){const _0x217dae=_0x32dc26 instanceof Error?_0x32dc26[_0xa51385(0x2a5)]:String(_0x32dc26);return console['error'](_0xa51385(0x2fb)+_0x217dae),0x1;}const _0x175d0f=await withSpinner('Analyzing\x20changes...',()=>_0x46aa7c[_0xa51385(0x23d)][_0xa51385(0x243)](_0xc1ce7),{'verbose':_0x50c7e0[_0xa51385(0x24d)]}),_0x2317a2=_0x175d0f[_0xa51385(0x264)],{isNew:_0x3ef747,name:_0x5b0403,hasChanges:_0x28082a,diffFormatted:_0xdcec6a}=_0x2317a2;if(!_0x28082a)return console[_0xa51385(0x2cb)](_0xa51385(0x266)+_0x5b0403+_0xa51385(0x269)),0x0;_0x3ef747?console[_0xa51385(0x2cb)](_0xa51385(0x238)+_0x5b0403+'\x27:'):console[_0xa51385(0x2cb)](_0xa51385(0x282)+_0x5b0403+'\x27:');console[_0xa51385(0x2cb)]('─'[_0xa51385(0x270)](0x3c)),console['error'](_0xdcec6a),console[_0xa51385(0x2cb)]('─'[_0xa51385(0x270)](0x3c));const _0x5302c2=_0x3ef747?_0xa51385(0x2c3)+_0x5b0403+'\x27?':_0xa51385(0x23b)+_0x5b0403+'\x27?';if(!_0x50c7e0[_0xa51385(0x30a)]){if(!isInteractive())return console[_0xa51385(0x2cb)](a29_0x483110[_0xa51385(0x205)](_0xa51385(0x2f4)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a29_0x483110['dim'](_0xa51385(0x2b9))),0x1;const _0x1216bf=await confirmKey(_0x5302c2);if(!_0x1216bf)return console[_0xa51385(0x2cb)](a29_0x483110[_0xa51385(0x1db)](_0xa51385(0x256))),0x1;}const _0x15a5c2=_0x3ef747?_0xa51385(0x27c):_0xa51385(0x1e4),_0x1b42d7=await withSpinner(_0x15a5c2+_0xa51385(0x318)+_0x5b0403+_0xa51385(0x291),()=>_0x2317a2[_0xa51385(0x299)](),{'verbose':_0x50c7e0[_0xa51385(0x24d)]}),_0x1ad261=_0x1b42d7[_0xa51385(0x264)],_0x4d781e=getConsoleNextUrl(_0x50c7e0['site'],_0xa51385(0x319)+_0x1ad261['id']),_0x54b9cf=_0x3ef747?_0xa51385(0x33a):'Updated';return console[_0xa51385(0x2cb)]('✔\x20'+_0x54b9cf+_0xa51385(0x318)+_0x1ad261[_0xa51385(0x311)]+'\x27'),console[_0xa51385(0x2cb)]('\x20\x20'+_0x4d781e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x1eb);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x31a);async['execute'](_0x1599bf){const _0x20cade=a29_0x4cec4b,{options:_0x42aff2,args:_0x51346a,tdx:_0x112cb3}=_0x1599bf,_0x464943=_0x42aff2,_0x3fdaf=_0x51346a[0x0]||_0x42aff2['parentSegment'];if(!_0x3fdaf)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'+_0x20cade(0x2ad)+_0x20cade(0x332)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x20cade(0x29b)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0xca26b0=resolveYamlFile(_0x3fdaf);if(!existsSync(_0xca26b0))return showFileNotFoundError(_0xca26b0,_0x3fdaf),0x1;_0x464943[_0x20cade(0x24d)]&&(console[_0x20cade(0x2cb)](_0x20cade(0x31e)+_0x464943[_0x20cade(0x317)]),console[_0x20cade(0x2cb)](_0x20cade(0x220)+_0xca26b0));let _0x271ae3;try{_0x271ae3=readFileSync(_0xca26b0,_0x20cade(0x1d4));}catch(_0x377be0){const _0x44c602=_0x377be0 instanceof Error?_0x377be0[_0x20cade(0x2a5)]:String(_0x377be0);return console['error']('Error\x20reading\x20file:\x20'+_0x44c602),0x1;}const _0x302a43=createCommandSpinner(a29_0x483110['dim'](_0x20cade(0x2d6)),{'verbose':_0x464943[_0x20cade(0x24d)]});_0x302a43[_0x20cade(0x2ec)]();const _0x12d8f3={'onProgress':_0x4f38b4=>{const _0x2632ca=_0x20cade;_0x302a43[_0x2632ca(0x2a4)]=formatProgressMessage(_0x4f38b4);}};if(_0x464943[_0x20cade(0x2b1)])_0x12d8f3[_0x20cade(0x2b1)]=!![];if(_0x464943[_0x20cade(0x2dd)])_0x12d8f3[_0x20cade(0x2dd)]=!![];_0x464943[_0x20cade(0x2b5)]&&(_0x12d8f3['attribute']=_0x464943['attribute']);_0x464943[_0x20cade(0x1e8)]&&(_0x12d8f3[_0x20cade(0x1e8)]=_0x464943[_0x20cade(0x1e8)]);if(_0x464943[_0x20cade(0x2f9)])_0x12d8f3['interval']=_0x464943[_0x20cade(0x2f9)];let _0x4794d7;try{_0x4794d7=await _0x112cb3[_0x20cade(0x23d)][_0x20cade(0x33b)](_0x271ae3,_0x12d8f3),_0x302a43[_0x20cade(0x2ef)]();}catch(_0x160853){_0x302a43[_0x20cade(0x2ef)]();throw _0x160853;}const _0x5b6d94=_0x464943[_0x20cade(0x2f9)]||'-1d';return this[_0x20cade(0x1f1)](_0x4794d7,_0x12d8f3,_0xca26b0,_0x5b6d94),_0x4794d7['allValid']?0x0:0x1;}[a29_0x4cec4b(0x1f1)](_0x1d3c92,_0x56eb93,_0x25ad75,_0x30b608){const _0x3ab4c2=a29_0x4cec4b;console[_0x3ab4c2(0x2cb)]('\x0a'+a29_0x483110[_0x3ab4c2(0x30b)](_0x3ab4c2(0x2de))+'\x20'+_0x1d3c92[_0x3ab4c2(0x311)]),console['error']('═'['repeat'](0x3c)),this[_0x3ab4c2(0x234)](_0x1d3c92);if(typeof _0x56eb93[_0x3ab4c2(0x2b5)]===_0x3ab4c2(0x2a8)){this[_0x3ab4c2(0x201)](_0x1d3c92),this[_0x3ab4c2(0x29c)](_0x1d3c92),this[_0x3ab4c2(0x28f)](_0x25ad75,_0x30b608,_0x3ab4c2(0x2b5),_0x56eb93['attribute']);return;}if(_0x56eb93[_0x3ab4c2(0x2b5)]===!![]){this[_0x3ab4c2(0x201)](_0x1d3c92),this[_0x3ab4c2(0x29c)](_0x1d3c92),this[_0x3ab4c2(0x28f)](_0x25ad75,_0x30b608,_0x3ab4c2(0x214));return;}if(typeof _0x56eb93[_0x3ab4c2(0x1e8)]===_0x3ab4c2(0x2a8)){this[_0x3ab4c2(0x206)](_0x1d3c92,_0x30b608),this['displaySummary'](_0x1d3c92),this['displayPreviewHints'](_0x25ad75,_0x30b608,_0x3ab4c2(0x1e8),_0x56eb93[_0x3ab4c2(0x1e8)]);return;}if(_0x56eb93['behavior']===!![]){this[_0x3ab4c2(0x206)](_0x1d3c92,_0x30b608),this[_0x3ab4c2(0x29c)](_0x1d3c92),this['displayPreviewHints'](_0x25ad75,_0x30b608,_0x3ab4c2(0x304));return;}this[_0x3ab4c2(0x201)](_0x1d3c92),this[_0x3ab4c2(0x206)](_0x1d3c92,_0x30b608),this[_0x3ab4c2(0x254)](_0x1d3c92),this[_0x3ab4c2(0x29c)](_0x1d3c92),this['displayPreviewHints'](_0x25ad75,_0x30b608,_0x3ab4c2(0x229));}[a29_0x4cec4b(0x254)](_0x4d361d){displayRealtimeValidation(_0x4d361d);}[a29_0x4cec4b(0x28f)](_0x2436ed,_0x1bf02f,_0x169c32,_0xea8211){const _0x4d8f33=a29_0x4cec4b;console[_0x4d8f33(0x2cb)]('\x0a'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x225)));const _0x71a7e3=_0x1bf02f!=='-1d'?_0x4d8f33(0x2b7)+_0x1bf02f:'';if(_0x169c32===_0x4d8f33(0x2b5)&&_0xea8211)console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x21b)+_0x2436ed+'\x20--attribute\x20\x22'+_0xea8211+'\x22'+_0x71a7e3));else{if(_0x169c32==='behavior'&&_0xea8211)console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)]('tdx\x20ps\x20preview\x20'+_0x2436ed+_0x4d8f33(0x2f0)+_0xea8211+'\x22'+_0x71a7e3));else(_0x169c32==='attributes'||_0x169c32==='all')&&console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x21b)+_0x2436ed+'\x20--attribute\x20\x22<name>\x22'+_0x71a7e3));}(_0x169c32===_0x4d8f33(0x304)||_0x169c32===_0x4d8f33(0x229))&&console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)]('tdx\x20ps\x20preview\x20'+_0x2436ed+'\x20--behavior\x20\x22<name>\x22'+_0x71a7e3)),_0x169c32===_0x4d8f33(0x229)&&console['error']('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x21b)+_0x2436ed+'\x20--enriched'+_0x71a7e3));}['displayMasterInfo'](_0x3b885b){const _0x2c0c58=a29_0x4cec4b,{master:_0x3bfd5d}=_0x3b885b,_0x19f567=_0x3bfd5d[_0x2c0c58(0x259)]?a29_0x483110['green']('✔'):a29_0x483110[_0x2c0c58(0x205)]('✘');console[_0x2c0c58(0x2cb)]('\x0a'+a29_0x483110[_0x2c0c58(0x28a)]('Master\x20Table')),console['error'](_0x19f567+'\x20'+a29_0x483110['bold'](_0x3bfd5d[_0x2c0c58(0x200)]+'.'+_0x3bfd5d[_0x2c0c58(0x307)])),_0x3bfd5d[_0x2c0c58(0x259)]?_0x3bfd5d[_0x2c0c58(0x334)]!==undefined&&console[_0x2c0c58(0x2cb)]('\x20\x20'+a29_0x483110[_0x2c0c58(0x28a)](_0x2c0c58(0x2dc))+'\x20'+a29_0x483110['cyan'](formatRows(_0x3bfd5d[_0x2c0c58(0x334)]))):console['error']('\x20\x20'+a29_0x483110[_0x2c0c58(0x205)](_0x2c0c58(0x1d5))+'\x20'+_0x3bfd5d[_0x2c0c58(0x2c9)]);}[a29_0x4cec4b(0x201)](_0x42ab5f){const _0x4e588a=a29_0x4cec4b;if(_0x42ab5f['attributes'][_0x4e588a(0x32f)]===0x0)return;console[_0x4e588a(0x2cb)]('\x0a'+a29_0x483110['dim'](_0x4e588a(0x279)));for(const _0x46673d of _0x42ab5f[_0x4e588a(0x214)]){const _0x59bf6b=_0x46673d[_0x4e588a(0x259)]?a29_0x483110[_0x4e588a(0x31f)]('✔'):a29_0x483110[_0x4e588a(0x205)]('✘');let _0x4afcbb='';if(_0x46673d[_0x4e588a(0x259)]&&_0x46673d[_0x4e588a(0x235)]!==undefined&&_0x46673d[_0x4e588a(0x277)]!==undefined){const _0x345c12=_0x46673d['coveragePercent'][_0x4e588a(0x290)](0x1),_0x42ee89=_0x46673d[_0x4e588a(0x277)]>=0x50?a29_0x483110[_0x4e588a(0x31f)]:_0x46673d[_0x4e588a(0x277)]>=0x32?a29_0x483110['yellow']:a29_0x483110[_0x4e588a(0x205)];_0x4afcbb='\x20'+a29_0x483110[_0x4e588a(0x28a)]('Coverage:')+'\x20'+_0x42ee89(_0x345c12+'%')+'\x20('+formatRows(_0x46673d[_0x4e588a(0x235)])+_0x4e588a(0x280);}console[_0x4e588a(0x2cb)](_0x59bf6b+'\x20'+a29_0x483110[_0x4e588a(0x30b)](_0x46673d['name'])+_0x4afcbb),console['error']('\x20\x20'+a29_0x483110[_0x4e588a(0x28a)](_0x4e588a(0x284))+'\x20'+a29_0x483110['bold'](_0x46673d['database']+'.'+_0x46673d[_0x4e588a(0x307)]));const _0x4823dc=_0x46673d[_0x4e588a(0x261)]===_0x46673d[_0x4e588a(0x1d6)]?a29_0x483110[_0x4e588a(0x28a)]('Join\x20on:')+'\x20'+_0x46673d[_0x4e588a(0x261)]:a29_0x483110[_0x4e588a(0x28a)]('Join:')+'\x20'+_0x46673d[_0x4e588a(0x261)]+_0x4e588a(0x1ec)+_0x46673d['foreignKey'];console['error']('\x20\x20'+_0x4823dc),console[_0x4e588a(0x2cb)]('\x20\x20'+a29_0x483110[_0x4e588a(0x28a)](_0x4e588a(0x297))),this[_0x4e588a(0x2c1)](_0x46673d[_0x4e588a(0x25b)]),!_0x46673d[_0x4e588a(0x259)]&&console['error']('\x20\x20'+a29_0x483110[_0x4e588a(0x205)]('Error:')+'\x20'+_0x46673d[_0x4e588a(0x2c9)]);}}[a29_0x4cec4b(0x206)](_0x335570,_0x557d73){const _0x26e2b7=a29_0x4cec4b;if(_0x335570['behaviors']['length']===0x0)return;console[_0x26e2b7(0x2cb)]('\x0a'+a29_0x483110[_0x26e2b7(0x28a)]('Behaviors')+'\x20'+a29_0x483110['dim']('('+_0x557d73+')'));for(const _0x2b4136 of _0x335570['behaviors']){const _0xa3f000=_0x2b4136['schemaValid']?a29_0x483110[_0x26e2b7(0x31f)]('✔'):a29_0x483110['red']('✘');let _0x414d4f='';if(_0x2b4136['schemaValid']&&_0x2b4136[_0x26e2b7(0x28e)]!==undefined&&_0x2b4136[_0x26e2b7(0x265)]!==undefined){const _0x28e5e5=_0x2b4136[_0x26e2b7(0x244)]?.['toFixed'](0x1)||'?',_0x27919d=(_0x2b4136[_0x26e2b7(0x244)]??0x0)>=0x32?a29_0x483110['green']:(_0x2b4136['customerPercent']??0x0)>=0x14?a29_0x483110[_0x26e2b7(0x1db)]:a29_0x483110[_0x26e2b7(0x205)];_0x414d4f='\x20'+a29_0x483110['dim'](_0x26e2b7(0x204))+'\x20'+_0x27919d(formatRows(_0x2b4136[_0x26e2b7(0x28e)]))+'\x20('+_0x28e5e5+_0x26e2b7(0x226)+a29_0x483110[_0x26e2b7(0x28a)](_0x26e2b7(0x2e5))+'\x20'+a29_0x483110[_0x26e2b7(0x1e3)](formatRows(_0x2b4136[_0x26e2b7(0x265)]));}console[_0x26e2b7(0x2cb)](_0xa3f000+'\x20'+a29_0x483110[_0x26e2b7(0x30b)](_0x2b4136[_0x26e2b7(0x311)])+_0x414d4f),console[_0x26e2b7(0x2cb)]('\x20\x20'+a29_0x483110[_0x26e2b7(0x28a)](_0x26e2b7(0x284))+'\x20'+a29_0x483110[_0x26e2b7(0x30b)](_0x2b4136[_0x26e2b7(0x200)]+'.'+_0x2b4136[_0x26e2b7(0x307)]));const _0x5512f9=_0x2b4136[_0x26e2b7(0x261)]===_0x2b4136[_0x26e2b7(0x1d6)]?a29_0x483110['dim']('Join\x20on:')+'\x20'+_0x2b4136['joinKey']:a29_0x483110[_0x26e2b7(0x28a)]('Join:')+'\x20'+_0x2b4136[_0x26e2b7(0x261)]+'\x20=\x20'+_0x2b4136[_0x26e2b7(0x1d6)];console[_0x26e2b7(0x2cb)]('\x20\x20'+_0x5512f9),console[_0x26e2b7(0x2cb)]('\x20\x20'+a29_0x483110['dim'](_0x26e2b7(0x297))),this['displayColumns'](_0x2b4136[_0x26e2b7(0x25b)]),!_0x2b4136[_0x26e2b7(0x259)]&&console['error']('\x20\x20'+a29_0x483110['red'](_0x26e2b7(0x1d5))+'\x20'+_0x2b4136[_0x26e2b7(0x2c9)]);}}[a29_0x4cec4b(0x2c1)](_0x42b825){const _0x44a0e0=a29_0x4cec4b;for(const _0x586ef9 of _0x42b825){_0x586ef9[_0x44a0e0(0x1e0)]===_0x586ef9['column']||_0x586ef9[_0x44a0e0(0x23c)]==='*'?console[_0x44a0e0(0x2cb)](_0x44a0e0(0x32c)+_0x586ef9[_0x44a0e0(0x1e0)]):console[_0x44a0e0(0x2cb)]('\x20\x20\x20\x20-\x20'+_0x586ef9[_0x44a0e0(0x1e0)]+'\x20'+a29_0x483110['dim']('('+_0x586ef9[_0x44a0e0(0x23c)]+')'));}}[a29_0x4cec4b(0x29c)](_0x97dc0a){const _0x2faeac=a29_0x4cec4b;console['error']('─'[_0x2faeac(0x270)](0x3c));if(_0x97dc0a[_0x2faeac(0x30c)][_0x2faeac(0x32f)]>0x0){console[_0x2faeac(0x2cb)]('\x0a'+a29_0x483110[_0x2faeac(0x205)](_0x2faeac(0x1d7)));for(const _0x1196fe of _0x97dc0a[_0x2faeac(0x30c)]){console[_0x2faeac(0x2cb)]('\x20\x20'+a29_0x483110[_0x2faeac(0x205)]('•')+'\x20'+_0x1196fe);}}_0x97dc0a['allValid']&&console[_0x2faeac(0x2cb)]('\x0a'+a29_0x483110[_0x2faeac(0x31f)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x21c);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x26b);async[a29_0x4cec4b(0x1cb)](_0x3f75cf){const _0x7e0b9=a29_0x4cec4b,{options:_0x32c6fd,args:_0x158df6,tdx:_0x3f653c}=_0x3f75cf,_0x2ae739=_0x32c6fd,_0x1c85a4=_0x158df6[0x0]||_0x32c6fd['parentSegment'];if(!_0x1c85a4)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x7e0b9(0x1fa)+_0x7e0b9(0x29d)+'\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'+_0x7e0b9(0x1c8)+_0x7e0b9(0x23a)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x2ae739['master']&&!_0x2ae739[_0x7e0b9(0x2b5)]&&!_0x2ae739[_0x7e0b9(0x1e8)]&&!_0x2ae739['enriched'])return console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x7e0b9(0x2cb)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x2d8)),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x278)),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x7e0b9(0x2cb)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0xbad0f7=resolveYamlFile(_0x1c85a4);if(!existsSync(_0xbad0f7))return showFileNotFoundError(_0xbad0f7,_0x1c85a4),0x1;_0x2ae739['verbose']&&(console[_0x7e0b9(0x2cb)](_0x7e0b9(0x31e)+_0x2ae739[_0x7e0b9(0x317)]),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x220)+_0xbad0f7));let _0x24f617;try{_0x24f617=readFileSync(_0xbad0f7,_0x7e0b9(0x1d4));}catch(_0x2de6e0){const _0x53041d=_0x2de6e0 instanceof Error?_0x2de6e0[_0x7e0b9(0x2a5)]:String(_0x2de6e0);return console['error'](_0x7e0b9(0x2fb)+_0x53041d),0x1;}let _0x2ee91b;try{_0x2ee91b=parseDef(_0x24f617);}catch(_0x2c5a34){const _0x494c0c=_0x2c5a34 instanceof Error?_0x2c5a34[_0x7e0b9(0x2a5)]:String(_0x2c5a34);return console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x247)+_0x494c0c)),0x1;}if(_0x2ae739['attribute']===!![]||_0x2ae739[_0x7e0b9(0x2b5)]===''){const _0x43e25c=_0x2ee91b[_0x7e0b9(0x214)]?.[_0x7e0b9(0x26a)](_0x8d1aab=>_0x8d1aab['name'])||[];if(_0x43e25c[_0x7e0b9(0x32f)]===0x0)console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x28d)));else{console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x237))),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x2a1));for(const _0xe5de45 of _0x43e25c){console[_0x7e0b9(0x2cb)]('\x20\x20'+a29_0x483110[_0x7e0b9(0x1e3)](_0xe5de45));}console[_0x7e0b9(0x2cb)](_0x7e0b9(0x236)+_0x1c85a4+_0x7e0b9(0x2d5)+_0x43e25c[0x0]+'\x22');}return 0x1;}if(_0x2ae739[_0x7e0b9(0x1e8)]===!![]||_0x2ae739[_0x7e0b9(0x1e8)]===''){const _0xd6c9fd=_0x2ee91b['behaviors']?.['map'](_0x5e27aa=>_0x5e27aa[_0x7e0b9(0x311)])||[];if(_0xd6c9fd[_0x7e0b9(0x32f)]===0x0)console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x25d)));else{console[_0x7e0b9(0x2cb)](a29_0x483110['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x276));for(const _0x2dddcb of _0xd6c9fd){console['error']('\x20\x20'+a29_0x483110[_0x7e0b9(0x1e3)](_0x2dddcb));}console[_0x7e0b9(0x2cb)](_0x7e0b9(0x236)+_0x1c85a4+_0x7e0b9(0x2f0)+_0xd6c9fd[0x0]+'\x22');}return 0x1;}const _0x22f8f5=createCommandSpinner(a29_0x483110[_0x7e0b9(0x28a)](_0x7e0b9(0x2af)),{'verbose':_0x2ae739['verbose']});_0x22f8f5['start']();const _0x5aed06={'onProgress':_0x3db448=>{const _0x39389c=_0x7e0b9;_0x22f8f5[_0x39389c(0x2a4)]=formatProgressMessage(_0x3db448);}};if(_0x2ae739['master'])_0x5aed06[_0x7e0b9(0x2b1)]=!![];if(_0x2ae739[_0x7e0b9(0x2b5)]&&typeof _0x2ae739[_0x7e0b9(0x2b5)]===_0x7e0b9(0x2a8))_0x5aed06[_0x7e0b9(0x2b5)]=_0x2ae739['attribute'];if(_0x2ae739['behavior']&&typeof _0x2ae739[_0x7e0b9(0x1e8)]===_0x7e0b9(0x2a8))_0x5aed06[_0x7e0b9(0x1e8)]=_0x2ae739[_0x7e0b9(0x1e8)];if(_0x2ae739[_0x7e0b9(0x2dd)])_0x5aed06[_0x7e0b9(0x2dd)]=!![];if(_0x2ae739[_0x7e0b9(0x2f9)])_0x5aed06[_0x7e0b9(0x2f9)]=_0x2ae739[_0x7e0b9(0x2f9)];let _0xd1e156;try{_0xd1e156=await _0x3f653c['segment'][_0x7e0b9(0x1cc)](_0x24f617,_0x5aed06),_0x22f8f5[_0x7e0b9(0x2ef)]();}catch(_0x410027){_0x22f8f5[_0x7e0b9(0x2ef)]();throw _0x410027;}return await this[_0x7e0b9(0x2ae)](_0xd1e156,{'master':_0x2ae739[_0x7e0b9(0x2b1)],'attribute':typeof _0x2ae739[_0x7e0b9(0x2b5)]===_0x7e0b9(0x2a8)?_0x2ae739[_0x7e0b9(0x2b5)]:undefined,'behavior':typeof _0x2ae739[_0x7e0b9(0x1e8)]===_0x7e0b9(0x2a8)?_0x2ae739[_0x7e0b9(0x1e8)]:undefined,'enriched':_0x2ae739[_0x7e0b9(0x2dd)]}),_0xd1e156[_0x7e0b9(0x1f7)]?0x0:0x1;}async['displayPreviewResults'](_0x3c376f,_0x1903f4){const _0x2fef8a=a29_0x4cec4b;console[_0x2fef8a(0x2cb)]('\x0a'+a29_0x483110[_0x2fef8a(0x30b)](_0x2fef8a(0x2bb))+'\x20'+_0x3c376f[_0x2fef8a(0x311)]),console[_0x2fef8a(0x2cb)]('═'['repeat'](0x3c));if(_0x1903f4[_0x2fef8a(0x2b1)]&&_0x3c376f['sampleData']){const _0x520da2=a29_0x483110[_0x2fef8a(0x28a)]('Master:')+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x3c376f[_0x2fef8a(0x2b1)][_0x2fef8a(0x200)]+'.'+_0x3c376f['master']['table']);await this[_0x2fef8a(0x2b8)](_0x520da2,_0x3c376f[_0x2fef8a(0x2bc)]);}else{if(_0x1903f4[_0x2fef8a(0x2b5)]&&_0x3c376f[_0x2fef8a(0x2bc)]){const _0x32770a=a29_0x483110['dim']('Attribute:')+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x1903f4[_0x2fef8a(0x2b5)]);await this[_0x2fef8a(0x2b8)](_0x32770a,_0x3c376f[_0x2fef8a(0x2bc)]);}else{if(_0x1903f4[_0x2fef8a(0x1e8)]&&_0x3c376f[_0x2fef8a(0x2bc)]){const _0x2521c4=a29_0x483110['dim'](_0x2fef8a(0x241))+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x1903f4['behavior']);await this[_0x2fef8a(0x2b8)](_0x2521c4,_0x3c376f['sampleData']);}else{if(_0x1903f4[_0x2fef8a(0x2dd)]&&_0x3c376f['sampleData']){const _0x457012=a29_0x483110[_0x2fef8a(0x28a)](_0x2fef8a(0x29a))+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x2fef8a(0x2be));await this[_0x2fef8a(0x2b8)](_0x457012,_0x3c376f['sampleData']);}else!_0x3c376f[_0x2fef8a(0x2bc)]&&console['error'](_0x2fef8a(0x27d));}}}if(_0x3c376f['errors'][_0x2fef8a(0x32f)]>0x0){console[_0x2fef8a(0x2cb)]('─'['repeat'](0x3c)),console['error']('\x0a'+a29_0x483110[_0x2fef8a(0x205)](_0x2fef8a(0x1d7)));for(const _0x5cc0e0 of _0x3c376f['errors']){console[_0x2fef8a(0x2cb)]('\x20\x20'+a29_0x483110['red']('•')+'\x20'+_0x5cc0e0);}}}async['displaySampleData'](_0x585bd3,_0x1e2dc6){const _0x54ac58=a29_0x4cec4b;if(_0x1e2dc6['length']===0x0){console[_0x54ac58(0x2cb)]('\x0a'+_0x585bd3),console[_0x54ac58(0x2cb)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x54ac58(0x2cb)]('\x0a'+_0x585bd3);const _0x1034d1=Object['keys'](_0x1e2dc6[0x0])[_0x54ac58(0x26a)](_0x5a3e6e=>({'name':_0x5a3e6e,'type':typeof _0x1e2dc6[0x0][_0x5a3e6e]===_0x54ac58(0x328)?'double':_0x54ac58(0x2d7)})),_0x2886ff={'queryId':'preview','columns':_0x1034d1,'data':_0x1e2dc6,'stats':{'state':_0x54ac58(0x2bf),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1e2dc6['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x327074=formatAsTable(_0x2886ff,_0x1e2dc6[_0x54ac58(0x32f)],!![]);await writeOutput(_0x327074,undefined,_0x54ac58(0x307));}}function a29_0x5785(_0x5800f1,_0x44742b){_0x5800f1=_0x5800f1-0x1c6;const _0x264905=a29_0x2649();let _0x5785e1=_0x264905[_0x5800f1];return _0x5785e1;}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x1ce);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x4cec4b(0x1cb)](_0x12e040){const _0x1464fe=a29_0x4cec4b,{options:_0x112357,args:_0x932f0d,tdx:_0x24cd93}=_0x12e040,_0x2ee985=_0x112357,_0x3d6660=_0x932f0d[0x0]||_0x112357[_0x1464fe(0x245)];if(!_0x3d6660)return showParentSegmentNotSetError(_0x1464fe(0x224)+_0x1464fe(0x268)),0x1;const _0x4f4dbc=resolveYamlFile(_0x3d6660);if(existsSync(_0x4f4dbc)){_0x2ee985[_0x1464fe(0x24d)]&&console[_0x1464fe(0x2cb)](_0x1464fe(0x1f6)+_0x4f4dbc);let _0x247890;try{_0x247890=readFileSync(_0x4f4dbc,_0x1464fe(0x1d4));}catch(_0x208567){const _0x352c72=_0x208567 instanceof Error?_0x208567['message']:String(_0x208567);return console[_0x1464fe(0x2cb)](_0x1464fe(0x2fb)+_0x352c72),0x1;}const _0x23ba72=await withSpinner('Analyzing\x20changes...',()=>_0x24cd93[_0x1464fe(0x23d)][_0x1464fe(0x243)](_0x247890),{'verbose':_0x2ee985[_0x1464fe(0x24d)]}),_0x53cd7c=_0x23ba72[_0x1464fe(0x264)],{isNew:_0x3e46ff,name:_0x576719,hasChanges:_0x44fe36,diffFormatted:_0xa88be4}=_0x53cd7c;if(_0x44fe36){_0x3e46ff?console[_0x1464fe(0x2cb)](_0x1464fe(0x238)+_0x576719+'\x27:'):console[_0x1464fe(0x2cb)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x576719+'\x27:');console['error']('─'[_0x1464fe(0x270)](0x3c)),console['error'](_0xa88be4),console[_0x1464fe(0x2cb)]('─'[_0x1464fe(0x270)](0x3c));const _0x544aa4=_0x3e46ff?'Create\x20parent\x20segment\x20\x27'+_0x576719+_0x1464fe(0x215):'Apply\x20changes\x20to\x20\x27'+_0x576719+_0x1464fe(0x215);if(!_0x2ee985[_0x1464fe(0x30a)]){if(!isInteractive())return console[_0x1464fe(0x2cb)](a29_0x483110[_0x1464fe(0x205)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1464fe(0x2cb)](a29_0x483110['dim'](_0x1464fe(0x2b9))),0x1;const _0x1cb165=await confirmKey(_0x544aa4);if(!_0x1cb165)return console[_0x1464fe(0x2cb)](a29_0x483110[_0x1464fe(0x1db)](_0x1464fe(0x256))),0x1;}const _0x1ac386=_0x3e46ff?_0x1464fe(0x27c):_0x1464fe(0x1e4);await withSpinner(_0x1ac386+'\x20parent\x20segment\x20\x27'+_0x576719+_0x1464fe(0x291),()=>_0x53cd7c[_0x1464fe(0x299)](),{'verbose':_0x2ee985[_0x1464fe(0x24d)]});const _0xb5beb9=_0x3e46ff?_0x1464fe(0x33a):'Updated';console[_0x1464fe(0x2cb)]('✔\x20'+_0xb5beb9+_0x1464fe(0x318)+_0x576719+'\x27');}else console[_0x1464fe(0x2cb)]('✔\x20No\x20changes\x20-\x20\x27'+_0x576719+_0x1464fe(0x22d));}const _0x121edc=await withSpinner(_0x1464fe(0x211)+_0x3d6660+_0x1464fe(0x291),()=>_0x24cd93[_0x1464fe(0x23d)][_0x1464fe(0x207)](_0x3d6660),{'verbose':_0x2ee985[_0x1464fe(0x24d)]}),_0x1978cf=_0x121edc['data'],_0x525d65=getConsoleUrl(_0x2ee985['site'],'/app/workflows/'+_0x1978cf[_0x1464fe(0x230)]+_0x1464fe(0x32a)+_0x1978cf[_0x1464fe(0x2ce)]+_0x1464fe(0x267)+_0x1978cf[_0x1464fe(0x2bd)]);return console[_0x1464fe(0x2cb)](_0x1464fe(0x258)),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x227))+'\x20'+_0x1978cf[_0x1464fe(0x1cd)]),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x21f))+'\x20'+_0x1978cf[_0x1464fe(0x1ed)]),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)]('Session:')+'\x20'+_0x1978cf[_0x1464fe(0x2ce)]),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x305))+'\x20'+_0x1978cf[_0x1464fe(0x2bd)]),console[_0x1464fe(0x2cb)]('\x20\x20'+_0x525d65),console[_0x1464fe(0x2cb)]('\x0a'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x27e))+_0x1464fe(0x26c)+_0x1978cf[_0x1464fe(0x2bd)]+_0x1464fe(0x22a)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x4cec4b(0x311)]='segment:parent:fields';[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x20d);async[a29_0x4cec4b(0x1cb)](_0x36a6f1){const _0x481a1c=a29_0x4cec4b,{options:_0x485b70,args:_0x549cec,tdx:_0x3150ca}=_0x36a6f1,_0x32af63=_0x549cec[0x0]||_0x485b70['parentSegment'];if(!_0x32af63)return showParentSegmentNotSetError(_0x481a1c(0x301)+_0x481a1c(0x2b3)),0x1;_0x485b70[_0x481a1c(0x24d)]&&(console['error'](_0x481a1c(0x31e)+_0x485b70[_0x481a1c(0x317)]),console[_0x481a1c(0x2cb)](_0x481a1c(0x1df)+_0x32af63));const _0x499767=await withSpinner(_0x481a1c(0x32b)+_0x32af63+'\x27...',()=>_0x3150ca[_0x481a1c(0x23d)][_0x481a1c(0x2f3)](_0x32af63),{'verbose':_0x485b70[_0x481a1c(0x24d)]}),_0x3bec29=_0x499767[_0x481a1c(0x264)];console[_0x481a1c(0x2cb)](_0x481a1c(0x1d8)+_0x3bec29[_0x481a1c(0x32f)]+_0x481a1c(0x303)+(_0x3bec29['length']!==0x1?'s':''));if(_0x485b70[_0x481a1c(0x2ee)]||_0x485b70[_0x481a1c(0x26f)])return await handleSDKOutput(_0x3bec29,_0x485b70),0x0;return displayFieldsHumanReadable(_0x3bec29,_0x32af63),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x4cec4b(0x2f1);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x314);async[a29_0x4cec4b(0x1cb)](_0x341fbe){const _0x510af3=a29_0x4cec4b,{options:_0x356449,args:_0x3916ef,tdx:_0x32494c}=_0x341fbe,_0x2341be=_0x356449,_0x5a4fd1=_0x3916ef[0x0]||_0x356449['parentSegment'];if(!_0x5a4fd1)return showParentSegmentNotSetError(_0x510af3(0x326)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x510af3(0x332)+_0x510af3(0x260)),0x1;_0x356449[_0x510af3(0x24d)]&&(console[_0x510af3(0x2cb)](_0x510af3(0x31e)+_0x356449[_0x510af3(0x317)]),console[_0x510af3(0x2cb)](_0x510af3(0x1df)+_0x5a4fd1));const _0x5256e7=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x5a4fd1+_0x510af3(0x291),()=>_0x32494c[_0x510af3(0x23d)][_0x510af3(0x321)](_0x5a4fd1),{'verbose':_0x356449[_0x510af3(0x24d)]}),_0x50a554=_0x5256e7['data'];if(_0x2341be[_0x510af3(0x242)]){const _0x38c21f=getConsoleNextUrl(_0x2341be[_0x510af3(0x317)],_0x510af3(0x319)+_0x50a554['id']);return console['error'](a29_0x483110['green']('✔')+_0x510af3(0x27b)+a29_0x483110[_0x510af3(0x1e3)](_0x38c21f)),openBrowser(_0x38c21f),0x0;}return await handleSingleObjectOutput(_0x50a554,_0x356449),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x337);[a29_0x4cec4b(0x2a3)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a29_0x4cec4b(0x1cb)](_0x10b45c){const _0x58d89d=a29_0x4cec4b,{options:_0x503c85,args:_0x5e0dbc,tdx:_0x54e4d2}=_0x10b45c,_0x18279f=_0x503c85,_0x32b7ba=_0x5e0dbc[0x0]||_0x503c85[_0x58d89d(0x245)];if(!_0x32b7ba)return showParentSegmentNotSetError(_0x58d89d(0x21e)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+_0x58d89d(0x332)+_0x58d89d(0x320)),0x1;_0x503c85[_0x58d89d(0x24d)]&&(console[_0x58d89d(0x2cb)]('Site:\x20'+_0x503c85[_0x58d89d(0x317)]),console['error'](_0x58d89d(0x1df)+_0x32b7ba));const _0x1d10fc=await withSpinner(_0x58d89d(0x222)+_0x32b7ba+_0x58d89d(0x291),()=>_0x54e4d2[_0x58d89d(0x23d)]['resolveParentId'](_0x32b7ba),{'verbose':_0x503c85[_0x58d89d(0x24d)]}),_0x5c7c56=_0x1d10fc[_0x58d89d(0x264)],_0x4c80ba=_0x54e4d2[_0x58d89d(0x23d)][_0x58d89d(0x1d2)](_0x5c7c56);if(_0x18279f[_0x58d89d(0x1fe)]){const _0x3ef810=await this[_0x58d89d(0x322)](_0x10b45c,_0x32b7ba,_0x5c7c56,_0x4c80ba),_0xe281c4=this[_0x58d89d(0x2f6)](_0x3ef810);writeFileSync(_0x18279f[_0x58d89d(0x1fe)],_0xe281c4);const _0x3a623b=_0x3ef810[_0x58d89d(0x257)]['columns'][_0x58d89d(0x32f)]+_0x3ef810[_0x58d89d(0x304)][_0x58d89d(0x2da)]((_0x4779d7,_0x2f8b3e)=>_0x4779d7+_0x2f8b3e[_0x58d89d(0x25b)]['length'],0x0),_0x167d58=_0x3ef810['behaviors'][_0x58d89d(0x2e4)](_0x481b3b=>_0x481b3b['columns'][_0x58d89d(0x32f)]===0x0)['length'];return console[_0x58d89d(0x1f3)]('Schema\x20saved\x20to\x20'+_0x18279f[_0x58d89d(0x1fe)]),console['log'](_0x58d89d(0x30e)+_0x4c80ba),console['log']('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x3ef810[_0x58d89d(0x304)]['length']+_0x58d89d(0x285)),console[_0x58d89d(0x1f3)](_0x58d89d(0x210)+_0x3a623b+_0x58d89d(0x2cd)),_0x167d58>0x0&&console[_0x58d89d(0x1f3)]('\x20\x20Note:\x20'+_0x167d58+_0x58d89d(0x217)),0x0;}console[_0x58d89d(0x2cb)]('\x0a'+a29_0x483110[_0x58d89d(0x30b)]('Output\x20Database:')+'\x20'+a29_0x483110[_0x58d89d(0x1e3)](_0x4c80ba));const _0x3b9a7a=await withSpinner(_0x58d89d(0x292),()=>_0x54e4d2[_0x58d89d(0x23d)][_0x58d89d(0x25e)](_0x5c7c56),{'verbose':_0x503c85[_0x58d89d(0x24d)]});console['error']('\x0a'+a29_0x483110[_0x58d89d(0x30b)](_0x58d89d(0x257))+'\x20'+a29_0x483110[_0x58d89d(0x28a)]('('+_0x4c80ba+_0x58d89d(0x2c6)));const _0x57563a=await executeSchemaQuery(_0x3b9a7a['data'],_0x54e4d2,_0x503c85);await handleQueryOutput(_0x57563a,_0x503c85);const _0x572465=await withSpinner(_0x58d89d(0x1e9),()=>_0x54e4d2[_0x58d89d(0x23d)][_0x58d89d(0x30d)](_0x5c7c56),{'verbose':_0x503c85['verbose']});for(const _0x172456 of _0x572465['data']){const _0x5e0617=_0x58d89d(0x24a)+_0x172456[_0x58d89d(0x2df)]()['replace'](/\s+/g,'_'),_0x21517e=_0x58d89d(0x246)+_0x4c80ba+'.'+_0x5e0617;console['error']('\x0a'+a29_0x483110[_0x58d89d(0x30b)](_0x172456)+'\x20'+a29_0x483110['dim']('('+_0x4c80ba+'.'+_0x5e0617+')'));try{const _0x27c6b8=await executeSchemaQuery(_0x21517e,_0x54e4d2,_0x503c85);await handleQueryOutput(_0x27c6b8,_0x503c85);}catch{console['error'](a29_0x483110[_0x58d89d(0x1db)](_0x58d89d(0x339)));}}return 0x0;}async[a29_0x4cec4b(0x322)](_0x263962,_0x486013,_0x88b4bd,_0x1ab189){const _0x35648a=a29_0x4cec4b,{options:_0x5b7cdd,tdx:_0x1bec39}=_0x263962,_0x157ab0=await withSpinner(_0x35648a(0x292),()=>_0x1bec39['segment'][_0x35648a(0x25e)](_0x88b4bd),{'verbose':_0x5b7cdd['verbose']}),_0x20958d=await executeSchemaQuery(_0x157ab0[_0x35648a(0x264)],_0x1bec39,_0x5b7cdd),_0x4cb89e=_0x20958d['data'][_0x35648a(0x26a)](_0x4f4863=>({'name':_0x4f4863[_0x35648a(0x1e2)],'type':_0x4f4863['column_type']})),_0xf0d066=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x1bec39[_0x35648a(0x23d)][_0x35648a(0x30d)](_0x88b4bd),{'verbose':_0x5b7cdd['verbose']}),_0x1ed76f=[];for(const _0xfb5d8b of _0xf0d066[_0x35648a(0x264)]){const _0x1042a7=_0x35648a(0x24a)+_0xfb5d8b[_0x35648a(0x2df)]()['replace'](/\s+/g,'_'),_0x41b51c=_0x35648a(0x246)+_0x1ab189+'.'+_0x1042a7;let _0xfe1f2f=[];try{const _0x26cf45=await executeSchemaQuery(_0x41b51c,_0x1bec39,_0x5b7cdd);_0xfe1f2f=_0x26cf45[_0x35648a(0x264)][_0x35648a(0x26a)](_0x7f18bf=>({'name':_0x7f18bf['column_name'],'type':_0x7f18bf['column_type']}));}catch{}_0x1ed76f[_0x35648a(0x2e0)]({'table':_0x1042a7,'columns':_0xfe1f2f});}return{'database':_0x1ab189,'parent_segment':_0x486013,'parent_id':_0x88b4bd,'customers':{'table':_0x35648a(0x257),'columns':_0x4cb89e},'behaviors':_0x1ed76f};}[a29_0x4cec4b(0x2f6)](_0x1fbfee){const _0x21faa9=a29_0x4cec4b,_0x1e0823=_0xea073d=>{const _0x33bc2a=a29_0x5785;if(_0xea073d[_0x33bc2a(0x32f)]===0x0)return'[]';const _0x1bf397=_0xea073d['map'](_0x237d84=>_0x33bc2a(0x2e7)+_0x237d84['name']+_0x33bc2a(0x1e7)+_0x237d84[_0x33bc2a(0x1ef)]+'\x22\x20}');return'[\x0a'+_0x1bf397[_0x33bc2a(0x2fd)](',\x0a')+_0x33bc2a(0x327);},_0x1a06ee=_0x1fbfee['behaviors'][_0x21faa9(0x26a)](_0x175db9=>{const _0x45ff7b=_0x21faa9;return _0x45ff7b(0x271)+_0x175db9['table']+_0x45ff7b(0x2a9)+_0x1e0823(_0x175db9[_0x45ff7b(0x25b)])['replace'](/^/gm,'\x20\x20')[_0x45ff7b(0x1d9)]()+_0x45ff7b(0x249);})[_0x21faa9(0x2fd)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x1fbfee[_0x21faa9(0x200)]+_0x21faa9(0x286)+_0x1fbfee[_0x21faa9(0x29f)]+_0x21faa9(0x2eb)+_0x1fbfee[_0x21faa9(0x1de)]+_0x21faa9(0x275)+_0x1fbfee[_0x21faa9(0x257)][_0x21faa9(0x307)]+_0x21faa9(0x300)+_0x1e0823(_0x1fbfee[_0x21faa9(0x257)][_0x21faa9(0x25b)])[_0x21faa9(0x2e2)](/^/gm,'\x20\x20')[_0x21faa9(0x1d9)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x1a06ee+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2f2);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x1f4);async[a29_0x4cec4b(0x1cb)](_0x20404e){const _0x5b095d=a29_0x4cec4b,{options:_0xbc7a70,args:_0x221db3,tdx:_0x25f45d}=_0x20404e,_0x22d78d=_0x221db3[0x0]||_0xbc7a70[_0x5b095d(0x245)];if(!_0x22d78d)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0xbc7a70[_0x5b095d(0x24d)]&&(console[_0x5b095d(0x2cb)](_0x5b095d(0x31e)+_0xbc7a70['site']),console[_0x5b095d(0x2cb)]('Parent\x20segment:\x20'+_0x22d78d));const _0x951a72=await withSpinner(_0x5b095d(0x222)+_0x22d78d+_0x5b095d(0x291),()=>_0x25f45d[_0x5b095d(0x23d)][_0x5b095d(0x20a)](_0x22d78d),{'verbose':_0xbc7a70[_0x5b095d(0x24d)]}),_0xb27a93=_0x951a72[_0x5b095d(0x264)],_0x14bf1f=await withSpinner(_0x5b095d(0x2b0)+_0x22d78d+'\x27...',()=>_0x25f45d['segment']['getParentSQL'](_0xb27a93),{'verbose':_0xbc7a70[_0x5b095d(0x24d)]}),_0x5cb6ad=_0x14bf1f[_0x5b095d(0x264)];return _0xbc7a70[_0x5b095d(0x2a7)]===_0x5b095d(0x2ee)||_0xbc7a70['format']===_0x5b095d(0x26f)?await handleSDKOutput([{'sql':_0x5cb6ad}],_0xbc7a70):console['log'](_0x5cb6ad),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x4cec4b(0x311)]='segment:parent:show';[a29_0x4cec4b(0x2a3)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a29_0x4cec4b(0x1cb)](_0xa58f2a){const _0xa4e3a4=a29_0x4cec4b,{options:_0xf7ab8,args:_0x18aa52,tdx:_0x4c3eee}=_0xa58f2a,_0x3cd425=_0x18aa52[0x0]||_0xf7ab8[_0xa4e3a4(0x245)];if(!_0x3cd425)return showParentSegmentNotSetError(_0xa4e3a4(0x24b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0xf7ab8['verbose']&&(console[_0xa4e3a4(0x2cb)](_0xa4e3a4(0x31e)+_0xf7ab8[_0xa4e3a4(0x317)]),console[_0xa4e3a4(0x2cb)]('Parent\x20segment:\x20'+_0x3cd425));const _0x5523a4=await withSpinner(_0xa4e3a4(0x222)+_0x3cd425+_0xa4e3a4(0x291),()=>_0x4c3eee[_0xa4e3a4(0x23d)][_0xa4e3a4(0x20a)](_0x3cd425),{'verbose':_0xf7ab8['verbose']}),_0x2bc8a9=_0x5523a4[_0xa4e3a4(0x264)],_0x353943=await withSpinner(_0xa4e3a4(0x2b0)+_0x3cd425+'\x27...',()=>_0x4c3eee[_0xa4e3a4(0x23d)][_0xa4e3a4(0x25e)](_0x2bc8a9),{'verbose':_0xf7ab8['verbose']});let _0x3f5bc1=_0x353943['data'];const _0x135c75=resolveLimit(_0xf7ab8[_0xa4e3a4(0x2f5)],DEFAULT_DISPLAY_LIMIT),_0x4c31ed=/\bLIMIT\s+\d+/i[_0xa4e3a4(0x25a)](_0x3f5bc1);!_0x4c31ed&&(_0x3f5bc1=_0x3f5bc1[_0xa4e3a4(0x1d9)]()[_0xa4e3a4(0x2e2)](/;+$/,''),_0x3f5bc1=_0xa4e3a4(0x28c)+_0x3f5bc1+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x135c75);_0xf7ab8['verbose']&&console[_0xa4e3a4(0x2cb)]('SQL\x20query:\x0a'+_0x3f5bc1);const _0x1b49f9=await withProgressSpinner(_0xa4e3a4(0x2a6),async _0x2a0dec=>{const _0x14e4da=_0xa4e3a4,_0x47107d=await _0x4c3eee[_0x14e4da(0x2fc)][_0x14e4da(0x1cb)](_0x3f5bc1,{'catalog':'td','schema':_0x14e4da(0x2cc),'onJobId':_0x365a6e=>{_0x2a0dec['setJobId'](_0x365a6e);}});return _0x47107d;},{'verbose':_0xf7ab8[_0xa4e3a4(0x24d)]}),_0x2f4292=_0x1b49f9[_0xa4e3a4(0x264)],_0x370dfb=_0x2f4292[_0xa4e3a4(0x2f7)]?_0xa4e3a4(0x1f8)+_0x2f4292['jobId']+']':'';return console[_0xa4e3a4(0x2cb)](_0xa4e3a4(0x295)+_0x2f4292[_0xa4e3a4(0x298)][_0xa4e3a4(0x287)][_0xa4e3a4(0x208)]()+_0xa4e3a4(0x213)+(_0xa4e3a4(0x1d1)+formatElapsed(_0x2f4292[_0xa4e3a4(0x298)][_0xa4e3a4(0x32d)])+_0x370dfb)),await handleQueryOutput(_0x2f4292,_0xf7ab8),0x0;}}export class PSRtListCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x1dc);['description']=a29_0x4cec4b(0x24e);async[a29_0x4cec4b(0x1cb)](_0x334085){const _0x3d7926=a29_0x4cec4b,{options:_0x196967,args:_0x86f97f,tdx:_0x58868d}=_0x334085,_0x37405c=_0x86f97f[0x0],_0x2d7335=await withSpinner(_0x37405c?_0x3d7926(0x336)+_0x37405c+_0x3d7926(0x291):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x58868d[_0x3d7926(0x1ea)][_0x3d7926(0x20f)](),{'verbose':_0x196967['verbose']});let _0x22a231=_0x2d7335[_0x3d7926(0x264)][_0x3d7926(0x2e4)](_0x5a1bdc=>_0x5a1bdc['realtime_enabled']);if(_0x37405c){const _0x55b84b=_0x37405c[_0x3d7926(0x2e2)](/[.+^${}()|[\]\\]/g,_0x3d7926(0x2db))[_0x3d7926(0x2e2)](/\*/g,'.*')[_0x3d7926(0x2e2)](/\?/g,'.'),_0x2640b1=new RegExp('^'+_0x55b84b+'$','i');_0x22a231=_0x22a231[_0x3d7926(0x2e4)](_0x16dbc8=>_0x2640b1[_0x3d7926(0x25a)](_0x16dbc8['name']));}_0x22a231[_0x3d7926(0x1ca)]((_0x2c5a8e,_0x340fd2)=>_0x2c5a8e['name'][_0x3d7926(0x2b2)](_0x340fd2['name'])),console[_0x3d7926(0x2cb)](_0x3d7926(0x1d8)+_0x22a231[_0x3d7926(0x32f)]+_0x3d7926(0x233)+(_0x22a231[_0x3d7926(0x32f)]!==0x1?'s':''));const _0x101414=_0x5994d0=>{return getConsoleNextUrl(_0x196967['site'],'/app/dw/parentSegments/'+_0x5994d0);};if(_0x196967[_0x3d7926(0x2a7)]===_0x3d7926(0x2ee)||_0x196967[_0x3d7926(0x2a7)]==='jsonl'){const _0x20ce80=_0x22a231[_0x3d7926(0x26a)](_0x5d98ae=>({..._0x5d98ae,'url':_0x101414(_0x5d98ae['id'])}));await handleSDKOutput(_0x20ce80,_0x196967);}else{if(_0x22a231[_0x3d7926(0x32f)]===0x0)console[_0x3d7926(0x1f3)](_0x3d7926(0x25f));else for(const _0x1b9600 of _0x22a231){const _0xf35d14=_0x1b9600[_0x3d7926(0x1c6)]?a29_0x483110[_0x3d7926(0x28a)]('\x20('+formatRows(_0x1b9600[_0x3d7926(0x1c6)])+')'):'',_0x1a1c50=hyperlink(_0x1b9600[_0x3d7926(0x311)],_0x101414(_0x1b9600['id']));console[_0x3d7926(0x1f3)]('⚡\x20'+_0x1a1c50+_0xf35d14);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2b4);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x293);async[a29_0x4cec4b(0x1cb)](_0xbfa0b4){const _0x191f88=a29_0x4cec4b,{options:_0x28b450,args:_0x4a3247,tdx:_0x44e4d5}=_0xbfa0b4,_0x37a0d3=_0x4a3247[0x0]||_0x28b450['parentSegment'];if(!_0x37a0d3)return showParentSegmentNotSetError(_0x191f88(0x2fa)+_0x191f88(0x2e3)),0x1;const _0x56ce59=resolveYamlFile(_0x37a0d3);if(!existsSync(_0x56ce59))return showFileNotFoundError(_0x56ce59,_0x37a0d3),0x1;let _0x377711;try{_0x377711=readFileSync(_0x56ce59,_0x191f88(0x1d4));}catch(_0xc28c3b){const _0x53fcc7=_0xc28c3b instanceof Error?_0xc28c3b[_0x191f88(0x2a5)]:String(_0xc28c3b);return console[_0x191f88(0x2cb)](_0x191f88(0x2fb)+_0x53fcc7),0x1;}const _0x1d1ef0=createCommandSpinner(a29_0x483110[_0x191f88(0x28a)](_0x191f88(0x2e6)),{'verbose':_0x28b450[_0x191f88(0x24d)]});_0x1d1ef0[_0x191f88(0x2ec)]();const _0x4b6f4a={'realtime':!![],'onProgress':_0x221ab2=>{const _0x4f2d3f=_0x191f88;_0x1d1ef0[_0x4f2d3f(0x2a4)]=formatProgressMessage(_0x221ab2);}};let _0x5863b4;try{_0x5863b4=await _0x44e4d5[_0x191f88(0x23d)][_0x191f88(0x33b)](_0x377711,_0x4b6f4a),_0x1d1ef0[_0x191f88(0x2ef)]();}catch(_0x2c999b){_0x1d1ef0[_0x191f88(0x2ef)]();throw _0x2c999b;}console[_0x191f88(0x2cb)]('\x0a'+a29_0x483110['bold'](_0x191f88(0x228))+'\x20'+_0x5863b4[_0x191f88(0x311)]),console[_0x191f88(0x2cb)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x5863b4),console[_0x191f88(0x2cb)]('─'['repeat'](0x3c));if(_0x5863b4[_0x191f88(0x30c)][_0x191f88(0x32f)]>0x0){console[_0x191f88(0x2cb)]('\x0a'+a29_0x483110[_0x191f88(0x205)](_0x191f88(0x1d7)));for(const _0x326b67 of _0x5863b4['errors']){console[_0x191f88(0x2cb)]('\x20\x20'+a29_0x483110[_0x191f88(0x205)]('•')+'\x20'+_0x326b67);}}return _0x5863b4['allValid']&&console[_0x191f88(0x2cb)]('\x0a'+a29_0x483110[_0x191f88(0x31f)]('✔')+_0x191f88(0x2ca)),_0x5863b4['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2e1);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x1e5);async[a29_0x4cec4b(0x1cb)](_0x794e72){const _0x31d0ea=a29_0x4cec4b,{options:_0x542a2a,args:_0xbcd781,tdx:_0xb91fd0}=_0x794e72,_0x33cb7a=_0xbcd781[0x0]||_0x542a2a[_0x31d0ea(0x245)];if(!_0x33cb7a)return showParentSegmentNotSetError(_0x31d0ea(0x323)+_0x31d0ea(0x22f)),0x1;const _0x152e07=await withSpinner(_0x31d0ea(0x222)+_0x33cb7a+'\x27...',()=>_0xb91fd0[_0x31d0ea(0x23d)]['resolveParentId'](_0x33cb7a),{'verbose':_0x542a2a[_0x31d0ea(0x24d)]}),_0x582dd2=_0x152e07[_0x31d0ea(0x264)],_0x4e03d9=await withSpinner(_0x31d0ea(0x329)+_0x33cb7a+_0x31d0ea(0x291),()=>_0xb91fd0['personalization'][_0x31d0ea(0x20f)](_0x582dd2),{'verbose':_0x542a2a[_0x31d0ea(0x24d)]}),_0x1a7bec=_0x4e03d9[_0x31d0ea(0x264)];console['error'](_0x31d0ea(0x1d8)+_0x1a7bec[_0x31d0ea(0x32f)]+_0x31d0ea(0x1c9)+(_0x1a7bec[_0x31d0ea(0x32f)]!==0x1?'s':''));if(_0x542a2a[_0x31d0ea(0x2a7)]==='json'||_0x542a2a[_0x31d0ea(0x2a7)]===_0x31d0ea(0x26f))await handleSDKOutput(_0x1a7bec,_0x542a2a);else{if(_0x1a7bec[_0x31d0ea(0x32f)]===0x0)console[_0x31d0ea(0x1f3)](_0x31d0ea(0x31d)),console['error'](a29_0x483110[_0x31d0ea(0x1e3)](_0x31d0ea(0x1cf)));else for(const _0xd936a4 of _0x1a7bec){const _0x17f347=_0xd936a4[_0x31d0ea(0x1e1)]?.[_0x31d0ea(0x32f)]||0x0,_0x3dd40c=_0xd936a4[_0x31d0ea(0x33c)]?a29_0x483110[_0x31d0ea(0x28a)]('\x20trigger='+_0xd936a4['trigger_event']):'',_0x29685a=a29_0x483110['dim']('\x20('+_0x17f347+_0x31d0ea(0x219)+(_0x17f347!==0x1?'s':'')+')');console[_0x31d0ea(0x1f3)]('\x20\x20'+_0xd936a4[_0x31d0ea(0x311)]+_0x3dd40c+_0x29685a),_0xd936a4[_0x31d0ea(0x2a3)]&&console['log'](_0x31d0ea(0x316)+a29_0x483110[_0x31d0ea(0x28a)](_0xd936a4[_0x31d0ea(0x2a3)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x32e);['description']=a29_0x4cec4b(0x255);async[a29_0x4cec4b(0x1cb)](_0x5bbf41){const _0x410045=a29_0x4cec4b,{options:_0x375b63,args:_0x3f6f38}=_0x5bbf41,_0x1f02b8=_0x3f6f38[0x0]||_0x375b63['parentSegment'];if(!_0x1f02b8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a'+_0x410045(0x28b)),0x1;const _0x5b298f=resolveYamlFile(_0x1f02b8);if(!existsSync(_0x5b298f))return showFileNotFoundError(_0x5b298f,_0x1f02b8),0x1;let _0x4cd76f;try{_0x4cd76f=readFileSync(_0x5b298f,'utf-8');}catch(_0xd30192){const _0x3d5e7c=_0xd30192 instanceof Error?_0xd30192[_0x410045(0x2a5)]:String(_0xd30192);return console[_0x410045(0x2cb)](_0x410045(0x2fb)+_0x3d5e7c),0x1;}let _0x2712d8;try{_0x2712d8=parseDef(_0x4cd76f);}catch(_0x125602){const _0x4612ba=_0x125602 instanceof Error?_0x125602[_0x410045(0x2a5)]:String(_0x125602);return console[_0x410045(0x2cb)](a29_0x483110[_0x410045(0x205)](_0x410045(0x247)+_0x4612ba)),0x1;}if(_0x2712d8['personalization_services']&&_0x2712d8[_0x410045(0x2e9)][_0x410045(0x32f)]>0x0)return console[_0x410045(0x2cb)](a29_0x483110['yellow']('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x5b298f)),console[_0x410045(0x2cb)](a29_0x483110[_0x410045(0x28a)](_0x410045(0x2ba)+_0x2712d8[_0x410045(0x2e9)][_0x410045(0x32f)]+_0x410045(0x212))),0x1;!_0x2712d8[_0x410045(0x1ea)]&&(_0x2712d8['realtime']={'events':[{'name':_0x410045(0x2d2),'source_table':_0x410045(0x2cf)}],'attributes':[{'name':_0x410045(0x1ff),'type':_0x410045(0x313)}],'id_stitching':{'primary_key':_0x2712d8[_0x410045(0x2b1)][_0x410045(0x307)]==='customers'?_0x410045(0x23e):_0x410045(0x250)}});_0x2712d8['personalization_services']=[{'name':_0x410045(0x338),'description':'Personalization\x20service\x20description','trigger_event':'page_view','sections':[{'name':_0x410045(0x310),'criteria':_0x410045(0x273),'attributes':[_0x410045(0x1ff)]}]}];const _0x3ed646=serializeDef(_0x2712d8);return writeFileSync(_0x5b298f,_0x3ed646,_0x410045(0x1d4)),console[_0x410045(0x2cb)](a29_0x483110['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a29_0x483110['cyan'](_0x5b298f)),(!_0x2712d8[_0x410045(0x1ea)]||_0x4cd76f[_0x410045(0x2ed)]('realtime:')===-0x1)&&console[_0x410045(0x2cb)](a29_0x483110[_0x410045(0x31f)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console[_0x410045(0x2cb)]('\x0a'+a29_0x483110[_0x410045(0x28a)](_0x410045(0x283))),console[_0x410045(0x2cb)](_0x410045(0x31b)+_0x5b298f+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x410045(0x2cb)](_0x410045(0x2b6)+a29_0x483110['dim'](_0x410045(0x2d0)+_0x1f02b8)+_0x410045(0x1f2)),0x0;}}
@@ -1 +1 @@
1
- const a30_0xbadcf6=a30_0x106c;(function(_0x41033d,_0x58c1be){const _0x4a0a9=a30_0x106c,_0x46cf13=_0x41033d();while(!![]){try{const _0x139083=parseInt(_0x4a0a9(0xea))/0x1*(parseInt(_0x4a0a9(0xdb))/0x2)+-parseInt(_0x4a0a9(0xe8))/0x3*(parseInt(_0x4a0a9(0x12b))/0x4)+parseInt(_0x4a0a9(0x131))/0x5+parseInt(_0x4a0a9(0xd4))/0x6*(-parseInt(_0x4a0a9(0xcd))/0x7)+parseInt(_0x4a0a9(0xbf))/0x8*(-parseInt(_0x4a0a9(0xef))/0x9)+parseInt(_0x4a0a9(0xd0))/0xa+-parseInt(_0x4a0a9(0x127))/0xb*(-parseInt(_0x4a0a9(0xdc))/0xc);if(_0x139083===_0x58c1be)break;else _0x46cf13['push'](_0x46cf13['shift']());}catch(_0x40b68){_0x46cf13['push'](_0x46cf13['shift']());}}}(a30_0x4917,0x342de));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 a30_0x3b7669 from'node:path';import{saveSessionContext,getSessionID,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 a30_0x4ee68d from'prompts';import a30_0x1d0cbd from'chalk';function validateProfileName(_0x297764){const _0x2f2d33=a30_0x106c;if(!_0x297764||!_0x297764[_0x2f2d33(0x11f)]())return _0x2f2d33(0xca);const _0x12936d=_0x297764[_0x2f2d33(0x11f)]();if(!/^[a-zA-Z0-9_-]+$/[_0x2f2d33(0xe7)](_0x12936d))return _0x2f2d33(0x112);if(profileExists(_0x12936d))return _0x2f2d33(0xe5)+_0x12936d+_0x2f2d33(0xf4);return!![];}function a30_0x106c(_0x8bdef9,_0x5c21a0){_0x8bdef9=_0x8bdef9-0xbf;const _0x49177e=a30_0x4917();let _0x106c4b=_0x49177e[_0x8bdef9];return _0x106c4b;}export class ProfileCreateCommand extends BaseCommand{[a30_0xbadcf6(0xe3)]=a30_0xbadcf6(0xe4);[a30_0xbadcf6(0x105)]=a30_0xbadcf6(0x12d);async[a30_0xbadcf6(0xf0)](_0x1255d6){const _0x39d321=a30_0xbadcf6,{options:_0x5ce3c4,args:_0x22cce7}=_0x1255d6;console['log'](a30_0x1d0cbd[_0x39d321(0xd2)]('tdx:\x20profile\x20create'));let _0xa6d56f;if(_0x22cce7['length']>0x0&&_0x22cce7[0x0]){const _0x3c2708=_0x22cce7[0x0][_0x39d321(0x11f)](),_0x1d5339=validateProfileName(_0x3c2708);if(_0x1d5339!==!![])return console[_0x39d321(0x132)](a30_0x1d0cbd[_0x39d321(0x115)](_0x1d5339)),0x1;_0xa6d56f=_0x3c2708;}else{const _0x28c96a=await a30_0x4ee68d({'type':_0x39d321(0x107),'name':_0x39d321(0x10a),'message':_0x39d321(0x120),'validate':validateProfileName});if(!_0x28c96a[_0x39d321(0x10a)])return console[_0x39d321(0x121)]('\x0aSetup\x20cancelled'),0x1;_0xa6d56f=_0x28c96a['profileName'][_0x39d321(0x11f)]();}const _0x17ee41=await a30_0x4ee68d({'type':_0x39d321(0x107),'name':_0x39d321(0x105),'message':_0x39d321(0x128)}),_0x49e165=_0x17ee41['description']?.[_0x39d321(0x11f)]()||undefined,_0x3483c6=_0x5ce3c4[_0x39d321(0x109)]||'us01',{choices:_0x2eb8d6,initialIndex:_0x8db48c}=buildSiteChoices(_0x3483c6),_0x123771=await a30_0x4ee68d({'type':_0x39d321(0x117),'name':_0x39d321(0x109),'message':_0x39d321(0x125)+_0xa6d56f+'\x27:','choices':_0x2eb8d6,'initial':_0x8db48c});if(!_0x123771[_0x39d321(0x109)])return console[_0x39d321(0x121)](_0x39d321(0xc3)),0x1;let _0x37a781;if(_0x123771[_0x39d321(0x109)]===_0x39d321(0xfb)){const _0xbff872=await a30_0x4ee68d({'type':_0x39d321(0x107),'name':_0x39d321(0x12e),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x5af995=>{const _0x1be1bb=_0x39d321;if(!_0x5af995||!_0x5af995[_0x1be1bb(0x11f)]())return _0x1be1bb(0xe9);if(!/^[a-z0-9-]+$/[_0x1be1bb(0xe7)](_0x5af995[_0x1be1bb(0x11f)]()))return _0x1be1bb(0x11c);return!![];}});if(!_0xbff872['customSite'])return console[_0x39d321(0x121)](_0x39d321(0xc3)),0x1;_0x37a781=_0xbff872[_0x39d321(0x12e)];}else _0x37a781=_0x123771[_0x39d321(0x109)];const _0x30ec8d=resolveSite(_0x37a781);console[_0x39d321(0x121)](_0x39d321(0x104)+_0x30ec8d),console[_0x39d321(0x121)](_0x39d321(0x10c)),console['log']('\x20\x20'+getConsoleUrl(_0x30ec8d,_0x39d321(0xd7)));const _0x3c83ba=await a30_0x4ee68d({'type':_0x39d321(0xf8),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x1599ba=>{const _0x305f7a=_0x39d321;if(!_0x1599ba||!_0x1599ba[_0x305f7a(0x11f)]())return _0x305f7a(0xe6);return!![];}});if(!_0x3c83ba[_0x39d321(0xfa)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x4b5895=_0x3c83ba[_0x39d321(0xfa)];console[_0x39d321(0x121)](_0x39d321(0xd1));try{const _0x4bed6c=TDX[_0x39d321(0xf1)]({'site':_0x30ec8d,'apiKey':_0x4b5895[_0x39d321(0x11f)](),'logLevel':_0x5ce3c4[_0x39d321(0x108)]??LogLevel[_0x39d321(0x130)]}),_0x33d9b2=await _0x4bed6c['jobs']['getUserInfo']();console[_0x39d321(0x121)](a30_0x1d0cbd[_0x39d321(0xc7)]('✓')+_0x39d321(0xf2)+_0x33d9b2[_0x39d321(0xd5)]+')');const _0x1c77c1=await isKeychainAvailable();_0x1c77c1?(await saveAPIKeyAsync(_0x4b5895[_0x39d321(0x11f)](),_0x30ec8d,_0xa6d56f),console[_0x39d321(0x121)](a30_0x1d0cbd[_0x39d321(0xc7)]('✓')+_0x39d321(0xc6)+_0xa6d56f+')')):(console[_0x39d321(0xc1)](a30_0x1d0cbd[_0x39d321(0x126)](_0x39d321(0xfd))),console[_0x39d321(0xc1)](a30_0x1d0cbd['yellow'](_0x39d321(0xe1))));const _0x43d11d={'site':_0x30ec8d,..._0x49e165&&{'description':_0x49e165}};return saveProfileToUserConfig(_0xa6d56f,_0x43d11d),console[_0x39d321(0x121)](a30_0x1d0cbd[_0x39d321(0xc7)]('✓')+_0x39d321(0xc4)+_0xa6d56f+_0x39d321(0xeb)),console[_0x39d321(0x121)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x39d321(0x121)](_0x39d321(0x129)+_0xa6d56f+_0x39d321(0x113)),console[_0x39d321(0x121)](_0x39d321(0x129)+_0xa6d56f+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5aebed){if(_0x5aebed instanceof HTTPClientError&&_0x5aebed[_0x39d321(0xf3)]===0x191)return printAuthError(_0x5aebed),0x1;return console[_0x39d321(0x132)](a30_0x1d0cbd[_0x39d321(0x115)](_0x39d321(0xff)+(_0x5aebed instanceof Error?_0x5aebed[_0x39d321(0x10d)]:String(_0x5aebed)))),console['error'](_0x39d321(0xc0)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a30_0xbadcf6(0xe3)]=a30_0xbadcf6(0x12a);['description']='Remove\x20a\x20profile';['validate'](_0x54550e){const _0x245c50=a30_0xbadcf6,{args:_0x2f9fd8}=_0x54550e;if(_0x2f9fd8[_0x245c50(0xec)]===0x0)return _0x245c50(0x102);return undefined;}async['execute'](_0x48a939){const _0x2ecdb0=a30_0xbadcf6,{args:_0x31da29}=_0x48a939,_0x5c0d0b=_0x31da29[0x0];console[_0x2ecdb0(0x121)](a30_0x1d0cbd[_0x2ecdb0(0xd2)](_0x2ecdb0(0xc5)));if(!profileExists(_0x5c0d0b)){console[_0x2ecdb0(0x132)](a30_0x1d0cbd['red'](_0x2ecdb0(0xe5)+_0x5c0d0b+'\x27\x20does\x20not\x20exist.')),console[_0x2ecdb0(0x121)](_0x2ecdb0(0x111));const _0x51424d=listProfiles();if(_0x51424d[_0x2ecdb0(0xec)]===0x0)console[_0x2ecdb0(0x121)](_0x2ecdb0(0xcb));else for(const _0x5c3aac of _0x51424d){console['log']('\x20\x20-\x20'+_0x5c3aac[_0x2ecdb0(0xe3)]);}return 0x1;}const _0x1fe929=await a30_0x4ee68d({'type':_0x2ecdb0(0x118),'name':'confirm','message':_0x2ecdb0(0xee)+_0x5c0d0b+'\x27?','initial':![]});if(!_0x1fe929[_0x2ecdb0(0x118)])return console[_0x2ecdb0(0x121)](_0x2ecdb0(0x11e)),0x0;try{removeProfileFromUserConfig(_0x5c0d0b),console[_0x2ecdb0(0x121)](a30_0x1d0cbd[_0x2ecdb0(0xc7)]('✓')+_0x2ecdb0(0xc4)+_0x5c0d0b+_0x2ecdb0(0x100));}catch(_0x5722bf){return console[_0x2ecdb0(0x132)](a30_0x1d0cbd[_0x2ecdb0(0x115)](_0x2ecdb0(0xdf)+(_0x5722bf instanceof Error?_0x5722bf[_0x2ecdb0(0x10d)]:String(_0x5722bf)))),0x1;}const _0x556762=await isKeychainAvailable();if(_0x556762){const _0x580938=await deleteKeychainAPIKey(_0x5c0d0b);_0x580938&&console[_0x2ecdb0(0x121)](a30_0x1d0cbd[_0x2ecdb0(0xc7)]('✓')+_0x2ecdb0(0x10f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a30_0xbadcf6(0xe3)]=a30_0xbadcf6(0xc2);[a30_0xbadcf6(0x105)]=a30_0xbadcf6(0xd9);static [a30_0xbadcf6(0xf6)]=['site',a30_0xbadcf6(0x10e),a30_0xbadcf6(0xdd),a30_0xbadcf6(0x11b),'llm_agent',a30_0xbadcf6(0x105)];[a30_0xbadcf6(0x119)](_0x549e27){const _0x3defa3=a30_0xbadcf6,{args:_0x2faca3,options:_0x4caa55}=_0x549e27,_0x14254d=_0x4caa55['profile']||getActiveProfile();if(!_0x14254d)return _0x3defa3(0x110);if(_0x2faca3[_0x3defa3(0xec)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x3defa3(0x106)](',\x20');const _0xa57a8a=_0x2faca3[0x0];if(!_0xa57a8a[_0x3defa3(0x12f)]('='))return _0x3defa3(0x11d)+ProfileSetCommand[_0x3defa3(0xf6)]['join'](',\x20');const [_0x58b4b1]=_0xa57a8a[_0x3defa3(0x133)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x3defa3(0x12f)](_0x58b4b1))return _0x3defa3(0xce)+_0x58b4b1+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3defa3(0xf6)]['join'](',\x20');return undefined;}async[a30_0xbadcf6(0xf0)](_0x4ccda0){const _0x1949a2=a30_0xbadcf6,{args:_0x32447f,options:_0x8c4094}=_0x4ccda0,_0x43d460=_0x8c4094[_0x1949a2(0x12c)]||getActiveProfile(),[_0x55c437,..._0x5258d2]=_0x32447f[0x0][_0x1949a2(0x133)]('='),_0x4993a9=_0x5258d2[_0x1949a2(0x106)]('=');console[_0x1949a2(0x121)](a30_0x1d0cbd[_0x1949a2(0xd2)]('tdx:\x20profile\x20set'));if(!profileExists(_0x43d460)){const _0x2e9d3b=await a30_0x4ee68d({'type':_0x1949a2(0x118),'name':_0x1949a2(0xf1),'message':_0x1949a2(0xe5)+_0x43d460+_0x1949a2(0x122),'initial':!![]});if(!_0x2e9d3b[_0x1949a2(0xf1)])return console['log'](_0x1949a2(0xf5)),0x1;}const _0x5b4dc4=loadProfile(_0x43d460),_0x3f98f8=_0x5b4dc4?.[_0x1949a2(0xcc)]||{};if(_0x55c437===_0x1949a2(0x109)){const _0x270e76=resolveSite(_0x4993a9);console[_0x1949a2(0x121)]('Changing\x20site\x20to\x20\x27'+_0x270e76+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x1949a2(0x121)](_0x1949a2(0x101)),console[_0x1949a2(0x121)]('\x20\x20'+getConsoleUrl(_0x270e76,_0x1949a2(0xd7)));const _0x3cf1ea=await a30_0x4ee68d({'type':_0x1949a2(0xf8),'name':_0x1949a2(0xfa),'message':_0x1949a2(0xfe),'validate':_0x1cb42a=>{if(!_0x1cb42a||!_0x1cb42a['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3cf1ea[_0x1949a2(0xfa)])return console[_0x1949a2(0x121)](_0x1949a2(0x103)),0x1;console[_0x1949a2(0x121)](_0x1949a2(0xd1));try{const _0x22acbe=TDX[_0x1949a2(0xf1)]({'site':_0x270e76,'apiKey':_0x3cf1ea[_0x1949a2(0xfa)][_0x1949a2(0x11f)](),'logLevel':_0x8c4094[_0x1949a2(0x108)]??LogLevel[_0x1949a2(0x130)]}),_0x482fdd=await _0x22acbe[_0x1949a2(0xf9)][_0x1949a2(0xda)]();console['log'](a30_0x1d0cbd[_0x1949a2(0xc7)]('✓')+_0x1949a2(0xf2)+_0x482fdd['email']+')');const _0x1854f=await isKeychainAvailable();_0x1854f?(await saveAPIKeyAsync(_0x3cf1ea[_0x1949a2(0xfa)]['trim'](),_0x270e76,_0x43d460),console[_0x1949a2(0x121)](a30_0x1d0cbd[_0x1949a2(0xc7)]('✓')+_0x1949a2(0x123))):console[_0x1949a2(0xc1)](a30_0x1d0cbd['yellow'](_0x1949a2(0xfd))),_0x3f98f8[_0x1949a2(0x109)]=_0x270e76;}catch(_0x49cb96){if(_0x49cb96 instanceof HTTPClientError&&_0x49cb96[_0x1949a2(0xf3)]===0x191)return printAuthError(_0x49cb96),0x1;return console[_0x1949a2(0x132)](a30_0x1d0cbd[_0x1949a2(0x115)](_0x1949a2(0xff)+(_0x49cb96 instanceof Error?_0x49cb96['message']:String(_0x49cb96)))),console[_0x1949a2(0x132)](_0x1949a2(0xed)),0x1;}}else _0x3f98f8[_0x55c437]=_0x4993a9||undefined;return saveProfileToUserConfig(_0x43d460,_0x3f98f8),console[_0x1949a2(0x121)](a30_0x1d0cbd[_0x1949a2(0xc7)]('✓')+_0x1949a2(0xc4)+_0x43d460+'\x27\x20updated:\x20'+_0x55c437+'='+(_0x4993a9||_0x1949a2(0x114))),0x0;}}function a30_0x4917(){const _0x5a6f3f=['\x20\x20tdx\x20--profile\x20','profile:remove','1628NJtvMC','profile','Create\x20a\x20new\x20profile','customSite','includes','ERROR','1834860TamLtL','error','split','5128iKXemE','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','warn','profile:set','\x0aSetup\x20cancelled','\x20Profile\x20\x27','tdx:\x20profile\x20remove','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','default','Profile\x20name\x20cannot\x20be\x20empty','\x20\x20(no\x20profiles\x20found)','config','1169rwFWGb','Unknown\x20key\x20\x27','Set\x20session\x20profile','739090zGCLxE','Validating\x20API\x20key...','bold','tdx.json','9804wjAbrg','email','session','/app/mp/ak','Session\x20profile\x20set\x20to:\x20','Set\x20a\x20profile\x20configuration\x20value','getUserInfo','22084mSjxJA','12tHypYQ','parent_segment','profile:use','Failed\x20to\x20remove\x20profile:\x20','\x27\x20does\x20not\x20exist.','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20--default\x27\x20to\x20save\x20permanently','name','profile:create','Profile\x20\x27','API\x20key\x20cannot\x20be\x20empty','test','2802AEHjVx','Site\x20name\x20cannot\x20be\x20empty','27UuDqof','\x27\x20created','length','Site\x20was\x20not\x20changed.','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','4986JxVMFE','execute','create','\x20API\x20key\x20is\x20valid\x20(User:\x20','status','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Operation\x20cancelled','VALID_KEYS','\x20\x20-\x20','password','jobs','apiKey','other','(session:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','✗\x20Validation\x20failed:\x20','\x27\x20removed\x20from\x20configuration','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x0aOperation\x20cancelled','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','description','join','text','logLevel','site','profileName','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','You\x20can\x20find\x20your\x20API\x20key\x20at:','message','database','\x20API\x20key\x20removed\x20from\x20system\x20keychain','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>','\x0aAvailable\x20profiles:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','(cleared)','red','\x0aSaved\x20to:\x20','select','confirm','validate','Default\x20profile\x20set\x20to:\x20','llm_project','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Removal\x20cancelled','trim','Enter\x20profile\x20name:','log','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20API\x20key\x20saved\x20to\x20system\x20keychain','dim','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','yellow','5311251qRcoQL','Enter\x20description\x20(optional):'];a30_0x4917=function(){return _0x5a6f3f;};return a30_0x4917();}export class ProfileUseCommand extends BaseCommand{['name']=a30_0xbadcf6(0xde);[a30_0xbadcf6(0x105)]=a30_0xbadcf6(0xcf);[a30_0xbadcf6(0x119)](_0x5c09f5){const _0x5d9ea0=a30_0xbadcf6,{args:_0x5a83c3}=_0x5c09f5;if(_0x5a83c3[_0x5d9ea0(0xec)]===0x0)return _0x5d9ea0(0x10b);return undefined;}async['execute'](_0x4febd7){const _0x416820=a30_0xbadcf6,{args:_0x23ae38,options:_0x1d8b18}=_0x4febd7,_0x4a679d=_0x23ae38[0x0],_0x41d7fc=_0x1d8b18[_0x416820(0xc9)];cleanExpiredSessions();if(!profileExists(_0x4a679d)){console['error'](a30_0x1d0cbd[_0x416820(0x115)](_0x416820(0xe5)+_0x4a679d+_0x416820(0xe0))),console['log'](_0x416820(0x111));const _0x55b504=listProfiles();if(_0x55b504[_0x416820(0xec)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x1a5882 of _0x55b504){console[_0x416820(0x121)](_0x416820(0xf7)+_0x1a5882['name']);}return 0x1;}if(_0x41d7fc){const _0x1aee85=a30_0x3b7669[_0x416820(0x106)](getConfigDir(),_0x416820(0xd3));return saveActiveProfileToUserConfig(_0x4a679d),console[_0x416820(0x121)](_0x416820(0x11a)+a30_0x1d0cbd[_0x416820(0xc7)](_0x4a679d)),console[_0x416820(0x121)](a30_0x1d0cbd['dim'](_0x416820(0x116)+_0x1aee85)),0x0;}const _0x1a10ad=getSessionID(_0x1d8b18[_0x416820(0xd6)]);return saveSessionContext({'profile':_0x4a679d},_0x1d8b18[_0x416820(0xd6)]),console['log'](_0x416820(0xd8)+a30_0x1d0cbd['green'](_0x4a679d)+'\x20'+a30_0x1d0cbd[_0x416820(0x124)](_0x416820(0xfc)+_0x1a10ad+')')),console[_0x416820(0x121)](a30_0x1d0cbd[_0x416820(0x124)](_0x416820(0xc8)+_0x4a679d+_0x416820(0xe2))),0x0;}}
1
+ const a30_0x2a7a94=a30_0xa3dd;(function(_0x4775c5,_0x155289){const _0x48dcfd=a30_0xa3dd,_0x1293d9=_0x4775c5();while(!![]){try{const _0x3329d3=parseInt(_0x48dcfd(0x189))/0x1+-parseInt(_0x48dcfd(0x17a))/0x2+-parseInt(_0x48dcfd(0x17f))/0x3*(parseInt(_0x48dcfd(0x175))/0x4)+parseInt(_0x48dcfd(0x188))/0x5*(-parseInt(_0x48dcfd(0x173))/0x6)+parseInt(_0x48dcfd(0x195))/0x7+-parseInt(_0x48dcfd(0x17d))/0x8*(parseInt(_0x48dcfd(0x176))/0x9)+parseInt(_0x48dcfd(0x171))/0xa;if(_0x3329d3===_0x155289)break;else _0x1293d9['push'](_0x1293d9['shift']());}catch(_0xe0659a){_0x1293d9['push'](_0x1293d9['shift']());}}}(a30_0x1c74,0xd61cd));function a30_0x1c74(){const _0xe7808d=['\x27.\x0a\x0aValid\x20keys:\x20','name','test','(session:\x20','Enter\x20description\x20(optional):','error','ERROR','parent_segment','Profile\x20name\x20cannot\x20be\x20empty','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','getUserInfo','profile:remove','status','Set\x20a\x20profile\x20configuration\x20value','yellow','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','config','Validating\x20API\x20key...','profile:create','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx:\x20profile\x20remove','site','Operation\x20cancelled','✗\x20Validation\x20failed:\x20','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Set\x20session\x20profile','tdx:\x20profile\x20create','/app/mp/ak','profile:set','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','llm_project','28892310gIWXJF','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','1579224YWegWi','other','4566644IZnzzJ','268542NIeJTO','Remove\x20a\x20profile','Site\x20was\x20not\x20changed.','warn','2215912cBhXbv','session','\x27\x20requires\x20API\x20key\x20validation.','272xGypAa','Enter\x20site\x20name:','3kOQOWh','\x0aSetup\x20cancelled','create','\x20\x20tdx\x20--profile\x20','\x27\x20does\x20not\x20exist.','description','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','10Qphnas','1114907rDrFoQ','\x0aAvailable\x20profiles:','text','apiKey','bold','Removal\x20cancelled','Enter\x20profile\x20name:','profile','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Default\x20profile\x20set\x20to:\x20','\x27\x20removed\x20from\x20configuration','log','4643688BFUiTu','message','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','database','llm_agent','us01','validate','Session\x20profile\x20set\x20to:\x20','\x0aSaved\x20to:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20your\x20TD\x20API\x20key:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Unknown\x20key\x20\x27','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','profile:use','profileName','\x20Profile\x20\x27','customSite','\x20--default\x27\x20to\x20save\x20permanently','\x27\x20created','VALID_KEYS','green','Changing\x20site\x20to\x20\x27','Profile\x20\x27','Site\x20name\x20cannot\x20be\x20empty','confirm','dim','password','join','\x20\x20-\x20','logLevel','tdx.json','execute','trim','length','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20updated:\x20','split','includes','email'];a30_0x1c74=function(){return _0xe7808d;};return a30_0x1c74();}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 a30_0x102d88 from'node:path';import{saveSessionContext,getSessionID,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';function a30_0xa3dd(_0x520b04,_0x2c9463){_0x520b04=_0x520b04-0x13f;const _0x1c74c8=a30_0x1c74();let _0xa3ddd6=_0x1c74c8[_0x520b04];return _0xa3ddd6;}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 a30_0x5b575d from'prompts';import a30_0x562e1d from'chalk';function validateProfileName(_0x5a4773){const _0xa96745=a30_0xa3dd;if(!_0x5a4773||!_0x5a4773[_0xa96745(0x14a)]())return _0xa96745(0x159);const _0x1b9583=_0x5a4773[_0xa96745(0x14a)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x1b9583))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x1b9583))return _0xa96745(0x140)+_0x1b9583+_0xa96745(0x1a7);return!![];}export class ProfileCreateCommand extends BaseCommand{[a30_0x2a7a94(0x152)]=a30_0x2a7a94(0x164);[a30_0x2a7a94(0x184)]='Create\x20a\x20new\x20profile';async[a30_0x2a7a94(0x149)](_0x4b1dd0){const _0x2c1395=a30_0x2a7a94,{options:_0x4bdf8b,args:_0x35bbde}=_0x4b1dd0;console[_0x2c1395(0x194)](a30_0x562e1d[_0x2c1395(0x18d)](_0x2c1395(0x16c)));let _0x22d0e0;if(_0x35bbde[_0x2c1395(0x14b)]>0x0&&_0x35bbde[0x0]){const _0x441f44=_0x35bbde[0x0][_0x2c1395(0x14a)](),_0x7afe84=validateProfileName(_0x441f44);if(_0x7afe84!==!![])return console[_0x2c1395(0x156)](a30_0x562e1d[_0x2c1395(0x197)](_0x7afe84)),0x1;_0x22d0e0=_0x441f44;}else{const _0x1f92c0=await a30_0x5b575d({'type':_0x2c1395(0x18b),'name':_0x2c1395(0x1a9),'message':_0x2c1395(0x18f),'validate':validateProfileName});if(!_0x1f92c0[_0x2c1395(0x1a9)])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;_0x22d0e0=_0x1f92c0[_0x2c1395(0x1a9)][_0x2c1395(0x14a)]();}const _0x4a6526=await a30_0x5b575d({'type':'text','name':_0x2c1395(0x184),'message':_0x2c1395(0x155)}),_0x19db24=_0x4a6526[_0x2c1395(0x184)]?.[_0x2c1395(0x14a)]()||undefined,_0x182162=_0x4bdf8b['site']||_0x2c1395(0x19f),{choices:_0x12b7db,initialIndex:_0x57bb2c}=buildSiteChoices(_0x182162),_0xac80c7=await a30_0x5b575d({'type':'select','name':_0x2c1395(0x167),'message':_0x2c1395(0x19c)+_0x22d0e0+'\x27:','choices':_0x12b7db,'initial':_0x57bb2c});if(!_0xac80c7[_0x2c1395(0x167)])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;let _0x48a7ae;if(_0xac80c7[_0x2c1395(0x167)]===_0x2c1395(0x174)){const _0x2a778b=await a30_0x5b575d({'type':_0x2c1395(0x18b),'name':_0x2c1395(0x1ab),'message':_0x2c1395(0x17e),'initial':_0x2c1395(0x19f),'validate':_0x11e56a=>{const _0x1bd6f4=_0x2c1395;if(!_0x11e56a||!_0x11e56a[_0x1bd6f4(0x14a)]())return _0x1bd6f4(0x141);if(!/^[a-z0-9-]+$/[_0x1bd6f4(0x153)](_0x11e56a[_0x1bd6f4(0x14a)]()))return _0x1bd6f4(0x161);return!![];}});if(!_0x2a778b['customSite'])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;_0x48a7ae=_0x2a778b[_0x2c1395(0x1ab)];}else _0x48a7ae=_0xac80c7['site'];const _0x1b7fcf=resolveSite(_0x48a7ae);console[_0x2c1395(0x194)](_0x2c1395(0x191)+_0x1b7fcf),console[_0x2c1395(0x194)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2c1395(0x194)]('\x20\x20'+getConsoleUrl(_0x1b7fcf,_0x2c1395(0x16d)));const _0x46825c=await a30_0x5b575d({'type':_0x2c1395(0x144),'name':_0x2c1395(0x18c),'message':_0x2c1395(0x1a4),'validate':_0x1ff4ad=>{const _0x86bc70=_0x2c1395;if(!_0x1ff4ad||!_0x1ff4ad[_0x86bc70(0x14a)]())return _0x86bc70(0x160);return!![];}});if(!_0x46825c[_0x2c1395(0x18c)])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;const _0x2c7dba=_0x46825c[_0x2c1395(0x18c)];console['log'](_0x2c1395(0x163));try{const _0x42ed69=TDX[_0x2c1395(0x181)]({'site':_0x1b7fcf,'apiKey':_0x2c7dba[_0x2c1395(0x14a)](),'logLevel':_0x4bdf8b[_0x2c1395(0x147)]??LogLevel[_0x2c1395(0x157)]}),_0x3b772b=await _0x42ed69['jobs'][_0x2c1395(0x15b)]();console[_0x2c1395(0x194)](a30_0x562e1d['green']('✓')+_0x2c1395(0x165)+_0x3b772b[_0x2c1395(0x150)]+')');const _0x233ed7=await isKeychainAvailable();_0x233ed7?(await saveAPIKeyAsync(_0x2c7dba[_0x2c1395(0x14a)](),_0x1b7fcf,_0x22d0e0),console[_0x2c1395(0x194)](a30_0x562e1d[_0x2c1395(0x1af)]('✓')+_0x2c1395(0x199)+_0x22d0e0+')')):(console[_0x2c1395(0x179)](a30_0x562e1d[_0x2c1395(0x15f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x2c1395(0x179)](a30_0x562e1d[_0x2c1395(0x15f)](_0x2c1395(0x186))));const _0x533d8b={'site':_0x1b7fcf,..._0x19db24&&{'description':_0x19db24}};return saveProfileToUserConfig(_0x22d0e0,_0x533d8b),console[_0x2c1395(0x194)](a30_0x562e1d[_0x2c1395(0x1af)]('✓')+_0x2c1395(0x1aa)+_0x22d0e0+_0x2c1395(0x1ad)),console['log'](),console[_0x2c1395(0x194)](_0x2c1395(0x15a)),console[_0x2c1395(0x194)](_0x2c1395(0x182)+_0x22d0e0+_0x2c1395(0x172)),console[_0x2c1395(0x194)](_0x2c1395(0x182)+_0x22d0e0+_0x2c1395(0x1a5)),0x0;}catch(_0x5b7057){if(_0x5b7057 instanceof HTTPClientError&&_0x5b7057[_0x2c1395(0x15d)]===0x191)return printAuthError(_0x5b7057),0x1;return console['error'](a30_0x562e1d[_0x2c1395(0x197)]('✗\x20Validation\x20failed:\x20'+(_0x5b7057 instanceof Error?_0x5b7057[_0x2c1395(0x196)]:String(_0x5b7057)))),console[_0x2c1395(0x156)](_0x2c1395(0x19a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a30_0x2a7a94(0x15c);['description']=a30_0x2a7a94(0x177);['validate'](_0x1b4fee){const _0x329968=a30_0x2a7a94,{args:_0x13d185}=_0x1b4fee;if(_0x13d185[_0x329968(0x14b)]===0x0)return _0x329968(0x198);return undefined;}async['execute'](_0x149726){const _0x407ba3=a30_0x2a7a94,{args:_0x59134}=_0x149726,_0x3dbc6b=_0x59134[0x0];console[_0x407ba3(0x194)](a30_0x562e1d[_0x407ba3(0x18d)](_0x407ba3(0x166)));if(!profileExists(_0x3dbc6b)){console[_0x407ba3(0x156)](a30_0x562e1d[_0x407ba3(0x197)](_0x407ba3(0x140)+_0x3dbc6b+_0x407ba3(0x183))),console[_0x407ba3(0x194)](_0x407ba3(0x18a));const _0x510362=listProfiles();if(_0x510362[_0x407ba3(0x14b)]===0x0)console[_0x407ba3(0x194)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x4a4dab of _0x510362){console[_0x407ba3(0x194)](_0x407ba3(0x146)+_0x4a4dab[_0x407ba3(0x152)]);}return 0x1;}const _0x159bf1=await a30_0x5b575d({'type':_0x407ba3(0x142),'name':_0x407ba3(0x142),'message':_0x407ba3(0x19b)+_0x3dbc6b+'\x27?','initial':![]});if(!_0x159bf1[_0x407ba3(0x142)])return console[_0x407ba3(0x194)](_0x407ba3(0x18e)),0x0;try{removeProfileFromUserConfig(_0x3dbc6b),console[_0x407ba3(0x194)](a30_0x562e1d['green']('✓')+'\x20Profile\x20\x27'+_0x3dbc6b+_0x407ba3(0x193));}catch(_0x42a691){return console[_0x407ba3(0x156)](a30_0x562e1d[_0x407ba3(0x197)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x42a691 instanceof Error?_0x42a691['message']:String(_0x42a691)))),0x1;}const _0x32db91=await isKeychainAvailable();if(_0x32db91){const _0x4e66a1=await deleteKeychainAPIKey(_0x3dbc6b);_0x4e66a1&&console[_0x407ba3(0x194)](a30_0x562e1d[_0x407ba3(0x1af)]('✓')+_0x407ba3(0x16a));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a30_0x2a7a94(0x152)]=a30_0x2a7a94(0x16e);['description']=a30_0x2a7a94(0x15e);static [a30_0x2a7a94(0x1ae)]=[a30_0x2a7a94(0x167),a30_0x2a7a94(0x19d),a30_0x2a7a94(0x158),a30_0x2a7a94(0x170),a30_0x2a7a94(0x19e),'description'];[a30_0x2a7a94(0x1a0)](_0x21aaff){const _0x584602=a30_0x2a7a94,{args:_0x1b7ab4,options:_0x50b078}=_0x21aaff,_0xda7c19=_0x50b078[_0x584602(0x190)]||getActiveProfile();if(!_0xda7c19)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(_0x1b7ab4[_0x584602(0x14b)]===0x0)return _0x584602(0x185)+ProfileSetCommand['VALID_KEYS'][_0x584602(0x145)](',\x20');const _0x392e40=_0x1b7ab4[0x0];if(!_0x392e40[_0x584602(0x14f)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x584602(0x145)](',\x20');const [_0x3ae562]=_0x392e40[_0x584602(0x14e)]('=',0x2);if(!ProfileSetCommand[_0x584602(0x1ae)][_0x584602(0x14f)](_0x3ae562))return _0x584602(0x1a6)+_0x3ae562+_0x584602(0x151)+ProfileSetCommand[_0x584602(0x1ae)][_0x584602(0x145)](',\x20');return undefined;}async['execute'](_0x35125e){const _0x3eea01=a30_0x2a7a94,{args:_0x3ed9e0,options:_0x23c602}=_0x35125e,_0xc7c445=_0x23c602[_0x3eea01(0x190)]||getActiveProfile(),[_0x2d2800,..._0x3894b4]=_0x3ed9e0[0x0][_0x3eea01(0x14e)]('='),_0x3377cb=_0x3894b4[_0x3eea01(0x145)]('=');console[_0x3eea01(0x194)](a30_0x562e1d['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0xc7c445)){const _0x2c47ec=await a30_0x5b575d({'type':_0x3eea01(0x142),'name':_0x3eea01(0x181),'message':_0x3eea01(0x140)+_0xc7c445+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x2c47ec['create'])return console['log'](_0x3eea01(0x168)),0x1;}const _0x1106ee=loadProfile(_0xc7c445),_0x5aaca9=_0x1106ee?.[_0x3eea01(0x162)]||{};if(_0x2d2800===_0x3eea01(0x167)){const _0x46f298=resolveSite(_0x3377cb);console[_0x3eea01(0x194)](_0x3eea01(0x13f)+_0x46f298+_0x3eea01(0x17c)),console[_0x3eea01(0x194)](_0x3eea01(0x187)),console['log']('\x20\x20'+getConsoleUrl(_0x46f298,_0x3eea01(0x16d)));const _0x203256=await a30_0x5b575d({'type':_0x3eea01(0x144),'name':_0x3eea01(0x18c),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x1e69aa=>{const _0x11c90a=_0x3eea01;if(!_0x1e69aa||!_0x1e69aa[_0x11c90a(0x14a)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x203256[_0x3eea01(0x18c)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x3eea01(0x194)](_0x3eea01(0x163));try{const _0x5a86b3=TDX['create']({'site':_0x46f298,'apiKey':_0x203256[_0x3eea01(0x18c)][_0x3eea01(0x14a)](),'logLevel':_0x23c602['logLevel']??LogLevel[_0x3eea01(0x157)]}),_0x59c3c8=await _0x5a86b3['jobs'][_0x3eea01(0x15b)]();console[_0x3eea01(0x194)](a30_0x562e1d[_0x3eea01(0x1af)]('✓')+_0x3eea01(0x165)+_0x59c3c8['email']+')');const _0x3f1bba=await isKeychainAvailable();_0x3f1bba?(await saveAPIKeyAsync(_0x203256[_0x3eea01(0x18c)][_0x3eea01(0x14a)](),_0x46f298,_0xc7c445),console[_0x3eea01(0x194)](a30_0x562e1d[_0x3eea01(0x1af)]('✓')+_0x3eea01(0x1a3))):console[_0x3eea01(0x179)](a30_0x562e1d[_0x3eea01(0x15f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5aaca9[_0x3eea01(0x167)]=_0x46f298;}catch(_0x40f804){if(_0x40f804 instanceof HTTPClientError&&_0x40f804['status']===0x191)return printAuthError(_0x40f804),0x1;return console[_0x3eea01(0x156)](a30_0x562e1d[_0x3eea01(0x197)](_0x3eea01(0x169)+(_0x40f804 instanceof Error?_0x40f804[_0x3eea01(0x196)]:String(_0x40f804)))),console['error'](_0x3eea01(0x178)),0x1;}}else _0x5aaca9[_0x2d2800]=_0x3377cb||undefined;return saveProfileToUserConfig(_0xc7c445,_0x5aaca9),console[_0x3eea01(0x194)](a30_0x562e1d[_0x3eea01(0x1af)]('✓')+_0x3eea01(0x1aa)+_0xc7c445+_0x3eea01(0x14d)+_0x2d2800+'='+(_0x3377cb||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a30_0x2a7a94(0x1a8);['description']=a30_0x2a7a94(0x16b);[a30_0x2a7a94(0x1a0)](_0x55ee69){const _0x32ebea=a30_0x2a7a94,{args:_0x3a90fd}=_0x55ee69;if(_0x3a90fd[_0x32ebea(0x14b)]===0x0)return _0x32ebea(0x16f);return undefined;}async[a30_0x2a7a94(0x149)](_0x1c52f2){const _0x41a6fb=a30_0x2a7a94,{args:_0x6e4158,options:_0x269b2f}=_0x1c52f2,_0x4c3b8f=_0x6e4158[0x0],_0x34c1e7=_0x269b2f['default'];cleanExpiredSessions();if(!profileExists(_0x4c3b8f)){console[_0x41a6fb(0x156)](a30_0x562e1d['red'](_0x41a6fb(0x140)+_0x4c3b8f+'\x27\x20does\x20not\x20exist.')),console['log'](_0x41a6fb(0x18a));const _0x255cd6=listProfiles();if(_0x255cd6[_0x41a6fb(0x14b)]===0x0)console[_0x41a6fb(0x194)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x43e747 of _0x255cd6){console['log'](_0x41a6fb(0x146)+_0x43e747[_0x41a6fb(0x152)]);}return 0x1;}if(_0x34c1e7){const _0x30e318=a30_0x102d88['join'](getConfigDir(),_0x41a6fb(0x148));return saveActiveProfileToUserConfig(_0x4c3b8f),console[_0x41a6fb(0x194)](_0x41a6fb(0x192)+a30_0x562e1d[_0x41a6fb(0x1af)](_0x4c3b8f)),console[_0x41a6fb(0x194)](a30_0x562e1d[_0x41a6fb(0x143)](_0x41a6fb(0x1a2)+_0x30e318)),0x0;}const _0x526cc7=getSessionID(_0x269b2f['session']);return saveSessionContext({'profile':_0x4c3b8f},_0x269b2f[_0x41a6fb(0x17b)]),console[_0x41a6fb(0x194)](_0x41a6fb(0x1a1)+a30_0x562e1d[_0x41a6fb(0x1af)](_0x4c3b8f)+'\x20'+a30_0x562e1d['dim'](_0x41a6fb(0x154)+_0x526cc7+')')),console[_0x41a6fb(0x194)](a30_0x562e1d[_0x41a6fb(0x143)](_0x41a6fb(0x14c)+_0x4c3b8f+_0x41a6fb(0x1ac))),0x0;}}
@@ -1 +1 @@
1
- function a31_0x2411(){const _0x5275d0=['2088MZAfJc','13NrOEua','73320pIudRU','map','18770JaaIQG','3240714lVuQeZ','393168ucDhVP','message','15190fDAwXj','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Global:\x20~/.config/tdx/tdx.json','List\x20all\x20available\x20profiles','24846zwibSt','176hYiLaq','4bmjpNf','log','scope','config','588KIZlBj','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','4239WiQwTq','9809605UqkTMP','error','execute','description'];a31_0x2411=function(){return _0x5275d0;};return a31_0x2411();}function a31_0x297a(_0x272e20,_0x476b27){_0x272e20=_0x272e20-0x155;const _0x241188=a31_0x2411();let _0x297aab=_0x241188[_0x272e20];return _0x297aab;}const a31_0x4b32f1=a31_0x297a;(function(_0x1af058,_0x710959){const _0x179dc9=a31_0x297a,_0x44dcc3=_0x1af058();while(!![]){try{const _0x167c7f=parseInt(_0x179dc9(0x167))/0x1*(-parseInt(_0x179dc9(0x158))/0x2)+-parseInt(_0x179dc9(0x16b))/0x3*(-parseInt(_0x179dc9(0x15a))/0x4)+parseInt(_0x179dc9(0x16e))/0x5*(parseInt(_0x179dc9(0x166))/0x6)+-parseInt(_0x179dc9(0x15e))/0x7*(parseInt(_0x179dc9(0x168))/0x8)+parseInt(_0x179dc9(0x161))/0x9*(-parseInt(_0x179dc9(0x16a))/0xa)+-parseInt(_0x179dc9(0x159))/0xb*(parseInt(_0x179dc9(0x16c))/0xc)+parseInt(_0x179dc9(0x162))/0xd;if(_0x167c7f===_0x710959)break;else _0x44dcc3['push'](_0x44dcc3['shift']());}catch(_0x20b6b5){_0x44dcc3['push'](_0x44dcc3['shift']());}}}(a31_0x2411,0x86dcd));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{[a31_0x4b32f1(0x160)]='profiles';[a31_0x4b32f1(0x165)]=a31_0x4b32f1(0x157);async[a31_0x4b32f1(0x164)](_0x198764){const _0x22d489=a31_0x4b32f1,{options:_0x243634}=_0x198764;try{const _0x220653=listProfiles(),_0x57f7be=getActiveProfile();if(_0x220653['length']===0x0)return console[_0x22d489(0x15b)](_0x22d489(0x155)),console['log'](_0x22d489(0x15f)),console[_0x22d489(0x15b)](_0x22d489(0x156)),0x0;const _0x544ab8=_0x220653[_0x22d489(0x169)](_0x541933=>{const _0x5ceed3=_0x22d489,_0x5172fe=_0x541933['name']===_0x57f7be,_0x1336ed=getProfileParams(_0x541933[_0x5ceed3(0x15d)]);return{'name':_0x541933[_0x5ceed3(0x160)],'active':_0x5172fe,'scope':_0x541933[_0x5ceed3(0x15c)],'description':_0x541933[_0x5ceed3(0x15d)]['description']||'','params':_0x1336ed};});return await handleSDKOutput(_0x544ab8,_0x243634),0x0;}catch(_0x263e15){return _0x263e15 instanceof Error&&console[_0x22d489(0x163)]('Error:\x20'+_0x263e15[_0x22d489(0x16d)]),0x1;}}}
1
+ const a31_0xe04cb8=a31_0x6f00;(function(_0x3a7b8a,_0x485cdf){const _0x17a180=a31_0x6f00,_0x2b9878=_0x3a7b8a();while(!![]){try{const _0x1aa0d2=parseInt(_0x17a180(0x8d))/0x1+-parseInt(_0x17a180(0x96))/0x2+parseInt(_0x17a180(0x86))/0x3*(-parseInt(_0x17a180(0x83))/0x4)+-parseInt(_0x17a180(0x8b))/0x5+-parseInt(_0x17a180(0x84))/0x6+-parseInt(_0x17a180(0x99))/0x7+parseInt(_0x17a180(0x88))/0x8*(parseInt(_0x17a180(0x97))/0x9);if(_0x1aa0d2===_0x485cdf)break;else _0x2b9878['push'](_0x2b9878['shift']());}catch(_0x3ed32b){_0x2b9878['push'](_0x2b9878['shift']());}}}(a31_0x2d38,0x9426c));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a31_0x2d38(){const _0x4b3952=['log','List\x20all\x20available\x20profiles','2819890ZRLUGI','error','193812qtjala','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','length','config','scope','message','execute','name','488390jIPkNL','36kmiEJx','Error:\x20','3315382JsMFZU','8hryGsb','2933610pbrhVJ','\x20\x20Global:\x20~/.config/tdx/tdx.json','126741ECcHhY','profiles','4536488OhuLwT'];a31_0x2d38=function(){return _0x4b3952;};return a31_0x2d38();}function a31_0x6f00(_0x36e173,_0x17bfb0){_0x36e173=_0x36e173-0x83;const _0x2d38b3=a31_0x2d38();let _0x6f0076=_0x2d38b3[_0x36e173];return _0x6f0076;}export class ProfilesCommand extends BaseCommand{[a31_0xe04cb8(0x95)]=a31_0xe04cb8(0x87);['description']=a31_0xe04cb8(0x8a);async[a31_0xe04cb8(0x94)](_0x1f03fc){const _0x5afcd0=a31_0xe04cb8,{options:_0x38a269}=_0x1f03fc;try{const _0x42c8da=listProfiles(),_0x47446d=getActiveProfile();if(_0x42c8da[_0x5afcd0(0x90)]===0x0)return console[_0x5afcd0(0x89)](_0x5afcd0(0x8e)),console[_0x5afcd0(0x89)](_0x5afcd0(0x8f)),console[_0x5afcd0(0x89)](_0x5afcd0(0x85)),0x0;const _0x1a3f2b=_0x42c8da['map'](_0x366838=>{const _0x397cef=_0x5afcd0,_0x27a35f=_0x366838[_0x397cef(0x95)]===_0x47446d,_0x3c7662=getProfileParams(_0x366838[_0x397cef(0x91)]);return{'name':_0x366838[_0x397cef(0x95)],'active':_0x27a35f,'scope':_0x366838[_0x397cef(0x92)],'description':_0x366838[_0x397cef(0x91)]['description']||'','params':_0x3c7662};});return await handleSDKOutput(_0x1a3f2b,_0x38a269),0x0;}catch(_0x478667){return _0x478667 instanceof Error&&console[_0x5afcd0(0x8c)](_0x5afcd0(0x98)+_0x478667[_0x5afcd0(0x93)]),0x1;}}}
@@ -1 +1 @@
1
- const a32_0x4e0265=a32_0x3b91;(function(_0x534f8d,_0x32fe99){const _0x2a3959=a32_0x3b91,_0x15c6a6=_0x534f8d();while(!![]){try{const _0x2936cd=parseInt(_0x2a3959(0x11c))/0x1+parseInt(_0x2a3959(0x108))/0x2*(parseInt(_0x2a3959(0x109))/0x3)+parseInt(_0x2a3959(0x10d))/0x4*(parseInt(_0x2a3959(0x107))/0x5)+parseInt(_0x2a3959(0xfd))/0x6+-parseInt(_0x2a3959(0xfc))/0x7+-parseInt(_0x2a3959(0x111))/0x8*(parseInt(_0x2a3959(0x120))/0x9)+parseInt(_0x2a3959(0x121))/0xa*(-parseInt(_0x2a3959(0xfe))/0xb);if(_0x2936cd===_0x32fe99)break;else _0x15c6a6['push'](_0x15c6a6['shift']());}catch(_0x58f9fa){_0x15c6a6['push'](_0x15c6a6['shift']());}}}(a32_0xa7ae,0x41855));function a32_0x3b91(_0x5ca9c7,_0x3133c6){_0x5ca9c7=_0x5ca9c7-0xf1;const _0xa7aee4=a32_0xa7ae();let _0x3b9112=_0xa7aee4[_0x5ca9c7];return _0x3b9112;}import{BaseCommand}from'./command.js';function a32_0xa7ae(){const _0x14c1ae=['Site:\x20','...','message','55wiwEZr','61254OqTBJd','39rQAcJT','totalSplits','Statement\x20','setPhase','77516lxsGwe','jobId','error','output','14024CNyQiE','No\x20SQL\x20provided','description','\x0aAll\x20results\x20saved\x20to\x20','completedSplits','setJobId','Error:\x20','verbose','Schema:\x20','file','name','459162PPHzKY','SQL:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','execute','9afPEtS','6713880ZwdKEm','Executing\x20query...','information_schema','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','Executing\x20query\x20[','options','database','query','Query\x20completed:\x20Processed\x20','data','site','push','2373665XRKMvH','1260762JIszgn','11KyQGdw','args','processedRows','\x20rows\x20','join','length'];a32_0xa7ae=function(){return _0x14c1ae;};return a32_0xa7ae();}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';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a32_0x4e0265(0x11b)]=a32_0x4e0265(0xf7);[a32_0x4e0265(0x113)]='Run\x20Trino\x20queries\x20(streaming)';async[a32_0x4e0265(0x11f)](_0x44157a){const _0x25f1dc=a32_0x4e0265,{options:_0x4e2f10,args:_0x465e75,tdx:_0x3f2fdc}=_0x44157a,_0x1b2db7={..._0x4e2f10,'limitStructuredFormats':!![]},_0x36d07c=_0x465e75[0x0],_0x5efdcf=_0x4e2f10['file'];let _0x192c87;try{if(_0x5efdcf)_0x192c87=readSqlStatementsFromFile(_0x5efdcf);else{if(_0x36d07c==='-')_0x192c87=await readSqlStatementsFromStdin();else{if(_0x36d07c&&isSqlFilePath(_0x36d07c))_0x192c87=readSqlStatementsFromFile(_0x36d07c);else{if(_0x36d07c)_0x192c87=splitSqlStatements(_0x36d07c);else throw new Error(_0x25f1dc(0x112));}}}}catch(_0x55bbfd){return console[_0x25f1dc(0x10f)](_0x25f1dc(0x117)+_0x55bbfd[_0x25f1dc(0x106)]),0x1;}const _0xb313d3=_0x4e2f10[_0x25f1dc(0xf6)]||_0x25f1dc(0xf2),_0xeffebe=_0x4e2f10['catalog'];try{const _0x1e4aad=[],_0x3c1b81=!!_0x4e2f10[_0x25f1dc(0x110)];for(let _0x4b2b99=0x0;_0x4b2b99<_0x192c87[_0x25f1dc(0x103)];_0x4b2b99++){const _0x3b8d74=_0x192c87[_0x4b2b99],_0x1e5b8c=_0x4b2b99+0x1,_0x3d0985=_0x192c87[_0x25f1dc(0x103)],_0x39717b=_0x3d0985>0x1;_0x4e2f10[_0x25f1dc(0x118)]&&(console[_0x25f1dc(0x10f)]('\x0a'+(_0x39717b?_0x25f1dc(0x10b)+_0x1e5b8c+'/'+_0x3d0985+':':'')),console[_0x25f1dc(0x10f)](_0x25f1dc(0x104)+_0x4e2f10[_0x25f1dc(0xfa)]),console[_0x25f1dc(0x10f)]('Catalog:\x20'+(_0xeffebe||'td')),console[_0x25f1dc(0x10f)](_0x25f1dc(0x119)+_0xb313d3),console['error'](_0x25f1dc(0x11d)+_0x3b8d74));const _0x4371a1=_0x39717b?'Executing\x20statement\x20'+_0x1e5b8c+'/'+_0x3d0985+_0x25f1dc(0x105):_0x25f1dc(0xf1);try{const _0x5aa660=await withProgressSpinner(_0x4371a1,async _0x6ca7c8=>{const _0x3321b3=_0x25f1dc,_0x4a582e=await _0x3f2fdc[_0x3321b3(0xf7)][_0x3321b3(0x11f)](_0x3b8d74,{'catalog':_0xeffebe,'schema':_0xb313d3,'onJobId':_0x73fb5d=>{const _0x5db874=_0x3321b3;_0x6ca7c8[_0x5db874(0x116)](_0x73fb5d);},'onProgress':_0xd37635=>{const _0xa8d3b=_0x3321b3;_0x6ca7c8[_0xa8d3b(0x10c)](_0xa8d3b(0xf4)+_0xd37635['state']+']'),_0x6ca7c8['setExtra'](formatRows(_0xd37635[_0xa8d3b(0x100)])+_0xa8d3b(0x101)+_0xd37635[_0xa8d3b(0x115)]+'/'+_0xd37635[_0xa8d3b(0x10a)]+'\x20splits');}});return _0x4a582e;},{'verbose':_0x4e2f10[_0x25f1dc(0x118)]}),_0x467bce=_0x5aa660[_0x25f1dc(0xf9)],_0x2e148c=_0x467bce[_0x25f1dc(0x10e)]?'\x20[Job\x20ID:\x20'+_0x467bce[_0x25f1dc(0x10e)]+']':'',_0x10823e=_0x39717b?_0x25f1dc(0x10b)+_0x1e5b8c+'/'+_0x3d0985+'\x20-\x20':'';console[_0x25f1dc(0x10f)]('✔\x20'+_0x10823e+_0x25f1dc(0xf8)+formatRows(_0x467bce['stats'][_0x25f1dc(0x100)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x467bce['stats']['elapsedTimeMillis'])+_0x2e148c));if(_0x39717b&&_0x3c1b81){const _0x24f0d3=resolveOutputOptions(_0x1b2db7),_0x59cebf=await formatQueryOutput(_0x467bce,_0x24f0d3);_0x1e4aad[_0x25f1dc(0xfb)](_0x59cebf);}else await handleQueryOutput(_0x467bce,_0x1b2db7);}catch(_0x7c2446){const _0xa87dcb=_0x39717b?_0x25f1dc(0x10b)+_0x1e5b8c+'/'+_0x3d0985+':\x0a':'',_0x29fdfc=_0x7c2446 instanceof SDKError?_0x7c2446['originalMessage']:_0x7c2446['message'];return console[_0x25f1dc(0x10f)](''+_0xa87dcb+_0x29fdfc),0x1;}}if(_0x192c87[_0x25f1dc(0x103)]>0x1&&_0x3c1b81&&_0x1e4aad[_0x25f1dc(0x103)]>0x0){const _0x4f590f=_0x1e4aad[_0x25f1dc(0x102)]('\x0a');writeFileSync(_0x4e2f10[_0x25f1dc(0x110)],_0x4f590f),console[_0x25f1dc(0x10f)](_0x25f1dc(0x114)+_0x4e2f10[_0x25f1dc(0x110)]);}return 0x0;}catch(_0x4bf289){throw _0x4bf289;}}['validate'](_0x13c2eb){const _0x599d84=a32_0x4e0265,_0x238456=_0x13c2eb[_0x599d84(0xff)][0x0],_0x1ecc67=_0x13c2eb[_0x599d84(0xf5)][_0x599d84(0x11a)];if(!_0x238456&&!_0x1ecc67)return _0x599d84(0xf3);if(_0x238456&&_0x1ecc67)return _0x599d84(0x11e);return undefined;}}
1
+ const a32_0x5dea78=a32_0x226e;function a32_0x226e(_0x346ba4,_0x1e7a99){_0x346ba4=_0x346ba4-0x171;const _0x222fa7=a32_0x222f();let _0x226e11=_0x222fa7[_0x346ba4];return _0x226e11;}(function(_0x27f3c3,_0x45bf3a){const _0x33686b=a32_0x226e,_0x1ba8e9=_0x27f3c3();while(!![]){try{const _0x511f55=-parseInt(_0x33686b(0x18d))/0x1*(parseInt(_0x33686b(0x174))/0x2)+parseInt(_0x33686b(0x196))/0x3*(-parseInt(_0x33686b(0x197))/0x4)+-parseInt(_0x33686b(0x18c))/0x5+parseInt(_0x33686b(0x191))/0x6+-parseInt(_0x33686b(0x178))/0x7*(parseInt(_0x33686b(0x184))/0x8)+parseInt(_0x33686b(0x19b))/0x9*(parseInt(_0x33686b(0x175))/0xa)+parseInt(_0x33686b(0x1a0))/0xb*(parseInt(_0x33686b(0x172))/0xc);if(_0x511f55===_0x45bf3a)break;else _0x1ba8e9['push'](_0x1ba8e9['shift']());}catch(_0xfb36a5){_0x1ba8e9['push'](_0x1ba8e9['shift']());}}}(a32_0x222f,0xa9df2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a32_0x222f(){const _0x20d595=['5978736RQXgYc','file','Executing\x20query...','No\x20SQL\x20provided','verbose','77685eMBGvn','60TIRxaX','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','query','completedSplits','28485Ibbwoo','jobId','Executing\x20query\x20[','Error:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','87197ZOMKPF','validate','Run\x20Trino\x20queries\x20(streaming)','length','error','state','600MbiUSr','setJobId','452uhKziw','3500BGxosT','Statement\x20','Catalog:\x20','266dRhNWF','site','\x20rows\x20','push','information_schema','processedRows','setExtra','Site:\x20','totalSplits','options','name','output','29752eOkIhi','args','data','message','...','database','stats','join','2057345IIfSSi','3821tATyVl','description','execute','setPhase'];a32_0x222f=function(){return _0x20d595;};return a32_0x222f();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a32_0x5dea78(0x182)]=a32_0x5dea78(0x199);[a32_0x5dea78(0x18e)]=a32_0x5dea78(0x1a2);async[a32_0x5dea78(0x18f)](_0x4e40c2){const _0x350c61=a32_0x5dea78,{options:_0x3aa9ab,args:_0x371268,tdx:_0x11c604}=_0x4e40c2,_0x540e01={..._0x3aa9ab,'limitStructuredFormats':!![]},_0x4bd42e=_0x371268[0x0],_0x5d227d=_0x3aa9ab[_0x350c61(0x192)];let _0x2dd15c;try{if(_0x5d227d)_0x2dd15c=readSqlStatementsFromFile(_0x5d227d);else{if(_0x4bd42e==='-')_0x2dd15c=await readSqlStatementsFromStdin();else{if(_0x4bd42e&&isSqlFilePath(_0x4bd42e))_0x2dd15c=readSqlStatementsFromFile(_0x4bd42e);else{if(_0x4bd42e)_0x2dd15c=splitSqlStatements(_0x4bd42e);else throw new Error(_0x350c61(0x194));}}}}catch(_0x5cc8c5){return console[_0x350c61(0x1a4)](_0x350c61(0x19e)+_0x5cc8c5[_0x350c61(0x187)]),0x1;}const _0x469926=_0x3aa9ab[_0x350c61(0x189)]||_0x350c61(0x17c),_0x1b0e07=_0x3aa9ab['catalog'];try{const _0x111e73=[],_0x4c3d2e=!!_0x3aa9ab[_0x350c61(0x183)];for(let _0x15ed2c=0x0;_0x15ed2c<_0x2dd15c[_0x350c61(0x1a3)];_0x15ed2c++){const _0x1ff8e9=_0x2dd15c[_0x15ed2c],_0x5ddd74=_0x15ed2c+0x1,_0x2a9c72=_0x2dd15c['length'],_0x8e453a=_0x2a9c72>0x1;_0x3aa9ab[_0x350c61(0x195)]&&(console[_0x350c61(0x1a4)]('\x0a'+(_0x8e453a?'Statement\x20'+_0x5ddd74+'/'+_0x2a9c72+':':'')),console['error'](_0x350c61(0x17f)+_0x3aa9ab[_0x350c61(0x179)]),console['error'](_0x350c61(0x177)+(_0x1b0e07||'td')),console[_0x350c61(0x1a4)]('Schema:\x20'+_0x469926),console[_0x350c61(0x1a4)]('SQL:\x20'+_0x1ff8e9));const _0x45ef6b=_0x8e453a?'Executing\x20statement\x20'+_0x5ddd74+'/'+_0x2a9c72+_0x350c61(0x188):_0x350c61(0x193);try{const _0x4c4a38=await withProgressSpinner(_0x45ef6b,async _0x34a523=>{const _0x31b85b=_0x350c61,_0x3d2ee8=await _0x11c604[_0x31b85b(0x199)][_0x31b85b(0x18f)](_0x1ff8e9,{'catalog':_0x1b0e07,'schema':_0x469926,'onJobId':_0x52c09a=>{const _0x1f51af=_0x31b85b;_0x34a523[_0x1f51af(0x173)](_0x52c09a);},'onProgress':_0x205fca=>{const _0x557080=_0x31b85b;_0x34a523[_0x557080(0x190)](_0x557080(0x19d)+_0x205fca[_0x557080(0x171)]+']'),_0x34a523[_0x557080(0x17e)](formatRows(_0x205fca[_0x557080(0x17d)])+_0x557080(0x17a)+_0x205fca[_0x557080(0x19a)]+'/'+_0x205fca[_0x557080(0x180)]+'\x20splits');}});return _0x3d2ee8;},{'verbose':_0x3aa9ab['verbose']}),_0x4ed6f4=_0x4c4a38[_0x350c61(0x186)],_0x5650f2=_0x4ed6f4[_0x350c61(0x19c)]?'\x20[Job\x20ID:\x20'+_0x4ed6f4[_0x350c61(0x19c)]+']':'',_0x54dfe0=_0x8e453a?_0x350c61(0x176)+_0x5ddd74+'/'+_0x2a9c72+'\x20-\x20':'';console[_0x350c61(0x1a4)]('✔\x20'+_0x54dfe0+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4ed6f4['stats'][_0x350c61(0x17d)])+_0x350c61(0x17a)+('in\x20'+formatElapsed(_0x4ed6f4[_0x350c61(0x18a)]['elapsedTimeMillis'])+_0x5650f2));if(_0x8e453a&&_0x4c3d2e){const _0x543fd1=resolveOutputOptions(_0x540e01),_0x334f4a=await formatQueryOutput(_0x4ed6f4,_0x543fd1);_0x111e73[_0x350c61(0x17b)](_0x334f4a);}else await handleQueryOutput(_0x4ed6f4,_0x540e01);}catch(_0x522fd3){const _0x58ca70=_0x8e453a?'Statement\x20'+_0x5ddd74+'/'+_0x2a9c72+':\x0a':'',_0x1fc97b=_0x522fd3 instanceof SDKError?_0x522fd3['originalMessage']:_0x522fd3[_0x350c61(0x187)];return console[_0x350c61(0x1a4)](''+_0x58ca70+_0x1fc97b),0x1;}}if(_0x2dd15c[_0x350c61(0x1a3)]>0x1&&_0x4c3d2e&&_0x111e73[_0x350c61(0x1a3)]>0x0){const _0x3963ab=_0x111e73[_0x350c61(0x18b)]('\x0a');writeFileSync(_0x3aa9ab[_0x350c61(0x183)],_0x3963ab),console[_0x350c61(0x1a4)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x3aa9ab['output']);}return 0x0;}catch(_0x4ebe05){throw _0x4ebe05;}}[a32_0x5dea78(0x1a1)](_0x1e9242){const _0x503475=a32_0x5dea78,_0x321f82=_0x1e9242[_0x503475(0x185)][0x0],_0x25817b=_0x1e9242[_0x503475(0x181)][_0x503475(0x192)];if(!_0x321f82&&!_0x25817b)return _0x503475(0x19f);if(_0x321f82&&_0x25817b)return _0x503475(0x198);return undefined;}}