@treasuredata/tdx 0.24.0 → 0.25.1

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 (175) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.d.ts +14 -3
  13. package/dist/commands/chat-command.d.ts.map +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/chat-command.js.map +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/job-command.js +1 -1
  25. package/dist/commands/journey-command.js +1 -1
  26. package/dist/commands/journey-validate-command.js +1 -1
  27. package/dist/commands/llm-command.js +1 -1
  28. package/dist/commands/mcp-command.js +1 -1
  29. package/dist/commands/parent-segment-command.js +1 -1
  30. package/dist/commands/profile-command.js +1 -1
  31. package/dist/commands/profiles-command.js +1 -1
  32. package/dist/commands/query-command.js +1 -1
  33. package/dist/commands/schedule-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segment-validate-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/status-command.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/unset-command.js +1 -1
  47. package/dist/commands/use-command.js +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/command-output.js +1 -1
  52. package/dist/core/config.js +1 -1
  53. package/dist/core/connection-cache.js +1 -1
  54. package/dist/core/constants.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/core/version.js +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/mcp/server.js +1 -1
  65. package/dist/mcp/tools/index.js +1 -1
  66. package/dist/mcp/tools/tdx-run.js +1 -1
  67. package/dist/mcp/tools/tdx-search.js +1 -1
  68. package/dist/mcp/utils.js +1 -1
  69. package/dist/proxy/claude-usage-tracker.js +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/sse-usage-parser.js +1 -1
  72. package/dist/sdk/agent/agent-config.js +1 -1
  73. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  74. package/dist/sdk/agent/agent-yaml.js +1 -1
  75. package/dist/sdk/agent/test/evaluator.js +1 -1
  76. package/dist/sdk/agent/test/executor.js +1 -1
  77. package/dist/sdk/agent/test/index.js +1 -1
  78. package/dist/sdk/agent/test/output.js +1 -1
  79. package/dist/sdk/agent/test/parser.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/endpoints.js +1 -1
  83. package/dist/sdk/client/engage-api-client.js +1 -1
  84. package/dist/sdk/client/http-client.js +1 -1
  85. package/dist/sdk/client/llm-api-client.js +1 -1
  86. package/dist/sdk/client/rate-limiter.js +1 -1
  87. package/dist/sdk/client/td-api-client.js +1 -1
  88. package/dist/sdk/client/trino-api-client.js +1 -1
  89. package/dist/sdk/client/workflow-client.js +1 -1
  90. package/dist/sdk/connection-validator.js +1 -1
  91. package/dist/sdk/connection.js +1 -1
  92. package/dist/sdk/engage.js +1 -1
  93. package/dist/sdk/errors.js +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/io/index.js +1 -1
  96. package/dist/sdk/io/node-filesystem.js +1 -1
  97. package/dist/sdk/job.js +1 -1
  98. package/dist/sdk/journey.js +1 -1
  99. package/dist/sdk/llm/chat-cache.js +1 -1
  100. package/dist/sdk/llm/index.d.ts.map +1 -1
  101. package/dist/sdk/llm/index.js +1 -1
  102. package/dist/sdk/llm/index.js.map +1 -1
  103. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  104. package/dist/sdk/llm/model-factors.d.ts +4 -4
  105. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  106. package/dist/sdk/llm/model-factors.js +1 -1
  107. package/dist/sdk/llm/model-factors.js.map +1 -1
  108. package/dist/sdk/query/index.js +1 -1
  109. package/dist/sdk/query/sql-parser.js +1 -1
  110. package/dist/sdk/schedule.js +1 -1
  111. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  112. package/dist/sdk/segment/fields-display.js +1 -1
  113. package/dist/sdk/segment/file-discovery.js +1 -1
  114. package/dist/sdk/segment/journey-utils.js +1 -1
  115. package/dist/sdk/segment/journey-yaml.js +1 -1
  116. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  117. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/pull-workflow.js +1 -1
  119. package/dist/sdk/segment/push-workflow.js +1 -1
  120. package/dist/sdk/segment/resolution-context.js +1 -1
  121. package/dist/sdk/segment/segment-path-parser.js +1 -1
  122. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  123. package/dist/sdk/segment/target-resolution.js +1 -1
  124. package/dist/sdk/segment/tdx-config.js +1 -1
  125. package/dist/sdk/segment/validate-files.js +1 -1
  126. package/dist/sdk/segment/yaml-validator.js +1 -1
  127. package/dist/sdk/segment.js +1 -1
  128. package/dist/sdk/types/index.js +1 -1
  129. package/dist/sdk/types/llm.d.ts +1 -0
  130. package/dist/sdk/types/llm.d.ts.map +1 -1
  131. package/dist/sdk/types/progress.js +1 -1
  132. package/dist/sdk/user.js +1 -1
  133. package/dist/sdk/util/format-detector.js +1 -1
  134. package/dist/sdk/util/formatters.js +1 -1
  135. package/dist/sdk/util/index.js +1 -1
  136. package/dist/sdk/util/tree-formatter.js +1 -1
  137. package/dist/sdk/workflow/archive-validation.js +1 -1
  138. package/dist/sdk/workflow/clone-workflow.js +1 -1
  139. package/dist/sdk/workflow/index.js +1 -1
  140. package/dist/sdk/workflow/pull-workflow.js +1 -1
  141. package/dist/sdk/workflow/push-workflow.js +1 -1
  142. package/dist/sdk/workflow/tdx-config.js +1 -1
  143. package/dist/sdk/workflow/workflow-utils.js +1 -1
  144. package/dist/test-utils/command-runner.js +1 -1
  145. package/dist/test-utils/factories.js +1 -1
  146. package/dist/test-utils/fixtures.js +1 -1
  147. package/dist/test-utils/http-mock.js +1 -1
  148. package/dist/test-utils/index.js +1 -1
  149. package/dist/utils/async.js +1 -1
  150. package/dist/utils/colors.js +1 -1
  151. package/dist/utils/diff.js +1 -1
  152. package/dist/utils/file-permissions.js +1 -1
  153. package/dist/utils/global-cache.js +1 -1
  154. package/dist/utils/json-loader.js +1 -1
  155. package/dist/utils/local-cache.js +1 -1
  156. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  157. package/dist/utils/logger/formatters/index.js +1 -1
  158. package/dist/utils/logger/handlers/console-handler.js +1 -1
  159. package/dist/utils/logger/handlers/file-handler.js +1 -1
  160. package/dist/utils/logger/handlers/index.js +1 -1
  161. package/dist/utils/logger/handlers/null-handler.js +1 -1
  162. package/dist/utils/logger/index.js +1 -1
  163. package/dist/utils/logger/logger.js +1 -1
  164. package/dist/utils/logger/types.js +1 -1
  165. package/dist/utils/option-validation.js +1 -1
  166. package/dist/utils/port.js +1 -1
  167. package/dist/utils/process.js +1 -1
  168. package/dist/utils/prompt.js +1 -1
  169. package/dist/utils/spinner.js +1 -1
  170. package/dist/utils/sse-parser.js +1 -1
  171. package/dist/utils/string-utils.js +1 -1
  172. package/dist/utils/table-ref-parser.js +1 -1
  173. package/dist/utils/tdx-logger.js +1 -1
  174. package/dist/utils/version-check.js +1 -1
  175. package/package.json +1 -1
@@ -1 +1 @@
1
- const a22_0x46b216=a22_0xd58f;(function(_0xddd773,_0x5f0453){const _0x2142e9=a22_0xd58f,_0x1b3907=_0xddd773();while(!![]){try{const _0x5a709e=-parseInt(_0x2142e9(0x1e9))/0x1*(parseInt(_0x2142e9(0x2e5))/0x2)+parseInt(_0x2142e9(0x2cb))/0x3+parseInt(_0x2142e9(0x21e))/0x4*(-parseInt(_0x2142e9(0x207))/0x5)+-parseInt(_0x2142e9(0x2d5))/0x6+-parseInt(_0x2142e9(0x26d))/0x7*(parseInt(_0x2142e9(0x30c))/0x8)+-parseInt(_0x2142e9(0x2c2))/0x9*(-parseInt(_0x2142e9(0x2e4))/0xa)+-parseInt(_0x2142e9(0x238))/0xb*(-parseInt(_0x2142e9(0x2c4))/0xc);if(_0x5a709e===_0x5f0453)break;else _0x1b3907['push'](_0x1b3907['shift']());}catch(_0x47625a){_0x1b3907['push'](_0x1b3907['shift']());}}}(a22_0x328c,0xe4ad3));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x487f45 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a22_0x328c(){const _0x3e16f0=['all','segment:parent:push','addAttributes','query','List\x20available\x20fields\x20for\x20segmentation','yes','✘\x20Failed\x20to\x20rename\x20directory:\x20','sort','Listing\x20fields\x20for\x20\x27','pushParentYaml','segment:parent:fields','toLocaleString','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','rowCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','createParent','\x20--attribute\x20\x22','Fetching\x20SQL\x20for\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Found\x20YAML\x20file:\x20','jsonl','map','customerPercent','toLowerCase','match','description','segment:parent:sql','Validating\x20configuration...','data','Master\x20+\x20Attributes','customers','To\x20cancel:','Error:\x20Parent\x20segment\x20name\x20is\x20required','allValid','Apply\x20changes\x20to\x20\x27','jobId','\x0aChanges\x20to\x20apply\x20to\x20\x27','audienceId','Enriched:','start','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20--interval\x20','displayMasterInfo','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','column','segment:parent:validate','timezone','Database:\x20','interval','%)\x20','Options\x20(one\x20required):\x0a','\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','stop','dirname','getParentFull','SQL\x20query:\x0a','Fetching\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','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\x20No\x20sample\x20data\x20available','segment:parent:desc','customerGroup','Pattern:\x20','red','\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','execute','string','segment:parent:list','displayPreviewResults','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','run','\x20--behavior\x20\x22','joinKey','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','displayAttributesStats','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment','162xRaMmZ','👥\x20','38992476gizDRD','\x20[Job\x20ID:\x20','✔\x20No\x20changes\x20-\x20\x27','scheduleOption','Fetching\x20customers\x20schema...','coveragePercent','\x20Configuration\x20is\x20valid','1059900ryARlF','cyan','use','\x20\x20Database:\x20','\x20=\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20rows\x20','`\x20to\x20download\x20the\x20configuration\x20first','sampleData','listFields','10370286jrhNAa','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','table','Schema\x20saved\x20to\x20','segment:parent:show','darwin','displayValidateResults','\x27\x20is\x20already\x20up\x20to\x20date','displaySummary','reduce','Join:','Get\x20SQL\x20query\x20for\x20parent\x20segment','Events:','Overwrite\x20\x27','786340WqjWdn','406gWvspj','Columns:','Analyzing\x20changes...','filter','List\x20parent\x20segments','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','segment:parent:update','\x22,\x20\x22type\x22:\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','listParents','matchedCount','getBehaviorNames','double','column_type','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','trim','No\x20parent\x20segments\x20match\x20pattern:\x20','information_schema','length','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20tdx\x20wf\x20attempt\x20','addAttributesFile','setJobId','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','errors','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','behaviors','\x20rows)','Updated','pullParentYaml','Site:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','scheduleType','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Creating','addBehaviorsFile','\x0aNew\x20parent\x20segment\x20\x27','Master\x20Table','4488fMtRyv','label','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','message','\x0aChanges\x20to\x20\x27','behaviorsFile','status','FINISHED','Created','\x0aNo\x20sample\x20data\x20available','database','in\x20','limit','schemaValid','displayColumns','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','segment:parent:preview','ignore','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','platform','replace','Updating','formatSchemaJson','\x0a\x20\x20]\x0a}\x0a','Options:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error:\x20File\x20not\x20found:\x20','Attributes','.customers)','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x0aUsage:\x20tdx\x20ps\x20preview\x20','log','type','\x20behaviors','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Fetching\x20sample\x20data...','columns','/attempt/','processedRows','master','YAML\x20file:\x20','segment:parent:pull','displayPreviewHints','477GXsCvJ','Errors:','\x20--enriched','join','Preview:','Error\x20reading\x20file:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Parent\x20segment:\x20','segment:parent:run','Creating\x20parent\x20segment\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:create','\x27\x20is\x20up\x20to\x20date','/\x20→\x20','✔\x20Query\x20completed:\x20Processed\x20','utf-8','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayBehaviorsStats','yellow','enriched','\x20\x20\x20\x20-\x20','Source:','Error:\x20--database\x20and\x20--table\x20are\x20required','.yml','test','output','Behaviors','toFixed','/\x20and\x20','behavior','7595WTRHnU','Customers:','workflowSessionId','\x20parent\x20segment\x20\x27','parentSegment','Master:','attributes','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','varchar','\x0aError:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','localeCompare','Resolving\x20parent\x20segment\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','\x0a✔\x20Workflow\x20started','isDirectory','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','runParent','Join\x20on:','workflowAttemptId','Error\x20parsing\x20YAML:\x20','resolveParentId','endsWith','4108XbjSkF','\x20field','\x27...','getOutputDatabaseName','text','population','verbose','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Create\x20parent\x20segment\x20\x27','push','name','repeat','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Attribute:','/sessions/','totalEvents','Fetching\x20behavior\x20list...','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','validateParentYaml','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','No\x20parent\x20segments\x20found','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','✔\x20Renamed\x20directory\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','green','11NeZgil','.yaml','Error:','behavior_','displaySampleData','json','attribute','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x27\x20and\x20run\x20workflow?','keys','Available\x20behaviors:','attributesFile','Table:\x20','unref','Aborted.','✔\x20Found\x20','parent_segment','\x20Context\x20set:\x20','Rows:','/\x20directory.\x0a','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','collectSchema','open','tdx\x20segment\x20parent\x20preview\x20','\x0a\x20\x20\x20\x20}','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','dim','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','format','Available\x20attributes:','\x20--attribute\x20\x22<name>\x22','site','stats','Options:\x0a','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','getParentSQL','bold','Validate:','/app/workflows/','addBehaviors','customersWithEvents','schemaError','Output\x20Database:','\x20Opening\x20','\x0a⚠️\x20\x20Both\x20','Coverage:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','/app/dw/parentSegments/','previewParentYaml','customerGroupFile','8687CjEmzY','apply','foreignKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','error','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a'];a22_0x328c=function(){return _0x3e16f0;};return a22_0x328c();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x3237f9 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='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a22_0x46b216(0x248);function openBrowser(_0x54ed21){const _0x1d3910=a22_0x46b216,_0x2f7135=process[_0x1d3910(0x31f)],_0x5f1f75=_0x2f7135===_0x1d3910(0x2db)?_0x1d3910(0x24e):_0x2f7135==='win32'?_0x1d3910(0x29a):'xdg-open';spawn(_0x5f1f75,[_0x54ed21],{'detached':!![],'stdio':_0x1d3910(0x31d)})[_0x1d3910(0x245)]();}function migrateLegacyDirectory(){const _0x57b9cd=a22_0x46b216;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x86c9a8=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x86c9a8[_0x57b9cd(0x216)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x57b9cd(0x271)](a22_0x3237f9['yellow'](_0x57b9cd(0x266)+LEGACY_PARENT_SEGMENT_DIR+_0x57b9cd(0x205)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console['error'](a22_0x3237f9[_0x57b9cd(0x253)](_0x57b9cd(0x217)+LEGACY_PARENT_SEGMENT_DIR+_0x57b9cd(0x24b))),![];console[_0x57b9cd(0x271)](a22_0x3237f9[_0x57b9cd(0x1fb)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x57b9cd(0x1f6)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x57b9cd(0x271)](a22_0x3237f9['green'](_0x57b9cd(0x235)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x264f7e){const _0x25eadc=_0x264f7e instanceof Error?_0x264f7e[_0x57b9cd(0x30f)]:String(_0x264f7e);return console[_0x57b9cd(0x271)](a22_0x3237f9['red'](_0x57b9cd(0x279)+_0x25eadc+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x46b216(0x2bb)](_0x48a010){const _0x406e81=a22_0x46b216;return migrateLegacyDirectory(),super[_0x406e81(0x2bb)](_0x48a010);}}function resolveYamlFile(_0x5ce5e2){const _0x3628e1=a22_0x46b216;if(_0x5ce5e2[_0x3628e1(0x21d)](_0x3628e1(0x200))||_0x5ce5e2[_0x3628e1(0x21d)](_0x3628e1(0x239)))return _0x5ce5e2;return a22_0x487f45[_0x3628e1(0x1ec)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5ce5e2)+_0x3628e1(0x200));}function formatProgressMessage(_0x138aaa){const _0x96c1cf=a22_0x46b216,_0x4bf42d=_0x138aaa[_0x96c1cf(0x28b)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4bf42d){const [,_0x28b0d9,_0x49d883,_0x12f883='']=_0x4bf42d;return a22_0x3237f9[_0x96c1cf(0x253)](_0x28b0d9+':')+'\x20'+_0x49d883+a22_0x3237f9[_0x96c1cf(0x253)](_0x12f883);}return a22_0x3237f9[_0x96c1cf(0x253)](_0x138aaa);}function showFileNotFoundError(_0xdcb4ff,_0x129a7b){const _0x2536df=a22_0x46b216;console[_0x2536df(0x271)](a22_0x3237f9[_0x2536df(0x2b3)](_0x2536df(0x326)+_0xdcb4ff+'\x0a')),console['error'](a22_0x3237f9['cyan'](_0x2536df(0x2ea)+_0x129a7b+_0x2536df(0x2d2)));}function showParentSegmentNotSetError(_0x2939e9){const _0x8f6367=a22_0x46b216;console[_0x8f6367(0x271)](a22_0x3237f9['yellow'](_0x8f6367(0x24c))),console[_0x8f6367(0x271)](_0x2939e9);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2b7);['description']=a22_0x46b216(0x2e9);async[a22_0x46b216(0x2b5)](_0x12a67){const _0x1cf8aa=a22_0x46b216,{options:_0x10697f,args:_0x361d7c,tdx:_0x3bf7f8}=_0x12a67,_0x58f1d3=_0x361d7c[0x0];_0x10697f[_0x1cf8aa(0x224)]&&(console[_0x1cf8aa(0x271)](_0x1cf8aa(0x304)+_0x10697f['site']),_0x58f1d3&&console['error'](_0x1cf8aa(0x2b2)+_0x58f1d3));const _0x1a95e8=await withSpinner(_0x58f1d3?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x58f1d3+_0x1cf8aa(0x220):'Listing\x20parent\x20segments...',()=>_0x3bf7f8[_0x1cf8aa(0x2c1)][_0x1cf8aa(0x2ee)](),{'verbose':_0x10697f['verbose']});let _0xd3824f=_0x1a95e8['data'];if(_0x58f1d3){const _0x57e0cb=_0x58f1d3[_0x1cf8aa(0x320)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x1cf8aa(0x320)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2c2a0c=new RegExp('^'+_0x57e0cb+'$','i');_0xd3824f=_0xd3824f[_0x1cf8aa(0x2e8)](_0x1355ef=>_0x2c2a0c['test'](_0x1355ef[_0x1cf8aa(0x20d)]['name']));}_0xd3824f[_0x1cf8aa(0x27a)]((_0x1605fd,_0x49fc2e)=>_0x1605fd[_0x1cf8aa(0x20d)][_0x1cf8aa(0x228)][_0x1cf8aa(0x212)](_0x49fc2e[_0x1cf8aa(0x20d)]['name'])),console[_0x1cf8aa(0x271)](_0x1cf8aa(0x247)+_0xd3824f[_0x1cf8aa(0x2f8)]+'\x20parent\x20segment'+(_0xd3824f[_0x1cf8aa(0x2f8)]!==0x1?'s':''));const _0x2da5a3=_0x6b6894=>{const _0x3e9520=_0x1cf8aa;return getConsoleNextUrl(_0x10697f[_0x3e9520(0x259)],'/app/dw/parentSegments/'+_0x6b6894);};if(_0x10697f['format']===_0x1cf8aa(0x23d)||_0x10697f[_0x1cf8aa(0x256)]===_0x1cf8aa(0x287)){const _0x109fa5=_0xd3824f[_0x1cf8aa(0x288)](_0x3f911b=>({..._0x3f911b,'url':_0x2da5a3(_0x3f911b['id'])}));await handleSDKOutput(_0x109fa5,_0x10697f);}else{if(_0xd3824f[_0x1cf8aa(0x2f8)]===0x0)_0x58f1d3?console[_0x1cf8aa(0x32b)](_0x1cf8aa(0x2f6)+_0x58f1d3):console['log'](_0x1cf8aa(0x233));else for(const _0xf04947 of _0xd3824f){const _0x3be9ac=_0xf04947[_0x1cf8aa(0x20d)][_0x1cf8aa(0x223)]?a22_0x3237f9[_0x1cf8aa(0x253)]('\x20('+formatRows(_0xf04947[_0x1cf8aa(0x20d)][_0x1cf8aa(0x223)])+')'):'',_0x5e8116=hyperlink(_0xf04947['attributes'][_0x1cf8aa(0x228)],_0x2da5a3(_0xf04947['id']));console[_0x1cf8aa(0x32b)](_0x1cf8aa(0x2c3)+_0x5e8116+_0x3be9ac);}}return 0x0;}}function a22_0xd58f(_0x3cc5bb,_0x4cce81){_0x3cc5bb=_0x3cc5bb-0x1e6;const _0x328c9d=a22_0x328c();let _0xd58f27=_0x328c9d[_0x3cc5bb];return _0xd58f27;}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x1f4);[a22_0x46b216(0x28c)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x46b216(0x2b5)](_0x4e506c){const _0x7f8d0d=a22_0x46b216,{options:_0x4d1f72,args:_0x345834,tdx:_0x52d377}=_0x4e506c;console[_0x7f8d0d(0x271)](_0x7f8d0d(0x2f3)+_0x7f8d0d(0x254)+_0x7f8d0d(0x272));const _0x130754=_0x4d1f72;if(_0x345834[_0x7f8d0d(0x2f8)]===0x0)return console[_0x7f8d0d(0x271)](a22_0x3237f9[_0x7f8d0d(0x2b3)](_0x7f8d0d(0x293))),console[_0x7f8d0d(0x271)](_0x7f8d0d(0x31e)),0x1;const _0x54683d=_0x345834[0x0];if(!_0x130754[_0x7f8d0d(0x316)]||!_0x130754[_0x7f8d0d(0x2d8)])return console['error'](_0x7f8d0d(0x1ff)),console['error'](_0x7f8d0d(0x31e)),0x1;_0x130754[_0x7f8d0d(0x224)]&&(console[_0x7f8d0d(0x271)](_0x7f8d0d(0x304)+_0x130754[_0x7f8d0d(0x259)]),console[_0x7f8d0d(0x271)]('Name:\x20'+_0x54683d),console[_0x7f8d0d(0x271)](_0x7f8d0d(0x2a2)+_0x130754[_0x7f8d0d(0x316)]),console[_0x7f8d0d(0x271)](_0x7f8d0d(0x244)+_0x130754[_0x7f8d0d(0x2d8)]));const _0xa9b4dd=await loadJSONFromOptions(_0x130754[_0x7f8d0d(0x20d)],_0x130754[_0x7f8d0d(0x243)]),_0x2a51fd=await loadJSONFromOptions(_0x130754[_0x7f8d0d(0x300)],_0x130754[_0x7f8d0d(0x311)]),_0x2f57f2=await loadJSONFromOptions(_0x130754['customerGroup'],_0x130754[_0x7f8d0d(0x26c)]),_0x1b1345={'name':_0x54683d,'description':_0x130754[_0x7f8d0d(0x28c)],'scheduleType':_0x130754[_0x7f8d0d(0x306)],'scheduleOption':_0x130754['scheduleOption'],'timezone':_0x130754[_0x7f8d0d(0x2a1)],'master':{'parentDatabaseName':_0x130754[_0x7f8d0d(0x316)],'parentTableName':_0x130754[_0x7f8d0d(0x2d8)]},'attributes':_0xa9b4dd,'behaviors':_0x2a51fd,'customerGroup':_0x2f57f2},_0x4e859a=await withSpinner(_0x7f8d0d(0x1f2)+_0x54683d+_0x7f8d0d(0x220),()=>_0x52d377[_0x7f8d0d(0x2c1)][_0x7f8d0d(0x282)](_0x1b1345),{'verbose':_0x4d1f72['verbose']}),_0x374def=_0x4e859a['data'];return console[_0x7f8d0d(0x271)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x374def[_0x7f8d0d(0x228)]+'\x27\x20with\x20ID:\x20'+_0x374def['id']),await handleSDKOutput([_0x374def],_0x4d1f72),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2eb);[a22_0x46b216(0x28c)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x46b216(0x2b5)](_0x968a8c){const _0x4ec12b=a22_0x46b216,{options:_0x6efe74,args:_0x2c9527,tdx:_0x3cec37}=_0x968a8c;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4ec12b(0x272));const _0x4713ee=_0x6efe74;if(_0x2c9527[_0x4ec12b(0x2f8)]===0x0)return console[_0x4ec12b(0x271)](a22_0x3237f9[_0x4ec12b(0x2b3)](_0x4ec12b(0x293))),console['error'](_0x4ec12b(0x2ff)),0x1;const _0x5899c9=_0x2c9527[0x0];_0x4713ee[_0x4ec12b(0x224)]&&(console[_0x4ec12b(0x271)](_0x4ec12b(0x304)+_0x4713ee[_0x4ec12b(0x259)]),console[_0x4ec12b(0x271)](_0x4ec12b(0x1f0)+_0x5899c9));const _0x152c3d=await withSpinner(_0x4ec12b(0x214)+_0x5899c9+_0x4ec12b(0x220),()=>_0x3cec37['segment'][_0x4ec12b(0x2aa)](_0x5899c9),{'verbose':_0x4713ee[_0x4ec12b(0x224)]}),_0x365308=_0x152c3d[_0x4ec12b(0x28f)],_0x1b0475=await loadJSONFromOptions(_0x4713ee[_0x4ec12b(0x275)],_0x4713ee[_0x4ec12b(0x2fb)]),_0x274fc6=await loadJSONFromOptions(_0x4713ee[_0x4ec12b(0x261)],_0x4713ee[_0x4ec12b(0x309)]),_0x246603={'name':_0x365308[_0x4ec12b(0x228)],'description':_0x4713ee[_0x4ec12b(0x28c)]!==undefined?_0x4713ee['description']:_0x365308['description'],'scheduleType':_0x4713ee['scheduleType']!==undefined?_0x4713ee['scheduleType']:_0x365308['scheduleType'],'scheduleOption':_0x4713ee[_0x4ec12b(0x2c7)]!==undefined?_0x4713ee[_0x4ec12b(0x2c7)]:_0x365308['scheduleOption'],'timezone':_0x4713ee[_0x4ec12b(0x2a1)]!==undefined?_0x4713ee[_0x4ec12b(0x2a1)]:_0x365308['timezone'],'master':_0x365308[_0x4ec12b(0x334)],'attributes':_0x1b0475?[..._0x365308[_0x4ec12b(0x20d)]||[],..._0x1b0475]:_0x365308[_0x4ec12b(0x20d)],'behaviors':_0x274fc6?[..._0x365308[_0x4ec12b(0x300)]||[],..._0x274fc6]:_0x365308['behaviors'],'customerGroup':_0x365308[_0x4ec12b(0x2b1)]},_0x481c69=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x5899c9+_0x4ec12b(0x220),()=>_0x3cec37[_0x4ec12b(0x2c1)]['updateParent'](_0x5899c9,_0x246603),{'verbose':_0x4713ee[_0x4ec12b(0x224)]}),_0x75ec24=_0x481c69[_0x4ec12b(0x28f)];return console[_0x4ec12b(0x271)](_0x4ec12b(0x2b9)+_0x75ec24[_0x4ec12b(0x228)]+'\x27'),await handleSDKOutput([_0x75ec24],_0x4713ee),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x46b216(0x1e7);[a22_0x46b216(0x28c)]=a22_0x46b216(0x329);async[a22_0x46b216(0x2b5)](_0xe675be){const _0x41f15c=a22_0x46b216,{options:_0x1e6547,args:_0x5c8f52,tdx:_0xcb81a0}=_0xe675be,_0x43b7ef=_0x1e6547,_0x43d412=_0x5c8f52[0x0]||_0x1e6547[_0x41f15c(0x20b)];if(!_0x43d412)return showParentSegmentNotSetError(_0x41f15c(0x2f9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x43b7ef[_0x41f15c(0x2cd)]&&_0x43b7ef['output'])return console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x2b3)](_0x41f15c(0x2c0))),console['error'](a22_0x3237f9['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x253)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x41f15c(0x271)](a22_0x3237f9['cyan'](_0x41f15c(0x268))),0x1;const _0x278231=_0x43b7ef[_0x41f15c(0x202)]||a22_0x487f45[_0x41f15c(0x1ec)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x43d412)+'.yml');_0x43b7ef[_0x41f15c(0x224)]&&(console[_0x41f15c(0x271)](_0x41f15c(0x304)+_0x43b7ef['site']),console[_0x41f15c(0x271)](_0x41f15c(0x1f0)+_0x43d412),console[_0x41f15c(0x271)]('Output\x20file:\x20'+_0x278231));const _0x3b892d=await withSpinner(_0x41f15c(0x2ac)+_0x43d412+'\x27...',()=>_0xcb81a0['segment'][_0x41f15c(0x303)](_0x43d412),{'verbose':_0x43b7ef['verbose']}),_0x17695d=_0x3b892d[_0x41f15c(0x28f)];if(existsSync(_0x278231)){const _0x36d36a=readFileSync(_0x278231,_0x41f15c(0x1f8)),_0x2d9837=generateDiff(_0x36d36a,_0x17695d);if(!hasChanges(_0x2d9837))console['error'](a22_0x3237f9[_0x41f15c(0x237)]('✔')+'\x20No\x20changes\x20-\x20'+a22_0x3237f9[_0x41f15c(0x2cc)](_0x278231)+_0x41f15c(0x2a6));else{console['error'](_0x41f15c(0x310)+_0x278231+'\x27:'),console['error']('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x2d9837)),console['error']('─'[_0x41f15c(0x229)](0x3c));if(!_0x43b7ef['yes']){if(!isInteractive())return console[_0x41f15c(0x271)](a22_0x3237f9['red'](_0x41f15c(0x210)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x253)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xa512b3=await confirmKey(_0x41f15c(0x2e3)+_0x278231+'\x27?');if(!_0xa512b3)return console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x1fb)](_0x41f15c(0x246))),0x1;}writeFileSync(_0x278231,_0x17695d,_0x41f15c(0x1f8)),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x237)]('✔')+_0x41f15c(0x325)+a22_0x3237f9[_0x41f15c(0x2cc)](_0x278231));}}else{const _0xc33baa=a22_0x487f45[_0x41f15c(0x2a9)](_0x278231);!existsSync(_0xc33baa)&&mkdirSync(_0xc33baa,{'recursive':!![]}),writeFileSync(_0x278231,_0x17695d,_0x41f15c(0x1f8)),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x237)]('✔')+_0x41f15c(0x325)+a22_0x3237f9['cyan'](_0x278231));}return saveSessionContext({'parent_segment':_0x43d412},_0x43b7ef['session']),console[_0x41f15c(0x271)](a22_0x3237f9['green']('✔')+_0x41f15c(0x249)+a22_0x3237f9[_0x41f15c(0x253)]('parent_segment')+_0x41f15c(0x2cf)+a22_0x3237f9['cyan'](_0x43d412)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x274);[a22_0x46b216(0x28c)]=a22_0x46b216(0x32f);async['execute'](_0x592e08){const _0xfedcd9=a22_0x46b216,{options:_0x34ecaa,args:_0x593901,tdx:_0x45f823}=_0x592e08,_0x6d758=_0x34ecaa,_0x36b203=_0x593901[0x0]||_0x34ecaa[_0xfedcd9(0x20b)];if(!_0x36b203)return showParentSegmentNotSetError(_0xfedcd9(0x2f4)+_0xfedcd9(0x281)),0x1;const _0x29ec4e=resolveYamlFile(_0x36b203);if(!existsSync(_0x29ec4e))return showFileNotFoundError(_0x29ec4e,_0x36b203),0x1;_0x6d758[_0xfedcd9(0x224)]&&(console[_0xfedcd9(0x271)](_0xfedcd9(0x304)+_0x6d758['site']),console[_0xfedcd9(0x271)](_0xfedcd9(0x1e6)+_0x29ec4e));let _0x43540b;try{_0x43540b=readFileSync(_0x29ec4e,_0xfedcd9(0x1f8));}catch(_0x34727e){const _0x8e76a6=_0x34727e instanceof Error?_0x34727e['message']:String(_0x34727e);return console['error'](_0xfedcd9(0x1ee)+_0x8e76a6),0x1;}const _0x351ae1=await withSpinner(_0xfedcd9(0x2e7),()=>_0x45f823['segment']['pushParentYaml'](_0x43540b),{'verbose':_0x6d758['verbose']}),_0xcc388a=_0x351ae1[_0xfedcd9(0x28f)],{isNew:_0x4d9455,name:_0x2af3ab,hasChanges:_0x41c2ae,diffFormatted:_0x56ec1b}=_0xcc388a;if(!_0x41c2ae)return console[_0xfedcd9(0x271)](_0xfedcd9(0x2c6)+_0x2af3ab+_0xfedcd9(0x2dd)),0x0;_0x4d9455?console[_0xfedcd9(0x271)](_0xfedcd9(0x30a)+_0x2af3ab+'\x27:'):console[_0xfedcd9(0x271)](_0xfedcd9(0x297)+_0x2af3ab+'\x27:');console[_0xfedcd9(0x271)]('─'[_0xfedcd9(0x229)](0x3c)),console[_0xfedcd9(0x271)](_0x56ec1b),console[_0xfedcd9(0x271)]('─'[_0xfedcd9(0x229)](0x3c));const _0x338fc4=_0x4d9455?_0xfedcd9(0x226)+_0x2af3ab+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x2af3ab+'\x27?';if(!_0x6d758[_0xfedcd9(0x278)]){if(!isInteractive())return console[_0xfedcd9(0x271)](a22_0x3237f9['red'](_0xfedcd9(0x210)),_0xfedcd9(0x20e)),console[_0xfedcd9(0x271)](a22_0x3237f9[_0xfedcd9(0x253)](_0xfedcd9(0x251))),0x1;const _0x55d728=await confirmKey(_0x338fc4);if(!_0x55d728)return console[_0xfedcd9(0x271)](a22_0x3237f9['yellow'](_0xfedcd9(0x246))),0x1;}const _0x2380bf=_0x4d9455?_0xfedcd9(0x308):_0xfedcd9(0x321),_0x2c4e61=await withSpinner(_0x2380bf+_0xfedcd9(0x20a)+_0x2af3ab+'\x27...',()=>_0xcc388a[_0xfedcd9(0x26e)](),{'verbose':_0x6d758['verbose']}),_0x22df3e=_0x2c4e61[_0xfedcd9(0x28f)],_0x5bbf82=getConsoleNextUrl(_0x6d758[_0xfedcd9(0x259)],_0xfedcd9(0x26a)+_0x22df3e['id']),_0xfc1975=_0x4d9455?'Created':_0xfedcd9(0x302);return console['error']('✔\x20'+_0xfc1975+'\x20parent\x20segment\x20\x27'+_0x22df3e['name']+'\x27'),console['error']('\x20\x20'+_0x5bbf82),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x46b216(0x2a0);[a22_0x46b216(0x28c)]=a22_0x46b216(0x1f9);async[a22_0x46b216(0x2b5)](_0x442fd0){const _0x59520f=a22_0x46b216,{options:_0x263b9e,args:_0x19a36d,tdx:_0x5ef384}=_0x442fd0,_0x423f81=_0x263b9e,_0x6554e4=_0x19a36d[0x0]||_0x263b9e[_0x59520f(0x20b)];if(!_0x6554e4)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'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x59520f(0x211)+_0x59520f(0x30e)),0x1;const _0x4fef69=resolveYamlFile(_0x6554e4);if(!existsSync(_0x4fef69))return showFileNotFoundError(_0x4fef69,_0x6554e4),0x1;_0x423f81[_0x59520f(0x224)]&&(console[_0x59520f(0x271)](_0x59520f(0x304)+_0x423f81['site']),console[_0x59520f(0x271)]('YAML\x20file:\x20'+_0x4fef69));let _0x5d41b7;try{_0x5d41b7=readFileSync(_0x4fef69,_0x59520f(0x1f8));}catch(_0xe1d9d0){const _0x1481f7=_0xe1d9d0 instanceof Error?_0xe1d9d0['message']:String(_0xe1d9d0);return console[_0x59520f(0x271)]('Error\x20reading\x20file:\x20'+_0x1481f7),0x1;}const _0x2dd73f=createCommandSpinner(a22_0x3237f9['dim'](_0x59520f(0x28e)),{'verbose':_0x423f81[_0x59520f(0x224)]});_0x2dd73f[_0x59520f(0x29a)]();const _0x5e855c={'onProgress':_0x926242=>{const _0x323b85=_0x59520f;_0x2dd73f[_0x323b85(0x222)]=formatProgressMessage(_0x926242);}};if(_0x423f81[_0x59520f(0x334)])_0x5e855c[_0x59520f(0x334)]=!![];if(_0x423f81['enriched'])_0x5e855c[_0x59520f(0x1fc)]=!![];_0x423f81[_0x59520f(0x23e)]&&(_0x5e855c[_0x59520f(0x23e)]=_0x423f81[_0x59520f(0x23e)]);_0x423f81['behavior']&&(_0x5e855c[_0x59520f(0x206)]=_0x423f81['behavior']);if(_0x423f81[_0x59520f(0x2a3)])_0x5e855c['interval']=_0x423f81[_0x59520f(0x2a3)];let _0x307820;try{_0x307820=await _0x5ef384[_0x59520f(0x2c1)][_0x59520f(0x231)](_0x5d41b7,_0x5e855c),_0x2dd73f[_0x59520f(0x2a8)]();}catch(_0x142aac){_0x2dd73f[_0x59520f(0x2a8)]();throw _0x142aac;}const _0x30e109=_0x423f81[_0x59520f(0x2a3)]||'-1d';return this['displayValidateResults'](_0x307820,_0x5e855c,_0x4fef69,_0x30e109),_0x307820[_0x59520f(0x294)]?0x0:0x1;}[a22_0x46b216(0x2dc)](_0x58927e,_0x2ac168,_0x497b38,_0x234647){const _0x40d826=a22_0x46b216;console[_0x40d826(0x271)]('\x0a'+a22_0x3237f9[_0x40d826(0x25e)](_0x40d826(0x25f))+'\x20'+_0x58927e[_0x40d826(0x228)]),console[_0x40d826(0x271)]('═'[_0x40d826(0x229)](0x3c)),this[_0x40d826(0x29d)](_0x58927e);if(typeof _0x2ac168['attribute']==='string'){this[_0x40d826(0x2bf)](_0x58927e),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x23e),_0x2ac168['attribute']);return;}if(_0x2ac168[_0x40d826(0x23e)]===!![]){this[_0x40d826(0x2bf)](_0x58927e),this['displaySummary'](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x20d));return;}if(typeof _0x2ac168[_0x40d826(0x206)]==='string'){this['displayBehaviorsStats'](_0x58927e,_0x234647),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x206),_0x2ac168['behavior']);return;}if(_0x2ac168[_0x40d826(0x206)]===!![]){this[_0x40d826(0x1fa)](_0x58927e,_0x234647),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x300));return;}this['displayAttributesStats'](_0x58927e),this[_0x40d826(0x1fa)](_0x58927e,_0x234647),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x273));}[a22_0x46b216(0x1e8)](_0x41caf7,_0x96bffc,_0xf0bbdb,_0x1ffce4){const _0x177e1d=a22_0x46b216;console[_0x177e1d(0x271)]('\x0a'+a22_0x3237f9[_0x177e1d(0x253)]('To\x20view\x20sample\x20data:'));const _0x1af936=_0x96bffc!=='-1d'?_0x177e1d(0x29c)+_0x96bffc:'';if(_0xf0bbdb===_0x177e1d(0x23e)&&_0x1ffce4)console['error']('\x20\x20'+a22_0x3237f9['dim'](_0x177e1d(0x24f)+_0x41caf7+_0x177e1d(0x283)+_0x1ffce4+'\x22'+_0x1af936));else{if(_0xf0bbdb===_0x177e1d(0x206)&&_0x1ffce4)console[_0x177e1d(0x271)]('\x20\x20'+a22_0x3237f9['dim'](_0x177e1d(0x24f)+_0x41caf7+_0x177e1d(0x2bc)+_0x1ffce4+'\x22'+_0x1af936));else(_0xf0bbdb==='attributes'||_0xf0bbdb==='all')&&console['error']('\x20\x20'+a22_0x3237f9[_0x177e1d(0x253)]('tdx\x20segment\x20parent\x20preview\x20'+_0x41caf7+_0x177e1d(0x258)+_0x1af936));}(_0xf0bbdb===_0x177e1d(0x300)||_0xf0bbdb===_0x177e1d(0x273))&&console['error']('\x20\x20'+a22_0x3237f9['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x41caf7+'\x20--behavior\x20\x22<name>\x22'+_0x1af936)),_0xf0bbdb===_0x177e1d(0x273)&&console[_0x177e1d(0x271)]('\x20\x20'+a22_0x3237f9[_0x177e1d(0x253)](_0x177e1d(0x24f)+_0x41caf7+_0x177e1d(0x1eb)+_0x1af936));}['displayMasterInfo'](_0x1c880d){const _0x167d95=a22_0x46b216,{master:_0x4ff340}=_0x1c880d,_0x2fe5b1=_0x4ff340[_0x167d95(0x319)]?a22_0x3237f9['green']('✔'):a22_0x3237f9['red']('✘');console[_0x167d95(0x271)]('\x0a'+a22_0x3237f9[_0x167d95(0x253)](_0x167d95(0x30b))),console[_0x167d95(0x271)](_0x2fe5b1+'\x20'+a22_0x3237f9[_0x167d95(0x25e)](_0x4ff340['database']+'.'+_0x4ff340[_0x167d95(0x2d8)])),_0x4ff340[_0x167d95(0x319)]?_0x4ff340[_0x167d95(0x280)]!==undefined&&console[_0x167d95(0x271)]('\x20\x20'+a22_0x3237f9[_0x167d95(0x253)](_0x167d95(0x24a))+'\x20'+a22_0x3237f9[_0x167d95(0x2cc)](formatRows(_0x4ff340['rowCount']))):console[_0x167d95(0x271)]('\x20\x20'+a22_0x3237f9[_0x167d95(0x2b3)]('Error:')+'\x20'+_0x4ff340['schemaError']);}['displayAttributesStats'](_0x2a8de5){const _0x7686d0=a22_0x46b216;if(_0x2a8de5[_0x7686d0(0x20d)][_0x7686d0(0x2f8)]===0x0)return;console[_0x7686d0(0x271)]('\x0a'+a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x327)));for(const _0x233d3f of _0x2a8de5[_0x7686d0(0x20d)]){const _0x5578fa=_0x233d3f['schemaValid']?a22_0x3237f9[_0x7686d0(0x237)]('✔'):a22_0x3237f9[_0x7686d0(0x2b3)]('✘');let _0x3c5481='';if(_0x233d3f[_0x7686d0(0x319)]&&_0x233d3f['matchedCount']!==undefined&&_0x233d3f[_0x7686d0(0x2c9)]!==undefined){const _0x3661eb=_0x233d3f[_0x7686d0(0x2c9)]['toFixed'](0x1),_0x2ee844=_0x233d3f['coveragePercent']>=0x50?a22_0x3237f9[_0x7686d0(0x237)]:_0x233d3f['coveragePercent']>=0x32?a22_0x3237f9['yellow']:a22_0x3237f9['red'];_0x3c5481='\x20'+a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x267))+'\x20'+_0x2ee844(_0x3661eb+'%')+'\x20('+formatRows(_0x233d3f[_0x7686d0(0x2ef)])+_0x7686d0(0x301);}console[_0x7686d0(0x271)](_0x5578fa+'\x20'+a22_0x3237f9['bold'](_0x233d3f[_0x7686d0(0x228)])+_0x3c5481),console[_0x7686d0(0x271)]('\x20\x20'+a22_0x3237f9['dim'](_0x7686d0(0x1fe))+'\x20'+a22_0x3237f9['bold'](_0x233d3f['database']+'.'+_0x233d3f[_0x7686d0(0x2d8)]));const _0x5c3c30=_0x233d3f[_0x7686d0(0x2bd)]===_0x233d3f['foreignKey']?a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x219))+'\x20'+_0x233d3f[_0x7686d0(0x2bd)]:a22_0x3237f9['dim'](_0x7686d0(0x2e0))+'\x20'+_0x233d3f[_0x7686d0(0x2bd)]+_0x7686d0(0x2cf)+_0x233d3f[_0x7686d0(0x26f)];console[_0x7686d0(0x271)]('\x20\x20'+_0x5c3c30),console['error']('\x20\x20'+a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x2e6))),this[_0x7686d0(0x31a)](_0x233d3f[_0x7686d0(0x331)]),!_0x233d3f[_0x7686d0(0x319)]&&console[_0x7686d0(0x271)]('\x20\x20'+a22_0x3237f9[_0x7686d0(0x2b3)](_0x7686d0(0x23a))+'\x20'+_0x233d3f[_0x7686d0(0x263)]);}}[a22_0x46b216(0x1fa)](_0x6fbaab,_0x3b4072){const _0x527456=a22_0x46b216;if(_0x6fbaab[_0x527456(0x300)][_0x527456(0x2f8)]===0x0)return;console[_0x527456(0x271)]('\x0a'+a22_0x3237f9[_0x527456(0x253)](_0x527456(0x203))+'\x20'+a22_0x3237f9[_0x527456(0x253)]('('+_0x3b4072+')'));for(const _0x1c4457 of _0x6fbaab['behaviors']){const _0x54ce5d=_0x1c4457[_0x527456(0x319)]?a22_0x3237f9[_0x527456(0x237)]('✔'):a22_0x3237f9['red']('✘');let _0x3bfd7a='';if(_0x1c4457[_0x527456(0x319)]&&_0x1c4457['customersWithEvents']!==undefined&&_0x1c4457[_0x527456(0x22d)]!==undefined){const _0x46691e=_0x1c4457[_0x527456(0x289)]?.[_0x527456(0x204)](0x1)||'?',_0x372e64=(_0x1c4457[_0x527456(0x289)]??0x0)>=0x32?a22_0x3237f9[_0x527456(0x237)]:(_0x1c4457['customerPercent']??0x0)>=0x14?a22_0x3237f9[_0x527456(0x1fb)]:a22_0x3237f9[_0x527456(0x2b3)];_0x3bfd7a='\x20'+a22_0x3237f9[_0x527456(0x253)](_0x527456(0x208))+'\x20'+_0x372e64(formatRows(_0x1c4457[_0x527456(0x262)]))+'\x20('+_0x46691e+_0x527456(0x2a4)+a22_0x3237f9[_0x527456(0x253)](_0x527456(0x2e2))+'\x20'+a22_0x3237f9[_0x527456(0x2cc)](formatRows(_0x1c4457['totalEvents']));}console[_0x527456(0x271)](_0x54ce5d+'\x20'+a22_0x3237f9[_0x527456(0x25e)](_0x1c4457[_0x527456(0x228)])+_0x3bfd7a),console['error']('\x20\x20'+a22_0x3237f9['dim'](_0x527456(0x1fe))+'\x20'+a22_0x3237f9[_0x527456(0x25e)](_0x1c4457[_0x527456(0x316)]+'.'+_0x1c4457['table']));const _0x5ca049=_0x1c4457[_0x527456(0x2bd)]===_0x1c4457['foreignKey']?a22_0x3237f9['dim'](_0x527456(0x219))+'\x20'+_0x1c4457[_0x527456(0x2bd)]:a22_0x3237f9['dim']('Join:')+'\x20'+_0x1c4457['joinKey']+'\x20=\x20'+_0x1c4457['foreignKey'];console['error']('\x20\x20'+_0x5ca049),console[_0x527456(0x271)]('\x20\x20'+a22_0x3237f9['dim'](_0x527456(0x2e6))),this[_0x527456(0x31a)](_0x1c4457[_0x527456(0x331)]),!_0x1c4457[_0x527456(0x319)]&&console[_0x527456(0x271)]('\x20\x20'+a22_0x3237f9[_0x527456(0x2b3)]('Error:')+'\x20'+_0x1c4457['schemaError']);}}[a22_0x46b216(0x31a)](_0x2b51e3){const _0x1660c5=a22_0x46b216;for(const _0x1a0db4 of _0x2b51e3){_0x1a0db4['label']===_0x1a0db4['column']||_0x1a0db4[_0x1660c5(0x29f)]==='*'?console[_0x1660c5(0x271)](_0x1660c5(0x1fd)+_0x1a0db4[_0x1660c5(0x30d)]):console[_0x1660c5(0x271)]('\x20\x20\x20\x20-\x20'+_0x1a0db4[_0x1660c5(0x30d)]+'\x20'+a22_0x3237f9['dim']('('+_0x1a0db4[_0x1660c5(0x29f)]+')'));}}[a22_0x46b216(0x2de)](_0x3df0ab){const _0x3af7ee=a22_0x46b216;console[_0x3af7ee(0x271)]('─'[_0x3af7ee(0x229)](0x3c));if(_0x3df0ab[_0x3af7ee(0x2fe)][_0x3af7ee(0x2f8)]>0x0){console['error']('\x0a'+a22_0x3237f9[_0x3af7ee(0x2b3)](_0x3af7ee(0x1ea)));for(const _0x879ca8 of _0x3df0ab['errors']){console[_0x3af7ee(0x271)]('\x20\x20'+a22_0x3237f9[_0x3af7ee(0x2b3)]('•')+'\x20'+_0x879ca8);}}_0x3df0ab[_0x3af7ee(0x294)]&&console[_0x3af7ee(0x271)]('\x0a'+a22_0x3237f9['green']('✔')+_0x3af7ee(0x2ca));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x31c);['description']=a22_0x46b216(0x230);async[a22_0x46b216(0x2b5)](_0x3b1d2c){const _0xabea6c=a22_0x46b216,{options:_0x134786,args:_0x22d5d7,tdx:_0x9cfede}=_0x3b1d2c,_0xa80af8=_0x134786,_0x1a51f3=_0x22d5d7[0x0]||_0x134786[_0xabea6c(0x20b)];if(!_0x1a51f3)return showParentSegmentNotSetError(_0xabea6c(0x2d6)+_0xabea6c(0x2d7)+_0xabea6c(0x2a5)+_0xabea6c(0x305)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0xabea6c(0x32e)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0xabea6c(0x30e)),0x1;if(!_0xa80af8['master']&&!_0xa80af8['attribute']&&!_0xa80af8[_0xabea6c(0x206)]&&!_0xa80af8[_0xabea6c(0x1fc)])return console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x232))),console['error'](_0xabea6c(0x307)),console['error'](_0xabea6c(0x324)),console[_0xabea6c(0x271)](_0xabea6c(0x285)),console[_0xabea6c(0x271)](_0xabea6c(0x2ad)),console[_0xabea6c(0x271)](_0xabea6c(0x31b)),console['error'](_0xabea6c(0x2d0)),0x1;const _0x51e95b=resolveYamlFile(_0x1a51f3);if(!existsSync(_0x51e95b))return showFileNotFoundError(_0x51e95b,_0x1a51f3),0x1;_0xa80af8[_0xabea6c(0x224)]&&(console['error'](_0xabea6c(0x304)+_0xa80af8[_0xabea6c(0x259)]),console[_0xabea6c(0x271)](_0xabea6c(0x1e6)+_0x51e95b));let _0x291ff0;try{_0x291ff0=readFileSync(_0x51e95b,_0xabea6c(0x1f8));}catch(_0x397aef){const _0x1ef57d=_0x397aef instanceof Error?_0x397aef['message']:String(_0x397aef);return console['error'](_0xabea6c(0x1ee)+_0x1ef57d),0x1;}let _0x1c968a;try{_0x1c968a=parseDef(_0x291ff0);}catch(_0x2ff498){const _0x5dda37=_0x2ff498 instanceof Error?_0x2ff498[_0xabea6c(0x30f)]:String(_0x2ff498);return console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x21b)+_0x5dda37)),0x1;}if(_0xa80af8[_0xabea6c(0x23e)]===!![]||_0xa80af8['attribute']===''){const _0x13762a=_0x1c968a[_0xabea6c(0x20d)]?.[_0xabea6c(0x288)](_0x1b7951=>_0x1b7951[_0xabea6c(0x228)])||[];if(_0x13762a[_0xabea6c(0x2f8)]===0x0)console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x252)));else{console[_0xabea6c(0x271)](a22_0x3237f9['red'](_0xabea6c(0x225))),console[_0xabea6c(0x271)](_0xabea6c(0x257));for(const _0xfe6bf7 of _0x13762a){console[_0xabea6c(0x271)]('\x20\x20'+a22_0x3237f9[_0xabea6c(0x2cc)](_0xfe6bf7));}console[_0xabea6c(0x271)](_0xabea6c(0x32a)+_0x1a51f3+_0xabea6c(0x283)+_0x13762a[0x0]+'\x22');}return 0x1;}if(_0xa80af8['behavior']===!![]||_0xa80af8[_0xabea6c(0x206)]===''){const _0x589fef=_0x1c968a[_0xabea6c(0x300)]?.[_0xabea6c(0x288)](_0x212c9a=>_0x212c9a[_0xabea6c(0x228)])||[];if(_0x589fef[_0xabea6c(0x2f8)]===0x0)console[_0xabea6c(0x271)](a22_0x3237f9['red']('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x29b))),console[_0xabea6c(0x271)](_0xabea6c(0x242));for(const _0x490c1f of _0x589fef){console[_0xabea6c(0x271)]('\x20\x20'+a22_0x3237f9['cyan'](_0x490c1f));}console[_0xabea6c(0x271)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x1a51f3+_0xabea6c(0x2bc)+_0x589fef[0x0]+'\x22');}return 0x1;}const _0x13a1af=createCommandSpinner(a22_0x3237f9[_0xabea6c(0x253)](_0xabea6c(0x330)),{'verbose':_0xa80af8[_0xabea6c(0x224)]});_0x13a1af[_0xabea6c(0x29a)]();const _0x1f3900={'onProgress':_0x3a9010=>{const _0x4a2dce=_0xabea6c;_0x13a1af[_0x4a2dce(0x222)]=formatProgressMessage(_0x3a9010);}};if(_0xa80af8[_0xabea6c(0x334)])_0x1f3900[_0xabea6c(0x334)]=!![];if(_0xa80af8[_0xabea6c(0x23e)]&&typeof _0xa80af8[_0xabea6c(0x23e)]===_0xabea6c(0x2b6))_0x1f3900[_0xabea6c(0x23e)]=_0xa80af8['attribute'];if(_0xa80af8['behavior']&&typeof _0xa80af8[_0xabea6c(0x206)]===_0xabea6c(0x2b6))_0x1f3900[_0xabea6c(0x206)]=_0xa80af8['behavior'];if(_0xa80af8[_0xabea6c(0x1fc)])_0x1f3900['enriched']=!![];if(_0xa80af8['interval'])_0x1f3900[_0xabea6c(0x2a3)]=_0xa80af8[_0xabea6c(0x2a3)];let _0x2a1462;try{_0x2a1462=await _0x9cfede['segment'][_0xabea6c(0x26b)](_0x291ff0,_0x1f3900),_0x13a1af['stop']();}catch(_0x37bdee){_0x13a1af[_0xabea6c(0x2a8)]();throw _0x37bdee;}return await this['displayPreviewResults'](_0x2a1462,{'master':_0xa80af8[_0xabea6c(0x334)],'attribute':typeof _0xa80af8[_0xabea6c(0x23e)]===_0xabea6c(0x2b6)?_0xa80af8[_0xabea6c(0x23e)]:undefined,'behavior':typeof _0xa80af8['behavior']===_0xabea6c(0x2b6)?_0xa80af8[_0xabea6c(0x206)]:undefined,'enriched':_0xa80af8[_0xabea6c(0x1fc)]}),_0x2a1462[_0xabea6c(0x294)]?0x0:0x1;}async[a22_0x46b216(0x2b8)](_0x357f2c,_0x4eb8af){const _0x5d11a3=a22_0x46b216;console['error']('\x0a'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x5d11a3(0x1ed))+'\x20'+_0x357f2c[_0x5d11a3(0x228)]),console[_0x5d11a3(0x271)]('═'[_0x5d11a3(0x229)](0x3c));if(_0x4eb8af[_0x5d11a3(0x334)]&&_0x357f2c[_0x5d11a3(0x2d3)]){const _0x55b15b=a22_0x3237f9['dim'](_0x5d11a3(0x20c))+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x357f2c[_0x5d11a3(0x334)][_0x5d11a3(0x316)]+'.'+_0x357f2c['master'][_0x5d11a3(0x2d8)]);await this[_0x5d11a3(0x23c)](_0x55b15b,_0x357f2c[_0x5d11a3(0x2d3)]);}else{if(_0x4eb8af[_0x5d11a3(0x23e)]&&_0x357f2c['sampleData']){const _0xe95e15=a22_0x3237f9['dim'](_0x5d11a3(0x22b))+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x4eb8af['attribute']);await this[_0x5d11a3(0x23c)](_0xe95e15,_0x357f2c[_0x5d11a3(0x2d3)]);}else{if(_0x4eb8af['behavior']&&_0x357f2c[_0x5d11a3(0x2d3)]){const _0x4965f2=a22_0x3237f9['dim']('Behavior:')+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x4eb8af['behavior']);await this['displaySampleData'](_0x4965f2,_0x357f2c[_0x5d11a3(0x2d3)]);}else{if(_0x4eb8af[_0x5d11a3(0x1fc)]&&_0x357f2c[_0x5d11a3(0x2d3)]){const _0x358f8b=a22_0x3237f9[_0x5d11a3(0x253)](_0x5d11a3(0x299))+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x5d11a3(0x290));await this[_0x5d11a3(0x23c)](_0x358f8b,_0x357f2c[_0x5d11a3(0x2d3)]);}else!_0x357f2c[_0x5d11a3(0x2d3)]&&console[_0x5d11a3(0x271)](_0x5d11a3(0x315));}}}if(_0x357f2c[_0x5d11a3(0x2fe)][_0x5d11a3(0x2f8)]>0x0){console[_0x5d11a3(0x271)]('─'[_0x5d11a3(0x229)](0x3c)),console[_0x5d11a3(0x271)]('\x0a'+a22_0x3237f9[_0x5d11a3(0x2b3)](_0x5d11a3(0x1ea)));for(const _0x270dea of _0x357f2c[_0x5d11a3(0x2fe)]){console['error']('\x20\x20'+a22_0x3237f9[_0x5d11a3(0x2b3)]('•')+'\x20'+_0x270dea);}}}async[a22_0x46b216(0x23c)](_0x30edfe,_0x365301){const _0x33ad57=a22_0x46b216;if(_0x365301[_0x33ad57(0x2f8)]===0x0){console[_0x33ad57(0x271)]('\x0a'+_0x30edfe),console[_0x33ad57(0x271)](_0x33ad57(0x2af));return;}console[_0x33ad57(0x271)]('\x0a'+_0x30edfe);const _0x2f4eb5=Object[_0x33ad57(0x241)](_0x365301[0x0])[_0x33ad57(0x288)](_0x409e90=>({'name':_0x409e90,'type':typeof _0x365301[0x0][_0x409e90]==='number'?_0x33ad57(0x2f1):_0x33ad57(0x20f)})),_0x557cec={'queryId':'preview','columns':_0x2f4eb5,'data':_0x365301,'stats':{'state':_0x33ad57(0x313),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x365301[_0x33ad57(0x2f8)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x29b2ed=formatAsTable(_0x557cec,_0x365301[_0x33ad57(0x2f8)],!![]);await writeOutput(_0x29b2ed,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a22_0x46b216(0x1f1);[a22_0x46b216(0x28c)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a22_0x46b216(0x2b5)](_0x47f1a7){const _0xd13702=a22_0x46b216,{options:_0x1d63e8,args:_0x231c50,tdx:_0x1223af}=_0x47f1a7,_0x2e6657=_0x1d63e8,_0x307ec6=_0x231c50[0x0]||_0x1d63e8[_0xd13702(0x20b)];if(!_0x307ec6)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'+_0xd13702(0x270)),0x1;const _0x23143a=resolveYamlFile(_0x307ec6);if(existsSync(_0x23143a)){_0x2e6657['verbose']&&console[_0xd13702(0x271)](_0xd13702(0x286)+_0x23143a);let _0x598467;try{_0x598467=readFileSync(_0x23143a,_0xd13702(0x1f8));}catch(_0x2738d0){const _0x8a9242=_0x2738d0 instanceof Error?_0x2738d0[_0xd13702(0x30f)]:String(_0x2738d0);return console[_0xd13702(0x271)]('Error\x20reading\x20file:\x20'+_0x8a9242),0x1;}const _0xfd4f68=await withSpinner('Analyzing\x20changes...',()=>_0x1223af[_0xd13702(0x2c1)][_0xd13702(0x27c)](_0x598467),{'verbose':_0x2e6657[_0xd13702(0x224)]}),_0x4c86aa=_0xfd4f68[_0xd13702(0x28f)],{isNew:_0x192a17,name:_0x44ed70,hasChanges:_0xd5b08f,diffFormatted:_0x44536e}=_0x4c86aa;if(_0xd5b08f){_0x192a17?console[_0xd13702(0x271)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x44ed70+'\x27:'):console[_0xd13702(0x271)](_0xd13702(0x297)+_0x44ed70+'\x27:');console['error']('─'[_0xd13702(0x229)](0x3c)),console[_0xd13702(0x271)](_0x44536e),console[_0xd13702(0x271)]('─'[_0xd13702(0x229)](0x3c));const _0x498016=_0x192a17?'Create\x20parent\x20segment\x20\x27'+_0x44ed70+_0xd13702(0x240):_0xd13702(0x295)+_0x44ed70+_0xd13702(0x240);if(!_0x2e6657[_0xd13702(0x278)]){if(!isInteractive())return console[_0xd13702(0x271)](a22_0x3237f9[_0xd13702(0x2b3)]('\x0aError:'),_0xd13702(0x20e)),console[_0xd13702(0x271)](a22_0x3237f9[_0xd13702(0x253)](_0xd13702(0x251))),0x1;const _0x4efd2c=await confirmKey(_0x498016);if(!_0x4efd2c)return console['error'](a22_0x3237f9[_0xd13702(0x1fb)]('Aborted.')),0x1;}const _0x284517=_0x192a17?_0xd13702(0x308):'Updating';await withSpinner(_0x284517+_0xd13702(0x20a)+_0x44ed70+_0xd13702(0x220),()=>_0x4c86aa['apply'](),{'verbose':_0x2e6657['verbose']});const _0x78cb47=_0x192a17?_0xd13702(0x314):'Updated';console[_0xd13702(0x271)]('✔\x20'+_0x78cb47+'\x20parent\x20segment\x20\x27'+_0x44ed70+'\x27');}else console['error'](_0xd13702(0x2c6)+_0x44ed70+_0xd13702(0x1f5));}const _0x47e784=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x307ec6+_0xd13702(0x220),()=>_0x1223af[_0xd13702(0x2c1)][_0xd13702(0x218)](_0x307ec6),{'verbose':_0x2e6657[_0xd13702(0x224)]}),_0x28e746=_0x47e784[_0xd13702(0x28f)],_0x219b1d=getConsoleUrl(_0x2e6657['site'],_0xd13702(0x260)+_0x28e746['workflowId']+_0xd13702(0x22c)+_0x28e746['workflowSessionId']+_0xd13702(0x332)+_0x28e746[_0xd13702(0x21a)]);return console[_0xd13702(0x271)](_0xd13702(0x215)),console[_0xd13702(0x271)]('\x20\x20'+a22_0x3237f9[_0xd13702(0x253)]('Audience\x20ID:')+'\x20'+_0x28e746[_0xd13702(0x298)]),console[_0xd13702(0x271)]('\x20\x20'+a22_0x3237f9['dim']('Status:')+'\x20'+_0x28e746[_0xd13702(0x312)]),console[_0xd13702(0x271)]('\x20\x20'+a22_0x3237f9['dim']('Session:')+'\x20'+_0x28e746[_0xd13702(0x209)]),console['error']('\x20\x20'+a22_0x3237f9[_0xd13702(0x253)]('Attempt:')+'\x20'+_0x28e746[_0xd13702(0x21a)]),console[_0xd13702(0x271)]('\x20\x20'+_0x219b1d),console[_0xd13702(0x271)]('\x0a'+a22_0x3237f9['dim'](_0xd13702(0x292))+_0xd13702(0x2fa)+_0x28e746[_0xd13702(0x21a)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x27d);[a22_0x46b216(0x28c)]=a22_0x46b216(0x277);async[a22_0x46b216(0x2b5)](_0x1b9d18){const _0x45c51e=a22_0x46b216,{options:_0xf26f0f,args:_0x579ecd,tdx:_0x567b54}=_0x1b9d18,_0x462dc4=_0x579ecd[0x0]||_0xf26f0f[_0x45c51e(0x20b)];if(!_0x462dc4)return showParentSegmentNotSetError(_0x45c51e(0x269)+_0x45c51e(0x236)),0x1;_0xf26f0f['verbose']&&(console['error'](_0x45c51e(0x304)+_0xf26f0f[_0x45c51e(0x259)]),console[_0x45c51e(0x271)]('Parent\x20segment:\x20'+_0x462dc4));const _0x48c288=await withSpinner(_0x45c51e(0x27b)+_0x462dc4+_0x45c51e(0x220),()=>_0x567b54[_0x45c51e(0x2c1)][_0x45c51e(0x2d4)](_0x462dc4),{'verbose':_0xf26f0f[_0x45c51e(0x224)]}),_0x11b5b9=_0x48c288[_0x45c51e(0x28f)];console[_0x45c51e(0x271)]('✔\x20Found\x20'+_0x11b5b9['length']+_0x45c51e(0x21f)+(_0x11b5b9['length']!==0x1?'s':''));if(_0xf26f0f[_0x45c51e(0x23d)]||_0xf26f0f[_0x45c51e(0x287)])return await handleSDKOutput(_0x11b5b9,_0xf26f0f),0x0;return displayFieldsHumanReadable(_0x11b5b9,_0x462dc4),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']='segment:parent:view';[a22_0x46b216(0x28c)]='Show\x20parent\x20segment\x20details';async[a22_0x46b216(0x2b5)](_0x36377a){const _0x1b591b=a22_0x46b216,{options:_0x1d09f9,args:_0x1bd069,tdx:_0xdff7b7}=_0x36377a,_0x2b178e=_0x1d09f9,_0x3822fd=_0x1bd069[0x0]||_0x1d09f9['parentSegment'];if(!_0x3822fd)return showParentSegmentNotSetError(_0x1b591b(0x1ef)+_0x1b591b(0x2ed)+_0x1b591b(0x25b)+_0x1b591b(0x255)),0x1;_0x1d09f9[_0x1b591b(0x224)]&&(console[_0x1b591b(0x271)](_0x1b591b(0x304)+_0x1d09f9[_0x1b591b(0x259)]),console['error']('Parent\x20segment:\x20'+_0x3822fd));const _0x1c3dae=await withSpinner(_0x1b591b(0x2ac)+_0x3822fd+_0x1b591b(0x220),()=>_0xdff7b7[_0x1b591b(0x2c1)][_0x1b591b(0x2aa)](_0x3822fd),{'verbose':_0x1d09f9[_0x1b591b(0x224)]}),_0x373196=_0x1c3dae[_0x1b591b(0x28f)];if(_0x2b178e['web']){const _0x17d06a=getConsoleNextUrl(_0x2b178e['site'],_0x1b591b(0x26a)+_0x373196['id']);return console[_0x1b591b(0x271)](a22_0x3237f9[_0x1b591b(0x237)]('✔')+_0x1b591b(0x265)+a22_0x3237f9[_0x1b591b(0x2cc)](_0x17d06a)),openBrowser(_0x17d06a),0x0;}return await handleSingleObjectOutput(_0x373196,_0x1d09f9),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2b0);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a22_0x46b216(0x2b5)](_0xd4e168){const _0x4748fc=a22_0x46b216,{options:_0x2d7c33,args:_0xe3a917,tdx:_0x2570c1}=_0xd4e168,_0x2b8e6a=_0x2d7c33,_0x2b9bed=_0xe3a917[0x0]||_0x2d7c33[_0x4748fc(0x20b)];if(!_0x2b9bed)return showParentSegmentNotSetError(_0x4748fc(0x2be)+_0x4748fc(0x2b4)+_0x4748fc(0x25b)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x2d7c33[_0x4748fc(0x224)]&&(console['error'](_0x4748fc(0x304)+_0x2d7c33[_0x4748fc(0x259)]),console[_0x4748fc(0x271)]('Parent\x20segment:\x20'+_0x2b9bed));const _0x24892d=await withSpinner(_0x4748fc(0x213)+_0x2b9bed+_0x4748fc(0x220),()=>_0x2570c1[_0x4748fc(0x2c1)]['resolveParentId'](_0x2b9bed),{'verbose':_0x2d7c33[_0x4748fc(0x224)]}),_0x45d60b=_0x24892d[_0x4748fc(0x28f)],_0x558591=_0x2570c1[_0x4748fc(0x2c1)][_0x4748fc(0x221)](_0x45d60b);if(_0x2b8e6a[_0x4748fc(0x202)]){const _0x562ca3=await this[_0x4748fc(0x24d)](_0xd4e168,_0x2b9bed,_0x45d60b,_0x558591),_0x37ba0e=this[_0x4748fc(0x322)](_0x562ca3);writeFileSync(_0x2b8e6a[_0x4748fc(0x202)],_0x37ba0e);const _0x179c17=_0x562ca3[_0x4748fc(0x291)][_0x4748fc(0x331)][_0x4748fc(0x2f8)]+_0x562ca3[_0x4748fc(0x300)][_0x4748fc(0x2df)]((_0x23ce02,_0x12c233)=>_0x23ce02+_0x12c233['columns'][_0x4748fc(0x2f8)],0x0),_0x45a5d3=_0x562ca3[_0x4748fc(0x300)][_0x4748fc(0x2e8)](_0x5a832e=>_0x5a832e['columns'][_0x4748fc(0x2f8)]===0x0)[_0x4748fc(0x2f8)];return console['log'](_0x4748fc(0x2d9)+_0x2b8e6a[_0x4748fc(0x202)]),console[_0x4748fc(0x32b)](_0x4748fc(0x2ce)+_0x558591),console[_0x4748fc(0x32b)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x562ca3[_0x4748fc(0x300)][_0x4748fc(0x2f8)]+_0x4748fc(0x32d)),console[_0x4748fc(0x32b)]('\x20\x20Columns:\x20'+_0x179c17+'\x20total'),_0x45a5d3>0x0&&console[_0x4748fc(0x32b)]('\x20\x20Note:\x20'+_0x45a5d3+_0x4748fc(0x22f)),0x0;}console[_0x4748fc(0x271)]('\x0a'+a22_0x3237f9['bold'](_0x4748fc(0x264))+'\x20'+a22_0x3237f9[_0x4748fc(0x2cc)](_0x558591));const _0x4c3ae7=await withSpinner(_0x4748fc(0x2c8),()=>_0x2570c1[_0x4748fc(0x2c1)][_0x4748fc(0x25d)](_0x45d60b),{'verbose':_0x2d7c33[_0x4748fc(0x224)]});console['error']('\x0a'+a22_0x3237f9[_0x4748fc(0x25e)]('customers')+'\x20'+a22_0x3237f9['dim']('('+_0x558591+_0x4748fc(0x328)));const _0x14b44f=await executeSchemaQuery(_0x4c3ae7[_0x4748fc(0x28f)],_0x2570c1,_0x2d7c33);await handleQueryOutput(_0x14b44f,_0x2d7c33);const _0x412205=await withSpinner(_0x4748fc(0x22e),()=>_0x2570c1[_0x4748fc(0x2c1)]['getBehaviorNames'](_0x45d60b),{'verbose':_0x2d7c33[_0x4748fc(0x224)]});for(const _0x466f88 of _0x412205['data']){const _0x4fd323='behavior_'+_0x466f88[_0x4748fc(0x28a)]()[_0x4748fc(0x320)](/\s+/g,'_'),_0x5b2a6b='SELECT\x20*\x20FROM\x20'+_0x558591+'.'+_0x4fd323;console[_0x4748fc(0x271)]('\x0a'+a22_0x3237f9['bold'](_0x466f88)+'\x20'+a22_0x3237f9[_0x4748fc(0x253)]('('+_0x558591+'.'+_0x4fd323+')'));try{const _0x45e00b=await executeSchemaQuery(_0x5b2a6b,_0x2570c1,_0x2d7c33);await handleQueryOutput(_0x45e00b,_0x2d7c33);}catch{console['error'](a22_0x3237f9['yellow'](_0x4748fc(0x25c)));}}return 0x0;}async[a22_0x46b216(0x24d)](_0x42e418,_0x527b6c,_0x32de30,_0x2fceae){const _0x5d7f53=a22_0x46b216,{options:_0x331948,tdx:_0x2c9220}=_0x42e418,_0x443135=await withSpinner(_0x5d7f53(0x2c8),()=>_0x2c9220[_0x5d7f53(0x2c1)]['getParentSQL'](_0x32de30),{'verbose':_0x331948[_0x5d7f53(0x224)]}),_0x5a6836=await executeSchemaQuery(_0x443135[_0x5d7f53(0x28f)],_0x2c9220,_0x331948),_0x1b13a5=_0x5a6836[_0x5d7f53(0x28f)][_0x5d7f53(0x288)](_0x1fa86f=>({'name':_0x1fa86f['column_name'],'type':_0x1fa86f[_0x5d7f53(0x2f2)]})),_0x46a0e3=await withSpinner(_0x5d7f53(0x22e),()=>_0x2c9220[_0x5d7f53(0x2c1)][_0x5d7f53(0x2f0)](_0x32de30),{'verbose':_0x331948[_0x5d7f53(0x224)]}),_0xf10163=[];for(const _0x4172b4 of _0x46a0e3[_0x5d7f53(0x28f)]){const _0x29bdde=_0x5d7f53(0x23b)+_0x4172b4[_0x5d7f53(0x28a)]()[_0x5d7f53(0x320)](/\s+/g,'_'),_0x2d6728='SELECT\x20*\x20FROM\x20'+_0x2fceae+'.'+_0x29bdde;let _0x4bc119=[];try{const _0x2312e0=await executeSchemaQuery(_0x2d6728,_0x2c9220,_0x331948);_0x4bc119=_0x2312e0[_0x5d7f53(0x28f)][_0x5d7f53(0x288)](_0x11860f=>({'name':_0x11860f['column_name'],'type':_0x11860f[_0x5d7f53(0x2f2)]}));}catch{}_0xf10163[_0x5d7f53(0x227)]({'table':_0x29bdde,'columns':_0x4bc119});}return{'database':_0x2fceae,'parent_segment':_0x527b6c,'parent_id':_0x32de30,'customers':{'table':_0x5d7f53(0x291),'columns':_0x1b13a5},'behaviors':_0xf10163};}[a22_0x46b216(0x322)](_0x293442){const _0x5a970f=a22_0x46b216,_0x4bd3e3=_0x3699d6=>{const _0xfafbc4=a22_0xd58f;if(_0x3699d6['length']===0x0)return'[]';const _0x231d9c=_0x3699d6[_0xfafbc4(0x288)](_0x2ea6b5=>_0xfafbc4(0x27f)+_0x2ea6b5[_0xfafbc4(0x228)]+_0xfafbc4(0x2ec)+_0x2ea6b5[_0xfafbc4(0x32c)]+'\x22\x20}');return'[\x0a'+_0x231d9c[_0xfafbc4(0x1ec)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x128265=_0x293442[_0x5a970f(0x300)][_0x5a970f(0x288)](_0x566c0e=>{const _0x3a87bc=_0x5a970f;return _0x3a87bc(0x2ba)+_0x566c0e[_0x3a87bc(0x2d8)]+_0x3a87bc(0x2fd)+_0x4bd3e3(_0x566c0e['columns'])['replace'](/^/gm,'\x20\x20')['trim']()+_0x3a87bc(0x250);})[_0x5a970f(0x1ec)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x293442[_0x5a970f(0x316)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x293442[_0x5a970f(0x248)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x293442['parent_id']+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x293442[_0x5a970f(0x291)][_0x5a970f(0x2d8)]+_0x5a970f(0x29e)+_0x4bd3e3(_0x293442[_0x5a970f(0x291)][_0x5a970f(0x331)])[_0x5a970f(0x320)](/^/gm,'\x20\x20')[_0x5a970f(0x2f5)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x128265+_0x5a970f(0x323);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0x46b216(0x28d);[a22_0x46b216(0x28c)]=a22_0x46b216(0x2e1);async[a22_0x46b216(0x2b5)](_0x239b95){const _0x529731=a22_0x46b216,{options:_0x3d8cc4,args:_0x3c3ed2,tdx:_0x470d9f}=_0x239b95,_0x155014=_0x3c3ed2[0x0]||_0x3d8cc4[_0x529731(0x20b)];if(!_0x155014)return showParentSegmentNotSetError(_0x529731(0x2a7)+_0x529731(0x23f)),0x1;_0x3d8cc4[_0x529731(0x224)]&&(console['error'](_0x529731(0x304)+_0x3d8cc4[_0x529731(0x259)]),console[_0x529731(0x271)](_0x529731(0x1f0)+_0x155014));const _0x4d0034=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x155014+'\x27...',()=>_0x470d9f[_0x529731(0x2c1)][_0x529731(0x21c)](_0x155014),{'verbose':_0x3d8cc4['verbose']}),_0x25193f=_0x4d0034[_0x529731(0x28f)],_0x4c0787=await withSpinner(_0x529731(0x284)+_0x155014+_0x529731(0x220),()=>_0x470d9f['segment'][_0x529731(0x25d)](_0x25193f),{'verbose':_0x3d8cc4['verbose']}),_0x280d0b=_0x4c0787[_0x529731(0x28f)];return _0x3d8cc4['format']===_0x529731(0x23d)||_0x3d8cc4[_0x529731(0x256)]===_0x529731(0x287)?await handleSDKOutput([{'sql':_0x280d0b}],_0x3d8cc4):console[_0x529731(0x32b)](_0x280d0b),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2da);[a22_0x46b216(0x28c)]=a22_0x46b216(0x234);async['execute'](_0x574afa){const _0x32fc83=a22_0x46b216,{options:_0x1cb753,args:_0x463292,tdx:_0x4fff31}=_0x574afa,_0x68ef21=_0x463292[0x0]||_0x1cb753[_0x32fc83(0x20b)];if(!_0x68ef21)return showParentSegmentNotSetError(_0x32fc83(0x2ae)+'\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;_0x1cb753[_0x32fc83(0x224)]&&(console['error'](_0x32fc83(0x304)+_0x1cb753['site']),console[_0x32fc83(0x271)](_0x32fc83(0x1f0)+_0x68ef21));const _0x5662e8=await withSpinner(_0x32fc83(0x213)+_0x68ef21+_0x32fc83(0x220),()=>_0x4fff31[_0x32fc83(0x2c1)][_0x32fc83(0x21c)](_0x68ef21),{'verbose':_0x1cb753[_0x32fc83(0x224)]}),_0x3a9242=_0x5662e8['data'],_0x5b9ed9=await withSpinner(_0x32fc83(0x284)+_0x68ef21+_0x32fc83(0x220),()=>_0x4fff31[_0x32fc83(0x2c1)]['getParentSQL'](_0x3a9242),{'verbose':_0x1cb753[_0x32fc83(0x224)]});let _0x5d83fc=_0x5b9ed9[_0x32fc83(0x28f)];const _0x3918ed=resolveLimit(_0x1cb753[_0x32fc83(0x318)],DEFAULT_DISPLAY_LIMIT),_0x310247=/\bLIMIT\s+\d+/i[_0x32fc83(0x201)](_0x5d83fc);!_0x310247&&(_0x5d83fc=_0x5d83fc[_0x32fc83(0x2f5)]()['replace'](/;+$/,''),_0x5d83fc=_0x32fc83(0x1f3)+_0x5d83fc+_0x32fc83(0x22a)+_0x3918ed);_0x1cb753[_0x32fc83(0x224)]&&console[_0x32fc83(0x271)](_0x32fc83(0x2ab)+_0x5d83fc);const _0x5ec92d=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x3fa84d=>{const _0x1ee7e5=_0x32fc83,_0x581ec7=await _0x4fff31[_0x1ee7e5(0x276)][_0x1ee7e5(0x2b5)](_0x5d83fc,{'catalog':'td','schema':_0x1ee7e5(0x2f7),'onJobId':_0x42a67b=>{const _0x3d35fc=_0x1ee7e5;_0x3fa84d[_0x3d35fc(0x2fc)](_0x42a67b);}});return _0x581ec7;},{'verbose':_0x1cb753['verbose']}),_0x20a7d7=_0x5ec92d['data'],_0x5009b4=_0x20a7d7[_0x32fc83(0x296)]?_0x32fc83(0x2c5)+_0x20a7d7['jobId']+']':'';return console['error'](_0x32fc83(0x1f7)+_0x20a7d7['stats'][_0x32fc83(0x333)][_0x32fc83(0x27e)]()+_0x32fc83(0x2d1)+(_0x32fc83(0x317)+formatElapsed(_0x20a7d7[_0x32fc83(0x25a)]['elapsedTimeMillis'])+_0x5009b4)),await handleQueryOutput(_0x20a7d7,_0x1cb753),0x0;}}
1
+ const a22_0x59b92d=a22_0xcfb4;(function(_0x59905d,_0x41cebe){const _0x464a46=a22_0xcfb4,_0x209971=_0x59905d();while(!![]){try{const _0x56ea80=parseInt(_0x464a46(0x2b5))/0x1*(-parseInt(_0x464a46(0x2b4))/0x2)+-parseInt(_0x464a46(0x1e9))/0x3+-parseInt(_0x464a46(0x23f))/0x4*(-parseInt(_0x464a46(0x218))/0x5)+-parseInt(_0x464a46(0x224))/0x6*(parseInt(_0x464a46(0x1d7))/0x7)+-parseInt(_0x464a46(0x27d))/0x8+parseInt(_0x464a46(0x2ae))/0x9+parseInt(_0x464a46(0x27b))/0xa;if(_0x56ea80===_0x41cebe)break;else _0x209971['push'](_0x209971['shift']());}catch(_0x5adb69){_0x209971['push'](_0x209971['shift']());}}}(a22_0x2b5a,0x6a4e9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x575f81 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x2c7678 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=a22_0x59b92d(0x21f),LEGACY_PARENT_SEGMENT_DIR=a22_0x59b92d(0x2ce);function openBrowser(_0x4f0a5e){const _0x1d3d2d=a22_0x59b92d,_0x4565e2=process[_0x1d3d2d(0x24c)],_0x1b34ef=_0x4565e2===_0x1d3d2d(0x1cd)?_0x1d3d2d(0x2e9):_0x4565e2===_0x1d3d2d(0x1db)?_0x1d3d2d(0x308):'xdg-open';spawn(_0x1b34ef,[_0x4f0a5e],{'detached':!![],'stdio':_0x1d3d2d(0x25b)})[_0x1d3d2d(0x289)]();}function migrateLegacyDirectory(){const _0x231585=a22_0x59b92d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4c3a87=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4c3a87['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x2f7)](_0x231585(0x212)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x231585(0x28e))),console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x2e3)](_0x231585(0x2e7)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x231585(0x298)](a22_0x2c7678['yellow'](_0x231585(0x2cb)+LEGACY_PARENT_SEGMENT_DIR+_0x231585(0x2b0)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x290)](_0x231585(0x2bb)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x18c5a4){const _0x3efa53=_0x18c5a4 instanceof Error?_0x18c5a4[_0x231585(0x1e6)]:String(_0x18c5a4);return console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x1f8)](_0x231585(0x1dd)+_0x3efa53+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x59b92d(0x2d6)](_0x395f01){return migrateLegacyDirectory(),super['run'](_0x395f01);}}function resolveYamlFile(_0xd8bc1b){const _0x5420cc=a22_0x59b92d;if(_0xd8bc1b[_0x5420cc(0x252)](_0x5420cc(0x1f1))||_0xd8bc1b[_0x5420cc(0x252)](_0x5420cc(0x2d5)))return _0xd8bc1b;return a22_0x575f81[_0x5420cc(0x271)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd8bc1b)+_0x5420cc(0x1f1));}function formatProgressMessage(_0x3b3c2f){const _0x2c5a0e=a22_0x59b92d,_0x3ac700=_0x3b3c2f['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3ac700){const [,_0x427eef,_0x817fb1,_0x55bf67='']=_0x3ac700;return a22_0x2c7678[_0x2c5a0e(0x2e3)](_0x427eef+':')+'\x20'+_0x817fb1+a22_0x2c7678[_0x2c5a0e(0x2e3)](_0x55bf67);}return a22_0x2c7678[_0x2c5a0e(0x2e3)](_0x3b3c2f);}function showFileNotFoundError(_0x3f5977,_0x3eeda6){const _0xdddaca=a22_0x59b92d;console[_0xdddaca(0x298)](a22_0x2c7678[_0xdddaca(0x1f8)]('Error:\x20File\x20not\x20found:\x20'+_0x3f5977+'\x0a')),console['error'](a22_0x2c7678['cyan'](_0xdddaca(0x1dc)+_0x3eeda6+_0xdddaca(0x226)));}function showParentSegmentNotSetError(_0x49d484){const _0x3e0311=a22_0x59b92d;console[_0x3e0311(0x298)](a22_0x2c7678[_0x3e0311(0x2f7)](_0x3e0311(0x1e8))),console['error'](_0x49d484);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]='segment:parent:list';['description']=a22_0x59b92d(0x2e4);async[a22_0x59b92d(0x317)](_0xdc3010){const _0x522c24=a22_0x59b92d,{options:_0x5efd8e,args:_0x456b9a,tdx:_0x8eff6f}=_0xdc3010,_0x3cfde2=_0x456b9a[0x0];_0x5efd8e[_0x522c24(0x1fe)]&&(console[_0x522c24(0x298)](_0x522c24(0x265)+_0x5efd8e[_0x522c24(0x260)]),_0x3cfde2&&console[_0x522c24(0x298)]('Pattern:\x20'+_0x3cfde2));const _0x43d3b1=await withSpinner(_0x3cfde2?_0x522c24(0x295)+_0x3cfde2+'\x27...':_0x522c24(0x25c),()=>_0x8eff6f['segment']['listParents'](),{'verbose':_0x5efd8e[_0x522c24(0x1fe)]});let _0x4bc42d=_0x43d3b1['data'];if(_0x3cfde2){const _0x2bf824=_0x3cfde2[_0x522c24(0x2fb)](/[.+^${}()|[\]\\]/g,_0x522c24(0x2c1))[_0x522c24(0x2fb)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2c8dd2=new RegExp('^'+_0x2bf824+'$','i');_0x4bc42d=_0x4bc42d['filter'](_0x289648=>_0x2c8dd2[_0x522c24(0x256)](_0x289648[_0x522c24(0x21e)][_0x522c24(0x2ff)]));}_0x4bc42d['sort']((_0x1097e0,_0x21f7e8)=>_0x1097e0[_0x522c24(0x21e)][_0x522c24(0x2ff)]['localeCompare'](_0x21f7e8['attributes']['name'])),console[_0x522c24(0x298)]('✔\x20Found\x20'+_0x4bc42d[_0x522c24(0x269)]+_0x522c24(0x2a0)+(_0x4bc42d[_0x522c24(0x269)]!==0x1?'s':''));const _0x1beaf7=_0xce12b8=>{const _0x2b4880=_0x522c24;return getConsoleNextUrl(_0x5efd8e[_0x2b4880(0x260)],_0x2b4880(0x314)+_0xce12b8);};if(_0x5efd8e[_0x522c24(0x21b)]===_0x522c24(0x204)||_0x5efd8e[_0x522c24(0x21b)]===_0x522c24(0x2d2)){const _0x4a19dd=_0x4bc42d[_0x522c24(0x2d0)](_0x35b5d6=>({..._0x35b5d6,'url':_0x1beaf7(_0x35b5d6['id'])}));await handleSDKOutput(_0x4a19dd,_0x5efd8e);}else{if(_0x4bc42d[_0x522c24(0x269)]===0x0)_0x3cfde2?console[_0x522c24(0x1f3)](_0x522c24(0x2ed)+_0x3cfde2):console['log'](_0x522c24(0x222));else for(const _0x4d887b of _0x4bc42d){const _0x15f61d=_0x4d887b[_0x522c24(0x21e)]['population']?a22_0x2c7678[_0x522c24(0x2e3)]('\x20('+formatRows(_0x4d887b[_0x522c24(0x21e)][_0x522c24(0x1d8)])+')'):'',_0x33d31d=hyperlink(_0x4d887b[_0x522c24(0x21e)][_0x522c24(0x2ff)],_0x1beaf7(_0x4d887b['id']));console['log'](_0x522c24(0x2ea)+_0x33d31d+_0x15f61d);}}return 0x0;}}function a22_0xcfb4(_0x9ac7c2,_0x52d742){_0x9ac7c2=_0x9ac7c2-0x1ca;const _0x2b5a92=a22_0x2b5a();let _0xcfb41e=_0x2b5a92[_0x9ac7c2];return _0xcfb41e;}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x201);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x305);async[a22_0x59b92d(0x317)](_0x16da33){const _0x4789f4=a22_0x59b92d,{options:_0x57b3b2,args:_0x12c2c8,tdx:_0x1d112f}=_0x16da33;console[_0x4789f4(0x298)](_0x4789f4(0x1cf)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4789f4(0x1ef));const _0x148329=_0x57b3b2;if(_0x12c2c8[_0x4789f4(0x269)]===0x0)return console[_0x4789f4(0x298)](a22_0x2c7678[_0x4789f4(0x1f8)](_0x4789f4(0x279))),console[_0x4789f4(0x298)](_0x4789f4(0x1fb)),0x1;const _0x49119d=_0x12c2c8[0x0];if(!_0x148329[_0x4789f4(0x22e)]||!_0x148329[_0x4789f4(0x2a1)])return console[_0x4789f4(0x298)](_0x4789f4(0x273)),console[_0x4789f4(0x298)](_0x4789f4(0x1fb)),0x1;_0x148329['verbose']&&(console['error'](_0x4789f4(0x265)+_0x148329[_0x4789f4(0x260)]),console[_0x4789f4(0x298)](_0x4789f4(0x2ba)+_0x49119d),console['error'](_0x4789f4(0x213)+_0x148329[_0x4789f4(0x22e)]),console[_0x4789f4(0x298)](_0x4789f4(0x211)+_0x148329[_0x4789f4(0x2a1)]));const _0x1ab6ed=await loadJSONFromOptions(_0x148329['attributes'],_0x148329[_0x4789f4(0x1e5)]),_0x200d6b=await loadJSONFromOptions(_0x148329['behaviors'],_0x148329['behaviorsFile']),_0x1eaad4=await loadJSONFromOptions(_0x148329[_0x4789f4(0x2aa)],_0x148329[_0x4789f4(0x2f0)]),_0x290901={'name':_0x49119d,'description':_0x148329[_0x4789f4(0x2de)],'scheduleType':_0x148329['scheduleType'],'scheduleOption':_0x148329[_0x4789f4(0x1e7)],'timezone':_0x148329[_0x4789f4(0x2f1)],'master':{'parentDatabaseName':_0x148329[_0x4789f4(0x22e)],'parentTableName':_0x148329[_0x4789f4(0x2a1)]},'attributes':_0x1ab6ed,'behaviors':_0x200d6b,'customerGroup':_0x1eaad4},_0x522f4a=await withSpinner(_0x4789f4(0x1ca)+_0x49119d+_0x4789f4(0x1df),()=>_0x1d112f[_0x4789f4(0x282)]['createParent'](_0x290901),{'verbose':_0x57b3b2['verbose']}),_0x58c7c6=_0x522f4a[_0x4789f4(0x2fc)];return console['error'](_0x4789f4(0x2e1)+_0x58c7c6['name']+_0x4789f4(0x2d3)+_0x58c7c6['id']),await handleSDKOutput([_0x58c7c6],_0x57b3b2),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]='segment:parent:update';[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x2e0);async[a22_0x59b92d(0x317)](_0x41dc7e){const _0x13443f=a22_0x59b92d,{options:_0x5d64ac,args:_0x33a50a,tdx:_0x57e299}=_0x41dc7e;console['error'](_0x13443f(0x267)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x13443f(0x1ef));const _0x4e478f=_0x5d64ac;if(_0x33a50a[_0x13443f(0x269)]===0x0)return console[_0x13443f(0x298)](a22_0x2c7678[_0x13443f(0x1f8)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x13443f(0x298)](_0x13443f(0x1e2)),0x1;const _0x55a21f=_0x33a50a[0x0];_0x4e478f[_0x13443f(0x1fe)]&&(console['error']('Site:\x20'+_0x4e478f[_0x13443f(0x260)]),console['error']('Parent\x20segment:\x20'+_0x55a21f));const _0x451aab=await withSpinner(_0x13443f(0x1f6)+_0x55a21f+_0x13443f(0x1df),()=>_0x57e299[_0x13443f(0x282)][_0x13443f(0x25e)](_0x55a21f),{'verbose':_0x4e478f[_0x13443f(0x1fe)]}),_0x258dff=_0x451aab[_0x13443f(0x2fc)],_0x1da6b8=await loadJSONFromOptions(_0x4e478f['addAttributes'],_0x4e478f[_0x13443f(0x239)]),_0x22fb83=await loadJSONFromOptions(_0x4e478f[_0x13443f(0x253)],_0x4e478f[_0x13443f(0x1d3)]),_0x4d3885={'name':_0x258dff[_0x13443f(0x2ff)],'description':_0x4e478f[_0x13443f(0x2de)]!==undefined?_0x4e478f[_0x13443f(0x2de)]:_0x258dff['description'],'scheduleType':_0x4e478f[_0x13443f(0x27f)]!==undefined?_0x4e478f[_0x13443f(0x27f)]:_0x258dff['scheduleType'],'scheduleOption':_0x4e478f[_0x13443f(0x1e7)]!==undefined?_0x4e478f[_0x13443f(0x1e7)]:_0x258dff[_0x13443f(0x1e7)],'timezone':_0x4e478f[_0x13443f(0x2f1)]!==undefined?_0x4e478f[_0x13443f(0x2f1)]:_0x258dff[_0x13443f(0x2f1)],'master':_0x258dff[_0x13443f(0x287)],'attributes':_0x1da6b8?[..._0x258dff[_0x13443f(0x21e)]||[],..._0x1da6b8]:_0x258dff[_0x13443f(0x21e)],'behaviors':_0x22fb83?[..._0x258dff[_0x13443f(0x2dd)]||[],..._0x22fb83]:_0x258dff[_0x13443f(0x2dd)],'customerGroup':_0x258dff[_0x13443f(0x2aa)]},_0x317d67=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x55a21f+'\x27...',()=>_0x57e299[_0x13443f(0x282)]['updateParent'](_0x55a21f,_0x4d3885),{'verbose':_0x4e478f[_0x13443f(0x1fe)]}),_0x44b142=_0x317d67['data'];return console['error'](_0x13443f(0x291)+_0x44b142[_0x13443f(0x2ff)]+'\x27'),await handleSDKOutput([_0x44b142],_0x4e478f),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';[a22_0x59b92d(0x2de)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x59b92d(0x317)](_0x2406d1){const _0x4a22da=a22_0x59b92d,{options:_0x2023e5,args:_0x282af6,tdx:_0x2b3191}=_0x2406d1,_0x5e64c0=_0x2023e5,_0xeb6d5e=_0x282af6[0x0]||_0x2023e5[_0x4a22da(0x30f)];if(!_0xeb6d5e)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'+_0x4a22da(0x30e)),0x1;if(_0x5e64c0[_0x4a22da(0x286)]&&_0x5e64c0[_0x4a22da(0x225)])return console[_0x4a22da(0x298)](a22_0x2c7678['red'](_0x4a22da(0x2e5))),console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x2e3)](_0x4a22da(0x2e8))),console[_0x4a22da(0x298)](a22_0x2c7678['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x4a22da(0x1fd))),console[_0x4a22da(0x298)](a22_0x2c7678['cyan']('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x2e3e60=_0x5e64c0[_0x4a22da(0x225)]||a22_0x575f81[_0x4a22da(0x271)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xeb6d5e)+'.yml');_0x5e64c0[_0x4a22da(0x1fe)]&&(console[_0x4a22da(0x298)](_0x4a22da(0x265)+_0x5e64c0[_0x4a22da(0x260)]),console[_0x4a22da(0x298)](_0x4a22da(0x1cc)+_0xeb6d5e),console['error'](_0x4a22da(0x26c)+_0x2e3e60));const _0x514479=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xeb6d5e+_0x4a22da(0x1df),()=>_0x2b3191[_0x4a22da(0x282)]['pullParentYaml'](_0xeb6d5e),{'verbose':_0x5e64c0[_0x4a22da(0x1fe)]}),_0x338449=_0x514479['data'];if(existsSync(_0x2e3e60)){const _0x3f160b=readFileSync(_0x2e3e60,_0x4a22da(0x25f)),_0x27fee1=generateDiff(_0x3f160b,_0x338449);if(!hasChanges(_0x27fee1))console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x290)]('✔')+_0x4a22da(0x2dc)+a22_0x2c7678[_0x4a22da(0x24b)](_0x2e3e60)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x4a22da(0x298)]('\x0aChanges\x20to\x20\x27'+_0x2e3e60+'\x27:'),console[_0x4a22da(0x298)]('─'[_0x4a22da(0x2d7)](0x3c)),console[_0x4a22da(0x298)](formatDiffWithColors(_0x27fee1)),console['error']('─'[_0x4a22da(0x2d7)](0x3c));if(!_0x5e64c0[_0x4a22da(0x215)]){if(!isInteractive())return console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x1f8)](_0x4a22da(0x1ec)),_0x4a22da(0x23e)),console[_0x4a22da(0x298)](a22_0x2c7678['dim'](_0x4a22da(0x207))),0x1;const _0x56fed7=await confirmKey(_0x4a22da(0x285)+_0x2e3e60+'\x27?');if(!_0x56fed7)return console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x2f7)](_0x4a22da(0x216))),0x1;}writeFileSync(_0x2e3e60,_0x338449,'utf-8'),console['error'](a22_0x2c7678['green']('✔')+_0x4a22da(0x2d1)+a22_0x2c7678['cyan'](_0x2e3e60));}}else{const _0x1624f0=a22_0x575f81[_0x4a22da(0x2b9)](_0x2e3e60);!existsSync(_0x1624f0)&&mkdirSync(_0x1624f0,{'recursive':!![]}),writeFileSync(_0x2e3e60,_0x338449,_0x4a22da(0x25f)),console['error'](a22_0x2c7678[_0x4a22da(0x290)]('✔')+_0x4a22da(0x2d1)+a22_0x2c7678[_0x4a22da(0x24b)](_0x2e3e60));}return saveSessionContext({'parent_segment':_0xeb6d5e},_0x5e64c0[_0x4a22da(0x250)]),console['error'](a22_0x2c7678[_0x4a22da(0x290)]('✔')+_0x4a22da(0x28d)+a22_0x2c7678[_0x4a22da(0x2e3)](_0x4a22da(0x2ce))+_0x4a22da(0x230)+a22_0x2c7678[_0x4a22da(0x24b)](_0xeb6d5e)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x2c7);['description']=a22_0x59b92d(0x2ac);async[a22_0x59b92d(0x317)](_0x291c37){const _0x259b16=a22_0x59b92d,{options:_0x3124a8,args:_0x2bda1a,tdx:_0x57fa31}=_0x291c37,_0x5c0fbf=_0x3124a8,_0x55a674=_0x2bda1a[0x0]||_0x3124a8[_0x259b16(0x30f)];if(!_0x55a674)return showParentSegmentNotSetError(_0x259b16(0x221)+_0x259b16(0x266)),0x1;const _0x5f5036=resolveYamlFile(_0x55a674);if(!existsSync(_0x5f5036))return showFileNotFoundError(_0x5f5036,_0x55a674),0x1;_0x5c0fbf[_0x259b16(0x1fe)]&&(console[_0x259b16(0x298)]('Site:\x20'+_0x5c0fbf['site']),console[_0x259b16(0x298)](_0x259b16(0x2a9)+_0x5f5036));let _0x377bb7;try{_0x377bb7=readFileSync(_0x5f5036,_0x259b16(0x25f));}catch(_0x42709f){const _0x76d26e=_0x42709f instanceof Error?_0x42709f[_0x259b16(0x1e6)]:String(_0x42709f);return console[_0x259b16(0x298)](_0x259b16(0x205)+_0x76d26e),0x1;}const _0xe8c159=await withSpinner('Analyzing\x20changes...',()=>_0x57fa31[_0x259b16(0x282)][_0x259b16(0x29e)](_0x377bb7),{'verbose':_0x5c0fbf[_0x259b16(0x1fe)]}),_0x19a5a7=_0xe8c159[_0x259b16(0x2fc)],{isNew:_0x5f3097,name:_0x34e145,hasChanges:_0x1f5019,diffFormatted:_0x476848}=_0x19a5a7;if(!_0x1f5019)return console[_0x259b16(0x298)](_0x259b16(0x2c0)+_0x34e145+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x5f3097?console[_0x259b16(0x298)](_0x259b16(0x231)+_0x34e145+'\x27:'):console[_0x259b16(0x298)](_0x259b16(0x240)+_0x34e145+'\x27:');console[_0x259b16(0x298)]('─'[_0x259b16(0x2d7)](0x3c)),console['error'](_0x476848),console[_0x259b16(0x298)]('─'[_0x259b16(0x2d7)](0x3c));const _0x254629=_0x5f3097?_0x259b16(0x30c)+_0x34e145+'\x27?':_0x259b16(0x1f5)+_0x34e145+'\x27?';if(!_0x5c0fbf[_0x259b16(0x215)]){if(!isInteractive())return console[_0x259b16(0x298)](a22_0x2c7678[_0x259b16(0x1f8)]('\x0aError:'),_0x259b16(0x23e)),console[_0x259b16(0x298)](a22_0x2c7678[_0x259b16(0x2e3)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x416865=await confirmKey(_0x254629);if(!_0x416865)return console[_0x259b16(0x298)](a22_0x2c7678['yellow'](_0x259b16(0x216))),0x1;}const _0x82c160=_0x5f3097?'Creating':_0x259b16(0x30d),_0x3810c6=await withSpinner(_0x82c160+_0x259b16(0x246)+_0x34e145+'\x27...',()=>_0x19a5a7[_0x259b16(0x268)](),{'verbose':_0x5c0fbf['verbose']}),_0x4ab191=_0x3810c6[_0x259b16(0x2fc)],_0xccead6=getConsoleNextUrl(_0x5c0fbf[_0x259b16(0x260)],_0x259b16(0x314)+_0x4ab191['id']),_0x4874d2=_0x5f3097?_0x259b16(0x2b7):_0x259b16(0x301);return console['error']('✔\x20'+_0x4874d2+_0x259b16(0x246)+_0x4ab191['name']+'\x27'),console[_0x259b16(0x298)]('\x20\x20'+_0xccead6),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x1f2);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x25d);async[a22_0x59b92d(0x317)](_0x228717){const _0x478dea=a22_0x59b92d,{options:_0x6477ab,args:_0x1dee1e,tdx:_0x2062c6}=_0x228717,_0x1674c6=_0x6477ab,_0x8431f6=_0x1dee1e[0x0]||_0x6477ab['parentSegment'];if(!_0x8431f6)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'+_0x478dea(0x1e1)+_0x478dea(0x30b)+_0x478dea(0x234)+_0x478dea(0x300)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1da047=resolveYamlFile(_0x8431f6);if(!existsSync(_0x1da047))return showFileNotFoundError(_0x1da047,_0x8431f6),0x1;_0x1674c6[_0x478dea(0x1fe)]&&(console[_0x478dea(0x298)](_0x478dea(0x265)+_0x1674c6[_0x478dea(0x260)]),console['error']('YAML\x20file:\x20'+_0x1da047));let _0x9a334f;try{_0x9a334f=readFileSync(_0x1da047,_0x478dea(0x25f));}catch(_0x752d01){const _0x31d80d=_0x752d01 instanceof Error?_0x752d01[_0x478dea(0x1e6)]:String(_0x752d01);return console[_0x478dea(0x298)](_0x478dea(0x205)+_0x31d80d),0x1;}const _0x4a5849=createCommandSpinner(a22_0x2c7678[_0x478dea(0x2e3)]('Validating\x20configuration...'),{'verbose':_0x1674c6['verbose']});_0x4a5849['start']();const _0x22a918={'onProgress':_0x17567c=>{_0x4a5849['text']=formatProgressMessage(_0x17567c);}};if(_0x1674c6[_0x478dea(0x287)])_0x22a918[_0x478dea(0x287)]=!![];if(_0x1674c6['enriched'])_0x22a918[_0x478dea(0x1fc)]=!![];_0x1674c6[_0x478dea(0x2f3)]&&(_0x22a918['attribute']=_0x1674c6[_0x478dea(0x2f3)]);_0x1674c6[_0x478dea(0x2df)]&&(_0x22a918[_0x478dea(0x2df)]=_0x1674c6['behavior']);if(_0x1674c6[_0x478dea(0x208)])_0x22a918[_0x478dea(0x208)]=_0x1674c6[_0x478dea(0x208)];let _0x3f676b;try{_0x3f676b=await _0x2062c6[_0x478dea(0x282)][_0x478dea(0x2a7)](_0x9a334f,_0x22a918),_0x4a5849[_0x478dea(0x2eb)]();}catch(_0xe00dc9){_0x4a5849[_0x478dea(0x2eb)]();throw _0xe00dc9;}const _0x39ec2a=_0x1674c6[_0x478dea(0x208)]||'-1d';return this[_0x478dea(0x241)](_0x3f676b,_0x22a918,_0x1da047,_0x39ec2a),_0x3f676b[_0x478dea(0x223)]?0x0:0x1;}[a22_0x59b92d(0x241)](_0x54e965,_0x382c69,_0x51920f,_0x26bb54){const _0x5d4b8c=a22_0x59b92d;console[_0x5d4b8c(0x298)]('\x0a'+a22_0x2c7678[_0x5d4b8c(0x2ab)](_0x5d4b8c(0x302))+'\x20'+_0x54e965[_0x5d4b8c(0x2ff)]),console[_0x5d4b8c(0x298)]('═'[_0x5d4b8c(0x2d7)](0x3c)),this['displayMasterInfo'](_0x54e965);if(typeof _0x382c69[_0x5d4b8c(0x2f3)]===_0x5d4b8c(0x24f)){this[_0x5d4b8c(0x2ec)](_0x54e965),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,_0x5d4b8c(0x2f3),_0x382c69[_0x5d4b8c(0x2f3)]);return;}if(_0x382c69[_0x5d4b8c(0x2f3)]===!![]){this[_0x5d4b8c(0x2ec)](_0x54e965),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,'attributes');return;}if(typeof _0x382c69[_0x5d4b8c(0x2df)]===_0x5d4b8c(0x24f)){this[_0x5d4b8c(0x1f4)](_0x54e965,_0x26bb54),this['displaySummary'](_0x54e965),this['displayPreviewHints'](_0x51920f,_0x26bb54,_0x5d4b8c(0x2df),_0x382c69['behavior']);return;}if(_0x382c69[_0x5d4b8c(0x2df)]===!![]){this['displayBehaviorsStats'](_0x54e965,_0x26bb54),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,_0x5d4b8c(0x2dd));return;}this[_0x5d4b8c(0x2ec)](_0x54e965),this['displayBehaviorsStats'](_0x54e965,_0x26bb54),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,_0x5d4b8c(0x220));}[a22_0x59b92d(0x1d1)](_0x560f76,_0x3cf710,_0x1b3d5d,_0x3b67f1){const _0x5ea420=a22_0x59b92d;console['error']('\x0a'+a22_0x2c7678[_0x5ea420(0x2e3)]('To\x20view\x20sample\x20data:'));const _0x125cde=_0x3cf710!==_0x5ea420(0x2f9)?_0x5ea420(0x242)+_0x3cf710:'';if(_0x1b3d5d==='attribute'&&_0x3b67f1)console[_0x5ea420(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)]('tdx\x20segment\x20parent\x20preview\x20'+_0x560f76+_0x5ea420(0x235)+_0x3b67f1+'\x22'+_0x125cde));else{if(_0x1b3d5d===_0x5ea420(0x2df)&&_0x3b67f1)console[_0x5ea420(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x2b3)+_0x3b67f1+'\x22'+_0x125cde));else(_0x1b3d5d===_0x5ea420(0x21e)||_0x1b3d5d===_0x5ea420(0x220))&&console['error']('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x274)+_0x125cde));}(_0x1b3d5d===_0x5ea420(0x2dd)||_0x1b3d5d===_0x5ea420(0x220))&&console[_0x5ea420(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x294)+_0x125cde)),_0x1b3d5d==='all'&&console['error']('\x20\x20'+a22_0x2c7678['dim'](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x23a)+_0x125cde));}[a22_0x59b92d(0x297)](_0x1d01dc){const _0x2f6a1b=a22_0x59b92d,{master:_0x2540b1}=_0x1d01dc,_0x286bac=_0x2540b1['schemaValid']?a22_0x2c7678[_0x2f6a1b(0x290)]('✔'):a22_0x2c7678[_0x2f6a1b(0x1f8)]('✘');console[_0x2f6a1b(0x298)]('\x0a'+a22_0x2c7678[_0x2f6a1b(0x2e3)](_0x2f6a1b(0x272))),console['error'](_0x286bac+'\x20'+a22_0x2c7678['bold'](_0x2540b1[_0x2f6a1b(0x22e)]+'.'+_0x2540b1[_0x2f6a1b(0x2a1)])),_0x2540b1[_0x2f6a1b(0x1f9)]?_0x2540b1[_0x2f6a1b(0x2d8)]!==undefined&&console[_0x2f6a1b(0x298)]('\x20\x20'+a22_0x2c7678[_0x2f6a1b(0x2e3)](_0x2f6a1b(0x214))+'\x20'+a22_0x2c7678['cyan'](formatRows(_0x2540b1['rowCount']))):console[_0x2f6a1b(0x298)]('\x20\x20'+a22_0x2c7678[_0x2f6a1b(0x1f8)](_0x2f6a1b(0x28c))+'\x20'+_0x2540b1['schemaError']);}[a22_0x59b92d(0x2ec)](_0x5224fc){const _0x257aa=a22_0x59b92d;if(_0x5224fc[_0x257aa(0x21e)][_0x257aa(0x269)]===0x0)return;console[_0x257aa(0x298)]('\x0a'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x2c9)));for(const _0x17903b of _0x5224fc[_0x257aa(0x21e)]){const _0xe21380=_0x17903b[_0x257aa(0x1f9)]?a22_0x2c7678[_0x257aa(0x290)]('✔'):a22_0x2c7678[_0x257aa(0x1f8)]('✘');let _0x370713='';if(_0x17903b[_0x257aa(0x1f9)]&&_0x17903b[_0x257aa(0x304)]!==undefined&&_0x17903b[_0x257aa(0x2fa)]!==undefined){const _0x4e8ca0=_0x17903b[_0x257aa(0x2fa)][_0x257aa(0x2a8)](0x1),_0x5b9b9d=_0x17903b[_0x257aa(0x2fa)]>=0x50?a22_0x2c7678[_0x257aa(0x290)]:_0x17903b['coveragePercent']>=0x32?a22_0x2c7678['yellow']:a22_0x2c7678[_0x257aa(0x1f8)];_0x370713='\x20'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x210))+'\x20'+_0x5b9b9d(_0x4e8ca0+'%')+'\x20('+formatRows(_0x17903b[_0x257aa(0x304)])+'\x20rows)';}console[_0x257aa(0x298)](_0xe21380+'\x20'+a22_0x2c7678[_0x257aa(0x2ab)](_0x17903b[_0x257aa(0x2ff)])+_0x370713),console[_0x257aa(0x298)]('\x20\x20'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x20b))+'\x20'+a22_0x2c7678['bold'](_0x17903b[_0x257aa(0x22e)]+'.'+_0x17903b['table']));const _0x473295=_0x17903b['joinKey']===_0x17903b['foreignKey']?a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x217))+'\x20'+_0x17903b[_0x257aa(0x29f)]:a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x276))+'\x20'+_0x17903b[_0x257aa(0x29f)]+_0x257aa(0x230)+_0x17903b['foreignKey'];console[_0x257aa(0x298)]('\x20\x20'+_0x473295),console[_0x257aa(0x298)]('\x20\x20'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x258))),this[_0x257aa(0x2b6)](_0x17903b[_0x257aa(0x1ce)]),!_0x17903b[_0x257aa(0x1f9)]&&console[_0x257aa(0x298)]('\x20\x20'+a22_0x2c7678[_0x257aa(0x1f8)]('Error:')+'\x20'+_0x17903b[_0x257aa(0x1d5)]);}}[a22_0x59b92d(0x1f4)](_0x227bba,_0x4064ec){const _0x2473a7=a22_0x59b92d;if(_0x227bba[_0x2473a7(0x2dd)][_0x2473a7(0x269)]===0x0)return;console['error']('\x0a'+a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x238))+'\x20'+a22_0x2c7678[_0x2473a7(0x2e3)]('('+_0x4064ec+')'));for(const _0x27836f of _0x227bba[_0x2473a7(0x2dd)]){const _0x14f5e1=_0x27836f[_0x2473a7(0x1f9)]?a22_0x2c7678[_0x2473a7(0x290)]('✔'):a22_0x2c7678[_0x2473a7(0x1f8)]('✘');let _0x408281='';if(_0x27836f[_0x2473a7(0x1f9)]&&_0x27836f[_0x2473a7(0x27a)]!==undefined&&_0x27836f[_0x2473a7(0x29d)]!==undefined){const _0x254607=_0x27836f['customerPercent']?.[_0x2473a7(0x2a8)](0x1)||'?',_0xf25a5c=(_0x27836f[_0x2473a7(0x1d4)]??0x0)>=0x32?a22_0x2c7678[_0x2473a7(0x290)]:(_0x27836f[_0x2473a7(0x1d4)]??0x0)>=0x14?a22_0x2c7678[_0x2473a7(0x2f7)]:a22_0x2c7678[_0x2473a7(0x1f8)];_0x408281='\x20'+a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x2a3))+'\x20'+_0xf25a5c(formatRows(_0x27836f['customersWithEvents']))+'\x20('+_0x254607+_0x2473a7(0x24d)+a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x23d))+'\x20'+a22_0x2c7678[_0x2473a7(0x24b)](formatRows(_0x27836f[_0x2473a7(0x29d)]));}console[_0x2473a7(0x298)](_0x14f5e1+'\x20'+a22_0x2c7678[_0x2473a7(0x2ab)](_0x27836f[_0x2473a7(0x2ff)])+_0x408281),console[_0x2473a7(0x298)]('\x20\x20'+a22_0x2c7678[_0x2473a7(0x2e3)]('Source:')+'\x20'+a22_0x2c7678[_0x2473a7(0x2ab)](_0x27836f[_0x2473a7(0x22e)]+'.'+_0x27836f[_0x2473a7(0x2a1)]));const _0x5d4c2f=_0x27836f['joinKey']===_0x27836f[_0x2473a7(0x2f8)]?a22_0x2c7678['dim']('Join\x20on:')+'\x20'+_0x27836f[_0x2473a7(0x29f)]:a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x276))+'\x20'+_0x27836f[_0x2473a7(0x29f)]+'\x20=\x20'+_0x27836f[_0x2473a7(0x2f8)];console['error']('\x20\x20'+_0x5d4c2f),console['error']('\x20\x20'+a22_0x2c7678[_0x2473a7(0x2e3)]('Columns:')),this[_0x2473a7(0x2b6)](_0x27836f[_0x2473a7(0x1ce)]),!_0x27836f[_0x2473a7(0x1f9)]&&console[_0x2473a7(0x298)]('\x20\x20'+a22_0x2c7678[_0x2473a7(0x1f8)]('Error:')+'\x20'+_0x27836f[_0x2473a7(0x1d5)]);}}[a22_0x59b92d(0x2b6)](_0x3ad136){const _0x49d5b0=a22_0x59b92d;for(const _0x3abb8e of _0x3ad136){_0x3abb8e[_0x49d5b0(0x1eb)]===_0x3abb8e[_0x49d5b0(0x2bd)]||_0x3abb8e[_0x49d5b0(0x2bd)]==='*'?console[_0x49d5b0(0x298)]('\x20\x20\x20\x20-\x20'+_0x3abb8e['label']):console[_0x49d5b0(0x298)]('\x20\x20\x20\x20-\x20'+_0x3abb8e[_0x49d5b0(0x1eb)]+'\x20'+a22_0x2c7678[_0x49d5b0(0x2e3)]('('+_0x3abb8e[_0x49d5b0(0x2bd)]+')'));}}[a22_0x59b92d(0x2cf)](_0x5a0550){const _0x316d8d=a22_0x59b92d;console['error']('─'[_0x316d8d(0x2d7)](0x3c));if(_0x5a0550[_0x316d8d(0x1ff)][_0x316d8d(0x269)]>0x0){console[_0x316d8d(0x298)]('\x0a'+a22_0x2c7678[_0x316d8d(0x1f8)]('Errors:'));for(const _0x15d2b7 of _0x5a0550[_0x316d8d(0x1ff)]){console[_0x316d8d(0x298)]('\x20\x20'+a22_0x2c7678[_0x316d8d(0x1f8)]('•')+'\x20'+_0x15d2b7);}}_0x5a0550[_0x316d8d(0x223)]&&console['error']('\x0a'+a22_0x2c7678[_0x316d8d(0x290)]('✔')+_0x316d8d(0x1d9));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a22_0x59b92d(0x288);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x284);async[a22_0x59b92d(0x317)](_0x5e2676){const _0x5ced27=a22_0x59b92d,{options:_0x5c1e70,args:_0x459eea,tdx:_0x3e7db1}=_0x5e2676,_0x488aa1=_0x5c1e70,_0x552b85=_0x459eea[0x0]||_0x5c1e70[_0x5ced27(0x30f)];if(!_0x552b85)return showParentSegmentNotSetError(_0x5ced27(0x277)+_0x5ced27(0x21a)+_0x5ced27(0x1d6)+_0x5ced27(0x27e)+_0x5ced27(0x262)+_0x5ced27(0x21c)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x5ced27(0x202)),0x1;if(!_0x488aa1['master']&&!_0x488aa1[_0x5ced27(0x2f3)]&&!_0x488aa1[_0x5ced27(0x2df)]&&!_0x488aa1[_0x5ced27(0x1fc)])return console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x307))),console['error'](_0x5ced27(0x20d)),console[_0x5ced27(0x298)](_0x5ced27(0x28f)),console[_0x5ced27(0x298)](_0x5ced27(0x24a)),console[_0x5ced27(0x298)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x5ced27(0x298)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5ced27(0x298)](_0x5ced27(0x228)),0x1;const _0x181231=resolveYamlFile(_0x552b85);if(!existsSync(_0x181231))return showFileNotFoundError(_0x181231,_0x552b85),0x1;_0x488aa1[_0x5ced27(0x1fe)]&&(console['error'](_0x5ced27(0x265)+_0x488aa1[_0x5ced27(0x260)]),console[_0x5ced27(0x298)](_0x5ced27(0x2a9)+_0x181231));let _0x32ffdc;try{_0x32ffdc=readFileSync(_0x181231,_0x5ced27(0x25f));}catch(_0x315d74){const _0x37d35a=_0x315d74 instanceof Error?_0x315d74['message']:String(_0x315d74);return console[_0x5ced27(0x298)](_0x5ced27(0x205)+_0x37d35a),0x1;}let _0x33a69b;try{_0x33a69b=parseDef(_0x32ffdc);}catch(_0x41625c){const _0x49a4df=_0x41625c instanceof Error?_0x41625c['message']:String(_0x41625c);return console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x22c)+_0x49a4df)),0x1;}if(_0x488aa1[_0x5ced27(0x2f3)]===!![]||_0x488aa1['attribute']===''){const _0x595102=_0x33a69b['attributes']?.[_0x5ced27(0x2d0)](_0x3b319a=>_0x3b319a[_0x5ced27(0x2ff)])||[];if(_0x595102['length']===0x0)console[_0x5ced27(0x298)](a22_0x2c7678['red'](_0x5ced27(0x26d)));else{console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x5ced27(0x298)](_0x5ced27(0x26f));for(const _0x18faf1 of _0x595102){console[_0x5ced27(0x298)]('\x20\x20'+a22_0x2c7678['cyan'](_0x18faf1));}console[_0x5ced27(0x298)](_0x5ced27(0x248)+_0x552b85+_0x5ced27(0x235)+_0x595102[0x0]+'\x22');}return 0x1;}if(_0x488aa1['behavior']===!![]||_0x488aa1[_0x5ced27(0x2df)]===''){const _0x2470b9=_0x33a69b['behaviors']?.['map'](_0x1f7e71=>_0x1f7e71[_0x5ced27(0x2ff)])||[];if(_0x2470b9['length']===0x0)console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x1e3)));else{console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x1e0))),console[_0x5ced27(0x298)](_0x5ced27(0x2b8));for(const _0x28cc64 of _0x2470b9){console[_0x5ced27(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ced27(0x24b)](_0x28cc64));}console[_0x5ced27(0x298)](_0x5ced27(0x248)+_0x552b85+_0x5ced27(0x2b3)+_0x2470b9[0x0]+'\x22');}return 0x1;}const _0x1405ea=createCommandSpinner(a22_0x2c7678[_0x5ced27(0x2e3)](_0x5ced27(0x2a2)),{'verbose':_0x488aa1[_0x5ced27(0x1fe)]});_0x1405ea[_0x5ced27(0x308)]();const _0x25916f={'onProgress':_0x5c5d26=>{const _0x3a30f9=_0x5ced27;_0x1405ea[_0x3a30f9(0x26b)]=formatProgressMessage(_0x5c5d26);}};if(_0x488aa1[_0x5ced27(0x287)])_0x25916f[_0x5ced27(0x287)]=!![];if(_0x488aa1['attribute']&&typeof _0x488aa1['attribute']===_0x5ced27(0x24f))_0x25916f['attribute']=_0x488aa1[_0x5ced27(0x2f3)];if(_0x488aa1[_0x5ced27(0x2df)]&&typeof _0x488aa1[_0x5ced27(0x2df)]===_0x5ced27(0x24f))_0x25916f[_0x5ced27(0x2df)]=_0x488aa1[_0x5ced27(0x2df)];if(_0x488aa1[_0x5ced27(0x1fc)])_0x25916f['enriched']=!![];if(_0x488aa1[_0x5ced27(0x208)])_0x25916f[_0x5ced27(0x208)]=_0x488aa1[_0x5ced27(0x208)];let _0x5531cf;try{_0x5531cf=await _0x3e7db1[_0x5ced27(0x282)][_0x5ced27(0x29b)](_0x32ffdc,_0x25916f),_0x1405ea['stop']();}catch(_0x113bf7){_0x1405ea[_0x5ced27(0x2eb)]();throw _0x113bf7;}return await this[_0x5ced27(0x261)](_0x5531cf,{'master':_0x488aa1['master'],'attribute':typeof _0x488aa1[_0x5ced27(0x2f3)]===_0x5ced27(0x24f)?_0x488aa1['attribute']:undefined,'behavior':typeof _0x488aa1[_0x5ced27(0x2df)]===_0x5ced27(0x24f)?_0x488aa1['behavior']:undefined,'enriched':_0x488aa1['enriched']}),_0x5531cf[_0x5ced27(0x223)]?0x0:0x1;}async[a22_0x59b92d(0x261)](_0x1a0295,_0x5a14ea){const _0x3b76cc=a22_0x59b92d;console[_0x3b76cc(0x298)]('\x0a'+a22_0x2c7678['bold']('Preview:')+'\x20'+_0x1a0295['name']),console[_0x3b76cc(0x298)]('═'[_0x3b76cc(0x2d7)](0x3c));if(_0x5a14ea[_0x3b76cc(0x287)]&&_0x1a0295[_0x3b76cc(0x1f0)]){const _0x23683d=a22_0x2c7678[_0x3b76cc(0x2e3)](_0x3b76cc(0x227))+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x1a0295['master'][_0x3b76cc(0x22e)]+'.'+_0x1a0295[_0x3b76cc(0x287)][_0x3b76cc(0x2a1)]);await this[_0x3b76cc(0x2c6)](_0x23683d,_0x1a0295['sampleData']);}else{if(_0x5a14ea[_0x3b76cc(0x2f3)]&&_0x1a0295[_0x3b76cc(0x1f0)]){const _0x495149=a22_0x2c7678['dim'](_0x3b76cc(0x2d9))+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x5a14ea[_0x3b76cc(0x2f3)]);await this[_0x3b76cc(0x2c6)](_0x495149,_0x1a0295['sampleData']);}else{if(_0x5a14ea[_0x3b76cc(0x2df)]&&_0x1a0295['sampleData']){const _0x3d21bc=a22_0x2c7678[_0x3b76cc(0x2e3)](_0x3b76cc(0x278))+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x5a14ea[_0x3b76cc(0x2df)]);await this[_0x3b76cc(0x2c6)](_0x3d21bc,_0x1a0295[_0x3b76cc(0x1f0)]);}else{if(_0x5a14ea['enriched']&&_0x1a0295[_0x3b76cc(0x1f0)]){const _0x54eb5d=a22_0x2c7678[_0x3b76cc(0x2e3)]('Enriched:')+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x3b76cc(0x281));await this[_0x3b76cc(0x2c6)](_0x54eb5d,_0x1a0295['sampleData']);}else!_0x1a0295[_0x3b76cc(0x1f0)]&&console[_0x3b76cc(0x298)](_0x3b76cc(0x251));}}}if(_0x1a0295['errors']['length']>0x0){console['error']('─'[_0x3b76cc(0x2d7)](0x3c)),console['error']('\x0a'+a22_0x2c7678[_0x3b76cc(0x1f8)]('Errors:'));for(const _0x1d6c87 of _0x1a0295[_0x3b76cc(0x1ff)]){console[_0x3b76cc(0x298)]('\x20\x20'+a22_0x2c7678['red']('•')+'\x20'+_0x1d6c87);}}}async[a22_0x59b92d(0x2c6)](_0x2b801b,_0x1ec48c){const _0x2396d9=a22_0x59b92d;if(_0x1ec48c[_0x2396d9(0x269)]===0x0){console['error']('\x0a'+_0x2b801b),console[_0x2396d9(0x298)](_0x2396d9(0x1d0));return;}console[_0x2396d9(0x298)]('\x0a'+_0x2b801b);const _0x327152=Object['keys'](_0x1ec48c[0x0])[_0x2396d9(0x2d0)](_0x4fd6cf=>({'name':_0x4fd6cf,'type':typeof _0x1ec48c[0x0][_0x4fd6cf]===_0x2396d9(0x2fd)?_0x2396d9(0x296):'varchar'})),_0x2b7ab6={'queryId':'preview','columns':_0x327152,'data':_0x1ec48c,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1ec48c[_0x2396d9(0x269)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x35040e=formatAsTable(_0x2b7ab6,_0x1ec48c[_0x2396d9(0x269)],!![]);await writeOutput(_0x35040e,undefined,_0x2396d9(0x2a1));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a22_0x59b92d(0x303);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x232);async['execute'](_0x3ef879){const _0x4fcffe=a22_0x59b92d,{options:_0xd22d21,args:_0x2419d9,tdx:_0x898b00}=_0x3ef879,_0x295e86=_0xd22d21,_0x5a5a79=_0x2419d9[0x0]||_0xd22d21[_0x4fcffe(0x30f)];if(!_0x5a5a79)return showParentSegmentNotSetError(_0x4fcffe(0x1f7)+_0x4fcffe(0x255)),0x1;const _0x27cded=resolveYamlFile(_0x5a5a79);if(existsSync(_0x27cded)){_0x295e86['verbose']&&console[_0x4fcffe(0x298)](_0x4fcffe(0x259)+_0x27cded);let _0xdda556;try{_0xdda556=readFileSync(_0x27cded,_0x4fcffe(0x25f));}catch(_0x1f5535){const _0x5cbeab=_0x1f5535 instanceof Error?_0x1f5535[_0x4fcffe(0x1e6)]:String(_0x1f5535);return console[_0x4fcffe(0x298)](_0x4fcffe(0x205)+_0x5cbeab),0x1;}const _0x380dd3=await withSpinner('Analyzing\x20changes...',()=>_0x898b00['segment'][_0x4fcffe(0x29e)](_0xdda556),{'verbose':_0x295e86[_0x4fcffe(0x1fe)]}),_0x502f22=_0x380dd3[_0x4fcffe(0x2fc)],{isNew:_0x15472c,name:_0x3521be,hasChanges:_0x237379,diffFormatted:_0x4c21dd}=_0x502f22;if(_0x237379){_0x15472c?console[_0x4fcffe(0x298)](_0x4fcffe(0x231)+_0x3521be+'\x27:'):console[_0x4fcffe(0x298)](_0x4fcffe(0x240)+_0x3521be+'\x27:');console[_0x4fcffe(0x298)]('─'[_0x4fcffe(0x2d7)](0x3c)),console['error'](_0x4c21dd),console[_0x4fcffe(0x298)]('─'['repeat'](0x3c));const _0x5dee96=_0x15472c?_0x4fcffe(0x30c)+_0x3521be+_0x4fcffe(0x2be):_0x4fcffe(0x1f5)+_0x3521be+_0x4fcffe(0x2be);if(!_0x295e86[_0x4fcffe(0x215)]){if(!isInteractive())return console[_0x4fcffe(0x298)](a22_0x2c7678[_0x4fcffe(0x1f8)](_0x4fcffe(0x1ec)),_0x4fcffe(0x23e)),console[_0x4fcffe(0x298)](a22_0x2c7678[_0x4fcffe(0x2e3)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x521b6b=await confirmKey(_0x5dee96);if(!_0x521b6b)return console[_0x4fcffe(0x298)](a22_0x2c7678[_0x4fcffe(0x2f7)]('Aborted.')),0x1;}const _0x3052d5=_0x15472c?'Creating':'Updating';await withSpinner(_0x3052d5+'\x20parent\x20segment\x20\x27'+_0x3521be+_0x4fcffe(0x1df),()=>_0x502f22['apply'](),{'verbose':_0x295e86['verbose']});const _0x4ec596=_0x15472c?_0x4fcffe(0x2b7):_0x4fcffe(0x301);console[_0x4fcffe(0x298)]('✔\x20'+_0x4ec596+'\x20parent\x20segment\x20\x27'+_0x3521be+'\x27');}else console[_0x4fcffe(0x298)]('✔\x20No\x20changes\x20-\x20\x27'+_0x3521be+_0x4fcffe(0x22f));}const _0x13d791=await withSpinner(_0x4fcffe(0x299)+_0x5a5a79+_0x4fcffe(0x1df),()=>_0x898b00[_0x4fcffe(0x282)][_0x4fcffe(0x30a)](_0x5a5a79),{'verbose':_0x295e86['verbose']}),_0x25a50c=_0x13d791[_0x4fcffe(0x2fc)],_0x253a13=getConsoleUrl(_0x295e86[_0x4fcffe(0x260)],'/app/workflows/'+_0x25a50c[_0x4fcffe(0x29a)]+'/sessions/'+_0x25a50c['workflowSessionId']+_0x4fcffe(0x2c4)+_0x25a50c['workflowAttemptId']);return console[_0x4fcffe(0x298)](_0x4fcffe(0x2d4)),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678[_0x4fcffe(0x2e3)]('Audience\x20ID:')+'\x20'+_0x25a50c[_0x4fcffe(0x2da)]),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678[_0x4fcffe(0x2e3)]('Status:')+'\x20'+_0x25a50c[_0x4fcffe(0x313)]),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678[_0x4fcffe(0x2e3)](_0x4fcffe(0x22a))+'\x20'+_0x25a50c[_0x4fcffe(0x29c)]),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678['dim'](_0x4fcffe(0x264))+'\x20'+_0x25a50c[_0x4fcffe(0x2cc)]),console[_0x4fcffe(0x298)]('\x20\x20'+_0x253a13),console[_0x4fcffe(0x298)]('\x0a'+a22_0x2c7678[_0x4fcffe(0x2e3)](_0x4fcffe(0x2ca))+'\x20tdx\x20wf\x20attempt\x20'+_0x25a50c['workflowAttemptId']+_0x4fcffe(0x2f2)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]='segment:parent:fields';['description']=a22_0x59b92d(0x20c);async[a22_0x59b92d(0x317)](_0x4a5bd5){const _0x3fb831=a22_0x59b92d,{options:_0x2711c8,args:_0x1f8a9d,tdx:_0x4427b2}=_0x4a5bd5,_0x246ada=_0x1f8a9d[0x0]||_0x2711c8['parentSegment'];if(!_0x246ada)return showParentSegmentNotSetError(_0x3fb831(0x236)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x2711c8[_0x3fb831(0x1fe)]&&(console[_0x3fb831(0x298)]('Site:\x20'+_0x2711c8['site']),console[_0x3fb831(0x298)](_0x3fb831(0x1cc)+_0x246ada));const _0x256be2=await withSpinner(_0x3fb831(0x233)+_0x246ada+_0x3fb831(0x1df),()=>_0x4427b2[_0x3fb831(0x282)]['listFields'](_0x246ada),{'verbose':_0x2711c8[_0x3fb831(0x1fe)]}),_0x135a7e=_0x256be2['data'];console[_0x3fb831(0x298)](_0x3fb831(0x1ea)+_0x135a7e[_0x3fb831(0x269)]+_0x3fb831(0x275)+(_0x135a7e[_0x3fb831(0x269)]!==0x1?'s':''));if(_0x2711c8[_0x3fb831(0x204)]||_0x2711c8[_0x3fb831(0x2d2)])return await handleSDKOutput(_0x135a7e,_0x2711c8),0x0;return displayFieldsHumanReadable(_0x135a7e,_0x246ada),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a22_0x59b92d(0x2a4);[a22_0x59b92d(0x2de)]='Show\x20parent\x20segment\x20details';async[a22_0x59b92d(0x317)](_0x293659){const _0x2531be=a22_0x59b92d,{options:_0x23d6e6,args:_0x3c5c7b,tdx:_0x65c1f4}=_0x293659,_0x331327=_0x23d6e6,_0x400025=_0x3c5c7b[0x0]||_0x23d6e6[_0x2531be(0x30f)];if(!_0x400025)return showParentSegmentNotSetError(_0x2531be(0x315)+_0x2531be(0x306)+_0x2531be(0x30b)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x23d6e6[_0x2531be(0x1fe)]&&(console['error']('Site:\x20'+_0x23d6e6[_0x2531be(0x260)]),console[_0x2531be(0x298)](_0x2531be(0x1cc)+_0x400025));const _0x10907b=await withSpinner(_0x2531be(0x27c)+_0x400025+_0x2531be(0x1df),()=>_0x65c1f4[_0x2531be(0x282)][_0x2531be(0x25e)](_0x400025),{'verbose':_0x23d6e6[_0x2531be(0x1fe)]}),_0x4be1d3=_0x10907b[_0x2531be(0x2fc)];if(_0x331327[_0x2531be(0x22d)]){const _0x41851c=getConsoleNextUrl(_0x331327[_0x2531be(0x260)],'/app/dw/parentSegments/'+_0x4be1d3['id']);return console[_0x2531be(0x298)](a22_0x2c7678[_0x2531be(0x290)]('✔')+_0x2531be(0x2bf)+a22_0x2c7678[_0x2531be(0x24b)](_0x41851c)),openBrowser(_0x41851c),0x0;}return await handleSingleObjectOutput(_0x4be1d3,_0x23d6e6),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x1e4);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x283);async[a22_0x59b92d(0x317)](_0x46f5db){const _0x2a5b01=a22_0x59b92d,{options:_0x5a4b60,args:_0x55c341,tdx:_0x2c1dd9}=_0x46f5db,_0x261326=_0x5a4b60,_0x38e403=_0x55c341[0x0]||_0x5a4b60[_0x2a5b01(0x30f)];if(!_0x38e403)return showParentSegmentNotSetError(_0x2a5b01(0x28a)+_0x2a5b01(0x26e)+_0x2a5b01(0x30b)+_0x2a5b01(0x2b2)),0x1;_0x5a4b60[_0x2a5b01(0x1fe)]&&(console[_0x2a5b01(0x298)](_0x2a5b01(0x265)+_0x5a4b60[_0x2a5b01(0x260)]),console[_0x2a5b01(0x298)](_0x2a5b01(0x1cc)+_0x38e403));const _0x1a1484=await withSpinner(_0x2a5b01(0x2f4)+_0x38e403+'\x27...',()=>_0x2c1dd9[_0x2a5b01(0x282)][_0x2a5b01(0x2af)](_0x38e403),{'verbose':_0x5a4b60[_0x2a5b01(0x1fe)]}),_0x39bfd3=_0x1a1484[_0x2a5b01(0x2fc)],_0x4d5b43=_0x2c1dd9[_0x2a5b01(0x282)][_0x2a5b01(0x257)](_0x39bfd3);if(_0x261326[_0x2a5b01(0x225)]){const _0x247523=await this[_0x2a5b01(0x293)](_0x46f5db,_0x38e403,_0x39bfd3,_0x4d5b43),_0x3fb6c9=this['formatSchemaJson'](_0x247523);writeFileSync(_0x261326[_0x2a5b01(0x225)],_0x3fb6c9);const _0x594a48=_0x247523[_0x2a5b01(0x20f)]['columns'][_0x2a5b01(0x269)]+_0x247523[_0x2a5b01(0x2dd)][_0x2a5b01(0x219)]((_0x3147e5,_0x3e2836)=>_0x3147e5+_0x3e2836[_0x2a5b01(0x1ce)]['length'],0x0),_0x185723=_0x247523[_0x2a5b01(0x2dd)]['filter'](_0x1de8a5=>_0x1de8a5[_0x2a5b01(0x1ce)][_0x2a5b01(0x269)]===0x0)[_0x2a5b01(0x269)];return console[_0x2a5b01(0x1f3)](_0x2a5b01(0x2bc)+_0x261326[_0x2a5b01(0x225)]),console['log'](_0x2a5b01(0x245)+_0x4d5b43),console[_0x2a5b01(0x1f3)](_0x2a5b01(0x25a)+_0x247523[_0x2a5b01(0x2dd)]['length']+'\x20behaviors'),console[_0x2a5b01(0x1f3)]('\x20\x20Columns:\x20'+_0x594a48+_0x2a5b01(0x23c)),_0x185723>0x0&&console[_0x2a5b01(0x1f3)](_0x2a5b01(0x1cb)+_0x185723+_0x2a5b01(0x247)),0x0;}console['error']('\x0a'+a22_0x2c7678[_0x2a5b01(0x2ab)]('Output\x20Database:')+'\x20'+a22_0x2c7678['cyan'](_0x4d5b43));const _0x42b8d6=await withSpinner(_0x2a5b01(0x244),()=>_0x2c1dd9[_0x2a5b01(0x282)][_0x2a5b01(0x2b1)](_0x39bfd3),{'verbose':_0x5a4b60[_0x2a5b01(0x1fe)]});console[_0x2a5b01(0x298)]('\x0a'+a22_0x2c7678[_0x2a5b01(0x2ab)](_0x2a5b01(0x20f))+'\x20'+a22_0x2c7678['dim']('('+_0x4d5b43+_0x2a5b01(0x263)));const _0x84e72=await executeSchemaQuery(_0x42b8d6[_0x2a5b01(0x2fc)],_0x2c1dd9,_0x5a4b60);await handleQueryOutput(_0x84e72,_0x5a4b60);const _0xc4fd7d=await withSpinner(_0x2a5b01(0x249),()=>_0x2c1dd9['segment'][_0x2a5b01(0x2ad)](_0x39bfd3),{'verbose':_0x5a4b60[_0x2a5b01(0x1fe)]});for(const _0x18918f of _0xc4fd7d['data']){const _0x3efb9e=_0x2a5b01(0x292)+_0x18918f['toLowerCase']()[_0x2a5b01(0x2fb)](/\s+/g,'_'),_0x47b371=_0x2a5b01(0x1ed)+_0x4d5b43+'.'+_0x3efb9e;console[_0x2a5b01(0x298)]('\x0a'+a22_0x2c7678[_0x2a5b01(0x2ab)](_0x18918f)+'\x20'+a22_0x2c7678[_0x2a5b01(0x2e3)]('('+_0x4d5b43+'.'+_0x3efb9e+')'));try{const _0x138102=await executeSchemaQuery(_0x47b371,_0x2c1dd9,_0x5a4b60);await handleQueryOutput(_0x138102,_0x5a4b60);}catch{console[_0x2a5b01(0x298)](a22_0x2c7678[_0x2a5b01(0x2f7)](_0x2a5b01(0x203)));}}return 0x0;}async[a22_0x59b92d(0x293)](_0x273ed7,_0x3092c0,_0x5dd399,_0x518539){const _0x4e0ef0=a22_0x59b92d,{options:_0x8286d9,tdx:_0x3c59cb}=_0x273ed7,_0x55d72f=await withSpinner(_0x4e0ef0(0x244),()=>_0x3c59cb[_0x4e0ef0(0x282)][_0x4e0ef0(0x2b1)](_0x5dd399),{'verbose':_0x8286d9['verbose']}),_0x5010c7=await executeSchemaQuery(_0x55d72f[_0x4e0ef0(0x2fc)],_0x3c59cb,_0x8286d9),_0x5ae401=_0x5010c7[_0x4e0ef0(0x2fc)][_0x4e0ef0(0x2d0)](_0x14a3cc=>({'name':_0x14a3cc[_0x4e0ef0(0x318)],'type':_0x14a3cc[_0x4e0ef0(0x1d2)]})),_0x427d03=await withSpinner(_0x4e0ef0(0x249),()=>_0x3c59cb[_0x4e0ef0(0x282)][_0x4e0ef0(0x2ad)](_0x5dd399),{'verbose':_0x8286d9[_0x4e0ef0(0x1fe)]}),_0x3b76aa=[];for(const _0x43460e of _0x427d03[_0x4e0ef0(0x2fc)]){const _0x183dd7=_0x4e0ef0(0x292)+_0x43460e['toLowerCase']()[_0x4e0ef0(0x2fb)](/\s+/g,'_'),_0xd8f374=_0x4e0ef0(0x1ed)+_0x518539+'.'+_0x183dd7;let _0x2bcc40=[];try{const _0x597b97=await executeSchemaQuery(_0xd8f374,_0x3c59cb,_0x8286d9);_0x2bcc40=_0x597b97[_0x4e0ef0(0x2fc)][_0x4e0ef0(0x2d0)](_0x1f4014=>({'name':_0x1f4014[_0x4e0ef0(0x318)],'type':_0x1f4014['column_type']}));}catch{}_0x3b76aa[_0x4e0ef0(0x1da)]({'table':_0x183dd7,'columns':_0x2bcc40});}return{'database':_0x518539,'parent_segment':_0x3092c0,'parent_id':_0x5dd399,'customers':{'table':_0x4e0ef0(0x20f),'columns':_0x5ae401},'behaviors':_0x3b76aa};}['formatSchemaJson'](_0x305182){const _0x3538b=a22_0x59b92d,_0x179756=_0x5de2fc=>{const _0x2531de=a22_0xcfb4;if(_0x5de2fc[_0x2531de(0x269)]===0x0)return'[]';const _0x3291e5=_0x5de2fc['map'](_0x3365c2=>_0x2531de(0x312)+_0x3365c2[_0x2531de(0x2ff)]+_0x2531de(0x2db)+_0x3365c2[_0x2531de(0x28b)]+_0x2531de(0x2c2));return'[\x0a'+_0x3291e5[_0x2531de(0x271)](',\x0a')+_0x2531de(0x316);},_0xf9ee1e=_0x305182[_0x3538b(0x2dd)]['map'](_0x7d3d74=>{const _0x47a26d=_0x3538b;return _0x47a26d(0x200)+_0x7d3d74[_0x47a26d(0x2a1)]+_0x47a26d(0x23b)+_0x179756(_0x7d3d74[_0x47a26d(0x1ce)])['replace'](/^/gm,'\x20\x20')[_0x47a26d(0x229)]()+_0x47a26d(0x1fa);})[_0x3538b(0x271)](',\x0a');return _0x3538b(0x270)+_0x305182[_0x3538b(0x22e)]+_0x3538b(0x2f5)+_0x305182[_0x3538b(0x2ce)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x305182['parent_id']+_0x3538b(0x2fe)+_0x305182['customers']['table']+_0x3538b(0x243)+_0x179756(_0x305182[_0x3538b(0x20f)]['columns'])[_0x3538b(0x2fb)](/^/gm,'\x20\x20')[_0x3538b(0x229)]()+_0x3538b(0x2c8)+_0xf9ee1e+_0x3538b(0x209);}}function a22_0x2b5a(){const _0x50abac=['\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:desc','attributesFile','message','scheduleOption','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','279045wiKDdV','✔\x20Found\x20','label','\x0aError:','SELECT\x20*\x20FROM\x20','segment:parent:show','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','sampleData','.yml','segment:parent:validate','log','displayBehaviorsStats','Apply\x20changes\x20to\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','red','schemaValid','\x0a\x20\x20\x20\x20}','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','enriched','/{name}.yml\x0a','verbose','errors','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','segment:parent:create','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','json','Error\x20reading\x20file:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','interval','\x0a\x20\x20]\x0a}\x0a','processedRows','Source:','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','limit','customers','Coverage:','Table:\x20','\x0a⚠️\x20\x20Both\x20','Database:\x20','Rows:','yes','Aborted.','Join\x20on:','278835NPHJfW','reduce','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','format','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','attributes','parent_segments','all','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','No\x20parent\x20segments\x20found','allValid','3875694jNzsCf','output','`\x20to\x20download\x20the\x20configuration\x20first','Master:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','trim','Session:','query','Error\x20parsing\x20YAML:\x20','web','database','\x27\x20is\x20up\x20to\x20date','\x20=\x20','\x0aNew\x20parent\x20segment\x20\x27','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Listing\x20fields\x20for\x20\x27','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20--attribute\x20\x22','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Behaviors','addAttributesFile','\x20--enriched','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20total','Events:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','8LoSXHF','\x0aChanges\x20to\x20apply\x20to\x20\x27','displayValidateResults','\x20--interval\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Fetching\x20customers\x20schema...','\x20\x20Database:\x20','\x20parent\x20segment\x20\x27','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Fetching\x20behavior\x20list...','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','cyan','platform','%)\x20','stats','string','session','\x0aNo\x20sample\x20data\x20available','endsWith','addBehaviors','\x20[Job\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','test','getOutputDatabaseName','Columns:','Found\x20YAML\x20file:\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','ignore','Listing\x20parent\x20segments...','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','getParentFull','utf-8','site','displayPreviewResults','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','.customers)','Attempt:','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','apply','length','in\x20','text','Output\x20file:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\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','Available\x20attributes:','{\x0a\x20\x20\x22database\x22:\x20\x22','join','Master\x20Table','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20--attribute\x20\x22<name>\x22','\x20field','Join:','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Behavior:','Error:\x20Parent\x20segment\x20name\x20is\x20required','customersWithEvents','15711620AxtXUy','Fetching\x20parent\x20segment\x20\x27','4097824TNzfxj','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','scheduleType','segment:parent:sql','Master\x20+\x20Attributes','segment','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Overwrite\x20\x27','use','master','segment:parent:preview','unref','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','type','Error:','\x20Context\x20set:\x20','/\x20directories\x20exist.','Options:','green','✔\x20Updated\x20parent\x20segment\x20\x27','behavior_','collectSchema','\x20--behavior\x20\x22<name>\x22','Listing\x20parent\x20segments\x20matching\x20\x27','double','displayMasterInfo','error','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','workflowId','previewParentYaml','workflowSessionId','totalEvents','pushParentYaml','joinKey','\x20parent\x20segment','table','Fetching\x20sample\x20data...','Customers:','segment:parent:view','toLocaleString','Fetching\x20SQL\x20for\x20\x27','validateParentYaml','toFixed','YAML\x20file:\x20','customerGroup','bold','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','getBehaviorNames','5078619kqjuwE','resolveParentId','/\x20→\x20','getParentSQL','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20--behavior\x20\x22','2QRtpwN','560362apQRAW','displayColumns','Created','Available\x20behaviors:','dirname','Name:\x20','✔\x20Renamed\x20directory\x20to\x20','Schema\x20saved\x20to\x20','column','\x27\x20and\x20run\x20workflow?','\x20Opening\x20','✔\x20No\x20changes\x20-\x20\x27','\x5c$&','\x22\x20}','information_schema','/attempt/','jobId','displaySampleData','segment:parent:push','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Attributes','To\x20cancel:','\x0a⚠️\x20\x20Migrating:\x20','workflowAttemptId','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','parent_segment','displaySummary','map','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','jsonl','\x27\x20with\x20ID:\x20','\x0a✔\x20Workflow\x20started','.yaml','run','repeat','rowCount','Attribute:','audienceId','\x22,\x20\x22type\x22:\x20\x22','\x20No\x20changes\x20-\x20','behaviors','description','behavior','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','✔\x20Created\x20parent\x20segment\x20\x27','\x20rows\x20','dim','List\x20parent\x20segments','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','SQL\x20query:\x0a','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','open','👥\x20','stop','displayAttributesStats','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','tdx\x20segment\x20parent\x20preview\x20','customerGroupFile','timezone','\x20kill','attribute','Resolving\x20parent\x20segment\x20\x27','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','yellow','foreignKey','-1d','coveragePercent','replace','data','number','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','name','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Updated','Validate:','segment:parent:run','matchedCount','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','start','elapsedTimeMillis','runParent','Options:\x0a','Create\x20parent\x20segment\x20\x27','Updating','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','parentSegment','setJobId','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','status','/app/dw/parentSegments/','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x0a\x20\x20\x20\x20]','execute','column_name','Creating\x20parent\x20segment\x20\x27','\x20\x20Note:\x20','Parent\x20segment:\x20','darwin','columns','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20No\x20sample\x20data\x20available','displayPreviewHints','column_type','addBehaviorsFile','customerPercent','schemaError','Options\x20(one\x20required):\x0a','7wTbuwd','population','\x20Configuration\x20is\x20valid','push','win32','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','✔\x20Query\x20completed:\x20Processed\x20','\x27...','Error:\x20--behavior\x20requires\x20a\x20name\x0a'];a22_0x2b5a=function(){return _0x50abac;};return a22_0x2b5a();}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x280);['description']=a22_0x59b92d(0x21d);async[a22_0x59b92d(0x317)](_0x3bc41a){const _0x208451=a22_0x59b92d,{options:_0x19b1e3,args:_0x1194e0,tdx:_0x393172}=_0x3bc41a,_0x558b59=_0x1194e0[0x0]||_0x19b1e3[_0x208451(0x30f)];if(!_0x558b59)return showParentSegmentNotSetError(_0x208451(0x2cd)+_0x208451(0x2ee)),0x1;_0x19b1e3[_0x208451(0x1fe)]&&(console['error'](_0x208451(0x265)+_0x19b1e3['site']),console[_0x208451(0x298)](_0x208451(0x1cc)+_0x558b59));const _0x5677c5=await withSpinner(_0x208451(0x2f4)+_0x558b59+_0x208451(0x1df),()=>_0x393172[_0x208451(0x282)][_0x208451(0x2af)](_0x558b59),{'verbose':_0x19b1e3['verbose']}),_0x5cb5ef=_0x5677c5['data'],_0x145781=await withSpinner(_0x208451(0x2a6)+_0x558b59+'\x27...',()=>_0x393172[_0x208451(0x282)]['getParentSQL'](_0x5cb5ef),{'verbose':_0x19b1e3[_0x208451(0x1fe)]}),_0x5e4a23=_0x145781[_0x208451(0x2fc)];return _0x19b1e3[_0x208451(0x21b)]===_0x208451(0x204)||_0x19b1e3[_0x208451(0x21b)]===_0x208451(0x2d2)?await handleSDKOutput([{'sql':_0x5e4a23}],_0x19b1e3):console[_0x208451(0x1f3)](_0x5e4a23),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x1ee);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x2f6);async[a22_0x59b92d(0x317)](_0x323de6){const _0x2094b6=a22_0x59b92d,{options:_0x4fbe98,args:_0x4e667e,tdx:_0xa2c78f}=_0x323de6,_0x442427=_0x4e667e[0x0]||_0x4fbe98[_0x2094b6(0x30f)];if(!_0x442427)return showParentSegmentNotSetError(_0x2094b6(0x206)+_0x2094b6(0x237)),0x1;_0x4fbe98[_0x2094b6(0x1fe)]&&(console[_0x2094b6(0x298)](_0x2094b6(0x265)+_0x4fbe98['site']),console[_0x2094b6(0x298)](_0x2094b6(0x1cc)+_0x442427));const _0x30695e=await withSpinner(_0x2094b6(0x2f4)+_0x442427+_0x2094b6(0x1df),()=>_0xa2c78f[_0x2094b6(0x282)][_0x2094b6(0x2af)](_0x442427),{'verbose':_0x4fbe98[_0x2094b6(0x1fe)]}),_0x1cea3b=_0x30695e['data'],_0x432498=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x442427+_0x2094b6(0x1df),()=>_0xa2c78f[_0x2094b6(0x282)]['getParentSQL'](_0x1cea3b),{'verbose':_0x4fbe98['verbose']});let _0x4c3c87=_0x432498[_0x2094b6(0x2fc)];const _0x468ca8=resolveLimit(_0x4fbe98[_0x2094b6(0x20e)],DEFAULT_DISPLAY_LIMIT),_0x3d5f4a=/\bLIMIT\s+\d+/i[_0x2094b6(0x256)](_0x4c3c87);!_0x3d5f4a&&(_0x4c3c87=_0x4c3c87[_0x2094b6(0x229)]()[_0x2094b6(0x2fb)](/;+$/,''),_0x4c3c87='SELECT\x20*\x20FROM\x20(\x0a'+_0x4c3c87+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x468ca8);_0x4fbe98[_0x2094b6(0x1fe)]&&console['error'](_0x2094b6(0x2e6)+_0x4c3c87);const _0x359c95=await withProgressSpinner(_0x2094b6(0x311),async _0x2f874d=>{const _0x286182=_0x2094b6,_0x4ff53d=await _0xa2c78f[_0x286182(0x22b)][_0x286182(0x317)](_0x4c3c87,{'catalog':'td','schema':_0x286182(0x2c3),'onJobId':_0x32677b=>{const _0x18fbf3=_0x286182;_0x2f874d[_0x18fbf3(0x310)](_0x32677b);}});return _0x4ff53d;},{'verbose':_0x4fbe98[_0x2094b6(0x1fe)]}),_0x52f34a=_0x359c95[_0x2094b6(0x2fc)],_0x52bc0f=_0x52f34a[_0x2094b6(0x2c5)]?_0x2094b6(0x254)+_0x52f34a[_0x2094b6(0x2c5)]+']':'';return console['error'](_0x2094b6(0x1de)+_0x52f34a[_0x2094b6(0x24e)][_0x2094b6(0x20a)][_0x2094b6(0x2a5)]()+_0x2094b6(0x2e2)+(_0x2094b6(0x26a)+formatElapsed(_0x52f34a[_0x2094b6(0x24e)][_0x2094b6(0x309)])+_0x52bc0f)),await handleQueryOutput(_0x52f34a,_0x4fbe98),0x0;}}
@@ -1 +1 @@
1
- const a23_0x64c92=a23_0x5d1b;(function(_0x402f60,_0x306c08){const _0x3999a4=a23_0x5d1b,_0x53a803=_0x402f60();while(!![]){try{const _0x527a8c=-parseInt(_0x3999a4(0x14f))/0x1+-parseInt(_0x3999a4(0x10d))/0x2+parseInt(_0x3999a4(0x120))/0x3*(-parseInt(_0x3999a4(0x121))/0x4)+-parseInt(_0x3999a4(0xf7))/0x5*(-parseInt(_0x3999a4(0xee))/0x6)+parseInt(_0x3999a4(0x144))/0x7+parseInt(_0x3999a4(0x117))/0x8*(parseInt(_0x3999a4(0x153))/0x9)+-parseInt(_0x3999a4(0x138))/0xa*(parseInt(_0x3999a4(0x113))/0xb);if(_0x527a8c===_0x306c08)break;else _0x53a803['push'](_0x53a803['shift']());}catch(_0xd48b57){_0x53a803['push'](_0x53a803['shift']());}}}(a23_0x41ab,0x83024));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 a23_0x236cb1 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a23_0x5d1b(_0x29899c,_0x3d6195){_0x29899c=_0x29899c-0xe4;const _0x41abf4=a23_0x41ab();let _0x5d1b04=_0x41abf4[_0x29899c];return _0x5d1b04;}function a23_0x41ab(){const _0x535e65=['\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','129LbkrDT','32484KCywAp','text','logLevel','dim','ERROR','tdx:\x20profile\x20create','log','\x20\x20-\x20','execute','Enter\x20your\x20TD\x20API\x20key:','Site\x20was\x20not\x20changed.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','config','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','llm_project','profileName','select','tdx:\x20profile\x20set','database','name','129980UqTegR','\x0aAvailable\x20profiles:','red','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','message','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','site','warn','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>','test','description','4367454iLNCRb','us01','create','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Enter\x20profile\x20name:','✗\x20Validation\x20failed:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','join','default','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','password','55302QkrjST','Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','API\x20key\x20cannot\x20be\x20empty','4232997yghNRQ','Enter\x20description\x20(optional):','parent_segment','split','error','profile:use','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:set','profile:remove','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Remove\x20a\x20profile','222UHvhYU','confirm','\x0aSetup\x20cancelled','getUserInfo','Set\x20a\x20profile\x20configuration\x20value','green','length','\x20--default\x27\x20to\x20save\x20permanently','profile','109815vidXur','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Set\x20session\x20profile','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','tdx.json','\x20\x20tdx\x20--profile\x20','\x20\x20(no\x20profiles\x20found)','Unknown\x20key\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','validate','apiKey','Validating\x20API\x20key...','\x0aOperation\x20cancelled','(cleared)','(session:\x20','\x27\x20removed\x20from\x20configuration','\x27\x20requires\x20API\x20key\x20validation.','Operation\x20cancelled','VALID_KEYS','yellow','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','trim','553750SvxdBE','\x27.\x0a\x0aValid\x20keys:\x20','jobs','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Session\x20profile\x20set\x20to:\x20','profile:create','583dkONmu','session','email','tdx:\x20profile\x20remove','8wvFpwh','\x20Profile\x20\x27','bold','Removal\x20cancelled','includes','/app/mp/ak','customSite','\x27\x20created'];a23_0x41ab=function(){return _0x535e65;};return a23_0x41ab();}import{LogLevel}from'../utils/tdx-logger.js';import a23_0x5caf6b from'prompts';import a23_0x561b56 from'chalk';function validateProfileName(_0x34b118){const _0x21bb3e=a23_0x5d1b;if(!_0x34b118||!_0x34b118[_0x21bb3e(0x10c)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x413045=_0x34b118[_0x21bb3e(0x10c)]();if(!/^[a-zA-Z0-9_-]+$/[_0x21bb3e(0x142)](_0x413045))return _0x21bb3e(0x131);if(profileExists(_0x413045))return _0x21bb3e(0x150)+_0x413045+_0x21bb3e(0x12d);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x64c92(0x137)]=a23_0x64c92(0x112);['description']='Create\x20a\x20new\x20profile';async[a23_0x64c92(0x129)](_0x5dbde6){const _0xd746c7=a23_0x64c92,{options:_0x162a02,args:_0x1f25d8}=_0x5dbde6;console[_0xd746c7(0x127)](a23_0x561b56['bold'](_0xd746c7(0x126)));let _0x48d0b3;if(_0x1f25d8[_0xd746c7(0xf4)]>0x0&&_0x1f25d8[0x0]){const _0x1c7d07=_0x1f25d8[0x0]['trim'](),_0x38727b=validateProfileName(_0x1c7d07);if(_0x38727b!==!![])return console[_0xd746c7(0xe6)](a23_0x561b56['red'](_0x38727b)),0x1;_0x48d0b3=_0x1c7d07;}else{const _0x3d6341=await a23_0x5caf6b({'type':_0xd746c7(0x122),'name':_0xd746c7(0x133),'message':_0xd746c7(0x148),'validate':validateProfileName});if(!_0x3d6341[_0xd746c7(0x133)])return console['log'](_0xd746c7(0xf0)),0x1;_0x48d0b3=_0x3d6341[_0xd746c7(0x133)][_0xd746c7(0x10c)]();}const _0x407308=await a23_0x5caf6b({'type':'text','name':_0xd746c7(0x143),'message':_0xd746c7(0x154)}),_0x3ad2d6=_0x407308[_0xd746c7(0x143)]?.['trim']()||undefined,_0x111b41=_0x162a02['site']||'us01',{choices:_0x491858,initialIndex:_0x17c32e}=buildSiteChoices(_0x111b41),_0x31e399=await a23_0x5caf6b({'type':_0xd746c7(0x134),'name':'site','message':_0xd746c7(0xfa)+_0x48d0b3+'\x27:','choices':_0x491858,'initial':_0x17c32e});if(!_0x31e399[_0xd746c7(0x13f)])return console['log'](_0xd746c7(0xf0)),0x1;let _0x59f176;if(_0x31e399[_0xd746c7(0x13f)]==='other'){const _0xc374ee=await a23_0x5caf6b({'type':'text','name':_0xd746c7(0x11d),'message':'Enter\x20site\x20name:','initial':_0xd746c7(0x145),'validate':_0x17c9ce=>{const _0xa31a9=_0xd746c7;if(!_0x17c9ce||!_0x17c9ce[_0xa31a9(0x10c)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0xa31a9(0x142)](_0x17c9ce[_0xa31a9(0x10c)]()))return _0xa31a9(0x147);return!![];}});if(!_0xc374ee[_0xd746c7(0x11d)])return console[_0xd746c7(0x127)](_0xd746c7(0xf0)),0x1;_0x59f176=_0xc374ee['customSite'];}else _0x59f176=_0x31e399[_0xd746c7(0x13f)];const _0x4284e7=resolveSite(_0x59f176);console[_0xd746c7(0x127)](_0xd746c7(0x13b)+_0x4284e7),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xd746c7(0x127)]('\x20\x20'+getConsoleUrl(_0x4284e7,_0xd746c7(0x11c)));const _0x500260=await a23_0x5caf6b({'type':_0xd746c7(0x14e),'name':'apiKey','message':_0xd746c7(0x12a),'validate':_0x1e0fbb=>{const _0x50a953=_0xd746c7;if(!_0x1e0fbb||!_0x1e0fbb['trim']())return _0x50a953(0x152);return!![];}});if(!_0x500260[_0xd746c7(0x101)])return console['log'](_0xd746c7(0xf0)),0x1;const _0x40062e=_0x500260['apiKey'];console['log'](_0xd746c7(0x102));try{const _0x253c34=TDX[_0xd746c7(0x146)]({'site':_0x4284e7,'apiKey':_0x40062e[_0xd746c7(0x10c)](),'logLevel':_0x162a02[_0xd746c7(0x123)]??LogLevel[_0xd746c7(0x125)]}),_0x40a69c=await _0x253c34[_0xd746c7(0x10f)][_0xd746c7(0xf1)]();console[_0xd746c7(0x127)](a23_0x561b56['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x40a69c[_0xd746c7(0x115)]+')');const _0x29a47a=await isKeychainAvailable();_0x29a47a?(await saveAPIKeyAsync(_0x40062e['trim'](),_0x4284e7,_0x48d0b3),console[_0xd746c7(0x127)](a23_0x561b56[_0xd746c7(0xf3)]('✓')+_0xd746c7(0x130)+_0x48d0b3+')')):(console[_0xd746c7(0x140)](a23_0x561b56[_0xd746c7(0x10a)](_0xd746c7(0x110))),console['warn'](a23_0x561b56[_0xd746c7(0x10a)](_0xd746c7(0xec))));const _0x40eb82={'site':_0x4284e7,..._0x3ad2d6&&{'description':_0x3ad2d6}};return saveProfileToUserConfig(_0x48d0b3,_0x40eb82),console[_0xd746c7(0x127)](a23_0x561b56[_0xd746c7(0xf3)]('✓')+_0xd746c7(0x118)+_0x48d0b3+_0xd746c7(0x11e)),console[_0xd746c7(0x127)](),console['log'](_0xd746c7(0xe8)),console[_0xd746c7(0x127)](_0xd746c7(0xfc)+_0x48d0b3+_0xd746c7(0x11f)),console[_0xd746c7(0x127)](_0xd746c7(0xfc)+_0x48d0b3+_0xd746c7(0x14a)),0x0;}catch(_0x115605){if(_0x115605 instanceof HTTPClientError&&_0x115605[_0xd746c7(0x12f)]===0x191)return printAuthError(_0x115605),0x1;return console['error'](a23_0x561b56[_0xd746c7(0x13a)](_0xd746c7(0x149)+(_0x115605 instanceof Error?_0x115605[_0xd746c7(0x13d)]:String(_0x115605)))),console[_0xd746c7(0xe6)](_0xd746c7(0x14d)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x64c92(0xea);['description']=a23_0x64c92(0xed);[a23_0x64c92(0x100)](_0x44c8c2){const _0x52da22=a23_0x64c92,{args:_0x1c409f}=_0x44c8c2;if(_0x1c409f[_0x52da22(0xf4)]===0x0)return _0x52da22(0x151);return undefined;}async['execute'](_0x369279){const _0x2ce28f=a23_0x64c92,{args:_0x8eb593}=_0x369279,_0x33cce1=_0x8eb593[0x0];console['log'](a23_0x561b56[_0x2ce28f(0x119)](_0x2ce28f(0x116)));if(!profileExists(_0x33cce1)){console['error'](a23_0x561b56[_0x2ce28f(0x13a)](_0x2ce28f(0x150)+_0x33cce1+'\x27\x20does\x20not\x20exist.')),console[_0x2ce28f(0x127)]('\x0aAvailable\x20profiles:');const _0x4d2acf=listProfiles();if(_0x4d2acf[_0x2ce28f(0xf4)]===0x0)console[_0x2ce28f(0x127)](_0x2ce28f(0xfd));else for(const _0x3f4c6e of _0x4d2acf){console['log'](_0x2ce28f(0x128)+_0x3f4c6e[_0x2ce28f(0x137)]);}return 0x1;}const _0x4e92fd=await a23_0x5caf6b({'type':_0x2ce28f(0xef),'name':_0x2ce28f(0xef),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x33cce1+'\x27?','initial':![]});if(!_0x4e92fd[_0x2ce28f(0xef)])return console[_0x2ce28f(0x127)](_0x2ce28f(0x11a)),0x0;try{removeProfileFromUserConfig(_0x33cce1),console[_0x2ce28f(0x127)](a23_0x561b56[_0x2ce28f(0xf3)]('✓')+_0x2ce28f(0x118)+_0x33cce1+_0x2ce28f(0x106));}catch(_0x307ed4){return console[_0x2ce28f(0xe6)](a23_0x561b56['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x307ed4 instanceof Error?_0x307ed4[_0x2ce28f(0x13d)]:String(_0x307ed4)))),0x1;}const _0x390e63=await isKeychainAvailable();if(_0x390e63){const _0x3853bd=await deleteKeychainAPIKey(_0x33cce1);_0x3853bd&&console['log'](a23_0x561b56[_0x2ce28f(0xf3)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x64c92(0x137)]=a23_0x64c92(0xe9);[a23_0x64c92(0x143)]=a23_0x64c92(0xf2);static ['VALID_KEYS']=['site',a23_0x64c92(0x136),a23_0x64c92(0xe4),a23_0x64c92(0x132),'llm_agent',a23_0x64c92(0x143)];['validate'](_0x26640a){const _0x227eda=a23_0x64c92,{args:_0x45b084,options:_0x52efd6}=_0x26640a,_0x574f01=_0x52efd6[_0x227eda(0xf6)]||getActiveProfile();if(!_0x574f01)return _0x227eda(0x141);if(_0x45b084[_0x227eda(0xf4)]===0x0)return _0x227eda(0x13e)+ProfileSetCommand[_0x227eda(0x109)][_0x227eda(0x14b)](',\x20');const _0x361c00=_0x45b084[0x0];if(!_0x361c00[_0x227eda(0x11b)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x227eda(0x109)][_0x227eda(0x14b)](',\x20');const [_0x4a329b]=_0x361c00[_0x227eda(0xe5)]('=',0x2);if(!ProfileSetCommand[_0x227eda(0x109)]['includes'](_0x4a329b))return _0x227eda(0xfe)+_0x4a329b+_0x227eda(0x10e)+ProfileSetCommand[_0x227eda(0x109)][_0x227eda(0x14b)](',\x20');return undefined;}async[a23_0x64c92(0x129)](_0x1a036d){const _0x3bc8da=a23_0x64c92,{args:_0x2aab7e,options:_0xc4f0c}=_0x1a036d,_0x50579b=_0xc4f0c[_0x3bc8da(0xf6)]||getActiveProfile(),[_0x2722be,..._0x13997e]=_0x2aab7e[0x0][_0x3bc8da(0xe5)]('='),_0x19543b=_0x13997e[_0x3bc8da(0x14b)]('=');console[_0x3bc8da(0x127)](a23_0x561b56[_0x3bc8da(0x119)](_0x3bc8da(0x135)));if(!profileExists(_0x50579b)){const _0x1f525e=await a23_0x5caf6b({'type':_0x3bc8da(0xef),'name':_0x3bc8da(0x146),'message':'Profile\x20\x27'+_0x50579b+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x1f525e[_0x3bc8da(0x146)])return console[_0x3bc8da(0x127)](_0x3bc8da(0x108)),0x1;}const _0x7db20f=loadProfile(_0x50579b),_0x39cd95=_0x7db20f?.[_0x3bc8da(0x12e)]||{};if(_0x2722be===_0x3bc8da(0x13f)){const _0x516519=resolveSite(_0x19543b);console['log']('Changing\x20site\x20to\x20\x27'+_0x516519+_0x3bc8da(0x107)),console[_0x3bc8da(0x127)](_0x3bc8da(0xeb)),console[_0x3bc8da(0x127)]('\x20\x20'+getConsoleUrl(_0x516519,_0x3bc8da(0x11c)));const _0x13e410=await a23_0x5caf6b({'type':_0x3bc8da(0x14e),'name':_0x3bc8da(0x101),'message':_0x3bc8da(0x10b),'validate':_0x2efddd=>{const _0x1093ee=_0x3bc8da;if(!_0x2efddd||!_0x2efddd[_0x1093ee(0x10c)]())return _0x1093ee(0x152);return!![];}});if(!_0x13e410['apiKey'])return console[_0x3bc8da(0x127)](_0x3bc8da(0x103)),0x1;console[_0x3bc8da(0x127)](_0x3bc8da(0x102));try{const _0x37f8d4=TDX['create']({'site':_0x516519,'apiKey':_0x13e410[_0x3bc8da(0x101)]['trim'](),'logLevel':_0xc4f0c[_0x3bc8da(0x123)]??LogLevel[_0x3bc8da(0x125)]}),_0x219efc=await _0x37f8d4['jobs'][_0x3bc8da(0xf1)]();console[_0x3bc8da(0x127)](a23_0x561b56[_0x3bc8da(0xf3)]('✓')+_0x3bc8da(0xff)+_0x219efc[_0x3bc8da(0x115)]+')');const _0x103635=await isKeychainAvailable();_0x103635?(await saveAPIKeyAsync(_0x13e410['apiKey'][_0x3bc8da(0x10c)](),_0x516519,_0x50579b),console[_0x3bc8da(0x127)](a23_0x561b56['green']('✓')+_0x3bc8da(0x12c))):console[_0x3bc8da(0x140)](a23_0x561b56[_0x3bc8da(0x10a)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x39cd95[_0x3bc8da(0x13f)]=_0x516519;}catch(_0x33b0ec){if(_0x33b0ec instanceof HTTPClientError&&_0x33b0ec[_0x3bc8da(0x12f)]===0x191)return printAuthError(_0x33b0ec),0x1;return console[_0x3bc8da(0xe6)](a23_0x561b56['red'](_0x3bc8da(0x149)+(_0x33b0ec instanceof Error?_0x33b0ec[_0x3bc8da(0x13d)]:String(_0x33b0ec)))),console['error'](_0x3bc8da(0x12b)),0x1;}}else _0x39cd95[_0x2722be]=_0x19543b||undefined;return saveProfileToUserConfig(_0x50579b,_0x39cd95),console[_0x3bc8da(0x127)](a23_0x561b56[_0x3bc8da(0xf3)]('✓')+_0x3bc8da(0x118)+_0x50579b+'\x27\x20updated:\x20'+_0x2722be+'='+(_0x19543b||_0x3bc8da(0x104))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x64c92(0x137)]=a23_0x64c92(0xe7);[a23_0x64c92(0x143)]=a23_0x64c92(0xf9);['validate'](_0x1a5393){const _0x20a683=a23_0x64c92,{args:_0x23ec01}=_0x1a5393;if(_0x23ec01[_0x20a683(0xf4)]===0x0)return _0x20a683(0x13c);return undefined;}async[a23_0x64c92(0x129)](_0x55dfdc){const _0x54b7ce=a23_0x64c92,{args:_0x5a42e9,options:_0x5944e6}=_0x55dfdc,_0x1f8a94=_0x5a42e9[0x0],_0x3bfc90=_0x5944e6[_0x54b7ce(0x14c)];cleanExpiredSessions();if(!profileExists(_0x1f8a94)){console[_0x54b7ce(0xe6)](a23_0x561b56['red'](_0x54b7ce(0x150)+_0x1f8a94+'\x27\x20does\x20not\x20exist.')),console['log'](_0x54b7ce(0x139));const _0x13f772=listProfiles();if(_0x13f772[_0x54b7ce(0xf4)]===0x0)console['log'](_0x54b7ce(0xfd));else for(const _0x4adfe6 of _0x13f772){console[_0x54b7ce(0x127)](_0x54b7ce(0x128)+_0x4adfe6[_0x54b7ce(0x137)]);}return 0x1;}if(_0x3bfc90){const _0x4bb55b=a23_0x236cb1[_0x54b7ce(0x14b)](getConfigDir(),_0x54b7ce(0xfb));return saveActiveProfileToUserConfig(_0x1f8a94),console[_0x54b7ce(0x127)]('Default\x20profile\x20set\x20to:\x20'+a23_0x561b56[_0x54b7ce(0xf3)](_0x1f8a94)),console[_0x54b7ce(0x127)](a23_0x561b56['dim']('\x0aSaved\x20to:\x20'+_0x4bb55b)),0x0;}const _0x178f1e=getSessionID(_0x5944e6['session']);return saveSessionContext({'profile':_0x1f8a94},_0x5944e6[_0x54b7ce(0x114)]),console['log'](_0x54b7ce(0x111)+a23_0x561b56[_0x54b7ce(0xf3)](_0x1f8a94)+'\x20'+a23_0x561b56[_0x54b7ce(0x124)](_0x54b7ce(0x105)+_0x178f1e+')')),console[_0x54b7ce(0x127)](a23_0x561b56[_0x54b7ce(0x124)](_0x54b7ce(0xf8)+_0x1f8a94+_0x54b7ce(0xf5))),0x0;}}
1
+ const a23_0x1cddb2=a23_0x20bc;(function(_0x31b35f,_0x295f00){const _0x3773a6=a23_0x20bc,_0x26fd3d=_0x31b35f();while(!![]){try{const _0x20ddfc=-parseInt(_0x3773a6(0x223))/0x1*(-parseInt(_0x3773a6(0x1e1))/0x2)+-parseInt(_0x3773a6(0x1f8))/0x3+parseInt(_0x3773a6(0x1d3))/0x4*(parseInt(_0x3773a6(0x206))/0x5)+parseInt(_0x3773a6(0x1d1))/0x6+parseInt(_0x3773a6(0x1db))/0x7+parseInt(_0x3773a6(0x21a))/0x8+-parseInt(_0x3773a6(0x220))/0x9*(parseInt(_0x3773a6(0x22c))/0xa);if(_0x20ddfc===_0x295f00)break;else _0x26fd3d['push'](_0x26fd3d['shift']());}catch(_0x4cff4e){_0x26fd3d['push'](_0x26fd3d['shift']());}}}(a23_0x224a,0x2c378));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 a23_0x39a501 from'node:path';function a23_0x20bc(_0x4a7bcb,_0x2db5ac){_0x4a7bcb=_0x4a7bcb-0x1c6;const _0x224a7f=a23_0x224a();let _0x20bcda=_0x224a7f[_0x4a7bcb];return _0x20bcda;}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';function a23_0x224a(){const _0x31a077=['\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','19lAdWLL','tdx:\x20profile\x20remove','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','execute','Set\x20a\x20profile\x20configuration\x20value','test','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','status','tdx.json','10LwxFsZ','select','message','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','name','Default\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist.','includes','ERROR','\x20\x20-\x20','✗\x20Validation\x20failed:\x20','Unknown\x20key\x20\x27','Removal\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','596028UmzAlX','\x20API\x20key\x20is\x20valid\x20(User:\x20','2596riXLtM','\x20--default\x27\x20to\x20save\x20permanently','length','\x0aSaved\x20to:\x20','\x20Profile\x20\x27','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','API\x20key\x20cannot\x20be\x20empty','Validating\x20API\x20key...','1761963soaXrZ','log','join','\x27\x20requires\x20API\x20key\x20validation.','password','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','1010UJGFgT','trim','session','default','llm_project','Remove\x20a\x20profile','description','Failed\x20to\x20remove\x20profile:\x20','\x0aSetup\x20cancelled','tdx:\x20profile\x20set','\x20\x20tdx\x20--profile\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','dim','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Site\x20name\x20cannot\x20be\x20empty','text','Set\x20session\x20profile','error','profile:set','profile:use','apiKey','\x20\x20(no\x20profiles\x20found)','green','539109PafDxJ','llm_agent','warn','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','/app/mp/ak','validate','\x27\x20removed\x20from\x20configuration','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x0aAvailable\x20profiles:','split','red','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20created','(session:\x20','1215sSjssy','Changing\x20site\x20to\x20\x27','profileName','jobs','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','getUserInfo','profile:create','customSite','Profile\x20\x27','VALID_KEYS','profile','email','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>','(cleared)','Enter\x20your\x20TD\x20API\x20key:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','parent_segment','confirm','create','1899464haJhuV','bold','Site\x20was\x20not\x20changed.','yellow','Create\x20a\x20new\x20profile','site','3554703BMsqKr','logLevel'];a23_0x224a=function(){return _0x31a077;};return a23_0x224a();}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x362c5f from'prompts';import a23_0x512a1e from'chalk';function validateProfileName(_0x544d4f){const _0x29db64=a23_0x20bc;if(!_0x544d4f||!_0x544d4f['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x34ccaa=_0x544d4f[_0x29db64(0x1e2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x29db64(0x228)](_0x34ccaa))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x34ccaa))return'Profile\x20\x27'+_0x34ccaa+_0x29db64(0x222);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]=a23_0x1cddb2(0x20c);[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x21e);async[a23_0x1cddb2(0x226)](_0x5e4ae4){const _0x9fa00b=a23_0x1cddb2,{options:_0x30180e,args:_0x2285cd}=_0x5e4ae4;console[_0x9fa00b(0x1dc)](a23_0x512a1e[_0x9fa00b(0x21b)]('tdx:\x20profile\x20create'));let _0x99fee3;if(_0x2285cd[_0x9fa00b(0x1d5)]>0x0&&_0x2285cd[0x0]){const _0x42a588=_0x2285cd[0x0][_0x9fa00b(0x1e2)](),_0x282cf8=validateProfileName(_0x42a588);if(_0x282cf8!==!![])return console[_0x9fa00b(0x1f2)](a23_0x512a1e[_0x9fa00b(0x202)](_0x282cf8)),0x1;_0x99fee3=_0x42a588;}else{const _0xebd314=await a23_0x362c5f({'type':_0x9fa00b(0x1f0),'name':_0x9fa00b(0x208),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0xebd314['profileName'])return console['log'](_0x9fa00b(0x1e9)),0x1;_0x99fee3=_0xebd314[_0x9fa00b(0x208)][_0x9fa00b(0x1e2)]();}const _0x4e9de9=await a23_0x362c5f({'type':_0x9fa00b(0x1f0),'name':_0x9fa00b(0x1e7),'message':'Enter\x20description\x20(optional):'}),_0x39c3a5=_0x4e9de9[_0x9fa00b(0x1e7)]?.[_0x9fa00b(0x1e2)]()||undefined,_0x12aa34=_0x30180e[_0x9fa00b(0x21f)]||'us01',{choices:_0x1a4937,initialIndex:_0x2ae1bb}=buildSiteChoices(_0x12aa34),_0x40eec4=await a23_0x362c5f({'type':_0x9fa00b(0x22d),'name':_0x9fa00b(0x21f),'message':_0x9fa00b(0x1ff)+_0x99fee3+'\x27:','choices':_0x1a4937,'initial':_0x2ae1bb});if(!_0x40eec4[_0x9fa00b(0x21f)])return console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1e9)),0x1;let _0x3aa3c9;if(_0x40eec4[_0x9fa00b(0x21f)]==='other'){const _0x5d265c=await a23_0x362c5f({'type':_0x9fa00b(0x1f0),'name':_0x9fa00b(0x20d),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x3fe43d=>{const _0x31f608=_0x9fa00b;if(!_0x3fe43d||!_0x3fe43d['trim']())return _0x31f608(0x1ef);if(!/^[a-z0-9-]+$/[_0x31f608(0x228)](_0x3fe43d[_0x31f608(0x1e2)]()))return _0x31f608(0x216);return!![];}});if(!_0x5d265c[_0x9fa00b(0x20d)])return console[_0x9fa00b(0x1dc)]('\x0aSetup\x20cancelled'),0x1;_0x3aa3c9=_0x5d265c[_0x9fa00b(0x20d)];}else _0x3aa3c9=_0x40eec4[_0x9fa00b(0x21f)];const _0x41f9e1=resolveSite(_0x3aa3c9);console['log'](_0x9fa00b(0x1ee)+_0x41f9e1),console['log'](_0x9fa00b(0x22f)),console[_0x9fa00b(0x1dc)]('\x20\x20'+getConsoleUrl(_0x41f9e1,_0x9fa00b(0x1fc)));const _0x13a6d9=await a23_0x362c5f({'type':'password','name':_0x9fa00b(0x1f5),'message':_0x9fa00b(0x214),'validate':_0x5d8f8a=>{const _0x4e1387=_0x9fa00b;if(!_0x5d8f8a||!_0x5d8f8a[_0x4e1387(0x1e2)]())return _0x4e1387(0x1d9);return!![];}});if(!_0x13a6d9[_0x9fa00b(0x1f5)])return console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1e9)),0x1;const _0x1f960f=_0x13a6d9[_0x9fa00b(0x1f5)];console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1da));try{const _0x5b15af=TDX['create']({'site':_0x41f9e1,'apiKey':_0x1f960f[_0x9fa00b(0x1e2)](),'logLevel':_0x30180e[_0x9fa00b(0x221)]??LogLevel['ERROR']}),_0xd5ed59=await _0x5b15af['jobs'][_0x9fa00b(0x20b)]();console[_0x9fa00b(0x1dc)](a23_0x512a1e['green']('✓')+_0x9fa00b(0x1d2)+_0xd5ed59[_0x9fa00b(0x211)]+')');const _0x41df59=await isKeychainAvailable();_0x41df59?(await saveAPIKeyAsync(_0x1f960f[_0x9fa00b(0x1e2)](),_0x41f9e1,_0x99fee3),console[_0x9fa00b(0x1dc)](a23_0x512a1e['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x99fee3+')')):(console[_0x9fa00b(0x1fa)](a23_0x512a1e[_0x9fa00b(0x21d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x9fa00b(0x1fa)](a23_0x512a1e['yellow'](_0x9fa00b(0x1d8))));const _0x202487={'site':_0x41f9e1,..._0x39c3a5&&{'description':_0x39c3a5}};return saveProfileToUserConfig(_0x99fee3,_0x202487),console[_0x9fa00b(0x1dc)](a23_0x512a1e['green']('✓')+_0x9fa00b(0x1d7)+_0x99fee3+_0x9fa00b(0x204)),console[_0x9fa00b(0x1dc)](),console[_0x9fa00b(0x1dc)](_0x9fa00b(0x203)),console[_0x9fa00b(0x1dc)]('\x20\x20tdx\x20--profile\x20'+_0x99fee3+_0x9fa00b(0x215)),console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1eb)+_0x99fee3+_0x9fa00b(0x20a)),0x0;}catch(_0x4d15ed){if(_0x4d15ed instanceof HTTPClientError&&_0x4d15ed[_0x9fa00b(0x22a)]===0x191)return printAuthError(_0x4d15ed),0x1;return console[_0x9fa00b(0x1f2)](a23_0x512a1e[_0x9fa00b(0x202)](_0x9fa00b(0x1cd)+(_0x4d15ed instanceof Error?_0x4d15ed[_0x9fa00b(0x22e)]:String(_0x4d15ed)))),console[_0x9fa00b(0x1f2)](_0x9fa00b(0x1c6)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]='profile:remove';[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x1e6);[a23_0x1cddb2(0x1fd)](_0x5b9789){const _0x540804=a23_0x1cddb2,{args:_0x3ccee8}=_0x5b9789;if(_0x3ccee8[_0x540804(0x1d5)]===0x0)return _0x540804(0x1e0);return undefined;}async['execute'](_0x5b66e0){const _0x3bf752=a23_0x1cddb2,{args:_0x31742}=_0x5b66e0,_0x270b8d=_0x31742[0x0];console['log'](a23_0x512a1e['bold'](_0x3bf752(0x224)));if(!profileExists(_0x270b8d)){console[_0x3bf752(0x1f2)](a23_0x512a1e[_0x3bf752(0x202)](_0x3bf752(0x20e)+_0x270b8d+_0x3bf752(0x1c9))),console[_0x3bf752(0x1dc)](_0x3bf752(0x200));const _0x31ff51=listProfiles();if(_0x31ff51['length']===0x0)console[_0x3bf752(0x1dc)](_0x3bf752(0x1f6));else for(const _0x14b407 of _0x31ff51){console['log']('\x20\x20-\x20'+_0x14b407['name']);}return 0x1;}const _0xd820cf=await a23_0x362c5f({'type':_0x3bf752(0x218),'name':_0x3bf752(0x218),'message':_0x3bf752(0x1d0)+_0x270b8d+'\x27?','initial':![]});if(!_0xd820cf[_0x3bf752(0x218)])return console[_0x3bf752(0x1dc)](_0x3bf752(0x1cf)),0x0;try{removeProfileFromUserConfig(_0x270b8d),console[_0x3bf752(0x1dc)](a23_0x512a1e[_0x3bf752(0x1f7)]('✓')+_0x3bf752(0x1d7)+_0x270b8d+_0x3bf752(0x1fe));}catch(_0x57d0c4){return console[_0x3bf752(0x1f2)](a23_0x512a1e[_0x3bf752(0x202)](_0x3bf752(0x1e8)+(_0x57d0c4 instanceof Error?_0x57d0c4['message']:String(_0x57d0c4)))),0x1;}const _0x1cc0e5=await isKeychainAvailable();if(_0x1cc0e5){const _0x3c45db=await deleteKeychainAPIKey(_0x270b8d);_0x3c45db&&console[_0x3bf752(0x1dc)](a23_0x512a1e[_0x3bf752(0x1f7)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]=a23_0x1cddb2(0x1f3);[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x227);static [a23_0x1cddb2(0x20f)]=[a23_0x1cddb2(0x21f),'database',a23_0x1cddb2(0x217),a23_0x1cddb2(0x1e5),a23_0x1cddb2(0x1f9),a23_0x1cddb2(0x1e7)];[a23_0x1cddb2(0x1fd)](_0x42352d){const _0xaaa673=a23_0x1cddb2,{args:_0x9dbfb7,options:_0x5a13de}=_0x42352d,_0x1d6397=_0x5a13de[_0xaaa673(0x210)]||getActiveProfile();if(!_0x1d6397)return _0xaaa673(0x212);if(_0x9dbfb7[_0xaaa673(0x1d5)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xaaa673(0x20f)][_0xaaa673(0x1dd)](',\x20');const _0x161565=_0x9dbfb7[0x0];if(!_0x161565[_0xaaa673(0x1ca)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xaaa673(0x20f)][_0xaaa673(0x1dd)](',\x20');const [_0x5f345a]=_0x161565[_0xaaa673(0x201)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0xaaa673(0x1ca)](_0x5f345a))return _0xaaa673(0x1ce)+_0x5f345a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a23_0x1cddb2(0x226)](_0x35c750){const _0x1863b0=a23_0x1cddb2,{args:_0x4a8eb6,options:_0x267d2c}=_0x35c750,_0x4fa59f=_0x267d2c[_0x1863b0(0x210)]||getActiveProfile(),[_0x3286ed,..._0x116793]=_0x4a8eb6[0x0][_0x1863b0(0x201)]('='),_0xd182c4=_0x116793[_0x1863b0(0x1dd)]('=');console['log'](a23_0x512a1e['bold'](_0x1863b0(0x1ea)));if(!profileExists(_0x4fa59f)){const _0x3cb746=await a23_0x362c5f({'type':_0x1863b0(0x218),'name':_0x1863b0(0x219),'message':_0x1863b0(0x20e)+_0x4fa59f+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x3cb746['create'])return console[_0x1863b0(0x1dc)]('Operation\x20cancelled'),0x1;}const _0x36c96f=loadProfile(_0x4fa59f),_0x48770a=_0x36c96f?.['config']||{};if(_0x3286ed===_0x1863b0(0x21f)){const _0xf9af4b=resolveSite(_0xd182c4);console[_0x1863b0(0x1dc)](_0x1863b0(0x207)+_0xf9af4b+_0x1863b0(0x1de)),console[_0x1863b0(0x1dc)](_0x1863b0(0x225)),console[_0x1863b0(0x1dc)]('\x20\x20'+getConsoleUrl(_0xf9af4b,'/app/mp/ak'));const _0x4d7439=await a23_0x362c5f({'type':_0x1863b0(0x1df),'name':_0x1863b0(0x1f5),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x4457b1=>{const _0x95a9aa=_0x1863b0;if(!_0x4457b1||!_0x4457b1[_0x95a9aa(0x1e2)]())return _0x95a9aa(0x1d9);return!![];}});if(!_0x4d7439[_0x1863b0(0x1f5)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x1863b0(0x1dc)](_0x1863b0(0x1da));try{const _0xdeebdc=TDX[_0x1863b0(0x219)]({'site':_0xf9af4b,'apiKey':_0x4d7439['apiKey'][_0x1863b0(0x1e2)](),'logLevel':_0x267d2c[_0x1863b0(0x221)]??LogLevel[_0x1863b0(0x1cb)]}),_0x333c24=await _0xdeebdc[_0x1863b0(0x209)][_0x1863b0(0x20b)]();console[_0x1863b0(0x1dc)](a23_0x512a1e[_0x1863b0(0x1f7)]('✓')+_0x1863b0(0x1d2)+_0x333c24['email']+')');const _0x5b6d8d=await isKeychainAvailable();_0x5b6d8d?(await saveAPIKeyAsync(_0x4d7439[_0x1863b0(0x1f5)][_0x1863b0(0x1e2)](),_0xf9af4b,_0x4fa59f),console[_0x1863b0(0x1dc)](a23_0x512a1e['green']('✓')+_0x1863b0(0x1ec))):console[_0x1863b0(0x1fa)](a23_0x512a1e[_0x1863b0(0x21d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x48770a[_0x1863b0(0x21f)]=_0xf9af4b;}catch(_0xac1595){if(_0xac1595 instanceof HTTPClientError&&_0xac1595['status']===0x191)return printAuthError(_0xac1595),0x1;return console[_0x1863b0(0x1f2)](a23_0x512a1e[_0x1863b0(0x202)](_0x1863b0(0x1cd)+(_0xac1595 instanceof Error?_0xac1595[_0x1863b0(0x22e)]:String(_0xac1595)))),console[_0x1863b0(0x1f2)](_0x1863b0(0x21c)),0x1;}}else _0x48770a[_0x3286ed]=_0xd182c4||undefined;return saveProfileToUserConfig(_0x4fa59f,_0x48770a),console[_0x1863b0(0x1dc)](a23_0x512a1e[_0x1863b0(0x1f7)]('✓')+_0x1863b0(0x1d7)+_0x4fa59f+'\x27\x20updated:\x20'+_0x3286ed+'='+(_0xd182c4||_0x1863b0(0x213))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]=a23_0x1cddb2(0x1f4);[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x1f1);['validate'](_0x3b14a6){const _0x12bb02=a23_0x1cddb2,{args:_0x124c80}=_0x3b14a6;if(_0x124c80[_0x12bb02(0x1d5)]===0x0)return _0x12bb02(0x1fb);return undefined;}async[a23_0x1cddb2(0x226)](_0x37f5d5){const _0x2dd299=a23_0x1cddb2,{args:_0x1c937d,options:_0xafd8ab}=_0x37f5d5,_0x279fef=_0x1c937d[0x0],_0x29fa5c=_0xafd8ab[_0x2dd299(0x1e4)];cleanExpiredSessions();if(!profileExists(_0x279fef)){console[_0x2dd299(0x1f2)](a23_0x512a1e[_0x2dd299(0x202)](_0x2dd299(0x20e)+_0x279fef+'\x27\x20does\x20not\x20exist.')),console[_0x2dd299(0x1dc)]('\x0aAvailable\x20profiles:');const _0x2a2e66=listProfiles();if(_0x2a2e66['length']===0x0)console[_0x2dd299(0x1dc)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x248284 of _0x2a2e66){console[_0x2dd299(0x1dc)](_0x2dd299(0x1cc)+_0x248284[_0x2dd299(0x1c7)]);}return 0x1;}if(_0x29fa5c){const _0x180225=a23_0x39a501['join'](getConfigDir(),_0x2dd299(0x22b));return saveActiveProfileToUserConfig(_0x279fef),console['log'](_0x2dd299(0x1c8)+a23_0x512a1e[_0x2dd299(0x1f7)](_0x279fef)),console[_0x2dd299(0x1dc)](a23_0x512a1e[_0x2dd299(0x1ed)](_0x2dd299(0x1d6)+_0x180225)),0x0;}const _0x54fc71=getSessionID(_0xafd8ab['session']);return saveSessionContext({'profile':_0x279fef},_0xafd8ab[_0x2dd299(0x1e3)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a23_0x512a1e[_0x2dd299(0x1f7)](_0x279fef)+'\x20'+a23_0x512a1e['dim'](_0x2dd299(0x205)+_0x54fc71+')')),console['log'](a23_0x512a1e['dim'](_0x2dd299(0x229)+_0x279fef+_0x2dd299(0x1d4))),0x0;}}
@@ -1 +1 @@
1
- const a24_0x7d51d7=a24_0x482b;function a24_0x482b(_0x4ddd7e,_0x214e55){_0x4ddd7e=_0x4ddd7e-0x153;const _0x3837c0=a24_0x3837();let _0x482b8a=_0x3837c0[_0x4ddd7e];return _0x482b8a;}(function(_0x28cf08,_0x56c660){const _0x4a6dec=a24_0x482b,_0x1eedb1=_0x28cf08();while(!![]){try{const _0x227a40=-parseInt(_0x4a6dec(0x169))/0x1*(-parseInt(_0x4a6dec(0x167))/0x2)+parseInt(_0x4a6dec(0x15f))/0x3+parseInt(_0x4a6dec(0x16a))/0x4*(parseInt(_0x4a6dec(0x164))/0x5)+-parseInt(_0x4a6dec(0x163))/0x6+parseInt(_0x4a6dec(0x161))/0x7*(-parseInt(_0x4a6dec(0x16b))/0x8)+-parseInt(_0x4a6dec(0x15a))/0x9*(-parseInt(_0x4a6dec(0x165))/0xa)+-parseInt(_0x4a6dec(0x15c))/0xb;if(_0x227a40===_0x56c660)break;else _0x1eedb1['push'](_0x1eedb1['shift']());}catch(_0x20f1d2){_0x1eedb1['push'](_0x1eedb1['shift']());}}}(a24_0x3837,0x4cd8f));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x7d51d7(0x168)]=a24_0x7d51d7(0x158);['description']=a24_0x7d51d7(0x155);async[a24_0x7d51d7(0x159)](_0x5730dd){const _0x420e59=a24_0x7d51d7,{options:_0x5362a8}=_0x5730dd;try{const _0x34feb4=listProfiles(),_0xe94500=getActiveProfile();if(_0x34feb4[_0x420e59(0x15e)]===0x0)return console['log'](_0x420e59(0x153)),console[_0x420e59(0x154)](_0x420e59(0x15d)),console[_0x420e59(0x154)](_0x420e59(0x166)),0x0;const _0x54aef2=_0x34feb4[_0x420e59(0x162)](_0x4da78c=>{const _0x358664=_0x420e59,_0x32ba98=_0x4da78c[_0x358664(0x168)]===_0xe94500,_0x402c98=getProfileParams(_0x4da78c[_0x358664(0x15b)]);return{'name':_0x4da78c['name'],'active':_0x32ba98,'scope':_0x4da78c[_0x358664(0x156)],'description':_0x4da78c[_0x358664(0x15b)][_0x358664(0x157)]||'','params':_0x402c98};});return await handleSDKOutput(_0x54aef2,_0x5362a8),0x0;}catch(_0x1cc758){return _0x1cc758 instanceof Error&&console[_0x420e59(0x160)]('Error:\x20'+_0x1cc758['message']),0x1;}}}function a24_0x3837(){const _0x4358a3=['729570HRhafd','\x20\x20Global:\x20~/.config/tdx/tdx.json','122RvGEqs','name','7528DIhkOY','237288PJwchh','112WKtupk','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','log','List\x20all\x20available\x20profiles','scope','description','profiles','execute','9IuDptq','config','6980325hNwMiU','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','length','1342857WcxhYk','error','204729dBPgpr','map','573360cNawsW','40ioVKsI'];a24_0x3837=function(){return _0x4358a3;};return a24_0x3837();}
1
+ const a24_0x45f321=a24_0x197c;(function(_0x1573c8,_0xc34651){const _0xb09688=a24_0x197c,_0x1b5e48=_0x1573c8();while(!![]){try{const _0x769174=parseInt(_0xb09688(0x16e))/0x1*(parseInt(_0xb09688(0x160))/0x2)+-parseInt(_0xb09688(0x16b))/0x3+parseInt(_0xb09688(0x162))/0x4*(parseInt(_0xb09688(0x16f))/0x5)+parseInt(_0xb09688(0x172))/0x6*(-parseInt(_0xb09688(0x161))/0x7)+parseInt(_0xb09688(0x168))/0x8+parseInt(_0xb09688(0x167))/0x9*(-parseInt(_0xb09688(0x173))/0xa)+parseInt(_0xb09688(0x170))/0xb;if(_0x769174===_0xc34651)break;else _0x1b5e48['push'](_0x1b5e48['shift']());}catch(_0x5598ac){_0x1b5e48['push'](_0x1b5e48['shift']());}}}(a24_0x366e,0x6b609));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a24_0x366e(){const _0xa0ae24=['log','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','1214kHZnXJ','519848hrokbs','8QuKmNH','message','description','execute','error','261wTZyEH','2809672ldnGTn','Error:\x20','config','2382069DaeZWE','profiles','List\x20all\x20available\x20profiles','1243nCkipT','514495FXEOBy','5267845zqxwcy','name','6veFbYp','166310stdxtl'];a24_0x366e=function(){return _0xa0ae24;};return a24_0x366e();}function a24_0x197c(_0x4de222,_0x41aac7){_0x4de222=_0x4de222-0x15e;const _0x366e4b=a24_0x366e();let _0x197c49=_0x366e4b[_0x4de222];return _0x197c49;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']=a24_0x45f321(0x16c);[a24_0x45f321(0x164)]=a24_0x45f321(0x16d);async[a24_0x45f321(0x165)](_0x3e7150){const _0x166083=a24_0x45f321,{options:_0x1bc541}=_0x3e7150;try{const _0xf57b49=listProfiles(),_0x506e7f=getActiveProfile();if(_0xf57b49['length']===0x0)return console[_0x166083(0x15e)](_0x166083(0x15f)),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x487a29=_0xf57b49['map'](_0x437b95=>{const _0x1c35a4=_0x166083,_0x26ca06=_0x437b95['name']===_0x506e7f,_0x390019=getProfileParams(_0x437b95[_0x1c35a4(0x16a)]);return{'name':_0x437b95[_0x1c35a4(0x171)],'active':_0x26ca06,'scope':_0x437b95['scope'],'description':_0x437b95[_0x1c35a4(0x16a)]['description']||'','params':_0x390019};});return await handleSDKOutput(_0x487a29,_0x1bc541),0x0;}catch(_0x5636e8){return _0x5636e8 instanceof Error&&console[_0x166083(0x166)](_0x166083(0x169)+_0x5636e8[_0x166083(0x163)]),0x1;}}}
@@ -1 +1 @@
1
- const a25_0x36ed8a=a25_0x29b7;function a25_0x29b7(_0x47eea3,_0xd94101){_0x47eea3=_0x47eea3-0xec;const _0xed797c=a25_0xed79();let _0x29b721=_0xed797c[_0x47eea3];return _0x29b721;}(function(_0x23a6a6,_0x4b07e0){const _0x39102a=a25_0x29b7,_0x17979f=_0x23a6a6();while(!![]){try{const _0x588e39=-parseInt(_0x39102a(0x11a))/0x1*(-parseInt(_0x39102a(0xf9))/0x2)+-parseInt(_0x39102a(0x117))/0x3+-parseInt(_0x39102a(0x11f))/0x4*(parseInt(_0x39102a(0x10e))/0x5)+-parseInt(_0x39102a(0xfd))/0x6+parseInt(_0x39102a(0xf8))/0x7+-parseInt(_0x39102a(0x10c))/0x8*(parseInt(_0x39102a(0xed))/0x9)+parseInt(_0x39102a(0xf2))/0xa;if(_0x588e39===_0x4b07e0)break;else _0x17979f['push'](_0x17979f['shift']());}catch(_0x14c5f3){_0x17979f['push'](_0x17979f['shift']());}}}(a25_0xed79,0x84d32));function a25_0xed79(){const _0x3f25aa=['53090mfwEMZ','processedRows','length','completedSplits','setExtra','elapsedTimeMillis','push','query','in\x20','2650266QWKAZL','verbose','SQL:\x20','16xXNYJm','No\x20SQL\x20provided','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','validate','jobId','404eWWqkj','Schema:\x20','54qWXBCV','originalMessage','Query\x20completed:\x20Processed\x20','stats','data','33275630ObVkTE','\x0aAll\x20results\x20saved\x20to\x20','...','Error:\x20','args','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','1677739yliaOZ','37024fpzSEa','Catalog:\x20','totalSplits','Executing\x20query...','1855728UKlGRg','error','description','file','output','Run\x20Trino\x20queries\x20(streaming)','Executing\x20statement\x20','message','database','catalog','setPhase','\x20rows\x20','\x20[Job\x20ID:\x20','Statement\x20','execute','1405672TMogSO','Executing\x20query\x20['];a25_0xed79=function(){return _0x3f25aa;};return a25_0xed79();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a25_0x36ed8a(0x115);[a25_0x36ed8a(0xff)]=a25_0x36ed8a(0x102);async[a25_0x36ed8a(0x10b)](_0x21e5b4){const _0x23a95b=a25_0x36ed8a,{options:_0x51e405,args:_0x358c99,tdx:_0x1d19a0}=_0x21e5b4,_0x2179e8=_0x358c99[0x0],_0x4b8891=_0x51e405['file'];let _0x35812b;try{if(_0x4b8891)_0x35812b=readSqlStatementsFromFile(_0x4b8891);else{if(_0x2179e8==='-')_0x35812b=await readSqlStatementsFromStdin();else{if(_0x2179e8&&isSqlFilePath(_0x2179e8))_0x35812b=readSqlStatementsFromFile(_0x2179e8);else{if(_0x2179e8)_0x35812b=splitSqlStatements(_0x2179e8);else throw new Error(_0x23a95b(0x11b));}}}}catch(_0x554191){return console['error'](_0x23a95b(0xf5)+_0x554191[_0x23a95b(0x104)]),0x1;}const _0x216d2d=_0x51e405[_0x23a95b(0x105)]||'information_schema',_0x17b1d4=_0x51e405[_0x23a95b(0x106)];try{const _0x46258d=[],_0x17a13d=!!_0x51e405[_0x23a95b(0x101)];for(let _0x4bafa7=0x0;_0x4bafa7<_0x35812b['length'];_0x4bafa7++){const _0x4c5f1c=_0x35812b[_0x4bafa7],_0x39b786=_0x4bafa7+0x1,_0x45a18b=_0x35812b[_0x23a95b(0x110)],_0x1a6b62=_0x45a18b>0x1;_0x51e405[_0x23a95b(0x118)]&&(console['error']('\x0a'+(_0x1a6b62?_0x23a95b(0x10a)+_0x39b786+'/'+_0x45a18b+':':'')),console[_0x23a95b(0xfe)]('Site:\x20'+_0x51e405['site']),console[_0x23a95b(0xfe)](_0x23a95b(0xfa)+(_0x17b1d4||'td')),console[_0x23a95b(0xfe)](_0x23a95b(0xec)+_0x216d2d),console[_0x23a95b(0xfe)](_0x23a95b(0x119)+_0x4c5f1c));const _0x381883=_0x1a6b62?_0x23a95b(0x103)+_0x39b786+'/'+_0x45a18b+_0x23a95b(0xf4):_0x23a95b(0xfc);try{const _0x50bb3a=await withProgressSpinner(_0x381883,async _0x381270=>{const _0xf88e9b=_0x23a95b,_0x365f3d=await _0x1d19a0[_0xf88e9b(0x115)][_0xf88e9b(0x10b)](_0x4c5f1c,{'catalog':_0x17b1d4,'schema':_0x216d2d,'onJobId':_0x191c5f=>{_0x381270['setJobId'](_0x191c5f);},'onProgress':_0x4ffa38=>{const _0x3ecca2=_0xf88e9b;_0x381270[_0x3ecca2(0x107)](_0x3ecca2(0x10d)+_0x4ffa38['state']+']'),_0x381270[_0x3ecca2(0x112)](formatRows(_0x4ffa38[_0x3ecca2(0x10f)])+'\x20rows\x20'+_0x4ffa38[_0x3ecca2(0x111)]+'/'+_0x4ffa38[_0x3ecca2(0xfb)]+'\x20splits');}});return _0x365f3d;},{'verbose':_0x51e405[_0x23a95b(0x118)]}),_0x333798=_0x50bb3a[_0x23a95b(0xf1)],_0x55c390=_0x333798['jobId']?_0x23a95b(0x109)+_0x333798[_0x23a95b(0x11e)]+']':'',_0x34a725=_0x1a6b62?_0x23a95b(0x10a)+_0x39b786+'/'+_0x45a18b+'\x20-\x20':'';console[_0x23a95b(0xfe)]('✔\x20'+_0x34a725+_0x23a95b(0xef)+formatRows(_0x333798['stats'][_0x23a95b(0x10f)])+_0x23a95b(0x108)+(_0x23a95b(0x116)+formatElapsed(_0x333798[_0x23a95b(0xf0)][_0x23a95b(0x113)])+_0x55c390));if(_0x1a6b62&&_0x17a13d){const _0x45c197=resolveOutputOptions(_0x51e405),_0x523552=await formatQueryOutput(_0x333798,_0x45c197);_0x46258d[_0x23a95b(0x114)](_0x523552);}else await handleQueryOutput(_0x333798,_0x51e405);}catch(_0x7e80c6){const _0x534778=_0x1a6b62?_0x23a95b(0x10a)+_0x39b786+'/'+_0x45a18b+':\x0a':'',_0x3a4aac=_0x7e80c6 instanceof SDKError?_0x7e80c6[_0x23a95b(0xee)]:_0x7e80c6[_0x23a95b(0x104)];return console['error'](''+_0x534778+_0x3a4aac),0x1;}}if(_0x35812b['length']>0x1&&_0x17a13d&&_0x46258d[_0x23a95b(0x110)]>0x0){const _0x578972=_0x46258d['join']('\x0a');writeFileSync(_0x51e405[_0x23a95b(0x101)],_0x578972),console[_0x23a95b(0xfe)](_0x23a95b(0xf3)+_0x51e405[_0x23a95b(0x101)]);}return 0x0;}catch(_0x3f5888){throw _0x3f5888;}}[a25_0x36ed8a(0x11d)](_0x1b9ba8){const _0x39cb05=a25_0x36ed8a,_0x53d25e=_0x1b9ba8[_0x39cb05(0xf6)][0x0],_0x323790=_0x1b9ba8['options'][_0x39cb05(0x100)];if(!_0x53d25e&&!_0x323790)return _0x39cb05(0x11c);if(_0x53d25e&&_0x323790)return _0x39cb05(0xf7);return undefined;}}
1
+ const a25_0x37b39c=a25_0xc808;(function(_0x520623,_0x1737e2){const _0x3d7ce6=a25_0xc808,_0x2bc7a5=_0x520623();while(!![]){try{const _0x16d5be=parseInt(_0x3d7ce6(0x1a2))/0x1+-parseInt(_0x3d7ce6(0x1b3))/0x2*(parseInt(_0x3d7ce6(0x19f))/0x3)+-parseInt(_0x3d7ce6(0x1b6))/0x4+-parseInt(_0x3d7ce6(0x1a1))/0x5*(-parseInt(_0x3d7ce6(0x1bc))/0x6)+-parseInt(_0x3d7ce6(0x1a0))/0x7*(-parseInt(_0x3d7ce6(0x1b5))/0x8)+-parseInt(_0x3d7ce6(0x198))/0x9+parseInt(_0x3d7ce6(0x193))/0xa;if(_0x16d5be===_0x1737e2)break;else _0x2bc7a5['push'](_0x2bc7a5['shift']());}catch(_0x1a48e6){_0x2bc7a5['push'](_0x2bc7a5['shift']());}}}(a25_0x290b,0x87718));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a25_0xc808(_0xb17863,_0x5bf503){_0xb17863=_0xb17863-0x18d;const _0x290b4a=a25_0x290b();let _0xc80880=_0x290b4a[_0xb17863];return _0xc80880;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a25_0x290b(){const _0x1c5bed=['2815524LbcyDB','verbose','Query\x20completed:\x20Processed\x20','file','\x20-\x20','Executing\x20statement\x20','originalMessage','1090833VRdHrG','28DLhLrM','18155OMLMoT','481843ATGNrH','execute','in\x20','description','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','elapsedTimeMillis','Catalog:\x20','\x20[Job\x20ID:\x20','name','message','query','length','\x0aAll\x20results\x20saved\x20to\x20','error','...','options','2yCeExJ','setPhase','505520CVzAJX','3121364fHyrEn','push','Schema:\x20','Run\x20Trino\x20queries\x20(streaming)','information_schema','output','1830NNZhdV','data','Statement\x20','SQL:\x20','No\x20SQL\x20provided','\x20splits','processedRows','validate','completedSplits','stats','\x20rows\x20','setExtra','jobId','1695060pLtkyD','state','setJobId','Executing\x20query\x20[','database'];a25_0x290b=function(){return _0x1c5bed;};return a25_0x290b();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x37b39c(0x1ab)]=a25_0x37b39c(0x1ad);[a25_0x37b39c(0x1a5)]=a25_0x37b39c(0x1b9);async[a25_0x37b39c(0x1a3)](_0x335846){const _0x3feab4=a25_0x37b39c,{options:_0x2fbf9d,args:_0x18801e,tdx:_0x2f69eb}=_0x335846,_0x5488b2=_0x18801e[0x0],_0x6f2978=_0x2fbf9d[_0x3feab4(0x19b)];let _0x4b2a02;try{if(_0x6f2978)_0x4b2a02=readSqlStatementsFromFile(_0x6f2978);else{if(_0x5488b2==='-')_0x4b2a02=await readSqlStatementsFromStdin();else{if(_0x5488b2&&isSqlFilePath(_0x5488b2))_0x4b2a02=readSqlStatementsFromFile(_0x5488b2);else{if(_0x5488b2)_0x4b2a02=splitSqlStatements(_0x5488b2);else throw new Error(_0x3feab4(0x1c0));}}}}catch(_0x17b223){return console[_0x3feab4(0x1b0)]('Error:\x20'+_0x17b223[_0x3feab4(0x1ac)]),0x1;}const _0x1c0bd3=_0x2fbf9d[_0x3feab4(0x197)]||_0x3feab4(0x1ba),_0x182b65=_0x2fbf9d['catalog'];try{const _0x4ae072=[],_0x509325=!!_0x2fbf9d[_0x3feab4(0x1bb)];for(let _0x13ebe9=0x0;_0x13ebe9<_0x4b2a02['length'];_0x13ebe9++){const _0xb4d531=_0x4b2a02[_0x13ebe9],_0x9e10e3=_0x13ebe9+0x1,_0x43d50a=_0x4b2a02['length'],_0x296933=_0x43d50a>0x1;_0x2fbf9d[_0x3feab4(0x199)]&&(console[_0x3feab4(0x1b0)]('\x0a'+(_0x296933?_0x3feab4(0x1be)+_0x9e10e3+'/'+_0x43d50a+':':'')),console[_0x3feab4(0x1b0)]('Site:\x20'+_0x2fbf9d['site']),console[_0x3feab4(0x1b0)](_0x3feab4(0x1a9)+(_0x182b65||'td')),console[_0x3feab4(0x1b0)](_0x3feab4(0x1b8)+_0x1c0bd3),console['error'](_0x3feab4(0x1bf)+_0xb4d531));const _0x289d68=_0x296933?_0x3feab4(0x19d)+_0x9e10e3+'/'+_0x43d50a+_0x3feab4(0x1b1):'Executing\x20query...';try{const _0x3654ce=await withProgressSpinner(_0x289d68,async _0x34b1ca=>{const _0x91e09b=_0x3feab4,_0x74c3f1=await _0x2f69eb[_0x91e09b(0x1ad)][_0x91e09b(0x1a3)](_0xb4d531,{'catalog':_0x182b65,'schema':_0x1c0bd3,'onJobId':_0x93fb12=>{const _0x57266d=_0x91e09b;_0x34b1ca[_0x57266d(0x195)](_0x93fb12);},'onProgress':_0x5098f9=>{const _0x487e0a=_0x91e09b;_0x34b1ca[_0x487e0a(0x1b4)](_0x487e0a(0x196)+_0x5098f9[_0x487e0a(0x194)]+']'),_0x34b1ca[_0x487e0a(0x191)](formatRows(_0x5098f9[_0x487e0a(0x1c2)])+_0x487e0a(0x190)+_0x5098f9[_0x487e0a(0x18e)]+'/'+_0x5098f9['totalSplits']+_0x487e0a(0x1c1));}});return _0x74c3f1;},{'verbose':_0x2fbf9d[_0x3feab4(0x199)]}),_0x1b7ad2=_0x3654ce[_0x3feab4(0x1bd)],_0x110e5c=_0x1b7ad2[_0x3feab4(0x192)]?_0x3feab4(0x1aa)+_0x1b7ad2[_0x3feab4(0x192)]+']':'',_0x3c5744=_0x296933?_0x3feab4(0x1be)+_0x9e10e3+'/'+_0x43d50a+_0x3feab4(0x19c):'';console[_0x3feab4(0x1b0)]('✔\x20'+_0x3c5744+_0x3feab4(0x19a)+formatRows(_0x1b7ad2[_0x3feab4(0x18f)][_0x3feab4(0x1c2)])+'\x20rows\x20'+(_0x3feab4(0x1a4)+formatElapsed(_0x1b7ad2[_0x3feab4(0x18f)][_0x3feab4(0x1a8)])+_0x110e5c));if(_0x296933&&_0x509325){const _0x1b32d1=resolveOutputOptions(_0x2fbf9d),_0x3b05ba=await formatQueryOutput(_0x1b7ad2,_0x1b32d1);_0x4ae072[_0x3feab4(0x1b7)](_0x3b05ba);}else await handleQueryOutput(_0x1b7ad2,_0x2fbf9d);}catch(_0x47e55f){const _0x54a142=_0x296933?_0x3feab4(0x1be)+_0x9e10e3+'/'+_0x43d50a+':\x0a':'',_0x5e3c49=_0x47e55f instanceof SDKError?_0x47e55f[_0x3feab4(0x19e)]:_0x47e55f[_0x3feab4(0x1ac)];return console[_0x3feab4(0x1b0)](''+_0x54a142+_0x5e3c49),0x1;}}if(_0x4b2a02[_0x3feab4(0x1ae)]>0x1&&_0x509325&&_0x4ae072['length']>0x0){const _0x198c61=_0x4ae072['join']('\x0a');writeFileSync(_0x2fbf9d[_0x3feab4(0x1bb)],_0x198c61),console[_0x3feab4(0x1b0)](_0x3feab4(0x1af)+_0x2fbf9d['output']);}return 0x0;}catch(_0x3d2177){throw _0x3d2177;}}[a25_0x37b39c(0x18d)](_0x355a61){const _0x47ac14=a25_0x37b39c,_0x2a9710=_0x355a61['args'][0x0],_0x44b9d2=_0x355a61[_0x47ac14(0x1b2)]['file'];if(!_0x2a9710&&!_0x44b9d2)return _0x47ac14(0x1a6);if(_0x2a9710&&_0x44b9d2)return _0x47ac14(0x1a7);return undefined;}}