@treasuredata/tdx 2026.3.3 → 2026.3.4

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_0x4f72eb=a29_0x2465;(function(_0x3ea55b,_0x44639e){const _0x482863=a29_0x2465,_0x316b09=_0x3ea55b();while(!![]){try{const _0x4656c8=parseInt(_0x482863(0xfb))/0x1+parseInt(_0x482863(0xec))/0x2+-parseInt(_0x482863(0x14c))/0x3+parseInt(_0x482863(0x1e2))/0x4+-parseInt(_0x482863(0x1d7))/0x5+-parseInt(_0x482863(0x192))/0x6*(parseInt(_0x482863(0xdd))/0x7)+-parseInt(_0x482863(0x12a))/0x8;if(_0x4656c8===_0x44639e)break;else _0x316b09['push'](_0x316b09['shift']());}catch(_0x2ad854){_0x316b09['push'](_0x316b09['shift']());}}}(a29_0x53df,0x5da53));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x4a3195 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_0x348113 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_0x4f72eb(0xdb),LEGACY_PARENT_SEGMENT_DIR=a29_0x4f72eb(0x200);function openBrowser(_0x567438){const _0xabd27=a29_0x4f72eb,_0x5be12c=process[_0xabd27(0x181)],_0x42ece7=_0x5be12c==='darwin'?_0xabd27(0x139):_0x5be12c==='win32'?'start':'xdg-open';spawn(_0x42ece7,[_0x567438],{'detached':!![],'stdio':_0xabd27(0x202)})[_0xabd27(0x8d)]();}function migrateLegacyDirectory(){const _0x140d6e=a29_0x4f72eb;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x179511=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x179511['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x348113[_0x140d6e(0xb2)](_0x140d6e(0x179)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x140d6e(0x19b))),console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0xb0)](_0x140d6e(0xe1)+LEGACY_PARENT_SEGMENT_DIR+_0x140d6e(0x111))),![];console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0xb2)](_0x140d6e(0xcd)+LEGACY_PARENT_SEGMENT_DIR+_0x140d6e(0x106)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0x16f)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x5eef83){const _0x22a06a=_0x5eef83 instanceof Error?_0x5eef83[_0x140d6e(0xc8)]:String(_0x5eef83);return console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0x1d6)](_0x140d6e(0x152)+_0x22a06a+'\x0a')),![];}}function a29_0x53df(){const _0x17b1de=['Listing\x20parent\x20segments...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','SQL\x20query:\x0a','toLocaleString','\x0aUsage:\x20tdx\x20ps\x20preview\x20','true','\x20\x201.\x20Edit\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','/\x20→\x20','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x20--enriched','filter','log','\x20\x20\x20\x20\x20\x20','Updated','Validating\x20RT\x20configuration...','realtime:','\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','execute','/\x20directory.\x0a','/{name}.yml\x0a','\x20configured','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','resolveParentId','Listing\x20RT-enabled\x20parent\x20segments...','replace','No\x20personalization\x20services\x20configured','trim','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','.yaml','personalization_services','<database>.<table>','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','displayValidateResults','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','displayRealtimeInfo','\x20parent\x20segment','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','using\x20the\x20default\x20path:\x20','Default','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','2019176CIgOKh','label','table','Site:\x20','Available\x20behaviors:','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','site','displayAttributesStats','varchar','\x20is\x20already\x20up\x20to\x20date','trigger_event','jsonl','getParentSQL','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','open','text','displaySummary','/attempt/','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','customers','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','previewParentYaml','\x0aNo\x20sample\x20data\x20available','segment:parent:create','single','stop','getOutputDatabaseName','runParent','Fetching\x20parent\x20segment\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','addAttributes','segment:parent:view','stats','277548HFQcnK','-1d','\x20--attribute\x20\x22<name>\x22','/app/workflows/','last_page_viewed','sampleData','✘\x20Failed\x20to\x20rename\x20directory:\x20','personalization','\x27\x20and\x20run\x20workflow?','Listing\x20fields\x20for\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','dirname','repeat','bold','\x0a\x20\x20\x20\x20]','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Found\x20YAML\x20file:\x20','verbose','List\x20available\x20fields\x20for\x20segmentation','\x20\x20\x20\x20-\x20','\x20[Job\x20ID:\x20','customerGroupFile','customerPercent','pushParentYaml','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','listParents','segment','Fetching\x20behavior\x20list...','getBehaviorNames','foreignKey','\x20behaviors','\x20Opening\x20','SELECT\x20*\x20FROM\x20','events','createParent','green','Show\x20parent\x20segment\x20details','segment:parent:list','Behavior:','scheduleOption','type','\x20kill','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','page_view','ps:pz:init','\x0a⚠️\x20\x20Both\x20','displayPreviewHints','Error:','idStitching','user_id','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','.yml','To\x20cancel:','platform','ps:pz:list','No\x20RT-enabled\x20parent\x20segments\x20found','\x20to\x20push\x20the\x20configuration','\x20service','\x20parent\x20segment\x20\x27','\x20\x20Database:\x20','column_name','\x27\x20is\x20already\x20up\x20to\x20date','session','Behaviors','attributesFile','✔\x20Created\x20parent\x20segment\x20\x27','schemaValid','sections','\x20\x20Note:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','120YLTvta','map','Get\x20SQL\x20query\x20for\x20parent\x20segment','/app/dw/parentSegments/','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','json','/\x20directories\x20exist.','⚡\x20Enabled','Validating\x20configuration...','displayMasterInfo','\x0a✔\x20Workflow\x20started','RT\x202.0:','\x20tdx\x20wf\x20attempt\x20','totalEvents','errors','joinKey','Executing\x20parent\x20segment\x20query...','Updating\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','output','Fetching\x20current\x20configuration\x20for\x20\x27','Personalization\x20service\x20description','\x20service(s)\x20configured','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','RT\x202.0\x20Validate:','td_client_id','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20rows)','Options\x20(one\x20required):\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','status','\x20--behavior\x20\x22','parent_id','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displaySampleData','realtime','Customers:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','setJobId','addAttributesFile','test','Master\x20Table','schemaError','segment:parent:desc','Options:\x0a','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','listFields','Error:\x20--behavior\x20requires\x20a\x20name\x0a','master','\x20=\x20','parentSegment','Schema\x20saved\x20to\x20','segment:parent:validate','format','\x20\x20Columns:\x20','enriched','join','jobId','list','toFixed','displayColumns','workflowAttemptId','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Create\x20parent\x20segment\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','red','1792785CUvHXG','toLowerCase','attribute','personalizationServices','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','utf-8','formatSchemaJson','Table:\x20','\x0aChanges\x20to\x20\x27','Available\x20attributes:','endsWith','2278604ipcHXn','behavior','yes','audienceId','indexOf','Attempt:','\x20\x20\x20','Database:\x20','Created','YAML\x20file:\x20','Fetching\x20SQL\x20for\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','length','Source:','Analyzing\x20changes...','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','No\x20parent\x20segments\x20match\x20pattern:\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','web','ps:rt:validate','string','\x0aError:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Added\x20personalization\x20template\x20to\x20','\x20RT-enabled\x20parent\x20segment','scheduleType','sourceTableValid','Apply\x20changes\x20to\x20\x27','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','parent_segment','workflowSessionId','ignore','ID\x20Stitching:','push','No\x20parent\x20segments\x20found','validateParentYaml','Session:','timezone','Updating','\x20\x20\x20\x20','valid','attributes','population','column','Error\x20reading\x20file:\x20','unref','stitchingKeys','columns','customersWithEvents','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20--attribute\x20\x22','information_schema','✔\x20No\x20changes\x20-\x20\x27','preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Events:','sort','processedRows','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','limit','cyan','Name:\x20','elapsedTimeMillis','Resolving\x20parent\x20segment\x20\x27','behaviorsFile','\x27...','Pattern:\x20','reduce','\x20--behavior\x20\x22<name>\x22','displayBehaviorsStats','\x0a\x20\x20\x20\x20}','Parent\x20segment:\x20','name','rowCount','\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','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','displayPreviewResults','collectSchema','ps:rt:list','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','dim','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','yellow','interval','realtime_enabled','allValid','\x20\x20Tables:\x201\x20customers\x20+\x20','in\x20','workflowId','tdx\x20ps\x20preview\x20','\x20to\x20configure\x20your\x20personalization\x20service','behavior_','{\x0a\x20\x20\x22database\x22:\x20\x22','localeCompare','match','data','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Errors:','tdx\x20ps\x20push\x20','Attributes:','run','\x20\x202.\x20Run\x20','column_type','apply','message','\x20No\x20changes\x20-\x20','addBehaviorsFile','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20+\x20[','\x0a⚠️\x20\x20Migrating:\x20','\x20Context\x20set:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','database','all','coveragePercent','start','\x22,\x20\x22type\x22:\x20\x22','Join\x20on:','👥\x20','✔\x20Found\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','⚡\x20Not\x20enabled','segment:parent:push','parent_segments','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','15841yGnIBq','Fetching\x20customers\x20schema...','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x5c$&','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','use','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','behaviors','\x0a\x20\x20]\x0a}\x0a','.customers)','customerGroup','Listing\x20parent\x20segments\x20matching\x20\x27','\x20--interval\x20','531980geDuhb','sourceTableError','List\x20parent\x20segments','Coverage:','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','Creating','Status:','keys','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','error','segment:parent:preview','Options:','Personalization:','Error\x20parsing\x20YAML:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','296660MGKrSE','Output\x20Database:','getParentFull'];a29_0x53df=function(){return _0x17b1de;};return a29_0x53df();}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x4f72eb(0xc4)](_0x111b58){const _0x506941=a29_0x4f72eb;return migrateLegacyDirectory(),super[_0x506941(0xc4)](_0x111b58);}}function resolveYamlFile(_0x29ebeb){const _0x56303b=a29_0x4f72eb;if(_0x29ebeb[_0x56303b(0x1e1)](_0x56303b(0x17f))||_0x29ebeb[_0x56303b(0x1e1)](_0x56303b(0x11c)))return _0x29ebeb;return a29_0x4a3195['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x29ebeb)+'.yml');}function formatProgressMessage(_0x36e75f){const _0x3672aa=a29_0x4f72eb,_0xf482ad=_0x36e75f[_0x3672aa(0xbe)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xf482ad){const [,_0x23b527,_0x4f7288,_0x2f8f0e='']=_0xf482ad;return a29_0x348113[_0x3672aa(0xb0)](_0x23b527+':')+'\x20'+_0x4f7288+a29_0x348113[_0x3672aa(0xb0)](_0x2f8f0e);}return a29_0x348113[_0x3672aa(0xb0)](_0x36e75f);}function showFileNotFoundError(_0x3106e9,_0x1cb0be){const _0x6384c=a29_0x4f72eb;console[_0x6384c(0xf5)](a29_0x348113[_0x6384c(0x1d6)]('Error:\x20File\x20not\x20found:\x20'+_0x3106e9+'\x0a')),console['error'](a29_0x348113[_0x6384c(0x9c)](_0x6384c(0xe3)+_0x1cb0be+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x3f3d29){const _0x32e96f=a29_0x4f72eb;if(!_0x3f3d29[_0x32e96f(0x1b8)])return;const _0x4389cd=_0x3f3d29[_0x32e96f(0x1b8)],_0x2ea111=_0x4389cd['enabled']?a29_0x348113[_0x32e96f(0x16f)](_0x32e96f(0x19c)):a29_0x348113[_0x32e96f(0xb2)](_0x32e96f(0xd9));console[_0x32e96f(0xf5)]('\x0a'+a29_0x348113['dim'](_0x32e96f(0x1a0))+'\x20'+_0x2ea111);if(_0x4389cd[_0x32e96f(0x16d)]&&_0x4389cd[_0x32e96f(0x16d)][_0x32e96f(0x1ee)]>0x0){console[_0x32e96f(0xf5)]('\x20\x20'+a29_0x348113['dim'](_0x32e96f(0x97))+'\x20'+_0x4389cd[_0x32e96f(0x16d)]['length']+'\x20configured');for(const _0x4bbc65 of _0x4389cd['events']){const _0x22ba07=_0x4bbc65[_0x32e96f(0x1fd)]===![]?a29_0x348113[_0x32e96f(0x1d6)]('✘'):a29_0x348113[_0x32e96f(0x16f)]('✔');console[_0x32e96f(0xf5)](_0x32e96f(0x20a)+_0x22ba07+'\x20'+_0x4bbc65[_0x32e96f(0xa8)]),_0x4bbc65[_0x32e96f(0xed)]&&console[_0x32e96f(0xf5)](_0x32e96f(0x10b)+a29_0x348113[_0x32e96f(0x1d6)](_0x4bbc65[_0x32e96f(0xed)]));}}if(_0x4389cd['attributes']&&_0x4389cd['attributes']['length']>0x0){console['error']('\x20\x20'+a29_0x348113['dim'](_0x32e96f(0xc3))+'\x20'+_0x4389cd['attributes'][_0x32e96f(0x1ee)]+_0x32e96f(0x113));for(const _0x4afef8 of _0x4389cd[_0x32e96f(0x89)]){const _0x3ae42e=_0x4afef8[_0x32e96f(0x88)]?a29_0x348113[_0x32e96f(0x16f)]('✔'):a29_0x348113[_0x32e96f(0x1d6)]('✘');console[_0x32e96f(0xf5)](_0x32e96f(0x20a)+_0x3ae42e+'\x20'+_0x4afef8[_0x32e96f(0xa8)]+'\x20'+a29_0x348113['dim']('('+_0x4afef8[_0x32e96f(0x174)]+')'));}}if(_0x4389cd[_0x32e96f(0x17c)]){const _0x33cbf6=_0x4389cd[_0x32e96f(0x17c)][_0x32e96f(0x8e)]?.[_0x32e96f(0x1ee)]?_0x32e96f(0xcc)+_0x4389cd['idStitching'][_0x32e96f(0x8e)][_0x32e96f(0x1cd)](',\x20')+']':'';console['error']('\x20\x20'+a29_0x348113[_0x32e96f(0xb0)](_0x32e96f(0x203))+'\x20'+_0x4389cd['idStitching']['primaryKey']+_0x33cbf6);}if(_0x4389cd[_0x32e96f(0x1da)]&&_0x4389cd[_0x32e96f(0x1da)]['length']>0x0){console[_0x32e96f(0xf5)]('\x20\x20'+a29_0x348113['dim'](_0x32e96f(0xf8))+'\x20'+_0x4389cd[_0x32e96f(0x1da)][_0x32e96f(0x1ee)]+_0x32e96f(0x185)+(_0x4389cd[_0x32e96f(0x1da)][_0x32e96f(0x1ee)]!==0x1?'s':''));for(const _0x190183 of _0x4389cd['personalizationServices']){console[_0x32e96f(0xf5)]('\x20\x20\x20\x20-\x20'+_0x190183[_0x32e96f(0xa8)]);}}}function showParentSegmentNotSetError(_0x50650d){const _0x245ae8=a29_0x4f72eb;console[_0x245ae8(0xf5)](a29_0x348113[_0x245ae8(0xb2)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x245ae8(0xf5)](_0x50650d);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x171);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0xee);async[a29_0x4f72eb(0x110)](_0x36bdd6){const _0x3f504d=a29_0x4f72eb,{options:_0x35f5d1,args:_0x3d31,tdx:_0x16e6ac}=_0x36bdd6,_0x3038bd=_0x3d31[0x0];_0x35f5d1[_0x3f504d(0x15d)]&&(console[_0x3f504d(0xf5)](_0x3f504d(0x12d)+_0x35f5d1[_0x3f504d(0x130)]),_0x3038bd&&console['error'](_0x3f504d(0xa2)+_0x3038bd));const _0x184151=await withSpinner(_0x3038bd?_0x3f504d(0xea)+_0x3038bd+_0x3f504d(0xa1):_0x3f504d(0xfe),()=>_0x16e6ac[_0x3f504d(0x166)][_0x3f504d(0x165)](),{'verbose':_0x35f5d1[_0x3f504d(0x15d)]});let _0x356a0c=_0x184151[_0x3f504d(0xbf)];if(_0x3038bd){const _0x592cfc=_0x3038bd[_0x3f504d(0x117)](/[.+^${}()|[\]\\]/g,_0x3f504d(0xe0))[_0x3f504d(0x117)](/\*/g,'.*')[_0x3f504d(0x117)](/\?/g,'.'),_0x2eded5=new RegExp('^'+_0x592cfc+'$','i');_0x356a0c=_0x356a0c[_0x3f504d(0x109)](_0x5b844b=>_0x2eded5['test'](_0x5b844b[_0x3f504d(0x89)]['name']));}_0x356a0c[_0x3f504d(0x98)]((_0x51bbca,_0x1a2323)=>_0x51bbca['attributes'][_0x3f504d(0xa8)][_0x3f504d(0xbd)](_0x1a2323['attributes'][_0x3f504d(0xa8)])),console[_0x3f504d(0xf5)](_0x3f504d(0xd7)+_0x356a0c[_0x3f504d(0x1ee)]+_0x3f504d(0x125)+(_0x356a0c[_0x3f504d(0x1ee)]!==0x1?'s':''));const _0x5a26f4=_0x5f16ae=>{const _0x122412=_0x3f504d;return getConsoleNextUrl(_0x35f5d1[_0x122412(0x130)],_0x122412(0x195)+_0x5f16ae);};if(_0x35f5d1[_0x3f504d(0x1ca)]===_0x3f504d(0x19a)||_0x35f5d1[_0x3f504d(0x1ca)]==='jsonl'){const _0x352d7b=_0x356a0c['map'](_0x1b7141=>({..._0x1b7141,'url':_0x5a26f4(_0x1b7141['id'])}));await handleSDKOutput(_0x352d7b,_0x35f5d1);}else{if(_0x356a0c['length']===0x0)_0x3038bd?console[_0x3f504d(0x10a)](_0x3f504d(0x1f3)+_0x3038bd):console[_0x3f504d(0x10a)](_0x3f504d(0x205));else for(const _0x2c6d23 of _0x356a0c){const _0x53c8ec=_0x2c6d23[_0x3f504d(0x89)]['population']?a29_0x348113[_0x3f504d(0xb0)]('\x20('+formatRows(_0x2c6d23[_0x3f504d(0x89)]['population'])+')'):'',_0x53246a=hyperlink(_0x2c6d23[_0x3f504d(0x89)][_0x3f504d(0xa8)],_0x5a26f4(_0x2c6d23['id']));console[_0x3f504d(0x10a)](_0x3f504d(0xd6)+_0x53246a+_0x53c8ec);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x142);['description']=a29_0x4f72eb(0x1af);async[a29_0x4f72eb(0x110)](_0x4d47aa){const _0x3f6e61=a29_0x4f72eb,{options:_0x1cf11c,args:_0xa82768,tdx:_0x224b04}=_0x4d47aa;console['error'](_0x3f6e61(0x191)+_0x3f6e61(0xdf)+_0x3f6e61(0xb1));const _0x1d2ce0=_0x1cf11c;if(_0xa82768[_0x3f6e61(0x1ee)]===0x0)return console['error'](a29_0x348113['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x3f6e61(0x9a)),0x1;const _0x4d8935=_0xa82768[0x0];if(!_0x1d2ce0[_0x3f6e61(0xd0)]||!_0x1d2ce0['table'])return console[_0x3f6e61(0xf5)](_0x3f6e61(0xe5)),console[_0x3f6e61(0xf5)](_0x3f6e61(0x9a)),0x1;_0x1d2ce0[_0x3f6e61(0x15d)]&&(console[_0x3f6e61(0xf5)](_0x3f6e61(0x12d)+_0x1d2ce0[_0x3f6e61(0x130)]),console[_0x3f6e61(0xf5)](_0x3f6e61(0x9d)+_0x4d8935),console[_0x3f6e61(0xf5)](_0x3f6e61(0x1e9)+_0x1d2ce0['database']),console[_0x3f6e61(0xf5)](_0x3f6e61(0x1de)+_0x1d2ce0[_0x3f6e61(0x12c)]));const _0x3a229a=await loadJSONFromOptions(_0x1d2ce0[_0x3f6e61(0x89)],_0x1d2ce0[_0x3f6e61(0x18c)]),_0x34f5c2=await loadJSONFromOptions(_0x1d2ce0[_0x3f6e61(0xe6)],_0x1d2ce0[_0x3f6e61(0xa0)]),_0x77a472=await loadJSONFromOptions(_0x1d2ce0[_0x3f6e61(0xe9)],_0x1d2ce0[_0x3f6e61(0x161)]),_0x43583d={'name':_0x4d8935,'description':_0x1d2ce0['description'],'scheduleType':_0x1d2ce0[_0x3f6e61(0x1fc)],'scheduleOption':_0x1d2ce0['scheduleOption'],'timezone':_0x1d2ce0[_0x3f6e61(0x208)],'master':{'parentDatabaseName':_0x1d2ce0['database'],'parentTableName':_0x1d2ce0[_0x3f6e61(0x12c)]},'attributes':_0x3a229a,'behaviors':_0x34f5c2,'customerGroup':_0x77a472},_0x5ef407=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x4d8935+_0x3f6e61(0xa1),()=>_0x224b04[_0x3f6e61(0x166)][_0x3f6e61(0x16e)](_0x43583d),{'verbose':_0x1cf11c['verbose']}),_0x3dafaa=_0x5ef407['data'];return console['error'](_0x3f6e61(0x18d)+_0x3dafaa[_0x3f6e61(0xa8)]+'\x27\x20with\x20ID:\x20'+_0x3dafaa['id']),await handleSDKOutput([_0x3dafaa],_0x1cf11c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:update';[a29_0x4f72eb(0x196)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x1db881){const _0xec3c74=a29_0x4f72eb,{options:_0x45389f,args:_0x3ffe3a,tdx:_0x2524ef}=_0x1db881;console['error'](_0xec3c74(0x198)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0xec3c74(0xb1));const _0x585753=_0x45389f;if(_0x3ffe3a[_0xec3c74(0x1ee)]===0x0)return console['error'](a29_0x348113[_0xec3c74(0x1d6)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0xec3c74(0xf5)](_0xec3c74(0x1f1)),0x1;const _0xf8c7eb=_0x3ffe3a[0x0];_0x585753[_0xec3c74(0x15d)]&&(console[_0xec3c74(0xf5)](_0xec3c74(0x12d)+_0x585753['site']),console['error'](_0xec3c74(0xa7)+_0xf8c7eb));const _0x4d4f20=await withSpinner(_0xec3c74(0x1a9)+_0xf8c7eb+'\x27...',()=>_0x2524ef['segment'][_0xec3c74(0xfd)](_0xf8c7eb),{'verbose':_0x585753[_0xec3c74(0x15d)]}),_0x173eb9=_0x4d4f20['data'],_0x566fb6=await loadJSONFromOptions(_0x585753[_0xec3c74(0x149)],_0x585753[_0xec3c74(0x1bc)]),_0x31afaa=await loadJSONFromOptions(_0x585753['addBehaviors'],_0x585753[_0xec3c74(0xca)]),_0xab3e5a={'name':_0x173eb9[_0xec3c74(0xa8)],'description':_0x585753[_0xec3c74(0x196)]!==undefined?_0x585753['description']:_0x173eb9[_0xec3c74(0x196)],'scheduleType':_0x585753['scheduleType']!==undefined?_0x585753['scheduleType']:_0x173eb9[_0xec3c74(0x1fc)],'scheduleOption':_0x585753[_0xec3c74(0x173)]!==undefined?_0x585753['scheduleOption']:_0x173eb9['scheduleOption'],'timezone':_0x585753[_0xec3c74(0x208)]!==undefined?_0x585753[_0xec3c74(0x208)]:_0x173eb9[_0xec3c74(0x208)],'master':_0x173eb9[_0xec3c74(0x1c5)],'attributes':_0x566fb6?[..._0x173eb9[_0xec3c74(0x89)]||[],..._0x566fb6]:_0x173eb9[_0xec3c74(0x89)],'behaviors':_0x31afaa?[..._0x173eb9['behaviors']||[],..._0x31afaa]:_0x173eb9['behaviors'],'customerGroup':_0x173eb9[_0xec3c74(0xe9)]},_0x4a7323=await withSpinner(_0xec3c74(0x1a6)+_0xf8c7eb+_0xec3c74(0xa1),()=>_0x2524ef[_0xec3c74(0x166)]['updateParent'](_0xf8c7eb,_0xab3e5a),{'verbose':_0x585753[_0xec3c74(0x15d)]}),_0x3e1548=_0x4a7323[_0xec3c74(0xbf)];return console[_0xec3c74(0xf5)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x3e1548[_0xec3c74(0xa8)]+'\x27'),await handleSDKOutput([_0x3e1548],_0x585753),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x4f1928){const _0x1d6c53=a29_0x4f72eb,{options:_0x421020,args:_0x5c398d,tdx:_0x396ddc}=_0x4f1928,_0x4165e4=_0x421020,_0x3826cf=_0x5c398d[0x0]||_0x421020['parentSegment'];if(!_0x3826cf)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x1d6c53(0x120)),0x1;if(_0x4165e4[_0x1d6c53(0xe2)]&&_0x4165e4[_0x1d6c53(0x1a8)])return console['error'](a29_0x348113[_0x1d6c53(0x1d6)](_0x1d6c53(0x148))),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0xb0)](_0x1d6c53(0x1b2))),console['error'](a29_0x348113[_0x1d6c53(0xb0)](_0x1d6c53(0x127)+PARENT_SEGMENT_DIR+_0x1d6c53(0x112))),console[_0x1d6c53(0xf5)](a29_0x348113['cyan'](_0x1d6c53(0xaf))),0x1;const _0x12ecbf=_0x4165e4[_0x1d6c53(0x1a8)]||a29_0x4a3195[_0x1d6c53(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3826cf)+'.yml');_0x4165e4[_0x1d6c53(0x15d)]&&(console[_0x1d6c53(0xf5)]('Site:\x20'+_0x4165e4[_0x1d6c53(0x130)]),console[_0x1d6c53(0xf5)]('Parent\x20segment:\x20'+_0x3826cf),console[_0x1d6c53(0xf5)]('Output\x20file:\x20'+_0x12ecbf));const _0x5549e9=await withSpinner(_0x1d6c53(0x147)+_0x3826cf+_0x1d6c53(0xa1),()=>_0x396ddc[_0x1d6c53(0x166)]['pullParentYaml'](_0x3826cf),{'verbose':_0x4165e4[_0x1d6c53(0x15d)]}),_0x54757a=_0x5549e9['data'];if(existsSync(_0x12ecbf)){const _0x50f5c4=readFileSync(_0x12ecbf,_0x1d6c53(0x1dc)),_0x50e836=generateDiff(_0x50f5c4,_0x54757a);if(!hasChanges(_0x50e836))console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x16f)]('✔')+_0x1d6c53(0xc9)+a29_0x348113[_0x1d6c53(0x9c)](_0x12ecbf)+_0x1d6c53(0x133));else{console[_0x1d6c53(0xf5)](_0x1d6c53(0x1df)+_0x12ecbf+'\x27:'),console[_0x1d6c53(0xf5)]('─'[_0x1d6c53(0x158)](0x3c)),console['error'](formatDiffWithColors(_0x50e836)),console[_0x1d6c53(0xf5)]('─'[_0x1d6c53(0x158)](0x3c));if(!_0x4165e4['yes']){if(!isInteractive())return console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x1d6)](_0x1d6c53(0x1f8)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0xb0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2b4297=await confirmKey('Overwrite\x20\x27'+_0x12ecbf+'\x27?');if(!_0x2b4297)return console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0xb2)]('Aborted.')),0x1;}writeFileSync(_0x12ecbf,_0x54757a,_0x1d6c53(0x1dc)),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x16f)]('✔')+_0x1d6c53(0x122)+a29_0x348113[_0x1d6c53(0x9c)](_0x12ecbf));}}else{const _0x528631=a29_0x4a3195[_0x1d6c53(0x157)](_0x12ecbf);!existsSync(_0x528631)&&mkdirSync(_0x528631,{'recursive':!![]}),writeFileSync(_0x12ecbf,_0x54757a,_0x1d6c53(0x1dc)),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x16f)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a29_0x348113['cyan'](_0x12ecbf));}return saveSessionContext({'parent_segment':_0x3826cf},_0x4165e4[_0x1d6c53(0x18a)]),console[_0x1d6c53(0xf5)](a29_0x348113['green']('✔')+_0x1d6c53(0xce)+a29_0x348113[_0x1d6c53(0xb0)]('parent_segment')+'\x20=\x20'+a29_0x348113[_0x1d6c53(0x9c)](_0x3826cf)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0xda);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0xd8);async[a29_0x4f72eb(0x110)](_0x454711){const _0x2c1102=a29_0x4f72eb,{options:_0x18ad82,args:_0x2a67c0,tdx:_0x2feef6}=_0x454711,_0x3fd1fc=_0x18ad82,_0x1be776=_0x2a67c0[0x0]||_0x18ad82[_0x2c1102(0x1c7)];if(!_0x1be776)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2c1102(0x96)),0x1;const _0x356746=resolveYamlFile(_0x1be776);if(!existsSync(_0x356746))return showFileNotFoundError(_0x356746,_0x1be776),0x1;_0x3fd1fc[_0x2c1102(0x15d)]&&(console['error']('Site:\x20'+_0x3fd1fc[_0x2c1102(0x130)]),console[_0x2c1102(0xf5)]('YAML\x20file:\x20'+_0x356746));let _0x79ca46;try{_0x79ca46=readFileSync(_0x356746,'utf-8');}catch(_0x52f16f){const _0x13cdc3=_0x52f16f instanceof Error?_0x52f16f['message']:String(_0x52f16f);return console[_0x2c1102(0xf5)](_0x2c1102(0x8c)+_0x13cdc3),0x1;}const _0x3d333f=await withSpinner(_0x2c1102(0x1f0),()=>_0x2feef6[_0x2c1102(0x166)][_0x2c1102(0x163)](_0x79ca46),{'verbose':_0x3fd1fc[_0x2c1102(0x15d)]}),_0x58f45c=_0x3d333f[_0x2c1102(0xbf)],{isNew:_0x41b898,name:_0xa9bb6c,hasChanges:_0x1dc2c8,diffFormatted:_0x498b70}=_0x58f45c;if(!_0x1dc2c8)return console[_0x2c1102(0xf5)](_0x2c1102(0x94)+_0xa9bb6c+_0x2c1102(0x189)),0x0;_0x41b898?console[_0x2c1102(0xf5)](_0x2c1102(0x1d5)+_0xa9bb6c+'\x27:'):console[_0x2c1102(0xf5)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0xa9bb6c+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x498b70),console[_0x2c1102(0xf5)]('─'[_0x2c1102(0x158)](0x3c));const _0x366ec1=_0x41b898?_0x2c1102(0x1d4)+_0xa9bb6c+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xa9bb6c+'\x27?';if(!_0x3fd1fc[_0x2c1102(0x1e4)]){if(!isInteractive())return console[_0x2c1102(0xf5)](a29_0x348113[_0x2c1102(0x1d6)](_0x2c1102(0x1f8)),_0x2c1102(0x13f)),console[_0x2c1102(0xf5)](a29_0x348113[_0x2c1102(0xb0)](_0x2c1102(0x15b))),0x1;const _0x510989=await confirmKey(_0x366ec1);if(!_0x510989)return console['error'](a29_0x348113[_0x2c1102(0xb2)]('Aborted.')),0x1;}const _0x26b54e=_0x41b898?_0x2c1102(0xf1):_0x2c1102(0x209),_0x3bde5a=await withSpinner(_0x26b54e+'\x20parent\x20segment\x20\x27'+_0xa9bb6c+_0x2c1102(0xa1),()=>_0x58f45c[_0x2c1102(0xc7)](),{'verbose':_0x3fd1fc[_0x2c1102(0x15d)]}),_0x58c77c=_0x3bde5a[_0x2c1102(0xbf)],_0x3cf0c0=getConsoleNextUrl(_0x3fd1fc['site'],_0x2c1102(0x195)+_0x58c77c['id']),_0x19d5b0=_0x41b898?'Created':_0x2c1102(0x10c);return console[_0x2c1102(0xf5)]('✔\x20'+_0x19d5b0+_0x2c1102(0x186)+_0x58c77c[_0x2c1102(0xa8)]+'\x27'),console[_0x2c1102(0xf5)]('\x20\x20'+_0x3cf0c0),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x1c9);[a29_0x4f72eb(0x196)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a29_0x4f72eb(0x110)](_0x451aa6){const _0x1f656e=a29_0x4f72eb,{options:_0xc97cf,args:_0x1d3065,tdx:_0x3fab29}=_0x451aa6,_0x4e9963=_0xc97cf,_0x1f4500=_0x1d3065[0x0]||_0xc97cf[_0x1f656e(0x1c7)];if(!_0x1f4500)return showParentSegmentNotSetError(_0x1f656e(0x164)+_0x1f656e(0x138)+_0x1f656e(0x1c1)+_0x1f656e(0xe4)+_0x1f656e(0x1d3)+_0x1f656e(0x1f2)),0x1;const _0x527f2d=resolveYamlFile(_0x1f4500);if(!existsSync(_0x527f2d))return showFileNotFoundError(_0x527f2d,_0x1f4500),0x1;_0x4e9963[_0x1f656e(0x15d)]&&(console[_0x1f656e(0xf5)](_0x1f656e(0x12d)+_0x4e9963[_0x1f656e(0x130)]),console[_0x1f656e(0xf5)](_0x1f656e(0x1eb)+_0x527f2d));let _0x46cb90;try{_0x46cb90=readFileSync(_0x527f2d,_0x1f656e(0x1dc));}catch(_0x47759e){const _0x18eec7=_0x47759e instanceof Error?_0x47759e['message']:String(_0x47759e);return console[_0x1f656e(0xf5)](_0x1f656e(0x8c)+_0x18eec7),0x1;}const _0x330786=createCommandSpinner(a29_0x348113['dim'](_0x1f656e(0x19d)),{'verbose':_0x4e9963['verbose']});_0x330786['start']();const _0x402606={'onProgress':_0x1a21ba=>{const _0x44fdcf=_0x1f656e;_0x330786[_0x44fdcf(0x13a)]=formatProgressMessage(_0x1a21ba);}};if(_0x4e9963[_0x1f656e(0x1c5)])_0x402606[_0x1f656e(0x1c5)]=!![];if(_0x4e9963[_0x1f656e(0x1cc)])_0x402606['enriched']=!![];_0x4e9963[_0x1f656e(0x1d9)]&&(_0x402606[_0x1f656e(0x1d9)]=_0x4e9963[_0x1f656e(0x1d9)]);_0x4e9963[_0x1f656e(0x1e3)]&&(_0x402606[_0x1f656e(0x1e3)]=_0x4e9963[_0x1f656e(0x1e3)]);if(_0x4e9963[_0x1f656e(0xb3)])_0x402606[_0x1f656e(0xb3)]=_0x4e9963[_0x1f656e(0xb3)];let _0x1a8175;try{_0x1a8175=await _0x3fab29['segment'][_0x1f656e(0x206)](_0x46cb90,_0x402606),_0x330786[_0x1f656e(0x144)]();}catch(_0x154fbd){_0x330786[_0x1f656e(0x144)]();throw _0x154fbd;}const _0x533bb6=_0x4e9963[_0x1f656e(0xb3)]||_0x1f656e(0x14d);return this[_0x1f656e(0x121)](_0x1a8175,_0x402606,_0x527f2d,_0x533bb6),_0x1a8175[_0x1f656e(0xb5)]?0x0:0x1;}['displayValidateResults'](_0x585cfb,_0x3b2dd7,_0x388c5e,_0x263c11){const _0x1e93d3=a29_0x4f72eb;console['error']('\x0a'+a29_0x348113['bold']('Validate:')+'\x20'+_0x585cfb['name']),console[_0x1e93d3(0xf5)]('═'[_0x1e93d3(0x158)](0x3c)),this[_0x1e93d3(0x19e)](_0x585cfb);if(typeof _0x3b2dd7[_0x1e93d3(0x1d9)]===_0x1e93d3(0x1f7)){this['displayAttributesStats'](_0x585cfb),this[_0x1e93d3(0x13b)](_0x585cfb),this[_0x1e93d3(0x17a)](_0x388c5e,_0x263c11,'attribute',_0x3b2dd7[_0x1e93d3(0x1d9)]);return;}if(_0x3b2dd7[_0x1e93d3(0x1d9)]===!![]){this[_0x1e93d3(0x131)](_0x585cfb),this[_0x1e93d3(0x13b)](_0x585cfb),this[_0x1e93d3(0x17a)](_0x388c5e,_0x263c11,_0x1e93d3(0x89));return;}if(typeof _0x3b2dd7[_0x1e93d3(0x1e3)]===_0x1e93d3(0x1f7)){this[_0x1e93d3(0xa5)](_0x585cfb,_0x263c11),this['displaySummary'](_0x585cfb),this['displayPreviewHints'](_0x388c5e,_0x263c11,_0x1e93d3(0x1e3),_0x3b2dd7[_0x1e93d3(0x1e3)]);return;}if(_0x3b2dd7['behavior']===!![]){this[_0x1e93d3(0xa5)](_0x585cfb,_0x263c11),this['displaySummary'](_0x585cfb),this[_0x1e93d3(0x17a)](_0x388c5e,_0x263c11,_0x1e93d3(0xe6));return;}this[_0x1e93d3(0x131)](_0x585cfb),this[_0x1e93d3(0xa5)](_0x585cfb,_0x263c11),this['displayRealtimeInfo'](_0x585cfb),this[_0x1e93d3(0x13b)](_0x585cfb),this['displayPreviewHints'](_0x388c5e,_0x263c11,_0x1e93d3(0xd1));}[a29_0x4f72eb(0x124)](_0x44f813){displayRealtimeValidation(_0x44f813);}[a29_0x4f72eb(0x17a)](_0x3e2c84,_0x3882db,_0x62cff,_0x4b9dd4){const _0x12b9b2=a29_0x4f72eb;console['error']('\x0a'+a29_0x348113[_0x12b9b2(0xb0)]('To\x20view\x20sample\x20data:'));const _0x234f6d=_0x3882db!==_0x12b9b2(0x14d)?_0x12b9b2(0xeb)+_0x3882db:'';if(_0x62cff==='attribute'&&_0x4b9dd4)console['error']('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)]('tdx\x20ps\x20preview\x20'+_0x3e2c84+_0x12b9b2(0x92)+_0x4b9dd4+'\x22'+_0x234f6d));else{if(_0x62cff===_0x12b9b2(0x1e3)&&_0x4b9dd4)console['error']('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)]('tdx\x20ps\x20preview\x20'+_0x3e2c84+'\x20--behavior\x20\x22'+_0x4b9dd4+'\x22'+_0x234f6d));else(_0x62cff===_0x12b9b2(0x89)||_0x62cff===_0x12b9b2(0xd1))&&console[_0x12b9b2(0xf5)]('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)](_0x12b9b2(0xb9)+_0x3e2c84+_0x12b9b2(0x14e)+_0x234f6d));}(_0x62cff===_0x12b9b2(0xe6)||_0x62cff==='all')&&console[_0x12b9b2(0xf5)]('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)](_0x12b9b2(0xb9)+_0x3e2c84+_0x12b9b2(0xa4)+_0x234f6d)),_0x62cff===_0x12b9b2(0xd1)&&console[_0x12b9b2(0xf5)]('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)](_0x12b9b2(0xb9)+_0x3e2c84+_0x12b9b2(0x108)+_0x234f6d));}[a29_0x4f72eb(0x19e)](_0x3ca7b5){const _0x11be96=a29_0x4f72eb,{master:_0x814f72}=_0x3ca7b5,_0x40cfce=_0x814f72['schemaValid']?a29_0x348113['green']('✔'):a29_0x348113[_0x11be96(0x1d6)]('✘');console['error']('\x0a'+a29_0x348113[_0x11be96(0xb0)](_0x11be96(0x1be))),console[_0x11be96(0xf5)](_0x40cfce+'\x20'+a29_0x348113['bold'](_0x814f72[_0x11be96(0xd0)]+'.'+_0x814f72[_0x11be96(0x12c)])),_0x814f72[_0x11be96(0x18e)]?_0x814f72['rowCount']!==undefined&&console[_0x11be96(0xf5)]('\x20\x20'+a29_0x348113[_0x11be96(0xb0)]('Rows:')+'\x20'+a29_0x348113[_0x11be96(0x9c)](formatRows(_0x814f72[_0x11be96(0xa9)]))):console['error']('\x20\x20'+a29_0x348113[_0x11be96(0x1d6)](_0x11be96(0x17b))+'\x20'+_0x814f72[_0x11be96(0x1bf)]);}[a29_0x4f72eb(0x131)](_0x26e98d){const _0xc96bf7=a29_0x4f72eb;if(_0x26e98d[_0xc96bf7(0x89)]['length']===0x0)return;console[_0xc96bf7(0xf5)]('\x0a'+a29_0x348113[_0xc96bf7(0xb0)]('Attributes'));for(const _0x42ad91 of _0x26e98d[_0xc96bf7(0x89)]){const _0x228d9f=_0x42ad91[_0xc96bf7(0x18e)]?a29_0x348113['green']('✔'):a29_0x348113['red']('✘');let _0x708d60='';if(_0x42ad91[_0xc96bf7(0x18e)]&&_0x42ad91['matchedCount']!==undefined&&_0x42ad91['coveragePercent']!==undefined){const _0x27ae40=_0x42ad91[_0xc96bf7(0xd2)][_0xc96bf7(0x1d0)](0x1),_0x3fc4e6=_0x42ad91[_0xc96bf7(0xd2)]>=0x50?a29_0x348113[_0xc96bf7(0x16f)]:_0x42ad91[_0xc96bf7(0xd2)]>=0x32?a29_0x348113[_0xc96bf7(0xb2)]:a29_0x348113[_0xc96bf7(0x1d6)];_0x708d60='\x20'+a29_0x348113[_0xc96bf7(0xb0)](_0xc96bf7(0xef))+'\x20'+_0x3fc4e6(_0x27ae40+'%')+'\x20('+formatRows(_0x42ad91['matchedCount'])+_0xc96bf7(0x1b0);}console[_0xc96bf7(0xf5)](_0x228d9f+'\x20'+a29_0x348113[_0xc96bf7(0x159)](_0x42ad91[_0xc96bf7(0xa8)])+_0x708d60),console[_0xc96bf7(0xf5)]('\x20\x20'+a29_0x348113[_0xc96bf7(0xb0)](_0xc96bf7(0x1ef))+'\x20'+a29_0x348113[_0xc96bf7(0x159)](_0x42ad91[_0xc96bf7(0xd0)]+'.'+_0x42ad91[_0xc96bf7(0x12c)]));const _0x38ca13=_0x42ad91[_0xc96bf7(0x1a4)]===_0x42ad91['foreignKey']?a29_0x348113[_0xc96bf7(0xb0)](_0xc96bf7(0xd5))+'\x20'+_0x42ad91[_0xc96bf7(0x1a4)]:a29_0x348113[_0xc96bf7(0xb0)]('Join:')+'\x20'+_0x42ad91[_0xc96bf7(0x1a4)]+_0xc96bf7(0x1c6)+_0x42ad91[_0xc96bf7(0x169)];console[_0xc96bf7(0xf5)]('\x20\x20'+_0x38ca13),console['error']('\x20\x20'+a29_0x348113[_0xc96bf7(0xb0)]('Columns:')),this[_0xc96bf7(0x1d1)](_0x42ad91[_0xc96bf7(0x8f)]),!_0x42ad91[_0xc96bf7(0x18e)]&&console['error']('\x20\x20'+a29_0x348113[_0xc96bf7(0x1d6)]('Error:')+'\x20'+_0x42ad91[_0xc96bf7(0x1bf)]);}}[a29_0x4f72eb(0xa5)](_0x2e4caf,_0x259aeb){const _0x3fb35b=a29_0x4f72eb;if(_0x2e4caf[_0x3fb35b(0xe6)][_0x3fb35b(0x1ee)]===0x0)return;console[_0x3fb35b(0xf5)]('\x0a'+a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0x18b))+'\x20'+a29_0x348113[_0x3fb35b(0xb0)]('('+_0x259aeb+')'));for(const _0x44e980 of _0x2e4caf[_0x3fb35b(0xe6)]){const _0x46bc18=_0x44e980[_0x3fb35b(0x18e)]?a29_0x348113[_0x3fb35b(0x16f)]('✔'):a29_0x348113[_0x3fb35b(0x1d6)]('✘');let _0x49bb15='';if(_0x44e980[_0x3fb35b(0x18e)]&&_0x44e980[_0x3fb35b(0x90)]!==undefined&&_0x44e980[_0x3fb35b(0x1a2)]!==undefined){const _0x237c26=_0x44e980[_0x3fb35b(0x162)]?.[_0x3fb35b(0x1d0)](0x1)||'?',_0x3e3054=(_0x44e980[_0x3fb35b(0x162)]??0x0)>=0x32?a29_0x348113['green']:(_0x44e980[_0x3fb35b(0x162)]??0x0)>=0x14?a29_0x348113[_0x3fb35b(0xb2)]:a29_0x348113[_0x3fb35b(0x1d6)];_0x49bb15='\x20'+a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0x1b9))+'\x20'+_0x3e3054(formatRows(_0x44e980['customersWithEvents']))+'\x20('+_0x237c26+'%)\x20'+a29_0x348113['dim']('Events:')+'\x20'+a29_0x348113[_0x3fb35b(0x9c)](formatRows(_0x44e980[_0x3fb35b(0x1a2)]));}console['error'](_0x46bc18+'\x20'+a29_0x348113['bold'](_0x44e980[_0x3fb35b(0xa8)])+_0x49bb15),console[_0x3fb35b(0xf5)]('\x20\x20'+a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0x1ef))+'\x20'+a29_0x348113['bold'](_0x44e980[_0x3fb35b(0xd0)]+'.'+_0x44e980[_0x3fb35b(0x12c)]));const _0x115aed=_0x44e980[_0x3fb35b(0x1a4)]===_0x44e980[_0x3fb35b(0x169)]?a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0xd5))+'\x20'+_0x44e980[_0x3fb35b(0x1a4)]:a29_0x348113[_0x3fb35b(0xb0)]('Join:')+'\x20'+_0x44e980['joinKey']+_0x3fb35b(0x1c6)+_0x44e980[_0x3fb35b(0x169)];console['error']('\x20\x20'+_0x115aed),console['error']('\x20\x20'+a29_0x348113[_0x3fb35b(0xb0)]('Columns:')),this[_0x3fb35b(0x1d1)](_0x44e980['columns']),!_0x44e980['schemaValid']&&console[_0x3fb35b(0xf5)]('\x20\x20'+a29_0x348113[_0x3fb35b(0x1d6)](_0x3fb35b(0x17b))+'\x20'+_0x44e980['schemaError']);}}[a29_0x4f72eb(0x1d1)](_0x211fcc){const _0x16d9f6=a29_0x4f72eb;for(const _0x54db0e of _0x211fcc){_0x54db0e[_0x16d9f6(0x12b)]===_0x54db0e[_0x16d9f6(0x8b)]||_0x54db0e[_0x16d9f6(0x8b)]==='*'?console[_0x16d9f6(0xf5)](_0x16d9f6(0x15f)+_0x54db0e[_0x16d9f6(0x12b)]):console[_0x16d9f6(0xf5)](_0x16d9f6(0x15f)+_0x54db0e[_0x16d9f6(0x12b)]+'\x20'+a29_0x348113[_0x16d9f6(0xb0)]('('+_0x54db0e[_0x16d9f6(0x8b)]+')'));}}[a29_0x4f72eb(0x13b)](_0x73be99){const _0x427733=a29_0x4f72eb;console['error']('─'[_0x427733(0x158)](0x3c));if(_0x73be99[_0x427733(0x1a3)][_0x427733(0x1ee)]>0x0){console[_0x427733(0xf5)]('\x0a'+a29_0x348113['red'](_0x427733(0xc1)));for(const _0xac4553 of _0x73be99['errors']){console['error']('\x20\x20'+a29_0x348113[_0x427733(0x1d6)]('•')+'\x20'+_0xac4553);}}_0x73be99[_0x427733(0xb5)]&&console['error']('\x0a'+a29_0x348113['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0xf6);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x1ba);async['execute'](_0x1a825e){const _0x456e42=a29_0x4f72eb,{options:_0x2d8347,args:_0x31ad9c,tdx:_0x623d77}=_0x1a825e,_0x27e707=_0x2d8347,_0xb1d9e8=_0x31ad9c[0x0]||_0x2d8347['parentSegment'];if(!_0xb1d9e8)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'+_0x456e42(0x17e)+_0x456e42(0x1b1)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x456e42(0x1ac)+_0x456e42(0x199)+_0x456e42(0xcb)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x27e707[_0x456e42(0x1c5)]&&!_0x27e707['attribute']&&!_0x27e707[_0x456e42(0x1e3)]&&!_0x27e707[_0x456e42(0x1cc)])return console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x456e42(0xc0)),console['error'](_0x456e42(0xf7)),console[_0x456e42(0xf5)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x456e42(0xf5)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console['error'](_0x456e42(0xdc)),console[_0x456e42(0xf5)](_0x456e42(0x114)),0x1;const _0x257fe6=resolveYamlFile(_0xb1d9e8);if(!existsSync(_0x257fe6))return showFileNotFoundError(_0x257fe6,_0xb1d9e8),0x1;_0x27e707[_0x456e42(0x15d)]&&(console[_0x456e42(0xf5)]('Site:\x20'+_0x27e707[_0x456e42(0x130)]),console[_0x456e42(0xf5)](_0x456e42(0x1eb)+_0x257fe6));let _0x459acb;try{_0x459acb=readFileSync(_0x257fe6,_0x456e42(0x1dc));}catch(_0x586922){const _0x570e84=_0x586922 instanceof Error?_0x586922[_0x456e42(0xc8)]:String(_0x586922);return console[_0x456e42(0xf5)](_0x456e42(0x8c)+_0x570e84),0x1;}let _0xf33758;try{_0xf33758=parseDef(_0x459acb);}catch(_0x1790e5){const _0x4b15c8=_0x1790e5 instanceof Error?_0x1790e5[_0x456e42(0xc8)]:String(_0x1790e5);return console['error'](a29_0x348113[_0x456e42(0x1d6)]('Error\x20parsing\x20YAML:\x20'+_0x4b15c8)),0x1;}if(_0x27e707[_0x456e42(0x1d9)]===!![]||_0x27e707[_0x456e42(0x1d9)]===''){const _0x21c084=_0xf33758[_0x456e42(0x89)]?.[_0x456e42(0x193)](_0x2b4b59=>_0x2b4b59[_0x456e42(0xa8)])||[];if(_0x21c084[_0x456e42(0x1ee)]===0x0)console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)](_0x456e42(0x1b6)));else{console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x456e42(0xf5)](_0x456e42(0x1e0));for(const _0x30d17a of _0x21c084){console[_0x456e42(0xf5)]('\x20\x20'+a29_0x348113[_0x456e42(0x9c)](_0x30d17a));}console[_0x456e42(0xf5)](_0x456e42(0x102)+_0xb1d9e8+'\x20--attribute\x20\x22'+_0x21c084[0x0]+'\x22');}return 0x1;}if(_0x27e707[_0x456e42(0x1e3)]===!![]||_0x27e707[_0x456e42(0x1e3)]===''){const _0x5be295=_0xf33758[_0x456e42(0xe6)]?.[_0x456e42(0x193)](_0x28db5c=>_0x28db5c[_0x456e42(0xa8)])||[];if(_0x5be295['length']===0x0)console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)](_0x456e42(0x126)));else{console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)](_0x456e42(0x1c4))),console[_0x456e42(0xf5)](_0x456e42(0x12e));for(const _0x348048 of _0x5be295){console[_0x456e42(0xf5)]('\x20\x20'+a29_0x348113[_0x456e42(0x9c)](_0x348048));}console[_0x456e42(0xf5)](_0x456e42(0x102)+_0xb1d9e8+_0x456e42(0x1b4)+_0x5be295[0x0]+'\x22');}return 0x1;}const _0x8b7553=createCommandSpinner(a29_0x348113[_0x456e42(0xb0)]('Fetching\x20sample\x20data...'),{'verbose':_0x27e707[_0x456e42(0x15d)]});_0x8b7553[_0x456e42(0xd3)]();const _0xce5234={'onProgress':_0x69b6fc=>{const _0x3c2506=_0x456e42;_0x8b7553[_0x3c2506(0x13a)]=formatProgressMessage(_0x69b6fc);}};if(_0x27e707[_0x456e42(0x1c5)])_0xce5234[_0x456e42(0x1c5)]=!![];if(_0x27e707[_0x456e42(0x1d9)]&&typeof _0x27e707[_0x456e42(0x1d9)]===_0x456e42(0x1f7))_0xce5234['attribute']=_0x27e707['attribute'];if(_0x27e707[_0x456e42(0x1e3)]&&typeof _0x27e707[_0x456e42(0x1e3)]===_0x456e42(0x1f7))_0xce5234[_0x456e42(0x1e3)]=_0x27e707[_0x456e42(0x1e3)];if(_0x27e707[_0x456e42(0x1cc)])_0xce5234[_0x456e42(0x1cc)]=!![];if(_0x27e707[_0x456e42(0xb3)])_0xce5234[_0x456e42(0xb3)]=_0x27e707['interval'];let _0x36d57b;try{_0x36d57b=await _0x623d77['segment'][_0x456e42(0x140)](_0x459acb,_0xce5234),_0x8b7553[_0x456e42(0x144)]();}catch(_0x561aee){_0x8b7553[_0x456e42(0x144)]();throw _0x561aee;}return await this[_0x456e42(0xac)](_0x36d57b,{'master':_0x27e707[_0x456e42(0x1c5)],'attribute':typeof _0x27e707[_0x456e42(0x1d9)]==='string'?_0x27e707[_0x456e42(0x1d9)]:undefined,'behavior':typeof _0x27e707['behavior']==='string'?_0x27e707[_0x456e42(0x1e3)]:undefined,'enriched':_0x27e707[_0x456e42(0x1cc)]}),_0x36d57b[_0x456e42(0xb5)]?0x0:0x1;}async[a29_0x4f72eb(0xac)](_0x189a57,_0x1271f9){const _0x3b2e3c=a29_0x4f72eb;console[_0x3b2e3c(0xf5)]('\x0a'+a29_0x348113[_0x3b2e3c(0x159)]('Preview:')+'\x20'+_0x189a57[_0x3b2e3c(0xa8)]),console[_0x3b2e3c(0xf5)]('═'[_0x3b2e3c(0x158)](0x3c));if(_0x1271f9['master']&&_0x189a57[_0x3b2e3c(0x151)]){const _0x2b85b4=a29_0x348113[_0x3b2e3c(0xb0)]('Master:')+'\x20'+a29_0x348113[_0x3b2e3c(0x159)](_0x189a57[_0x3b2e3c(0x1c5)][_0x3b2e3c(0xd0)]+'.'+_0x189a57[_0x3b2e3c(0x1c5)][_0x3b2e3c(0x12c)]);await this[_0x3b2e3c(0x1b7)](_0x2b85b4,_0x189a57[_0x3b2e3c(0x151)]);}else{if(_0x1271f9[_0x3b2e3c(0x1d9)]&&_0x189a57[_0x3b2e3c(0x151)]){const _0xc0d799=a29_0x348113['dim']('Attribute:')+'\x20'+a29_0x348113[_0x3b2e3c(0x159)](_0x1271f9[_0x3b2e3c(0x1d9)]);await this[_0x3b2e3c(0x1b7)](_0xc0d799,_0x189a57[_0x3b2e3c(0x151)]);}else{if(_0x1271f9[_0x3b2e3c(0x1e3)]&&_0x189a57[_0x3b2e3c(0x151)]){const _0x59944a=a29_0x348113[_0x3b2e3c(0xb0)](_0x3b2e3c(0x172))+'\x20'+a29_0x348113[_0x3b2e3c(0x159)](_0x1271f9[_0x3b2e3c(0x1e3)]);await this[_0x3b2e3c(0x1b7)](_0x59944a,_0x189a57[_0x3b2e3c(0x151)]);}else{if(_0x1271f9[_0x3b2e3c(0x1cc)]&&_0x189a57[_0x3b2e3c(0x151)]){const _0x264873=a29_0x348113['dim']('Enriched:')+'\x20'+a29_0x348113['bold']('Master\x20+\x20Attributes');await this[_0x3b2e3c(0x1b7)](_0x264873,_0x189a57[_0x3b2e3c(0x151)]);}else!_0x189a57[_0x3b2e3c(0x151)]&&console[_0x3b2e3c(0xf5)](_0x3b2e3c(0x141));}}}if(_0x189a57[_0x3b2e3c(0x1a3)][_0x3b2e3c(0x1ee)]>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a29_0x348113['red'](_0x3b2e3c(0xc1)));for(const _0x408b84 of _0x189a57['errors']){console[_0x3b2e3c(0xf5)]('\x20\x20'+a29_0x348113[_0x3b2e3c(0x1d6)]('•')+'\x20'+_0x408b84);}}}async[a29_0x4f72eb(0x1b7)](_0x21d801,_0x4759ca){const _0x212a48=a29_0x4f72eb;if(_0x4759ca[_0x212a48(0x1ee)]===0x0){console[_0x212a48(0xf5)]('\x0a'+_0x21d801),console[_0x212a48(0xf5)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x212a48(0xf5)]('\x0a'+_0x21d801);const _0x37729a=Object[_0x212a48(0xf3)](_0x4759ca[0x0])[_0x212a48(0x193)](_0x2509eb=>({'name':_0x2509eb,'type':typeof _0x4759ca[0x0][_0x2509eb]==='number'?'double':_0x212a48(0x132)})),_0x3e9ba9={'queryId':_0x212a48(0x95),'columns':_0x37729a,'data':_0x4759ca,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4759ca[_0x212a48(0x1ee)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1ec8da=formatAsTable(_0x3e9ba9,_0x4759ca[_0x212a48(0x1ee)],!![]);await writeOutput(_0x1ec8da,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]='segment:parent:run';[a29_0x4f72eb(0x196)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x4f72eb(0x110)](_0x11dd3f){const _0x280c77=a29_0x4f72eb,{options:_0x2eed26,args:_0x34f47b,tdx:_0x15a70b}=_0x11dd3f,_0x2a5a43=_0x2eed26,_0x547fba=_0x34f47b[0x0]||_0x2eed26[_0x280c77(0x1c7)];if(!_0x547fba)return showParentSegmentNotSetError(_0x280c77(0x1f4)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x1a82e4=resolveYamlFile(_0x547fba);if(existsSync(_0x1a82e4)){_0x2a5a43[_0x280c77(0x15d)]&&console[_0x280c77(0xf5)](_0x280c77(0x15c)+_0x1a82e4);let _0x3c83df;try{_0x3c83df=readFileSync(_0x1a82e4,_0x280c77(0x1dc));}catch(_0x8bc17){const _0x4a47ad=_0x8bc17 instanceof Error?_0x8bc17[_0x280c77(0xc8)]:String(_0x8bc17);return console[_0x280c77(0xf5)](_0x280c77(0x8c)+_0x4a47ad),0x1;}const _0x159c5b=await withSpinner('Analyzing\x20changes...',()=>_0x15a70b[_0x280c77(0x166)]['pushParentYaml'](_0x3c83df),{'verbose':_0x2a5a43[_0x280c77(0x15d)]}),_0x309682=_0x159c5b[_0x280c77(0xbf)],{isNew:_0x1025d9,name:_0x12b8fd,hasChanges:_0x4f0908,diffFormatted:_0x42f834}=_0x309682;if(_0x4f0908){_0x1025d9?console[_0x280c77(0xf5)](_0x280c77(0x1d5)+_0x12b8fd+'\x27:'):console[_0x280c77(0xf5)](_0x280c77(0x11f)+_0x12b8fd+'\x27:');console[_0x280c77(0xf5)]('─'[_0x280c77(0x158)](0x3c)),console[_0x280c77(0xf5)](_0x42f834),console[_0x280c77(0xf5)]('─'[_0x280c77(0x158)](0x3c));const _0x3e74e7=_0x1025d9?'Create\x20parent\x20segment\x20\x27'+_0x12b8fd+_0x280c77(0x154):_0x280c77(0x1fe)+_0x12b8fd+_0x280c77(0x154);if(!_0x2a5a43[_0x280c77(0x1e4)]){if(!isInteractive())return console[_0x280c77(0xf5)](a29_0x348113[_0x280c77(0x1d6)](_0x280c77(0x1f8)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x280c77(0xf5)](a29_0x348113[_0x280c77(0xb0)](_0x280c77(0x15b))),0x1;const _0x3b71a8=await confirmKey(_0x3e74e7);if(!_0x3b71a8)return console['error'](a29_0x348113[_0x280c77(0xb2)]('Aborted.')),0x1;}const _0x55e36f=_0x1025d9?'Creating':_0x280c77(0x209);await withSpinner(_0x55e36f+_0x280c77(0x186)+_0x12b8fd+_0x280c77(0xa1),()=>_0x309682[_0x280c77(0xc7)](),{'verbose':_0x2a5a43[_0x280c77(0x15d)]});const _0x34e3d2=_0x1025d9?_0x280c77(0x1ea):'Updated';console[_0x280c77(0xf5)]('✔\x20'+_0x34e3d2+'\x20parent\x20segment\x20\x27'+_0x12b8fd+'\x27');}else console[_0x280c77(0xf5)](_0x280c77(0x94)+_0x12b8fd+_0x280c77(0x1a7));}const _0x52199e=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x547fba+'\x27...',()=>_0x15a70b[_0x280c77(0x166)][_0x280c77(0x146)](_0x547fba),{'verbose':_0x2a5a43[_0x280c77(0x15d)]}),_0x5a5cca=_0x52199e['data'],_0x2d1d2c=getConsoleUrl(_0x2a5a43[_0x280c77(0x130)],_0x280c77(0x14f)+_0x5a5cca[_0x280c77(0xb8)]+'/sessions/'+_0x5a5cca[_0x280c77(0x201)]+_0x280c77(0x13c)+_0x5a5cca[_0x280c77(0x1d2)]);return console[_0x280c77(0xf5)](_0x280c77(0x19f)),console[_0x280c77(0xf5)]('\x20\x20'+a29_0x348113[_0x280c77(0xb0)]('Audience\x20ID:')+'\x20'+_0x5a5cca[_0x280c77(0x1e5)]),console[_0x280c77(0xf5)]('\x20\x20'+a29_0x348113[_0x280c77(0xb0)](_0x280c77(0xf2))+'\x20'+_0x5a5cca[_0x280c77(0x1b3)]),console['error']('\x20\x20'+a29_0x348113['dim'](_0x280c77(0x207))+'\x20'+_0x5a5cca[_0x280c77(0x201)]),console[_0x280c77(0xf5)]('\x20\x20'+a29_0x348113['dim'](_0x280c77(0x1e7))+'\x20'+_0x5a5cca[_0x280c77(0x1d2)]),console[_0x280c77(0xf5)]('\x20\x20'+_0x2d1d2c),console[_0x280c77(0xf5)]('\x0a'+a29_0x348113[_0x280c77(0xb0)](_0x280c77(0x180))+_0x280c77(0x1a1)+_0x5a5cca[_0x280c77(0x1d2)]+_0x280c77(0x175)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:fields';[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x15e);async[a29_0x4f72eb(0x110)](_0x1b3687){const _0x2f30af=a29_0x4f72eb,{options:_0x49d71d,args:_0x5668e5,tdx:_0x467df2}=_0x1b3687,_0xc4fa00=_0x5668e5[0x0]||_0x49d71d['parentSegment'];if(!_0xc4fa00)return showParentSegmentNotSetError(_0x2f30af(0x11a)+_0x2f30af(0x197)),0x1;_0x49d71d[_0x2f30af(0x15d)]&&(console['error']('Site:\x20'+_0x49d71d['site']),console['error'](_0x2f30af(0xa7)+_0xc4fa00));const _0x12e6bc=await withSpinner(_0x2f30af(0x155)+_0xc4fa00+_0x2f30af(0xa1),()=>_0x467df2[_0x2f30af(0x166)][_0x2f30af(0x1c3)](_0xc4fa00),{'verbose':_0x49d71d['verbose']}),_0x2daf14=_0x12e6bc['data'];console[_0x2f30af(0xf5)](_0x2f30af(0xd7)+_0x2daf14['length']+'\x20field'+(_0x2daf14[_0x2f30af(0x1ee)]!==0x1?'s':''));if(_0x49d71d[_0x2f30af(0x19a)]||_0x49d71d[_0x2f30af(0x135)])return await handleSDKOutput(_0x2daf14,_0x49d71d),0x0;return displayFieldsHumanReadable(_0x2daf14,_0xc4fa00),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x14a);['description']=a29_0x4f72eb(0x170);async[a29_0x4f72eb(0x110)](_0x2fbf60){const _0x1f2c72=a29_0x4f72eb,{options:_0x1b8eaa,args:_0x1e2f16,tdx:_0x6fc058}=_0x2fbf60,_0x53f960=_0x1b8eaa,_0x45f795=_0x1e2f16[0x0]||_0x1b8eaa[_0x1f2c72(0x1c7)];if(!_0x45f795)return showParentSegmentNotSetError(_0x1f2c72(0xfa)+_0x1f2c72(0xff)+_0x1f2c72(0x1c1)+_0x1f2c72(0x105)),0x1;_0x1b8eaa['verbose']&&(console[_0x1f2c72(0xf5)]('Site:\x20'+_0x1b8eaa['site']),console['error'](_0x1f2c72(0xa7)+_0x45f795));const _0x4bd259=await withSpinner(_0x1f2c72(0x147)+_0x45f795+_0x1f2c72(0xa1),()=>_0x6fc058['segment'][_0x1f2c72(0xfd)](_0x45f795),{'verbose':_0x1b8eaa[_0x1f2c72(0x15d)]}),_0x525312=_0x4bd259[_0x1f2c72(0xbf)];if(_0x53f960[_0x1f2c72(0x1f5)]){const _0x2599d4=getConsoleNextUrl(_0x53f960[_0x1f2c72(0x130)],_0x1f2c72(0x195)+_0x525312['id']);return console[_0x1f2c72(0xf5)](a29_0x348113[_0x1f2c72(0x16f)]('✔')+_0x1f2c72(0x16b)+a29_0x348113[_0x1f2c72(0x9c)](_0x2599d4)),openBrowser(_0x2599d4),0x0;}return await handleSingleObjectOutput(_0x525312,_0x1b8eaa),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x1c0);[a29_0x4f72eb(0x196)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a29_0x4f72eb(0x110)](_0x4c7f81){const _0x349393=a29_0x4f72eb,{options:_0x27c907,args:_0x41771f,tdx:_0x2748be}=_0x4c7f81,_0x227ceb=_0x27c907,_0x2c054a=_0x41771f[0x0]||_0x27c907['parentSegment'];if(!_0x2c054a)return showParentSegmentNotSetError('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'+'\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'+'Options:\x0a'+_0x349393(0x1c2)),0x1;_0x27c907[_0x349393(0x15d)]&&(console[_0x349393(0xf5)]('Site:\x20'+_0x27c907[_0x349393(0x130)]),console[_0x349393(0xf5)]('Parent\x20segment:\x20'+_0x2c054a));const _0x2c4564=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2c054a+_0x349393(0xa1),()=>_0x2748be[_0x349393(0x166)][_0x349393(0x115)](_0x2c054a),{'verbose':_0x27c907[_0x349393(0x15d)]}),_0x58fb97=_0x2c4564[_0x349393(0xbf)],_0x459264=_0x2748be[_0x349393(0x166)][_0x349393(0x145)](_0x58fb97);if(_0x227ceb[_0x349393(0x1a8)]){const _0x1e452b=await this[_0x349393(0xad)](_0x4c7f81,_0x2c054a,_0x58fb97,_0x459264),_0x50ada6=this[_0x349393(0x1dd)](_0x1e452b);writeFileSync(_0x227ceb[_0x349393(0x1a8)],_0x50ada6);const _0x16ff26=_0x1e452b[_0x349393(0x13e)][_0x349393(0x8f)][_0x349393(0x1ee)]+_0x1e452b[_0x349393(0xe6)][_0x349393(0xa3)]((_0x47a336,_0x1361df)=>_0x47a336+_0x1361df[_0x349393(0x8f)][_0x349393(0x1ee)],0x0),_0xe5594b=_0x1e452b['behaviors'][_0x349393(0x109)](_0x39f7d5=>_0x39f7d5[_0x349393(0x8f)]['length']===0x0)[_0x349393(0x1ee)];return console[_0x349393(0x10a)](_0x349393(0x1c8)+_0x227ceb[_0x349393(0x1a8)]),console[_0x349393(0x10a)](_0x349393(0x187)+_0x459264),console[_0x349393(0x10a)](_0x349393(0xb6)+_0x1e452b[_0x349393(0xe6)]['length']+_0x349393(0x16a)),console[_0x349393(0x10a)](_0x349393(0x1cb)+_0x16ff26+'\x20total'),_0xe5594b>0x0&&console[_0x349393(0x10a)](_0x349393(0x190)+_0xe5594b+_0x349393(0x137)),0x0;}console[_0x349393(0xf5)]('\x0a'+a29_0x348113[_0x349393(0x159)](_0x349393(0xfc))+'\x20'+a29_0x348113[_0x349393(0x9c)](_0x459264));const _0xee0550=await withSpinner(_0x349393(0xde),()=>_0x2748be[_0x349393(0x166)][_0x349393(0x136)](_0x58fb97),{'verbose':_0x27c907[_0x349393(0x15d)]});console[_0x349393(0xf5)]('\x0a'+a29_0x348113['bold'](_0x349393(0x13e))+'\x20'+a29_0x348113[_0x349393(0xb0)]('('+_0x459264+_0x349393(0xe8)));const _0x327c0f=await executeSchemaQuery(_0xee0550[_0x349393(0xbf)],_0x2748be,_0x27c907);await handleQueryOutput(_0x327c0f,_0x27c907);const _0xe283a1=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x2748be['segment'][_0x349393(0x168)](_0x58fb97),{'verbose':_0x27c907['verbose']});for(const _0x2191bd of _0xe283a1[_0x349393(0xbf)]){const _0x22fa9b=_0x349393(0xbb)+_0x2191bd[_0x349393(0x1d8)]()[_0x349393(0x117)](/\s+/g,'_'),_0x5b1c49=_0x349393(0x16c)+_0x459264+'.'+_0x22fa9b;console[_0x349393(0xf5)]('\x0a'+a29_0x348113[_0x349393(0x159)](_0x2191bd)+'\x20'+a29_0x348113['dim']('('+_0x459264+'.'+_0x22fa9b+')'));try{const _0x34e451=await executeSchemaQuery(_0x5b1c49,_0x2748be,_0x27c907);await handleQueryOutput(_0x34e451,_0x27c907);}catch{console['error'](a29_0x348113[_0x349393(0xb2)](_0x349393(0x107)));}}return 0x0;}async[a29_0x4f72eb(0xad)](_0x8a7484,_0x3cb225,_0x1028ee,_0x30b1e6){const _0x20f9b9=a29_0x4f72eb,{options:_0x5c5322,tdx:_0x281915}=_0x8a7484,_0x38c4d5=await withSpinner(_0x20f9b9(0xde),()=>_0x281915['segment']['getParentSQL'](_0x1028ee),{'verbose':_0x5c5322[_0x20f9b9(0x15d)]}),_0x53f72d=await executeSchemaQuery(_0x38c4d5[_0x20f9b9(0xbf)],_0x281915,_0x5c5322),_0x1a350e=_0x53f72d['data']['map'](_0x5393d0=>({'name':_0x5393d0[_0x20f9b9(0x188)],'type':_0x5393d0[_0x20f9b9(0xc6)]})),_0x14bd6d=await withSpinner(_0x20f9b9(0x167),()=>_0x281915[_0x20f9b9(0x166)]['getBehaviorNames'](_0x1028ee),{'verbose':_0x5c5322[_0x20f9b9(0x15d)]}),_0x19efbe=[];for(const _0x1b7d6d of _0x14bd6d[_0x20f9b9(0xbf)]){const _0x45001c=_0x20f9b9(0xbb)+_0x1b7d6d[_0x20f9b9(0x1d8)]()[_0x20f9b9(0x117)](/\s+/g,'_'),_0xc2ca58=_0x20f9b9(0x16c)+_0x30b1e6+'.'+_0x45001c;let _0xa7634=[];try{const _0x269345=await executeSchemaQuery(_0xc2ca58,_0x281915,_0x5c5322);_0xa7634=_0x269345[_0x20f9b9(0xbf)][_0x20f9b9(0x193)](_0x37a3b5=>({'name':_0x37a3b5[_0x20f9b9(0x188)],'type':_0x37a3b5['column_type']}));}catch{}_0x19efbe[_0x20f9b9(0x204)]({'table':_0x45001c,'columns':_0xa7634});}return{'database':_0x30b1e6,'parent_segment':_0x3cb225,'parent_id':_0x1028ee,'customers':{'table':'customers','columns':_0x1a350e},'behaviors':_0x19efbe};}[a29_0x4f72eb(0x1dd)](_0x425e55){const _0x264595=a29_0x4f72eb,_0x461d91=_0x511760=>{const _0x40da8b=a29_0x2465;if(_0x511760[_0x40da8b(0x1ee)]===0x0)return'[]';const _0x215100=_0x511760[_0x40da8b(0x193)](_0x332ed9=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x332ed9[_0x40da8b(0xa8)]+_0x40da8b(0xd4)+_0x332ed9[_0x40da8b(0x174)]+'\x22\x20}');return'[\x0a'+_0x215100[_0x40da8b(0x1cd)](',\x0a')+_0x40da8b(0x15a);},_0x33c985=_0x425e55[_0x264595(0xe6)][_0x264595(0x193)](_0x287f65=>{const _0x592a67=_0x264595;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x287f65[_0x592a67(0x12c)]+_0x592a67(0xf4)+_0x461d91(_0x287f65['columns'])['replace'](/^/gm,'\x20\x20')[_0x592a67(0x119)]()+_0x592a67(0xa6);})['join'](',\x0a');return _0x264595(0xbc)+_0x425e55[_0x264595(0xd0)]+_0x264595(0x12f)+_0x425e55['parent_segment']+_0x264595(0x13d)+_0x425e55[_0x264595(0x1b5)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x425e55[_0x264595(0x13e)][_0x264595(0x12c)]+_0x264595(0x1db)+_0x461d91(_0x425e55[_0x264595(0x13e)][_0x264595(0x8f)])[_0x264595(0x117)](/^/gm,'\x20\x20')['trim']()+_0x264595(0xcf)+_0x33c985+_0x264595(0xe7);}}function a29_0x2465(_0x24b1aa,_0x26bff4){_0x24b1aa=_0x24b1aa-0x88;const _0x53df5d=a29_0x53df();let _0x2465b5=_0x53df5d[_0x24b1aa];return _0x2465b5;}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:sql';[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x194);async[a29_0x4f72eb(0x110)](_0x15f69e){const _0x55f6cf=a29_0x4f72eb,{options:_0x1d3524,args:_0xe88f6f,tdx:_0x489e44}=_0x15f69e,_0x2a7631=_0xe88f6f[0x0]||_0x1d3524['parentSegment'];if(!_0x2a7631)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'+_0x55f6cf(0x1f9)),0x1;_0x1d3524[_0x55f6cf(0x15d)]&&(console[_0x55f6cf(0xf5)]('Site:\x20'+_0x1d3524[_0x55f6cf(0x130)]),console[_0x55f6cf(0xf5)](_0x55f6cf(0xa7)+_0x2a7631));const _0x3e5a8c=await withSpinner(_0x55f6cf(0x9f)+_0x2a7631+_0x55f6cf(0xa1),()=>_0x489e44[_0x55f6cf(0x166)]['resolveParentId'](_0x2a7631),{'verbose':_0x1d3524[_0x55f6cf(0x15d)]}),_0xebc14c=_0x3e5a8c[_0x55f6cf(0xbf)],_0x470bc7=await withSpinner(_0x55f6cf(0x1ec)+_0x2a7631+'\x27...',()=>_0x489e44[_0x55f6cf(0x166)]['getParentSQL'](_0xebc14c),{'verbose':_0x1d3524[_0x55f6cf(0x15d)]}),_0x29e9ce=_0x470bc7['data'];return _0x1d3524['format']===_0x55f6cf(0x19a)||_0x1d3524[_0x55f6cf(0x1ca)]===_0x55f6cf(0x135)?await handleSDKOutput([{'sql':_0x29e9ce}],_0x1d3524):console[_0x55f6cf(0x10a)](_0x29e9ce),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:show';[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x11b);async['execute'](_0x21d78f){const _0x2028c8=a29_0x4f72eb,{options:_0x2114e2,args:_0x1a29e4,tdx:_0x5110b2}=_0x21d78f,_0x34bf18=_0x1a29e4[0x0]||_0x2114e2[_0x2028c8(0x1c7)];if(!_0x34bf18)return showParentSegmentNotSetError(_0x2028c8(0x123)+'\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;_0x2114e2[_0x2028c8(0x15d)]&&(console[_0x2028c8(0xf5)](_0x2028c8(0x12d)+_0x2114e2[_0x2028c8(0x130)]),console[_0x2028c8(0xf5)](_0x2028c8(0xa7)+_0x34bf18));const _0x551c3e=await withSpinner(_0x2028c8(0x9f)+_0x34bf18+'\x27...',()=>_0x5110b2['segment']['resolveParentId'](_0x34bf18),{'verbose':_0x2114e2[_0x2028c8(0x15d)]}),_0x55a0cc=_0x551c3e[_0x2028c8(0xbf)],_0x5efff4=await withSpinner(_0x2028c8(0x1ec)+_0x34bf18+_0x2028c8(0xa1),()=>_0x5110b2['segment'][_0x2028c8(0x136)](_0x55a0cc),{'verbose':_0x2114e2['verbose']});let _0x31c352=_0x5efff4[_0x2028c8(0xbf)];const _0x191e0c=resolveLimit(_0x2114e2[_0x2028c8(0x9b)],DEFAULT_DISPLAY_LIMIT),_0x326656=/\bLIMIT\s+\d+/i['test'](_0x31c352);!_0x326656&&(_0x31c352=_0x31c352[_0x2028c8(0x119)]()[_0x2028c8(0x117)](/;+$/,''),_0x31c352=_0x2028c8(0x156)+_0x31c352+_0x2028c8(0x1ed)+_0x191e0c);_0x2114e2['verbose']&&console[_0x2028c8(0xf5)](_0x2028c8(0x100)+_0x31c352);const _0x44540e=await withProgressSpinner(_0x2028c8(0x1a5),async _0x3c0958=>{const _0x47eb19=_0x2028c8,_0x521b88=await _0x5110b2['query'][_0x47eb19(0x110)](_0x31c352,{'catalog':'td','schema':_0x47eb19(0x93),'onJobId':_0x143417=>{const _0xf866fa=_0x47eb19;_0x3c0958[_0xf866fa(0x1bb)](_0x143417);}});return _0x521b88;},{'verbose':_0x2114e2[_0x2028c8(0x15d)]}),_0x405a79=_0x44540e['data'],_0x5d578b=_0x405a79[_0x2028c8(0x1ce)]?_0x2028c8(0x160)+_0x405a79[_0x2028c8(0x1ce)]+']':'';return console[_0x2028c8(0xf5)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x405a79['stats'][_0x2028c8(0x99)][_0x2028c8(0x101)]()+'\x20rows\x20'+(_0x2028c8(0xb7)+formatElapsed(_0x405a79[_0x2028c8(0x14b)][_0x2028c8(0x9e)])+_0x5d578b)),await handleQueryOutput(_0x405a79,_0x2114e2),0x0;}}export class PSRtListCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0xae);['description']='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async['execute'](_0x115c45){const _0x2dc098=a29_0x4f72eb,{options:_0x350dda,args:_0x11db4e,tdx:_0x2d7ab8}=_0x115c45,_0x49106f=_0x11db4e[0x0],_0x3c6fa=await withSpinner(_0x49106f?_0x2dc098(0x91)+_0x49106f+_0x2dc098(0xa1):_0x2dc098(0x116),()=>_0x2d7ab8[_0x2dc098(0x1b8)][_0x2dc098(0x1cf)](),{'verbose':_0x350dda[_0x2dc098(0x15d)]});let _0x400e00=_0x3c6fa['data']['filter'](_0x5ac736=>_0x5ac736[_0x2dc098(0xb4)]);if(_0x49106f){const _0x56d31f=_0x49106f['replace'](/[.+^${}()|[\]\\]/g,_0x2dc098(0xe0))['replace'](/\*/g,'.*')[_0x2dc098(0x117)](/\?/g,'.'),_0xf79a55=new RegExp('^'+_0x56d31f+'$','i');_0x400e00=_0x400e00[_0x2dc098(0x109)](_0xa7da5b=>_0xf79a55[_0x2dc098(0x1bd)](_0xa7da5b[_0x2dc098(0xa8)]));}_0x400e00[_0x2dc098(0x98)]((_0x547df4,_0x5107e2)=>_0x547df4['name'][_0x2dc098(0xbd)](_0x5107e2[_0x2dc098(0xa8)])),console[_0x2dc098(0xf5)](_0x2dc098(0xd7)+_0x400e00[_0x2dc098(0x1ee)]+_0x2dc098(0x1fb)+(_0x400e00[_0x2dc098(0x1ee)]!==0x1?'s':''));const _0x389fd9=_0x2e5eaf=>{const _0x100196=_0x2dc098;return getConsoleNextUrl(_0x350dda[_0x100196(0x130)],'/app/dw/parentSegments/'+_0x2e5eaf);};if(_0x350dda[_0x2dc098(0x1ca)]===_0x2dc098(0x19a)||_0x350dda[_0x2dc098(0x1ca)]===_0x2dc098(0x135)){const _0x14eb77=_0x400e00[_0x2dc098(0x193)](_0xe23f65=>({..._0xe23f65,'url':_0x389fd9(_0xe23f65['id'])}));await handleSDKOutput(_0x14eb77,_0x350dda);}else{if(_0x400e00[_0x2dc098(0x1ee)]===0x0)console['log'](_0x2dc098(0x183));else for(const _0x3dd3e8 of _0x400e00){const _0x1306fd=_0x3dd3e8['population']?a29_0x348113['dim']('\x20('+formatRows(_0x3dd3e8[_0x2dc098(0x8a)])+')'):'',_0x2a875c=hyperlink(_0x3dd3e8[_0x2dc098(0xa8)],_0x389fd9(_0x3dd3e8['id']));console['log']('⚡\x20'+_0x2a875c+_0x1306fd);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x1f6);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x176);async['execute'](_0x11ee64){const _0x295f57=a29_0x4f72eb,{options:_0x2d32ac,args:_0x1e9a68,tdx:_0x53deda}=_0x11ee64,_0x421c23=_0x1e9a68[0x0]||_0x2d32ac['parentSegment'];if(!_0x421c23)return showParentSegmentNotSetError(_0x295f57(0x129)+_0x295f57(0x10f)),0x1;const _0x5f09e9=resolveYamlFile(_0x421c23);if(!existsSync(_0x5f09e9))return showFileNotFoundError(_0x5f09e9,_0x421c23),0x1;let _0x540a23;try{_0x540a23=readFileSync(_0x5f09e9,_0x295f57(0x1dc));}catch(_0x34f2bf){const _0x535856=_0x34f2bf instanceof Error?_0x34f2bf[_0x295f57(0xc8)]:String(_0x34f2bf);return console[_0x295f57(0xf5)]('Error\x20reading\x20file:\x20'+_0x535856),0x1;}const _0x2dd6b7=createCommandSpinner(a29_0x348113['dim'](_0x295f57(0x10d)),{'verbose':_0x2d32ac[_0x295f57(0x15d)]});_0x2dd6b7[_0x295f57(0xd3)]();const _0x1bb0d9={'realtime':!![],'onProgress':_0x7d4e57=>{const _0x3cc54d=_0x295f57;_0x2dd6b7[_0x3cc54d(0x13a)]=formatProgressMessage(_0x7d4e57);}};let _0x9dcecb;try{_0x9dcecb=await _0x53deda[_0x295f57(0x166)][_0x295f57(0x206)](_0x540a23,_0x1bb0d9),_0x2dd6b7[_0x295f57(0x144)]();}catch(_0x23ac90){_0x2dd6b7['stop']();throw _0x23ac90;}console[_0x295f57(0xf5)]('\x0a'+a29_0x348113[_0x295f57(0x159)](_0x295f57(0x1ad))+'\x20'+_0x9dcecb[_0x295f57(0xa8)]),console[_0x295f57(0xf5)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x9dcecb),console[_0x295f57(0xf5)]('─'[_0x295f57(0x158)](0x3c));if(_0x9dcecb[_0x295f57(0x1a3)][_0x295f57(0x1ee)]>0x0){console[_0x295f57(0xf5)]('\x0a'+a29_0x348113[_0x295f57(0x1d6)](_0x295f57(0xc1)));for(const _0xd7ac89 of _0x9dcecb[_0x295f57(0x1a3)]){console[_0x295f57(0xf5)]('\x20\x20'+a29_0x348113[_0x295f57(0x1d6)]('•')+'\x20'+_0xd7ac89);}}return _0x9dcecb[_0x295f57(0xb5)]&&console['error']('\x0a'+a29_0x348113[_0x295f57(0x16f)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x9dcecb[_0x295f57(0xb5)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x182);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0xf0);async['execute'](_0x5ba1cc){const _0x439c1=a29_0x4f72eb,{options:_0x563ab2,args:_0x4176c2,tdx:_0x53b1e2}=_0x5ba1cc,_0x361f67=_0x4176c2[0x0]||_0x563ab2[_0x439c1(0x1c7)];if(!_0x361f67)return showParentSegmentNotSetError('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'+_0x439c1(0xaa)),0x1;const _0x3060b7=await withSpinner(_0x439c1(0x9f)+_0x361f67+_0x439c1(0xa1),()=>_0x53b1e2[_0x439c1(0x166)][_0x439c1(0x115)](_0x361f67),{'verbose':_0x563ab2[_0x439c1(0x15d)]}),_0x301287=_0x3060b7[_0x439c1(0xbf)],_0x1c5379=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x361f67+_0x439c1(0xa1),()=>_0x53b1e2[_0x439c1(0x153)][_0x439c1(0x1cf)](_0x301287),{'verbose':_0x563ab2['verbose']}),_0x4ebd2e=_0x1c5379['data'];console[_0x439c1(0xf5)](_0x439c1(0xd7)+_0x4ebd2e[_0x439c1(0x1ee)]+'\x20personalization\x20service'+(_0x4ebd2e['length']!==0x1?'s':''));if(_0x563ab2['format']===_0x439c1(0x19a)||_0x563ab2[_0x439c1(0x1ca)]===_0x439c1(0x135))await handleSDKOutput(_0x4ebd2e,_0x563ab2);else{if(_0x4ebd2e[_0x439c1(0x1ee)]===0x0)console['log'](_0x439c1(0x118)),console[_0x439c1(0xf5)](a29_0x348113[_0x439c1(0x9c)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0xb8e90 of _0x4ebd2e){const _0x3ecfcf=_0xb8e90[_0x439c1(0x18f)]?.[_0x439c1(0x1ee)]||0x0,_0x14e73e=_0xb8e90[_0x439c1(0x134)]?a29_0x348113[_0x439c1(0xb0)]('\x20trigger='+_0xb8e90[_0x439c1(0x134)]):'',_0x171cbb=a29_0x348113[_0x439c1(0xb0)]('\x20('+_0x3ecfcf+'\x20section'+(_0x3ecfcf!==0x1?'s':'')+')');console['log']('\x20\x20'+_0xb8e90[_0x439c1(0xa8)]+_0x14e73e+_0x171cbb),_0xb8e90[_0x439c1(0x196)]&&console['log']('\x20\x20\x20\x20'+a29_0x348113[_0x439c1(0xb0)](_0xb8e90[_0x439c1(0x196)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x178);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x1ff);async[a29_0x4f72eb(0x110)](_0x121cce){const _0x57dc61=a29_0x4f72eb,{options:_0x57ad14,args:_0x2cc8c1}=_0x121cce,_0x492797=_0x2cc8c1[0x0]||_0x57ad14['parentSegment'];if(!_0x492797)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'+'\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'),0x1;const _0x30c001=resolveYamlFile(_0x492797);if(!existsSync(_0x30c001))return showFileNotFoundError(_0x30c001,_0x492797),0x1;let _0x5b7549;try{_0x5b7549=readFileSync(_0x30c001,_0x57dc61(0x1dc));}catch(_0x943d26){const _0x5991d6=_0x943d26 instanceof Error?_0x943d26[_0x57dc61(0xc8)]:String(_0x943d26);return console[_0x57dc61(0xf5)](_0x57dc61(0x8c)+_0x5991d6),0x1;}let _0x2235a7;try{_0x2235a7=parseDef(_0x5b7549);}catch(_0x2057f5){const _0x3e8b5a=_0x2057f5 instanceof Error?_0x2057f5[_0x57dc61(0xc8)]:String(_0x2057f5);return console[_0x57dc61(0xf5)](a29_0x348113[_0x57dc61(0x1d6)](_0x57dc61(0xf9)+_0x3e8b5a)),0x1;}if(_0x2235a7['personalization_services']&&_0x2235a7['personalization_services'][_0x57dc61(0x1ee)]>0x0)return console['error'](a29_0x348113[_0x57dc61(0xb2)](_0x57dc61(0xab)+_0x30c001)),console[_0x57dc61(0xf5)](a29_0x348113[_0x57dc61(0xb0)](_0x57dc61(0x1e8)+_0x2235a7[_0x57dc61(0x11d)]['length']+_0x57dc61(0x1ab))),0x1;!_0x2235a7[_0x57dc61(0x1b8)]&&(_0x2235a7[_0x57dc61(0x1b8)]={'events':[{'name':'page_view','source_table':_0x57dc61(0x11e)}],'attributes':[{'name':_0x57dc61(0x150),'type':_0x57dc61(0x143)}],'id_stitching':{'primary_key':_0x2235a7['master'][_0x57dc61(0x12c)]===_0x57dc61(0x13e)?_0x57dc61(0x1ae):_0x57dc61(0x17d)}});_0x2235a7[_0x57dc61(0x11d)]=[{'name':'My\x20Service','description':_0x57dc61(0x1aa),'trigger_event':_0x57dc61(0x177),'sections':[{'name':_0x57dc61(0x128),'criteria':_0x57dc61(0x103),'attributes':[_0x57dc61(0x150)]}]}];const _0x3dd4ad=serializeDef(_0x2235a7);return writeFileSync(_0x30c001,_0x3dd4ad,'utf-8'),console[_0x57dc61(0xf5)](a29_0x348113[_0x57dc61(0x16f)]('✔')+_0x57dc61(0x1fa)+a29_0x348113['cyan'](_0x30c001)),(!_0x2235a7['realtime']||_0x5b7549[_0x57dc61(0x1e6)](_0x57dc61(0x10e))===-0x1)&&console['error'](a29_0x348113['green']('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console['error']('\x0a'+a29_0x348113[_0x57dc61(0xb0)]('Next\x20steps:')),console['error'](_0x57dc61(0x104)+_0x30c001+_0x57dc61(0xba)),console[_0x57dc61(0xf5)](_0x57dc61(0xc5)+a29_0x348113[_0x57dc61(0xb0)](_0x57dc61(0xc2)+_0x492797)+_0x57dc61(0x184)),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_0x1c9684=a30_0x513d;(function(_0x2534dd,_0x443c68){const _0x57871c=a30_0x513d,_0x47cc5a=_0x2534dd();while(!![]){try{const _0x3c05f3=-parseInt(_0x57871c(0x1c3))/0x1+-parseInt(_0x57871c(0x1e3))/0x2+-parseInt(_0x57871c(0x20e))/0x3+parseInt(_0x57871c(0x1fa))/0x4+-parseInt(_0x57871c(0x21e))/0x5*(parseInt(_0x57871c(0x1cd))/0x6)+parseInt(_0x57871c(0x1f9))/0x7+parseInt(_0x57871c(0x217))/0x8;if(_0x3c05f3===_0x443c68)break;else _0x47cc5a['push'](_0x47cc5a['shift']());}catch(_0x42e953){_0x47cc5a['push'](_0x47cc5a['shift']());}}}(a30_0x2db7,0x6620f));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a30_0x513d(_0x4fe25b,_0x11726e){_0x4fe25b=_0x4fe25b-0x1b9;const _0x2db767=a30_0x2db7();let _0x513d9b=_0x2db767[_0x4fe25b];return _0x513d9b;}import{getConfigDir}from'../core/config.js';import*as a30_0x22283e from'node:path';function a30_0x2db7(){const _0x2ea614=['VALID_KEYS','✗\x20Validation\x20failed:\x20','Enter\x20description\x20(optional):','Profile\x20name\x20cannot\x20be\x20empty','yellow','validate','message','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','getUserInfo','1512852FxYxRp','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aAvailable\x20profiles:','log','session','Removal\x20cancelled','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','9956328XcfyTy','split','logLevel','tdx:\x20profile\x20create','includes','Changing\x20site\x20to\x20\x27','description','4465lEqZSU','\x20\x20(no\x20profiles\x20found)','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','text','Profile\x20\x27','green','red','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20created','Enter\x20profile\x20name:','\x0aSetup\x20cancelled','select','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','profile:use','\x20API\x20key\x20removed\x20from\x20system\x20keychain','jobs','other','115813XSDvRK','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20cannot\x20be\x20empty','name','error','profileName','llm_project','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','ERROR','dim','3894bXHRqT','Site\x20was\x20not\x20changed.','Enter\x20your\x20TD\x20API\x20key:','\x27\x20removed\x20from\x20configuration','\x20\x20tdx\x20--profile\x20','test','confirm','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','warn','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','/app/mp/ak','status','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','password','Validating\x20API\x20key...','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','bold','us01','email','\x27.\x0a\x0aValid\x20keys:\x20','Default\x20profile\x20set\x20to:\x20','734242itIOEQ','join','site','parent_segment','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Remove\x20a\x20profile','Failed\x20to\x20remove\x20profile:\x20','create','config','profile:remove','\x20API\x20key\x20is\x20valid\x20(User:\x20','Create\x20a\x20new\x20profile','Operation\x20cancelled','tdx.json','profile','trim','(cleared)','customSite','\x20Profile\x20\x27','\x27\x20updated:\x20','\x27\x20does\x20not\x20exist.','tdx:\x20profile\x20remove','4408110guPSXn','443292TbkuNn','Session\x20profile\x20set\x20to:\x20','Unknown\x20key\x20\x27','length','\x0aOperation\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20-\x20','(session:\x20','apiKey','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.'];a30_0x2db7=function(){return _0x2ea614;};return a30_0x2db7();}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_0x1bebe9 from'prompts';import a30_0x3b321a from'chalk';function validateProfileName(_0x532602){const _0x107566=a30_0x513d;if(!_0x532602||!_0x532602[_0x107566(0x1f2)]())return _0x107566(0x208);const _0x84f5ab=_0x532602[_0x107566(0x1f2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x107566(0x1d2)](_0x84f5ab))return _0x107566(0x1dd);if(profileExists(_0x84f5ab))return _0x107566(0x222)+_0x84f5ab+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]='profile:create';[a30_0x1c9684(0x21d)]=a30_0x1c9684(0x1ee);async[a30_0x1c9684(0x215)](_0xb1057){const _0x1b3ab9=a30_0x1c9684,{options:_0x25dea6,args:_0x794f92}=_0xb1057;console[_0x1b3ab9(0x212)](a30_0x3b321a[_0x1b3ab9(0x1de)](_0x1b3ab9(0x21a)));let _0xd6e4b4;if(_0x794f92[_0x1b3ab9(0x1fd)]>0x0&&_0x794f92[0x0]){const _0x40634f=_0x794f92[0x0][_0x1b3ab9(0x1f2)](),_0x8eb4ac=validateProfileName(_0x40634f);if(_0x8eb4ac!==!![])return console[_0x1b3ab9(0x1c7)](a30_0x3b321a[_0x1b3ab9(0x224)](_0x8eb4ac)),0x1;_0xd6e4b4=_0x40634f;}else{const _0x56589c=await a30_0x1bebe9({'type':_0x1b3ab9(0x221),'name':_0x1b3ab9(0x1c8),'message':_0x1b3ab9(0x1ba),'validate':validateProfileName});if(!_0x56589c[_0x1b3ab9(0x1c8)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0xd6e4b4=_0x56589c[_0x1b3ab9(0x1c8)]['trim']();}const _0xcaa4cb=await a30_0x1bebe9({'type':'text','name':_0x1b3ab9(0x21d),'message':_0x1b3ab9(0x207)}),_0x54bd79=_0xcaa4cb['description']?.[_0x1b3ab9(0x1f2)]()||undefined,_0x27f6a6=_0x25dea6[_0x1b3ab9(0x1e5)]||_0x1b3ab9(0x1df),{choices:_0x40bd5b,initialIndex:_0x476160}=buildSiteChoices(_0x27f6a6),_0x21cc1a=await a30_0x1bebe9({'type':_0x1b3ab9(0x1bc),'name':_0x1b3ab9(0x1e5),'message':_0x1b3ab9(0x20c)+_0xd6e4b4+'\x27:','choices':_0x40bd5b,'initial':_0x476160});if(!_0x21cc1a['site'])return console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1bb)),0x1;let _0x2975ea;if(_0x21cc1a['site']===_0x1b3ab9(0x1c2)){const _0x2b6525=await a30_0x1bebe9({'type':_0x1b3ab9(0x221),'name':_0x1b3ab9(0x1f4),'message':'Enter\x20site\x20name:','initial':_0x1b3ab9(0x1df),'validate':_0x1b186b=>{const _0x6b8e01=_0x1b3ab9;if(!_0x1b186b||!_0x1b186b[_0x6b8e01(0x1f2)]())return _0x6b8e01(0x1c5);if(!/^[a-z0-9-]+$/[_0x6b8e01(0x1d2)](_0x1b186b['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x2b6525[_0x1b3ab9(0x1f4)])return console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1bb)),0x1;_0x2975ea=_0x2b6525[_0x1b3ab9(0x1f4)];}else _0x2975ea=_0x21cc1a[_0x1b3ab9(0x1e5)];const _0x4bd64e=resolveSite(_0x2975ea);console[_0x1b3ab9(0x212)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4bd64e),console[_0x1b3ab9(0x212)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1b3ab9(0x212)]('\x20\x20'+getConsoleUrl(_0x4bd64e,'/app/mp/ak'));const _0x5d8aa7=await a30_0x1bebe9({'type':_0x1b3ab9(0x1db),'name':_0x1b3ab9(0x203),'message':_0x1b3ab9(0x1cf),'validate':_0x5c42ed=>{const _0x56dd9c=_0x1b3ab9;if(!_0x5c42ed||!_0x5c42ed[_0x56dd9c(0x1f2)]())return _0x56dd9c(0x1c4);return!![];}});if(!_0x5d8aa7[_0x1b3ab9(0x203)])return console[_0x1b3ab9(0x212)]('\x0aSetup\x20cancelled'),0x1;const _0x20856f=_0x5d8aa7[_0x1b3ab9(0x203)];console['log'](_0x1b3ab9(0x1dc));try{const _0x4e32a3=TDX[_0x1b3ab9(0x1ea)]({'site':_0x4bd64e,'apiKey':_0x20856f[_0x1b3ab9(0x1f2)](),'logLevel':_0x25dea6[_0x1b3ab9(0x219)]??LogLevel['ERROR']}),_0x4ee7c6=await _0x4e32a3['jobs'][_0x1b3ab9(0x20d)]();console['log'](a30_0x3b321a[_0x1b3ab9(0x223)]('✓')+_0x1b3ab9(0x1ed)+_0x4ee7c6[_0x1b3ab9(0x1e0)]+')');const _0x430c58=await isKeychainAvailable();_0x430c58?(await saveAPIKeyAsync(_0x20856f['trim'](),_0x4bd64e,_0xd6e4b4),console[_0x1b3ab9(0x212)](a30_0x3b321a[_0x1b3ab9(0x223)]('✓')+_0x1b3ab9(0x220)+_0xd6e4b4+')')):(console[_0x1b3ab9(0x1d6)](a30_0x3b321a['yellow'](_0x1b3ab9(0x204))),console[_0x1b3ab9(0x1d6)](a30_0x3b321a[_0x1b3ab9(0x209)](_0x1b3ab9(0x20f))));const _0x303406={'site':_0x4bd64e,..._0x54bd79&&{'description':_0x54bd79}};return saveProfileToUserConfig(_0xd6e4b4,_0x303406),console['log'](a30_0x3b321a[_0x1b3ab9(0x223)]('✓')+_0x1b3ab9(0x1f5)+_0xd6e4b4+_0x1b3ab9(0x1b9)),console[_0x1b3ab9(0x212)](),console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1da)),console[_0x1b3ab9(0x212)]('\x20\x20tdx\x20--profile\x20'+_0xd6e4b4+_0x1b3ab9(0x1d5)),console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1d1)+_0xd6e4b4+_0x1b3ab9(0x1d4)),0x0;}catch(_0x2ca401){if(_0x2ca401 instanceof HTTPClientError&&_0x2ca401[_0x1b3ab9(0x1d9)]===0x191)return printAuthError(_0x2ca401),0x1;return console['error'](a30_0x3b321a[_0x1b3ab9(0x224)](_0x1b3ab9(0x206)+(_0x2ca401 instanceof Error?_0x2ca401[_0x1b3ab9(0x20b)]:String(_0x2ca401)))),console[_0x1b3ab9(0x1c7)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]=a30_0x1c9684(0x1ec);['description']=a30_0x1c9684(0x1e8);['validate'](_0xb8dc82){const _0xa5e6ed=a30_0x1c9684,{args:_0x238571}=_0xb8dc82;if(_0x238571['length']===0x0)return _0xa5e6ed(0x216);return undefined;}async['execute'](_0x3512b1){const _0x46ce45=a30_0x1c9684,{args:_0x458714}=_0x3512b1,_0xb502e5=_0x458714[0x0];console['log'](a30_0x3b321a['bold'](_0x46ce45(0x1f8)));if(!profileExists(_0xb502e5)){console[_0x46ce45(0x1c7)](a30_0x3b321a[_0x46ce45(0x224)]('Profile\x20\x27'+_0xb502e5+_0x46ce45(0x1f7))),console[_0x46ce45(0x212)](_0x46ce45(0x211));const _0x59407d=listProfiles();if(_0x59407d[_0x46ce45(0x1fd)]===0x0)console[_0x46ce45(0x212)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xab2387 of _0x59407d){console[_0x46ce45(0x212)](_0x46ce45(0x201)+_0xab2387[_0x46ce45(0x1c6)]);}return 0x1;}const _0x5edfb6=await a30_0x1bebe9({'type':_0x46ce45(0x1d3),'name':'confirm','message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xb502e5+'\x27?','initial':![]});if(!_0x5edfb6[_0x46ce45(0x1d3)])return console[_0x46ce45(0x212)](_0x46ce45(0x214)),0x0;try{removeProfileFromUserConfig(_0xb502e5),console[_0x46ce45(0x212)](a30_0x3b321a['green']('✓')+_0x46ce45(0x1f5)+_0xb502e5+_0x46ce45(0x1d0));}catch(_0x589e29){return console[_0x46ce45(0x1c7)](a30_0x3b321a[_0x46ce45(0x224)](_0x46ce45(0x1e9)+(_0x589e29 instanceof Error?_0x589e29[_0x46ce45(0x20b)]:String(_0x589e29)))),0x1;}const _0xac2e55=await isKeychainAvailable();if(_0xac2e55){const _0x4cc826=await deleteKeychainAPIKey(_0xb502e5);_0x4cc826&&console['log'](a30_0x3b321a[_0x46ce45(0x223)]('✓')+_0x46ce45(0x1c0));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]='profile:set';[a30_0x1c9684(0x21d)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a30_0x1c9684(0x1e5),'database',a30_0x1c9684(0x1e6),a30_0x1c9684(0x1c9),'llm_agent','description'];[a30_0x1c9684(0x20a)](_0x279490){const _0x5c955f=a30_0x1c9684,{args:_0x1eadd5,options:_0x3d47f5}=_0x279490,_0x178558=_0x3d47f5[_0x5c955f(0x1f1)]||getActiveProfile();if(!_0x178558)return _0x5c955f(0x1be);if(_0x1eadd5[_0x5c955f(0x1fd)]===0x0)return _0x5c955f(0x1bd)+ProfileSetCommand[_0x5c955f(0x205)][_0x5c955f(0x1e4)](',\x20');const _0x6a0569=_0x1eadd5[0x0];if(!_0x6a0569[_0x5c955f(0x21b)]('='))return _0x5c955f(0x1ca)+ProfileSetCommand['VALID_KEYS'][_0x5c955f(0x1e4)](',\x20');const [_0x1decf1]=_0x6a0569['split']('=',0x2);if(!ProfileSetCommand[_0x5c955f(0x205)][_0x5c955f(0x21b)](_0x1decf1))return _0x5c955f(0x1fc)+_0x1decf1+_0x5c955f(0x1e1)+ProfileSetCommand[_0x5c955f(0x205)][_0x5c955f(0x1e4)](',\x20');return undefined;}async[a30_0x1c9684(0x215)](_0x7dbefe){const _0x5605d9=a30_0x1c9684,{args:_0xcc3c60,options:_0x14342c}=_0x7dbefe,_0x3e10a1=_0x14342c['profile']||getActiveProfile(),[_0xf2a372,..._0x5121f3]=_0xcc3c60[0x0][_0x5605d9(0x218)]('='),_0x25e810=_0x5121f3['join']('=');console[_0x5605d9(0x212)](a30_0x3b321a[_0x5605d9(0x1de)]('tdx:\x20profile\x20set'));if(!profileExists(_0x3e10a1)){const _0xb99f51=await a30_0x1bebe9({'type':_0x5605d9(0x1d3),'name':_0x5605d9(0x1ea),'message':'Profile\x20\x27'+_0x3e10a1+_0x5605d9(0x200),'initial':!![]});if(!_0xb99f51[_0x5605d9(0x1ea)])return console[_0x5605d9(0x212)](_0x5605d9(0x1ef)),0x1;}const _0x3e5661=loadProfile(_0x3e10a1),_0x3cee4c=_0x3e5661?.[_0x5605d9(0x1eb)]||{};if(_0xf2a372===_0x5605d9(0x1e5)){const _0x15a3ed=resolveSite(_0x25e810);console['log'](_0x5605d9(0x21c)+_0x15a3ed+_0x5605d9(0x225)),console['log'](_0x5605d9(0x1e7)),console[_0x5605d9(0x212)]('\x20\x20'+getConsoleUrl(_0x15a3ed,_0x5605d9(0x1d8)));const _0x1f7b74=await a30_0x1bebe9({'type':_0x5605d9(0x1db),'name':_0x5605d9(0x203),'message':_0x5605d9(0x1d7),'validate':_0x24babb=>{const _0x23300a=_0x5605d9;if(!_0x24babb||!_0x24babb['trim']())return _0x23300a(0x1c4);return!![];}});if(!_0x1f7b74[_0x5605d9(0x203)])return console[_0x5605d9(0x212)](_0x5605d9(0x1fe)),0x1;console['log'](_0x5605d9(0x1dc));try{const _0x229473=TDX[_0x5605d9(0x1ea)]({'site':_0x15a3ed,'apiKey':_0x1f7b74[_0x5605d9(0x203)]['trim'](),'logLevel':_0x14342c[_0x5605d9(0x219)]??LogLevel[_0x5605d9(0x1cb)]}),_0x561d48=await _0x229473[_0x5605d9(0x1c1)][_0x5605d9(0x20d)]();console['log'](a30_0x3b321a[_0x5605d9(0x223)]('✓')+_0x5605d9(0x1ed)+_0x561d48[_0x5605d9(0x1e0)]+')');const _0x1ca7b4=await isKeychainAvailable();_0x1ca7b4?(await saveAPIKeyAsync(_0x1f7b74[_0x5605d9(0x203)][_0x5605d9(0x1f2)](),_0x15a3ed,_0x3e10a1),console[_0x5605d9(0x212)](a30_0x3b321a['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x5605d9(0x1d6)](a30_0x3b321a[_0x5605d9(0x209)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3cee4c[_0x5605d9(0x1e5)]=_0x15a3ed;}catch(_0x129d55){if(_0x129d55 instanceof HTTPClientError&&_0x129d55['status']===0x191)return printAuthError(_0x129d55),0x1;return console[_0x5605d9(0x1c7)](a30_0x3b321a[_0x5605d9(0x224)]('✗\x20Validation\x20failed:\x20'+(_0x129d55 instanceof Error?_0x129d55[_0x5605d9(0x20b)]:String(_0x129d55)))),console[_0x5605d9(0x1c7)](_0x5605d9(0x1ce)),0x1;}}else _0x3cee4c[_0xf2a372]=_0x25e810||undefined;return saveProfileToUserConfig(_0x3e10a1,_0x3cee4c),console[_0x5605d9(0x212)](a30_0x3b321a[_0x5605d9(0x223)]('✓')+_0x5605d9(0x1f5)+_0x3e10a1+_0x5605d9(0x1f6)+_0xf2a372+'='+(_0x25e810||_0x5605d9(0x1f3))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]=a30_0x1c9684(0x1bf);[a30_0x1c9684(0x21d)]='Set\x20session\x20profile';[a30_0x1c9684(0x20a)](_0x1ddc3f){const _0x568cb4=a30_0x1c9684,{args:_0x233075}=_0x1ddc3f;if(_0x233075[_0x568cb4(0x1fd)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a30_0x1c9684(0x215)](_0x30b9fd){const _0x3a4ac6=a30_0x1c9684,{args:_0xfeb884,options:_0x53b46e}=_0x30b9fd,_0x359071=_0xfeb884[0x0],_0x541e45=_0x53b46e['default'];cleanExpiredSessions();if(!profileExists(_0x359071)){console[_0x3a4ac6(0x1c7)](a30_0x3b321a[_0x3a4ac6(0x224)](_0x3a4ac6(0x222)+_0x359071+_0x3a4ac6(0x1f7))),console['log'](_0x3a4ac6(0x211));const _0x53406b=listProfiles();if(_0x53406b[_0x3a4ac6(0x1fd)]===0x0)console['log'](_0x3a4ac6(0x21f));else for(const _0x158a01 of _0x53406b){console[_0x3a4ac6(0x212)](_0x3a4ac6(0x201)+_0x158a01[_0x3a4ac6(0x1c6)]);}return 0x1;}if(_0x541e45){const _0x3d47c1=a30_0x22283e[_0x3a4ac6(0x1e4)](getConfigDir(),_0x3a4ac6(0x1f0));return saveActiveProfileToUserConfig(_0x359071),console[_0x3a4ac6(0x212)](_0x3a4ac6(0x1e2)+a30_0x3b321a['green'](_0x359071)),console['log'](a30_0x3b321a[_0x3a4ac6(0x1cc)]('\x0aSaved\x20to:\x20'+_0x3d47c1)),0x0;}const _0x27472c=getSessionID(_0x53b46e[_0x3a4ac6(0x213)]);return saveSessionContext({'profile':_0x359071},_0x53b46e['session']),console[_0x3a4ac6(0x212)](_0x3a4ac6(0x1fb)+a30_0x3b321a['green'](_0x359071)+'\x20'+a30_0x3b321a[_0x3a4ac6(0x1cc)](_0x3a4ac6(0x202)+_0x27472c+')')),console[_0x3a4ac6(0x212)](a30_0x3b321a[_0x3a4ac6(0x1cc)](_0x3a4ac6(0x210)+_0x359071+_0x3a4ac6(0x1ff))),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_0xf3e456=a31_0x3392;function a31_0x3392(_0x102932,_0x561815){_0x102932=_0x102932-0x182;const _0x2920b4=a31_0x2920();let _0x33926b=_0x2920b4[_0x102932];return _0x33926b;}(function(_0x1f0b03,_0x6e807c){const _0x57f843=a31_0x3392,_0xf5856b=_0x1f0b03();while(!![]){try{const _0x591627=parseInt(_0x57f843(0x195))/0x1+parseInt(_0x57f843(0x182))/0x2*(parseInt(_0x57f843(0x194))/0x3)+parseInt(_0x57f843(0x189))/0x4*(parseInt(_0x57f843(0x18c))/0x5)+-parseInt(_0x57f843(0x191))/0x6+parseInt(_0x57f843(0x185))/0x7+parseInt(_0x57f843(0x196))/0x8*(parseInt(_0x57f843(0x190))/0x9)+-parseInt(_0x57f843(0x18e))/0xa;if(_0x591627===_0x6e807c)break;else _0xf5856b['push'](_0xf5856b['shift']());}catch(_0x926cc6){_0xf5856b['push'](_0xf5856b['shift']());}}}(a31_0x2920,0x3279f));function a31_0x2920(){const _0x55bd26=['message','2460330sOqgJl','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','7263FkFNYq','738366ZiXwys','Error:\x20','name','60774dtrDfX','58998TbSkxd','456DyEkBk','2pKUnmr','description','log','1853075tPfyam','map','config','length','148692oTnfsc','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','error','25nOrcwQ'];a31_0x2920=function(){return _0x55bd26;};return a31_0x2920();}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{['name']='profiles';[a31_0xf3e456(0x183)]='List\x20all\x20available\x20profiles';async['execute'](_0x527db2){const _0x166dd3=a31_0xf3e456,{options:_0x4ab55e}=_0x527db2;try{const _0x457466=listProfiles(),_0x331a6f=getActiveProfile();if(_0x457466[_0x166dd3(0x188)]===0x0)return console['log'](_0x166dd3(0x18a)),console[_0x166dd3(0x184)](_0x166dd3(0x18f)),console[_0x166dd3(0x184)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2ce455=_0x457466[_0x166dd3(0x186)](_0x393869=>{const _0x16d479=_0x166dd3,_0x4afd56=_0x393869[_0x16d479(0x193)]===_0x331a6f,_0x5ab246=getProfileParams(_0x393869[_0x16d479(0x187)]);return{'name':_0x393869[_0x16d479(0x193)],'active':_0x4afd56,'scope':_0x393869['scope'],'description':_0x393869[_0x16d479(0x187)][_0x16d479(0x183)]||'','params':_0x5ab246};});return await handleSDKOutput(_0x2ce455,_0x4ab55e),0x0;}catch(_0x1a71db){return _0x1a71db instanceof Error&&console[_0x166dd3(0x18b)](_0x166dd3(0x192)+_0x1a71db[_0x166dd3(0x18d)]),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_0x465a96=a32_0x2c68;(function(_0xcc8ab2,_0x5e6e62){const _0x89a1a3=a32_0x2c68,_0x106528=_0xcc8ab2();while(!![]){try{const _0x6a3f4c=-parseInt(_0x89a1a3(0x191))/0x1+parseInt(_0x89a1a3(0x199))/0x2*(-parseInt(_0x89a1a3(0x186))/0x3)+parseInt(_0x89a1a3(0x19e))/0x4+parseInt(_0x89a1a3(0x19c))/0x5*(parseInt(_0x89a1a3(0x17e))/0x6)+parseInt(_0x89a1a3(0x18f))/0x7*(-parseInt(_0x89a1a3(0x1a1))/0x8)+parseInt(_0x89a1a3(0x195))/0x9*(parseInt(_0x89a1a3(0x180))/0xa)+parseInt(_0x89a1a3(0x171))/0xb*(parseInt(_0x89a1a3(0x194))/0xc);if(_0x6a3f4c===_0x5e6e62)break;else _0x106528['push'](_0x106528['shift']());}catch(_0x2b57f1){_0x106528['push'](_0x106528['shift']());}}}(a32_0x30ac,0xbd876));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a32_0x2c68(_0xdf7658,_0x424a45){_0xdf7658=_0xdf7658-0x16f;const _0x30ac0c=a32_0x30ac();let _0x2c68a9=_0x30ac0c[_0xdf7658];return _0x2c68a9;}import{formatRows}from'../sdk/util/formatters.js';function a32_0x30ac(){const _0x4c648f=['80EewvIj','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','length','setPhase','90937YzhsUK','catalog','Schema:\x20','message','description','\x0aAll\x20results\x20saved\x20to\x20','\x20rows\x20','processedRows','push','Executing\x20query...','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','args','1528806HHKOJF','information_schema','3075290VjKpsC','jobId','execute','elapsedTimeMillis','file','validate','69VSrNyv','totalSplits','output','stats','query','database','No\x20SQL\x20provided','verbose','...','929712VIlleP','site','620952BdWDmS','Statement\x20','data','264kbdYEi','18XNVxoW','error','Run\x20Trino\x20queries\x20(streaming)','setExtra','45446gxyVkp','Site:\x20','setJobId','25MfDhOH','\x20splits','4708456RcDswU','Executing\x20query\x20[','in\x20'];a32_0x30ac=function(){return _0x4c648f;};return a32_0x30ac();}export class QueryCommand extends BaseCommand{['name']=a32_0x465a96(0x18a);[a32_0x465a96(0x175)]=a32_0x465a96(0x197);async[a32_0x465a96(0x182)](_0x2e4587){const _0x4460e9=a32_0x465a96,{options:_0x247f70,args:_0x119064,tdx:_0x13f9f7}=_0x2e4587,_0x3c6ddb={..._0x247f70,'limitStructuredFormats':!![]},_0x317c5b=_0x119064[0x0],_0x53558a=_0x247f70[_0x4460e9(0x184)];let _0x1b6864;try{if(_0x53558a)_0x1b6864=readSqlStatementsFromFile(_0x53558a);else{if(_0x317c5b==='-')_0x1b6864=await readSqlStatementsFromStdin();else{if(_0x317c5b&&isSqlFilePath(_0x317c5b))_0x1b6864=readSqlStatementsFromFile(_0x317c5b);else{if(_0x317c5b)_0x1b6864=splitSqlStatements(_0x317c5b);else throw new Error(_0x4460e9(0x18c));}}}}catch(_0x454cb4){return console[_0x4460e9(0x196)]('Error:\x20'+_0x454cb4[_0x4460e9(0x174)]),0x1;}const _0x1a7ae0=_0x247f70[_0x4460e9(0x18b)]||_0x4460e9(0x17f),_0x5e6df0=_0x247f70[_0x4460e9(0x172)];try{const _0x195e5c=[],_0x10d12e=!!_0x247f70[_0x4460e9(0x188)];for(let _0x59485c=0x0;_0x59485c<_0x1b6864[_0x4460e9(0x16f)];_0x59485c++){const _0x21d59a=_0x1b6864[_0x59485c],_0x2268e2=_0x59485c+0x1,_0x10070b=_0x1b6864[_0x4460e9(0x16f)],_0x3d4c05=_0x10070b>0x1;_0x247f70[_0x4460e9(0x18d)]&&(console[_0x4460e9(0x196)]('\x0a'+(_0x3d4c05?_0x4460e9(0x192)+_0x2268e2+'/'+_0x10070b+':':'')),console['error'](_0x4460e9(0x19a)+_0x247f70[_0x4460e9(0x190)]),console[_0x4460e9(0x196)](_0x4460e9(0x17c)+(_0x5e6df0||'td')),console[_0x4460e9(0x196)](_0x4460e9(0x173)+_0x1a7ae0),console[_0x4460e9(0x196)]('SQL:\x20'+_0x21d59a));const _0x3174d9=_0x3d4c05?'Executing\x20statement\x20'+_0x2268e2+'/'+_0x10070b+_0x4460e9(0x18e):_0x4460e9(0x17a);try{const _0x29e2e1=await withProgressSpinner(_0x3174d9,async _0x56951b=>{const _0x595428=_0x4460e9,_0x489656=await _0x13f9f7[_0x595428(0x18a)][_0x595428(0x182)](_0x21d59a,{'catalog':_0x5e6df0,'schema':_0x1a7ae0,'onJobId':_0x40792a=>{const _0x5858dd=_0x595428;_0x56951b[_0x5858dd(0x19b)](_0x40792a);},'onProgress':_0x2c49c1=>{const _0x385edd=_0x595428;_0x56951b[_0x385edd(0x170)](_0x385edd(0x19f)+_0x2c49c1['state']+']'),_0x56951b[_0x385edd(0x198)](formatRows(_0x2c49c1[_0x385edd(0x178)])+_0x385edd(0x177)+_0x2c49c1['completedSplits']+'/'+_0x2c49c1[_0x385edd(0x187)]+_0x385edd(0x19d));}});return _0x489656;},{'verbose':_0x247f70[_0x4460e9(0x18d)]}),_0x1b6fd1=_0x29e2e1[_0x4460e9(0x193)],_0x68d2e2=_0x1b6fd1[_0x4460e9(0x181)]?'\x20[Job\x20ID:\x20'+_0x1b6fd1['jobId']+']':'',_0x41fefb=_0x3d4c05?'Statement\x20'+_0x2268e2+'/'+_0x10070b+'\x20-\x20':'';console[_0x4460e9(0x196)]('✔\x20'+_0x41fefb+'Query\x20completed:\x20Processed\x20'+formatRows(_0x1b6fd1[_0x4460e9(0x189)]['processedRows'])+'\x20rows\x20'+(_0x4460e9(0x1a0)+formatElapsed(_0x1b6fd1[_0x4460e9(0x189)][_0x4460e9(0x183)])+_0x68d2e2));if(_0x3d4c05&&_0x10d12e){const _0x5d2fee=resolveOutputOptions(_0x3c6ddb),_0x792e47=await formatQueryOutput(_0x1b6fd1,_0x5d2fee);_0x195e5c[_0x4460e9(0x179)](_0x792e47);}else await handleQueryOutput(_0x1b6fd1,_0x3c6ddb);}catch(_0xe3cc43){const _0x92754d=_0x3d4c05?'Statement\x20'+_0x2268e2+'/'+_0x10070b+':\x0a':'',_0x274640=_0xe3cc43 instanceof SDKError?_0xe3cc43['originalMessage']:_0xe3cc43[_0x4460e9(0x174)];return console[_0x4460e9(0x196)](''+_0x92754d+_0x274640),0x1;}}if(_0x1b6864[_0x4460e9(0x16f)]>0x1&&_0x10d12e&&_0x195e5c['length']>0x0){const _0x5b5507=_0x195e5c['join']('\x0a');writeFileSync(_0x247f70[_0x4460e9(0x188)],_0x5b5507),console[_0x4460e9(0x196)](_0x4460e9(0x176)+_0x247f70['output']);}return 0x0;}catch(_0xd78ac){throw _0xd78ac;}}[a32_0x465a96(0x185)](_0x279462){const _0x5826e5=a32_0x465a96,_0xe217c5=_0x279462[_0x5826e5(0x17d)][0x0],_0x47d059=_0x279462['options'][_0x5826e5(0x184)];if(!_0xe217c5&&!_0x47d059)return _0x5826e5(0x1a2);if(_0xe217c5&&_0x47d059)return _0x5826e5(0x17b);return undefined;}}