@treasuredata/tdx 2026.3.24 → 2026.3.26

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 (206) 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/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.d.ts +5 -0
  156. package/dist/sdk/segment.d.ts.map +1 -1
  157. package/dist/sdk/segment.js +1 -1
  158. package/dist/sdk/segment.js.map +1 -1
  159. package/dist/sdk/types/index.js +1 -1
  160. package/dist/sdk/types/progress.js +1 -1
  161. package/dist/sdk/user.js +1 -1
  162. package/dist/sdk/util/format-detector.js +1 -1
  163. package/dist/sdk/util/formatters.js +1 -1
  164. package/dist/sdk/util/index.js +1 -1
  165. package/dist/sdk/util/paginate.js +1 -1
  166. package/dist/sdk/util/tree-formatter.js +1 -1
  167. package/dist/sdk/workflow/archive-validation.js +1 -1
  168. package/dist/sdk/workflow/clone-workflow.js +1 -1
  169. package/dist/sdk/workflow/index.js +1 -1
  170. package/dist/sdk/workflow/pull-workflow.js +1 -1
  171. package/dist/sdk/workflow/push-workflow.js +1 -1
  172. package/dist/sdk/workflow/tdx-config.js +1 -1
  173. package/dist/sdk/workflow/workflow-utils.js +1 -1
  174. package/dist/test-utils/command-runner.js +1 -1
  175. package/dist/test-utils/factories.js +1 -1
  176. package/dist/test-utils/fixtures.js +1 -1
  177. package/dist/test-utils/http-mock.js +1 -1
  178. package/dist/test-utils/index.js +1 -1
  179. package/dist/utils/async.js +1 -1
  180. package/dist/utils/colors.js +1 -1
  181. package/dist/utils/diff.js +1 -1
  182. package/dist/utils/file-permissions.js +1 -1
  183. package/dist/utils/file-reader.js +1 -1
  184. package/dist/utils/github-releases.js +1 -1
  185. package/dist/utils/global-cache.js +1 -1
  186. package/dist/utils/json-loader.js +1 -1
  187. package/dist/utils/local-cache.js +1 -1
  188. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  189. package/dist/utils/logger/formatters/index.js +1 -1
  190. package/dist/utils/logger/handlers/console-handler.js +1 -1
  191. package/dist/utils/logger/handlers/file-handler.js +1 -1
  192. package/dist/utils/logger/handlers/index.js +1 -1
  193. package/dist/utils/logger/handlers/null-handler.js +1 -1
  194. package/dist/utils/logger/index.js +1 -1
  195. package/dist/utils/logger/logger.js +1 -1
  196. package/dist/utils/logger/types.js +1 -1
  197. package/dist/utils/option-validation.js +1 -1
  198. package/dist/utils/process.js +1 -1
  199. package/dist/utils/prompt.js +1 -1
  200. package/dist/utils/spinner.js +1 -1
  201. package/dist/utils/sse-parser.js +1 -1
  202. package/dist/utils/string-utils.js +1 -1
  203. package/dist/utils/table-ref-parser.js +1 -1
  204. package/dist/utils/tdx-logger.js +1 -1
  205. package/dist/utils/version-check.js +1 -1
  206. package/package.json +1 -1
@@ -1 +1 @@
1
- const a30_0x519256=a30_0x4a69;(function(_0x384a12,_0x3ba622){const _0x4013a0=a30_0x4a69,_0x5bdb3b=_0x384a12();while(!![]){try{const _0x45c002=parseInt(_0x4013a0(0x27e))/0x1*(parseInt(_0x4013a0(0x199))/0x2)+-parseInt(_0x4013a0(0x24e))/0x3*(-parseInt(_0x4013a0(0x26b))/0x4)+-parseInt(_0x4013a0(0x215))/0x5*(-parseInt(_0x4013a0(0x292))/0x6)+parseInt(_0x4013a0(0x218))/0x7*(parseInt(_0x4013a0(0x11f))/0x8)+-parseInt(_0x4013a0(0x176))/0x9+parseInt(_0x4013a0(0x28b))/0xa*(parseInt(_0x4013a0(0x121))/0xb)+parseInt(_0x4013a0(0x1e6))/0xc*(-parseInt(_0x4013a0(0x19b))/0xd);if(_0x45c002===_0x3ba622)break;else _0x5bdb3b['push'](_0x5bdb3b['shift']());}catch(_0x246d06){_0x5bdb3b['push'](_0x5bdb3b['shift']());}}}(a30_0x19f9,0xc015d));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x5a457f 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 a30_0x3a0c62 from'chalk';function a30_0x4a69(_0xe7e167,_0x32d2d4){_0xe7e167=_0xe7e167-0x10f;const _0x19f9e7=a30_0x19f9();let _0x4a6975=_0x19f9e7[_0xe7e167];return _0x4a6975;}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=a30_0x519256(0x1a8),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x4526d9){const _0x9b71e7=a30_0x519256,_0x4f5b03=process[_0x9b71e7(0x1d8)],_0x200fda=_0x4f5b03===_0x9b71e7(0x11b)?_0x9b71e7(0x214):_0x4f5b03===_0x9b71e7(0x111)?_0x9b71e7(0x14a):_0x9b71e7(0x1f9);spawn(_0x200fda,[_0x4526d9],{'detached':!![],'stdio':_0x9b71e7(0x196)})[_0x9b71e7(0x1ac)]();}function migrateLegacyDirectory(){const _0x462570=a30_0x519256;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3f0b32=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3f0b32[_0x462570(0x228)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x462570(0x1f4)](a30_0x3a0c62[_0x462570(0x289)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x462570(0x198)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x462570(0x1f4)](a30_0x3a0c62['dim'](_0x462570(0x1fe)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x462570(0x1f4)](a30_0x3a0c62[_0x462570(0x289)](_0x462570(0x1d9)+LEGACY_PARENT_SEGMENT_DIR+_0x462570(0x22b)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x462570(0x1f4)](a30_0x3a0c62[_0x462570(0x1f6)](_0x462570(0x27d)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x1e95d2){const _0x3a9f10=_0x1e95d2 instanceof Error?_0x1e95d2[_0x462570(0x139)]:String(_0x1e95d2);return console[_0x462570(0x1f4)](a30_0x3a0c62['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x3a9f10+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x519256(0x23e)](_0x452108){return migrateLegacyDirectory(),super['run'](_0x452108);}}function resolveYamlFile(_0x49a5a8){const _0x42b821=a30_0x519256;if(_0x49a5a8[_0x42b821(0x193)](_0x42b821(0x1e0))||_0x49a5a8['endsWith']('.yaml'))return _0x49a5a8;return a30_0x5a457f[_0x42b821(0x16f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x49a5a8)+_0x42b821(0x1e0));}function formatProgressMessage(_0x29afce){const _0x545655=a30_0x519256,_0x2b7588=_0x29afce[_0x545655(0x114)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2b7588){const [,_0x13e36f,_0x21ff13,_0x1259fe='']=_0x2b7588;return a30_0x3a0c62[_0x545655(0x1f3)](_0x13e36f+':')+'\x20'+_0x21ff13+a30_0x3a0c62[_0x545655(0x1f3)](_0x1259fe);}return a30_0x3a0c62[_0x545655(0x1f3)](_0x29afce);}function a30_0x19f9(){const _0x349a36=['personalization','endsWith','formatSchemaJson','\x20\x20Database:\x20','ignore','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','/\x20and\x20','202QCaRKs','segment:parent:validate','130izXvyV','Attribute:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:pull','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20\x20\x20','realtime','Master:','in\x20','Error\x20parsing\x20YAML:\x20','rowCount','use','\x20configured','parent_segments','length','Fetching\x20parent\x20segment\x20\x27','Fetching\x20sample\x20data...','unref','\x20\x20Tables:\x201\x20customers\x20+\x20','indexOf','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20Context\x20set:\x20','Fetching\x20SQL\x20for\x20\x27','Create\x20parent\x20segment\x20\x27','\x20parent\x20segment','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x27\x20and\x20run\x20workflow?','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','YAML\x20file:\x20','Apply\x20changes\x20to\x20\x27','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','My\x20Service','segment','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','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','population','`\x20to\x20download\x20the\x20configuration\x20first','double','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','/sessions/','\x20\x20Columns:\x20','getParentFull','Schema\x20saved\x20to\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','errors','\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','interval','Source:','Options\x20(one\x20required):\x0a','column_type','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\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','displayAttributesStats','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','sampleData','\x20RT-enabled\x20parent\x20segment','platform','\x0a⚠️\x20\x20Migrating:\x20','displaySampleData','data','\x20Added\x20RT\x202.0\x20template\x20section','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','text','type','.yml','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','behaviors','Errors:','4570476ixrSow','%)\x20','format','jobId','Error:\x20Parent\x20segment\x20name\x20is\x20required','schemaError','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','sections','foreignKey','attribute','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','personalization_services','allValid','dim','error','addBehaviors','green','Site:\x20','session','xdg-open','\x20Added\x20personalization\x20template\x20to\x20','trigger_event','number','Customers:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','displayBehaviorsStats','\x27\x20is\x20up\x20to\x20date','Behavior:','valid','Error:\x20--behavior\x20requires\x20a\x20name\x0a','stop','user_id','resolveParentId','Fetching\x20customers\x20schema...','query','customers','Preview:','behavior','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Show\x20parent\x20segment\x20schema\x20(column\x20types)','pullParentYaml','Enriched:','repeat','filter','ps:pz:list','open','1240030BxykCX','idStitching','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','2163YqbyRb','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','bold','segment:parent:run','✔\x20Updated\x20parent\x20segment\x20\x27','jsonl','cyan','log','validateParentYaml','\x20\x202.\x20Run\x20','\x20service','\x20parent\x20segment\x20\x27','stats','timezone','List\x20parent\x20segments','Listing\x20RT-enabled\x20parent\x20segments...','isDirectory','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20to\x20push\x20the\x20configuration','/\x20→\x20','Pattern:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','scheduleType','addBehaviorsFile','enriched','\x0aNew\x20parent\x20segment\x20\x27','Master\x20+\x20Attributes','\x20personalization\x20service','Coverage:','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Name:\x20','reduce','workflowAttemptId','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x201.\x20Edit\x20','To\x20cancel:','toLowerCase','\x20Configuration\x20is\x20valid','run','collectSchema','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','customersWithEvents','Analyzing\x20changes...','displayColumns','sort','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','push','Created','parent_segment','\x0a\x20\x20\x20\x20]','schemaValid','Parent\x20segment:\x20','FINISHED','displayPreviewHints','3GOkesd','\x0aChanges\x20to\x20\x27','list','pushParentYaml','Validating\x20RT\x20configuration...','ID\x20Stitching:','segment:parent:list','parentSegment','\x20rows)','Creating\x20parent\x20segment\x20\x27','\x22\x20}','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','tdx\x20ps\x20preview\x20','\x27...','displaySummary','Error:\x20--database\x20and\x20--table\x20are\x20required','Error:\x20--attribute\x20requires\x20a\x20name\x0a','output','\x20=\x20','createParent','sourceTableError','execute','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','sourceTableValid','events','behaviorsFile','Listing\x20fields\x20for\x20\x27','getOutputDatabaseName','Default','2596792KVpDMe','Audience\x20ID:','true','Available\x20behaviors:','label','verbose','attributes','td_client_id','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','column','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','attributesFile','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','displayValidateResults','Error\x20reading\x20file:\x20','parent_id','apply','✔\x20Renamed\x20directory\x20to\x20','14221ZsRXTG','processedRows','totalEvents','\x20--attribute\x20\x22','all','Attributes:','customerGroupFile','Personalization:','updateParent','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Attributes','yellow','table','7070540ZRdVGq','getParentSQL','Available\x20attributes:','workflowSessionId','Creating','trim','<database>.<table>','24aQfPHu','getBehaviorNames','customerPercent','toFixed','displayPreviewResults','\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','win32','status','Session:','match','database','json','\x20behaviors','\x20--behavior\x20\x22','Updating\x20parent\x20segment\x20\x27','\x20is\x20already\x20up\x20to\x20date','darwin','\x20\x20\x20','Status:','Resolving\x20parent\x20segment\x20\x27','26416wrjbaO','tdx\x20ps\x20push\x20','22pTDnfl','keys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:fields','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','test','Rows:','localeCompare','\x20\x20Note:\x20','Personalization\x20service\x20description','RT\x202.0\x20Validate:','\x20RT\x20configuration\x20is\x20valid','Listing\x20parent\x20segments\x20matching\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','✔\x20Created\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','last_page_viewed','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','\x27\x20is\x20already\x20up\x20to\x20date','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Columns:','Overwrite\x20\x27','message','Show\x20parent\x20segment\x20details','behavior_','SELECT\x20*\x20FROM\x20(\x0a','Output\x20file:\x20','columns','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','✔\x20Found\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','{\x0a\x20\x20\x22database\x22:\x20\x22','Join:','Executing\x20parent\x20segment\x20query...','Output\x20Database:','replace','\x0aChanges\x20to\x20apply\x20to\x20\x27','No\x20parent\x20segments\x20found','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','start','displayRealtimeInfo','\x5c$&','utf-8','stitchingKeys','ps:rt:list','Behaviors','Found\x20YAML\x20file:\x20','toLocaleString','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','-1d','Events:','master','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Aborted.','coveragePercent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','column_name','/attempt/','yes','Validating\x20configuration...','Updated','information_schema','\x20--enriched','Next\x20steps:','realtime_enabled','Validate:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','realtime:','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','/app/dw/parentSegments/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20Opening\x20','limit','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','segment:parent:sql','join','using\x20the\x20default\x20path:\x20','displayMasterInfo','Database:\x20','Options:\x0a','customerGroup','\x0aError:','8248122QvVUJP','/app/workflows/','description','Error:','joinKey','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','scheduleOption','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','personalizationServices','site','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20+\x20[','\x20[Job\x20ID:\x20','Fetching\x20behavior\x20list...','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Join\x20on:','name','map','\x20\x20\x20\x20-\x20','Attempt:','✔\x20No\x20changes\x20-\x20\x27','matchedCount','\x20--attribute\x20\x22<name>\x22','RT\x202.0:','\x20trigger=','\x20kill','segment:parent:show','string'];a30_0x19f9=function(){return _0x349a36;};return a30_0x19f9();}function showFileNotFoundError(_0x5532f2,_0x293aa0){const _0x2ce07d=a30_0x519256;console[_0x2ce07d(0x1f4)](a30_0x3a0c62[_0x2ce07d(0x277)]('Error:\x20File\x20not\x20found:\x20'+_0x5532f2+'\x0a')),console[_0x2ce07d(0x1f4)](a30_0x3a0c62[_0x2ce07d(0x21e)](_0x2ce07d(0x1af)+_0x293aa0+_0x2ce07d(0x1c1)));}function displayRealtimeValidation(_0x1d8d5e){const _0x1a2d18=a30_0x519256;if(!_0x1d8d5e['realtime'])return;const _0x458c26=_0x1d8d5e[_0x1a2d18(0x1a1)],_0x58ab5d=_0x458c26['enabled']?a30_0x3a0c62['green']('⚡\x20Enabled'):a30_0x3a0c62['yellow']('⚡\x20Not\x20enabled');console[_0x1a2d18(0x1f4)]('\x0a'+a30_0x3a0c62[_0x1a2d18(0x1f3)](_0x1a2d18(0x18d))+'\x20'+_0x58ab5d);if(_0x458c26[_0x1a2d18(0x266)]&&_0x458c26['events'][_0x1a2d18(0x1a9)]>0x0){console[_0x1a2d18(0x1f4)]('\x20\x20'+a30_0x3a0c62['dim'](_0x1a2d18(0x155))+'\x20'+_0x458c26[_0x1a2d18(0x266)][_0x1a2d18(0x1a9)]+_0x1a2d18(0x1a7));for(const _0x508907 of _0x458c26['events']){const _0x160916=_0x508907[_0x1a2d18(0x265)]===![]?a30_0x3a0c62[_0x1a2d18(0x277)]('✘'):a30_0x3a0c62[_0x1a2d18(0x1f6)]('✔');console['error'](_0x1a2d18(0x1a0)+_0x160916+'\x20'+_0x508907[_0x1a2d18(0x186)]),_0x508907[_0x1a2d18(0x262)]&&console['error']('\x20\x20\x20\x20\x20\x20'+a30_0x3a0c62[_0x1a2d18(0x277)](_0x508907[_0x1a2d18(0x262)]));}}if(_0x458c26[_0x1a2d18(0x271)]&&_0x458c26[_0x1a2d18(0x271)][_0x1a2d18(0x1a9)]>0x0){console[_0x1a2d18(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x1a2d18(0x1f3)](_0x1a2d18(0x283))+'\x20'+_0x458c26['attributes']['length']+'\x20configured');for(const _0x4fd98a of _0x458c26[_0x1a2d18(0x271)]){const _0x31ba74=_0x4fd98a[_0x1a2d18(0x203)]?a30_0x3a0c62[_0x1a2d18(0x1f6)]('✔'):a30_0x3a0c62[_0x1a2d18(0x277)]('✘');console[_0x1a2d18(0x1f4)]('\x20\x20\x20\x20'+_0x31ba74+'\x20'+_0x4fd98a[_0x1a2d18(0x186)]+'\x20'+a30_0x3a0c62[_0x1a2d18(0x1f3)]('('+_0x4fd98a['type']+')'));}}if(_0x458c26[_0x1a2d18(0x216)]){const _0x24ea0c=_0x458c26['idStitching']['stitchingKeys']?.[_0x1a2d18(0x1a9)]?_0x1a2d18(0x181)+_0x458c26[_0x1a2d18(0x216)][_0x1a2d18(0x14e)][_0x1a2d18(0x16f)](',\x20')+']':'';console[_0x1a2d18(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x1a2d18(0x1f3)](_0x1a2d18(0x253))+'\x20'+_0x458c26[_0x1a2d18(0x216)]['primaryKey']+_0x24ea0c);}if(_0x458c26[_0x1a2d18(0x17e)]&&_0x458c26[_0x1a2d18(0x17e)][_0x1a2d18(0x1a9)]>0x0){console[_0x1a2d18(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x1a2d18(0x1f3)](_0x1a2d18(0x285))+'\x20'+_0x458c26['personalizationServices'][_0x1a2d18(0x1a9)]+_0x1a2d18(0x222)+(_0x458c26['personalizationServices'][_0x1a2d18(0x1a9)]!==0x1?'s':''));for(const _0x2d6f15 of _0x458c26['personalizationServices']){console[_0x1a2d18(0x1f4)]('\x20\x20\x20\x20-\x20'+_0x2d6f15[_0x1a2d18(0x186)]);}}}function showParentSegmentNotSetError(_0x451293){const _0x297c6c=a30_0x519256;console['error'](a30_0x3a0c62[_0x297c6c(0x289)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x297c6c(0x1f4)](_0x451293);}export class ParentSegmentListCommand extends BaseCommand{['name']=a30_0x519256(0x254);['description']=a30_0x519256(0x226);async[a30_0x519256(0x263)](_0x4c7bf8){const _0x5785bd=a30_0x519256,{options:_0x513338,args:_0x42d4ec,tdx:_0x34c847}=_0x4c7bf8,_0x34c953=_0x42d4ec[0x0];_0x513338[_0x5785bd(0x270)]&&(console[_0x5785bd(0x1f4)](_0x5785bd(0x1f7)+_0x513338['site']),_0x34c953&&console[_0x5785bd(0x1f4)](_0x5785bd(0x22c)+_0x34c953));const _0x1119d6=await withSpinner(_0x34c953?_0x5785bd(0x12d)+_0x34c953+_0x5785bd(0x25b):'Listing\x20parent\x20segments...',()=>_0x34c847[_0x5785bd(0x1bc)]['listParents'](),{'verbose':_0x513338[_0x5785bd(0x270)]});let _0x3e40ea=_0x1119d6[_0x5785bd(0x1db)];if(_0x34c953){const _0x22e18a=_0x34c953[_0x5785bd(0x146)](/[.+^${}()|[\]\\]/g,_0x5785bd(0x14c))['replace'](/\*/g,'.*')[_0x5785bd(0x146)](/\?/g,'.'),_0x1d3adc=new RegExp('^'+_0x22e18a+'$','i');_0x3e40ea=_0x3e40ea[_0x5785bd(0x212)](_0x25f8eb=>_0x1d3adc['test'](_0x25f8eb[_0x5785bd(0x271)][_0x5785bd(0x186)]));}_0x3e40ea[_0x5785bd(0x244)]((_0x25a1a7,_0x2ad810)=>_0x25a1a7[_0x5785bd(0x271)][_0x5785bd(0x186)][_0x5785bd(0x128)](_0x2ad810[_0x5785bd(0x271)]['name'])),console[_0x5785bd(0x1f4)](_0x5785bd(0x140)+_0x3e40ea[_0x5785bd(0x1a9)]+_0x5785bd(0x1b3)+(_0x3e40ea['length']!==0x1?'s':''));const _0x5165d3=_0x416100=>{const _0x223c34=_0x5785bd;return getConsoleNextUrl(_0x513338[_0x223c34(0x17f)],'/app/dw/parentSegments/'+_0x416100);};if(_0x513338['format']===_0x5785bd(0x116)||_0x513338[_0x5785bd(0x1e8)]===_0x5785bd(0x21d)){const _0x1ef947=_0x3e40ea[_0x5785bd(0x187)](_0x1ca5c6=>({..._0x1ca5c6,'url':_0x5165d3(_0x1ca5c6['id'])}));await handleSDKOutput(_0x1ef947,_0x513338);}else{if(_0x3e40ea[_0x5785bd(0x1a9)]===0x0)_0x34c953?console[_0x5785bd(0x21f)](_0x5785bd(0x134)+_0x34c953):console[_0x5785bd(0x21f)](_0x5785bd(0x148));else for(const _0x52aa3c of _0x3e40ea){const _0x110d3b=_0x52aa3c['attributes']['population']?a30_0x3a0c62[_0x5785bd(0x1f3)]('\x20('+formatRows(_0x52aa3c['attributes']['population'])+')'):'',_0x2616ee=hyperlink(_0x52aa3c[_0x5785bd(0x271)]['name'],_0x5165d3(_0x52aa3c['id']));console[_0x5785bd(0x21f)]('👥\x20'+_0x2616ee+_0x110d3b);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x519256(0x186)]='segment:parent:create';[a30_0x519256(0x178)]=a30_0x519256(0x1d1);async['execute'](_0x403652){const _0x6a889a=a30_0x519256,{options:_0x5323f8,args:_0x2b2a2d,tdx:_0x24dc52}=_0x403652;console[_0x6a889a(0x1f4)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x6a889a(0x219)+_0x6a889a(0x12f));const _0x41debb=_0x5323f8;if(_0x2b2a2d['length']===0x0)return console[_0x6a889a(0x1f4)](a30_0x3a0c62[_0x6a889a(0x277)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x6a889a(0x184)),0x1;const _0x5e96d6=_0x2b2a2d[0x0];if(!_0x41debb[_0x6a889a(0x115)]||!_0x41debb[_0x6a889a(0x28a)])return console[_0x6a889a(0x1f4)](_0x6a889a(0x25d)),console[_0x6a889a(0x1f4)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x41debb[_0x6a889a(0x270)]&&(console[_0x6a889a(0x1f4)](_0x6a889a(0x1f7)+_0x41debb['site']),console['error'](_0x6a889a(0x236)+_0x5e96d6),console[_0x6a889a(0x1f4)](_0x6a889a(0x172)+_0x41debb[_0x6a889a(0x115)]),console[_0x6a889a(0x1f4)]('Table:\x20'+_0x41debb[_0x6a889a(0x28a)]));const _0x4599c8=await loadJSONFromOptions(_0x41debb[_0x6a889a(0x271)],_0x41debb[_0x6a889a(0x276)]),_0x41bd80=await loadJSONFromOptions(_0x41debb['behaviors'],_0x41debb[_0x6a889a(0x267)]),_0x4dbee3=await loadJSONFromOptions(_0x41debb[_0x6a889a(0x174)],_0x41debb[_0x6a889a(0x284)]),_0x32b98f={'name':_0x5e96d6,'description':_0x41debb['description'],'scheduleType':_0x41debb[_0x6a889a(0x22e)],'scheduleOption':_0x41debb[_0x6a889a(0x17c)],'timezone':_0x41debb[_0x6a889a(0x225)],'master':{'parentDatabaseName':_0x41debb[_0x6a889a(0x115)],'parentTableName':_0x41debb[_0x6a889a(0x28a)]},'attributes':_0x4599c8,'behaviors':_0x41bd80,'customerGroup':_0x4dbee3},_0x36dd4b=await withSpinner(_0x6a889a(0x257)+_0x5e96d6+_0x6a889a(0x25b),()=>_0x24dc52[_0x6a889a(0x1bc)][_0x6a889a(0x261)](_0x32b98f),{'verbose':_0x5323f8[_0x6a889a(0x270)]}),_0x138b07=_0x36dd4b[_0x6a889a(0x1db)];return console['error'](_0x6a889a(0x130)+_0x138b07['name']+'\x27\x20with\x20ID:\x20'+_0x138b07['id']),await handleSDKOutput([_0x138b07],_0x5323f8),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']='segment:parent:update';[a30_0x519256(0x178)]=a30_0x519256(0x1ba);async[a30_0x519256(0x263)](_0x20c4fd){const _0x21327c=a30_0x519256,{options:_0x3a7f93,args:_0x2ec68d,tdx:_0x83476}=_0x20c4fd;console[_0x21327c(0x1f4)](_0x21327c(0x180)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x21327c(0x12f));const _0x5af1d0=_0x3a7f93;if(_0x2ec68d['length']===0x0)return console[_0x21327c(0x1f4)](a30_0x3a0c62[_0x21327c(0x277)](_0x21327c(0x1ea))),console[_0x21327c(0x1f4)](_0x21327c(0x16d)),0x1;const _0x5e62f8=_0x2ec68d[0x0];_0x5af1d0[_0x21327c(0x270)]&&(console['error']('Site:\x20'+_0x5af1d0[_0x21327c(0x17f)]),console[_0x21327c(0x1f4)]('Parent\x20segment:\x20'+_0x5e62f8));const _0x3ee1f3=await withSpinner(_0x21327c(0x239)+_0x5e62f8+'\x27...',()=>_0x83476[_0x21327c(0x1bc)][_0x21327c(0x1c6)](_0x5e62f8),{'verbose':_0x5af1d0['verbose']}),_0x20426d=_0x3ee1f3[_0x21327c(0x1db)],_0x40b203=await loadJSONFromOptions(_0x5af1d0['addAttributes'],_0x5af1d0['addAttributesFile']),_0xe99512=await loadJSONFromOptions(_0x5af1d0[_0x21327c(0x1f5)],_0x5af1d0[_0x21327c(0x22f)]),_0x5a03f4={'name':_0x20426d[_0x21327c(0x186)],'description':_0x5af1d0[_0x21327c(0x178)]!==undefined?_0x5af1d0[_0x21327c(0x178)]:_0x20426d[_0x21327c(0x178)],'scheduleType':_0x5af1d0[_0x21327c(0x22e)]!==undefined?_0x5af1d0[_0x21327c(0x22e)]:_0x20426d[_0x21327c(0x22e)],'scheduleOption':_0x5af1d0[_0x21327c(0x17c)]!==undefined?_0x5af1d0[_0x21327c(0x17c)]:_0x20426d[_0x21327c(0x17c)],'timezone':_0x5af1d0[_0x21327c(0x225)]!==undefined?_0x5af1d0[_0x21327c(0x225)]:_0x20426d[_0x21327c(0x225)],'master':_0x20426d[_0x21327c(0x156)],'attributes':_0x40b203?[..._0x20426d[_0x21327c(0x271)]||[],..._0x40b203]:_0x20426d[_0x21327c(0x271)],'behaviors':_0xe99512?[..._0x20426d[_0x21327c(0x1e4)]||[],..._0xe99512]:_0x20426d[_0x21327c(0x1e4)],'customerGroup':_0x20426d[_0x21327c(0x174)]},_0x27c595=await withSpinner(_0x21327c(0x119)+_0x5e62f8+_0x21327c(0x25b),()=>_0x83476[_0x21327c(0x1bc)][_0x21327c(0x286)](_0x5e62f8,_0x5a03f4),{'verbose':_0x5af1d0[_0x21327c(0x270)]}),_0xeead66=_0x27c595[_0x21327c(0x1db)];return console[_0x21327c(0x1f4)](_0x21327c(0x21c)+_0xeead66[_0x21327c(0x186)]+'\x27'),await handleSDKOutput([_0xeead66],_0x5af1d0),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]=a30_0x519256(0x19e);[a30_0x519256(0x178)]=a30_0x519256(0x217);async[a30_0x519256(0x263)](_0x11709d){const _0x201a3a=a30_0x519256,{options:_0x400fca,args:_0x1c5833,tdx:_0x5c0fd5}=_0x11709d,_0x2c435c=_0x400fca,_0x1a574b=_0x1c5833[0x0]||_0x400fca['parentSegment'];if(!_0x1a574b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x2c435c[_0x201a3a(0x1a6)]&&_0x2c435c['output'])return console[_0x201a3a(0x1f4)](a30_0x3a0c62['red'](_0x201a3a(0x19d))),console['error'](a30_0x3a0c62[_0x201a3a(0x1f3)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x201a3a(0x1f4)](a30_0x3a0c62[_0x201a3a(0x1f3)](_0x201a3a(0x170)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x201a3a(0x1f4)](a30_0x3a0c62[_0x201a3a(0x21e)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x1975f4=_0x2c435c[_0x201a3a(0x25f)]||a30_0x5a457f[_0x201a3a(0x16f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1a574b)+_0x201a3a(0x1e0));_0x2c435c['verbose']&&(console[_0x201a3a(0x1f4)](_0x201a3a(0x1f7)+_0x2c435c[_0x201a3a(0x17f)]),console[_0x201a3a(0x1f4)](_0x201a3a(0x24b)+_0x1a574b),console[_0x201a3a(0x1f4)](_0x201a3a(0x13d)+_0x1975f4));const _0x505fe5=await withSpinner(_0x201a3a(0x1aa)+_0x1a574b+_0x201a3a(0x25b),()=>_0x5c0fd5[_0x201a3a(0x1bc)][_0x201a3a(0x20f)](_0x1a574b),{'verbose':_0x2c435c['verbose']}),_0xae7a31=_0x505fe5[_0x201a3a(0x1db)];if(existsSync(_0x1975f4)){const _0x374e21=readFileSync(_0x1975f4,'utf-8'),_0x5c9ffe=generateDiff(_0x374e21,_0xae7a31);if(!hasChanges(_0x5c9ffe))console[_0x201a3a(0x1f4)](a30_0x3a0c62[_0x201a3a(0x1f6)]('✔')+'\x20No\x20changes\x20-\x20'+a30_0x3a0c62[_0x201a3a(0x21e)](_0x1975f4)+_0x201a3a(0x11a));else{console[_0x201a3a(0x1f4)](_0x201a3a(0x24f)+_0x1975f4+'\x27:'),console[_0x201a3a(0x1f4)]('─'['repeat'](0x3c)),console[_0x201a3a(0x1f4)](formatDiffWithColors(_0x5c9ffe)),console[_0x201a3a(0x1f4)]('─'[_0x201a3a(0x211)](0x3c));if(!_0x2c435c['yes']){if(!isInteractive())return console[_0x201a3a(0x1f4)](a30_0x3a0c62[_0x201a3a(0x277)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a30_0x3a0c62[_0x201a3a(0x1f3)](_0x201a3a(0x125))),0x1;const _0x4edd65=await confirmKey(_0x201a3a(0x138)+_0x1975f4+'\x27?');if(!_0x4edd65)return console['error'](a30_0x3a0c62['yellow'](_0x201a3a(0x158))),0x1;}writeFileSync(_0x1975f4,_0xae7a31,_0x201a3a(0x14d)),console['error'](a30_0x3a0c62['green']('✔')+_0x201a3a(0x1f0)+a30_0x3a0c62[_0x201a3a(0x21e)](_0x1975f4));}}else{const _0x51ea98=a30_0x5a457f['dirname'](_0x1975f4);!existsSync(_0x51ea98)&&mkdirSync(_0x51ea98,{'recursive':!![]}),writeFileSync(_0x1975f4,_0xae7a31,_0x201a3a(0x14d)),console['error'](a30_0x3a0c62[_0x201a3a(0x1f6)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x3a0c62[_0x201a3a(0x21e)](_0x1975f4));}return saveSessionContext({'parent_segment':_0x1a574b},_0x2c435c[_0x201a3a(0x1f8)]),console[_0x201a3a(0x1f4)](a30_0x3a0c62[_0x201a3a(0x1f6)]('✔')+_0x201a3a(0x1b0)+a30_0x3a0c62[_0x201a3a(0x1f3)](_0x201a3a(0x248))+_0x201a3a(0x260)+a30_0x3a0c62[_0x201a3a(0x21e)](_0x1a574b)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]='segment:parent:push';[a30_0x519256(0x178)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a30_0x519256(0x263)](_0x4043c9){const _0x36a13a=a30_0x519256,{options:_0x56a135,args:_0x4fbde8,tdx:_0x239d51}=_0x4043c9,_0xa0b12b=_0x56a135,_0x3de7bc=_0x4fbde8[0x0]||_0x56a135[_0x36a13a(0x255)];if(!_0x3de7bc)return showParentSegmentNotSetError(_0x36a13a(0x166)+_0x36a13a(0x16a)),0x1;const _0x3beea4=resolveYamlFile(_0x3de7bc);if(!existsSync(_0x3beea4))return showFileNotFoundError(_0x3beea4,_0x3de7bc),0x1;_0xa0b12b[_0x36a13a(0x270)]&&(console[_0x36a13a(0x1f4)]('Site:\x20'+_0xa0b12b['site']),console[_0x36a13a(0x1f4)](_0x36a13a(0x1b8)+_0x3beea4));let _0x52684f;try{_0x52684f=readFileSync(_0x3beea4,'utf-8');}catch(_0xa76803){const _0x3b0863=_0xa76803 instanceof Error?_0xa76803[_0x36a13a(0x139)]:String(_0xa76803);return console[_0x36a13a(0x1f4)](_0x36a13a(0x27a)+_0x3b0863),0x1;}const _0x163afb=await withSpinner(_0x36a13a(0x242),()=>_0x239d51['segment'][_0x36a13a(0x251)](_0x52684f),{'verbose':_0xa0b12b[_0x36a13a(0x270)]}),_0x2dbb6d=_0x163afb[_0x36a13a(0x1db)],{isNew:_0x136268,name:_0x5eb6ea,hasChanges:_0x342778,diffFormatted:_0x40305c}=_0x2dbb6d;if(!_0x342778)return console[_0x36a13a(0x1f4)](_0x36a13a(0x18a)+_0x5eb6ea+_0x36a13a(0x135)),0x0;_0x136268?console[_0x36a13a(0x1f4)](_0x36a13a(0x231)+_0x5eb6ea+'\x27:'):console[_0x36a13a(0x1f4)](_0x36a13a(0x147)+_0x5eb6ea+'\x27:');console[_0x36a13a(0x1f4)]('─'[_0x36a13a(0x211)](0x3c)),console[_0x36a13a(0x1f4)](_0x40305c),console[_0x36a13a(0x1f4)]('─'['repeat'](0x3c));const _0x13d063=_0x136268?_0x36a13a(0x1b2)+_0x5eb6ea+'\x27?':_0x36a13a(0x1b9)+_0x5eb6ea+'\x27?';if(!_0xa0b12b[_0x36a13a(0x15e)]){if(!isInteractive())return console['error'](a30_0x3a0c62['red']('\x0aError:'),_0x36a13a(0x13f)),console['error'](a30_0x3a0c62[_0x36a13a(0x1f3)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x245400=await confirmKey(_0x13d063);if(!_0x245400)return console[_0x36a13a(0x1f4)](a30_0x3a0c62[_0x36a13a(0x289)](_0x36a13a(0x158))),0x1;}const _0x12d7f1=_0x136268?_0x36a13a(0x28f):'Updating',_0x2ebd60=await withSpinner(_0x12d7f1+_0x36a13a(0x223)+_0x5eb6ea+_0x36a13a(0x25b),()=>_0x2dbb6d[_0x36a13a(0x27c)](),{'verbose':_0xa0b12b[_0x36a13a(0x270)]}),_0x447258=_0x2ebd60['data'],_0x990bbe=getConsoleNextUrl(_0xa0b12b[_0x36a13a(0x17f)],_0x36a13a(0x169)+_0x447258['id']),_0x2036d6=_0x136268?'Created':'Updated';return console[_0x36a13a(0x1f4)]('✔\x20'+_0x2036d6+_0x36a13a(0x223)+_0x447258[_0x36a13a(0x186)]+'\x27'),console[_0x36a13a(0x1f4)]('\x20\x20'+_0x990bbe),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]=a30_0x519256(0x19a);[a30_0x519256(0x178)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x2d84b1){const _0x1f13a9=a30_0x519256,{options:_0x46091f,args:_0x2bf674,tdx:_0x4da42d}=_0x2d84b1,_0x10a880=_0x46091f,_0x200f58=_0x2bf674[0x0]||_0x46091f[_0x1f13a9(0x255)];if(!_0x200f58)return showParentSegmentNotSetError(_0x1f13a9(0x12e)+_0x1f13a9(0x123)+_0x1f13a9(0x173)+_0x1f13a9(0x149)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0xa06032=resolveYamlFile(_0x200f58);if(!existsSync(_0xa06032))return showFileNotFoundError(_0xa06032,_0x200f58),0x1;_0x10a880['verbose']&&(console['error']('Site:\x20'+_0x10a880['site']),console[_0x1f13a9(0x1f4)](_0x1f13a9(0x1b8)+_0xa06032));let _0x4565c9;try{_0x4565c9=readFileSync(_0xa06032,_0x1f13a9(0x14d));}catch(_0x29e67c){const _0x2ba771=_0x29e67c instanceof Error?_0x29e67c['message']:String(_0x29e67c);return console[_0x1f13a9(0x1f4)](_0x1f13a9(0x27a)+_0x2ba771),0x1;}const _0x1498d9=createCommandSpinner(a30_0x3a0c62[_0x1f13a9(0x1f3)](_0x1f13a9(0x15f)),{'verbose':_0x10a880[_0x1f13a9(0x270)]});_0x1498d9['start']();const _0x36bb59={'onProgress':_0x66f808=>{_0x1498d9['text']=formatProgressMessage(_0x66f808);}};if(_0x10a880[_0x1f13a9(0x156)])_0x36bb59['master']=!![];if(_0x10a880['enriched'])_0x36bb59[_0x1f13a9(0x230)]=!![];_0x10a880['attribute']&&(_0x36bb59[_0x1f13a9(0x1ef)]=_0x10a880[_0x1f13a9(0x1ef)]);_0x10a880[_0x1f13a9(0x20c)]&&(_0x36bb59[_0x1f13a9(0x20c)]=_0x10a880['behavior']);if(_0x10a880[_0x1f13a9(0x1cc)])_0x36bb59[_0x1f13a9(0x1cc)]=_0x10a880['interval'];let _0x27c7e5;try{_0x27c7e5=await _0x4da42d[_0x1f13a9(0x1bc)][_0x1f13a9(0x220)](_0x4565c9,_0x36bb59),_0x1498d9[_0x1f13a9(0x205)]();}catch(_0x3298f1){_0x1498d9[_0x1f13a9(0x205)]();throw _0x3298f1;}const _0x821632=_0x10a880[_0x1f13a9(0x1cc)]||_0x1f13a9(0x154);return this['displayValidateResults'](_0x27c7e5,_0x36bb59,_0xa06032,_0x821632),_0x27c7e5[_0x1f13a9(0x1f2)]?0x0:0x1;}[a30_0x519256(0x279)](_0x345507,_0x5d75c8,_0x2b0c93,_0x558b10){const _0x5935b5=a30_0x519256;console[_0x5935b5(0x1f4)]('\x0a'+a30_0x3a0c62['bold'](_0x5935b5(0x165))+'\x20'+_0x345507[_0x5935b5(0x186)]),console[_0x5935b5(0x1f4)]('═'['repeat'](0x3c)),this[_0x5935b5(0x171)](_0x345507);if(typeof _0x5d75c8[_0x5935b5(0x1ef)]===_0x5935b5(0x191)){this[_0x5935b5(0x1d3)](_0x345507),this['displaySummary'](_0x345507),this[_0x5935b5(0x24d)](_0x2b0c93,_0x558b10,'attribute',_0x5d75c8[_0x5935b5(0x1ef)]);return;}if(_0x5d75c8[_0x5935b5(0x1ef)]===!![]){this[_0x5935b5(0x1d3)](_0x345507),this[_0x5935b5(0x25c)](_0x345507),this[_0x5935b5(0x24d)](_0x2b0c93,_0x558b10,_0x5935b5(0x271));return;}if(typeof _0x5d75c8[_0x5935b5(0x20c)]===_0x5935b5(0x191)){this[_0x5935b5(0x200)](_0x345507,_0x558b10),this[_0x5935b5(0x25c)](_0x345507),this[_0x5935b5(0x24d)](_0x2b0c93,_0x558b10,'behavior',_0x5d75c8['behavior']);return;}if(_0x5d75c8[_0x5935b5(0x20c)]===!![]){this[_0x5935b5(0x200)](_0x345507,_0x558b10),this[_0x5935b5(0x25c)](_0x345507),this[_0x5935b5(0x24d)](_0x2b0c93,_0x558b10,_0x5935b5(0x1e4));return;}this['displayAttributesStats'](_0x345507),this[_0x5935b5(0x200)](_0x345507,_0x558b10),this[_0x5935b5(0x14b)](_0x345507),this[_0x5935b5(0x25c)](_0x345507),this['displayPreviewHints'](_0x2b0c93,_0x558b10,'all');}[a30_0x519256(0x14b)](_0x4c1fdf){displayRealtimeValidation(_0x4c1fdf);}[a30_0x519256(0x24d)](_0x5f1dad,_0x441ec0,_0x14fc62,_0x4f57f0){const _0x22e75d=a30_0x519256;console['error']('\x0a'+a30_0x3a0c62[_0x22e75d(0x1f3)]('To\x20view\x20sample\x20data:'));const _0x56946d=_0x441ec0!==_0x22e75d(0x154)?'\x20--interval\x20'+_0x441ec0:'';if(_0x14fc62===_0x22e75d(0x1ef)&&_0x4f57f0)console[_0x22e75d(0x1f4)]('\x20\x20'+a30_0x3a0c62['dim'](_0x22e75d(0x25a)+_0x5f1dad+'\x20--attribute\x20\x22'+_0x4f57f0+'\x22'+_0x56946d));else{if(_0x14fc62===_0x22e75d(0x20c)&&_0x4f57f0)console[_0x22e75d(0x1f4)]('\x20\x20'+a30_0x3a0c62['dim']('tdx\x20ps\x20preview\x20'+_0x5f1dad+_0x22e75d(0x118)+_0x4f57f0+'\x22'+_0x56946d));else(_0x14fc62===_0x22e75d(0x271)||_0x14fc62==='all')&&console[_0x22e75d(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x22e75d(0x1f3)](_0x22e75d(0x25a)+_0x5f1dad+_0x22e75d(0x18c)+_0x56946d));}(_0x14fc62===_0x22e75d(0x1e4)||_0x14fc62==='all')&&console[_0x22e75d(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x22e75d(0x1f3)]('tdx\x20ps\x20preview\x20'+_0x5f1dad+'\x20--behavior\x20\x22<name>\x22'+_0x56946d)),_0x14fc62===_0x22e75d(0x282)&&console[_0x22e75d(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x22e75d(0x1f3)](_0x22e75d(0x25a)+_0x5f1dad+_0x22e75d(0x162)+_0x56946d));}['displayMasterInfo'](_0xffd011){const _0x23989e=a30_0x519256,{master:_0x207efb}=_0xffd011,_0x5173ea=_0x207efb[_0x23989e(0x24a)]?a30_0x3a0c62[_0x23989e(0x1f6)]('✔'):a30_0x3a0c62['red']('✘');console[_0x23989e(0x1f4)]('\x0a'+a30_0x3a0c62[_0x23989e(0x1f3)]('Master\x20Table')),console[_0x23989e(0x1f4)](_0x5173ea+'\x20'+a30_0x3a0c62[_0x23989e(0x21a)](_0x207efb[_0x23989e(0x115)]+'.'+_0x207efb[_0x23989e(0x28a)])),_0x207efb['schemaValid']?_0x207efb[_0x23989e(0x1a5)]!==undefined&&console[_0x23989e(0x1f4)]('\x20\x20'+a30_0x3a0c62['dim'](_0x23989e(0x127))+'\x20'+a30_0x3a0c62[_0x23989e(0x21e)](formatRows(_0x207efb[_0x23989e(0x1a5)]))):console[_0x23989e(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x23989e(0x277)](_0x23989e(0x179))+'\x20'+_0x207efb[_0x23989e(0x1eb)]);}[a30_0x519256(0x1d3)](_0x105cbc){const _0x1f968b=a30_0x519256;if(_0x105cbc[_0x1f968b(0x271)][_0x1f968b(0x1a9)]===0x0)return;console[_0x1f968b(0x1f4)]('\x0a'+a30_0x3a0c62['dim'](_0x1f968b(0x288)));for(const _0xaf9737 of _0x105cbc[_0x1f968b(0x271)]){const _0x13115d=_0xaf9737[_0x1f968b(0x24a)]?a30_0x3a0c62[_0x1f968b(0x1f6)]('✔'):a30_0x3a0c62[_0x1f968b(0x277)]('✘');let _0x218ba9='';if(_0xaf9737['schemaValid']&&_0xaf9737[_0x1f968b(0x18b)]!==undefined&&_0xaf9737['coveragePercent']!==undefined){const _0x4373b4=_0xaf9737[_0x1f968b(0x159)]['toFixed'](0x1),_0x31ea79=_0xaf9737[_0x1f968b(0x159)]>=0x50?a30_0x3a0c62[_0x1f968b(0x1f6)]:_0xaf9737[_0x1f968b(0x159)]>=0x32?a30_0x3a0c62[_0x1f968b(0x289)]:a30_0x3a0c62[_0x1f968b(0x277)];_0x218ba9='\x20'+a30_0x3a0c62[_0x1f968b(0x1f3)](_0x1f968b(0x234))+'\x20'+_0x31ea79(_0x4373b4+'%')+'\x20('+formatRows(_0xaf9737[_0x1f968b(0x18b)])+_0x1f968b(0x256);}console[_0x1f968b(0x1f4)](_0x13115d+'\x20'+a30_0x3a0c62[_0x1f968b(0x21a)](_0xaf9737[_0x1f968b(0x186)])+_0x218ba9),console['error']('\x20\x20'+a30_0x3a0c62[_0x1f968b(0x1f3)](_0x1f968b(0x1cd))+'\x20'+a30_0x3a0c62[_0x1f968b(0x21a)](_0xaf9737['database']+'.'+_0xaf9737['table']));const _0x472a22=_0xaf9737[_0x1f968b(0x17a)]===_0xaf9737[_0x1f968b(0x1ee)]?a30_0x3a0c62[_0x1f968b(0x1f3)]('Join\x20on:')+'\x20'+_0xaf9737[_0x1f968b(0x17a)]:a30_0x3a0c62[_0x1f968b(0x1f3)](_0x1f968b(0x143))+'\x20'+_0xaf9737[_0x1f968b(0x17a)]+_0x1f968b(0x260)+_0xaf9737['foreignKey'];console[_0x1f968b(0x1f4)]('\x20\x20'+_0x472a22),console[_0x1f968b(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x1f968b(0x1f3)](_0x1f968b(0x137))),this[_0x1f968b(0x243)](_0xaf9737['columns']),!_0xaf9737[_0x1f968b(0x24a)]&&console['error']('\x20\x20'+a30_0x3a0c62[_0x1f968b(0x277)](_0x1f968b(0x179))+'\x20'+_0xaf9737['schemaError']);}}[a30_0x519256(0x200)](_0x17e03d,_0xdccbd){const _0x5099b9=a30_0x519256;if(_0x17e03d[_0x5099b9(0x1e4)]['length']===0x0)return;console[_0x5099b9(0x1f4)]('\x0a'+a30_0x3a0c62[_0x5099b9(0x1f3)](_0x5099b9(0x150))+'\x20'+a30_0x3a0c62[_0x5099b9(0x1f3)]('('+_0xdccbd+')'));for(const _0xef093 of _0x17e03d[_0x5099b9(0x1e4)]){const _0x56588d=_0xef093['schemaValid']?a30_0x3a0c62[_0x5099b9(0x1f6)]('✔'):a30_0x3a0c62['red']('✘');let _0x1351a3='';if(_0xef093['schemaValid']&&_0xef093[_0x5099b9(0x241)]!==undefined&&_0xef093[_0x5099b9(0x280)]!==undefined){const _0x44394d=_0xef093[_0x5099b9(0x294)]?.[_0x5099b9(0x295)](0x1)||'?',_0x2768e7=(_0xef093[_0x5099b9(0x294)]??0x0)>=0x32?a30_0x3a0c62[_0x5099b9(0x1f6)]:(_0xef093['customerPercent']??0x0)>=0x14?a30_0x3a0c62[_0x5099b9(0x289)]:a30_0x3a0c62['red'];_0x1351a3='\x20'+a30_0x3a0c62[_0x5099b9(0x1f3)](_0x5099b9(0x1fd))+'\x20'+_0x2768e7(formatRows(_0xef093[_0x5099b9(0x241)]))+'\x20('+_0x44394d+_0x5099b9(0x1e7)+a30_0x3a0c62[_0x5099b9(0x1f3)]('Events:')+'\x20'+a30_0x3a0c62['cyan'](formatRows(_0xef093['totalEvents']));}console[_0x5099b9(0x1f4)](_0x56588d+'\x20'+a30_0x3a0c62['bold'](_0xef093[_0x5099b9(0x186)])+_0x1351a3),console[_0x5099b9(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x5099b9(0x1f3)](_0x5099b9(0x1cd))+'\x20'+a30_0x3a0c62['bold'](_0xef093[_0x5099b9(0x115)]+'.'+_0xef093[_0x5099b9(0x28a)]));const _0x7acdf2=_0xef093[_0x5099b9(0x17a)]===_0xef093[_0x5099b9(0x1ee)]?a30_0x3a0c62[_0x5099b9(0x1f3)](_0x5099b9(0x185))+'\x20'+_0xef093['joinKey']:a30_0x3a0c62[_0x5099b9(0x1f3)]('Join:')+'\x20'+_0xef093['joinKey']+_0x5099b9(0x260)+_0xef093[_0x5099b9(0x1ee)];console[_0x5099b9(0x1f4)]('\x20\x20'+_0x7acdf2),console[_0x5099b9(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x5099b9(0x1f3)](_0x5099b9(0x137))),this[_0x5099b9(0x243)](_0xef093['columns']),!_0xef093['schemaValid']&&console[_0x5099b9(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x5099b9(0x277)](_0x5099b9(0x179))+'\x20'+_0xef093[_0x5099b9(0x1eb)]);}}['displayColumns'](_0x4e4dee){const _0x30cb6f=a30_0x519256;for(const _0x59c859 of _0x4e4dee){_0x59c859['label']===_0x59c859[_0x30cb6f(0x274)]||_0x59c859['column']==='*'?console[_0x30cb6f(0x1f4)](_0x30cb6f(0x188)+_0x59c859[_0x30cb6f(0x26f)]):console[_0x30cb6f(0x1f4)](_0x30cb6f(0x188)+_0x59c859['label']+'\x20'+a30_0x3a0c62[_0x30cb6f(0x1f3)]('('+_0x59c859[_0x30cb6f(0x274)]+')'));}}[a30_0x519256(0x25c)](_0x569b5c){const _0x2a88c5=a30_0x519256;console['error']('─'[_0x2a88c5(0x211)](0x3c));if(_0x569b5c[_0x2a88c5(0x1ca)]['length']>0x0){console[_0x2a88c5(0x1f4)]('\x0a'+a30_0x3a0c62[_0x2a88c5(0x277)]('Errors:'));for(const _0x2cd6fa of _0x569b5c[_0x2a88c5(0x1ca)]){console['error']('\x20\x20'+a30_0x3a0c62[_0x2a88c5(0x277)]('•')+'\x20'+_0x2cd6fa);}}_0x569b5c['allValid']&&console['error']('\x0a'+a30_0x3a0c62[_0x2a88c5(0x1f6)]('✔')+_0x2a88c5(0x23d));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]='segment:parent:preview';[a30_0x519256(0x178)]=a30_0x519256(0x1be);async['execute'](_0x19546e){const _0x3d320d=a30_0x519256,{options:_0x2c65f6,args:_0xb9a8b,tdx:_0x4a783c}=_0x19546e,_0x521e6e=_0x2c65f6,_0x1883f7=_0xb9a8b[0x0]||_0x2c65f6['parentSegment'];if(!_0x1883f7)return showParentSegmentNotSetError(_0x3d320d(0x133)+_0x3d320d(0x278)+_0x3d320d(0x1ce)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x3d320d(0x1c9)+_0x3d320d(0x15b)+_0x3d320d(0x259)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x521e6e[_0x3d320d(0x156)]&&!_0x521e6e['attribute']&&!_0x521e6e[_0x3d320d(0x20c)]&&!_0x521e6e[_0x3d320d(0x230)])return console[_0x3d320d(0x1f4)](a30_0x3a0c62['red']('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x3d320d(0x1f4)](_0x3d320d(0x1b4)),console[_0x3d320d(0x1f4)]('Options:'),console[_0x3d320d(0x1f4)](_0x3d320d(0x1e1)),console[_0x3d320d(0x1f4)](_0x3d320d(0x1bd)),console[_0x3d320d(0x1f4)](_0x3d320d(0x1d0)),console['error'](_0x3d320d(0x197)),0x1;const _0x53a098=resolveYamlFile(_0x1883f7);if(!existsSync(_0x53a098))return showFileNotFoundError(_0x53a098,_0x1883f7),0x1;_0x521e6e[_0x3d320d(0x270)]&&(console[_0x3d320d(0x1f4)](_0x3d320d(0x1f7)+_0x521e6e[_0x3d320d(0x17f)]),console['error']('YAML\x20file:\x20'+_0x53a098));let _0x4129da;try{_0x4129da=readFileSync(_0x53a098,_0x3d320d(0x14d));}catch(_0x305aa8){const _0x3d8bd6=_0x305aa8 instanceof Error?_0x305aa8[_0x3d320d(0x139)]:String(_0x305aa8);return console[_0x3d320d(0x1f4)]('Error\x20reading\x20file:\x20'+_0x3d8bd6),0x1;}let _0x252dc1;try{_0x252dc1=parseDef(_0x4129da);}catch(_0x5261c2){const _0x42b2d9=_0x5261c2 instanceof Error?_0x5261c2[_0x3d320d(0x139)]:String(_0x5261c2);return console[_0x3d320d(0x1f4)](a30_0x3a0c62[_0x3d320d(0x277)](_0x3d320d(0x1a4)+_0x42b2d9)),0x1;}if(_0x521e6e[_0x3d320d(0x1ef)]===!![]||_0x521e6e['attribute']===''){const _0x2888f7=_0x252dc1[_0x3d320d(0x271)]?.['map'](_0x545cac=>_0x545cac[_0x3d320d(0x186)])||[];if(_0x2888f7[_0x3d320d(0x1a9)]===0x0)console['error'](a30_0x3a0c62[_0x3d320d(0x277)](_0x3d320d(0x287)));else{console[_0x3d320d(0x1f4)](a30_0x3a0c62[_0x3d320d(0x277)](_0x3d320d(0x25e))),console[_0x3d320d(0x1f4)](_0x3d320d(0x28d));for(const _0x254fe0 of _0x2888f7){console[_0x3d320d(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x3d320d(0x21e)](_0x254fe0));}console['error'](_0x3d320d(0x1c8)+_0x1883f7+_0x3d320d(0x281)+_0x2888f7[0x0]+'\x22');}return 0x1;}if(_0x521e6e['behavior']===!![]||_0x521e6e[_0x3d320d(0x20c)]===''){const _0x1435af=_0x252dc1[_0x3d320d(0x1e4)]?.[_0x3d320d(0x187)](_0x4d6da4=>_0x4d6da4[_0x3d320d(0x186)])||[];if(_0x1435af[_0x3d320d(0x1a9)]===0x0)console['error'](a30_0x3a0c62[_0x3d320d(0x277)](_0x3d320d(0x1b6)));else{console['error'](a30_0x3a0c62[_0x3d320d(0x277)](_0x3d320d(0x204))),console[_0x3d320d(0x1f4)](_0x3d320d(0x26e));for(const _0x40e426 of _0x1435af){console[_0x3d320d(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x3d320d(0x21e)](_0x40e426));}console[_0x3d320d(0x1f4)](_0x3d320d(0x1c8)+_0x1883f7+_0x3d320d(0x118)+_0x1435af[0x0]+'\x22');}return 0x1;}const _0x36627f=createCommandSpinner(a30_0x3a0c62[_0x3d320d(0x1f3)](_0x3d320d(0x1ab)),{'verbose':_0x521e6e[_0x3d320d(0x270)]});_0x36627f['start']();const _0x57ac84={'onProgress':_0x36e8f9=>{const _0x5965e2=_0x3d320d;_0x36627f[_0x5965e2(0x1de)]=formatProgressMessage(_0x36e8f9);}};if(_0x521e6e['master'])_0x57ac84[_0x3d320d(0x156)]=!![];if(_0x521e6e[_0x3d320d(0x1ef)]&&typeof _0x521e6e[_0x3d320d(0x1ef)]===_0x3d320d(0x191))_0x57ac84[_0x3d320d(0x1ef)]=_0x521e6e[_0x3d320d(0x1ef)];if(_0x521e6e[_0x3d320d(0x20c)]&&typeof _0x521e6e[_0x3d320d(0x20c)]==='string')_0x57ac84['behavior']=_0x521e6e[_0x3d320d(0x20c)];if(_0x521e6e['enriched'])_0x57ac84['enriched']=!![];if(_0x521e6e[_0x3d320d(0x1cc)])_0x57ac84[_0x3d320d(0x1cc)]=_0x521e6e['interval'];let _0x3647dd;try{_0x3647dd=await _0x4a783c[_0x3d320d(0x1bc)]['previewParentYaml'](_0x4129da,_0x57ac84),_0x36627f[_0x3d320d(0x205)]();}catch(_0x545b41){_0x36627f[_0x3d320d(0x205)]();throw _0x545b41;}return await this[_0x3d320d(0x10f)](_0x3647dd,{'master':_0x521e6e['master'],'attribute':typeof _0x521e6e[_0x3d320d(0x1ef)]===_0x3d320d(0x191)?_0x521e6e[_0x3d320d(0x1ef)]:undefined,'behavior':typeof _0x521e6e[_0x3d320d(0x20c)]===_0x3d320d(0x191)?_0x521e6e[_0x3d320d(0x20c)]:undefined,'enriched':_0x521e6e['enriched']}),_0x3647dd[_0x3d320d(0x1f2)]?0x0:0x1;}async[a30_0x519256(0x10f)](_0x5097d2,_0x4b2f88){const _0x3b7826=a30_0x519256;console[_0x3b7826(0x1f4)]('\x0a'+a30_0x3a0c62[_0x3b7826(0x21a)](_0x3b7826(0x20b))+'\x20'+_0x5097d2[_0x3b7826(0x186)]),console['error']('═'[_0x3b7826(0x211)](0x3c));if(_0x4b2f88[_0x3b7826(0x156)]&&_0x5097d2[_0x3b7826(0x1d6)]){const _0x5ee5c6=a30_0x3a0c62[_0x3b7826(0x1f3)](_0x3b7826(0x1a2))+'\x20'+a30_0x3a0c62['bold'](_0x5097d2['master'][_0x3b7826(0x115)]+'.'+_0x5097d2[_0x3b7826(0x156)]['table']);await this[_0x3b7826(0x1da)](_0x5ee5c6,_0x5097d2[_0x3b7826(0x1d6)]);}else{if(_0x4b2f88[_0x3b7826(0x1ef)]&&_0x5097d2[_0x3b7826(0x1d6)]){const _0x1b744b=a30_0x3a0c62[_0x3b7826(0x1f3)](_0x3b7826(0x19c))+'\x20'+a30_0x3a0c62['bold'](_0x4b2f88[_0x3b7826(0x1ef)]);await this[_0x3b7826(0x1da)](_0x1b744b,_0x5097d2['sampleData']);}else{if(_0x4b2f88[_0x3b7826(0x20c)]&&_0x5097d2[_0x3b7826(0x1d6)]){const _0x20211b=a30_0x3a0c62[_0x3b7826(0x1f3)](_0x3b7826(0x202))+'\x20'+a30_0x3a0c62['bold'](_0x4b2f88[_0x3b7826(0x20c)]);await this[_0x3b7826(0x1da)](_0x20211b,_0x5097d2['sampleData']);}else{if(_0x4b2f88[_0x3b7826(0x230)]&&_0x5097d2['sampleData']){const _0x43cb41=a30_0x3a0c62[_0x3b7826(0x1f3)](_0x3b7826(0x210))+'\x20'+a30_0x3a0c62[_0x3b7826(0x21a)](_0x3b7826(0x232));await this['displaySampleData'](_0x43cb41,_0x5097d2[_0x3b7826(0x1d6)]);}else!_0x5097d2[_0x3b7826(0x1d6)]&&console[_0x3b7826(0x1f4)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x5097d2[_0x3b7826(0x1ca)][_0x3b7826(0x1a9)]>0x0){console[_0x3b7826(0x1f4)]('─'[_0x3b7826(0x211)](0x3c)),console[_0x3b7826(0x1f4)]('\x0a'+a30_0x3a0c62[_0x3b7826(0x277)](_0x3b7826(0x1e5)));for(const _0x56e71d of _0x5097d2[_0x3b7826(0x1ca)]){console[_0x3b7826(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x3b7826(0x277)]('•')+'\x20'+_0x56e71d);}}}async['displaySampleData'](_0x408b01,_0x9e0c1){const _0x1246e3=a30_0x519256;if(_0x9e0c1[_0x1246e3(0x1a9)]===0x0){console[_0x1246e3(0x1f4)]('\x0a'+_0x408b01),console[_0x1246e3(0x1f4)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x1246e3(0x1f4)]('\x0a'+_0x408b01);const _0x312c13=Object[_0x1246e3(0x122)](_0x9e0c1[0x0])[_0x1246e3(0x187)](_0x3c6f25=>({'name':_0x3c6f25,'type':typeof _0x9e0c1[0x0][_0x3c6f25]===_0x1246e3(0x1fc)?_0x1246e3(0x1c2):'varchar'})),_0x2d9809={'queryId':'preview','columns':_0x312c13,'data':_0x9e0c1,'stats':{'state':_0x1246e3(0x24c),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x9e0c1[_0x1246e3(0x1a9)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x261928=formatAsTable(_0x2d9809,_0x9e0c1[_0x1246e3(0x1a9)],!![]);await writeOutput(_0x261928,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]=a30_0x519256(0x21b);[a30_0x519256(0x178)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0x372c0e){const _0x11a4a6=a30_0x519256,{options:_0x37359d,args:_0x3a4e49,tdx:_0x16f45c}=_0x372c0e,_0xc8afc9=_0x37359d,_0x254eac=_0x3a4e49[0x0]||_0x37359d[_0x11a4a6(0x255)];if(!_0x254eac)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x11a4a6(0x17d)),0x1;const _0x331a5a=resolveYamlFile(_0x254eac);if(existsSync(_0x331a5a)){_0xc8afc9[_0x11a4a6(0x270)]&&console['error'](_0x11a4a6(0x151)+_0x331a5a);let _0x3250c1;try{_0x3250c1=readFileSync(_0x331a5a,_0x11a4a6(0x14d));}catch(_0x455264){const _0x2e9d17=_0x455264 instanceof Error?_0x455264[_0x11a4a6(0x139)]:String(_0x455264);return console['error'](_0x11a4a6(0x27a)+_0x2e9d17),0x1;}const _0x26a716=await withSpinner(_0x11a4a6(0x242),()=>_0x16f45c[_0x11a4a6(0x1bc)][_0x11a4a6(0x251)](_0x3250c1),{'verbose':_0xc8afc9[_0x11a4a6(0x270)]}),_0x11dec0=_0x26a716[_0x11a4a6(0x1db)],{isNew:_0x3630a0,name:_0x1628b1,hasChanges:_0x5e02de,diffFormatted:_0x2de49e}=_0x11dec0;if(_0x5e02de){_0x3630a0?console[_0x11a4a6(0x1f4)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x1628b1+'\x27:'):console[_0x11a4a6(0x1f4)](_0x11a4a6(0x147)+_0x1628b1+'\x27:');console[_0x11a4a6(0x1f4)]('─'[_0x11a4a6(0x211)](0x3c)),console[_0x11a4a6(0x1f4)](_0x2de49e),console[_0x11a4a6(0x1f4)]('─'[_0x11a4a6(0x211)](0x3c));const _0x439a0d=_0x3630a0?_0x11a4a6(0x1b2)+_0x1628b1+_0x11a4a6(0x1b5):_0x11a4a6(0x1b9)+_0x1628b1+'\x27\x20and\x20run\x20workflow?';if(!_0xc8afc9[_0x11a4a6(0x15e)]){if(!isInteractive())return console[_0x11a4a6(0x1f4)](a30_0x3a0c62[_0x11a4a6(0x277)](_0x11a4a6(0x175)),_0x11a4a6(0x13f)),console[_0x11a4a6(0x1f4)](a30_0x3a0c62[_0x11a4a6(0x1f3)](_0x11a4a6(0x125))),0x1;const _0x5bce5c=await confirmKey(_0x439a0d);if(!_0x5bce5c)return console[_0x11a4a6(0x1f4)](a30_0x3a0c62[_0x11a4a6(0x289)]('Aborted.')),0x1;}const _0x3b5b92=_0x3630a0?_0x11a4a6(0x28f):'Updating';await withSpinner(_0x3b5b92+'\x20parent\x20segment\x20\x27'+_0x1628b1+_0x11a4a6(0x25b),()=>_0x11dec0['apply'](),{'verbose':_0xc8afc9[_0x11a4a6(0x270)]});const _0x43b570=_0x3630a0?_0x11a4a6(0x247):_0x11a4a6(0x160);console[_0x11a4a6(0x1f4)]('✔\x20'+_0x43b570+'\x20parent\x20segment\x20\x27'+_0x1628b1+'\x27');}else console[_0x11a4a6(0x1f4)](_0x11a4a6(0x18a)+_0x1628b1+_0x11a4a6(0x201));}const _0x2041a2=await withSpinner(_0x11a4a6(0x157)+_0x254eac+'\x27...',()=>_0x16f45c['segment']['runParent'](_0x254eac),{'verbose':_0xc8afc9[_0x11a4a6(0x270)]}),_0x27d252=_0x2041a2[_0x11a4a6(0x1db)],_0x250442=getConsoleUrl(_0xc8afc9[_0x11a4a6(0x17f)],_0x11a4a6(0x177)+_0x27d252['workflowId']+_0x11a4a6(0x1c4)+_0x27d252[_0x11a4a6(0x28e)]+_0x11a4a6(0x15d)+_0x27d252[_0x11a4a6(0x238)]);return console[_0x11a4a6(0x1f4)]('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a30_0x3a0c62[_0x11a4a6(0x1f3)](_0x11a4a6(0x26c))+'\x20'+_0x27d252['audienceId']),console[_0x11a4a6(0x1f4)]('\x20\x20'+a30_0x3a0c62['dim'](_0x11a4a6(0x11d))+'\x20'+_0x27d252[_0x11a4a6(0x112)]),console[_0x11a4a6(0x1f4)]('\x20\x20'+a30_0x3a0c62['dim'](_0x11a4a6(0x113))+'\x20'+_0x27d252[_0x11a4a6(0x28e)]),console[_0x11a4a6(0x1f4)]('\x20\x20'+a30_0x3a0c62[_0x11a4a6(0x1f3)](_0x11a4a6(0x189))+'\x20'+_0x27d252[_0x11a4a6(0x238)]),console[_0x11a4a6(0x1f4)]('\x20\x20'+_0x250442),console[_0x11a4a6(0x1f4)]('\x0a'+a30_0x3a0c62[_0x11a4a6(0x1f3)](_0x11a4a6(0x23b))+'\x20tdx\x20wf\x20attempt\x20'+_0x27d252['workflowAttemptId']+_0x11a4a6(0x18f)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x519256(0x186)]=a30_0x519256(0x124);[a30_0x519256(0x178)]='List\x20available\x20fields\x20for\x20segmentation';async[a30_0x519256(0x263)](_0x3710d3){const _0x491ef2=a30_0x519256,{options:_0x4f1a5a,args:_0x4c5813,tdx:_0x504849}=_0x3710d3,_0x257a92=_0x4c5813[0x0]||_0x4f1a5a[_0x491ef2(0x255)];if(!_0x257a92)return showParentSegmentNotSetError(_0x491ef2(0x245)+_0x491ef2(0x15a)),0x1;_0x4f1a5a[_0x491ef2(0x270)]&&(console[_0x491ef2(0x1f4)](_0x491ef2(0x1f7)+_0x4f1a5a[_0x491ef2(0x17f)]),console['error'](_0x491ef2(0x24b)+_0x257a92));const _0x286203=await withSpinner(_0x491ef2(0x268)+_0x257a92+_0x491ef2(0x25b),()=>_0x504849[_0x491ef2(0x1bc)]['listFields'](_0x257a92),{'verbose':_0x4f1a5a[_0x491ef2(0x270)]}),_0x3ab899=_0x286203[_0x491ef2(0x1db)];console[_0x491ef2(0x1f4)](_0x491ef2(0x140)+_0x3ab899['length']+'\x20field'+(_0x3ab899[_0x491ef2(0x1a9)]!==0x1?'s':''));if(_0x4f1a5a['json']||_0x4f1a5a['jsonl'])return await handleSDKOutput(_0x3ab899,_0x4f1a5a),0x0;return displayFieldsHumanReadable(_0x3ab899,_0x257a92),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x519256(0x186)]='segment:parent:view';[a30_0x519256(0x178)]=a30_0x519256(0x13a);async['execute'](_0x194c08){const _0x3ed7f8=a30_0x519256,{options:_0x270319,args:_0xea57ef,tdx:_0x51dbd3}=_0x194c08,_0x532f0f=_0x270319,_0x972de8=_0xea57ef[0x0]||_0x270319['parentSegment'];if(!_0x972de8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x3ed7f8(0x131)+_0x3ed7f8(0x173)+_0x3ed7f8(0x1dd)),0x1;_0x270319[_0x3ed7f8(0x270)]&&(console['error'](_0x3ed7f8(0x1f7)+_0x270319[_0x3ed7f8(0x17f)]),console[_0x3ed7f8(0x1f4)](_0x3ed7f8(0x24b)+_0x972de8));const _0x9c2369=await withSpinner(_0x3ed7f8(0x1aa)+_0x972de8+'\x27...',()=>_0x51dbd3[_0x3ed7f8(0x1bc)]['getParentFull'](_0x972de8),{'verbose':_0x270319[_0x3ed7f8(0x270)]}),_0x64bd84=_0x9c2369[_0x3ed7f8(0x1db)];if(_0x532f0f['web']){const _0x1d85bb=getConsoleNextUrl(_0x532f0f[_0x3ed7f8(0x17f)],_0x3ed7f8(0x169)+_0x64bd84['id']);return console[_0x3ed7f8(0x1f4)](a30_0x3a0c62[_0x3ed7f8(0x1f6)]('✔')+_0x3ed7f8(0x16b)+a30_0x3a0c62[_0x3ed7f8(0x21e)](_0x1d85bb)),openBrowser(_0x1d85bb),0x0;}return await handleSingleObjectOutput(_0x64bd84,_0x270319),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x519256(0x186)]='segment:parent:desc';['description']=a30_0x519256(0x20e);async[a30_0x519256(0x263)](_0x3cd742){const _0x3e7b33=a30_0x519256,{options:_0x555198,args:_0x484f05,tdx:_0x4f8f98}=_0x3cd742,_0x21eca0=_0x555198,_0x226df0=_0x484f05[0x0]||_0x555198[_0x3e7b33(0x255)];if(!_0x226df0)return showParentSegmentNotSetError(_0x3e7b33(0x1bf)+_0x3e7b33(0x1cb)+_0x3e7b33(0x173)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x555198[_0x3e7b33(0x270)]&&(console[_0x3e7b33(0x1f4)](_0x3e7b33(0x1f7)+_0x555198[_0x3e7b33(0x17f)]),console[_0x3e7b33(0x1f4)](_0x3e7b33(0x24b)+_0x226df0));const _0x139119=await withSpinner(_0x3e7b33(0x11e)+_0x226df0+'\x27...',()=>_0x4f8f98[_0x3e7b33(0x1bc)][_0x3e7b33(0x207)](_0x226df0),{'verbose':_0x555198[_0x3e7b33(0x270)]}),_0x35c2f3=_0x139119['data'],_0x4aac8e=_0x4f8f98[_0x3e7b33(0x1bc)][_0x3e7b33(0x269)](_0x35c2f3);if(_0x21eca0[_0x3e7b33(0x25f)]){const _0x3b80ba=await this[_0x3e7b33(0x23f)](_0x3cd742,_0x226df0,_0x35c2f3,_0x4aac8e),_0x187a6b=this[_0x3e7b33(0x194)](_0x3b80ba);writeFileSync(_0x21eca0[_0x3e7b33(0x25f)],_0x187a6b);const _0x562e48=_0x3b80ba['customers'][_0x3e7b33(0x13e)][_0x3e7b33(0x1a9)]+_0x3b80ba[_0x3e7b33(0x1e4)][_0x3e7b33(0x237)]((_0x29c3c4,_0x163eff)=>_0x29c3c4+_0x163eff['columns'][_0x3e7b33(0x1a9)],0x0),_0xd57317=_0x3b80ba[_0x3e7b33(0x1e4)][_0x3e7b33(0x212)](_0x5dfa4b=>_0x5dfa4b[_0x3e7b33(0x13e)]['length']===0x0)[_0x3e7b33(0x1a9)];return console['log'](_0x3e7b33(0x1c7)+_0x21eca0['output']),console['log'](_0x3e7b33(0x195)+_0x4aac8e),console[_0x3e7b33(0x21f)](_0x3e7b33(0x1ad)+_0x3b80ba[_0x3e7b33(0x1e4)]['length']+_0x3e7b33(0x117)),console[_0x3e7b33(0x21f)](_0x3e7b33(0x1c5)+_0x562e48+'\x20total'),_0xd57317>0x0&&console[_0x3e7b33(0x21f)](_0x3e7b33(0x129)+_0xd57317+_0x3e7b33(0x1d5)),0x0;}console[_0x3e7b33(0x1f4)]('\x0a'+a30_0x3a0c62[_0x3e7b33(0x21a)](_0x3e7b33(0x145))+'\x20'+a30_0x3a0c62[_0x3e7b33(0x21e)](_0x4aac8e));const _0x52a4ba=await withSpinner(_0x3e7b33(0x208),()=>_0x4f8f98[_0x3e7b33(0x1bc)][_0x3e7b33(0x28c)](_0x35c2f3),{'verbose':_0x555198[_0x3e7b33(0x270)]});console[_0x3e7b33(0x1f4)]('\x0a'+a30_0x3a0c62[_0x3e7b33(0x21a)](_0x3e7b33(0x20a))+'\x20'+a30_0x3a0c62['dim']('('+_0x4aac8e+'.customers)'));const _0x48c2a3=await executeSchemaQuery(_0x52a4ba['data'],_0x4f8f98,_0x555198);await handleQueryOutput(_0x48c2a3,_0x555198);const _0xebe518=await withSpinner(_0x3e7b33(0x183),()=>_0x4f8f98[_0x3e7b33(0x1bc)][_0x3e7b33(0x293)](_0x35c2f3),{'verbose':_0x555198[_0x3e7b33(0x270)]});for(const _0x5cdd91 of _0xebe518[_0x3e7b33(0x1db)]){const _0x441029='behavior_'+_0x5cdd91[_0x3e7b33(0x23c)]()[_0x3e7b33(0x146)](/\s+/g,'_'),_0x830279='SELECT\x20*\x20FROM\x20'+_0x4aac8e+'.'+_0x441029;console[_0x3e7b33(0x1f4)]('\x0a'+a30_0x3a0c62['bold'](_0x5cdd91)+'\x20'+a30_0x3a0c62[_0x3e7b33(0x1f3)]('('+_0x4aac8e+'.'+_0x441029+')'));try{const _0x42b72b=await executeSchemaQuery(_0x830279,_0x4f8f98,_0x555198);await handleQueryOutput(_0x42b72b,_0x555198);}catch{console[_0x3e7b33(0x1f4)](a30_0x3a0c62[_0x3e7b33(0x289)](_0x3e7b33(0x1e3)));}}return 0x0;}async[a30_0x519256(0x23f)](_0x478c48,_0x230b1d,_0x5c1880,_0x25f711){const _0x3e2c24=a30_0x519256,{options:_0x5170fc,tdx:_0x2212a0}=_0x478c48,_0x3e3a1b=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x2212a0[_0x3e2c24(0x1bc)][_0x3e2c24(0x28c)](_0x5c1880),{'verbose':_0x5170fc[_0x3e2c24(0x270)]}),_0x4afaa4=await executeSchemaQuery(_0x3e3a1b[_0x3e2c24(0x1db)],_0x2212a0,_0x5170fc),_0x152850=_0x4afaa4[_0x3e2c24(0x1db)][_0x3e2c24(0x187)](_0x325651=>({'name':_0x325651[_0x3e2c24(0x15c)],'type':_0x325651['column_type']})),_0x14dfe3=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x2212a0[_0x3e2c24(0x1bc)][_0x3e2c24(0x293)](_0x5c1880),{'verbose':_0x5170fc[_0x3e2c24(0x270)]}),_0x46d135=[];for(const _0x1dd768 of _0x14dfe3[_0x3e2c24(0x1db)]){const _0x319d3a=_0x3e2c24(0x13b)+_0x1dd768['toLowerCase']()[_0x3e2c24(0x146)](/\s+/g,'_'),_0x2bdea4='SELECT\x20*\x20FROM\x20'+_0x25f711+'.'+_0x319d3a;let _0xdc56cb=[];try{const _0x487ad4=await executeSchemaQuery(_0x2bdea4,_0x2212a0,_0x5170fc);_0xdc56cb=_0x487ad4[_0x3e2c24(0x1db)][_0x3e2c24(0x187)](_0x588d68=>({'name':_0x588d68[_0x3e2c24(0x15c)],'type':_0x588d68[_0x3e2c24(0x1cf)]}));}catch{}_0x46d135[_0x3e2c24(0x246)]({'table':_0x319d3a,'columns':_0xdc56cb});}return{'database':_0x25f711,'parent_segment':_0x230b1d,'parent_id':_0x5c1880,'customers':{'table':_0x3e2c24(0x20a),'columns':_0x152850},'behaviors':_0x46d135};}[a30_0x519256(0x194)](_0x4672bb){const _0x5ed1f2=a30_0x519256,_0x2be90d=_0x20d9af=>{const _0x2dd230=a30_0x4a69;if(_0x20d9af['length']===0x0)return'[]';const _0x41be84=_0x20d9af['map'](_0x344cad=>_0x2dd230(0x1e2)+_0x344cad[_0x2dd230(0x186)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x344cad[_0x2dd230(0x1df)]+_0x2dd230(0x258));return'[\x0a'+_0x41be84[_0x2dd230(0x16f)](',\x0a')+_0x2dd230(0x249);},_0x3e299c=_0x4672bb[_0x5ed1f2(0x1e4)][_0x5ed1f2(0x187)](_0x557963=>{const _0x11a084=_0x5ed1f2;return _0x11a084(0x275)+_0x557963[_0x11a084(0x28a)]+_0x11a084(0x141)+_0x2be90d(_0x557963[_0x11a084(0x13e)])['replace'](/^/gm,'\x20\x20')[_0x11a084(0x290)]()+'\x0a\x20\x20\x20\x20}';})[_0x5ed1f2(0x16f)](',\x0a');return _0x5ed1f2(0x142)+_0x4672bb[_0x5ed1f2(0x115)]+_0x5ed1f2(0x1ec)+_0x4672bb[_0x5ed1f2(0x248)]+_0x5ed1f2(0x168)+_0x4672bb[_0x5ed1f2(0x27b)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x4672bb[_0x5ed1f2(0x20a)][_0x5ed1f2(0x28a)]+_0x5ed1f2(0x235)+_0x2be90d(_0x4672bb[_0x5ed1f2(0x20a)]['columns'])[_0x5ed1f2(0x146)](/^/gm,'\x20\x20')[_0x5ed1f2(0x290)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x3e299c+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a30_0x519256(0x16e);['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x519256(0x263)](_0x4a6809){const _0x27ca6b=a30_0x519256,{options:_0x1d85f3,args:_0x3e6a96,tdx:_0x5b06e1}=_0x4a6809,_0x84eaa5=_0x3e6a96[0x0]||_0x1d85f3[_0x27ca6b(0x255)];if(!_0x84eaa5)return showParentSegmentNotSetError(_0x27ca6b(0x229)+_0x27ca6b(0x20d)),0x1;_0x1d85f3[_0x27ca6b(0x270)]&&(console[_0x27ca6b(0x1f4)](_0x27ca6b(0x1f7)+_0x1d85f3[_0x27ca6b(0x17f)]),console[_0x27ca6b(0x1f4)](_0x27ca6b(0x24b)+_0x84eaa5));const _0xe427c=await withSpinner(_0x27ca6b(0x11e)+_0x84eaa5+_0x27ca6b(0x25b),()=>_0x5b06e1[_0x27ca6b(0x1bc)]['resolveParentId'](_0x84eaa5),{'verbose':_0x1d85f3[_0x27ca6b(0x270)]}),_0x22f68b=_0xe427c[_0x27ca6b(0x1db)],_0xc5d644=await withSpinner(_0x27ca6b(0x1b1)+_0x84eaa5+_0x27ca6b(0x25b),()=>_0x5b06e1[_0x27ca6b(0x1bc)]['getParentSQL'](_0x22f68b),{'verbose':_0x1d85f3[_0x27ca6b(0x270)]}),_0x40f5bc=_0xc5d644[_0x27ca6b(0x1db)];return _0x1d85f3[_0x27ca6b(0x1e8)]===_0x27ca6b(0x116)||_0x1d85f3[_0x27ca6b(0x1e8)]===_0x27ca6b(0x21d)?await handleSDKOutput([{'sql':_0x40f5bc}],_0x1d85f3):console[_0x27ca6b(0x21f)](_0x40f5bc),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x519256(0x186)]=a30_0x519256(0x190);[a30_0x519256(0x178)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a30_0x519256(0x263)](_0x246d69){const _0x29334c=a30_0x519256,{options:_0x158895,args:_0xd2c0ae,tdx:_0x1dfed4}=_0x246d69,_0xd96f49=_0xd2c0ae[0x0]||_0x158895['parentSegment'];if(!_0xd96f49)return showParentSegmentNotSetError(_0x29334c(0x19f)+'\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;_0x158895[_0x29334c(0x270)]&&(console['error'](_0x29334c(0x1f7)+_0x158895['site']),console[_0x29334c(0x1f4)](_0x29334c(0x24b)+_0xd96f49));const _0x457f41=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xd96f49+_0x29334c(0x25b),()=>_0x1dfed4[_0x29334c(0x1bc)]['resolveParentId'](_0xd96f49),{'verbose':_0x158895[_0x29334c(0x270)]}),_0x2f0e06=_0x457f41['data'],_0x48c9b0=await withSpinner(_0x29334c(0x1b1)+_0xd96f49+_0x29334c(0x25b),()=>_0x1dfed4[_0x29334c(0x1bc)][_0x29334c(0x28c)](_0x2f0e06),{'verbose':_0x158895[_0x29334c(0x270)]});let _0x3557a6=_0x48c9b0['data'];const _0x312f85=resolveLimit(_0x158895[_0x29334c(0x16c)],DEFAULT_DISPLAY_LIMIT),_0x14123f=/\bLIMIT\s+\d+/i['test'](_0x3557a6);!_0x14123f&&(_0x3557a6=_0x3557a6[_0x29334c(0x290)]()[_0x29334c(0x146)](/;+$/,''),_0x3557a6=_0x29334c(0x13c)+_0x3557a6+_0x29334c(0x1ff)+_0x312f85);_0x158895[_0x29334c(0x270)]&&console['error']('SQL\x20query:\x0a'+_0x3557a6);const _0x20d6cf=await withProgressSpinner(_0x29334c(0x144),async _0x4e0cc5=>{const _0x37da28=_0x29334c,_0xd064e=await _0x1dfed4[_0x37da28(0x209)][_0x37da28(0x263)](_0x3557a6,{'catalog':'td','schema':_0x37da28(0x161),'onJobId':_0x2b0f5d=>{_0x4e0cc5['setJobId'](_0x2b0f5d);}});return _0xd064e;},{'verbose':_0x158895[_0x29334c(0x270)]}),_0x5ba415=_0x20d6cf[_0x29334c(0x1db)],_0x5137f5=_0x5ba415[_0x29334c(0x1e9)]?_0x29334c(0x182)+_0x5ba415[_0x29334c(0x1e9)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x5ba415[_0x29334c(0x224)][_0x29334c(0x27f)][_0x29334c(0x152)]()+'\x20rows\x20'+(_0x29334c(0x1a3)+formatElapsed(_0x5ba415['stats']['elapsedTimeMillis'])+_0x5137f5)),await handleQueryOutput(_0x5ba415,_0x158895),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x519256(0x14f);[a30_0x519256(0x178)]=a30_0x519256(0x1b7);async[a30_0x519256(0x263)](_0x157d08){const _0x2918b8=a30_0x519256,{options:_0x3a7bb9,args:_0x39c3bd,tdx:_0x247248}=_0x157d08,_0x1d1534=_0x39c3bd[0x0],_0x3e8d8b=await withSpinner(_0x1d1534?_0x2918b8(0x1d4)+_0x1d1534+_0x2918b8(0x25b):_0x2918b8(0x227),()=>_0x247248['realtime'][_0x2918b8(0x250)](),{'verbose':_0x3a7bb9[_0x2918b8(0x270)]});let _0x1d8f74=_0x3e8d8b[_0x2918b8(0x1db)][_0x2918b8(0x212)](_0x142629=>_0x142629[_0x2918b8(0x164)]);if(_0x1d1534){const _0x57cccd=_0x1d1534[_0x2918b8(0x146)](/[.+^${}()|[\]\\]/g,_0x2918b8(0x14c))[_0x2918b8(0x146)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x1b36ce=new RegExp('^'+_0x57cccd+'$','i');_0x1d8f74=_0x1d8f74[_0x2918b8(0x212)](_0x9abaa3=>_0x1b36ce[_0x2918b8(0x126)](_0x9abaa3[_0x2918b8(0x186)]));}_0x1d8f74[_0x2918b8(0x244)]((_0x3366be,_0x24f17c)=>_0x3366be['name'][_0x2918b8(0x128)](_0x24f17c[_0x2918b8(0x186)])),console[_0x2918b8(0x1f4)]('✔\x20Found\x20'+_0x1d8f74[_0x2918b8(0x1a9)]+_0x2918b8(0x1d7)+(_0x1d8f74['length']!==0x1?'s':''));const _0x5f5011=_0x247a3c=>{const _0xa6f755=_0x2918b8;return getConsoleNextUrl(_0x3a7bb9[_0xa6f755(0x17f)],'/app/dw/parentSegments/'+_0x247a3c);};if(_0x3a7bb9[_0x2918b8(0x1e8)]===_0x2918b8(0x116)||_0x3a7bb9['format']==='jsonl'){const _0x547e73=_0x1d8f74['map'](_0x152ed9=>({..._0x152ed9,'url':_0x5f5011(_0x152ed9['id'])}));await handleSDKOutput(_0x547e73,_0x3a7bb9);}else{if(_0x1d8f74[_0x2918b8(0x1a9)]===0x0)console[_0x2918b8(0x21f)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0xb844fe of _0x1d8f74){const _0x54e524=_0xb844fe[_0x2918b8(0x1c0)]?a30_0x3a0c62['dim']('\x20('+formatRows(_0xb844fe['population'])+')'):'',_0x2131fb=hyperlink(_0xb844fe[_0x2918b8(0x186)],_0x5f5011(_0xb844fe['id']));console[_0x2918b8(0x21f)]('⚡\x20'+_0x2131fb+_0x54e524);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]='ps:rt:validate';[a30_0x519256(0x178)]=a30_0x519256(0x273);async[a30_0x519256(0x263)](_0x26b28){const _0x13c676=a30_0x519256,{options:_0x4f8dc2,args:_0x555799,tdx:_0x7a7b49}=_0x26b28,_0x40973d=_0x555799[0x0]||_0x4f8dc2[_0x13c676(0x255)];if(!_0x40973d)return showParentSegmentNotSetError(_0x13c676(0x17b)+_0x13c676(0x110)),0x1;const _0x81d14b=resolveYamlFile(_0x40973d);if(!existsSync(_0x81d14b))return showFileNotFoundError(_0x81d14b,_0x40973d),0x1;let _0x43e58d;try{_0x43e58d=readFileSync(_0x81d14b,_0x13c676(0x14d));}catch(_0x54d2b7){const _0x338afd=_0x54d2b7 instanceof Error?_0x54d2b7[_0x13c676(0x139)]:String(_0x54d2b7);return console[_0x13c676(0x1f4)]('Error\x20reading\x20file:\x20'+_0x338afd),0x1;}const _0x108a77=createCommandSpinner(a30_0x3a0c62[_0x13c676(0x1f3)](_0x13c676(0x252)),{'verbose':_0x4f8dc2['verbose']});_0x108a77[_0x13c676(0x14a)]();const _0x14511d={'realtime':!![],'onProgress':_0x1e02a0=>{const _0x45ce61=_0x13c676;_0x108a77[_0x45ce61(0x1de)]=formatProgressMessage(_0x1e02a0);}};let _0x2c281e;try{_0x2c281e=await _0x7a7b49[_0x13c676(0x1bc)][_0x13c676(0x220)](_0x43e58d,_0x14511d),_0x108a77[_0x13c676(0x205)]();}catch(_0x21f8ee){_0x108a77[_0x13c676(0x205)]();throw _0x21f8ee;}console[_0x13c676(0x1f4)]('\x0a'+a30_0x3a0c62[_0x13c676(0x21a)](_0x13c676(0x12b))+'\x20'+_0x2c281e['name']),console[_0x13c676(0x1f4)]('═'[_0x13c676(0x211)](0x3c)),displayRealtimeValidation(_0x2c281e),console[_0x13c676(0x1f4)]('─'[_0x13c676(0x211)](0x3c));if(_0x2c281e[_0x13c676(0x1ca)][_0x13c676(0x1a9)]>0x0){console[_0x13c676(0x1f4)]('\x0a'+a30_0x3a0c62[_0x13c676(0x277)]('Errors:'));for(const _0x2044b0 of _0x2c281e[_0x13c676(0x1ca)]){console[_0x13c676(0x1f4)]('\x20\x20'+a30_0x3a0c62['red']('•')+'\x20'+_0x2044b0);}}return _0x2c281e[_0x13c676(0x1f2)]&&console[_0x13c676(0x1f4)]('\x0a'+a30_0x3a0c62[_0x13c676(0x1f6)]('✔')+_0x13c676(0x12c)),_0x2c281e[_0x13c676(0x1f2)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x519256(0x186)]=a30_0x519256(0x213);[a30_0x519256(0x178)]=a30_0x519256(0x240);async[a30_0x519256(0x263)](_0x541564){const _0x297b0a=a30_0x519256,{options:_0x590e88,args:_0x547f59,tdx:_0x1a7292}=_0x541564,_0xe1a20f=_0x547f59[0x0]||_0x590e88[_0x297b0a(0x255)];if(!_0xe1a20f)return showParentSegmentNotSetError(_0x297b0a(0x264)+_0x297b0a(0x22d)),0x1;const _0x3b81ad=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xe1a20f+_0x297b0a(0x25b),()=>_0x1a7292[_0x297b0a(0x1bc)][_0x297b0a(0x207)](_0xe1a20f),{'verbose':_0x590e88['verbose']}),_0x4bdf2a=_0x3b81ad['data'],_0x31249b=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0xe1a20f+_0x297b0a(0x25b),()=>_0x1a7292[_0x297b0a(0x192)][_0x297b0a(0x250)](_0x4bdf2a),{'verbose':_0x590e88[_0x297b0a(0x270)]}),_0xd2affa=_0x31249b[_0x297b0a(0x1db)];console['error'](_0x297b0a(0x140)+_0xd2affa[_0x297b0a(0x1a9)]+_0x297b0a(0x233)+(_0xd2affa[_0x297b0a(0x1a9)]!==0x1?'s':''));if(_0x590e88['format']==='json'||_0x590e88[_0x297b0a(0x1e8)]===_0x297b0a(0x21d))await handleSDKOutput(_0xd2affa,_0x590e88);else{if(_0xd2affa[_0x297b0a(0x1a9)]===0x0)console['log']('No\x20personalization\x20services\x20configured'),console[_0x297b0a(0x1f4)](a30_0x3a0c62[_0x297b0a(0x21e)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x170e97 of _0xd2affa){const _0x4fe941=_0x170e97[_0x297b0a(0x1ed)]?.[_0x297b0a(0x1a9)]||0x0,_0x1fc13e=_0x170e97['trigger_event']?a30_0x3a0c62['dim'](_0x297b0a(0x18e)+_0x170e97[_0x297b0a(0x1fb)]):'',_0x2474d2=a30_0x3a0c62[_0x297b0a(0x1f3)]('\x20('+_0x4fe941+'\x20section'+(_0x4fe941!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x170e97[_0x297b0a(0x186)]+_0x1fc13e+_0x2474d2),_0x170e97['description']&&console[_0x297b0a(0x21f)](_0x297b0a(0x1a0)+a30_0x3a0c62[_0x297b0a(0x1f3)](_0x170e97[_0x297b0a(0x178)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x519256(0x186)]='ps:pz:init';[a30_0x519256(0x178)]=a30_0x519256(0x1c3);async[a30_0x519256(0x263)](_0x3e462b){const _0x45bb40=a30_0x519256,{options:_0x23a095,args:_0x1d148c}=_0x3e462b,_0x5c8bb5=_0x1d148c[0x0]||_0x23a095['parentSegment'];if(!_0x5c8bb5)return showParentSegmentNotSetError(_0x45bb40(0x153)+_0x45bb40(0x1d2)),0x1;const _0x3c8fd9=resolveYamlFile(_0x5c8bb5);if(!existsSync(_0x3c8fd9))return showFileNotFoundError(_0x3c8fd9,_0x5c8bb5),0x1;let _0x599237;try{_0x599237=readFileSync(_0x3c8fd9,_0x45bb40(0x14d));}catch(_0x2fe975){const _0x5181f7=_0x2fe975 instanceof Error?_0x2fe975[_0x45bb40(0x139)]:String(_0x2fe975);return console['error'](_0x45bb40(0x27a)+_0x5181f7),0x1;}let _0x122c80;try{_0x122c80=parseDef(_0x599237);}catch(_0xa97121){const _0x2bdabf=_0xa97121 instanceof Error?_0xa97121[_0x45bb40(0x139)]:String(_0xa97121);return console[_0x45bb40(0x1f4)](a30_0x3a0c62[_0x45bb40(0x277)](_0x45bb40(0x1a4)+_0x2bdabf)),0x1;}if(_0x122c80[_0x45bb40(0x1f1)]&&_0x122c80[_0x45bb40(0x1f1)]['length']>0x0)return console[_0x45bb40(0x1f4)](a30_0x3a0c62[_0x45bb40(0x289)](_0x45bb40(0x136)+_0x3c8fd9)),console[_0x45bb40(0x1f4)](a30_0x3a0c62[_0x45bb40(0x1f3)](_0x45bb40(0x11c)+_0x122c80['personalization_services']['length']+'\x20service(s)\x20configured')),0x1;!_0x122c80[_0x45bb40(0x1a1)]&&(_0x122c80[_0x45bb40(0x1a1)]={'events':[{'name':'page_view','source_table':_0x45bb40(0x291)}],'attributes':[{'name':_0x45bb40(0x132),'type':'single'}],'id_stitching':{'primary_key':_0x122c80[_0x45bb40(0x156)][_0x45bb40(0x28a)]===_0x45bb40(0x20a)?_0x45bb40(0x272):_0x45bb40(0x206)}});_0x122c80['personalization_services']=[{'name':_0x45bb40(0x1bb),'description':_0x45bb40(0x12a),'trigger_event':'page_view','sections':[{'name':_0x45bb40(0x26a),'criteria':_0x45bb40(0x26d),'attributes':[_0x45bb40(0x132)]}]}];const _0x2a5c48=serializeDef(_0x122c80);return writeFileSync(_0x3c8fd9,_0x2a5c48,_0x45bb40(0x14d)),console['error'](a30_0x3a0c62[_0x45bb40(0x1f6)]('✔')+_0x45bb40(0x1fa)+a30_0x3a0c62[_0x45bb40(0x21e)](_0x3c8fd9)),(!_0x122c80[_0x45bb40(0x1a1)]||_0x599237[_0x45bb40(0x1ae)](_0x45bb40(0x167))===-0x1)&&console[_0x45bb40(0x1f4)](a30_0x3a0c62['green']('✔')+_0x45bb40(0x1dc)),console[_0x45bb40(0x1f4)]('\x0a'+a30_0x3a0c62['dim'](_0x45bb40(0x163))),console[_0x45bb40(0x1f4)](_0x45bb40(0x23a)+_0x3c8fd9+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x45bb40(0x1f4)](_0x45bb40(0x221)+a30_0x3a0c62[_0x45bb40(0x1f3)](_0x45bb40(0x120)+_0x5c8bb5)+_0x45bb40(0x22a)),0x0;}}
1
+ const a30_0x31aa82=a30_0x3c23;(function(_0x5a3325,_0xd3643){const _0x18c3e2=a30_0x3c23,_0xb19c22=_0x5a3325();while(!![]){try{const _0x198c7e=-parseInt(_0x18c3e2(0x99))/0x1*(-parseInt(_0x18c3e2(0x1b4))/0x2)+parseInt(_0x18c3e2(0x92))/0x3+parseInt(_0x18c3e2(0xd1))/0x4*(parseInt(_0x18c3e2(0x20f))/0x5)+-parseInt(_0x18c3e2(0x87))/0x6+parseInt(_0x18c3e2(0x1a6))/0x7+-parseInt(_0x18c3e2(0x171))/0x8*(parseInt(_0x18c3e2(0x1dd))/0x9)+parseInt(_0x18c3e2(0x1c9))/0xa;if(_0x198c7e===_0xd3643)break;else _0xb19c22['push'](_0xb19c22['shift']());}catch(_0x1283df){_0xb19c22['push'](_0xb19c22['shift']());}}}(a30_0x478b,0xd78bd));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x4ff47e 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 a30_0x5768fb 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=a30_0x31aa82(0x137),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x406c47){const _0x1736c7=a30_0x31aa82,_0x5ce042=process['platform'],_0x13a9d5=_0x5ce042==='darwin'?_0x1736c7(0x18e):_0x5ce042===_0x1736c7(0x17a)?_0x1736c7(0x18a):_0x1736c7(0x19a);spawn(_0x13a9d5,[_0x406c47],{'detached':!![],'stdio':_0x1736c7(0xd7)})[_0x1736c7(0x140)]();}function migrateLegacyDirectory(){const _0xe3d446=a30_0x31aa82;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2fa4dc=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2fa4dc[_0xe3d446(0x12f)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xe3d446(0xaa)](a30_0x5768fb['yellow'](_0xe3d446(0xa3)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0xe3d446(0x145))),console[_0xe3d446(0xaa)](a30_0x5768fb[_0xe3d446(0x201)](_0xe3d446(0x105)+LEGACY_PARENT_SEGMENT_DIR+_0xe3d446(0x138))),![];console[_0xe3d446(0xaa)](a30_0x5768fb[_0xe3d446(0x159)](_0xe3d446(0x1e1)+LEGACY_PARENT_SEGMENT_DIR+_0xe3d446(0x1f3)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x5768fb[_0xe3d446(0x1bb)](_0xe3d446(0x11e)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x43de90){const _0x4233c8=_0x43de90 instanceof Error?_0x43de90[_0xe3d446(0x186)]:String(_0x43de90);return console[_0xe3d446(0xaa)](a30_0x5768fb[_0xe3d446(0x103)](_0xe3d446(0xa0)+_0x4233c8+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x31aa82(0x1c0)](_0x4a5d44){const _0x20e730=a30_0x31aa82;return migrateLegacyDirectory(),super[_0x20e730(0x1c0)](_0x4a5d44);}}function resolveYamlFile(_0xd5c878){const _0x43959d=a30_0x31aa82;if(_0xd5c878[_0x43959d(0x195)](_0x43959d(0x11d))||_0xd5c878[_0x43959d(0x195)]('.yaml'))return _0xd5c878;return a30_0x4ff47e[_0x43959d(0x10a)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd5c878)+'.yml');}function formatProgressMessage(_0x5213f8){const _0x22fc05=a30_0x31aa82,_0x4bad1e=_0x5213f8[_0x22fc05(0x1b2)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4bad1e){const [,_0x36d441,_0x15cb3f,_0x4cb80a='']=_0x4bad1e;return a30_0x5768fb[_0x22fc05(0x201)](_0x36d441+':')+'\x20'+_0x15cb3f+a30_0x5768fb['dim'](_0x4cb80a);}return a30_0x5768fb[_0x22fc05(0x201)](_0x5213f8);}function showFileNotFoundError(_0x203e77,_0x40f054){const _0x30419c=a30_0x31aa82;console['error'](a30_0x5768fb['red'](_0x30419c(0x8b)+_0x203e77+'\x0a')),console['error'](a30_0x5768fb[_0x30419c(0x95)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x40f054+_0x30419c(0xfc)));}function displayRealtimeValidation(_0x2246ff){const _0x16bcfe=a30_0x31aa82;if(!_0x2246ff[_0x16bcfe(0x126)])return;const _0x2b5cc5=_0x2246ff['realtime'],_0x572e1f=_0x2b5cc5[_0x16bcfe(0x1a5)]?a30_0x5768fb[_0x16bcfe(0x1bb)](_0x16bcfe(0x1ff)):a30_0x5768fb[_0x16bcfe(0x159)]('⚡\x20Not\x20enabled');console[_0x16bcfe(0xaa)]('\x0a'+a30_0x5768fb[_0x16bcfe(0x201)](_0x16bcfe(0x147))+'\x20'+_0x572e1f);if(_0x2b5cc5[_0x16bcfe(0x1c4)]&&_0x2b5cc5[_0x16bcfe(0x1c4)][_0x16bcfe(0xcc)]>0x0){console[_0x16bcfe(0xaa)]('\x20\x20'+a30_0x5768fb['dim'](_0x16bcfe(0x166))+'\x20'+_0x2b5cc5[_0x16bcfe(0x1c4)][_0x16bcfe(0xcc)]+_0x16bcfe(0x1ad));for(const _0x3610ce of _0x2b5cc5[_0x16bcfe(0x1c4)]){const _0xf29256=_0x3610ce[_0x16bcfe(0x1bc)]===![]?a30_0x5768fb['red']('✘'):a30_0x5768fb[_0x16bcfe(0x1bb)]('✔');console['error'](_0x16bcfe(0x124)+_0xf29256+'\x20'+_0x3610ce[_0x16bcfe(0x173)]),_0x3610ce[_0x16bcfe(0x1cc)]&&console[_0x16bcfe(0xaa)](_0x16bcfe(0x194)+a30_0x5768fb[_0x16bcfe(0x103)](_0x3610ce[_0x16bcfe(0x1cc)]));}}if(_0x2b5cc5[_0x16bcfe(0xca)]&&_0x2b5cc5['attributes']['length']>0x0){console[_0x16bcfe(0xaa)]('\x20\x20'+a30_0x5768fb[_0x16bcfe(0x201)](_0x16bcfe(0x13e))+'\x20'+_0x2b5cc5[_0x16bcfe(0xca)][_0x16bcfe(0xcc)]+'\x20configured');for(const _0x5df4b4 of _0x2b5cc5[_0x16bcfe(0xca)]){const _0x545b86=_0x5df4b4[_0x16bcfe(0xe0)]?a30_0x5768fb[_0x16bcfe(0x1bb)]('✔'):a30_0x5768fb[_0x16bcfe(0x103)]('✘');console[_0x16bcfe(0xaa)](_0x16bcfe(0x124)+_0x545b86+'\x20'+_0x5df4b4['name']+'\x20'+a30_0x5768fb[_0x16bcfe(0x201)]('('+_0x5df4b4[_0x16bcfe(0x1a8)]+')'));}}if(_0x2b5cc5[_0x16bcfe(0x131)]){const _0xf0ee8d=_0x2b5cc5['idStitching'][_0x16bcfe(0x1dc)]?.[_0x16bcfe(0xcc)]?_0x16bcfe(0x1ee)+_0x2b5cc5[_0x16bcfe(0x131)][_0x16bcfe(0x1dc)][_0x16bcfe(0x10a)](',\x20')+']':'';console[_0x16bcfe(0xaa)]('\x20\x20'+a30_0x5768fb[_0x16bcfe(0x201)](_0x16bcfe(0x88))+'\x20'+_0x2b5cc5[_0x16bcfe(0x131)][_0x16bcfe(0x144)]+_0xf0ee8d);}if(_0x2b5cc5[_0x16bcfe(0x1da)]&&_0x2b5cc5['personalizationServices'][_0x16bcfe(0xcc)]>0x0){console[_0x16bcfe(0xaa)]('\x20\x20'+a30_0x5768fb[_0x16bcfe(0x201)](_0x16bcfe(0x17e))+'\x20'+_0x2b5cc5[_0x16bcfe(0x1da)][_0x16bcfe(0xcc)]+_0x16bcfe(0xe6)+(_0x2b5cc5[_0x16bcfe(0x1da)][_0x16bcfe(0xcc)]!==0x1?'s':''));for(const _0x3a0a1a of _0x2b5cc5[_0x16bcfe(0x1da)]){console['error']('\x20\x20\x20\x20-\x20'+_0x3a0a1a['name']);}}}function showParentSegmentNotSetError(_0x5afa48){const _0x36371b=a30_0x31aa82;console[_0x36371b(0xaa)](a30_0x5768fb[_0x36371b(0x159)](_0x36371b(0x1f6))),console[_0x36371b(0xaa)](_0x5afa48);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0xd4);['description']=a30_0x31aa82(0x96);async[a30_0x31aa82(0x110)](_0x262036){const _0x2f4cb3=a30_0x31aa82,{options:_0x36893b,args:_0x294777,tdx:_0x193b78}=_0x262036,_0xe6f0cd=_0x294777[0x0];_0x36893b[_0x2f4cb3(0xaf)]&&(console[_0x2f4cb3(0xaa)]('Site:\x20'+_0x36893b[_0x2f4cb3(0x148)]),_0xe6f0cd&&console[_0x2f4cb3(0xaa)]('Pattern:\x20'+_0xe6f0cd));const _0x4cbb1e=await withSpinner(_0xe6f0cd?_0x2f4cb3(0x114)+_0xe6f0cd+_0x2f4cb3(0x20a):_0x2f4cb3(0x115),()=>_0x193b78['segment'][_0x2f4cb3(0x1ce)](),{'verbose':_0x36893b['verbose']});let _0x581768=_0x4cbb1e[_0x2f4cb3(0x1e8)];if(_0xe6f0cd){const _0x43717b=_0xe6f0cd[_0x2f4cb3(0x1b5)](/[.+^${}()|[\]\\]/g,_0x2f4cb3(0xfa))[_0x2f4cb3(0x1b5)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x29d486=new RegExp('^'+_0x43717b+'$','i');_0x581768=_0x581768[_0x2f4cb3(0x1d9)](_0x1fa5a1=>_0x29d486[_0x2f4cb3(0x187)](_0x1fa5a1[_0x2f4cb3(0xca)][_0x2f4cb3(0x173)]));}_0x581768['sort']((_0x58af65,_0xac68ff)=>_0x58af65[_0x2f4cb3(0xca)][_0x2f4cb3(0x173)][_0x2f4cb3(0x161)](_0xac68ff[_0x2f4cb3(0xca)][_0x2f4cb3(0x173)])),console['error']('✔\x20Found\x20'+_0x581768[_0x2f4cb3(0xcc)]+_0x2f4cb3(0x1f4)+(_0x581768[_0x2f4cb3(0xcc)]!==0x1?'s':''));const _0x5cc829=_0x503568=>{const _0x495823=_0x2f4cb3;return getConsoleNextUrl(_0x36893b[_0x495823(0x148)],_0x495823(0x9b)+_0x503568);};if(_0x36893b['format']===_0x2f4cb3(0x1b9)||_0x36893b[_0x2f4cb3(0x1c2)]===_0x2f4cb3(0xea)){const _0x5f0320=_0x581768[_0x2f4cb3(0xbe)](_0x49a1d4=>({..._0x49a1d4,'url':_0x5cc829(_0x49a1d4['id'])}));await handleSDKOutput(_0x5f0320,_0x36893b);}else{if(_0x581768[_0x2f4cb3(0xcc)]===0x0)_0xe6f0cd?console[_0x2f4cb3(0x1ec)](_0x2f4cb3(0x1fd)+_0xe6f0cd):console[_0x2f4cb3(0x1ec)](_0x2f4cb3(0x13d));else for(const _0x36edc5 of _0x581768){const _0x4df8da=_0x36edc5[_0x2f4cb3(0xca)]['population']?a30_0x5768fb[_0x2f4cb3(0x201)]('\x20('+formatRows(_0x36edc5[_0x2f4cb3(0xca)][_0x2f4cb3(0xf9)])+')'):'',_0x35fe88=hyperlink(_0x36edc5[_0x2f4cb3(0xca)][_0x2f4cb3(0x173)],_0x5cc829(_0x36edc5['id']));console[_0x2f4cb3(0x1ec)]('👥\x20'+_0x35fe88+_0x4df8da);}}return 0x0;}}function a30_0x478b(){const _0x4c38d5=['\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','message','test','SELECT\x20*\x20FROM\x20(\x0a','Output\x20file:\x20','start','\x20No\x20changes\x20-\x20','allValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','open','Output\x20Database:','varchar','Table:\x20','interval','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','\x20\x20\x20\x20\x20\x20','endsWith','\x20\x20No\x20sample\x20data\x20available','\x0a\x20\x20\x20\x20]','sort','totalEvents','xdg-open','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','displayValidateResults','\x20\x20Database:\x20','\x20rows\x20','getParentFull','single','\x20=\x20','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','enabled','1297177xnWXXG','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','type','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','apply','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','\x20configured','timezone','\x0aChanges\x20to\x20apply\x20to\x20\x27','utf-8','bold','match','To\x20cancel:','2kVLuqF','replace','behaviors','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','displayMasterInfo','json','\x0a\x20\x20]\x0a}\x0a','green','sourceTableValid','scheduleOption','\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','Behavior:','run','\x20parent\x20segment\x20\x27','format','segment:parent:sql','events','Error:','Fetching\x20behavior\x20list...','in\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','1469800imebLR','behavior','displayRealtimeInfo','sourceTableError','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','listParents','My\x20Service','segment:parent:show','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Parent\x20segment:\x20','segment:parent:view','customersWithEvents','Errors:','Error\x20parsing\x20YAML:\x20','filter','personalizationServices','sampleData','stitchingKeys','9glTBqf','SELECT\x20*\x20FROM\x20','\x20\x20\x20\x20-\x20','\x20field','\x0a⚠️\x20\x20Migrating:\x20','repeat','master','\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','Error\x20reading\x20file:\x20','rowCount','toFixed','data','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20RT\x20configuration\x20is\x20valid','<database>.<table>','log','table','\x20+\x20[','last_page_viewed','stop','column_name','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','/\x20→\x20','\x20parent\x20segment','Create\x20parent\x20segment\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','ps:rt:validate','tdx\x20ps\x20push\x20','elapsedTimeMillis','✔\x20Found\x20','addBehaviors','Available\x20behaviors:','No\x20parent\x20segments\x20match\x20pattern:\x20','processedRows','⚡\x20Enabled','status','dim','RT\x202.0\x20Validate:','\x22,\x20\x22type\x22:\x20\x22','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Fetching\x20SQL\x20for\x20\x27','indexOf','Updating','previewParentYaml','jobId','\x27...','\x20--behavior\x20\x22<name>\x22','listFields','behaviorsFile','Validate:','485bmFXMq','Columns:','Fetching\x20sample\x20data...','Creating','4831344xXJKos','ID\x20Stitching:','realtime_enabled','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Error:\x20File\x20not\x20found:\x20','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','customers','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','schemaError','workflowAttemptId','preview','4189707LDeCZL','✔\x20No\x20changes\x20-\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','cyan','List\x20parent\x20segments','column','displayPreviewResults','457917DfmWvj','customerPercent','/app/dw/parentSegments/','\x20to\x20push\x20the\x20configuration','displayAttributesStats','segment:parent:push','segment:parent:validate','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20trigger=','ps:pz:init','\x0a⚠️\x20\x20Both\x20','output','displayBehaviorsStats','\x27\x20is\x20already\x20up\x20to\x20date','keys','customerGroupFile','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','error','List\x20available\x20fields\x20for\x20segmentation','attributesFile','Site:\x20','ps:pz:list','verbose','foreignKey','Aborted.','Executing\x20parent\x20segment\x20query...','parent_id','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20personalization\x20service','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','trim','displaySummary','label','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','workflowSessionId','Apply\x20changes\x20to\x20\x27','Listing\x20fields\x20for\x20\x27','map','Fetching\x20parent\x20segment\x20\x27','Behaviors','\x20is\x20already\x20up\x20to\x20date','Error:\x20Parent\x20segment\x20name\x20is\x20required','Rows:','ps:rt:list','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','database','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','parentSegment','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','attributes','Attempt:','length','/app/workflows/','validateParentYaml','Join\x20on:','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','47860xbJFjU','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','segment:parent:list','/attempt/','\x20Added\x20RT\x202.0\x20template\x20section','ignore','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','segment','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','query','text','\x20section','\x0aError:','coveragePercent','valid','collectSchema','td_client_id','session','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20service','segment:parent:pull','tdx\x20ps\x20preview\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','jsonl','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','displayColumns','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','/{name}.yml\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','pushParentYaml','%)\x20','\x20--interval\x20','trigger_event','\x20tdx\x20wf\x20attempt\x20','Updating\x20parent\x20segment\x20\x27','.customers)','Updated','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','population','\x5c$&','column_type','`\x20to\x20download\x20the\x20configuration\x20first','segment:parent:run','addAttributes','Fetching\x20current\x20configuration\x20for\x20\x27','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','personalization','Show\x20parent\x20segment\x20schema\x20(column\x20types)','red','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','customerGroup','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Personalization\x20service\x20description','✔\x20Query\x20completed:\x20Processed\x20','join','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Name:\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','Audience\x20ID:','Created','execute','pullParentYaml','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','segment:parent:create','Listing\x20parent\x20segments\x20matching\x20\x27','Listing\x20parent\x20segments...','Available\x20attributes:','Validating\x20configuration...','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','No\x20RT-enabled\x20parent\x20segments\x20found','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','string','.yml','✔\x20Renamed\x20directory\x20to\x20','list','\x20--behavior\x20\x22','Listing\x20personalization\x20services\x20for\x20\x27','scheduleType','updateParent','\x20\x20\x20\x20','\x0aNo\x20sample\x20data\x20available','realtime','getParentSQL','attribute','parent_segment','errors','\x0aNew\x20parent\x20segment\x20\x27','\x0a✔\x20Workflow\x20started','Enriched:','schemaValid','isDirectory','user_id','idStitching','\x20\x20\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20behaviors','Preview:','description','parent_segments','/\x20directory.\x0a','behavior_','personalization_services','displaySampleData','all','No\x20parent\x20segments\x20found','Attributes:','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','unref','\x27\x20and\x20run\x20workflow?','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','primaryKey','/\x20directories\x20exist.','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','RT\x202.0:','site','Default','Options\x20(one\x20required):\x0a','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','getBehaviorNames','sections','use','Get\x20SQL\x20query\x20for\x20parent\x20segment','addBehaviorsFile','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Join:','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Schema\x20saved\x20to\x20','Resolving\x20parent\x20segment\x20\x27','segment:parent:fields','resolveParentId','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','yellow','\x20total','Analyzing\x20changes...','columns','audienceId','Fetching\x20customers\x20schema...','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','push','localeCompare','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','formatSchemaJson','enriched','Events:','Customers:','reduce','\x20--attribute\x20\x22','displayPreviewHints','toLowerCase','yes','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','workflowId','Options:\x0a','\x20service(s)\x20configured','13274248SZpOfm','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','name','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Master\x20Table','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20kill','\x20\x202.\x20Run\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','win32','Attributes','joinKey','/sessions/','Personalization:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','YAML\x20file:\x20','stats','\x20[Job\x20ID:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x0aUsage:\x20tdx\x20ps\x20preview\x20'];a30_0x478b=function(){return _0x4c38d5;};return a30_0x478b();}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a30_0x31aa82(0x113);[a30_0x31aa82(0x136)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x2b5b0f){const _0x5e2541=a30_0x31aa82,{options:_0x392c87,args:_0x19ea53,tdx:_0x4fb016}=_0x2b5b0f;console[_0x5e2541(0xaa)](_0x5e2541(0x176)+_0x5e2541(0x10b)+_0x5e2541(0xe4));const _0x28a5ee=_0x392c87;if(_0x19ea53[_0x5e2541(0xcc)]===0x0)return console['error'](a30_0x5768fb['red'](_0x5e2541(0xc2))),console[_0x5e2541(0xaa)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2372b9=_0x19ea53[0x0];if(!_0x28a5ee['database']||!_0x28a5ee[_0x5e2541(0x1ed)])return console[_0x5e2541(0xaa)](_0x5e2541(0xe5)),console['error'](_0x5e2541(0x1aa)),0x1;_0x28a5ee[_0x5e2541(0xaf)]&&(console['error'](_0x5e2541(0xad)+_0x28a5ee['site']),console[_0x5e2541(0xaa)](_0x5e2541(0x10c)+_0x2372b9),console['error']('Database:\x20'+_0x28a5ee['database']),console[_0x5e2541(0xaa)](_0x5e2541(0x191)+_0x28a5ee['table']));const _0x1b97ec=await loadJSONFromOptions(_0x28a5ee['attributes'],_0x28a5ee[_0x5e2541(0xac)]),_0x258e21=await loadJSONFromOptions(_0x28a5ee[_0x5e2541(0x1b6)],_0x28a5ee[_0x5e2541(0x20d)]),_0xd637ec=await loadJSONFromOptions(_0x28a5ee[_0x5e2541(0x106)],_0x28a5ee[_0x5e2541(0xa8)]),_0x49b90f={'name':_0x2372b9,'description':_0x28a5ee[_0x5e2541(0x136)],'scheduleType':_0x28a5ee[_0x5e2541(0x122)],'scheduleOption':_0x28a5ee[_0x5e2541(0x1bd)],'timezone':_0x28a5ee[_0x5e2541(0x1ae)],'master':{'parentDatabaseName':_0x28a5ee[_0x5e2541(0xc6)],'parentTableName':_0x28a5ee['table']},'attributes':_0x1b97ec,'behaviors':_0x258e21,'customerGroup':_0xd637ec},_0x3f6380=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2372b9+_0x5e2541(0x20a),()=>_0x4fb016[_0x5e2541(0xd9)]['createParent'](_0x49b90f),{'verbose':_0x392c87[_0x5e2541(0xaf)]}),_0x11f2c1=_0x3f6380[_0x5e2541(0x1e8)];return console[_0x5e2541(0xaa)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x11f2c1[_0x5e2541(0x173)]+'\x27\x20with\x20ID:\x20'+_0x11f2c1['id']),await handleSDKOutput([_0x11f2c1],_0x392c87),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x31aa82(0x173)]='segment:parent:update';[a30_0x31aa82(0x136)]=a30_0x31aa82(0x104);async[a30_0x31aa82(0x110)](_0x33e3cd){const _0x2803ab=a30_0x31aa82,{options:_0x99d0f4,args:_0x331776,tdx:_0x58f505}=_0x33e3cd;console[_0x2803ab(0xaa)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x2803ab(0x10b)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x48de7f=_0x99d0f4;if(_0x331776['length']===0x0)return console[_0x2803ab(0xaa)](a30_0x5768fb[_0x2803ab(0x103)](_0x2803ab(0xc2))),console[_0x2803ab(0xaa)](_0x2803ab(0xd2)),0x1;const _0x46caba=_0x331776[0x0];_0x48de7f[_0x2803ab(0xaf)]&&(console[_0x2803ab(0xaa)](_0x2803ab(0xad)+_0x48de7f[_0x2803ab(0x148)]),console[_0x2803ab(0xaa)](_0x2803ab(0x1d4)+_0x46caba));const _0x437a0c=await withSpinner(_0x2803ab(0xff)+_0x46caba+_0x2803ab(0x20a),()=>_0x58f505[_0x2803ab(0xd9)][_0x2803ab(0x1a0)](_0x46caba),{'verbose':_0x48de7f[_0x2803ab(0xaf)]}),_0x9eea72=_0x437a0c[_0x2803ab(0x1e8)],_0x2912e0=await loadJSONFromOptions(_0x48de7f[_0x2803ab(0xfe)],_0x48de7f['addAttributesFile']),_0xf86ca4=await loadJSONFromOptions(_0x48de7f[_0x2803ab(0x1fb)],_0x48de7f[_0x2803ab(0x150)]),_0x1b1979={'name':_0x9eea72[_0x2803ab(0x173)],'description':_0x48de7f[_0x2803ab(0x136)]!==undefined?_0x48de7f['description']:_0x9eea72[_0x2803ab(0x136)],'scheduleType':_0x48de7f[_0x2803ab(0x122)]!==undefined?_0x48de7f['scheduleType']:_0x9eea72[_0x2803ab(0x122)],'scheduleOption':_0x48de7f[_0x2803ab(0x1bd)]!==undefined?_0x48de7f[_0x2803ab(0x1bd)]:_0x9eea72[_0x2803ab(0x1bd)],'timezone':_0x48de7f[_0x2803ab(0x1ae)]!==undefined?_0x48de7f['timezone']:_0x9eea72['timezone'],'master':_0x9eea72['master'],'attributes':_0x2912e0?[..._0x9eea72[_0x2803ab(0xca)]||[],..._0x2912e0]:_0x9eea72['attributes'],'behaviors':_0xf86ca4?[..._0x9eea72[_0x2803ab(0x1b6)]||[],..._0xf86ca4]:_0x9eea72[_0x2803ab(0x1b6)],'customerGroup':_0x9eea72[_0x2803ab(0x106)]},_0x3b8d14=await withSpinner(_0x2803ab(0xf5)+_0x46caba+'\x27...',()=>_0x58f505[_0x2803ab(0xd9)][_0x2803ab(0x123)](_0x46caba,_0x1b1979),{'verbose':_0x48de7f[_0x2803ab(0xaf)]}),_0x4bbd52=_0x3b8d14[_0x2803ab(0x1e8)];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x4bbd52['name']+'\x27'),await handleSDKOutput([_0x4bbd52],_0x48de7f),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0xe7);['description']=a30_0x31aa82(0xb6);async[a30_0x31aa82(0x110)](_0x122297){const _0x28dfc9=a30_0x31aa82,{options:_0x562acd,args:_0x5a7b3c,tdx:_0x42599a}=_0x122297,_0x53121c=_0x562acd,_0x349945=_0x5a7b3c[0x0]||_0x562acd[_0x28dfc9(0xc8)];if(!_0x349945)return showParentSegmentNotSetError(_0x28dfc9(0x179)+_0x28dfc9(0x18d)),0x1;if(_0x53121c[_0x28dfc9(0x14e)]&&_0x53121c[_0x28dfc9(0xa4)])return console['error'](a30_0x5768fb[_0x28dfc9(0x103)](_0x28dfc9(0x17f))),console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x201)](_0x28dfc9(0x1a4))),console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x201)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x28dfc9(0xee))),console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x95)](_0x28dfc9(0xc7))),0x1;const _0x356ea6=_0x53121c['output']||a30_0x4ff47e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x349945)+_0x28dfc9(0x11d));_0x53121c['verbose']&&(console[_0x28dfc9(0xaa)](_0x28dfc9(0xad)+_0x53121c[_0x28dfc9(0x148)]),console[_0x28dfc9(0xaa)](_0x28dfc9(0x1d4)+_0x349945),console[_0x28dfc9(0xaa)](_0x28dfc9(0x189)+_0x356ea6));const _0x6c8119=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x349945+_0x28dfc9(0x20a),()=>_0x42599a['segment'][_0x28dfc9(0x111)](_0x349945),{'verbose':_0x53121c[_0x28dfc9(0xaf)]}),_0x5c1975=_0x6c8119['data'];if(existsSync(_0x356ea6)){const _0x516a91=readFileSync(_0x356ea6,'utf-8'),_0x2c8f15=generateDiff(_0x516a91,_0x5c1975);if(!hasChanges(_0x2c8f15))console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x1bb)]('✔')+_0x28dfc9(0x18b)+a30_0x5768fb[_0x28dfc9(0x95)](_0x356ea6)+_0x28dfc9(0xc1));else{console[_0x28dfc9(0xaa)]('\x0aChanges\x20to\x20\x27'+_0x356ea6+'\x27:'),console[_0x28dfc9(0xaa)]('─'['repeat'](0x3c)),console[_0x28dfc9(0xaa)](formatDiffWithColors(_0x2c8f15)),console['error']('─'[_0x28dfc9(0x1e2)](0x3c));if(!_0x53121c['yes']){if(!isInteractive())return console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x103)](_0x28dfc9(0xde)),_0x28dfc9(0xf8)),console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x201)](_0x28dfc9(0x183))),0x1;const _0x3adc44=await confirmKey('Overwrite\x20\x27'+_0x356ea6+'\x27?');if(!_0x3adc44)return console['error'](a30_0x5768fb[_0x28dfc9(0x159)](_0x28dfc9(0xb1))),0x1;}writeFileSync(_0x356ea6,_0x5c1975,'utf-8'),console[_0x28dfc9(0xaa)](a30_0x5768fb['green']('✔')+_0x28dfc9(0x163)+a30_0x5768fb[_0x28dfc9(0x95)](_0x356ea6));}}else{const _0x460ff4=a30_0x4ff47e['dirname'](_0x356ea6);!existsSync(_0x460ff4)&&mkdirSync(_0x460ff4,{'recursive':!![]}),writeFileSync(_0x356ea6,_0x5c1975,_0x28dfc9(0x1b0)),console[_0x28dfc9(0xaa)](a30_0x5768fb[_0x28dfc9(0x1bb)]('✔')+_0x28dfc9(0x163)+a30_0x5768fb[_0x28dfc9(0x95)](_0x356ea6));}return saveSessionContext({'parent_segment':_0x349945},_0x53121c[_0x28dfc9(0xe3)]),console[_0x28dfc9(0xaa)](a30_0x5768fb['green']('✔')+'\x20Context\x20set:\x20'+a30_0x5768fb[_0x28dfc9(0x201)](_0x28dfc9(0x129))+_0x28dfc9(0x1a2)+a30_0x5768fb[_0x28dfc9(0x95)](_0x349945)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0x9e);[a30_0x31aa82(0x136)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a30_0x31aa82(0x110)](_0x17f881){const _0x403884=a30_0x31aa82,{options:_0x52e99a,args:_0x327fc7,tdx:_0x4a6de7}=_0x17f881,_0x3cb332=_0x52e99a,_0x4a567e=_0x327fc7[0x0]||_0x52e99a['parentSegment'];if(!_0x4a567e)return showParentSegmentNotSetError(_0x403884(0x1d3)+_0x403884(0x8e)),0x1;const _0x175117=resolveYamlFile(_0x4a567e);if(!existsSync(_0x175117))return showFileNotFoundError(_0x175117,_0x4a567e),0x1;_0x3cb332[_0x403884(0xaf)]&&(console[_0x403884(0xaa)](_0x403884(0xad)+_0x3cb332[_0x403884(0x148)]),console['error'](_0x403884(0x180)+_0x175117));let _0x3883c4;try{_0x3883c4=readFileSync(_0x175117,_0x403884(0x1b0));}catch(_0xe7afc0){const _0x1a9be8=_0xe7afc0 instanceof Error?_0xe7afc0[_0x403884(0x186)]:String(_0xe7afc0);return console['error']('Error\x20reading\x20file:\x20'+_0x1a9be8),0x1;}const _0x4962fc=await withSpinner(_0x403884(0x15b),()=>_0x4a6de7[_0x403884(0xd9)]['pushParentYaml'](_0x3883c4),{'verbose':_0x3cb332[_0x403884(0xaf)]}),_0x11eb58=_0x4962fc['data'],{isNew:_0x4eb6fc,name:_0x459a4c,hasChanges:_0x4cc24c,diffFormatted:_0x31944e}=_0x11eb58;if(!_0x4cc24c)return console[_0x403884(0xaa)](_0x403884(0x93)+_0x459a4c+_0x403884(0xa6)),0x0;_0x4eb6fc?console[_0x403884(0xaa)](_0x403884(0x12b)+_0x459a4c+'\x27:'):console[_0x403884(0xaa)](_0x403884(0x1af)+_0x459a4c+'\x27:');console[_0x403884(0xaa)]('─'[_0x403884(0x1e2)](0x3c)),console[_0x403884(0xaa)](_0x31944e),console['error']('─'[_0x403884(0x1e2)](0x3c));const _0x3f1cea=_0x4eb6fc?_0x403884(0x1f5)+_0x459a4c+'\x27?':_0x403884(0xbc)+_0x459a4c+'\x27?';if(!_0x3cb332[_0x403884(0x16c)]){if(!isInteractive())return console[_0x403884(0xaa)](a30_0x5768fb[_0x403884(0x103)]('\x0aError:'),_0x403884(0xf8)),console[_0x403884(0xaa)](a30_0x5768fb[_0x403884(0x201)](_0x403884(0x183))),0x1;const _0x10013a=await confirmKey(_0x3f1cea);if(!_0x10013a)return console['error'](a30_0x5768fb[_0x403884(0x159)](_0x403884(0xb1))),0x1;}const _0x24c6bd=_0x4eb6fc?'Creating':_0x403884(0x207),_0x13a159=await withSpinner(_0x24c6bd+_0x403884(0x1c1)+_0x459a4c+'\x27...',()=>_0x11eb58['apply'](),{'verbose':_0x3cb332[_0x403884(0xaf)]}),_0x46cb06=_0x13a159[_0x403884(0x1e8)],_0x44bb6b=getConsoleNextUrl(_0x3cb332[_0x403884(0x148)],'/app/dw/parentSegments/'+_0x46cb06['id']),_0x58ef1e=_0x4eb6fc?_0x403884(0x10f):_0x403884(0xf7);return console[_0x403884(0xaa)]('✔\x20'+_0x58ef1e+_0x403884(0x1c1)+_0x46cb06[_0x403884(0x173)]+'\x27'),console['error']('\x20\x20'+_0x44bb6b),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a30_0x31aa82(0x9f);[a30_0x31aa82(0x136)]=a30_0x31aa82(0x151);async[a30_0x31aa82(0x110)](_0x3274a7){const _0x1bb25c=a30_0x31aa82,{options:_0x32acf4,args:_0x3d9853,tdx:_0x4717df}=_0x3274a7,_0x5d424f=_0x32acf4,_0x369d0c=_0x3d9853[0x0]||_0x32acf4[_0x1bb25c(0xc8)];if(!_0x369d0c)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x1bb25c(0x1d2)+_0x1bb25c(0x1f2)+_0x1bb25c(0xd8)),0x1;const _0x155c5f=resolveYamlFile(_0x369d0c);if(!existsSync(_0x155c5f))return showFileNotFoundError(_0x155c5f,_0x369d0c),0x1;_0x5d424f[_0x1bb25c(0xaf)]&&(console[_0x1bb25c(0xaa)](_0x1bb25c(0xad)+_0x5d424f['site']),console['error']('YAML\x20file:\x20'+_0x155c5f));let _0x18cf25;try{_0x18cf25=readFileSync(_0x155c5f,_0x1bb25c(0x1b0));}catch(_0x3d448f){const _0x104cf7=_0x3d448f instanceof Error?_0x3d448f[_0x1bb25c(0x186)]:String(_0x3d448f);return console[_0x1bb25c(0xaa)](_0x1bb25c(0x1e5)+_0x104cf7),0x1;}const _0x2f58ff=createCommandSpinner(a30_0x5768fb['dim'](_0x1bb25c(0x117)),{'verbose':_0x5d424f[_0x1bb25c(0xaf)]});_0x2f58ff[_0x1bb25c(0x18a)]();const _0x2a7926={'onProgress':_0x535d48=>{const _0x2875c0=_0x1bb25c;_0x2f58ff[_0x2875c0(0xdc)]=formatProgressMessage(_0x535d48);}};if(_0x5d424f['master'])_0x2a7926[_0x1bb25c(0x1e3)]=!![];if(_0x5d424f[_0x1bb25c(0x165)])_0x2a7926[_0x1bb25c(0x165)]=!![];_0x5d424f[_0x1bb25c(0x128)]&&(_0x2a7926[_0x1bb25c(0x128)]=_0x5d424f['attribute']);_0x5d424f[_0x1bb25c(0x1ca)]&&(_0x2a7926[_0x1bb25c(0x1ca)]=_0x5d424f[_0x1bb25c(0x1ca)]);if(_0x5d424f[_0x1bb25c(0x192)])_0x2a7926['interval']=_0x5d424f[_0x1bb25c(0x192)];let _0x1d2d05;try{_0x1d2d05=await _0x4717df['segment'][_0x1bb25c(0xce)](_0x18cf25,_0x2a7926),_0x2f58ff[_0x1bb25c(0x1f0)]();}catch(_0x526fce){_0x2f58ff['stop']();throw _0x526fce;}const _0x6d63b6=_0x5d424f[_0x1bb25c(0x192)]||'-1d';return this[_0x1bb25c(0x19d)](_0x1d2d05,_0x2a7926,_0x155c5f,_0x6d63b6),_0x1d2d05[_0x1bb25c(0x18c)]?0x0:0x1;}[a30_0x31aa82(0x19d)](_0x40fac6,_0x1e1682,_0x2b9feb,_0x10c7eb){const _0x5dca00=a30_0x31aa82;console[_0x5dca00(0xaa)]('\x0a'+a30_0x5768fb['bold'](_0x5dca00(0x20e))+'\x20'+_0x40fac6[_0x5dca00(0x173)]),console['error']('═'['repeat'](0x3c)),this[_0x5dca00(0x1b8)](_0x40fac6);if(typeof _0x1e1682['attribute']===_0x5dca00(0x11c)){this[_0x5dca00(0x9d)](_0x40fac6),this[_0x5dca00(0xb8)](_0x40fac6),this[_0x5dca00(0x16a)](_0x2b9feb,_0x10c7eb,_0x5dca00(0x128),_0x1e1682[_0x5dca00(0x128)]);return;}if(_0x1e1682[_0x5dca00(0x128)]===!![]){this[_0x5dca00(0x9d)](_0x40fac6),this[_0x5dca00(0xb8)](_0x40fac6),this['displayPreviewHints'](_0x2b9feb,_0x10c7eb,_0x5dca00(0xca));return;}if(typeof _0x1e1682[_0x5dca00(0x1ca)]==='string'){this[_0x5dca00(0xa5)](_0x40fac6,_0x10c7eb),this[_0x5dca00(0xb8)](_0x40fac6),this[_0x5dca00(0x16a)](_0x2b9feb,_0x10c7eb,'behavior',_0x1e1682[_0x5dca00(0x1ca)]);return;}if(_0x1e1682[_0x5dca00(0x1ca)]===!![]){this['displayBehaviorsStats'](_0x40fac6,_0x10c7eb),this[_0x5dca00(0xb8)](_0x40fac6),this[_0x5dca00(0x16a)](_0x2b9feb,_0x10c7eb,_0x5dca00(0x1b6));return;}this[_0x5dca00(0x9d)](_0x40fac6),this[_0x5dca00(0xa5)](_0x40fac6,_0x10c7eb),this[_0x5dca00(0x1cb)](_0x40fac6),this[_0x5dca00(0xb8)](_0x40fac6),this[_0x5dca00(0x16a)](_0x2b9feb,_0x10c7eb,_0x5dca00(0x13c));}[a30_0x31aa82(0x1cb)](_0x342c08){displayRealtimeValidation(_0x342c08);}[a30_0x31aa82(0x16a)](_0x4e6cfd,_0x1623d8,_0x5432e4,_0x3ccb06){const _0x4d41b2=a30_0x31aa82;console[_0x4d41b2(0xaa)]('\x0a'+a30_0x5768fb[_0x4d41b2(0x201)]('To\x20view\x20sample\x20data:'));const _0x2ce14c=_0x1623d8!=='-1d'?_0x4d41b2(0xf2)+_0x1623d8:'';if(_0x5432e4===_0x4d41b2(0x128)&&_0x3ccb06)console[_0x4d41b2(0xaa)]('\x20\x20'+a30_0x5768fb[_0x4d41b2(0x201)]('tdx\x20ps\x20preview\x20'+_0x4e6cfd+_0x4d41b2(0x169)+_0x3ccb06+'\x22'+_0x2ce14c));else{if(_0x5432e4==='behavior'&&_0x3ccb06)console['error']('\x20\x20'+a30_0x5768fb[_0x4d41b2(0x201)](_0x4d41b2(0xe8)+_0x4e6cfd+_0x4d41b2(0x120)+_0x3ccb06+'\x22'+_0x2ce14c));else(_0x5432e4==='attributes'||_0x5432e4===_0x4d41b2(0x13c))&&console['error']('\x20\x20'+a30_0x5768fb[_0x4d41b2(0x201)](_0x4d41b2(0xe8)+_0x4e6cfd+'\x20--attribute\x20\x22<name>\x22'+_0x2ce14c));}(_0x5432e4===_0x4d41b2(0x1b6)||_0x5432e4===_0x4d41b2(0x13c))&&console[_0x4d41b2(0xaa)]('\x20\x20'+a30_0x5768fb[_0x4d41b2(0x201)](_0x4d41b2(0xe8)+_0x4e6cfd+_0x4d41b2(0x20b)+_0x2ce14c)),_0x5432e4==='all'&&console['error']('\x20\x20'+a30_0x5768fb[_0x4d41b2(0x201)](_0x4d41b2(0xe8)+_0x4e6cfd+'\x20--enriched'+_0x2ce14c));}[a30_0x31aa82(0x1b8)](_0x3de86e){const _0x5922f3=a30_0x31aa82,{master:_0x1df25f}=_0x3de86e,_0x523afd=_0x1df25f[_0x5922f3(0x12e)]?a30_0x5768fb[_0x5922f3(0x1bb)]('✔'):a30_0x5768fb[_0x5922f3(0x103)]('✘');console[_0x5922f3(0xaa)]('\x0a'+a30_0x5768fb[_0x5922f3(0x201)](_0x5922f3(0x175))),console[_0x5922f3(0xaa)](_0x523afd+'\x20'+a30_0x5768fb[_0x5922f3(0x1b1)](_0x1df25f[_0x5922f3(0xc6)]+'.'+_0x1df25f[_0x5922f3(0x1ed)])),_0x1df25f['schemaValid']?_0x1df25f[_0x5922f3(0x1e6)]!==undefined&&console[_0x5922f3(0xaa)]('\x20\x20'+a30_0x5768fb['dim'](_0x5922f3(0xc3))+'\x20'+a30_0x5768fb[_0x5922f3(0x95)](formatRows(_0x1df25f[_0x5922f3(0x1e6)]))):console[_0x5922f3(0xaa)]('\x20\x20'+a30_0x5768fb[_0x5922f3(0x103)](_0x5922f3(0x1c5))+'\x20'+_0x1df25f['schemaError']);}['displayAttributesStats'](_0x62d7a0){const _0x5196c1=a30_0x31aa82;if(_0x62d7a0[_0x5196c1(0xca)]['length']===0x0)return;console[_0x5196c1(0xaa)]('\x0a'+a30_0x5768fb[_0x5196c1(0x201)](_0x5196c1(0x17b)));for(const _0x3391fa of _0x62d7a0['attributes']){const _0x59da6b=_0x3391fa[_0x5196c1(0x12e)]?a30_0x5768fb['green']('✔'):a30_0x5768fb[_0x5196c1(0x103)]('✘');let _0x92572='';if(_0x3391fa['schemaValid']&&_0x3391fa['matchedCount']!==undefined&&_0x3391fa[_0x5196c1(0xdf)]!==undefined){const _0x323d50=_0x3391fa[_0x5196c1(0xdf)][_0x5196c1(0x1e7)](0x1),_0x146b27=_0x3391fa[_0x5196c1(0xdf)]>=0x50?a30_0x5768fb[_0x5196c1(0x1bb)]:_0x3391fa[_0x5196c1(0xdf)]>=0x32?a30_0x5768fb[_0x5196c1(0x159)]:a30_0x5768fb[_0x5196c1(0x103)];_0x92572='\x20'+a30_0x5768fb[_0x5196c1(0x201)]('Coverage:')+'\x20'+_0x146b27(_0x323d50+'%')+'\x20('+formatRows(_0x3391fa['matchedCount'])+'\x20rows)';}console['error'](_0x59da6b+'\x20'+a30_0x5768fb[_0x5196c1(0x1b1)](_0x3391fa['name'])+_0x92572),console['error']('\x20\x20'+a30_0x5768fb[_0x5196c1(0x201)]('Source:')+'\x20'+a30_0x5768fb[_0x5196c1(0x1b1)](_0x3391fa['database']+'.'+_0x3391fa['table']));const _0x119e79=_0x3391fa[_0x5196c1(0x17c)]===_0x3391fa[_0x5196c1(0xb0)]?a30_0x5768fb[_0x5196c1(0x201)]('Join\x20on:')+'\x20'+_0x3391fa[_0x5196c1(0x17c)]:a30_0x5768fb[_0x5196c1(0x201)]('Join:')+'\x20'+_0x3391fa[_0x5196c1(0x17c)]+_0x5196c1(0x1a2)+_0x3391fa[_0x5196c1(0xb0)];console[_0x5196c1(0xaa)]('\x20\x20'+_0x119e79),console['error']('\x20\x20'+a30_0x5768fb[_0x5196c1(0x201)](_0x5196c1(0x84))),this[_0x5196c1(0xec)](_0x3391fa['columns']),!_0x3391fa[_0x5196c1(0x12e)]&&console['error']('\x20\x20'+a30_0x5768fb[_0x5196c1(0x103)](_0x5196c1(0x1c5))+'\x20'+_0x3391fa[_0x5196c1(0x8f)]);}}['displayBehaviorsStats'](_0x1faed5,_0x5990e0){const _0x38fdfc=a30_0x31aa82;if(_0x1faed5[_0x38fdfc(0x1b6)][_0x38fdfc(0xcc)]===0x0)return;console[_0x38fdfc(0xaa)]('\x0a'+a30_0x5768fb[_0x38fdfc(0x201)](_0x38fdfc(0xc0))+'\x20'+a30_0x5768fb['dim']('('+_0x5990e0+')'));for(const _0x1fdbf1 of _0x1faed5[_0x38fdfc(0x1b6)]){const _0x94de95=_0x1fdbf1['schemaValid']?a30_0x5768fb[_0x38fdfc(0x1bb)]('✔'):a30_0x5768fb[_0x38fdfc(0x103)]('✘');let _0x5b36c1='';if(_0x1fdbf1['schemaValid']&&_0x1fdbf1[_0x38fdfc(0x1d6)]!==undefined&&_0x1fdbf1[_0x38fdfc(0x199)]!==undefined){const _0x4b9a8b=_0x1fdbf1[_0x38fdfc(0x9a)]?.['toFixed'](0x1)||'?',_0x3c7934=(_0x1fdbf1[_0x38fdfc(0x9a)]??0x0)>=0x32?a30_0x5768fb[_0x38fdfc(0x1bb)]:(_0x1fdbf1[_0x38fdfc(0x9a)]??0x0)>=0x14?a30_0x5768fb['yellow']:a30_0x5768fb[_0x38fdfc(0x103)];_0x5b36c1='\x20'+a30_0x5768fb[_0x38fdfc(0x201)](_0x38fdfc(0x167))+'\x20'+_0x3c7934(formatRows(_0x1fdbf1[_0x38fdfc(0x1d6)]))+'\x20('+_0x4b9a8b+_0x38fdfc(0xf1)+a30_0x5768fb[_0x38fdfc(0x201)]('Events:')+'\x20'+a30_0x5768fb['cyan'](formatRows(_0x1fdbf1['totalEvents']));}console['error'](_0x94de95+'\x20'+a30_0x5768fb[_0x38fdfc(0x1b1)](_0x1fdbf1[_0x38fdfc(0x173)])+_0x5b36c1),console[_0x38fdfc(0xaa)]('\x20\x20'+a30_0x5768fb[_0x38fdfc(0x201)]('Source:')+'\x20'+a30_0x5768fb['bold'](_0x1fdbf1[_0x38fdfc(0xc6)]+'.'+_0x1fdbf1[_0x38fdfc(0x1ed)]));const _0x49cb7c=_0x1fdbf1[_0x38fdfc(0x17c)]===_0x1fdbf1[_0x38fdfc(0xb0)]?a30_0x5768fb[_0x38fdfc(0x201)](_0x38fdfc(0xcf))+'\x20'+_0x1fdbf1['joinKey']:a30_0x5768fb[_0x38fdfc(0x201)](_0x38fdfc(0x152))+'\x20'+_0x1fdbf1[_0x38fdfc(0x17c)]+'\x20=\x20'+_0x1fdbf1[_0x38fdfc(0xb0)];console[_0x38fdfc(0xaa)]('\x20\x20'+_0x49cb7c),console['error']('\x20\x20'+a30_0x5768fb[_0x38fdfc(0x201)]('Columns:')),this[_0x38fdfc(0xec)](_0x1fdbf1[_0x38fdfc(0x15c)]),!_0x1fdbf1[_0x38fdfc(0x12e)]&&console['error']('\x20\x20'+a30_0x5768fb['red'](_0x38fdfc(0x1c5))+'\x20'+_0x1fdbf1[_0x38fdfc(0x8f)]);}}['displayColumns'](_0x45d970){const _0x3ab311=a30_0x31aa82;for(const _0x3a8979 of _0x45d970){_0x3a8979[_0x3ab311(0xb9)]===_0x3a8979['column']||_0x3a8979[_0x3ab311(0x97)]==='*'?console['error'](_0x3ab311(0x1df)+_0x3a8979[_0x3ab311(0xb9)]):console[_0x3ab311(0xaa)](_0x3ab311(0x1df)+_0x3a8979[_0x3ab311(0xb9)]+'\x20'+a30_0x5768fb['dim']('('+_0x3a8979['column']+')'));}}[a30_0x31aa82(0xb8)](_0x5b121b){const _0xa7904c=a30_0x31aa82;console[_0xa7904c(0xaa)]('─'[_0xa7904c(0x1e2)](0x3c));if(_0x5b121b[_0xa7904c(0x12a)][_0xa7904c(0xcc)]>0x0){console[_0xa7904c(0xaa)]('\x0a'+a30_0x5768fb['red']('Errors:'));for(const _0xf8895c of _0x5b121b['errors']){console[_0xa7904c(0xaa)]('\x20\x20'+a30_0x5768fb[_0xa7904c(0x103)]('•')+'\x20'+_0xf8895c);}}_0x5b121b[_0xa7904c(0x18c)]&&console[_0xa7904c(0xaa)]('\x0a'+a30_0x5768fb[_0xa7904c(0x1bb)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']='segment:parent:preview';[a30_0x31aa82(0x136)]=a30_0x31aa82(0x1cd);async[a30_0x31aa82(0x110)](_0x1a4faf){const _0x4963f9=a30_0x31aa82,{options:_0x3e52c2,args:_0x14e548,tdx:_0x21a964}=_0x1a4faf,_0x2c095d=_0x3e52c2,_0x1021e4=_0x14e548[0x0]||_0x3e52c2[_0x4963f9(0xc8)];if(!_0x1021e4)return showParentSegmentNotSetError(_0x4963f9(0x133)+_0x4963f9(0x19b)+_0x4963f9(0x14a)+_0x4963f9(0x185)+_0x4963f9(0x94)+_0x4963f9(0xa9)+_0x4963f9(0x174)+_0x4963f9(0xd8)),0x1;if(!_0x2c095d[_0x4963f9(0x1e3)]&&!_0x2c095d[_0x4963f9(0x128)]&&!_0x2c095d['behavior']&&!_0x2c095d[_0x4963f9(0x165)])return console['error'](a30_0x5768fb['red'](_0x4963f9(0xd3))),console[_0x4963f9(0xaa)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x4963f9(0xaa)]('Options:'),console[_0x4963f9(0xaa)](_0x4963f9(0x119)),console[_0x4963f9(0xaa)](_0x4963f9(0x15f)),console[_0x4963f9(0xaa)](_0x4963f9(0x142)),console[_0x4963f9(0xaa)](_0x4963f9(0x1e9)),0x1;const _0x32e5a6=resolveYamlFile(_0x1021e4);if(!existsSync(_0x32e5a6))return showFileNotFoundError(_0x32e5a6,_0x1021e4),0x1;_0x2c095d[_0x4963f9(0xaf)]&&(console[_0x4963f9(0xaa)](_0x4963f9(0xad)+_0x2c095d[_0x4963f9(0x148)]),console['error']('YAML\x20file:\x20'+_0x32e5a6));let _0x562d46;try{_0x562d46=readFileSync(_0x32e5a6,'utf-8');}catch(_0xc78975){const _0x54f536=_0xc78975 instanceof Error?_0xc78975[_0x4963f9(0x186)]:String(_0xc78975);return console['error']('Error\x20reading\x20file:\x20'+_0x54f536),0x1;}let _0x517710;try{_0x517710=parseDef(_0x562d46);}catch(_0x51c714){const _0x315968=_0x51c714 instanceof Error?_0x51c714['message']:String(_0x51c714);return console[_0x4963f9(0xaa)](a30_0x5768fb[_0x4963f9(0x103)](_0x4963f9(0x1d8)+_0x315968)),0x1;}if(_0x2c095d[_0x4963f9(0x128)]===!![]||_0x2c095d[_0x4963f9(0x128)]===''){const _0x3117c3=_0x517710[_0x4963f9(0xca)]?.[_0x4963f9(0xbe)](_0x53a585=>_0x53a585['name'])||[];if(_0x3117c3[_0x4963f9(0xcc)]===0x0)console[_0x4963f9(0xaa)](a30_0x5768fb[_0x4963f9(0x103)](_0x4963f9(0x204)));else{console[_0x4963f9(0xaa)](a30_0x5768fb[_0x4963f9(0x103)](_0x4963f9(0x19c))),console[_0x4963f9(0xaa)](_0x4963f9(0x116));for(const _0x511935 of _0x3117c3){console[_0x4963f9(0xaa)]('\x20\x20'+a30_0x5768fb[_0x4963f9(0x95)](_0x511935));}console[_0x4963f9(0xaa)](_0x4963f9(0x184)+_0x1021e4+_0x4963f9(0x169)+_0x3117c3[0x0]+'\x22');}return 0x1;}if(_0x2c095d['behavior']===!![]||_0x2c095d['behavior']===''){const _0x1d1a49=_0x517710[_0x4963f9(0x1b6)]?.['map'](_0x56cdf2=>_0x56cdf2['name'])||[];if(_0x1d1a49[_0x4963f9(0xcc)]===0x0)console[_0x4963f9(0xaa)](a30_0x5768fb[_0x4963f9(0x103)](_0x4963f9(0x118)));else{console['error'](a30_0x5768fb[_0x4963f9(0x103)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console['error'](_0x4963f9(0x1fc));for(const _0x25bba2 of _0x1d1a49){console[_0x4963f9(0xaa)]('\x20\x20'+a30_0x5768fb[_0x4963f9(0x95)](_0x25bba2));}console['error'](_0x4963f9(0x184)+_0x1021e4+'\x20--behavior\x20\x22'+_0x1d1a49[0x0]+'\x22');}return 0x1;}const _0xec1422=createCommandSpinner(a30_0x5768fb['dim'](_0x4963f9(0x85)),{'verbose':_0x2c095d[_0x4963f9(0xaf)]});_0xec1422['start']();const _0x105950={'onProgress':_0x21d5bd=>{_0xec1422['text']=formatProgressMessage(_0x21d5bd);}};if(_0x2c095d['master'])_0x105950[_0x4963f9(0x1e3)]=!![];if(_0x2c095d[_0x4963f9(0x128)]&&typeof _0x2c095d[_0x4963f9(0x128)]==='string')_0x105950[_0x4963f9(0x128)]=_0x2c095d[_0x4963f9(0x128)];if(_0x2c095d[_0x4963f9(0x1ca)]&&typeof _0x2c095d[_0x4963f9(0x1ca)]===_0x4963f9(0x11c))_0x105950['behavior']=_0x2c095d[_0x4963f9(0x1ca)];if(_0x2c095d[_0x4963f9(0x165)])_0x105950[_0x4963f9(0x165)]=!![];if(_0x2c095d['interval'])_0x105950[_0x4963f9(0x192)]=_0x2c095d['interval'];let _0x3b87de;try{_0x3b87de=await _0x21a964[_0x4963f9(0xd9)][_0x4963f9(0x208)](_0x562d46,_0x105950),_0xec1422[_0x4963f9(0x1f0)]();}catch(_0x33dd20){_0xec1422[_0x4963f9(0x1f0)]();throw _0x33dd20;}return await this['displayPreviewResults'](_0x3b87de,{'master':_0x2c095d[_0x4963f9(0x1e3)],'attribute':typeof _0x2c095d[_0x4963f9(0x128)]===_0x4963f9(0x11c)?_0x2c095d[_0x4963f9(0x128)]:undefined,'behavior':typeof _0x2c095d['behavior']===_0x4963f9(0x11c)?_0x2c095d[_0x4963f9(0x1ca)]:undefined,'enriched':_0x2c095d['enriched']}),_0x3b87de[_0x4963f9(0x18c)]?0x0:0x1;}async[a30_0x31aa82(0x98)](_0x1668a0,_0x39737b){const _0x3d13e1=a30_0x31aa82;console[_0x3d13e1(0xaa)]('\x0a'+a30_0x5768fb[_0x3d13e1(0x1b1)](_0x3d13e1(0x135))+'\x20'+_0x1668a0[_0x3d13e1(0x173)]),console['error']('═'[_0x3d13e1(0x1e2)](0x3c));if(_0x39737b[_0x3d13e1(0x1e3)]&&_0x1668a0['sampleData']){const _0x2ba3e2=a30_0x5768fb[_0x3d13e1(0x201)]('Master:')+'\x20'+a30_0x5768fb[_0x3d13e1(0x1b1)](_0x1668a0[_0x3d13e1(0x1e3)][_0x3d13e1(0xc6)]+'.'+_0x1668a0[_0x3d13e1(0x1e3)]['table']);await this[_0x3d13e1(0x13b)](_0x2ba3e2,_0x1668a0[_0x3d13e1(0x1db)]);}else{if(_0x39737b[_0x3d13e1(0x128)]&&_0x1668a0[_0x3d13e1(0x1db)]){const _0x504f81=a30_0x5768fb['dim']('Attribute:')+'\x20'+a30_0x5768fb['bold'](_0x39737b[_0x3d13e1(0x128)]);await this[_0x3d13e1(0x13b)](_0x504f81,_0x1668a0['sampleData']);}else{if(_0x39737b[_0x3d13e1(0x1ca)]&&_0x1668a0[_0x3d13e1(0x1db)]){const _0x1f1f44=a30_0x5768fb['dim'](_0x3d13e1(0x1bf))+'\x20'+a30_0x5768fb[_0x3d13e1(0x1b1)](_0x39737b['behavior']);await this['displaySampleData'](_0x1f1f44,_0x1668a0['sampleData']);}else{if(_0x39737b[_0x3d13e1(0x165)]&&_0x1668a0[_0x3d13e1(0x1db)]){const _0x52f3dc=a30_0x5768fb[_0x3d13e1(0x201)](_0x3d13e1(0x12d))+'\x20'+a30_0x5768fb[_0x3d13e1(0x1b1)]('Master\x20+\x20Attributes');await this[_0x3d13e1(0x13b)](_0x52f3dc,_0x1668a0[_0x3d13e1(0x1db)]);}else!_0x1668a0['sampleData']&&console[_0x3d13e1(0xaa)](_0x3d13e1(0x125));}}}if(_0x1668a0[_0x3d13e1(0x12a)][_0x3d13e1(0xcc)]>0x0){console['error']('─'[_0x3d13e1(0x1e2)](0x3c)),console[_0x3d13e1(0xaa)]('\x0a'+a30_0x5768fb[_0x3d13e1(0x103)](_0x3d13e1(0x1d7)));for(const _0x48ee98 of _0x1668a0['errors']){console[_0x3d13e1(0xaa)]('\x20\x20'+a30_0x5768fb[_0x3d13e1(0x103)]('•')+'\x20'+_0x48ee98);}}}async[a30_0x31aa82(0x13b)](_0x5e447c,_0x25f396){const _0x3e11b4=a30_0x31aa82;if(_0x25f396[_0x3e11b4(0xcc)]===0x0){console['error']('\x0a'+_0x5e447c),console[_0x3e11b4(0xaa)](_0x3e11b4(0x196));return;}console[_0x3e11b4(0xaa)]('\x0a'+_0x5e447c);const _0x509ef4=Object[_0x3e11b4(0xa7)](_0x25f396[0x0])[_0x3e11b4(0xbe)](_0x26d53d=>({'name':_0x26d53d,'type':typeof _0x25f396[0x0][_0x26d53d]==='number'?'double':_0x3e11b4(0x190)})),_0x18315e={'queryId':_0x3e11b4(0x91),'columns':_0x509ef4,'data':_0x25f396,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x25f396[_0x3e11b4(0xcc)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4f8f87=formatAsTable(_0x18315e,_0x25f396['length'],!![]);await writeOutput(_0x4f8f87,undefined,_0x3e11b4(0x1ed));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a30_0x31aa82(0xfd);[a30_0x31aa82(0x136)]=a30_0x31aa82(0x158);async['execute'](_0x217026){const _0xa6ba26=a30_0x31aa82,{options:_0x5bd9cb,args:_0x82cdc5,tdx:_0x4a7203}=_0x217026,_0x4a1a37=_0x5bd9cb,_0x1009ac=_0x82cdc5[0x0]||_0x5bd9cb[_0xa6ba26(0xc8)];if(!_0x1009ac)return showParentSegmentNotSetError(_0xa6ba26(0xc5)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x4dcd77=resolveYamlFile(_0x1009ac);if(existsSync(_0x4dcd77)){_0x4a1a37['verbose']&&console[_0xa6ba26(0xaa)]('Found\x20YAML\x20file:\x20'+_0x4dcd77);let _0x5da552;try{_0x5da552=readFileSync(_0x4dcd77,_0xa6ba26(0x1b0));}catch(_0x32e79a){const _0x25614f=_0x32e79a instanceof Error?_0x32e79a['message']:String(_0x32e79a);return console[_0xa6ba26(0xaa)](_0xa6ba26(0x1e5)+_0x25614f),0x1;}const _0x4a860d=await withSpinner(_0xa6ba26(0x15b),()=>_0x4a7203['segment'][_0xa6ba26(0xf0)](_0x5da552),{'verbose':_0x4a1a37[_0xa6ba26(0xaf)]}),_0x201400=_0x4a860d[_0xa6ba26(0x1e8)],{isNew:_0xf14d41,name:_0x29d193,hasChanges:_0x2bf17a,diffFormatted:_0x1fd3b2}=_0x201400;if(_0x2bf17a){_0xf14d41?console[_0xa6ba26(0xaa)](_0xa6ba26(0x12b)+_0x29d193+'\x27:'):console[_0xa6ba26(0xaa)](_0xa6ba26(0x1af)+_0x29d193+'\x27:');console['error']('─'[_0xa6ba26(0x1e2)](0x3c)),console['error'](_0x1fd3b2),console[_0xa6ba26(0xaa)]('─'[_0xa6ba26(0x1e2)](0x3c));const _0x49a78b=_0xf14d41?_0xa6ba26(0x1f5)+_0x29d193+'\x27\x20and\x20run\x20workflow?':_0xa6ba26(0xbc)+_0x29d193+_0xa6ba26(0x141);if(!_0x4a1a37[_0xa6ba26(0x16c)]){if(!isInteractive())return console[_0xa6ba26(0xaa)](a30_0x5768fb['red'](_0xa6ba26(0xde)),_0xa6ba26(0xf8)),console[_0xa6ba26(0xaa)](a30_0x5768fb[_0xa6ba26(0x201)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x28fd0d=await confirmKey(_0x49a78b);if(!_0x28fd0d)return console[_0xa6ba26(0xaa)](a30_0x5768fb['yellow'](_0xa6ba26(0xb1))),0x1;}const _0x3211cc=_0xf14d41?_0xa6ba26(0x86):'Updating';await withSpinner(_0x3211cc+'\x20parent\x20segment\x20\x27'+_0x29d193+_0xa6ba26(0x20a),()=>_0x201400[_0xa6ba26(0x1ab)](),{'verbose':_0x4a1a37[_0xa6ba26(0xaf)]});const _0x29aeed=_0xf14d41?_0xa6ba26(0x10f):'Updated';console[_0xa6ba26(0xaa)]('✔\x20'+_0x29aeed+'\x20parent\x20segment\x20\x27'+_0x29d193+'\x27');}else console[_0xa6ba26(0xaa)]('✔\x20No\x20changes\x20-\x20\x27'+_0x29d193+_0xa6ba26(0x1a9));}const _0x133f49=await withSpinner(_0xa6ba26(0x13f)+_0x1009ac+_0xa6ba26(0x20a),()=>_0x4a7203[_0xa6ba26(0xd9)]['runParent'](_0x1009ac),{'verbose':_0x4a1a37['verbose']}),_0x17779d=_0x133f49[_0xa6ba26(0x1e8)],_0x577ada=getConsoleUrl(_0x4a1a37[_0xa6ba26(0x148)],_0xa6ba26(0xcd)+_0x17779d[_0xa6ba26(0x16e)]+_0xa6ba26(0x17d)+_0x17779d[_0xa6ba26(0xbb)]+_0xa6ba26(0xd5)+_0x17779d[_0xa6ba26(0x90)]);return console[_0xa6ba26(0xaa)](_0xa6ba26(0x12c)),console['error']('\x20\x20'+a30_0x5768fb[_0xa6ba26(0x201)](_0xa6ba26(0x10e))+'\x20'+_0x17779d[_0xa6ba26(0x15d)]),console[_0xa6ba26(0xaa)]('\x20\x20'+a30_0x5768fb[_0xa6ba26(0x201)]('Status:')+'\x20'+_0x17779d[_0xa6ba26(0x200)]),console['error']('\x20\x20'+a30_0x5768fb[_0xa6ba26(0x201)]('Session:')+'\x20'+_0x17779d['workflowSessionId']),console[_0xa6ba26(0xaa)]('\x20\x20'+a30_0x5768fb[_0xa6ba26(0x201)](_0xa6ba26(0xcb))+'\x20'+_0x17779d['workflowAttemptId']),console[_0xa6ba26(0xaa)]('\x20\x20'+_0x577ada),console[_0xa6ba26(0xaa)]('\x0a'+a30_0x5768fb[_0xa6ba26(0x201)](_0xa6ba26(0x1b3))+_0xa6ba26(0xf4)+_0x17779d[_0xa6ba26(0x90)]+_0xa6ba26(0x177)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0x156);[a30_0x31aa82(0x136)]=a30_0x31aa82(0xab);async[a30_0x31aa82(0x110)](_0x5e417f){const _0x47b280=a30_0x31aa82,{options:_0x20f796,args:_0x17bb68,tdx:_0x4c1bc5}=_0x5e417f,_0x4d72e2=_0x17bb68[0x0]||_0x20f796[_0x47b280(0xc8)];if(!_0x4d72e2)return showParentSegmentNotSetError(_0x47b280(0x1b7)+_0x47b280(0x107)),0x1;_0x20f796[_0x47b280(0xaf)]&&(console[_0x47b280(0xaa)](_0x47b280(0xad)+_0x20f796[_0x47b280(0x148)]),console['error'](_0x47b280(0x1d4)+_0x4d72e2));const _0x221be5=await withSpinner(_0x47b280(0xbd)+_0x4d72e2+_0x47b280(0x20a),()=>_0x4c1bc5[_0x47b280(0xd9)][_0x47b280(0x20c)](_0x4d72e2),{'verbose':_0x20f796[_0x47b280(0xaf)]}),_0x2a9a48=_0x221be5[_0x47b280(0x1e8)];console['error'](_0x47b280(0x1fa)+_0x2a9a48[_0x47b280(0xcc)]+_0x47b280(0x1e0)+(_0x2a9a48[_0x47b280(0xcc)]!==0x1?'s':''));if(_0x20f796[_0x47b280(0x1b9)]||_0x20f796[_0x47b280(0xea)])return await handleSDKOutput(_0x2a9a48,_0x20f796),0x0;return displayFieldsHumanReadable(_0x2a9a48,_0x4d72e2),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0x1d5);[a30_0x31aa82(0x136)]='Show\x20parent\x20segment\x20details';async[a30_0x31aa82(0x110)](_0x33f6ac){const _0x18b2b4=a30_0x31aa82,{options:_0x112ac5,args:_0x1f6c82,tdx:_0x4dce62}=_0x33f6ac,_0x3b9212=_0x112ac5,_0x2f3353=_0x1f6c82[0x0]||_0x112ac5[_0x18b2b4(0xc8)];if(!_0x2f3353)return showParentSegmentNotSetError(_0x18b2b4(0x153)+_0x18b2b4(0xe9)+'Options:\x0a'+_0x18b2b4(0xc9)),0x1;_0x112ac5['verbose']&&(console[_0x18b2b4(0xaa)](_0x18b2b4(0xad)+_0x112ac5['site']),console[_0x18b2b4(0xaa)](_0x18b2b4(0x1d4)+_0x2f3353));const _0x2de968=await withSpinner(_0x18b2b4(0xbf)+_0x2f3353+_0x18b2b4(0x20a),()=>_0x4dce62[_0x18b2b4(0xd9)][_0x18b2b4(0x1a0)](_0x2f3353),{'verbose':_0x112ac5[_0x18b2b4(0xaf)]}),_0x15fca8=_0x2de968['data'];if(_0x3b9212['web']){const _0x594049=getConsoleNextUrl(_0x3b9212[_0x18b2b4(0x148)],_0x18b2b4(0x9b)+_0x15fca8['id']);return console[_0x18b2b4(0xaa)](a30_0x5768fb[_0x18b2b4(0x1bb)]('✔')+'\x20Opening\x20'+a30_0x5768fb[_0x18b2b4(0x95)](_0x594049)),openBrowser(_0x594049),0x0;}return await handleSingleObjectOutput(_0x15fca8,_0x112ac5),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x31aa82(0x173)]='segment:parent:desc';[a30_0x31aa82(0x136)]=a30_0x31aa82(0x102);async[a30_0x31aa82(0x110)](_0x13cd60){const _0x46f565=a30_0x31aa82,{options:_0x232293,args:_0x12bc78,tdx:_0x199514}=_0x13cd60,_0x570522=_0x232293,_0x530756=_0x12bc78[0x0]||_0x232293[_0x46f565(0xc8)];if(!_0x530756)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'+_0x46f565(0x10d)+_0x46f565(0x16f)+_0x46f565(0x172)),0x1;_0x232293[_0x46f565(0xaf)]&&(console[_0x46f565(0xaa)](_0x46f565(0xad)+_0x232293['site']),console[_0x46f565(0xaa)](_0x46f565(0x1d4)+_0x530756));const _0x16327e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x530756+_0x46f565(0x20a),()=>_0x199514[_0x46f565(0xd9)][_0x46f565(0x157)](_0x530756),{'verbose':_0x232293[_0x46f565(0xaf)]}),_0x4cf4f8=_0x16327e[_0x46f565(0x1e8)],_0x5e4271=_0x199514[_0x46f565(0xd9)]['getOutputDatabaseName'](_0x4cf4f8);if(_0x570522[_0x46f565(0xa4)]){const _0x5afa25=await this[_0x46f565(0xe1)](_0x13cd60,_0x530756,_0x4cf4f8,_0x5e4271),_0x8f3838=this[_0x46f565(0x164)](_0x5afa25);writeFileSync(_0x570522['output'],_0x8f3838);const _0x213fcc=_0x5afa25[_0x46f565(0x8d)]['columns'][_0x46f565(0xcc)]+_0x5afa25[_0x46f565(0x1b6)][_0x46f565(0x168)]((_0x9687b1,_0x2a83a4)=>_0x9687b1+_0x2a83a4[_0x46f565(0x15c)][_0x46f565(0xcc)],0x0),_0x201322=_0x5afa25['behaviors'][_0x46f565(0x1d9)](_0x5158cb=>_0x5158cb[_0x46f565(0x15c)][_0x46f565(0xcc)]===0x0)[_0x46f565(0xcc)];return console['log'](_0x46f565(0x154)+_0x570522['output']),console['log'](_0x46f565(0x19e)+_0x5e4271),console[_0x46f565(0x1ec)](_0x46f565(0x1c8)+_0x5afa25[_0x46f565(0x1b6)][_0x46f565(0xcc)]+_0x46f565(0x134)),console[_0x46f565(0x1ec)]('\x20\x20Columns:\x20'+_0x213fcc+_0x46f565(0x15a)),_0x201322>0x0&&console['log']('\x20\x20Note:\x20'+_0x201322+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x46f565(0xaa)]('\x0a'+a30_0x5768fb[_0x46f565(0x1b1)](_0x46f565(0x18f))+'\x20'+a30_0x5768fb[_0x46f565(0x95)](_0x5e4271));const _0x49a076=await withSpinner(_0x46f565(0x15e),()=>_0x199514[_0x46f565(0xd9)][_0x46f565(0x127)](_0x4cf4f8),{'verbose':_0x232293[_0x46f565(0xaf)]});console['error']('\x0a'+a30_0x5768fb[_0x46f565(0x1b1)](_0x46f565(0x8d))+'\x20'+a30_0x5768fb['dim']('('+_0x5e4271+_0x46f565(0xf6)));const _0x3caef4=await executeSchemaQuery(_0x49a076['data'],_0x199514,_0x232293);await handleQueryOutput(_0x3caef4,_0x232293);const _0x43bcf0=await withSpinner(_0x46f565(0x1c6),()=>_0x199514['segment']['getBehaviorNames'](_0x4cf4f8),{'verbose':_0x232293[_0x46f565(0xaf)]});for(const _0x2af707 of _0x43bcf0[_0x46f565(0x1e8)]){const _0x2a22ac=_0x46f565(0x139)+_0x2af707[_0x46f565(0x16b)]()[_0x46f565(0x1b5)](/\s+/g,'_'),_0x1be9e2='SELECT\x20*\x20FROM\x20'+_0x5e4271+'.'+_0x2a22ac;console[_0x46f565(0xaa)]('\x0a'+a30_0x5768fb['bold'](_0x2af707)+'\x20'+a30_0x5768fb[_0x46f565(0x201)]('('+_0x5e4271+'.'+_0x2a22ac+')'));try{const _0x2fdc0b=await executeSchemaQuery(_0x1be9e2,_0x199514,_0x232293);await handleQueryOutput(_0x2fdc0b,_0x232293);}catch{console['error'](a30_0x5768fb[_0x46f565(0x159)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a30_0x31aa82(0xe1)](_0x592aa1,_0x1cfc92,_0x4559d9,_0x4d347c){const _0x464834=a30_0x31aa82,{options:_0x224fe1,tdx:_0x26b172}=_0x592aa1,_0x21ccea=await withSpinner(_0x464834(0x15e),()=>_0x26b172[_0x464834(0xd9)][_0x464834(0x127)](_0x4559d9),{'verbose':_0x224fe1['verbose']}),_0x175c51=await executeSchemaQuery(_0x21ccea[_0x464834(0x1e8)],_0x26b172,_0x224fe1),_0x4dce46=_0x175c51[_0x464834(0x1e8)][_0x464834(0xbe)](_0xa123aa=>({'name':_0xa123aa['column_name'],'type':_0xa123aa[_0x464834(0xfb)]})),_0x20dc46=await withSpinner(_0x464834(0x1c6),()=>_0x26b172[_0x464834(0xd9)][_0x464834(0x14c)](_0x4559d9),{'verbose':_0x224fe1['verbose']}),_0x3b96b9=[];for(const _0x6666ea of _0x20dc46[_0x464834(0x1e8)]){const _0x4f6a23=_0x464834(0x139)+_0x6666ea[_0x464834(0x16b)]()[_0x464834(0x1b5)](/\s+/g,'_'),_0x4a3552=_0x464834(0x1de)+_0x4d347c+'.'+_0x4f6a23;let _0x41f98b=[];try{const _0x5a8db9=await executeSchemaQuery(_0x4a3552,_0x26b172,_0x224fe1);_0x41f98b=_0x5a8db9[_0x464834(0x1e8)][_0x464834(0xbe)](_0x25f3b9=>({'name':_0x25f3b9[_0x464834(0x1f1)],'type':_0x25f3b9[_0x464834(0xfb)]}));}catch{}_0x3b96b9[_0x464834(0x160)]({'table':_0x4f6a23,'columns':_0x41f98b});}return{'database':_0x4d347c,'parent_segment':_0x1cfc92,'parent_id':_0x4559d9,'customers':{'table':_0x464834(0x8d),'columns':_0x4dce46},'behaviors':_0x3b96b9};}[a30_0x31aa82(0x164)](_0x49e604){const _0x3b996d=a30_0x31aa82,_0x4dd819=_0x4c29a2=>{const _0xf9e02b=a30_0x3c23;if(_0x4c29a2[_0xf9e02b(0xcc)]===0x0)return'[]';const _0x1437f2=_0x4c29a2['map'](_0x3e757b=>_0xf9e02b(0x8a)+_0x3e757b['name']+_0xf9e02b(0x203)+_0x3e757b['type']+'\x22\x20}');return'[\x0a'+_0x1437f2['join'](',\x0a')+_0xf9e02b(0x197);},_0x563a8b=_0x49e604[_0x3b996d(0x1b6)][_0x3b996d(0xbe)](_0x275e8b=>{const _0x1aaefa=_0x3b996d;return _0x1aaefa(0x1a3)+_0x275e8b[_0x1aaefa(0x1ed)]+_0x1aaefa(0x1a7)+_0x4dd819(_0x275e8b[_0x1aaefa(0x15c)])[_0x1aaefa(0x1b5)](/^/gm,'\x20\x20')[_0x1aaefa(0xb7)]()+'\x0a\x20\x20\x20\x20}';})[_0x3b996d(0x10a)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x49e604[_0x3b996d(0xc6)]+_0x3b996d(0x112)+_0x49e604['parent_segment']+_0x3b996d(0xba)+_0x49e604[_0x3b996d(0xb3)]+_0x3b996d(0x100)+_0x49e604[_0x3b996d(0x8d)][_0x3b996d(0x1ed)]+_0x3b996d(0x16d)+_0x4dd819(_0x49e604[_0x3b996d(0x8d)][_0x3b996d(0x15c)])[_0x3b996d(0x1b5)](/^/gm,'\x20\x20')[_0x3b996d(0xb7)]()+_0x3b996d(0x143)+_0x563a8b+_0x3b996d(0x1ba);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0x1c3);[a30_0x31aa82(0x136)]=a30_0x31aa82(0x14f);async[a30_0x31aa82(0x110)](_0x5e1aa7){const _0x20fe84=a30_0x31aa82,{options:_0x322d33,args:_0x5993ba,tdx:_0x3e3cdc}=_0x5e1aa7,_0x1b5f07=_0x5993ba[0x0]||_0x322d33['parentSegment'];if(!_0x1b5f07)return showParentSegmentNotSetError(_0x20fe84(0xed)+_0x20fe84(0x11b)),0x1;_0x322d33[_0x20fe84(0xaf)]&&(console[_0x20fe84(0xaa)]('Site:\x20'+_0x322d33[_0x20fe84(0x148)]),console[_0x20fe84(0xaa)](_0x20fe84(0x1d4)+_0x1b5f07));const _0x27912e=await withSpinner(_0x20fe84(0x155)+_0x1b5f07+'\x27...',()=>_0x3e3cdc[_0x20fe84(0xd9)][_0x20fe84(0x157)](_0x1b5f07),{'verbose':_0x322d33[_0x20fe84(0xaf)]}),_0x53e87a=_0x27912e['data'],_0x54d6c1=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x1b5f07+_0x20fe84(0x20a),()=>_0x3e3cdc[_0x20fe84(0xd9)]['getParentSQL'](_0x53e87a),{'verbose':_0x322d33[_0x20fe84(0xaf)]}),_0x4eb93d=_0x54d6c1[_0x20fe84(0x1e8)];return _0x322d33[_0x20fe84(0x1c2)]===_0x20fe84(0x1b9)||_0x322d33[_0x20fe84(0x1c2)]==='jsonl'?await handleSDKOutput([{'sql':_0x4eb93d}],_0x322d33):console['log'](_0x4eb93d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0x1d0);[a30_0x31aa82(0x136)]=a30_0x31aa82(0xda);async['execute'](_0x411657){const _0x525fae=a30_0x31aa82,{options:_0x2810df,args:_0x3d0e54,tdx:_0x53b908}=_0x411657,_0x88ca4e=_0x3d0e54[0x0]||_0x2810df[_0x525fae(0xc8)];if(!_0x88ca4e)return showParentSegmentNotSetError(_0x525fae(0x1d1)+_0x525fae(0xb4)),0x1;_0x2810df['verbose']&&(console['error'](_0x525fae(0xad)+_0x2810df[_0x525fae(0x148)]),console['error'](_0x525fae(0x1d4)+_0x88ca4e));const _0x41da45=await withSpinner(_0x525fae(0x155)+_0x88ca4e+_0x525fae(0x20a),()=>_0x53b908[_0x525fae(0xd9)]['resolveParentId'](_0x88ca4e),{'verbose':_0x2810df[_0x525fae(0xaf)]}),_0x20e640=_0x41da45['data'],_0x56c322=await withSpinner(_0x525fae(0x205)+_0x88ca4e+_0x525fae(0x20a),()=>_0x53b908['segment']['getParentSQL'](_0x20e640),{'verbose':_0x2810df['verbose']});let _0x1df2aa=_0x56c322[_0x525fae(0x1e8)];const _0x271492=resolveLimit(_0x2810df['limit'],DEFAULT_DISPLAY_LIMIT),_0x4fd814=/\bLIMIT\s+\d+/i[_0x525fae(0x187)](_0x1df2aa);!_0x4fd814&&(_0x1df2aa=_0x1df2aa[_0x525fae(0xb7)]()[_0x525fae(0x1b5)](/;+$/,''),_0x1df2aa=_0x525fae(0x188)+_0x1df2aa+_0x525fae(0x162)+_0x271492);_0x2810df[_0x525fae(0xaf)]&&console[_0x525fae(0xaa)]('SQL\x20query:\x0a'+_0x1df2aa);const _0x2be7ea=await withProgressSpinner(_0x525fae(0xb2),async _0x2c46fb=>{const _0x1154db=_0x525fae,_0x40dbf4=await _0x53b908[_0x1154db(0xdb)][_0x1154db(0x110)](_0x1df2aa,{'catalog':'td','schema':'information_schema','onJobId':_0x190992=>{_0x2c46fb['setJobId'](_0x190992);}});return _0x40dbf4;},{'verbose':_0x2810df[_0x525fae(0xaf)]}),_0x54642e=_0x2be7ea[_0x525fae(0x1e8)],_0x301c7f=_0x54642e[_0x525fae(0x209)]?_0x525fae(0x182)+_0x54642e['jobId']+']':'';return console[_0x525fae(0xaa)](_0x525fae(0x109)+_0x54642e['stats'][_0x525fae(0x1fe)]['toLocaleString']()+_0x525fae(0x19f)+(_0x525fae(0x1c7)+formatElapsed(_0x54642e[_0x525fae(0x181)][_0x525fae(0x1f9)])+_0x301c7f)),await handleQueryOutput(_0x54642e,_0x2810df),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0xc4);[a30_0x31aa82(0x136)]=a30_0x31aa82(0x146);async[a30_0x31aa82(0x110)](_0xd721fd){const _0x3e4267=a30_0x31aa82,{options:_0x4b4e9c,args:_0x2a6f24,tdx:_0x508e56}=_0xd721fd,_0x45a9ee=_0x2a6f24[0x0],_0x154aa9=await withSpinner(_0x45a9ee?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x45a9ee+_0x3e4267(0x20a):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x508e56[_0x3e4267(0x126)]['list'](),{'verbose':_0x4b4e9c['verbose']});let _0x42b3f6=_0x154aa9[_0x3e4267(0x1e8)]['filter'](_0x584ecd=>_0x584ecd[_0x3e4267(0x89)]);if(_0x45a9ee){const _0x28cffc=_0x45a9ee[_0x3e4267(0x1b5)](/[.+^${}()|[\]\\]/g,_0x3e4267(0xfa))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x137f5c=new RegExp('^'+_0x28cffc+'$','i');_0x42b3f6=_0x42b3f6[_0x3e4267(0x1d9)](_0x4bf10f=>_0x137f5c[_0x3e4267(0x187)](_0x4bf10f[_0x3e4267(0x173)]));}_0x42b3f6[_0x3e4267(0x198)]((_0x1efc50,_0x539886)=>_0x1efc50[_0x3e4267(0x173)][_0x3e4267(0x161)](_0x539886[_0x3e4267(0x173)])),console[_0x3e4267(0xaa)](_0x3e4267(0x1fa)+_0x42b3f6['length']+'\x20RT-enabled\x20parent\x20segment'+(_0x42b3f6[_0x3e4267(0xcc)]!==0x1?'s':''));const _0x34686e=_0x354134=>{const _0x4e5a90=_0x3e4267;return getConsoleNextUrl(_0x4b4e9c[_0x4e5a90(0x148)],_0x4e5a90(0x9b)+_0x354134);};if(_0x4b4e9c['format']==='json'||_0x4b4e9c[_0x3e4267(0x1c2)]===_0x3e4267(0xea)){const _0x292cc4=_0x42b3f6[_0x3e4267(0xbe)](_0x2855cc=>({..._0x2855cc,'url':_0x34686e(_0x2855cc['id'])}));await handleSDKOutput(_0x292cc4,_0x4b4e9c);}else{if(_0x42b3f6[_0x3e4267(0xcc)]===0x0)console[_0x3e4267(0x1ec)](_0x3e4267(0x11a));else for(const _0x36ae25 of _0x42b3f6){const _0x5ed87f=_0x36ae25[_0x3e4267(0xf9)]?a30_0x5768fb[_0x3e4267(0x201)]('\x20('+formatRows(_0x36ae25['population'])+')'):'',_0x453777=hyperlink(_0x36ae25[_0x3e4267(0x173)],_0x34686e(_0x36ae25['id']));console[_0x3e4267(0x1ec)]('⚡\x20'+_0x453777+_0x5ed87f);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']=a30_0x31aa82(0x1f7);[a30_0x31aa82(0x136)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a30_0x31aa82(0x110)](_0x213967){const _0x5aca90=a30_0x31aa82,{options:_0x2205d0,args:_0x5c522d,tdx:_0x146a81}=_0x213967,_0x2c7746=_0x5c522d[0x0]||_0x2205d0[_0x5aca90(0xc8)];if(!_0x2c7746)return showParentSegmentNotSetError(_0x5aca90(0x14b)+_0x5aca90(0x1be)),0x1;const _0x28525f=resolveYamlFile(_0x2c7746);if(!existsSync(_0x28525f))return showFileNotFoundError(_0x28525f,_0x2c7746),0x1;let _0x3ff521;try{_0x3ff521=readFileSync(_0x28525f,_0x5aca90(0x1b0));}catch(_0x3ec44b){const _0x4a0c46=_0x3ec44b instanceof Error?_0x3ec44b[_0x5aca90(0x186)]:String(_0x3ec44b);return console[_0x5aca90(0xaa)](_0x5aca90(0x1e5)+_0x4a0c46),0x1;}const _0x156c39=createCommandSpinner(a30_0x5768fb[_0x5aca90(0x201)]('Validating\x20RT\x20configuration...'),{'verbose':_0x2205d0[_0x5aca90(0xaf)]});_0x156c39[_0x5aca90(0x18a)]();const _0x1735e1={'realtime':!![],'onProgress':_0x5874c8=>{_0x156c39['text']=formatProgressMessage(_0x5874c8);}};let _0x221416;try{_0x221416=await _0x146a81[_0x5aca90(0xd9)][_0x5aca90(0xce)](_0x3ff521,_0x1735e1),_0x156c39[_0x5aca90(0x1f0)]();}catch(_0x25f883){_0x156c39[_0x5aca90(0x1f0)]();throw _0x25f883;}console[_0x5aca90(0xaa)]('\x0a'+a30_0x5768fb[_0x5aca90(0x1b1)](_0x5aca90(0x202))+'\x20'+_0x221416[_0x5aca90(0x173)]),console['error']('═'[_0x5aca90(0x1e2)](0x3c)),displayRealtimeValidation(_0x221416),console[_0x5aca90(0xaa)]('─'['repeat'](0x3c));if(_0x221416[_0x5aca90(0x12a)][_0x5aca90(0xcc)]>0x0){console['error']('\x0a'+a30_0x5768fb['red'](_0x5aca90(0x1d7)));for(const _0x269464 of _0x221416['errors']){console['error']('\x20\x20'+a30_0x5768fb[_0x5aca90(0x103)]('•')+'\x20'+_0x269464);}}return _0x221416[_0x5aca90(0x18c)]&&console['error']('\x0a'+a30_0x5768fb[_0x5aca90(0x1bb)]('✔')+_0x5aca90(0x1ea)),_0x221416[_0x5aca90(0x18c)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0xae);['description']='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a30_0x31aa82(0x110)](_0x338cdd){const _0x4861ea=a30_0x31aa82,{options:_0x4ab565,args:_0x12a1b7,tdx:_0x1fb9f8}=_0x338cdd,_0x1375ab=_0x12a1b7[0x0]||_0x4ab565[_0x4861ea(0xc8)];if(!_0x1375ab)return showParentSegmentNotSetError(_0x4861ea(0x193)+_0x4861ea(0x1e4)),0x1;const _0x2698aa=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1375ab+'\x27...',()=>_0x1fb9f8[_0x4861ea(0xd9)][_0x4861ea(0x157)](_0x1375ab),{'verbose':_0x4ab565['verbose']}),_0x42d4c2=_0x2698aa[_0x4861ea(0x1e8)],_0x34272a=await withSpinner(_0x4861ea(0x121)+_0x1375ab+'\x27...',()=>_0x1fb9f8[_0x4861ea(0x101)][_0x4861ea(0x11f)](_0x42d4c2),{'verbose':_0x4ab565[_0x4861ea(0xaf)]}),_0x57d12f=_0x34272a[_0x4861ea(0x1e8)];console[_0x4861ea(0xaa)](_0x4861ea(0x1fa)+_0x57d12f[_0x4861ea(0xcc)]+_0x4861ea(0xb5)+(_0x57d12f[_0x4861ea(0xcc)]!==0x1?'s':''));if(_0x4ab565['format']===_0x4861ea(0x1b9)||_0x4ab565[_0x4861ea(0x1c2)]===_0x4861ea(0xea))await handleSDKOutput(_0x57d12f,_0x4ab565);else{if(_0x57d12f[_0x4861ea(0xcc)]===0x0)console['log']('No\x20personalization\x20services\x20configured'),console[_0x4861ea(0xaa)](a30_0x5768fb[_0x4861ea(0x95)](_0x4861ea(0xeb)));else for(const _0x2e17fd of _0x57d12f){const _0x58c374=_0x2e17fd[_0x4861ea(0x14d)]?.[_0x4861ea(0xcc)]||0x0,_0x26ecb6=_0x2e17fd[_0x4861ea(0xf3)]?a30_0x5768fb[_0x4861ea(0x201)](_0x4861ea(0xa1)+_0x2e17fd['trigger_event']):'',_0x120163=a30_0x5768fb['dim']('\x20('+_0x58c374+_0x4861ea(0xdd)+(_0x58c374!==0x1?'s':'')+')');console[_0x4861ea(0x1ec)]('\x20\x20'+_0x2e17fd[_0x4861ea(0x173)]+_0x26ecb6+_0x120163),_0x2e17fd[_0x4861ea(0x136)]&&console[_0x4861ea(0x1ec)]('\x20\x20\x20\x20'+a30_0x5768fb[_0x4861ea(0x201)](_0x2e17fd[_0x4861ea(0x136)]));}}return 0x0;}}function a30_0x3c23(_0x3fb76b,_0x2fd24f){_0x3fb76b=_0x3fb76b-0x84;const _0x478b80=a30_0x478b();let _0x3c2336=_0x478b80[_0x3fb76b];return _0x3c2336;}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x31aa82(0x173)]=a30_0x31aa82(0xa2);[a30_0x31aa82(0x136)]=a30_0x31aa82(0xd0);async[a30_0x31aa82(0x110)](_0x48a361){const _0x164ff9=a30_0x31aa82,{options:_0x7ef0e8,args:_0x1a59b0}=_0x48a361,_0x5d5f65=_0x1a59b0[0x0]||_0x7ef0e8[_0x164ff9(0xc8)];if(!_0x5d5f65)return showParentSegmentNotSetError(_0x164ff9(0x1ac)+_0x164ff9(0xef)),0x1;const _0x3d7756=resolveYamlFile(_0x5d5f65);if(!existsSync(_0x3d7756))return showFileNotFoundError(_0x3d7756,_0x5d5f65),0x1;let _0x12ded4;try{_0x12ded4=readFileSync(_0x3d7756,_0x164ff9(0x1b0));}catch(_0x26d950){const _0xc602c4=_0x26d950 instanceof Error?_0x26d950[_0x164ff9(0x186)]:String(_0x26d950);return console['error'](_0x164ff9(0x1e5)+_0xc602c4),0x1;}let _0x3c1dcd;try{_0x3c1dcd=parseDef(_0x12ded4);}catch(_0x465888){const _0x5e5891=_0x465888 instanceof Error?_0x465888[_0x164ff9(0x186)]:String(_0x465888);return console[_0x164ff9(0xaa)](a30_0x5768fb[_0x164ff9(0x103)](_0x164ff9(0x1d8)+_0x5e5891)),0x1;}if(_0x3c1dcd[_0x164ff9(0x13a)]&&_0x3c1dcd[_0x164ff9(0x13a)][_0x164ff9(0xcc)]>0x0)return console[_0x164ff9(0xaa)](a30_0x5768fb[_0x164ff9(0x159)](_0x164ff9(0x8c)+_0x3d7756)),console[_0x164ff9(0xaa)](a30_0x5768fb[_0x164ff9(0x201)](_0x164ff9(0x132)+_0x3c1dcd[_0x164ff9(0x13a)][_0x164ff9(0xcc)]+_0x164ff9(0x170))),0x1;!_0x3c1dcd[_0x164ff9(0x126)]&&(_0x3c1dcd[_0x164ff9(0x126)]={'events':[{'name':'page_view','source_table':_0x164ff9(0x1eb)}],'attributes':[{'name':_0x164ff9(0x1ef),'type':_0x164ff9(0x1a1)}],'id_stitching':{'primary_key':_0x3c1dcd[_0x164ff9(0x1e3)][_0x164ff9(0x1ed)]==='customers'?_0x164ff9(0xe2):_0x164ff9(0x130)}});_0x3c1dcd['personalization_services']=[{'name':_0x164ff9(0x1cf),'description':_0x164ff9(0x108),'trigger_event':'page_view','sections':[{'name':_0x164ff9(0x149),'criteria':'true','attributes':[_0x164ff9(0x1ef)]}]}];const _0x272234=serializeDef(_0x3c1dcd);return writeFileSync(_0x3d7756,_0x272234,_0x164ff9(0x1b0)),console[_0x164ff9(0xaa)](a30_0x5768fb[_0x164ff9(0x1bb)]('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a30_0x5768fb[_0x164ff9(0x95)](_0x3d7756)),(!_0x3c1dcd[_0x164ff9(0x126)]||_0x12ded4[_0x164ff9(0x206)]('realtime:')===-0x1)&&console[_0x164ff9(0xaa)](a30_0x5768fb[_0x164ff9(0x1bb)]('✔')+_0x164ff9(0xd6)),console[_0x164ff9(0xaa)]('\x0a'+a30_0x5768fb[_0x164ff9(0x201)]('Next\x20steps:')),console['error']('\x20\x201.\x20Edit\x20'+_0x3d7756+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x164ff9(0xaa)](_0x164ff9(0x178)+a30_0x5768fb[_0x164ff9(0x201)](_0x164ff9(0x1f8)+_0x5d5f65)+_0x164ff9(0x9c)),0x0;}}
@@ -1 +1 @@
1
- const a31_0x3000f1=a31_0x87f4;(function(_0x1e585f,_0xf554e7){const _0x151f41=a31_0x87f4,_0x2c6661=_0x1e585f();while(!![]){try{const _0x54cc49=parseInt(_0x151f41(0x1a9))/0x1+parseInt(_0x151f41(0x182))/0x2*(-parseInt(_0x151f41(0x170))/0x3)+parseInt(_0x151f41(0x17b))/0x4+parseInt(_0x151f41(0x183))/0x5*(parseInt(_0x151f41(0x17d))/0x6)+parseInt(_0x151f41(0x16d))/0x7+-parseInt(_0x151f41(0x19f))/0x8+-parseInt(_0x151f41(0x185))/0x9*(parseInt(_0x151f41(0x1a6))/0xa);if(_0x54cc49===_0xf554e7)break;else _0x2c6661['push'](_0x2c6661['shift']());}catch(_0x2016aa){_0x2c6661['push'](_0x2c6661['shift']());}}}(a31_0x3d05,0xed462));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a31_0x2a60b1 from'chalk';function a31_0x87f4(_0x55c213,_0x54d4cc){_0x55c213=_0x55c213-0x16c;const _0x3d0526=a31_0x3d05();let _0x87f4e7=_0x3d0526[_0x55c213];return _0x87f4e7;}export class PolicyCommand extends BaseCommand{[a31_0x3000f1(0x17f)]='policy';['description']=a31_0x3000f1(0x174);async[a31_0x3000f1(0x176)](_0x9e6706){const _0x7f234=a31_0x3000f1,{options:_0x2a6a12,tdx:_0x410402}=_0x9e6706,_0x48d2c0=await withSpinner('Fetching\x20permissions...',async()=>{const _0x468301=a31_0x87f4,[_0x26beda,_0x28da71]=await Promise[_0x468301(0x1a0)]([_0x410402[_0x468301(0x180)][_0x468301(0x198)](),_0x410402[_0x468301(0x17a)]['getMyPermissions']()]);return{'userInfo':_0x26beda,'permissions':_0x28da71};},{'verbose':_0x2a6a12[_0x7f234(0x171)]}),{userInfo:_0xf804ea,permissions:_0x49a67e}=_0x48d2c0[_0x7f234(0x1a2)];if(isStructuredFormat(_0x2a6a12))return await handleSingleObjectOutput(_0x49a67e,_0x2a6a12),0x0;const _0x21e9fa=_0xf804ea[_0x7f234(0x19e)]?_0x7f234(0x179):_0xf804ea[_0x7f234(0x1a3)]?_0x7f234(0x184):_0x7f234(0x1a7);console[_0x7f234(0x187)]('\x0a'+a31_0x2a60b1['bold']('👤')+'\x20'+a31_0x2a60b1[_0x7f234(0x196)](_0xf804ea[_0x7f234(0x17f)])+'\x20'+a31_0x2a60b1['dim']('('+_0xf804ea[_0x7f234(0x173)]+')')+_0x7f234(0x178)+_0x21e9fa),console[_0x7f234(0x187)](a31_0x2a60b1[_0x7f234(0x1a5)](_0x7f234(0x19a)+_0x410402[_0x7f234(0x18d)][_0x7f234(0x189)]+':'+_0xf804ea['account_id']+',\x20user_id:'+_0xf804ea['id']));const _0x252e5a=_0x49a67e[_0x7f234(0x177)];console['log']('\x0a'+a31_0x2a60b1['bold'](_0x7f234(0x1a1))+'\x20('+_0x252e5a[_0x7f234(0x194)]+'):');if(_0x252e5a[_0x7f234(0x194)]===0x0)console['log'](a31_0x2a60b1[_0x7f234(0x1a5)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x12a85a of _0x252e5a){console[_0x7f234(0x187)](_0x7f234(0x16e)+_0x12a85a[_0x7f234(0x17f)]);}return printPermissionsMap(_0x49a67e[_0x7f234(0x18f)]),console[_0x7f234(0x187)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a31_0x3000f1(0x17f)]=a31_0x3000f1(0x191);[a31_0x3000f1(0x17c)]=a31_0x3000f1(0x199);async[a31_0x3000f1(0x176)](_0x38442e){const _0x4c469c=a31_0x3000f1,{options:_0x55825f,tdx:_0x48d0a4}=_0x38442e,_0x32a2ed=await withSpinner(_0x4c469c(0x18b),()=>_0x48d0a4[_0x4c469c(0x17a)][_0x4c469c(0x192)](),{'verbose':_0x55825f['verbose']}),_0x4d8828=_0x32a2ed['data'];console[_0x4c469c(0x193)](_0x4c469c(0x188)+_0x4d8828[_0x4c469c(0x194)]+_0x4c469c(0x1a8)+(_0x4d8828['length']!==0x1?_0x4c469c(0x1a4):'y'));if(isStructuredFormat(_0x55825f))return await handleSDKOutput(_0x4d8828,_0x55825f),0x0;if(_0x4d8828['length']===0x0)console[_0x4c469c(0x187)](a31_0x2a60b1[_0x4c469c(0x1a5)](_0x4c469c(0x195)));else for(const _0x580124 of _0x4d8828){const _0xbe5b12=_0x580124[_0x4c469c(0x17c)]?a31_0x2a60b1[_0x4c469c(0x1a5)](_0x4c469c(0x178)+_0x580124[_0x4c469c(0x17c)]):'';console[_0x4c469c(0x187)](_0x4c469c(0x16e)+_0x580124[_0x4c469c(0x17f)]+_0xbe5b12);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a31_0x3000f1(0x17f)]=a31_0x3000f1(0x197);[a31_0x3000f1(0x17c)]=a31_0x3000f1(0x186);['validate'](_0xaeb027){const _0x489273=a31_0x3000f1;if(_0xaeb027[_0x489273(0x16c)]['length']===0x0)return _0x489273(0x175);return undefined;}async[a31_0x3000f1(0x176)](_0x58a2d0){const _0x44b256=a31_0x3000f1,{options:_0x4f24a2,tdx:_0x6bd4bb}=_0x58a2d0,_0x150e68=_0x58a2d0[_0x44b256(0x16c)][0x0],_0x552107=await withSpinner(_0x44b256(0x17e),async()=>{const _0x371ea4=_0x44b256,_0x4c20f1=await _0x6bd4bb[_0x371ea4(0x17a)][_0x371ea4(0x18c)](_0x150e68),[_0x25b65b,_0x3ace5a]=await Promise[_0x371ea4(0x1a0)]([_0x6bd4bb['policy'][_0x371ea4(0x16f)](_0x4c20f1['id']),_0x6bd4bb[_0x371ea4(0x17a)][_0x371ea4(0x190)](_0x4c20f1['id'])]);return{'policy':_0x4c20f1,'perms':_0x25b65b,'users':_0x3ace5a};},{'verbose':_0x4f24a2[_0x44b256(0x171)]}),{policy:_0x2f2388,perms:_0x277891,users:_0x5908bd}=_0x552107[_0x44b256(0x1a2)];if(isStructuredFormat(_0x4f24a2))return await handleSingleObjectOutput({..._0x2f2388,'permissions':_0x277891[_0x44b256(0x18f)],'users':_0x5908bd},_0x4f24a2),0x0;console['log']('\x0a'+a31_0x2a60b1[_0x44b256(0x196)]('📋')+'\x20'+a31_0x2a60b1[_0x44b256(0x196)](_0x2f2388[_0x44b256(0x17f)])+'\x20'+a31_0x2a60b1[_0x44b256(0x1a5)](_0x44b256(0x19b)+_0x2f2388['id']+')'));_0x2f2388['description']&&console[_0x44b256(0x187)]('\x20\x20\x20'+a31_0x2a60b1[_0x44b256(0x1a5)](_0x2f2388[_0x44b256(0x17c)]));console['log'](_0x44b256(0x19a)+_0x5908bd[_0x44b256(0x194)]+'\x20user'+(_0x5908bd[_0x44b256(0x194)]!==0x1?'s':'')+_0x44b256(0x181)),printPermissionsMap(_0x277891['permissions']);if(_0x5908bd[_0x44b256(0x194)]>0x0){console[_0x44b256(0x187)]('\x0a'+a31_0x2a60b1[_0x44b256(0x196)](_0x44b256(0x18a))+':');for(const _0x4a09e9 of _0x5908bd){const _0x103ffe=_0x4a09e9['email']&&_0x4a09e9[_0x44b256(0x173)]!==_0x4a09e9[_0x44b256(0x17f)]?a31_0x2a60b1['dim']('\x20<'+_0x4a09e9[_0x44b256(0x173)]+'>'):'';console[_0x44b256(0x187)](_0x44b256(0x16e)+_0x4a09e9[_0x44b256(0x17f)]+_0x103ffe);}}return console[_0x44b256(0x187)](),0x0;}}function a31_0x3d05(){const _0x105e87=['map','account_owner','14428528ZdFBWv','all','📋\x20Assigned\x20Policies','data','administrator','ies','dim','106130PvZUVe','Member','\x20polic','1400919XCkufF','args','12547612ORSGtS','\x20\x20•\x20','getPolicyPermissions','85308LZKrrz','verbose','entries','email','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','execute','policies','\x20—\x20','Account\x20Owner','policy','6343444mYsvQY','description','9426RbeiYk','Fetching\x20policy...','name','user','\x20assigned','14yvoHbz','775TEYwhh','Administrator','1737sKGaXc','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','log','✔\x20Found\x20','site','👥\x20Assigned\x20Users','Listing\x20policies...','getPolicy','context','\x20\x20No\x20permissions','permissions','getPolicyUsers','policy\x20list','listPolicies','error','length','No\x20policies\x20found','bold','policy\x20show','getCurrent','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20\x20\x20','(ID:\x20','max'];a31_0x3d05=function(){return _0x105e87;};return a31_0x3d05();}function printPermissionsMap(_0x5471c4){const _0x216237=a31_0x3000f1,_0x4dd362=Object[_0x216237(0x172)](_0x5471c4);console[_0x216237(0x187)]('\x0a'+a31_0x2a60b1[_0x216237(0x196)]('🔑\x20Effective\x20Permissions')+':');if(_0x4dd362[_0x216237(0x194)]===0x0){console[_0x216237(0x187)](a31_0x2a60b1['dim'](_0x216237(0x18e)));return;}const _0x45caf1=Math[_0x216237(0x19c)](..._0x4dd362[_0x216237(0x19d)](([_0x63af63])=>_0x63af63[_0x216237(0x194)]));for(const [_0x15f7db,_0x764705]of _0x4dd362){const _0x57f51c=formatOperations(_0x764705);console[_0x216237(0x187)]('\x20\x20'+_0x15f7db['padEnd'](_0x45caf1+0x2)+_0x57f51c);}}function formatOperations(_0x50c21f){const _0x320dcb=a31_0x3000f1,_0x2a9fa4=[...new Set(_0x50c21f[_0x320dcb(0x19d)](_0x209cf3=>_0x209cf3['operation']))];return _0x2a9fa4['join'](',\x20');}
1
+ const a31_0x25bce9=a31_0x514d;(function(_0x425e99,_0x1613de){const _0x4bf83e=a31_0x514d,_0x477e7c=_0x425e99();while(!![]){try{const _0x5ca41b=parseInt(_0x4bf83e(0x1b3))/0x1+parseInt(_0x4bf83e(0x19a))/0x2+-parseInt(_0x4bf83e(0x1a9))/0x3*(-parseInt(_0x4bf83e(0x197))/0x4)+parseInt(_0x4bf83e(0x1b6))/0x5*(-parseInt(_0x4bf83e(0x18c))/0x6)+parseInt(_0x4bf83e(0x1a5))/0x7+parseInt(_0x4bf83e(0x196))/0x8+parseInt(_0x4bf83e(0x1a0))/0x9*(-parseInt(_0x4bf83e(0x1bf))/0xa);if(_0x5ca41b===_0x1613de)break;else _0x477e7c['push'](_0x477e7c['shift']());}catch(_0x2cc158){_0x477e7c['push'](_0x477e7c['shift']());}}}(a31_0x4b46,0x2b475));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a31_0x57b9ac from'chalk';function a31_0x514d(_0x3a5ac7,_0x1615cb){_0x3a5ac7=_0x3a5ac7-0x189;const _0x4b46c3=a31_0x4b46();let _0x514d6f=_0x4b46c3[_0x3a5ac7];return _0x514d6f;}export class PolicyCommand extends BaseCommand{[a31_0x25bce9(0x19b)]=a31_0x25bce9(0x1b9);['description']=a31_0x25bce9(0x1ae);async[a31_0x25bce9(0x1b4)](_0x9a824d){const _0x405c43=a31_0x25bce9,{options:_0x2b0459,tdx:_0x18ea26}=_0x9a824d,_0x4f1aae=await withSpinner(_0x405c43(0x191),async()=>{const _0x540ea1=_0x405c43,[_0x35d934,_0x48af33]=await Promise[_0x540ea1(0x1bd)]([_0x18ea26['user'][_0x540ea1(0x19d)](),_0x18ea26[_0x540ea1(0x1b9)][_0x540ea1(0x190)]()]);return{'userInfo':_0x35d934,'permissions':_0x48af33};},{'verbose':_0x2b0459[_0x405c43(0x1a3)]}),{userInfo:_0x58f6ff,permissions:_0x358579}=_0x4f1aae[_0x405c43(0x1a2)];if(isStructuredFormat(_0x2b0459))return await handleSingleObjectOutput(_0x358579,_0x2b0459),0x0;const _0x1b9b63=_0x58f6ff[_0x405c43(0x1ba)]?_0x405c43(0x195):_0x58f6ff['administrator']?'Administrator':_0x405c43(0x189);console[_0x405c43(0x1a8)]('\x0a'+a31_0x57b9ac[_0x405c43(0x1be)]('👤')+'\x20'+a31_0x57b9ac[_0x405c43(0x1be)](_0x58f6ff[_0x405c43(0x19b)])+'\x20'+a31_0x57b9ac[_0x405c43(0x1af)]('('+_0x58f6ff[_0x405c43(0x18a)]+')')+'\x20—\x20'+_0x1b9b63),console['log'](a31_0x57b9ac[_0x405c43(0x1af)](_0x405c43(0x18d)+_0x18ea26[_0x405c43(0x1bc)]['site']+':'+_0x58f6ff['account_id']+_0x405c43(0x198)+_0x58f6ff['id']));const _0x4c6201=_0x358579['policies'];console[_0x405c43(0x1a8)]('\x0a'+a31_0x57b9ac[_0x405c43(0x1be)](_0x405c43(0x1b8))+'\x20('+_0x4c6201[_0x405c43(0x1a1)]+'):');if(_0x4c6201[_0x405c43(0x1a1)]===0x0)console[_0x405c43(0x1a8)](a31_0x57b9ac[_0x405c43(0x1af)](_0x405c43(0x193)));else for(const _0x42ef97 of _0x4c6201){console[_0x405c43(0x1a8)](_0x405c43(0x199)+_0x42ef97[_0x405c43(0x19b)]);}return printPermissionsMap(_0x358579[_0x405c43(0x1a4)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']='policy\x20list';['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a31_0x25bce9(0x1b4)](_0x5cf8da){const _0x459e77=a31_0x25bce9,{options:_0x481251,tdx:_0xaf3976}=_0x5cf8da,_0x5830d5=await withSpinner(_0x459e77(0x1bb),()=>_0xaf3976['policy']['listPolicies'](),{'verbose':_0x481251['verbose']}),_0x2349cf=_0x5830d5[_0x459e77(0x1a2)];console[_0x459e77(0x1b1)]('✔\x20Found\x20'+_0x2349cf[_0x459e77(0x1a1)]+'\x20polic'+(_0x2349cf['length']!==0x1?_0x459e77(0x1a6):'y'));if(isStructuredFormat(_0x481251))return await handleSDKOutput(_0x2349cf,_0x481251),0x0;if(_0x2349cf[_0x459e77(0x1a1)]===0x0)console[_0x459e77(0x1a8)](a31_0x57b9ac[_0x459e77(0x1af)](_0x459e77(0x1aa)));else for(const _0x50acdc of _0x2349cf){const _0x392e3b=_0x50acdc[_0x459e77(0x19e)]?a31_0x57b9ac['dim'](_0x459e77(0x1c2)+_0x50acdc[_0x459e77(0x19e)]):'';console[_0x459e77(0x1a8)](_0x459e77(0x199)+_0x50acdc[_0x459e77(0x19b)]+_0x392e3b);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a31_0x25bce9(0x19b)]=a31_0x25bce9(0x1c3);[a31_0x25bce9(0x19e)]=a31_0x25bce9(0x18b);['validate'](_0x854f03){if(_0x854f03['args']['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a31_0x25bce9(0x1b4)](_0x1a58e0){const _0x49689e=a31_0x25bce9,{options:_0x27c989,tdx:_0x3d4846}=_0x1a58e0,_0x374d55=_0x1a58e0[_0x49689e(0x1a7)][0x0],_0x3533cc=await withSpinner(_0x49689e(0x192),async()=>{const _0x5dd338=_0x49689e,_0x59d608=await _0x3d4846[_0x5dd338(0x1b9)][_0x5dd338(0x1b5)](_0x374d55),[_0x1a209e,_0x409d15]=await Promise['all']([_0x3d4846[_0x5dd338(0x1b9)][_0x5dd338(0x1ab)](_0x59d608['id']),_0x3d4846['policy'][_0x5dd338(0x19c)](_0x59d608['id'])]);return{'policy':_0x59d608,'perms':_0x1a209e,'users':_0x409d15};},{'verbose':_0x27c989[_0x49689e(0x1a3)]}),{policy:_0x401131,perms:_0x4817fa,users:_0x567df1}=_0x3533cc[_0x49689e(0x1a2)];if(isStructuredFormat(_0x27c989))return await handleSingleObjectOutput({..._0x401131,'permissions':_0x4817fa[_0x49689e(0x1a4)],'users':_0x567df1},_0x27c989),0x0;console[_0x49689e(0x1a8)]('\x0a'+a31_0x57b9ac[_0x49689e(0x1be)]('📋')+'\x20'+a31_0x57b9ac[_0x49689e(0x1be)](_0x401131['name'])+'\x20'+a31_0x57b9ac[_0x49689e(0x1af)]('(ID:\x20'+_0x401131['id']+')'));_0x401131[_0x49689e(0x19e)]&&console['log'](_0x49689e(0x18d)+a31_0x57b9ac[_0x49689e(0x1af)](_0x401131[_0x49689e(0x19e)]));console[_0x49689e(0x1a8)]('\x20\x20\x20'+_0x567df1[_0x49689e(0x1a1)]+_0x49689e(0x1b0)+(_0x567df1[_0x49689e(0x1a1)]!==0x1?'s':'')+_0x49689e(0x1b2)),printPermissionsMap(_0x4817fa[_0x49689e(0x1a4)]);if(_0x567df1[_0x49689e(0x1a1)]>0x0){console['log']('\x0a'+a31_0x57b9ac['bold'](_0x49689e(0x1c1))+':');for(const _0x5b15b7 of _0x567df1){const _0x23a04e=_0x5b15b7['email']&&_0x5b15b7['email']!==_0x5b15b7[_0x49689e(0x19b)]?a31_0x57b9ac['dim']('\x20<'+_0x5b15b7[_0x49689e(0x18a)]+'>'):'';console[_0x49689e(0x1a8)]('\x20\x20•\x20'+_0x5b15b7[_0x49689e(0x19b)]+_0x23a04e);}}return console[_0x49689e(0x1a8)](),0x0;}}function a31_0x4b46(){const _0x32f3db=['👥\x20Assigned\x20Users','\x20—\x20','policy\x20show','Member','email','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','586806wksKUm','\x20\x20\x20','map','\x20\x20No\x20permissions','getMyPermissions','Fetching\x20permissions...','Fetching\x20policy...','\x20\x20No\x20policies\x20assigned','operation','Account\x20Owner','746224rusGHp','692EVrmjA',',\x20user_id:','\x20\x20•\x20','697732TdUdOO','name','getPolicyUsers','getCurrent','description','max','2664SlGhMt','length','data','verbose','permissions','1853012KvOhTN','ies','args','log','4083gKZDBU','No\x20policies\x20found','getPolicyPermissions','padEnd','entries','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','dim','\x20user','error','\x20assigned','193942eMwOtS','execute','getPolicy','10rCqTbD','join','📋\x20Assigned\x20Policies','policy','account_owner','Listing\x20policies...','context','all','bold','25790HzQZuY','🔑\x20Effective\x20Permissions'];a31_0x4b46=function(){return _0x32f3db;};return a31_0x4b46();}function printPermissionsMap(_0x491217){const _0x57da74=a31_0x25bce9,_0x39aa04=Object[_0x57da74(0x1ad)](_0x491217);console[_0x57da74(0x1a8)]('\x0a'+a31_0x57b9ac[_0x57da74(0x1be)](_0x57da74(0x1c0))+':');if(_0x39aa04[_0x57da74(0x1a1)]===0x0){console[_0x57da74(0x1a8)](a31_0x57b9ac[_0x57da74(0x1af)](_0x57da74(0x18f)));return;}const _0x2e5103=Math[_0x57da74(0x19f)](..._0x39aa04[_0x57da74(0x18e)](([_0x528651])=>_0x528651[_0x57da74(0x1a1)]));for(const [_0x5c9303,_0xbfded5]of _0x39aa04){const _0xf662c3=formatOperations(_0xbfded5);console['log']('\x20\x20'+_0x5c9303[_0x57da74(0x1ac)](_0x2e5103+0x2)+_0xf662c3);}}function formatOperations(_0x3fa65b){const _0xe29bdd=a31_0x25bce9,_0x4e9bd1=[...new Set(_0x3fa65b[_0xe29bdd(0x18e)](_0x56f0d9=>_0x56f0d9[_0xe29bdd(0x194)]))];return _0x4e9bd1[_0xe29bdd(0x1b7)](',\x20');}
@@ -1 +1 @@
1
- const a32_0x111046=a32_0x5c07;(function(_0x1ca8e4,_0xfdfca9){const _0x5339c5=a32_0x5c07,_0x278450=_0x1ca8e4();while(!![]){try{const _0x5687a1=-parseInt(_0x5339c5(0x1db))/0x1+parseInt(_0x5339c5(0x1fd))/0x2+-parseInt(_0x5339c5(0x211))/0x3*(-parseInt(_0x5339c5(0x217))/0x4)+-parseInt(_0x5339c5(0x1f6))/0x5*(parseInt(_0x5339c5(0x1ed))/0x6)+-parseInt(_0x5339c5(0x1e1))/0x7*(parseInt(_0x5339c5(0x22c))/0x8)+-parseInt(_0x5339c5(0x210))/0x9*(-parseInt(_0x5339c5(0x1ef))/0xa)+parseInt(_0x5339c5(0x1e4))/0xb;if(_0x5687a1===_0xfdfca9)break;else _0x278450['push'](_0x278450['shift']());}catch(_0x511f60){_0x278450['push'](_0x278450['shift']());}}}(a32_0x12f9,0x262c6));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 a32_0x27b8a7 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a32_0x5c07(_0x4e1c48,_0x73ebbb){_0x4e1c48=_0x4e1c48-0x1d9;const _0x12f972=a32_0x12f9();let _0x5c071e=_0x12f972[_0x4e1c48];return _0x5c071e;}import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';function a32_0x12f9(){const _0x32dcbf=['trim','tdx:\x20profile\x20remove','60930prPmuL','green','20sIItYY','Site\x20was\x20not\x20changed.','Remove\x20a\x20profile','profile','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','includes','tdx:\x20profile\x20set','10sAgpIp','profile:remove','llm_project','Set\x20session\x20profile','(session:\x20','apikey','us01','142976LKxUSK','text','Setup\x20cancelled','Session\x20profile\x20set\x20to:\x20','Enter\x20profile\x20name:','red','API\x20key\x20cannot\x20be\x20empty','default','Profile\x20name\x20cannot\x20be\x20empty','Set\x20a\x20profile\x20configuration\x20value','length','Removal\x20cancelled','API\x20Key','email','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','join','Failed\x20to\x20remove\x20profile:\x20','error','Validating\x20API\x20key...','405711rIMiFa','27HXSvhK','\x27\x20updated:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','dim','oauth','apiKey','112484NIaWcq','profileName','VALID_KEYS','Create\x20a\x20new\x20profile','password','\x20Profile\x20\x27','session','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','tdx:\x20profile\x20create','Operation\x20cancelled','getUserInfo','\x20\x20tdx\x20--profile\x20','yellow','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','ERROR','/app/mp/ak','Profile\x20\x27','jobs','✗\x20Validation\x20failed:\x20','bold','logLevel','34264NKuMZA','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profile:create','profile:set','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20does\x20not\x20exist.','\x27\x20removed\x20from\x20configuration','split','execute','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','confirm','\x0aAvailable\x20profiles:','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','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>','llm_agent','(cleared)','create','Changing\x20site\x20to\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20-\x20','site','\x0aSetup\x20cancelled','125748LCXLyZ','name','log','message','\x27.\x0a\x0aValid\x20keys:\x20','\x20\x20(no\x20profiles\x20found)','203xvCReb','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','profile:use','130768zBYPjd','method','config','status','validate','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','description'];a32_0x12f9=function(){return _0x32dcbf;};return a32_0x12f9();}import{promptSiteSelection}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 a32_0x31d888 from'prompts';import a32_0x4d34e1 from'chalk';function validateProfileName(_0x291580){const _0x57e4e2=a32_0x5c07;if(!_0x291580||!_0x291580[_0x57e4e2(0x1eb)]())return _0x57e4e2(0x205);const _0x46ac88=_0x291580['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x46ac88))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x46ac88))return _0x57e4e2(0x227)+_0x46ac88+_0x57e4e2(0x213);return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x111046(0x1dc)]=a32_0x111046(0x230);['description']=a32_0x111046(0x21a);async[a32_0x111046(0x236)](_0x246cdf){const _0xdbba20=a32_0x111046,{options:_0x33a39e,args:_0xd34d1a}=_0x246cdf;console['log'](a32_0x4d34e1[_0xdbba20(0x22a)](_0xdbba20(0x21f)));let _0x232383;if(_0xd34d1a[_0xdbba20(0x207)]>0x0&&_0xd34d1a[0x0]){const _0x2e77c5=_0xd34d1a[0x0][_0xdbba20(0x1eb)](),_0x582e91=validateProfileName(_0x2e77c5);if(_0x582e91!==!![])return console[_0xdbba20(0x20e)](a32_0x4d34e1[_0xdbba20(0x202)](_0x582e91)),0x1;_0x232383=_0x2e77c5;}else{const _0x5b5b49=await a32_0x31d888({'type':_0xdbba20(0x1fe),'name':'profileName','message':_0xdbba20(0x201),'validate':validateProfileName});if(!_0x5b5b49['profileName'])return console[_0xdbba20(0x1dd)](_0xdbba20(0x1da)),0x1;_0x232383=_0x5b5b49[_0xdbba20(0x218)][_0xdbba20(0x1eb)]();}const _0x5824ee=await a32_0x31d888({'type':_0xdbba20(0x1fe),'name':_0xdbba20(0x1ea),'message':'Enter\x20description\x20(optional):'}),_0x160313=_0x5824ee['description']?.[_0xdbba20(0x1eb)]()||undefined,_0x2a19ee=_0x33a39e[_0xdbba20(0x1d9)]||_0xdbba20(0x1fc),_0x53c847=await promptSiteSelection(_0x2a19ee,_0x232383,_0xdbba20(0x1ff));if(!_0x53c847)return 0x1;const _0x1ce79f=resolveSite(_0x53c847);if(isOAuthSupported(_0x1ce79f)){const _0x133beb=await a32_0x31d888({'type':'select','name':_0xdbba20(0x1e5),'message':'Choose\x20authentication\x20method:','choices':[{'title':'OAuth\x20(browser\x20login)','value':_0xdbba20(0x215)},{'title':_0xdbba20(0x209),'value':_0xdbba20(0x1fb)}]});if(!_0x133beb[_0xdbba20(0x1e5)])return console[_0xdbba20(0x1dd)](_0xdbba20(0x1da)),0x1;if(_0x133beb[_0xdbba20(0x1e5)]==='oauth'){if(_0x160313){const _0x16989c={'site':_0x1ce79f,'description':_0x160313};saveProfileToUserConfig(_0x232383,_0x16989c);}return await runOAuthLoginFlow(_0x1ce79f,_0x232383,_0x33a39e[_0xdbba20(0x22b)]??LogLevel['ERROR']),0x0;}}console[_0xdbba20(0x1dd)](_0xdbba20(0x22f)+_0x1ce79f),console[_0xdbba20(0x1dd)](_0xdbba20(0x237)),console[_0xdbba20(0x1dd)]('\x20\x20'+getConsoleUrl(_0x1ce79f,_0xdbba20(0x226)));const _0x51110b=await a32_0x31d888({'type':'password','name':_0xdbba20(0x216),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x185b3c=>{const _0x20fa09=_0xdbba20;if(!_0x185b3c||!_0x185b3c['trim']())return _0x20fa09(0x203);return!![];}});if(!_0x51110b[_0xdbba20(0x216)])return console[_0xdbba20(0x1dd)]('\x0aSetup\x20cancelled'),0x1;const _0x54259b=_0x51110b[_0xdbba20(0x216)];console[_0xdbba20(0x1dd)](_0xdbba20(0x20f));try{const _0x261639=TDX[_0xdbba20(0x240)]({'site':_0x1ce79f,'apiKey':_0x54259b[_0xdbba20(0x1eb)](),'logLevel':_0x33a39e[_0xdbba20(0x22b)]??LogLevel['ERROR']}),_0x32d40e=await _0x261639['jobs'][_0xdbba20(0x221)]();console[_0xdbba20(0x1dd)](a32_0x4d34e1[_0xdbba20(0x1ee)]('✓')+_0xdbba20(0x22e)+_0x32d40e[_0xdbba20(0x20a)]+')');const _0x4a3146=await isKeychainAvailable();_0x4a3146?(await saveAPIKeyAsync(_0x54259b[_0xdbba20(0x1eb)](),_0x1ce79f,_0x232383),console[_0xdbba20(0x1dd)](a32_0x4d34e1[_0xdbba20(0x1ee)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x232383+')')):(console['warn'](a32_0x4d34e1[_0xdbba20(0x223)](_0xdbba20(0x1e9))),console['warn'](a32_0x4d34e1[_0xdbba20(0x223)](_0xdbba20(0x238))));const _0x13b2bf={'site':_0x1ce79f,..._0x160313&&{'description':_0x160313}};return saveProfileToUserConfig(_0x232383,_0x13b2bf),console['log'](a32_0x4d34e1['green']('✓')+'\x20Profile\x20\x27'+_0x232383+'\x27\x20created'),console[_0xdbba20(0x1dd)](),console[_0xdbba20(0x1dd)](_0xdbba20(0x23c)),console[_0xdbba20(0x1dd)](_0xdbba20(0x222)+_0x232383+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0xdbba20(0x1dd)](_0xdbba20(0x222)+_0x232383+_0xdbba20(0x1f3)),0x0;}catch(_0x527800){if(_0x527800 instanceof HTTPClientError&&_0x527800['status']===0x191)return printAuthError(_0x527800),0x1;return console[_0xdbba20(0x20e)](a32_0x4d34e1[_0xdbba20(0x202)](_0xdbba20(0x229)+(_0x527800 instanceof Error?_0x527800[_0xdbba20(0x1de)]:String(_0x527800)))),console['error'](_0xdbba20(0x224)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a32_0x111046(0x1f7);[a32_0x111046(0x1ea)]=a32_0x111046(0x1f1);['validate'](_0x4b0458){const _0x5845f3=a32_0x111046,{args:_0x4e85f0}=_0x4b0458;if(_0x4e85f0[_0x5845f3(0x207)]===0x0)return _0x5845f3(0x21e);return undefined;}async['execute'](_0xd0fa52){const _0x5eb971=a32_0x111046,{args:_0x5ee391}=_0xd0fa52,_0x8716db=_0x5ee391[0x0];console[_0x5eb971(0x1dd)](a32_0x4d34e1['bold'](_0x5eb971(0x1ec)));if(!profileExists(_0x8716db)){console[_0x5eb971(0x20e)](a32_0x4d34e1[_0x5eb971(0x202)](_0x5eb971(0x227)+_0x8716db+_0x5eb971(0x233))),console['log'](_0x5eb971(0x23b));const _0x4fd27a=listProfiles();if(_0x4fd27a[_0x5eb971(0x207)]===0x0)console[_0x5eb971(0x1dd)](_0x5eb971(0x1e0));else for(const _0x5bc44f of _0x4fd27a){console['log'](_0x5eb971(0x243)+_0x5bc44f[_0x5eb971(0x1dc)]);}return 0x1;}const _0x1fb485=await a32_0x31d888({'type':_0x5eb971(0x23a),'name':_0x5eb971(0x23a),'message':_0x5eb971(0x242)+_0x8716db+'\x27?','initial':![]});if(!_0x1fb485['confirm'])return console[_0x5eb971(0x1dd)](_0x5eb971(0x208)),0x0;try{removeProfileFromUserConfig(_0x8716db),console['log'](a32_0x4d34e1['green']('✓')+_0x5eb971(0x21c)+_0x8716db+_0x5eb971(0x234));}catch(_0xfe3bc){return console['error'](a32_0x4d34e1['red'](_0x5eb971(0x20d)+(_0xfe3bc instanceof Error?_0xfe3bc[_0x5eb971(0x1de)]:String(_0xfe3bc)))),0x1;}const _0x1f3e80=await isKeychainAvailable();if(_0x1f3e80){const _0x717c9f=await deleteKeychainAPIKey(_0x8716db);_0x717c9f&&console[_0x5eb971(0x1dd)](a32_0x4d34e1['green']('✓')+_0x5eb971(0x22d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a32_0x111046(0x1dc)]=a32_0x111046(0x231);[a32_0x111046(0x1ea)]=a32_0x111046(0x206);static [a32_0x111046(0x219)]=[a32_0x111046(0x1d9),'database','parent_segment',a32_0x111046(0x1f8),a32_0x111046(0x23e),a32_0x111046(0x1ea)];[a32_0x111046(0x1e8)](_0x471cc9){const _0x93efc4=a32_0x111046,{args:_0x524c4b,options:_0x33feb6}=_0x471cc9,_0x5f2e81=_0x33feb6[_0x93efc4(0x1f2)]||getActiveProfile();if(!_0x5f2e81)return _0x93efc4(0x23d);if(_0x524c4b[_0x93efc4(0x207)]===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'][_0x93efc4(0x20c)](',\x20');const _0x3416dd=_0x524c4b[0x0];if(!_0x3416dd[_0x93efc4(0x1f4)]('='))return _0x93efc4(0x1e2)+ProfileSetCommand[_0x93efc4(0x219)][_0x93efc4(0x20c)](',\x20');const [_0x39fbb6]=_0x3416dd[_0x93efc4(0x235)]('=',0x2);if(!ProfileSetCommand[_0x93efc4(0x219)][_0x93efc4(0x1f4)](_0x39fbb6))return'Unknown\x20key\x20\x27'+_0x39fbb6+_0x93efc4(0x1df)+ProfileSetCommand[_0x93efc4(0x219)][_0x93efc4(0x20c)](',\x20');return undefined;}async['execute'](_0x3b689f){const _0x21e918=a32_0x111046,{args:_0x2b173b,options:_0x1a2d4d}=_0x3b689f,_0xc0348=_0x1a2d4d['profile']||getActiveProfile(),[_0x40a87f,..._0x453fbc]=_0x2b173b[0x0][_0x21e918(0x235)]('='),_0x20c5e8=_0x453fbc[_0x21e918(0x20c)]('=');console[_0x21e918(0x1dd)](a32_0x4d34e1[_0x21e918(0x22a)](_0x21e918(0x1f5)));if(!profileExists(_0xc0348)){const _0x49dc66=await a32_0x31d888({'type':_0x21e918(0x23a),'name':_0x21e918(0x240),'message':_0x21e918(0x227)+_0xc0348+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x49dc66['create'])return console['log'](_0x21e918(0x220)),0x1;}const _0x276852=loadProfile(_0xc0348),_0x2e7ca4=_0x276852?.[_0x21e918(0x1e6)]||{};if(_0x40a87f===_0x21e918(0x1d9)){const _0xece0c8=resolveSite(_0x20c5e8);console[_0x21e918(0x1dd)](_0x21e918(0x241)+_0xece0c8+_0x21e918(0x232)),console['log'](_0x21e918(0x20b)),console[_0x21e918(0x1dd)]('\x20\x20'+getConsoleUrl(_0xece0c8,_0x21e918(0x226)));const _0x38147b=await a32_0x31d888({'type':_0x21e918(0x21b),'name':_0x21e918(0x216),'message':_0x21e918(0x239),'validate':_0x1acfbf=>{const _0x2530af=_0x21e918;if(!_0x1acfbf||!_0x1acfbf['trim']())return _0x2530af(0x203);return!![];}});if(!_0x38147b[_0x21e918(0x216)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x21e918(0x1dd)](_0x21e918(0x20f));try{const _0x643be3=TDX[_0x21e918(0x240)]({'site':_0xece0c8,'apiKey':_0x38147b[_0x21e918(0x216)][_0x21e918(0x1eb)](),'logLevel':_0x1a2d4d['logLevel']??LogLevel[_0x21e918(0x225)]}),_0x3bdc94=await _0x643be3[_0x21e918(0x228)][_0x21e918(0x221)]();console[_0x21e918(0x1dd)](a32_0x4d34e1[_0x21e918(0x1ee)]('✓')+_0x21e918(0x22e)+_0x3bdc94['email']+')');const _0x301e34=await isKeychainAvailable();_0x301e34?(await saveAPIKeyAsync(_0x38147b[_0x21e918(0x216)][_0x21e918(0x1eb)](),_0xece0c8,_0xc0348),console[_0x21e918(0x1dd)](a32_0x4d34e1['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console['warn'](a32_0x4d34e1[_0x21e918(0x223)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x2e7ca4[_0x21e918(0x1d9)]=_0xece0c8;}catch(_0x1d6d9c){if(_0x1d6d9c instanceof HTTPClientError&&_0x1d6d9c[_0x21e918(0x1e7)]===0x191)return printAuthError(_0x1d6d9c),0x1;return console[_0x21e918(0x20e)](a32_0x4d34e1[_0x21e918(0x202)]('✗\x20Validation\x20failed:\x20'+(_0x1d6d9c instanceof Error?_0x1d6d9c['message']:String(_0x1d6d9c)))),console[_0x21e918(0x20e)](_0x21e918(0x1f0)),0x1;}}else _0x2e7ca4[_0x40a87f]=_0x20c5e8||undefined;return saveProfileToUserConfig(_0xc0348,_0x2e7ca4),console[_0x21e918(0x1dd)](a32_0x4d34e1[_0x21e918(0x1ee)]('✓')+'\x20Profile\x20\x27'+_0xc0348+_0x21e918(0x212)+_0x40a87f+'='+(_0x20c5e8||_0x21e918(0x23f))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a32_0x111046(0x1e3);[a32_0x111046(0x1ea)]=a32_0x111046(0x1f9);[a32_0x111046(0x1e8)](_0x2a5ffd){const _0x1cf32b=a32_0x111046,{args:_0x1e6cfe}=_0x2a5ffd;if(_0x1e6cfe[_0x1cf32b(0x207)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a32_0x111046(0x236)](_0x46a6d3){const _0xa08c1e=a32_0x111046,{args:_0x4d5317,options:_0x1de286}=_0x46a6d3,_0x2b956c=_0x4d5317[0x0],_0x43a544=_0x1de286[_0xa08c1e(0x204)];cleanExpiredSessions();if(!profileExists(_0x2b956c)){console[_0xa08c1e(0x20e)](a32_0x4d34e1[_0xa08c1e(0x202)]('Profile\x20\x27'+_0x2b956c+'\x27\x20does\x20not\x20exist.')),console[_0xa08c1e(0x1dd)](_0xa08c1e(0x23b));const _0x566d9b=listProfiles();if(_0x566d9b['length']===0x0)console['log'](_0xa08c1e(0x1e0));else for(const _0x110255 of _0x566d9b){console[_0xa08c1e(0x1dd)](_0xa08c1e(0x243)+_0x110255[_0xa08c1e(0x1dc)]);}return 0x1;}if(_0x43a544){const _0x5b9a4c=a32_0x27b8a7[_0xa08c1e(0x20c)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x2b956c),console['log']('Default\x20profile\x20set\x20to:\x20'+a32_0x4d34e1[_0xa08c1e(0x1ee)](_0x2b956c)),console[_0xa08c1e(0x1dd)](a32_0x4d34e1[_0xa08c1e(0x214)]('\x0aSaved\x20to:\x20'+_0x5b9a4c)),0x0;}const _0x22a06b=getSessionID(_0x1de286[_0xa08c1e(0x21d)]);return saveSessionContext({'profile':_0x2b956c},_0x1de286[_0xa08c1e(0x21d)]),console[_0xa08c1e(0x1dd)](_0xa08c1e(0x200)+a32_0x4d34e1[_0xa08c1e(0x1ee)](_0x2b956c)+'\x20'+a32_0x4d34e1['dim'](_0xa08c1e(0x1fa)+_0x22a06b+')')),console[_0xa08c1e(0x1dd)](a32_0x4d34e1[_0xa08c1e(0x214)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2b956c+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ function a32_0x20c6(){const _0x693307=['red','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Validating\x20API\x20key...','Unknown\x20key\x20\x27','tdx:\x20profile\x20set','Session\x20profile\x20set\x20to:\x20','profile:remove','3010674ILCRZC','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Enter\x20description\x20(optional):','profile:use','email','9LkNmQV','create','name','jobs','tdx:\x20profile\x20remove','1405YXolcY','getUserInfo','validate','Failed\x20to\x20remove\x20profile:\x20','Choose\x20authentication\x20method:','apiKey','method','OAuth\x20(browser\x20login)','\x0aSaved\x20to:\x20','tdx:\x20profile\x20create','profile','Set\x20session\x20profile','database','✗\x20Validation\x20failed:\x20','split','session','length','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','text','3027860fRoHoE','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20API\x20key\x20is\x20valid\x20(User:\x20','join','confirm','execute','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','site','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','password','Profile\x20\x27','oauth','test','log','614zItURU','(cleared)','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profileName','description','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','6pIZXzM','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','yellow','apikey','20027260bHemek','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','logLevel','error','\x20API\x20key\x20saved\x20to\x20system\x20keychain','llm_agent','includes','message','\x20Profile\x20\x27','\x27\x20does\x20not\x20exist.','trim','/app/mp/ak','bold','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>','1058660ZgqclC','Default\x20profile\x20set\x20to:\x20','(session:\x20','\x27\x20requires\x20API\x20key\x20validation.','ERROR','tdx.json','Site\x20was\x20not\x20changed.','VALID_KEYS','config','Set\x20a\x20profile\x20configuration\x20value','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20-\x20','2283323JjaVyi','\x20\x20(no\x20profiles\x20found)','1267368EozFig','us01','\x0aAvailable\x20profiles:','\x27\x20created','API\x20key\x20cannot\x20be\x20empty','\x0aOperation\x20cancelled','Enter\x20profile\x20name:','dim','green','warn','profile:set','parent_segment','Create\x20a\x20new\x20profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20\x20tdx\x20--profile\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Enter\x20your\x20TD\x20API\x20key:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSetup\x20cancelled'];a32_0x20c6=function(){return _0x693307;};return a32_0x20c6();}const a32_0x7e87ea=a32_0x5235;(function(_0x5dda99,_0x4c24af){const _0xf18177=a32_0x5235,_0x26fd41=_0x5dda99();while(!![]){try{const _0x59bbdb=parseInt(_0xf18177(0x1d2))/0x1*(parseInt(_0xf18177(0x1f3))/0x2)+parseInt(_0xf18177(0x1f9))/0x3*(-parseInt(_0xf18177(0x20b))/0x4)+-parseInt(_0xf18177(0x1e5))/0x5+-parseInt(_0xf18177(0x1c8))/0x6+-parseInt(_0xf18177(0x217))/0x7+parseInt(_0xf18177(0x219))/0x8*(-parseInt(_0xf18177(0x1cd))/0x9)+parseInt(_0xf18177(0x1fd))/0xa;if(_0x59bbdb===_0x4c24af)break;else _0x26fd41['push'](_0x26fd41['shift']());}catch(_0x17bbb5){_0x26fd41['push'](_0x26fd41['shift']());}}}(a32_0x20c6,0x4c5c2));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 a32_0x39f2f0 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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}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 a32_0x569a1b from'prompts';import a32_0x111f93 from'chalk';function validateProfileName(_0x3e3775){const _0x339cc6=a32_0x5235;if(!_0x3e3775||!_0x3e3775[_0x339cc6(0x207)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x27cef8=_0x3e3775['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x339cc6(0x1f1)](_0x27cef8))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x27cef8))return'Profile\x20\x27'+_0x27cef8+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';['description']=a32_0x7e87ea(0x1ba);async[a32_0x7e87ea(0x1ea)](_0x322e0d){const _0x1db152=a32_0x7e87ea,{options:_0x2f7c70,args:_0x4e8f13}=_0x322e0d;console[_0x1db152(0x1f2)](a32_0x111f93[_0x1db152(0x209)](_0x1db152(0x1db)));let _0x4702d3;if(_0x4e8f13[_0x1db152(0x1e2)]>0x0&&_0x4e8f13[0x0]){const _0x2df811=_0x4e8f13[0x0][_0x1db152(0x207)](),_0x1a1419=validateProfileName(_0x2df811);if(_0x1a1419!==!![])return console[_0x1db152(0x200)](a32_0x111f93[_0x1db152(0x1c1)](_0x1a1419)),0x1;_0x4702d3=_0x2df811;}else{const _0x1a9fe4=await a32_0x569a1b({'type':'text','name':_0x1db152(0x1f6),'message':_0x1db152(0x1b4),'validate':validateProfileName});if(!_0x1a9fe4[_0x1db152(0x1f6)])return console['log'](_0x1db152(0x1c0)),0x1;_0x4702d3=_0x1a9fe4[_0x1db152(0x1f6)][_0x1db152(0x207)]();}const _0x41052b=await a32_0x569a1b({'type':_0x1db152(0x1e4),'name':'description','message':_0x1db152(0x1ca)}),_0x4cb5bd=_0x41052b[_0x1db152(0x1f7)]?.[_0x1db152(0x207)]()||undefined,_0x1f26da=_0x2f7c70['site']||_0x1db152(0x21a),_0x4959f9=await promptSiteSelection(_0x1f26da,_0x4702d3,'Setup\x20cancelled');if(!_0x4959f9)return 0x1;const _0x3dc2bf=resolveSite(_0x4959f9);if(isOAuthSupported(_0x3dc2bf)){const _0x2e2577=await a32_0x569a1b({'type':'select','name':_0x1db152(0x1d8),'message':_0x1db152(0x1d6),'choices':[{'title':_0x1db152(0x1d9),'value':'oauth'},{'title':'API\x20Key','value':_0x1db152(0x1fc)}]});if(!_0x2e2577[_0x1db152(0x1d8)])return console[_0x1db152(0x1f2)](_0x1db152(0x1c0)),0x1;if(_0x2e2577['method']===_0x1db152(0x1f0)){if(_0x4cb5bd){const _0x18ee01={'site':_0x3dc2bf,'description':_0x4cb5bd};saveProfileToUserConfig(_0x4702d3,_0x18ee01);}return await runOAuthLoginFlow(_0x3dc2bf,_0x4702d3,_0x2f7c70['logLevel']??LogLevel[_0x1db152(0x20f)]),0x0;}}console[_0x1db152(0x1f2)](_0x1db152(0x1f5)+_0x3dc2bf),console[_0x1db152(0x1f2)](_0x1db152(0x1e6)),console[_0x1db152(0x1f2)]('\x20\x20'+getConsoleUrl(_0x3dc2bf,_0x1db152(0x208)));const _0x49b66b=await a32_0x569a1b({'type':_0x1db152(0x1ee),'name':_0x1db152(0x1d7),'message':_0x1db152(0x1be),'validate':_0x374805=>{const _0x4883df=_0x1db152;if(!_0x374805||!_0x374805[_0x4883df(0x207)]())return _0x4883df(0x21d);return!![];}});if(!_0x49b66b['apiKey'])return console['log'](_0x1db152(0x1c0)),0x1;const _0x5aa614=_0x49b66b[_0x1db152(0x1d7)];console[_0x1db152(0x1f2)](_0x1db152(0x1c3));try{const _0x188022=TDX['create']({'site':_0x3dc2bf,'apiKey':_0x5aa614[_0x1db152(0x207)](),'logLevel':_0x2f7c70[_0x1db152(0x1ff)]??LogLevel[_0x1db152(0x20f)]}),_0x138a35=await _0x188022[_0x1db152(0x1d0)][_0x1db152(0x1d3)]();console[_0x1db152(0x1f2)](a32_0x111f93[_0x1db152(0x1b6)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x138a35[_0x1db152(0x1cc)]+')');const _0x499fa0=await isKeychainAvailable();_0x499fa0?(await saveAPIKeyAsync(_0x5aa614['trim'](),_0x3dc2bf,_0x4702d3),console[_0x1db152(0x1f2)](a32_0x111f93[_0x1db152(0x1b6)]('✓')+_0x1db152(0x1fa)+_0x4702d3+')')):(console[_0x1db152(0x1b7)](a32_0x111f93[_0x1db152(0x1fb)](_0x1db152(0x1c2))),console[_0x1db152(0x1b7)](a32_0x111f93[_0x1db152(0x1fb)](_0x1db152(0x1c9))));const _0x2c9900={'site':_0x3dc2bf,..._0x4cb5bd&&{'description':_0x4cb5bd}};return saveProfileToUserConfig(_0x4702d3,_0x2c9900),console[_0x1db152(0x1f2)](a32_0x111f93[_0x1db152(0x1b6)]('✓')+_0x1db152(0x205)+_0x4702d3+_0x1db152(0x21c)),console[_0x1db152(0x1f2)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x1db152(0x1f2)](_0x1db152(0x1bc)+_0x4702d3+_0x1db152(0x1e3)),console[_0x1db152(0x1f2)](_0x1db152(0x1bc)+_0x4702d3+_0x1db152(0x1eb)),0x0;}catch(_0x1417ea){if(_0x1417ea instanceof HTTPClientError&&_0x1417ea['status']===0x191)return printAuthError(_0x1417ea),0x1;return console[_0x1db152(0x200)](a32_0x111f93[_0x1db152(0x1c1)](_0x1db152(0x1df)+(_0x1417ea instanceof Error?_0x1417ea[_0x1db152(0x204)]:String(_0x1417ea)))),console[_0x1db152(0x200)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a32_0x5235(_0x5d0cb3,_0xb4a0bb){_0x5d0cb3=_0x5d0cb3-0x1b3;const _0x20c61e=a32_0x20c6();let _0x523581=_0x20c61e[_0x5d0cb3];return _0x523581;}export class ProfileRemoveCommand extends BaseCommand{[a32_0x7e87ea(0x1cf)]=a32_0x7e87ea(0x1c7);[a32_0x7e87ea(0x1f7)]='Remove\x20a\x20profile';[a32_0x7e87ea(0x1d4)](_0x462549){const _0x3f5506=a32_0x7e87ea,{args:_0x113fd8}=_0x462549;if(_0x113fd8[_0x3f5506(0x1e2)]===0x0)return _0x3f5506(0x1bd);return undefined;}async['execute'](_0x1f995a){const _0x438e22=a32_0x7e87ea,{args:_0x19c073}=_0x1f995a,_0x21a21b=_0x19c073[0x0];console['log'](a32_0x111f93['bold'](_0x438e22(0x1d1)));if(!profileExists(_0x21a21b)){console[_0x438e22(0x200)](a32_0x111f93[_0x438e22(0x1c1)]('Profile\x20\x27'+_0x21a21b+_0x438e22(0x206))),console[_0x438e22(0x1f2)](_0x438e22(0x21b));const _0xaf3d46=listProfiles();if(_0xaf3d46[_0x438e22(0x1e2)]===0x0)console[_0x438e22(0x1f2)](_0x438e22(0x218));else for(const _0x4fbd7d of _0xaf3d46){console['log']('\x20\x20-\x20'+_0x4fbd7d[_0x438e22(0x1cf)]);}return 0x1;}const _0x57fdf7=await a32_0x569a1b({'type':_0x438e22(0x1e9),'name':_0x438e22(0x1e9),'message':_0x438e22(0x215)+_0x21a21b+'\x27?','initial':![]});if(!_0x57fdf7[_0x438e22(0x1e9)])return console[_0x438e22(0x1f2)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x21a21b),console[_0x438e22(0x1f2)](a32_0x111f93[_0x438e22(0x1b6)]('✓')+'\x20Profile\x20\x27'+_0x21a21b+'\x27\x20removed\x20from\x20configuration');}catch(_0x6dd9b4){return console['error'](a32_0x111f93[_0x438e22(0x1c1)](_0x438e22(0x1d5)+(_0x6dd9b4 instanceof Error?_0x6dd9b4['message']:String(_0x6dd9b4)))),0x1;}const _0x1dedb6=await isKeychainAvailable();if(_0x1dedb6){const _0x525242=await deleteKeychainAPIKey(_0x21a21b);_0x525242&&console[_0x438e22(0x1f2)](a32_0x111f93[_0x438e22(0x1b6)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a32_0x7e87ea(0x1cf)]=a32_0x7e87ea(0x1b8);[a32_0x7e87ea(0x1f7)]=a32_0x7e87ea(0x214);static ['VALID_KEYS']=[a32_0x7e87ea(0x1ec),a32_0x7e87ea(0x1de),a32_0x7e87ea(0x1b9),'llm_project',a32_0x7e87ea(0x202),a32_0x7e87ea(0x1f7)];[a32_0x7e87ea(0x1d4)](_0x1556d7){const _0x4df1ec=a32_0x7e87ea,{args:_0xf96325,options:_0x46167e}=_0x1556d7,_0x20a264=_0x46167e[_0x4df1ec(0x1dc)]||getActiveProfile();if(!_0x20a264)return _0x4df1ec(0x20a);if(_0xf96325['length']===0x0)return _0x4df1ec(0x1ed)+ProfileSetCommand['VALID_KEYS'][_0x4df1ec(0x1e8)](',\x20');const _0x3d5c20=_0xf96325[0x0];if(!_0x3d5c20[_0x4df1ec(0x203)]('='))return _0x4df1ec(0x1f8)+ProfileSetCommand[_0x4df1ec(0x212)][_0x4df1ec(0x1e8)](',\x20');const [_0x3fc819]=_0x3d5c20['split']('=',0x2);if(!ProfileSetCommand[_0x4df1ec(0x212)]['includes'](_0x3fc819))return _0x4df1ec(0x1c4)+_0x3fc819+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4df1ec(0x212)][_0x4df1ec(0x1e8)](',\x20');return undefined;}async[a32_0x7e87ea(0x1ea)](_0x254da7){const _0x47d31a=a32_0x7e87ea,{args:_0x3b062c,options:_0xc52454}=_0x254da7,_0x5759de=_0xc52454[_0x47d31a(0x1dc)]||getActiveProfile(),[_0x37de85,..._0x584793]=_0x3b062c[0x0][_0x47d31a(0x1e0)]('='),_0x3e07d6=_0x584793[_0x47d31a(0x1e8)]('=');console[_0x47d31a(0x1f2)](a32_0x111f93[_0x47d31a(0x209)](_0x47d31a(0x1c5)));if(!profileExists(_0x5759de)){const _0x53deef=await a32_0x569a1b({'type':_0x47d31a(0x1e9),'name':_0x47d31a(0x1ce),'message':_0x47d31a(0x1ef)+_0x5759de+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x53deef['create'])return console['log']('Operation\x20cancelled'),0x1;}const _0x552044=loadProfile(_0x5759de),_0xf38136=_0x552044?.[_0x47d31a(0x213)]||{};if(_0x37de85===_0x47d31a(0x1ec)){const _0x2771d1=resolveSite(_0x3e07d6);console[_0x47d31a(0x1f2)]('Changing\x20site\x20to\x20\x27'+_0x2771d1+_0x47d31a(0x20e)),console[_0x47d31a(0x1f2)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x2771d1,_0x47d31a(0x208)));const _0x169cfa=await a32_0x569a1b({'type':_0x47d31a(0x1ee),'name':_0x47d31a(0x1d7),'message':_0x47d31a(0x1bf),'validate':_0x5da1e7=>{const _0x223641=_0x47d31a;if(!_0x5da1e7||!_0x5da1e7[_0x223641(0x207)]())return _0x223641(0x21d);return!![];}});if(!_0x169cfa[_0x47d31a(0x1d7)])return console['log'](_0x47d31a(0x1b3)),0x1;console[_0x47d31a(0x1f2)](_0x47d31a(0x1c3));try{const _0x2d0711=TDX[_0x47d31a(0x1ce)]({'site':_0x2771d1,'apiKey':_0x169cfa[_0x47d31a(0x1d7)][_0x47d31a(0x207)](),'logLevel':_0xc52454[_0x47d31a(0x1ff)]??LogLevel[_0x47d31a(0x20f)]}),_0x449ea6=await _0x2d0711[_0x47d31a(0x1d0)][_0x47d31a(0x1d3)]();console[_0x47d31a(0x1f2)](a32_0x111f93[_0x47d31a(0x1b6)]('✓')+_0x47d31a(0x1e7)+_0x449ea6[_0x47d31a(0x1cc)]+')');const _0x44de87=await isKeychainAvailable();_0x44de87?(await saveAPIKeyAsync(_0x169cfa['apiKey'][_0x47d31a(0x207)](),_0x2771d1,_0x5759de),console[_0x47d31a(0x1f2)](a32_0x111f93['green']('✓')+_0x47d31a(0x201))):console[_0x47d31a(0x1b7)](a32_0x111f93[_0x47d31a(0x1fb)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0xf38136[_0x47d31a(0x1ec)]=_0x2771d1;}catch(_0x1d543f){if(_0x1d543f instanceof HTTPClientError&&_0x1d543f['status']===0x191)return printAuthError(_0x1d543f),0x1;return console[_0x47d31a(0x200)](a32_0x111f93[_0x47d31a(0x1c1)](_0x47d31a(0x1df)+(_0x1d543f instanceof Error?_0x1d543f['message']:String(_0x1d543f)))),console[_0x47d31a(0x200)](_0x47d31a(0x211)),0x1;}}else _0xf38136[_0x37de85]=_0x3e07d6||undefined;return saveProfileToUserConfig(_0x5759de,_0xf38136),console[_0x47d31a(0x1f2)](a32_0x111f93['green']('✓')+'\x20Profile\x20\x27'+_0x5759de+'\x27\x20updated:\x20'+_0x37de85+'='+(_0x3e07d6||_0x47d31a(0x1f4))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a32_0x7e87ea(0x1cf)]=a32_0x7e87ea(0x1cb);[a32_0x7e87ea(0x1f7)]=a32_0x7e87ea(0x1dd);['validate'](_0x221b55){const _0x43e74a=a32_0x7e87ea,{args:_0x426b50}=_0x221b55;if(_0x426b50[_0x43e74a(0x1e2)]===0x0)return _0x43e74a(0x1fe);return undefined;}async[a32_0x7e87ea(0x1ea)](_0x59d0dd){const _0x532c09=a32_0x7e87ea,{args:_0x1f54ae,options:_0x14a31f}=_0x59d0dd,_0x421a55=_0x1f54ae[0x0],_0x1e3da3=_0x14a31f['default'];cleanExpiredSessions();if(!profileExists(_0x421a55)){console['error'](a32_0x111f93[_0x532c09(0x1c1)](_0x532c09(0x1ef)+_0x421a55+_0x532c09(0x206))),console[_0x532c09(0x1f2)](_0x532c09(0x21b));const _0x53dbae=listProfiles();if(_0x53dbae[_0x532c09(0x1e2)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x4bdb52 of _0x53dbae){console[_0x532c09(0x1f2)](_0x532c09(0x216)+_0x4bdb52[_0x532c09(0x1cf)]);}return 0x1;}if(_0x1e3da3){const _0x1f4845=a32_0x39f2f0[_0x532c09(0x1e8)](getConfigDir(),_0x532c09(0x210));return saveActiveProfileToUserConfig(_0x421a55),console[_0x532c09(0x1f2)](_0x532c09(0x20c)+a32_0x111f93[_0x532c09(0x1b6)](_0x421a55)),console[_0x532c09(0x1f2)](a32_0x111f93[_0x532c09(0x1b5)](_0x532c09(0x1da)+_0x1f4845)),0x0;}const _0x458273=getSessionID(_0x14a31f['session']);return saveSessionContext({'profile':_0x421a55},_0x14a31f[_0x532c09(0x1e1)]),console['log'](_0x532c09(0x1c6)+a32_0x111f93[_0x532c09(0x1b6)](_0x421a55)+'\x20'+a32_0x111f93[_0x532c09(0x1b5)](_0x532c09(0x20d)+_0x458273+')')),console[_0x532c09(0x1f2)](a32_0x111f93[_0x532c09(0x1b5)](_0x532c09(0x1bb)+_0x421a55+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a33_0x40929d=a33_0x4ab6;(function(_0x16d4dd,_0x18d9d2){const _0x18acfc=a33_0x4ab6,_0x2e638a=_0x16d4dd();while(!![]){try{const _0x4903da=parseInt(_0x18acfc(0x17c))/0x1*(parseInt(_0x18acfc(0x183))/0x2)+-parseInt(_0x18acfc(0x177))/0x3*(-parseInt(_0x18acfc(0x185))/0x4)+parseInt(_0x18acfc(0x189))/0x5*(-parseInt(_0x18acfc(0x188))/0x6)+-parseInt(_0x18acfc(0x174))/0x7+-parseInt(_0x18acfc(0x17b))/0x8+-parseInt(_0x18acfc(0x17d))/0x9*(-parseInt(_0x18acfc(0x18b))/0xa)+-parseInt(_0x18acfc(0x17a))/0xb*(-parseInt(_0x18acfc(0x187))/0xc);if(_0x4903da===_0x18d9d2)break;else _0x2e638a['push'](_0x2e638a['shift']());}catch(_0x2e12e0){_0x2e638a['push'](_0x2e638a['shift']());}}}(a33_0x3236,0x4d79d));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a33_0x3236(){const _0x4bd37f=['description','site','green','👤\x20','message','1525314WjdwtW','\x20\x20Global:\x20~/.config/tdx/tdx.json','List\x20all\x20available\x20profiles','135hvTSEh','log','dim','4482544MewxEf','870448oupHPr','1EYJlKC','184500hcmNcg','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','Error:\x20','scope','execute','209666HvAvhZ','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','12368tGFwgG','map','12dRzTjb','17496bPLgXv','540tjzISf','name','150fmswPG','config','length'];a33_0x3236=function(){return _0x4bd37f;};return a33_0x3236();}function a33_0x4ab6(_0x1b0229,_0x20d2b5){_0x1b0229=_0x1b0229-0x171;const _0x32365a=a33_0x3236();let _0x4ab641=_0x32365a[_0x1b0229];return _0x4ab641;}import a33_0x2c0ca3 from'chalk';export class ProfilesCommand extends BaseCommand{[a33_0x40929d(0x18a)]=a33_0x40929d(0x17f);['description']=a33_0x40929d(0x176);async[a33_0x40929d(0x182)](_0x20f324){const _0x5cfa29=a33_0x40929d,{options:_0x1e205b}=_0x20f324;try{const _0x4a4e2b=listProfiles(),_0x2c9aec=getActiveProfile();if(_0x4a4e2b[_0x5cfa29(0x18d)]===0x0)return console[_0x5cfa29(0x178)](_0x5cfa29(0x17e)),console[_0x5cfa29(0x178)](_0x5cfa29(0x184)),console[_0x5cfa29(0x178)](_0x5cfa29(0x175)),0x0;const _0x3c4c70=_0x4a4e2b[_0x5cfa29(0x186)](_0x269a21=>{const _0x5eb570=_0x5cfa29,_0x424515=_0x269a21[_0x5eb570(0x18a)]===_0x2c9aec,_0x12b06f=getProfileParams(_0x269a21[_0x5eb570(0x18c)]);return{'name':_0x269a21[_0x5eb570(0x18a)],'active':_0x424515,'scope':_0x269a21[_0x5eb570(0x181)],'description':_0x269a21[_0x5eb570(0x18c)][_0x5eb570(0x18e)]||'','params':_0x12b06f};});if(isStructuredFormat(_0x1e205b))await handleSDKOutput(_0x3c4c70,_0x1e205b);else for(const _0x10a0a1 of _0x4a4e2b){const _0x48fb10=_0x10a0a1[_0x5cfa29(0x18a)]===_0x2c9aec?a33_0x2c0ca3[_0x5cfa29(0x171)]('\x20✓'):'',_0x5dfbc3=_0x10a0a1[_0x5cfa29(0x18c)][_0x5cfa29(0x18f)]?a33_0x2c0ca3[_0x5cfa29(0x179)]('\x20'+_0x10a0a1[_0x5cfa29(0x18c)][_0x5cfa29(0x18f)]):'',_0x65316d=_0x10a0a1[_0x5cfa29(0x18c)][_0x5cfa29(0x18e)]?a33_0x2c0ca3[_0x5cfa29(0x179)]('\x20\x20'+_0x10a0a1['config'][_0x5cfa29(0x18e)]):'';console['log'](_0x5cfa29(0x172)+_0x10a0a1[_0x5cfa29(0x18a)]+_0x48fb10+_0x5dfbc3+_0x65316d);}return 0x0;}catch(_0x19005f){return _0x19005f instanceof Error&&console['error'](_0x5cfa29(0x180)+_0x19005f[_0x5cfa29(0x173)]),0x1;}}}
1
+ const a33_0x348c90=a33_0x2945;(function(_0x4cc512,_0x58fdbd){const _0x31d369=a33_0x2945,_0x34f950=_0x4cc512();while(!![]){try{const _0x36fa7c=parseInt(_0x31d369(0xfd))/0x1+-parseInt(_0x31d369(0x105))/0x2*(-parseInt(_0x31d369(0xf8))/0x3)+-parseInt(_0x31d369(0x100))/0x4*(parseInt(_0x31d369(0x102))/0x5)+-parseInt(_0x31d369(0xf7))/0x6+-parseInt(_0x31d369(0xf9))/0x7*(-parseInt(_0x31d369(0x10a))/0x8)+parseInt(_0x31d369(0x103))/0x9*(parseInt(_0x31d369(0x108))/0xa)+-parseInt(_0x31d369(0xfc))/0xb;if(_0x36fa7c===_0x58fdbd)break;else _0x34f950['push'](_0x34f950['shift']());}catch(_0x394895){_0x34f950['push'](_0x34f950['shift']());}}}(a33_0x5cf6,0x570db));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a33_0x5cf6(){const _0xac92a5=['1334842ZwrxmY','execute','dim','4521570PvzlNS','log','8qAUnHy','message','name','List\x20all\x20available\x20profiles','Error:\x20','👤\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','1757814XoapHj','3myTPbn','1317218yYSVvs','map','site','3409395Iaemde','361420ktkSsB','config','error','596pOCOPr','length','23815UkaNVR','9HUvDQq','green'];a33_0x5cf6=function(){return _0xac92a5;};return a33_0x5cf6();}function a33_0x2945(_0x11edf0,_0x320975){_0x11edf0=_0x11edf0-0xf1;const _0x5cf626=a33_0x5cf6();let _0x294559=_0x5cf626[_0x11edf0];return _0x294559;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a33_0xc0e616 from'chalk';export class ProfilesCommand extends BaseCommand{[a33_0x348c90(0xf1)]='profiles';[a33_0x348c90(0xf6)]=a33_0x348c90(0xf2);async[a33_0x348c90(0x106)](_0x1c49ce){const _0x32622b=a33_0x348c90,{options:_0x4908fd}=_0x1c49ce;try{const _0x31e8df=listProfiles(),_0x476cf3=getActiveProfile();if(_0x31e8df[_0x32622b(0x101)]===0x0)return console['log'](_0x32622b(0xf5)),console[_0x32622b(0x109)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x3e8a6e=_0x31e8df[_0x32622b(0xfa)](_0x3fc8c7=>{const _0x16a669=_0x32622b,_0x31df04=_0x3fc8c7[_0x16a669(0xf1)]===_0x476cf3,_0x29e856=getProfileParams(_0x3fc8c7[_0x16a669(0xfe)]);return{'name':_0x3fc8c7[_0x16a669(0xf1)],'active':_0x31df04,'scope':_0x3fc8c7['scope'],'description':_0x3fc8c7[_0x16a669(0xfe)]['description']||'','params':_0x29e856};});if(isStructuredFormat(_0x4908fd))await handleSDKOutput(_0x3e8a6e,_0x4908fd);else for(const _0x1935e9 of _0x31e8df){const _0x1888ef=_0x1935e9['name']===_0x476cf3?a33_0xc0e616[_0x32622b(0x104)]('\x20✓'):'',_0xa14a4b=_0x1935e9['config'][_0x32622b(0xfb)]?a33_0xc0e616[_0x32622b(0x107)]('\x20'+_0x1935e9[_0x32622b(0xfe)][_0x32622b(0xfb)]):'',_0x26637e=_0x1935e9[_0x32622b(0xfe)][_0x32622b(0xf6)]?a33_0xc0e616['dim']('\x20\x20'+_0x1935e9[_0x32622b(0xfe)][_0x32622b(0xf6)]):'';console[_0x32622b(0x109)](_0x32622b(0xf4)+_0x1935e9[_0x32622b(0xf1)]+_0x1888ef+_0xa14a4b+_0x26637e);}return 0x0;}catch(_0x26099b){return _0x26099b instanceof Error&&console[_0x32622b(0xff)](_0x32622b(0xf3)+_0x26099b[_0x32622b(0x10b)]),0x1;}}}