@treasuredata/tdx 0.16.2 → 0.16.3

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 (159) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/unset-command.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/user-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/command-output.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.js +1 -1
  48. package/dist/core/constants.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/core/version.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/mcp/server.js +1 -1
  59. package/dist/mcp/tools/index.js +1 -1
  60. package/dist/mcp/tools/tdx-run.js +1 -1
  61. package/dist/mcp/tools/tdx-search.js +1 -1
  62. package/dist/mcp/utils.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/server.js +1 -1
  69. package/dist/proxy/session-cache.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  81. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  82. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  83. package/dist/sdk/claude-agent/environment.d.ts +9 -0
  84. package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
  85. package/dist/sdk/claude-agent/environment.js +1 -1
  86. package/dist/sdk/claude-agent/environment.js.map +1 -1
  87. package/dist/sdk/claude-agent/index.js +1 -1
  88. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.js +1 -1
  94. package/dist/sdk/client/rate-limiter.js +1 -1
  95. package/dist/sdk/client/td-api-client.js +1 -1
  96. package/dist/sdk/client/trino-api-client.js +1 -1
  97. package/dist/sdk/client/workflow-client.js +1 -1
  98. package/dist/sdk/connection-validator.js +1 -1
  99. package/dist/sdk/connection.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-aliases.js +1 -1
  111. package/dist/sdk/llm/model-factors.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  115. package/dist/sdk/segment/fields-display.js +1 -1
  116. package/dist/sdk/segment/file-discovery.js +1 -1
  117. package/dist/sdk/segment/journey-utils.js +1 -1
  118. package/dist/sdk/segment/journey-yaml.js +1 -1
  119. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  120. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  121. package/dist/sdk/segment/pull-workflow.js +1 -1
  122. package/dist/sdk/segment/push-workflow.js +1 -1
  123. package/dist/sdk/segment/resolution-context.js +1 -1
  124. package/dist/sdk/segment/segment-path-parser.js +1 -1
  125. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  126. package/dist/sdk/segment/target-resolution.js +1 -1
  127. package/dist/sdk/segment/tdx-config.js +1 -1
  128. package/dist/sdk/segment/validate-files.js +1 -1
  129. package/dist/sdk/segment/yaml-validator.js +1 -1
  130. package/dist/sdk/segment.js +1 -1
  131. package/dist/sdk/types/index.js +1 -1
  132. package/dist/sdk/types/progress.js +1 -1
  133. package/dist/sdk/user.js +1 -1
  134. package/dist/sdk/util/format-detector.js +1 -1
  135. package/dist/sdk/util/formatters.js +1 -1
  136. package/dist/sdk/util/index.js +1 -1
  137. package/dist/sdk/util/tree-formatter.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/utils/async.js +1 -1
  145. package/dist/utils/colors.js +1 -1
  146. package/dist/utils/diff.js +1 -1
  147. package/dist/utils/file-permissions.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/option-validation.js +1 -1
  150. package/dist/utils/port.js +1 -1
  151. package/dist/utils/process.js +1 -1
  152. package/dist/utils/prompt.js +1 -1
  153. package/dist/utils/spinner.js +1 -1
  154. package/dist/utils/sse-parser.js +1 -1
  155. package/dist/utils/string-utils.js +1 -1
  156. package/dist/utils/table-ref-parser.js +1 -1
  157. package/dist/utils/tdx-logger.js +1 -1
  158. package/dist/utils/version-check.js +1 -1
  159. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x277f3c=a23_0x31ab;(function(_0x4fe195,_0x496ce4){const _0x101050=a23_0x31ab,_0x17277e=_0x4fe195();while(!![]){try{const _0x566d80=-parseInt(_0x101050(0x1fe))/0x1+parseInt(_0x101050(0x1ec))/0x2*(-parseInt(_0x101050(0x259))/0x3)+parseInt(_0x101050(0x24e))/0x4*(-parseInt(_0x101050(0x1d1))/0x5)+parseInt(_0x101050(0x2c5))/0x6+-parseInt(_0x101050(0x2e1))/0x7*(parseInt(_0x101050(0x201))/0x8)+parseInt(_0x101050(0x2b5))/0x9*(-parseInt(_0x101050(0x29e))/0xa)+parseInt(_0x101050(0x2f5))/0xb;if(_0x566d80===_0x496ce4)break;else _0x17277e['push'](_0x17277e['shift']());}catch(_0x125bad){_0x17277e['push'](_0x17277e['shift']());}}}(a23_0x1c37,0x4c7c8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x52e31e from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x3b54b8 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x1c37(){const _0x11c654=['parent_segment','\x20\x20\x20\x20-\x20','Updating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','message','✔\x20No\x20changes\x20-\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','web','displaySampleData','database','yes','scheduleType','18qGoCIp','darwin','\x20Opening\x20','data','localeCompare','resolveParentId','\x20\x20No\x20sample\x20data\x20available','varchar','getParentFull','stop','\x0aNo\x20sample\x20data\x20available','Enriched:','/\x20directories\x20exist.','red','parentSegment','schemaValid','3243426NLkJju','runParent','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','displayAttributesStats','unref','enriched','createParent','\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Available\x20attributes:','Source:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','apply','tdx\x20segment\x20parent\x20preview\x20','segment:parent:push','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','output','run','customerGroupFile','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','ignore','\x0aChanges\x20to\x20apply\x20to\x20\x27','customerGroup','segment:parent:validate','description','joinKey','119JFwqfy','name','\x0a⚠️\x20\x20Migrating:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','preview','Customers:','To\x20view\x20sample\x20data:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','addBehaviorsFile','text','table','/\x20directory.\x0a','Preview:','string','errors','all','pushParentYaml','10556139sLdBYG','segment:parent:show','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','repeat','displayPreviewResults','totalEvents','\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','toFixed','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0a✔\x20Workflow\x20started','workflowSessionId','\x0aUsage:\x20tdx\x20ps\x20preview\x20','sampleData','attribute','👥\x20','allValid','behavior','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','✔\x20Query\x20completed:\x20Processed\x20','map','2255vRiDHT','Listing\x20parent\x20segments\x20matching\x20\x27','\x27...','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','dim','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment','\x5c$&','log','verbose','`\x20to\x20download\x20the\x20configuration\x20first','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Join:','match','listFields','displayValidateResults','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20Configuration\x20is\x20valid','Executing\x20parent\x20segment\x20query...','Updating','cyan','Database:\x20','segment:parent:fields','customerPercent','start','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','29938SzLZQQ','Creating\x20parent\x20segment\x20\x27','\x20kill','displaySummary','FINISHED','session','Master\x20Table','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20--behavior\x20\x22<name>\x22','✔\x20Created\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','use','length','bold','\x0aNew\x20parent\x20segment\x20\x27','utf-8','\x20No\x20changes\x20-\x20','279201wtiPJN','Site:\x20','/app/workflows/','142744YSqDyj','Errors:','dirname','attributes','query','\x20rows\x20','displayMasterInfo','Error:','validateParentYaml','\x27\x20and\x20run\x20workflow?','Error:\x20--attribute\x20requires\x20a\x20name\x0a','displayBehaviorsStats','\x20tdx\x20wf\x20attempt\x20','columns','addAttributes','label','jobId','✔\x20Updated\x20parent\x20segment\x20\x27','Resolving\x20parent\x20segment\x20\x27','Table:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20=\x20','Coverage:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20--interval\x20','Attributes','-1d','setJobId','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','execute','Updated','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','SQL\x20query:\x0a','Aborted.','\x20rows)','customersWithEvents','using\x20the\x20default\x20path:\x20','processedRows','win32','Analyzing\x20changes...','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Apply\x20changes\x20to\x20\x27','stats','json','sort','error','scheduleOption','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Fetching\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Fetching\x20SQL\x20for\x20\x27','\x20--enriched','schemaError','\x20--attribute\x20\x22','No\x20parent\x20segments\x20found','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Audience\x20ID:','coveragePercent','/\x20→\x20','displayPreviewHints','\x0a⚠️\x20\x20Both\x20','segment:parent:desc','Creating','Master\x20+\x20Attributes','✔\x20Renamed\x20directory\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','behaviorsFile','listParents','behaviors','Columns:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Error\x20reading\x20file:\x20','pullParentYaml','Listing\x20parent\x20segments...','1732CsSbjA','%)\x20','Validating\x20configuration...','Error:\x20Parent\x20segment\x20name\x20is\x20required','Events:','\x27\x20with\x20ID:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','.yml','To\x20cancel:','xdg-open','audienceId','45mzCsvS','\x20--behavior\x20\x22','\x20[Job\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','isDirectory','yellow','Found\x20YAML\x20file:\x20','status','Show\x20parent\x20segment\x20details','platform','foreignKey','green','attributesFile','segment:parent:sql','keys','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','jsonl','test','/app/dw/parentSegments/','Master:','workflowAttemptId','Fetching\x20sample\x20data...','segment:parent:preview','Get\x20SQL\x20query\x20for\x20parent\x20segment','List\x20parent\x20segments','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','timezone','\x0aChanges\x20to\x20\x27','updateParent','segment:parent:list','site','number','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:view','/sessions/','format','Error\x20parsing\x20YAML:\x20','elapsedTimeMillis','YAML\x20file:\x20','Listing\x20fields\x20for\x20\x27','in\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Options:\x0a','Error:\x20File\x20not\x20found:\x20','matchedCount','Attribute:','Pattern:\x20','displayColumns','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/attempt/','segment:parent:pull','\x20field','addBehaviors','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20is\x20already\x20up\x20to\x20date','rowCount','Status:','endsWith','Behaviors','filter','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Rows:','Validate:','Join\x20on:','population','replace','column','922910hGnNxR','getParentSQL','segment:parent:create','Show\x20parent\x20segment\x20schema\x20(column\x20types)','interval','join','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','master','segment:parent:update','Error:\x20--behavior\x20requires\x20a\x20name\x0a','open'];a23_0x1c37=function(){return _0x11c654;};return a23_0x1c37();}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x277f3c(0x2a9);function openBrowser(_0x414ff3){const _0x1309d9=a23_0x277f3c,_0xba7e14=process[_0x1309d9(0x262)],_0x43da76=_0xba7e14===_0x1309d9(0x2b6)?_0x1309d9(0x2a8):_0xba7e14===_0x1309d9(0x228)?_0x1309d9(0x1ea):_0x1309d9(0x257);spawn(_0x43da76,[_0x414ff3],{'detached':!![],'stdio':_0x1309d9(0x2db)})[_0x1309d9(0x2ca)]();}function migrateLegacyDirectory(){const _0x478c58=a23_0x277f3c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58b68e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58b68e[_0x478c58(0x25d)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x25e)](_0x478c58(0x23e)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x478c58(0x2c1))),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x1d6)](_0x478c58(0x254)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x2ef))),![];console['error'](a23_0x3b54b8['yellow'](_0x478c58(0x2e3)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x23c)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x264)](_0x478c58(0x242)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x640844){const _0x2dcb85=_0x640844 instanceof Error?_0x640844[_0x478c58(0x2ad)]:String(_0x640844);return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x2c2)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x2dcb85+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x5981f8){const _0x4a63d4=a23_0x277f3c;return migrateLegacyDirectory(),super[_0x4a63d4(0x2d8)](_0x5981f8);}}function resolveYamlFile(_0x289d82){const _0x3334d7=a23_0x277f3c;if(_0x289d82[_0x3334d7(0x294)](_0x3334d7(0x255))||_0x289d82[_0x3334d7(0x294)]('.yaml'))return _0x289d82;return a23_0x52e31e[_0x3334d7(0x2a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x289d82)+_0x3334d7(0x255));}function formatProgressMessage(_0x27f356){const _0x132f8d=a23_0x277f3c,_0x37488c=_0x27f356[_0x132f8d(0x1df)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x37488c){const [,_0x4b7772,_0x577082,_0x36bb16='']=_0x37488c;return a23_0x3b54b8['dim'](_0x4b7772+':')+'\x20'+_0x577082+a23_0x3b54b8['dim'](_0x36bb16);}return a23_0x3b54b8[_0x132f8d(0x1d6)](_0x27f356);}function showFileNotFoundError(_0x2481e9,_0x1c908b){const _0x59aeea=a23_0x277f3c;console[_0x59aeea(0x22f)](a23_0x3b54b8['red'](_0x59aeea(0x286)+_0x2481e9+'\x0a')),console[_0x59aeea(0x22f)](a23_0x3b54b8[_0x59aeea(0x1e6)](_0x59aeea(0x221)+_0x1c908b+_0x59aeea(0x1dc)));}function showParentSegmentNotSetError(_0x10ac32){const _0x2a0080=a23_0x277f3c;console[_0x2a0080(0x22f)](a23_0x3b54b8['yellow'](_0x2a0080(0x219))),console[_0x2a0080(0x22f)](_0x10ac32);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x277);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x272);async[a23_0x277f3c(0x21f)](_0x1d4640){const _0xd62cf6=a23_0x277f3c,{options:_0x224229,args:_0x322358,tdx:_0xa65b7c}=_0x1d4640,_0x22d475=_0x322358[0x0];_0x224229[_0xd62cf6(0x1db)]&&(console[_0xd62cf6(0x22f)](_0xd62cf6(0x1ff)+_0x224229[_0xd62cf6(0x278)]),_0x22d475&&console[_0xd62cf6(0x22f)](_0xd62cf6(0x289)+_0x22d475));const _0x3e226f=await withSpinner(_0x22d475?_0xd62cf6(0x1d2)+_0x22d475+_0xd62cf6(0x1d3):_0xd62cf6(0x24d),()=>_0xa65b7c[_0xd62cf6(0x1d8)][_0xd62cf6(0x246)](),{'verbose':_0x224229[_0xd62cf6(0x1db)]});let _0x368362=_0x3e226f['data'];if(_0x22d475){const _0x4f31f5=_0x22d475[_0xd62cf6(0x29c)](/[.+^${}()|[\]\\]/g,_0xd62cf6(0x1d9))['replace'](/\*/g,'.*')[_0xd62cf6(0x29c)](/\?/g,'.'),_0x825b39=new RegExp('^'+_0x4f31f5+'$','i');_0x368362=_0x368362[_0xd62cf6(0x296)](_0x332084=>_0x825b39[_0xd62cf6(0x26b)](_0x332084['attributes'][_0xd62cf6(0x2e2)]));}_0x368362[_0xd62cf6(0x22e)]((_0x4938f2,_0x2bf406)=>_0x4938f2[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)][_0xd62cf6(0x2b9)](_0x2bf406[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)])),console[_0xd62cf6(0x22f)]('✔\x20Found\x20'+_0x368362[_0xd62cf6(0x1f9)]+_0xd62cf6(0x2fc)+(_0x368362['length']!==0x1?'s':''));const _0x57927d=_0x203f16=>{const _0x3f0a95=_0xd62cf6;return getConsoleNextUrl(_0x224229[_0x3f0a95(0x278)],'/app/dw/parentSegments/'+_0x203f16);};if(_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x22d)||_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x26a)){const _0x335c45=_0x368362[_0xd62cf6(0x1d0)](_0x37fd9c=>({..._0x37fd9c,'url':_0x57927d(_0x37fd9c['id'])}));await handleSDKOutput(_0x335c45,_0x224229);}else{if(_0x368362[_0xd62cf6(0x1f9)]===0x0)_0x22d475?console[_0xd62cf6(0x1da)](_0xd62cf6(0x284)+_0x22d475):console[_0xd62cf6(0x1da)](_0xd62cf6(0x238));else for(const _0x5a13ed of _0x368362){const _0x282f37=_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)]?a23_0x3b54b8[_0xd62cf6(0x1d6)]('\x20('+formatRows(_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)])+')'):'',_0x42a743=hyperlink(_0x5a13ed['attributes']['name'],_0x57927d(_0x5a13ed['id']));console[_0xd62cf6(0x1da)](_0xd62cf6(0x305)+_0x42a743+_0x282f37);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x277f3c(0x2a0);['description']=a23_0x277f3c(0x27a);async[a23_0x277f3c(0x21f)](_0x27f2b0){const _0x1e9f26=a23_0x277f3c,{options:_0x1e77bb,args:_0x42c79d,tdx:_0x37ac33}=_0x27f2b0;console[_0x1e9f26(0x22f)](_0x1e9f26(0x2f8)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x18b4c7=_0x1e77bb;if(_0x42c79d[_0x1e9f26(0x1f9)]===0x0)return console['error'](a23_0x3b54b8[_0x1e9f26(0x2c2)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x1e9f26(0x22f)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2825c1=_0x42c79d[0x0];if(!_0x18b4c7['database']||!_0x18b4c7[_0x1e9f26(0x2ee)])return console[_0x1e9f26(0x22f)](_0x1e9f26(0x290)),console[_0x1e9f26(0x22f)](_0x1e9f26(0x2e9)),0x1;_0x18b4c7['verbose']&&(console[_0x1e9f26(0x22f)]('Site:\x20'+_0x18b4c7[_0x1e9f26(0x278)]),console['error']('Name:\x20'+_0x2825c1),console['error'](_0x1e9f26(0x1e7)+_0x18b4c7[_0x1e9f26(0x2b2)]),console[_0x1e9f26(0x22f)](_0x1e9f26(0x214)+_0x18b4c7[_0x1e9f26(0x2ee)]));const _0x34a25a=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x204)],_0x18b4c7[_0x1e9f26(0x265)]),_0x15ecdf=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x247)],_0x18b4c7[_0x1e9f26(0x245)]),_0x3f39ae=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x2dd)],_0x18b4c7[_0x1e9f26(0x2d9)]),_0xd70850={'name':_0x2825c1,'description':_0x18b4c7[_0x1e9f26(0x2df)],'scheduleType':_0x18b4c7[_0x1e9f26(0x2b4)],'scheduleOption':_0x18b4c7[_0x1e9f26(0x230)],'timezone':_0x18b4c7[_0x1e9f26(0x274)],'master':{'parentDatabaseName':_0x18b4c7[_0x1e9f26(0x2b2)],'parentTableName':_0x18b4c7[_0x1e9f26(0x2ee)]},'attributes':_0x34a25a,'behaviors':_0x15ecdf,'customerGroup':_0x3f39ae},_0x3b69eb=await withSpinner(_0x1e9f26(0x1ed)+_0x2825c1+_0x1e9f26(0x1d3),()=>_0x37ac33['segment'][_0x1e9f26(0x2cc)](_0xd70850),{'verbose':_0x1e77bb[_0x1e9f26(0x1db)]}),_0x1615c8=_0x3b69eb[_0x1e9f26(0x2b8)];return console[_0x1e9f26(0x22f)](_0x1e9f26(0x1f5)+_0x1615c8[_0x1e9f26(0x2e2)]+_0x1e9f26(0x253)+_0x1615c8['id']),await handleSDKOutput([_0x1615c8],_0x1e77bb),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2a6);[a23_0x277f3c(0x2df)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x2a0716){const _0x21546e=a23_0x277f3c,{options:_0x3e9548,args:_0x14c809,tdx:_0x10d13c}=_0x2a0716;console[_0x21546e(0x22f)](_0x21546e(0x22a)+_0x21546e(0x1d7)+_0x21546e(0x28b));const _0x325916=_0x3e9548;if(_0x14c809[_0x21546e(0x1f9)]===0x0)return console[_0x21546e(0x22f)](a23_0x3b54b8[_0x21546e(0x2c2)](_0x21546e(0x251))),console['error'](_0x21546e(0x2fd)),0x1;const _0x39b2fc=_0x14c809[0x0];_0x325916['verbose']&&(console[_0x21546e(0x22f)](_0x21546e(0x1ff)+_0x325916[_0x21546e(0x278)]),console[_0x21546e(0x22f)](_0x21546e(0x2eb)+_0x39b2fc));const _0x52ddea=await withSpinner(_0x21546e(0x2e4)+_0x39b2fc+'\x27...',()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x2bd)](_0x39b2fc),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x5bbc25=_0x52ddea['data'],_0x313f86=await loadJSONFromOptions(_0x325916[_0x21546e(0x20f)],_0x325916['addAttributesFile']),_0x59d36c=await loadJSONFromOptions(_0x325916[_0x21546e(0x28f)],_0x325916[_0x21546e(0x2ec)]),_0x129343={'name':_0x5bbc25['name'],'description':_0x325916[_0x21546e(0x2df)]!==undefined?_0x325916[_0x21546e(0x2df)]:_0x5bbc25[_0x21546e(0x2df)],'scheduleType':_0x325916['scheduleType']!==undefined?_0x325916[_0x21546e(0x2b4)]:_0x5bbc25[_0x21546e(0x2b4)],'scheduleOption':_0x325916['scheduleOption']!==undefined?_0x325916[_0x21546e(0x230)]:_0x5bbc25[_0x21546e(0x230)],'timezone':_0x325916['timezone']!==undefined?_0x325916['timezone']:_0x5bbc25[_0x21546e(0x274)],'master':_0x5bbc25['master'],'attributes':_0x313f86?[..._0x5bbc25[_0x21546e(0x204)]||[],..._0x313f86]:_0x5bbc25[_0x21546e(0x204)],'behaviors':_0x59d36c?[..._0x5bbc25[_0x21546e(0x247)]||[],..._0x59d36c]:_0x5bbc25[_0x21546e(0x247)],'customerGroup':_0x5bbc25['customerGroup']},_0x89bdf6=await withSpinner(_0x21546e(0x2ab)+_0x39b2fc+_0x21546e(0x1d3),()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x276)](_0x39b2fc,_0x129343),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x26effa=_0x89bdf6[_0x21546e(0x2b8)];return console[_0x21546e(0x22f)](_0x21546e(0x212)+_0x26effa['name']+'\x27'),await handleSDKOutput([_0x26effa],_0x325916),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x28d);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a23_0x277f3c(0x21f)](_0x50d7ce){const _0x3fd43c=a23_0x277f3c,{options:_0x18bdaa,args:_0x358510,tdx:_0x5bcacf}=_0x50d7ce,_0x1a9d38=_0x18bdaa,_0x12ae17=_0x358510[0x0]||_0x18bdaa['parentSegment'];if(!_0x12ae17)return showParentSegmentNotSetError(_0x3fd43c(0x297)+_0x3fd43c(0x2ce)),0x1;if(_0x1a9d38[_0x3fd43c(0x1f8)]&&_0x1a9d38[_0x3fd43c(0x2d7)])return console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x2c2)](_0x3fd43c(0x2d5))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x1d4))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x226)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x3fd43c(0x21e))),0x1;const _0x2fd56b=_0x1a9d38['output']||a23_0x52e31e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x12ae17)+_0x3fd43c(0x255));_0x1a9d38[_0x3fd43c(0x1db)]&&(console['error'](_0x3fd43c(0x1ff)+_0x1a9d38[_0x3fd43c(0x278)]),console['error'](_0x3fd43c(0x2eb)+_0x12ae17),console[_0x3fd43c(0x22f)]('Output\x20file:\x20'+_0x2fd56b));const _0x284b66=await withSpinner(_0x3fd43c(0x232)+_0x12ae17+'\x27...',()=>_0x5bcacf['segment'][_0x3fd43c(0x24c)](_0x12ae17),{'verbose':_0x1a9d38[_0x3fd43c(0x1db)]}),_0x13fc2d=_0x284b66['data'];if(existsSync(_0x2fd56b)){const _0x5606a0=readFileSync(_0x2fd56b,_0x3fd43c(0x1fc)),_0x586a63=generateDiff(_0x5606a0,_0x13fc2d);if(!hasChanges(_0x586a63))console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x1fd)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b)+_0x3fd43c(0x291));else{console[_0x3fd43c(0x22f)](_0x3fd43c(0x275)+_0x2fd56b+'\x27:'),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c)),console[_0x3fd43c(0x22f)](formatDiffWithColors(_0x586a63)),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c));if(!_0x1a9d38['yes']){const _0x49f496=await confirmKey('Overwrite\x20\x27'+_0x2fd56b+'\x27?');if(!_0x49f496)return console['error'](_0x3fd43c(0x223)),0x1;}writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8['green']('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}}else{const _0x4d528e=a23_0x52e31e[_0x3fd43c(0x203)](_0x2fd56b);!existsSync(_0x4d528e)&&mkdirSync(_0x4d528e,{'recursive':!![]}),writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}return saveSessionContext({'parent_segment':_0x12ae17},_0x1a9d38[_0x3fd43c(0x1f1)]),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+'\x20Context\x20set:\x20'+a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x2a9))+_0x3fd43c(0x217)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x12ae17)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x2d4);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1d5);async[a23_0x277f3c(0x21f)](_0x4a9cff){const _0x200437=a23_0x277f3c,{options:_0x4e4636,args:_0x366f24,tdx:_0x4a2ac2}=_0x4a9cff,_0x2b1fdd=_0x4e4636,_0x25a964=_0x366f24[0x0]||_0x4e4636[_0x200437(0x2c3)];if(!_0x25a964)return showParentSegmentNotSetError(_0x200437(0x2f7)+_0x200437(0x243)),0x1;const _0x4cc23c=resolveYamlFile(_0x25a964);if(!existsSync(_0x4cc23c))return showFileNotFoundError(_0x4cc23c,_0x25a964),0x1;_0x2b1fdd[_0x200437(0x1db)]&&(console[_0x200437(0x22f)]('Site:\x20'+_0x2b1fdd['site']),console[_0x200437(0x22f)](_0x200437(0x281)+_0x4cc23c));let _0x230e43;try{_0x230e43=readFileSync(_0x4cc23c,'utf-8');}catch(_0x19667c){const _0x3c6840=_0x19667c instanceof Error?_0x19667c[_0x200437(0x2ad)]:String(_0x19667c);return console[_0x200437(0x22f)]('Error\x20reading\x20file:\x20'+_0x3c6840),0x1;}const _0x4b9080=await withSpinner(_0x200437(0x229),()=>_0x4a2ac2[_0x200437(0x1d8)]['pushParentYaml'](_0x230e43),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0xddb794=_0x4b9080['data'],{isNew:_0x23a8eb,name:_0x5b5818,hasChanges:_0x579c74,diffFormatted:_0x4a2261}=_0xddb794;if(!_0x579c74)return console[_0x200437(0x22f)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5b5818+_0x200437(0x308)),0x0;_0x23a8eb?console[_0x200437(0x22f)](_0x200437(0x1fb)+_0x5b5818+'\x27:'):console[_0x200437(0x22f)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x5b5818+'\x27:');console[_0x200437(0x22f)]('─'[_0x200437(0x2f9)](0x3c)),console[_0x200437(0x22f)](_0x4a2261),console['error']('─'[_0x200437(0x2f9)](0x3c));const _0x37c4c9=_0x23a8eb?'Create\x20parent\x20segment\x20\x27'+_0x5b5818+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x5b5818+'\x27?';if(!_0x2b1fdd[_0x200437(0x2b3)]){const _0x1ff5f6=await confirmKey(_0x37c4c9);if(!_0x1ff5f6)return console['error'](_0x200437(0x223)),0x1;}const _0x27d873=_0x23a8eb?'Creating':_0x200437(0x1e5),_0x5dd550=await withSpinner(_0x27d873+_0x200437(0x2cd)+_0x5b5818+_0x200437(0x1d3),()=>_0xddb794[_0x200437(0x2d2)](),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0x4283a6=_0x5dd550['data'],_0x349836=getConsoleNextUrl(_0x2b1fdd[_0x200437(0x278)],_0x200437(0x26c)+_0x4283a6['id']),_0x36fbd0=_0x23a8eb?'Created':_0x200437(0x220);return console[_0x200437(0x22f)]('✔\x20'+_0x36fbd0+'\x20parent\x20segment\x20\x27'+_0x4283a6[_0x200437(0x2e2)]+'\x27'),console[_0x200437(0x22f)]('\x20\x20'+_0x349836),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2de);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x233);async[a23_0x277f3c(0x21f)](_0x2ebe0a){const _0x1c402e=a23_0x277f3c,{options:_0x187c28,args:_0x21ad54,tdx:_0xc96090}=_0x2ebe0a,_0x1f3687=_0x187c28,_0xe076f9=_0x21ad54[0x0]||_0x187c28['parentSegment'];if(!_0xe076f9)return showParentSegmentNotSetError(_0x1c402e(0x2af)+'\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'+_0x1c402e(0x2da)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1fbef2=resolveYamlFile(_0xe076f9);if(!existsSync(_0x1fbef2))return showFileNotFoundError(_0x1fbef2,_0xe076f9),0x1;_0x1f3687[_0x1c402e(0x1db)]&&(console[_0x1c402e(0x22f)](_0x1c402e(0x1ff)+_0x1f3687[_0x1c402e(0x278)]),console[_0x1c402e(0x22f)](_0x1c402e(0x281)+_0x1fbef2));let _0xf13f0b;try{_0xf13f0b=readFileSync(_0x1fbef2,'utf-8');}catch(_0x4cbc49){const _0x26816b=_0x4cbc49 instanceof Error?_0x4cbc49[_0x1c402e(0x2ad)]:String(_0x4cbc49);return console[_0x1c402e(0x22f)]('Error\x20reading\x20file:\x20'+_0x26816b),0x1;}const _0xc3651c=createCommandSpinner(a23_0x3b54b8[_0x1c402e(0x1d6)](_0x1c402e(0x250)),{'verbose':_0x1f3687[_0x1c402e(0x1db)]});_0xc3651c[_0x1c402e(0x1ea)]();const _0x33dcf8={'onProgress':_0x2f5369=>{const _0x5e09e9=_0x1c402e;_0xc3651c[_0x5e09e9(0x2ed)]=formatProgressMessage(_0x2f5369);}};if(_0x1f3687[_0x1c402e(0x2a5)])_0x33dcf8[_0x1c402e(0x2a5)]=!![];if(_0x1f3687['enriched'])_0x33dcf8[_0x1c402e(0x2cb)]=!![];_0x1f3687[_0x1c402e(0x304)]&&(_0x33dcf8[_0x1c402e(0x304)]=_0x1f3687[_0x1c402e(0x304)]);_0x1f3687['behavior']&&(_0x33dcf8[_0x1c402e(0x307)]=_0x1f3687[_0x1c402e(0x307)]);if(_0x1f3687[_0x1c402e(0x2a2)])_0x33dcf8[_0x1c402e(0x2a2)]=_0x1f3687[_0x1c402e(0x2a2)];let _0x28dc86;try{_0x28dc86=await _0xc96090['segment'][_0x1c402e(0x209)](_0xf13f0b,_0x33dcf8),_0xc3651c['stop']();}catch(_0x5f01e0){_0xc3651c['stop']();throw _0x5f01e0;}const _0x47c733=_0x1f3687[_0x1c402e(0x2a2)]||_0x1c402e(0x21c);return this[_0x1c402e(0x1e1)](_0x28dc86,_0x33dcf8,_0x1fbef2,_0x47c733),_0x28dc86[_0x1c402e(0x306)]?0x0:0x1;}[a23_0x277f3c(0x1e1)](_0x264efe,_0x3fc4d1,_0x37e1d4,_0x702b80){const _0x2e7c13=a23_0x277f3c;console[_0x2e7c13(0x22f)]('\x0a'+a23_0x3b54b8[_0x2e7c13(0x1fa)](_0x2e7c13(0x299))+'\x20'+_0x264efe[_0x2e7c13(0x2e2)]),console['error']('═'[_0x2e7c13(0x2f9)](0x3c)),this[_0x2e7c13(0x207)](_0x264efe);if(typeof _0x3fc4d1[_0x2e7c13(0x304)]==='string'){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this['displayPreviewHints'](_0x37e1d4,_0x702b80,'attribute',_0x3fc4d1[_0x2e7c13(0x304)]);return;}if(_0x3fc4d1[_0x2e7c13(0x304)]===!![]){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'attributes');return;}if(typeof _0x3fc4d1[_0x2e7c13(0x307)]===_0x2e7c13(0x2f1)){this['displayBehaviorsStats'](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'behavior',_0x3fc4d1[_0x2e7c13(0x307)]);return;}if(_0x3fc4d1['behavior']===!![]){this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x247));return;}this[_0x2e7c13(0x2c9)](_0x264efe),this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x2f3));}[a23_0x277f3c(0x23d)](_0x43bdb8,_0x3934c4,_0x15ea74,_0x475367){const _0x285412=a23_0x277f3c;console[_0x285412(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x285412(0x2e7)));const _0x28bc99=_0x3934c4!==_0x285412(0x21c)?_0x285412(0x21a)+_0x3934c4:'';if(_0x15ea74===_0x285412(0x304)&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x237)+_0x475367+'\x22'+_0x28bc99));else{if(_0x15ea74==='behavior'&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x25a)+_0x475367+'\x22'+_0x28bc99));else(_0x15ea74===_0x285412(0x204)||_0x15ea74===_0x285412(0x2f3))&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x1f6)+_0x28bc99));}(_0x15ea74==='behaviors'||_0x15ea74==='all')&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x1f4)+_0x28bc99)),_0x15ea74===_0x285412(0x2f3)&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x235)+_0x28bc99));}[a23_0x277f3c(0x207)](_0x38a838){const _0xeca59c=a23_0x277f3c,{master:_0x371a11}=_0x38a838,_0x3ee99b=_0x371a11[_0xeca59c(0x2c4)]?a23_0x3b54b8[_0xeca59c(0x264)]('✔'):a23_0x3b54b8[_0xeca59c(0x2c2)]('✘');console[_0xeca59c(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0xeca59c(0x1f2))),console[_0xeca59c(0x22f)](_0x3ee99b+'\x20'+a23_0x3b54b8['bold'](_0x371a11['database']+'.'+_0x371a11[_0xeca59c(0x2ee)])),_0x371a11[_0xeca59c(0x2c4)]?_0x371a11['rowCount']!==undefined&&console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8[_0xeca59c(0x1d6)](_0xeca59c(0x298))+'\x20'+a23_0x3b54b8['cyan'](formatRows(_0x371a11[_0xeca59c(0x292)]))):console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8['red']('Error:')+'\x20'+_0x371a11['schemaError']);}[a23_0x277f3c(0x2c9)](_0x48e6c1){const _0x1e5927=a23_0x277f3c;if(_0x48e6c1[_0x1e5927(0x204)][_0x1e5927(0x1f9)]===0x0)return;console[_0x1e5927(0x22f)]('\x0a'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x21b)));for(const _0x1bed6e of _0x48e6c1['attributes']){const _0x3ef676=_0x1bed6e['schemaValid']?a23_0x3b54b8[_0x1e5927(0x264)]('✔'):a23_0x3b54b8[_0x1e5927(0x2c2)]('✘');let _0x575b1a='';if(_0x1bed6e[_0x1e5927(0x2c4)]&&_0x1bed6e[_0x1e5927(0x287)]!==undefined&&_0x1bed6e[_0x1e5927(0x23b)]!==undefined){const _0x200ab9=_0x1bed6e[_0x1e5927(0x23b)]['toFixed'](0x1),_0x9a359b=_0x1bed6e['coveragePercent']>=0x50?a23_0x3b54b8[_0x1e5927(0x264)]:_0x1bed6e[_0x1e5927(0x23b)]>=0x32?a23_0x3b54b8[_0x1e5927(0x25e)]:a23_0x3b54b8[_0x1e5927(0x2c2)];_0x575b1a='\x20'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x218))+'\x20'+_0x9a359b(_0x200ab9+'%')+'\x20('+formatRows(_0x1bed6e['matchedCount'])+_0x1e5927(0x224);}console[_0x1e5927(0x22f)](_0x3ef676+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e['name'])+_0x575b1a),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x2d0))+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e[_0x1e5927(0x2b2)]+'.'+_0x1bed6e[_0x1e5927(0x2ee)]));const _0x2ed294=_0x1bed6e[_0x1e5927(0x2e0)]===_0x1bed6e[_0x1e5927(0x263)]?a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x29a))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]:a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x1de))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]+_0x1e5927(0x217)+_0x1bed6e[_0x1e5927(0x263)];console['error']('\x20\x20'+_0x2ed294),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x248))),this[_0x1e5927(0x28a)](_0x1bed6e['columns']),!_0x1bed6e[_0x1e5927(0x2c4)]&&console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x1e5927(0x2c2)]('Error:')+'\x20'+_0x1bed6e[_0x1e5927(0x236)]);}}[a23_0x277f3c(0x20c)](_0x425190,_0x1c0406){const _0x5d38e8=a23_0x277f3c;if(_0x425190[_0x5d38e8(0x247)][_0x5d38e8(0x1f9)]===0x0)return;console[_0x5d38e8(0x22f)]('\x0a'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x295))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)]('('+_0x1c0406+')'));for(const _0x2d9791 of _0x425190[_0x5d38e8(0x247)]){const _0xb3007b=_0x2d9791[_0x5d38e8(0x2c4)]?a23_0x3b54b8[_0x5d38e8(0x264)]('✔'):a23_0x3b54b8[_0x5d38e8(0x2c2)]('✘');let _0x5b3ad7='';if(_0x2d9791[_0x5d38e8(0x2c4)]&&_0x2d9791[_0x5d38e8(0x225)]!==undefined&&_0x2d9791[_0x5d38e8(0x2fb)]!==undefined){const _0x2c2071=_0x2d9791['customerPercent']?.[_0x5d38e8(0x2fe)](0x1)||'?',_0x181639=(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x32?a23_0x3b54b8['green']:(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x14?a23_0x3b54b8[_0x5d38e8(0x25e)]:a23_0x3b54b8['red'];_0x5b3ad7='\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2e6))+'\x20'+_0x181639(formatRows(_0x2d9791[_0x5d38e8(0x225)]))+'\x20('+_0x2c2071+_0x5d38e8(0x24f)+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x252))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1e6)](formatRows(_0x2d9791[_0x5d38e8(0x2fb)]));}console[_0x5d38e8(0x22f)](_0xb3007b+'\x20'+a23_0x3b54b8['bold'](_0x2d9791[_0x5d38e8(0x2e2)])+_0x5b3ad7),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2d0))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1fa)](_0x2d9791['database']+'.'+_0x2d9791[_0x5d38e8(0x2ee)]));const _0x522c66=_0x2d9791[_0x5d38e8(0x2e0)]===_0x2d9791['foreignKey']?a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x29a))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]:a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x1de))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]+_0x5d38e8(0x217)+_0x2d9791[_0x5d38e8(0x263)];console[_0x5d38e8(0x22f)]('\x20\x20'+_0x522c66),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x248))),this[_0x5d38e8(0x28a)](_0x2d9791[_0x5d38e8(0x20e)]),!_0x2d9791[_0x5d38e8(0x2c4)]&&console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8['red'](_0x5d38e8(0x208))+'\x20'+_0x2d9791[_0x5d38e8(0x236)]);}}[a23_0x277f3c(0x28a)](_0x4c8728){const _0xe8889a=a23_0x277f3c;for(const _0x4971be of _0x4c8728){_0x4971be[_0xe8889a(0x210)]===_0x4971be[_0xe8889a(0x29d)]||_0x4971be['column']==='*'?console[_0xe8889a(0x22f)]('\x20\x20\x20\x20-\x20'+_0x4971be[_0xe8889a(0x210)]):console[_0xe8889a(0x22f)](_0xe8889a(0x2aa)+_0x4971be[_0xe8889a(0x210)]+'\x20'+a23_0x3b54b8[_0xe8889a(0x1d6)]('('+_0x4971be[_0xe8889a(0x29d)]+')'));}}[a23_0x277f3c(0x1ef)](_0x1905c7){const _0x3742f4=a23_0x277f3c;console[_0x3742f4(0x22f)]('─'[_0x3742f4(0x2f9)](0x3c));if(_0x1905c7[_0x3742f4(0x2f2)]['length']>0x0){console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x2c2)](_0x3742f4(0x202)));for(const _0x334761 of _0x1905c7[_0x3742f4(0x2f2)]){console[_0x3742f4(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x3742f4(0x2c2)]('•')+'\x20'+_0x334761);}}_0x1905c7['allValid']&&console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x264)]('✔')+_0x3742f4(0x1e3));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x270);['description']=a23_0x277f3c(0x2c7);async['execute'](_0xbeabdf){const _0x4b6d18=a23_0x277f3c,{options:_0x3d9887,args:_0xe6830c,tdx:_0x3835dc}=_0xbeabdf,_0x398804=_0x3d9887,_0x590d04=_0xe6830c[0x0]||_0x3d9887[_0x4b6d18(0x2c3)];if(!_0x590d04)return showParentSegmentNotSetError(_0x4b6d18(0x2d6)+_0x4b6d18(0x244)+'Options\x20(one\x20required):\x0a'+_0x4b6d18(0x1ce)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4b6d18(0x2ff)+_0x4b6d18(0x231)+_0x4b6d18(0x2e8)),0x1;if(!_0x398804[_0x4b6d18(0x2a5)]&&!_0x398804[_0x4b6d18(0x304)]&&!_0x398804[_0x4b6d18(0x307)]&&!_0x398804[_0x4b6d18(0x2cb)])return console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2d1))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x216)),console['error']('Options:'),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2c8)),console['error'](_0x4b6d18(0x24a)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1e2)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1f7)),0x1;const _0x291d19=resolveYamlFile(_0x590d04);if(!existsSync(_0x291d19))return showFileNotFoundError(_0x291d19,_0x590d04),0x1;_0x398804['verbose']&&(console[_0x4b6d18(0x22f)](_0x4b6d18(0x1ff)+_0x398804[_0x4b6d18(0x278)]),console[_0x4b6d18(0x22f)]('YAML\x20file:\x20'+_0x291d19));let _0x24d62e;try{_0x24d62e=readFileSync(_0x291d19,'utf-8');}catch(_0x3f7e17){const _0x4679de=_0x3f7e17 instanceof Error?_0x3f7e17[_0x4b6d18(0x2ad)]:String(_0x3f7e17);return console['error'](_0x4b6d18(0x24b)+_0x4679de),0x1;}let _0x2b1820;try{_0x2b1820=parseDef(_0x24d62e);}catch(_0x4ac699){const _0x3868fb=_0x4ac699 instanceof Error?_0x4ac699[_0x4b6d18(0x2ad)]:String(_0x4ac699);return console[_0x4b6d18(0x22f)](a23_0x3b54b8['red'](_0x4b6d18(0x27f)+_0x3868fb)),0x1;}if(_0x398804[_0x4b6d18(0x304)]===!![]||_0x398804['attribute']===''){const _0x557b15=_0x2b1820[_0x4b6d18(0x204)]?.[_0x4b6d18(0x1d0)](_0x71f6f8=>_0x71f6f8[_0x4b6d18(0x2e2)])||[];if(_0x557b15['length']===0x0)console[_0x4b6d18(0x22f)](a23_0x3b54b8['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x20b))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2cf));for(const _0x5e7366 of _0x557b15){console['error']('\x20\x20'+a23_0x3b54b8['cyan'](_0x5e7366));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+_0x4b6d18(0x237)+_0x557b15[0x0]+'\x22');}return 0x1;}if(_0x398804['behavior']===!![]||_0x398804[_0x4b6d18(0x307)]===''){const _0x4476b1=_0x2b1820[_0x4b6d18(0x247)]?.[_0x4b6d18(0x1d0)](_0x4b3f68=>_0x4b3f68[_0x4b6d18(0x2e2)])||[];if(_0x4476b1['length']===0x0)console['error'](a23_0x3b54b8[_0x4b6d18(0x2c2)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2a7))),console[_0x4b6d18(0x22f)]('Available\x20behaviors:');for(const _0x534227 of _0x4476b1){console[_0x4b6d18(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x4b6d18(0x1e6)](_0x534227));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+'\x20--behavior\x20\x22'+_0x4476b1[0x0]+'\x22');}return 0x1;}const _0x47c4c4=createCommandSpinner(a23_0x3b54b8['dim'](_0x4b6d18(0x26f)),{'verbose':_0x398804['verbose']});_0x47c4c4[_0x4b6d18(0x1ea)]();const _0x1f1afc={'onProgress':_0x5e02bd=>{const _0x2e73f8=_0x4b6d18;_0x47c4c4[_0x2e73f8(0x2ed)]=formatProgressMessage(_0x5e02bd);}};if(_0x398804[_0x4b6d18(0x2a5)])_0x1f1afc['master']=!![];if(_0x398804['attribute']&&typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x304)]=_0x398804[_0x4b6d18(0x304)];if(_0x398804['behavior']&&typeof _0x398804[_0x4b6d18(0x307)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x307)]=_0x398804['behavior'];if(_0x398804['enriched'])_0x1f1afc[_0x4b6d18(0x2cb)]=!![];if(_0x398804[_0x4b6d18(0x2a2)])_0x1f1afc[_0x4b6d18(0x2a2)]=_0x398804[_0x4b6d18(0x2a2)];let _0x501333;try{_0x501333=await _0x3835dc[_0x4b6d18(0x1d8)]['previewParentYaml'](_0x24d62e,_0x1f1afc),_0x47c4c4[_0x4b6d18(0x2be)]();}catch(_0x432416){_0x47c4c4['stop']();throw _0x432416;}return await this[_0x4b6d18(0x2fa)](_0x501333,{'master':_0x398804[_0x4b6d18(0x2a5)],'attribute':typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1)?_0x398804['attribute']:undefined,'behavior':typeof _0x398804['behavior']===_0x4b6d18(0x2f1)?_0x398804['behavior']:undefined,'enriched':_0x398804['enriched']}),_0x501333['allValid']?0x0:0x1;}async[a23_0x277f3c(0x2fa)](_0x8515c0,_0x3805dd){const _0x124290=a23_0x277f3c;console['error']('\x0a'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x2f0))+'\x20'+_0x8515c0[_0x124290(0x2e2)]),console[_0x124290(0x22f)]('═'[_0x124290(0x2f9)](0x3c));if(_0x3805dd[_0x124290(0x2a5)]&&_0x8515c0[_0x124290(0x303)]){const _0x5e6337=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x26d))+'\x20'+a23_0x3b54b8['bold'](_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2b2)]+'.'+_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2ee)]);await this[_0x124290(0x2b1)](_0x5e6337,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x304)]&&_0x8515c0[_0x124290(0x303)]){const _0x862f70=a23_0x3b54b8['dim'](_0x124290(0x288))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd['attribute']);await this['displaySampleData'](_0x862f70,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x307)]&&_0x8515c0[_0x124290(0x303)]){const _0x131dd5=a23_0x3b54b8['dim']('Behavior:')+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd[_0x124290(0x307)]);await this[_0x124290(0x2b1)](_0x131dd5,_0x8515c0['sampleData']);}else{if(_0x3805dd[_0x124290(0x2cb)]&&_0x8515c0[_0x124290(0x303)]){const _0x27c49c=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x2c0))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x241));await this['displaySampleData'](_0x27c49c,_0x8515c0[_0x124290(0x303)]);}else!_0x8515c0[_0x124290(0x303)]&&console[_0x124290(0x22f)](_0x124290(0x2bf));}}}if(_0x8515c0[_0x124290(0x2f2)][_0x124290(0x1f9)]>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a23_0x3b54b8['red'](_0x124290(0x202)));for(const _0x1eb15f of _0x8515c0[_0x124290(0x2f2)]){console[_0x124290(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x124290(0x2c2)]('•')+'\x20'+_0x1eb15f);}}}async[a23_0x277f3c(0x2b1)](_0x533a2c,_0x419571){const _0x52d459=a23_0x277f3c;if(_0x419571[_0x52d459(0x1f9)]===0x0){console[_0x52d459(0x22f)]('\x0a'+_0x533a2c),console[_0x52d459(0x22f)](_0x52d459(0x2bb));return;}console[_0x52d459(0x22f)]('\x0a'+_0x533a2c);const _0x3e2b17=Object[_0x52d459(0x267)](_0x419571[0x0])['map'](_0x4f34f0=>({'name':_0x4f34f0,'type':typeof _0x419571[0x0][_0x4f34f0]===_0x52d459(0x279)?'double':_0x52d459(0x2bc)})),_0x7583fc={'queryId':_0x52d459(0x2e5),'columns':_0x3e2b17,'data':_0x419571,'stats':{'state':_0x52d459(0x1f0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x419571['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2d677c=formatAsTable(_0x7583fc,_0x419571[_0x52d459(0x1f9)],!![]);await writeOutput(_0x2d677c,undefined,_0x52d459(0x2ee));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]='segment:parent:run';[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1dd);async[a23_0x277f3c(0x21f)](_0xea5fcf){const _0x52ad0b=a23_0x277f3c,{options:_0x39e032,args:_0x4d92ed,tdx:_0x431850}=_0xea5fcf,_0x51f29e=_0x39e032,_0x5ab105=_0x4d92ed[0x0]||_0x39e032[_0x52ad0b(0x2c3)];if(!_0x5ab105)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'+_0x52ad0b(0x215)),0x1;const _0x2a1ea3=resolveYamlFile(_0x5ab105);if(existsSync(_0x2a1ea3)){_0x51f29e[_0x52ad0b(0x1db)]&&console[_0x52ad0b(0x22f)](_0x52ad0b(0x25f)+_0x2a1ea3);let _0x155efc;try{_0x155efc=readFileSync(_0x2a1ea3,_0x52ad0b(0x1fc));}catch(_0x5a4842){const _0x3aac89=_0x5a4842 instanceof Error?_0x5a4842[_0x52ad0b(0x2ad)]:String(_0x5a4842);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x24b)+_0x3aac89),0x1;}const _0x342bf0=await withSpinner(_0x52ad0b(0x229),()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2f4)](_0x155efc),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x25bd73=_0x342bf0['data'],{isNew:_0x19e178,name:_0x1758dc,hasChanges:_0x125ca3,diffFormatted:_0x57dc0b}=_0x25bd73;if(_0x125ca3){_0x19e178?console[_0x52ad0b(0x22f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x1758dc+'\x27:'):console[_0x52ad0b(0x22f)](_0x52ad0b(0x2dc)+_0x1758dc+'\x27:');console['error']('─'[_0x52ad0b(0x2f9)](0x3c)),console[_0x52ad0b(0x22f)](_0x57dc0b),console['error']('─'[_0x52ad0b(0x2f9)](0x3c));const _0x2406e9=_0x19e178?'Create\x20parent\x20segment\x20\x27'+_0x1758dc+_0x52ad0b(0x20a):_0x52ad0b(0x22b)+_0x1758dc+'\x27\x20and\x20run\x20workflow?';if(!_0x51f29e[_0x52ad0b(0x2b3)]){const _0x13de14=await confirmKey(_0x2406e9);if(!_0x13de14)return console['error'](_0x52ad0b(0x223)),0x1;}const _0x52c765=_0x19e178?_0x52ad0b(0x240):_0x52ad0b(0x1e5);await withSpinner(_0x52c765+_0x52ad0b(0x2cd)+_0x1758dc+'\x27...',()=>_0x25bd73[_0x52ad0b(0x2d2)](),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]});const _0x34ba22=_0x19e178?'Created':_0x52ad0b(0x220);console[_0x52ad0b(0x22f)]('✔\x20'+_0x34ba22+_0x52ad0b(0x2cd)+_0x1758dc+'\x27');}else console['error'](_0x52ad0b(0x2ae)+_0x1758dc+_0x52ad0b(0x269));}const _0xf8e14d=await withSpinner(_0x52ad0b(0x273)+_0x5ab105+'\x27...',()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2c6)](_0x5ab105),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x1b7fb1=_0xf8e14d['data'],_0x122ed8=getConsoleUrl(_0x51f29e[_0x52ad0b(0x278)],_0x52ad0b(0x200)+_0x1b7fb1['workflowId']+_0x52ad0b(0x27d)+_0x1b7fb1[_0x52ad0b(0x301)]+_0x52ad0b(0x28c)+_0x1b7fb1[_0x52ad0b(0x26e)]);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x300)),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)](_0x52ad0b(0x23a))+'\x20'+_0x1b7fb1[_0x52ad0b(0x258)]),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x52ad0b(0x293))+'\x20'+_0x1b7fb1[_0x52ad0b(0x260)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Session:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x301)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Attempt:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x26e)]),console[_0x52ad0b(0x22f)]('\x20\x20'+_0x122ed8),console[_0x52ad0b(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x52ad0b(0x256))+_0x52ad0b(0x20d)+_0x1b7fb1[_0x52ad0b(0x26e)]+_0x52ad0b(0x1ee)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a23_0x277f3c(0x1e8);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2ea);async[a23_0x277f3c(0x21f)](_0x3daa06){const _0x54d191=a23_0x277f3c,{options:_0x278015,args:_0x1152b2,tdx:_0x1c5bd7}=_0x3daa06,_0x4e1bf4=_0x1152b2[0x0]||_0x278015[_0x54d191(0x2c3)];if(!_0x4e1bf4)return showParentSegmentNotSetError(_0x54d191(0x2ac)+'\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;_0x278015[_0x54d191(0x1db)]&&(console[_0x54d191(0x22f)](_0x54d191(0x1ff)+_0x278015['site']),console[_0x54d191(0x22f)]('Parent\x20segment:\x20'+_0x4e1bf4));const _0x41d0d2=await withSpinner(_0x54d191(0x282)+_0x4e1bf4+_0x54d191(0x1d3),()=>_0x1c5bd7['segment'][_0x54d191(0x1e0)](_0x4e1bf4),{'verbose':_0x278015[_0x54d191(0x1db)]}),_0x3247d4=_0x41d0d2[_0x54d191(0x2b8)];console[_0x54d191(0x22f)]('✔\x20Found\x20'+_0x3247d4[_0x54d191(0x1f9)]+_0x54d191(0x28e)+(_0x3247d4[_0x54d191(0x1f9)]!==0x1?'s':''));if(_0x278015['json']||_0x278015['jsonl'])return await handleSDKOutput(_0x3247d4,_0x278015),0x0;return displayFieldsHumanReadable(_0x3247d4,_0x4e1bf4),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x27c);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x261);async[a23_0x277f3c(0x21f)](_0x341dd3){const _0xa70fde=a23_0x277f3c,{options:_0x39f364,args:_0x52f6ff,tdx:_0x4a335c}=_0x341dd3,_0x4eefc9=_0x39f364,_0x4bbf8f=_0x52f6ff[0x0]||_0x39f364[_0xa70fde(0x2c3)];if(!_0x4bbf8f)return showParentSegmentNotSetError(_0xa70fde(0x1eb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0xa70fde(0x285)+_0xa70fde(0x249)),0x1;_0x39f364['verbose']&&(console[_0xa70fde(0x22f)](_0xa70fde(0x1ff)+_0x39f364[_0xa70fde(0x278)]),console['error'](_0xa70fde(0x2eb)+_0x4bbf8f));const _0x2bbc05=await withSpinner(_0xa70fde(0x232)+_0x4bbf8f+'\x27...',()=>_0x4a335c[_0xa70fde(0x1d8)][_0xa70fde(0x2bd)](_0x4bbf8f),{'verbose':_0x39f364[_0xa70fde(0x1db)]}),_0x497869=_0x2bbc05[_0xa70fde(0x2b8)];if(_0x4eefc9[_0xa70fde(0x2b0)]){const _0x400641=getConsoleNextUrl(_0x4eefc9[_0xa70fde(0x278)],_0xa70fde(0x26c)+_0x497869['id']);return console[_0xa70fde(0x22f)](a23_0x3b54b8[_0xa70fde(0x264)]('✔')+_0xa70fde(0x2b7)+a23_0x3b54b8[_0xa70fde(0x1e6)](_0x400641)),openBrowser(_0x400641),0x0;}return await handleSingleObjectOutput(_0x497869,_0x39f364),0x0;}}function a23_0x31ab(_0x241fd4,_0x5cf95b){_0x241fd4=_0x241fd4-0x1ce;const _0x1c3770=a23_0x1c37();let _0x31ab54=_0x1c3770[_0x241fd4];return _0x31ab54;}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x23f);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2a1);async[a23_0x277f3c(0x21f)](_0x49e697){const _0x3a5ac9=a23_0x277f3c,{options:_0xbce695,args:_0x1833ac,tdx:_0x177ab6}=_0x49e697,_0x5c8981=_0x1833ac[0x0]||_0xbce695[_0x3a5ac9(0x2c3)];if(!_0x5c8981)return showParentSegmentNotSetError(_0x3a5ac9(0x1f3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0xbce695['verbose']&&(console[_0x3a5ac9(0x22f)](_0x3a5ac9(0x1ff)+_0xbce695[_0x3a5ac9(0x278)]),console[_0x3a5ac9(0x22f)]('Parent\x20segment:\x20'+_0x5c8981));const _0x8d97f5=await withSpinner(_0x3a5ac9(0x213)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6['segment'][_0x3a5ac9(0x2ba)](_0x5c8981),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0xff61bd=_0x8d97f5['data'],_0x495d4c=await withSpinner(_0x3a5ac9(0x234)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6[_0x3a5ac9(0x1d8)]['getParentSQL'](_0xff61bd),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0x1e31f2=await executeSchemaQuery(_0x495d4c['data'],_0x177ab6,_0xbce695);return await handleQueryOutput(_0x1e31f2,_0xbce695),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x266);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x271);async['execute'](_0x5cd95c){const _0x1e9126=a23_0x277f3c,{options:_0x10bc91,args:_0x527a9f,tdx:_0xa18cbe}=_0x5cd95c,_0x2bf3c3=_0x527a9f[0x0]||_0x10bc91[_0x1e9126(0x2c3)];if(!_0x2bf3c3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x10bc91['verbose']&&(console[_0x1e9126(0x22f)](_0x1e9126(0x1ff)+_0x10bc91[_0x1e9126(0x278)]),console['error'](_0x1e9126(0x2eb)+_0x2bf3c3));const _0x35212f=await withSpinner(_0x1e9126(0x213)+_0x2bf3c3+_0x1e9126(0x1d3),()=>_0xa18cbe['segment'][_0x1e9126(0x2ba)](_0x2bf3c3),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x23ec4a=_0x35212f[_0x1e9126(0x2b8)],_0xa868b4=await withSpinner(_0x1e9126(0x234)+_0x2bf3c3+'\x27...',()=>_0xa18cbe[_0x1e9126(0x1d8)][_0x1e9126(0x29f)](_0x23ec4a),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x46cdf2=_0xa868b4[_0x1e9126(0x2b8)];return _0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x22d)||_0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x26a)?await handleSDKOutput([{'sql':_0x46cdf2}],_0x10bc91):console[_0x1e9126(0x1da)](_0x46cdf2),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2f6);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x239);async[a23_0x277f3c(0x21f)](_0xa6d296){const _0x27885f=a23_0x277f3c,{options:_0x1ca982,args:_0x376c8e,tdx:_0x42c33a}=_0xa6d296,_0x5c30be=_0x376c8e[0x0]||_0x1ca982['parentSegment'];if(!_0x5c30be)return showParentSegmentNotSetError(_0x27885f(0x268)+'\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;_0x1ca982[_0x27885f(0x1db)]&&(console['error'](_0x27885f(0x1ff)+_0x1ca982[_0x27885f(0x278)]),console[_0x27885f(0x22f)](_0x27885f(0x2eb)+_0x5c30be));const _0x47c22e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c30be+_0x27885f(0x1d3),()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x2ba)](_0x5c30be),{'verbose':_0x1ca982[_0x27885f(0x1db)]}),_0x52dca3=_0x47c22e['data'],_0x530267=await withSpinner(_0x27885f(0x234)+_0x5c30be+'\x27...',()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x29f)](_0x52dca3),{'verbose':_0x1ca982[_0x27885f(0x1db)]});let _0x3459d9=_0x530267['data'];const _0xe9946c=resolveLimit(_0x1ca982['limit'],DEFAULT_DISPLAY_LIMIT),_0x896dc1=/\bLIMIT\s+\d+/i[_0x27885f(0x26b)](_0x3459d9);!_0x896dc1&&(_0x3459d9=_0x3459d9['trim']()[_0x27885f(0x29c)](/;+$/,''),_0x3459d9=_0x27885f(0x27b)+_0x3459d9+_0x27885f(0x25c)+_0xe9946c);_0x1ca982[_0x27885f(0x1db)]&&console[_0x27885f(0x22f)](_0x27885f(0x222)+_0x3459d9);const _0x51bb1e=await withProgressSpinner(_0x27885f(0x1e4),async _0x321a57=>{const _0x5d5586=_0x27885f,_0x487dff=await _0x42c33a[_0x5d5586(0x205)][_0x5d5586(0x21f)](_0x3459d9,{'catalog':'td','schema':'information_schema','onJobId':_0x347d53=>{const _0x836db6=_0x5d5586;_0x321a57[_0x836db6(0x21d)](_0x347d53);}});return _0x487dff;},{'verbose':_0x1ca982['verbose']}),_0x4c7b1d=_0x51bb1e[_0x27885f(0x2b8)],_0x20c28c=_0x4c7b1d[_0x27885f(0x211)]?_0x27885f(0x25b)+_0x4c7b1d[_0x27885f(0x211)]+']':'';return console[_0x27885f(0x22f)](_0x27885f(0x1cf)+_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x227)]['toLocaleString']()+_0x27885f(0x206)+(_0x27885f(0x283)+formatElapsed(_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x280)])+_0x20c28c)),await handleQueryOutput(_0x4c7b1d,_0x1ca982),0x0;}}
1
+ const a23_0x5f52b8=a23_0x4bc1;(function(_0x1616b8,_0x2b09c1){const _0x25d08a=a23_0x4bc1,_0x325fde=_0x1616b8();while(!![]){try{const _0x238fce=-parseInt(_0x25d08a(0x292))/0x1*(-parseInt(_0x25d08a(0x283))/0x2)+-parseInt(_0x25d08a(0x266))/0x3*(-parseInt(_0x25d08a(0x29b))/0x4)+-parseInt(_0x25d08a(0x2c1))/0x5*(parseInt(_0x25d08a(0x228))/0x6)+-parseInt(_0x25d08a(0x2ad))/0x7*(-parseInt(_0x25d08a(0x1cc))/0x8)+parseInt(_0x25d08a(0x298))/0x9*(-parseInt(_0x25d08a(0x20b))/0xa)+parseInt(_0x25d08a(0x209))/0xb*(-parseInt(_0x25d08a(0x221))/0xc)+parseInt(_0x25d08a(0x21d))/0xd*(-parseInt(_0x25d08a(0x26e))/0xe);if(_0x238fce===_0x2b09c1)break;else _0x325fde['push'](_0x325fde['shift']());}catch(_0x40a702){_0x325fde['push'](_0x325fde['shift']());}}}(a23_0x289e,0xe508d));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x684510 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x12ece1 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x5f52b8(0x2c8),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x1d684c){const _0x26e976=a23_0x5f52b8,_0x16f1fd=process[_0x26e976(0x26b)],_0x142cba=_0x16f1fd==='darwin'?'open':_0x16f1fd===_0x26e976(0x1be)?_0x26e976(0x213):_0x26e976(0x1f8);spawn(_0x142cba,[_0x1d684c],{'detached':!![],'stdio':'ignore'})[_0x26e976(0x21b)]();}function migrateLegacyDirectory(){const _0x372fa2=a23_0x5f52b8;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x53e4de=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x53e4de[_0x372fa2(0x1e6)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a23_0x12ece1[_0x372fa2(0x23f)](_0x372fa2(0x256)+LEGACY_PARENT_SEGMENT_DIR+_0x372fa2(0x1ec)+PARENT_SEGMENT_DIR+_0x372fa2(0x23d))),console[_0x372fa2(0x210)](a23_0x12ece1[_0x372fa2(0x2bf)](_0x372fa2(0x206)+LEGACY_PARENT_SEGMENT_DIR+_0x372fa2(0x21c))),![];console['error'](a23_0x12ece1['yellow'](_0x372fa2(0x2b6)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a23_0x12ece1[_0x372fa2(0x2c4)](_0x372fa2(0x201)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x16a8e9){const _0x21f9f3=_0x16a8e9 instanceof Error?_0x16a8e9[_0x372fa2(0x226)]:String(_0x16a8e9);return console[_0x372fa2(0x210)](a23_0x12ece1[_0x372fa2(0x1e8)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x21f9f3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x5f52b8(0x252)](_0x568294){return migrateLegacyDirectory(),super['run'](_0x568294);}}function resolveYamlFile(_0x11fda0){const _0x3c0682=a23_0x5f52b8;if(_0x11fda0['endsWith'](_0x3c0682(0x2b0))||_0x11fda0[_0x3c0682(0x1d6)](_0x3c0682(0x1da)))return _0x11fda0;return a23_0x684510[_0x3c0682(0x261)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x11fda0)+_0x3c0682(0x2b0));}function formatProgressMessage(_0x2b0eb9){const _0x59d803=a23_0x5f52b8,_0x3d79e2=_0x2b0eb9[_0x59d803(0x262)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3d79e2){const [,_0x3f43ce,_0x3e62a4,_0x360fa8='']=_0x3d79e2;return a23_0x12ece1[_0x59d803(0x2bf)](_0x3f43ce+':')+'\x20'+_0x3e62a4+a23_0x12ece1['dim'](_0x360fa8);}return a23_0x12ece1[_0x59d803(0x2bf)](_0x2b0eb9);}function showFileNotFoundError(_0x4b95c4,_0xace18e){const _0x53c267=a23_0x5f52b8;console[_0x53c267(0x210)](a23_0x12ece1['red'](_0x53c267(0x1a8)+_0x4b95c4+'\x0a')),console[_0x53c267(0x210)](a23_0x12ece1['cyan'](_0x53c267(0x225)+_0xace18e+_0x53c267(0x1de)));}function showParentSegmentNotSetError(_0x28fda9){const _0x23f716=a23_0x5f52b8;console[_0x23f716(0x210)](a23_0x12ece1[_0x23f716(0x23f)](_0x23f716(0x276))),console[_0x23f716(0x210)](_0x28fda9);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]='segment:parent:list';[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x29a);async['execute'](_0x31cd4c){const _0x1d950e=a23_0x5f52b8,{options:_0x27bbf6,args:_0x270ebe,tdx:_0x468bb8}=_0x31cd4c,_0x576674=_0x270ebe[0x0];_0x27bbf6['verbose']&&(console['error'](_0x1d950e(0x1ae)+_0x27bbf6[_0x1d950e(0x23b)]),_0x576674&&console[_0x1d950e(0x210)](_0x1d950e(0x1a2)+_0x576674));const _0x32039a=await withSpinner(_0x576674?_0x1d950e(0x1e0)+_0x576674+_0x1d950e(0x215):_0x1d950e(0x270),()=>_0x468bb8[_0x1d950e(0x222)][_0x1d950e(0x1b8)](),{'verbose':_0x27bbf6['verbose']});let _0x469aee=_0x32039a[_0x1d950e(0x29c)];if(_0x576674){const _0xc4efdc=_0x576674['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')[_0x1d950e(0x282)](/\?/g,'.'),_0x1c3996=new RegExp('^'+_0xc4efdc+'$','i');_0x469aee=_0x469aee[_0x1d950e(0x22e)](_0x5571f2=>_0x1c3996[_0x1d950e(0x231)](_0x5571f2['attributes'][_0x1d950e(0x26c)]));}_0x469aee[_0x1d950e(0x2c3)]((_0x20b6af,_0x40e8d2)=>_0x20b6af['attributes'][_0x1d950e(0x26c)]['localeCompare'](_0x40e8d2[_0x1d950e(0x1ac)][_0x1d950e(0x26c)])),console[_0x1d950e(0x210)]('✔\x20Found\x20'+_0x469aee[_0x1d950e(0x255)]+_0x1d950e(0x20f)+(_0x469aee[_0x1d950e(0x255)]!==0x1?'s':''));const _0x14a931=_0x3f2fa8=>{const _0x25180d=_0x1d950e;return getConsoleNextUrl(_0x27bbf6[_0x25180d(0x23b)],'/app/dw/parentSegments/'+_0x3f2fa8);};if(_0x27bbf6[_0x1d950e(0x2c2)]===_0x1d950e(0x1c2)||_0x27bbf6[_0x1d950e(0x2c2)]===_0x1d950e(0x291)){const _0x151c64=_0x469aee[_0x1d950e(0x1bd)](_0x11833a=>({..._0x11833a,'url':_0x14a931(_0x11833a['id'])}));await handleSDKOutput(_0x151c64,_0x27bbf6);}else{if(_0x469aee[_0x1d950e(0x255)]===0x0)_0x576674?console[_0x1d950e(0x278)](_0x1d950e(0x28b)+_0x576674):console[_0x1d950e(0x278)](_0x1d950e(0x25a));else for(const _0x11222b of _0x469aee){const _0xcb56d5=_0x11222b[_0x1d950e(0x1ac)][_0x1d950e(0x224)]?a23_0x12ece1[_0x1d950e(0x2bf)]('\x20('+formatRows(_0x11222b[_0x1d950e(0x1ac)][_0x1d950e(0x224)])+')'):'',_0x61e352=hyperlink(_0x11222b[_0x1d950e(0x1ac)][_0x1d950e(0x26c)],_0x14a931(_0x11222b['id']));console['log'](_0x1d950e(0x212)+_0x61e352+_0xcb56d5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x204);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x254);async[a23_0x5f52b8(0x234)](_0x54d13f){const _0x323d79=a23_0x5f52b8,{options:_0x3ce1f6,args:_0x44c837,tdx:_0x54163a}=_0x54d13f;console[_0x323d79(0x210)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x11c6e9=_0x3ce1f6;if(_0x44c837[_0x323d79(0x255)]===0x0)return console[_0x323d79(0x210)](a23_0x12ece1[_0x323d79(0x1e8)](_0x323d79(0x1dd))),console['error'](_0x323d79(0x1bb)),0x1;const _0x26fd05=_0x44c837[0x0];if(!_0x11c6e9['database']||!_0x11c6e9[_0x323d79(0x280)])return console['error'](_0x323d79(0x1d9)),console['error'](_0x323d79(0x1bb)),0x1;_0x11c6e9[_0x323d79(0x1cb)]&&(console[_0x323d79(0x210)](_0x323d79(0x1ae)+_0x11c6e9[_0x323d79(0x23b)]),console[_0x323d79(0x210)](_0x323d79(0x2ae)+_0x26fd05),console['error'](_0x323d79(0x1cf)+_0x11c6e9[_0x323d79(0x1ed)]),console[_0x323d79(0x210)](_0x323d79(0x1a6)+_0x11c6e9['table']));const _0x427251=await loadJSONFromOptions(_0x11c6e9['attributes'],_0x11c6e9[_0x323d79(0x28d)]),_0x124fd5=await loadJSONFromOptions(_0x11c6e9['behaviors'],_0x11c6e9[_0x323d79(0x247)]),_0x28be6c=await loadJSONFromOptions(_0x11c6e9[_0x323d79(0x1d5)],_0x11c6e9[_0x323d79(0x1d7)]),_0x3cced7={'name':_0x26fd05,'description':_0x11c6e9[_0x323d79(0x284)],'scheduleType':_0x11c6e9[_0x323d79(0x28a)],'scheduleOption':_0x11c6e9[_0x323d79(0x2af)],'timezone':_0x11c6e9[_0x323d79(0x24d)],'master':{'parentDatabaseName':_0x11c6e9[_0x323d79(0x1ed)],'parentTableName':_0x11c6e9[_0x323d79(0x280)]},'attributes':_0x427251,'behaviors':_0x124fd5,'customerGroup':_0x28be6c},_0x43ba02=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x26fd05+_0x323d79(0x215),()=>_0x54163a[_0x323d79(0x222)][_0x323d79(0x22d)](_0x3cced7),{'verbose':_0x3ce1f6['verbose']}),_0x1a0e5f=_0x43ba02[_0x323d79(0x29c)];return console['error'](_0x323d79(0x290)+_0x1a0e5f[_0x323d79(0x26c)]+_0x323d79(0x2c0)+_0x1a0e5f['id']),await handleSDKOutput([_0x1a0e5f],_0x3ce1f6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]='segment:parent:update';[a23_0x5f52b8(0x284)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x5f52b8(0x234)](_0x1a0f91){const _0x8dcd31=a23_0x5f52b8,{options:_0x10b117,args:_0x3c56b6,tdx:_0x414771}=_0x1a0f91;console['error'](_0x8dcd31(0x233)+_0x8dcd31(0x21f)+_0x8dcd31(0x2be));const _0x56484c=_0x10b117;if(_0x3c56b6[_0x8dcd31(0x255)]===0x0)return console[_0x8dcd31(0x210)](a23_0x12ece1[_0x8dcd31(0x1e8)](_0x8dcd31(0x1dd))),console[_0x8dcd31(0x210)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x494ea3=_0x3c56b6[0x0];_0x56484c[_0x8dcd31(0x1cb)]&&(console[_0x8dcd31(0x210)](_0x8dcd31(0x1ae)+_0x56484c['site']),console['error']('Parent\x20segment:\x20'+_0x494ea3));const _0x1c80a0=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x494ea3+_0x8dcd31(0x215),()=>_0x414771[_0x8dcd31(0x222)][_0x8dcd31(0x1cd)](_0x494ea3),{'verbose':_0x56484c[_0x8dcd31(0x1cb)]}),_0x2bfada=_0x1c80a0[_0x8dcd31(0x29c)],_0x5ec13f=await loadJSONFromOptions(_0x56484c[_0x8dcd31(0x24b)],_0x56484c['addAttributesFile']),_0x36fc16=await loadJSONFromOptions(_0x56484c[_0x8dcd31(0x2b9)],_0x56484c[_0x8dcd31(0x1ce)]),_0x57ae1e={'name':_0x2bfada[_0x8dcd31(0x26c)],'description':_0x56484c[_0x8dcd31(0x284)]!==undefined?_0x56484c['description']:_0x2bfada[_0x8dcd31(0x284)],'scheduleType':_0x56484c[_0x8dcd31(0x28a)]!==undefined?_0x56484c[_0x8dcd31(0x28a)]:_0x2bfada[_0x8dcd31(0x28a)],'scheduleOption':_0x56484c[_0x8dcd31(0x2af)]!==undefined?_0x56484c[_0x8dcd31(0x2af)]:_0x2bfada[_0x8dcd31(0x2af)],'timezone':_0x56484c[_0x8dcd31(0x24d)]!==undefined?_0x56484c[_0x8dcd31(0x24d)]:_0x2bfada[_0x8dcd31(0x24d)],'master':_0x2bfada[_0x8dcd31(0x26d)],'attributes':_0x5ec13f?[..._0x2bfada[_0x8dcd31(0x1ac)]||[],..._0x5ec13f]:_0x2bfada['attributes'],'behaviors':_0x36fc16?[..._0x2bfada['behaviors']||[],..._0x36fc16]:_0x2bfada[_0x8dcd31(0x2b1)],'customerGroup':_0x2bfada['customerGroup']},_0x90e2cb=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x494ea3+_0x8dcd31(0x215),()=>_0x414771['segment']['updateParent'](_0x494ea3,_0x57ae1e),{'verbose':_0x56484c[_0x8dcd31(0x1cb)]}),_0x57d00d=_0x90e2cb[_0x8dcd31(0x29c)];return console[_0x8dcd31(0x210)](_0x8dcd31(0x22a)+_0x57d00d[_0x8dcd31(0x26c)]+'\x27'),await handleSDKOutput([_0x57d00d],_0x56484c),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x2b5);['description']=a23_0x5f52b8(0x1bc);async[a23_0x5f52b8(0x234)](_0x21cff2){const _0x4e99e7=a23_0x5f52b8,{options:_0x453847,args:_0x587e05,tdx:_0x14717e}=_0x21cff2,_0x2e0e94=_0x453847,_0xd8a2f9=_0x587e05[0x0]||_0x453847[_0x4e99e7(0x240)];if(!_0xd8a2f9)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x2e0e94[_0x4e99e7(0x2a9)]&&_0x2e0e94[_0x4e99e7(0x1b2)])return console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x1e8)](_0x4e99e7(0x1f3))),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2bf)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2bf)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x4e99e7(0x294))),console['error'](a23_0x12ece1[_0x4e99e7(0x220)](_0x4e99e7(0x299))),0x1;const _0x2b51d6=_0x2e0e94[_0x4e99e7(0x1b2)]||a23_0x684510['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd8a2f9)+_0x4e99e7(0x2b0));_0x2e0e94[_0x4e99e7(0x1cb)]&&(console[_0x4e99e7(0x210)]('Site:\x20'+_0x2e0e94[_0x4e99e7(0x23b)]),console['error']('Parent\x20segment:\x20'+_0xd8a2f9),console[_0x4e99e7(0x210)]('Output\x20file:\x20'+_0x2b51d6));const _0x11e254=await withSpinner(_0x4e99e7(0x2b3)+_0xd8a2f9+'\x27...',()=>_0x14717e[_0x4e99e7(0x222)][_0x4e99e7(0x1b6)](_0xd8a2f9),{'verbose':_0x2e0e94['verbose']}),_0x31ee00=_0x11e254['data'];if(existsSync(_0x2b51d6)){const _0x219e7a=readFileSync(_0x2b51d6,_0x4e99e7(0x232)),_0x1b283f=generateDiff(_0x219e7a,_0x31ee00);if(!hasChanges(_0x1b283f))console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2c4)]('✔')+_0x4e99e7(0x20e)+a23_0x12ece1[_0x4e99e7(0x220)](_0x2b51d6)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x4e99e7(0x210)](_0x4e99e7(0x1af)+_0x2b51d6+'\x27:'),console[_0x4e99e7(0x210)]('─'[_0x4e99e7(0x1c1)](0x3c)),console[_0x4e99e7(0x210)](formatDiffWithColors(_0x1b283f)),console[_0x4e99e7(0x210)]('─'[_0x4e99e7(0x1c1)](0x3c));if(!_0x2e0e94[_0x4e99e7(0x23c)]){const _0x404844=await confirmKey(_0x4e99e7(0x1a9)+_0x2b51d6+'\x27?');if(!_0x404844)return console['error']('Aborted.'),0x1;}writeFileSync(_0x2b51d6,_0x31ee00,_0x4e99e7(0x232)),console[_0x4e99e7(0x210)](a23_0x12ece1['green']('✔')+_0x4e99e7(0x259)+a23_0x12ece1['cyan'](_0x2b51d6));}}else{const _0x16ddcc=a23_0x684510[_0x4e99e7(0x21a)](_0x2b51d6);!existsSync(_0x16ddcc)&&mkdirSync(_0x16ddcc,{'recursive':!![]}),writeFileSync(_0x2b51d6,_0x31ee00,_0x4e99e7(0x232)),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2c4)]('✔')+_0x4e99e7(0x259)+a23_0x12ece1['cyan'](_0x2b51d6));}return saveSessionContext({'parent_segment':_0xd8a2f9},_0x2e0e94[_0x4e99e7(0x242)]),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2c4)]('✔')+_0x4e99e7(0x1a4)+a23_0x12ece1[_0x4e99e7(0x2bf)](_0x4e99e7(0x203))+_0x4e99e7(0x2a7)+a23_0x12ece1[_0x4e99e7(0x220)](_0xd8a2f9)),0x0;}}function a23_0x4bc1(_0x46b7db,_0x32f5c9){_0x46b7db=_0x46b7db-0x1a1;const _0x289e4f=a23_0x289e();let _0x4bc168=_0x289e4f[_0x46b7db];return _0x4bc168;}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x275);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x27f);async['execute'](_0x307fd2){const _0x170147=a23_0x5f52b8,{options:_0x1d5181,args:_0x4bb015,tdx:_0x48bea7}=_0x307fd2,_0x226f6b=_0x1d5181,_0x4dee34=_0x4bb015[0x0]||_0x1d5181['parentSegment'];if(!_0x4dee34)return showParentSegmentNotSetError(_0x170147(0x1ff)+_0x170147(0x2bc)),0x1;const _0xb5d7bf=resolveYamlFile(_0x4dee34);if(!existsSync(_0xb5d7bf))return showFileNotFoundError(_0xb5d7bf,_0x4dee34),0x1;_0x226f6b['verbose']&&(console[_0x170147(0x210)](_0x170147(0x1ae)+_0x226f6b[_0x170147(0x23b)]),console[_0x170147(0x210)](_0x170147(0x25d)+_0xb5d7bf));let _0x4bad31;try{_0x4bad31=readFileSync(_0xb5d7bf,_0x170147(0x232));}catch(_0x29d9a5){const _0x146f75=_0x29d9a5 instanceof Error?_0x29d9a5[_0x170147(0x226)]:String(_0x29d9a5);return console[_0x170147(0x210)](_0x170147(0x202)+_0x146f75),0x1;}const _0x3ca824=await withSpinner(_0x170147(0x257),()=>_0x48bea7[_0x170147(0x222)][_0x170147(0x2a4)](_0x4bad31),{'verbose':_0x226f6b['verbose']}),_0x1182ad=_0x3ca824[_0x170147(0x29c)],{isNew:_0x24b8b7,name:_0x40e5c4,hasChanges:_0x100a4f,diffFormatted:_0x1d1e68}=_0x1182ad;if(!_0x100a4f)return console[_0x170147(0x210)](_0x170147(0x1f1)+_0x40e5c4+_0x170147(0x29d)),0x0;_0x24b8b7?console[_0x170147(0x210)](_0x170147(0x25f)+_0x40e5c4+'\x27:'):console[_0x170147(0x210)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x40e5c4+'\x27:');console[_0x170147(0x210)]('─'[_0x170147(0x1c1)](0x3c)),console[_0x170147(0x210)](_0x1d1e68),console[_0x170147(0x210)]('─'[_0x170147(0x1c1)](0x3c));const _0xc50f44=_0x24b8b7?_0x170147(0x1a3)+_0x40e5c4+'\x27?':_0x170147(0x272)+_0x40e5c4+'\x27?';if(!_0x226f6b[_0x170147(0x23c)]){const _0x274d20=await confirmKey(_0xc50f44);if(!_0x274d20)return console[_0x170147(0x210)]('Aborted.'),0x1;}const _0x129b09=_0x24b8b7?'Creating':_0x170147(0x1b0),_0x17ad2a=await withSpinner(_0x129b09+_0x170147(0x246)+_0x40e5c4+_0x170147(0x215),()=>_0x1182ad[_0x170147(0x281)](),{'verbose':_0x226f6b['verbose']}),_0x19ee47=_0x17ad2a[_0x170147(0x29c)],_0x393043=getConsoleNextUrl(_0x226f6b[_0x170147(0x23b)],_0x170147(0x21e)+_0x19ee47['id']),_0x5c2df9=_0x24b8b7?'Created':_0x170147(0x296);return console[_0x170147(0x210)]('✔\x20'+_0x5c2df9+_0x170147(0x246)+_0x19ee47[_0x170147(0x26c)]+'\x27'),console[_0x170147(0x210)]('\x20\x20'+_0x393043),0x0;}}function a23_0x289e(){const _0x267b7e=['✔\x20Created\x20parent\x20segment\x20\x27','jsonl','2101ogcsSB','string','/{name}.yml\x0a','Parent\x20segment:\x20','Updated','stop','31905JilIlF','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','List\x20parent\x20segments','2257468ChRmxL','data','\x27\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','trim','elapsedTimeMillis','Behaviors','Error:\x20--attribute\x20requires\x20a\x20name\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','pushParentYaml','Preview:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20=\x20','toLocaleString','use','varchar','audienceId','\x20Configuration\x20is\x20valid','4668146sDGIhO','Name:\x20','scheduleOption','.yml','behaviors','\x0aNo\x20sample\x20data\x20available','Fetching\x20parent\x20segment\x20\x27','segment:parent:view','segment:parent:pull','\x0a⚠️\x20\x20Migrating:\x20','segment:parent:desc','-1d','addBehaviors','label','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','dim','\x27\x20with\x20ID:\x20','1105NNvARy','format','sort','green','previewParentYaml','segment:parent:show','Validating\x20configuration...','parent_segments','Fetching\x20SQL\x20for\x20\x27','\x27\x20is\x20up\x20to\x20date','displayBehaviorsStats','Master:','Pattern:\x20','Create\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','displayAttributesStats','Table:\x20','runParent','Error:\x20File\x20not\x20found:\x20','Overwrite\x20\x27','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','attributes','Error:','Site:\x20','\x0aChanges\x20to\x20\x27','Updating','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','output','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','keys','Enriched:','pullParentYaml','displayMasterInfo','listParents','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Options:\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','map','win32','displayPreviewHints','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','repeat','json','Created','Session:','getParentSQL','\x20--behavior\x20\x22','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','displayPreviewResults','Listing\x20fields\x20for\x20\x27','verbose','16fVZCaW','getParentFull','addBehaviorsFile','Database:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','workflowAttemptId','\x20tdx\x20wf\x20attempt\x20','%)\x20','\x20--attribute\x20\x22','customerGroup','endsWith','customerGroupFile','bold','Error:\x20--database\x20and\x20--table\x20are\x20required','.yaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Customers:','Error:\x20Parent\x20segment\x20name\x20is\x20required','`\x20to\x20download\x20the\x20configuration\x20first','customersWithEvents','Listing\x20parent\x20segments\x20matching\x20\x27','foreignKey','To\x20view\x20sample\x20data:','Events:','Errors:','Attributes','isDirectory','Join\x20on:','red','behavior','workflowSessionId','rowCount','/\x20and\x20','database','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','status','\x27\x20and\x20run\x20workflow?','✔\x20No\x20changes\x20-\x20\x27','Columns:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','in\x20','limit','attribute','Master\x20Table','xdg-open','displaySampleData','SELECT\x20*\x20FROM\x20(\x0a','customerPercent','/app/workflows/','segment:parent:sql','Behavior:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a✔\x20Workflow\x20started','✔\x20Renamed\x20directory\x20to\x20','Error\x20reading\x20file:\x20','parent_segment','segment:parent:create','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Attempt:','workflowId','33rZcsdt','toFixed','20AlHhMw','jobId','schemaError','\x20No\x20changes\x20-\x20','\x20parent\x20segment','error','/sessions/','👥\x20','start','segment:parent:validate','\x27...','SQL\x20query:\x0a','resolveParentId','Validate:','Creating','dirname','unref','/\x20directory.\x0a','9675146Wvyekp','/app/dw/parentSegments/','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','cyan','3287676MTbqfY','segment','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','population','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','message','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','11928VVRKkB','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','✔\x20Updated\x20parent\x20segment\x20\x27','column','Aborted.','createParent','filter','setJobId','tdx\x20segment\x20parent\x20preview\x20','test','utf-8','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','execute','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','web','all','listFields','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20--behavior\x20\x22<name>\x22','site','yes','/\x20directories\x20exist.','text','yellow','parentSegment','processedRows','session','Show\x20parent\x20segment\x20schema\x20(column\x20types)','displaySummary','✔\x20Query\x20completed:\x20Processed\x20','\x20parent\x20segment\x20\x27','behaviorsFile','Master\x20+\x20Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20rows)','addAttributes','double','timezone','schemaValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','stats','List\x20available\x20fields\x20for\x20segmentation','run','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','length','\x0a⚠️\x20\x20Both\x20','Analyzing\x20changes...','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','No\x20parent\x20segments\x20found','Status:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','YAML\x20file:\x20','\x20\x20No\x20sample\x20data\x20available','\x0aNew\x20parent\x20segment\x20\x27','\x20Opening\x20','join','match','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x0aChanges\x20to\x20apply\x20to\x20\x27','sampleData','3bWdqVT','Executing\x20parent\x20segment\x20query...','FINISHED','joinKey','preview','platform','name','master','14nWtGeM','Error\x20parsing\x20YAML:\x20','Listing\x20parent\x20segments...','enriched','Apply\x20changes\x20to\x20\x27','displayColumns','Join:','segment:parent:push','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','matchedCount','log','Show\x20parent\x20segment\x20details','displayValidateResults','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','totalEvents','information_schema','Rows:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','table','apply','replace','1002ZpSkos','description','errors','Options:','allValid','coveragePercent','segment:parent:preview','scheduleType','No\x20parent\x20segments\x20match\x20pattern:\x20','interval','attributesFile','Available\x20attributes:','segment:parent:fields'];a23_0x289e=function(){return _0x267b7e;};return a23_0x289e();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x5f52b8(0x214);[a23_0x5f52b8(0x284)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a23_0x5f52b8(0x234)](_0x26eff9){const _0x3ca651=a23_0x5f52b8,{options:_0x3fd6e4,args:_0x197dad,tdx:_0x43f26d}=_0x26eff9,_0x18b370=_0x3fd6e4,_0xfb6c5f=_0x197dad[0x0]||_0x3fd6e4['parentSegment'];if(!_0xfb6c5f)return showParentSegmentNotSetError(_0x3ca651(0x223)+_0x3ca651(0x2a3)+_0x3ca651(0x1ba)+_0x3ca651(0x1ee)+_0x3ca651(0x27b)+_0x3ca651(0x263)),0x1;const _0x2b9d1f=resolveYamlFile(_0xfb6c5f);if(!existsSync(_0x2b9d1f))return showFileNotFoundError(_0x2b9d1f,_0xfb6c5f),0x1;_0x18b370[_0x3ca651(0x1cb)]&&(console[_0x3ca651(0x210)](_0x3ca651(0x1ae)+_0x18b370[_0x3ca651(0x23b)]),console['error']('YAML\x20file:\x20'+_0x2b9d1f));let _0x3df3dd;try{_0x3df3dd=readFileSync(_0x2b9d1f,_0x3ca651(0x232));}catch(_0x2d5e09){const _0x6c6155=_0x2d5e09 instanceof Error?_0x2d5e09['message']:String(_0x2d5e09);return console[_0x3ca651(0x210)]('Error\x20reading\x20file:\x20'+_0x6c6155),0x1;}const _0x3ee4fa=createCommandSpinner(a23_0x12ece1[_0x3ca651(0x2bf)](_0x3ca651(0x2c7)),{'verbose':_0x18b370[_0x3ca651(0x1cb)]});_0x3ee4fa[_0x3ca651(0x213)]();const _0x328093={'onProgress':_0x396bef=>{const _0x3c6bf8=_0x3ca651;_0x3ee4fa[_0x3c6bf8(0x23e)]=formatProgressMessage(_0x396bef);}};if(_0x18b370[_0x3ca651(0x26d)])_0x328093['master']=!![];if(_0x18b370[_0x3ca651(0x271)])_0x328093['enriched']=!![];_0x18b370[_0x3ca651(0x1f6)]&&(_0x328093[_0x3ca651(0x1f6)]=_0x18b370['attribute']);_0x18b370['behavior']&&(_0x328093[_0x3ca651(0x1e9)]=_0x18b370[_0x3ca651(0x1e9)]);if(_0x18b370[_0x3ca651(0x28c)])_0x328093[_0x3ca651(0x28c)]=_0x18b370[_0x3ca651(0x28c)];let _0x148d0d;try{_0x148d0d=await _0x43f26d[_0x3ca651(0x222)]['validateParentYaml'](_0x3df3dd,_0x328093),_0x3ee4fa['stop']();}catch(_0x5a347f){_0x3ee4fa[_0x3ca651(0x297)]();throw _0x5a347f;}const _0x8c7510=_0x18b370[_0x3ca651(0x28c)]||_0x3ca651(0x2b8);return this[_0x3ca651(0x27a)](_0x148d0d,_0x328093,_0x2b9d1f,_0x8c7510),_0x148d0d[_0x3ca651(0x287)]?0x0:0x1;}['displayValidateResults'](_0x4107ee,_0xe046fb,_0x29e400,_0x2da93c){const _0x4bbba0=a23_0x5f52b8;console[_0x4bbba0(0x210)]('\x0a'+a23_0x12ece1['bold'](_0x4bbba0(0x218))+'\x20'+_0x4107ee[_0x4bbba0(0x26c)]),console[_0x4bbba0(0x210)]('═'[_0x4bbba0(0x1c1)](0x3c)),this[_0x4bbba0(0x1b7)](_0x4107ee);if(typeof _0xe046fb['attribute']===_0x4bbba0(0x293)){this[_0x4bbba0(0x1a5)](_0x4107ee),this[_0x4bbba0(0x244)](_0x4107ee),this['displayPreviewHints'](_0x29e400,_0x2da93c,_0x4bbba0(0x1f6),_0xe046fb[_0x4bbba0(0x1f6)]);return;}if(_0xe046fb[_0x4bbba0(0x1f6)]===!![]){this['displayAttributesStats'](_0x4107ee),this[_0x4bbba0(0x244)](_0x4107ee),this[_0x4bbba0(0x1bf)](_0x29e400,_0x2da93c,_0x4bbba0(0x1ac));return;}if(typeof _0xe046fb[_0x4bbba0(0x1e9)]==='string'){this[_0x4bbba0(0x2cb)](_0x4107ee,_0x2da93c),this['displaySummary'](_0x4107ee),this[_0x4bbba0(0x1bf)](_0x29e400,_0x2da93c,_0x4bbba0(0x1e9),_0xe046fb[_0x4bbba0(0x1e9)]);return;}if(_0xe046fb[_0x4bbba0(0x1e9)]===!![]){this[_0x4bbba0(0x2cb)](_0x4107ee,_0x2da93c),this['displaySummary'](_0x4107ee),this['displayPreviewHints'](_0x29e400,_0x2da93c,_0x4bbba0(0x2b1));return;}this['displayAttributesStats'](_0x4107ee),this['displayBehaviorsStats'](_0x4107ee,_0x2da93c),this['displaySummary'](_0x4107ee),this['displayPreviewHints'](_0x29e400,_0x2da93c,_0x4bbba0(0x237));}[a23_0x5f52b8(0x1bf)](_0x4143ad,_0x5cf5b9,_0x31484f,_0x2a2bbd){const _0xcad1de=a23_0x5f52b8;console[_0xcad1de(0x210)]('\x0a'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x1e2)));const _0x50e53d=_0x5cf5b9!==_0xcad1de(0x2b8)?'\x20--interval\x20'+_0x5cf5b9:'';if(_0x31484f===_0xcad1de(0x1f6)&&_0x2a2bbd)console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1['dim'](_0xcad1de(0x230)+_0x4143ad+'\x20--attribute\x20\x22'+_0x2a2bbd+'\x22'+_0x50e53d));else{if(_0x31484f==='behavior'&&_0x2a2bbd)console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x230)+_0x4143ad+'\x20--behavior\x20\x22'+_0x2a2bbd+'\x22'+_0x50e53d));else(_0x31484f==='attributes'||_0x31484f===_0xcad1de(0x237))&&console['error']('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x230)+_0x4143ad+'\x20--attribute\x20\x22<name>\x22'+_0x50e53d));}(_0x31484f===_0xcad1de(0x2b1)||_0x31484f===_0xcad1de(0x237))&&console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)]('tdx\x20segment\x20parent\x20preview\x20'+_0x4143ad+_0xcad1de(0x23a)+_0x50e53d)),_0x31484f===_0xcad1de(0x237)&&console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x230)+_0x4143ad+'\x20--enriched'+_0x50e53d));}[a23_0x5f52b8(0x1b7)](_0x43b858){const _0x265de2=a23_0x5f52b8,{master:_0x5bec0d}=_0x43b858,_0x3992af=_0x5bec0d[_0x265de2(0x24e)]?a23_0x12ece1['green']('✔'):a23_0x12ece1[_0x265de2(0x1e8)]('✘');console[_0x265de2(0x210)]('\x0a'+a23_0x12ece1[_0x265de2(0x2bf)](_0x265de2(0x1f7))),console[_0x265de2(0x210)](_0x3992af+'\x20'+a23_0x12ece1['bold'](_0x5bec0d[_0x265de2(0x1ed)]+'.'+_0x5bec0d['table'])),_0x5bec0d[_0x265de2(0x24e)]?_0x5bec0d[_0x265de2(0x1eb)]!==undefined&&console[_0x265de2(0x210)]('\x20\x20'+a23_0x12ece1[_0x265de2(0x2bf)](_0x265de2(0x27e))+'\x20'+a23_0x12ece1[_0x265de2(0x220)](formatRows(_0x5bec0d['rowCount']))):console['error']('\x20\x20'+a23_0x12ece1['red']('Error:')+'\x20'+_0x5bec0d[_0x265de2(0x20d)]);}[a23_0x5f52b8(0x1a5)](_0x16d05f){const _0x2caa25=a23_0x5f52b8;if(_0x16d05f[_0x2caa25(0x1ac)][_0x2caa25(0x255)]===0x0)return;console['error']('\x0a'+a23_0x12ece1[_0x2caa25(0x2bf)](_0x2caa25(0x1e5)));for(const _0x3926e5 of _0x16d05f['attributes']){const _0x2a88ee=_0x3926e5[_0x2caa25(0x24e)]?a23_0x12ece1[_0x2caa25(0x2c4)]('✔'):a23_0x12ece1[_0x2caa25(0x1e8)]('✘');let _0x5aa4ea='';if(_0x3926e5[_0x2caa25(0x24e)]&&_0x3926e5[_0x2caa25(0x277)]!==undefined&&_0x3926e5['coveragePercent']!==undefined){const _0x37b140=_0x3926e5[_0x2caa25(0x288)][_0x2caa25(0x20a)](0x1),_0x5c57e8=_0x3926e5[_0x2caa25(0x288)]>=0x50?a23_0x12ece1[_0x2caa25(0x2c4)]:_0x3926e5['coveragePercent']>=0x32?a23_0x12ece1[_0x2caa25(0x23f)]:a23_0x12ece1[_0x2caa25(0x1e8)];_0x5aa4ea='\x20'+a23_0x12ece1[_0x2caa25(0x2bf)]('Coverage:')+'\x20'+_0x5c57e8(_0x37b140+'%')+'\x20('+formatRows(_0x3926e5[_0x2caa25(0x277)])+_0x2caa25(0x24a);}console[_0x2caa25(0x210)](_0x2a88ee+'\x20'+a23_0x12ece1[_0x2caa25(0x1d8)](_0x3926e5[_0x2caa25(0x26c)])+_0x5aa4ea),console[_0x2caa25(0x210)]('\x20\x20'+a23_0x12ece1[_0x2caa25(0x2bf)]('Source:')+'\x20'+a23_0x12ece1[_0x2caa25(0x1d8)](_0x3926e5[_0x2caa25(0x1ed)]+'.'+_0x3926e5[_0x2caa25(0x280)]));const _0x293857=_0x3926e5[_0x2caa25(0x269)]===_0x3926e5['foreignKey']?a23_0x12ece1[_0x2caa25(0x2bf)]('Join\x20on:')+'\x20'+_0x3926e5[_0x2caa25(0x269)]:a23_0x12ece1[_0x2caa25(0x2bf)](_0x2caa25(0x274))+'\x20'+_0x3926e5['joinKey']+_0x2caa25(0x2a7)+_0x3926e5[_0x2caa25(0x1e1)];console[_0x2caa25(0x210)]('\x20\x20'+_0x293857),console['error']('\x20\x20'+a23_0x12ece1[_0x2caa25(0x2bf)](_0x2caa25(0x1f2))),this['displayColumns'](_0x3926e5['columns']),!_0x3926e5['schemaValid']&&console['error']('\x20\x20'+a23_0x12ece1[_0x2caa25(0x1e8)](_0x2caa25(0x1ad))+'\x20'+_0x3926e5['schemaError']);}}[a23_0x5f52b8(0x2cb)](_0x161b12,_0x4480a4){const _0x2b718b=a23_0x5f52b8;if(_0x161b12[_0x2b718b(0x2b1)][_0x2b718b(0x255)]===0x0)return;console['error']('\x0a'+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x2a1))+'\x20'+a23_0x12ece1['dim']('('+_0x4480a4+')'));for(const _0x296182 of _0x161b12[_0x2b718b(0x2b1)]){const _0x307ff3=_0x296182[_0x2b718b(0x24e)]?a23_0x12ece1[_0x2b718b(0x2c4)]('✔'):a23_0x12ece1['red']('✘');let _0x5c2d40='';if(_0x296182[_0x2b718b(0x24e)]&&_0x296182[_0x2b718b(0x1df)]!==undefined&&_0x296182['totalEvents']!==undefined){const _0x546e45=_0x296182['customerPercent']?.[_0x2b718b(0x20a)](0x1)||'?',_0x126043=(_0x296182['customerPercent']??0x0)>=0x32?a23_0x12ece1[_0x2b718b(0x2c4)]:(_0x296182[_0x2b718b(0x1fb)]??0x0)>=0x14?a23_0x12ece1[_0x2b718b(0x23f)]:a23_0x12ece1[_0x2b718b(0x1e8)];_0x5c2d40='\x20'+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1dc))+'\x20'+_0x126043(formatRows(_0x296182['customersWithEvents']))+'\x20('+_0x546e45+_0x2b718b(0x1d3)+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1e3))+'\x20'+a23_0x12ece1[_0x2b718b(0x220)](formatRows(_0x296182[_0x2b718b(0x27c)]));}console[_0x2b718b(0x210)](_0x307ff3+'\x20'+a23_0x12ece1[_0x2b718b(0x1d8)](_0x296182[_0x2b718b(0x26c)])+_0x5c2d40),console[_0x2b718b(0x210)]('\x20\x20'+a23_0x12ece1[_0x2b718b(0x2bf)]('Source:')+'\x20'+a23_0x12ece1[_0x2b718b(0x1d8)](_0x296182[_0x2b718b(0x1ed)]+'.'+_0x296182[_0x2b718b(0x280)]));const _0x56d806=_0x296182[_0x2b718b(0x269)]===_0x296182[_0x2b718b(0x1e1)]?a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1e7))+'\x20'+_0x296182[_0x2b718b(0x269)]:a23_0x12ece1[_0x2b718b(0x2bf)]('Join:')+'\x20'+_0x296182['joinKey']+_0x2b718b(0x2a7)+_0x296182[_0x2b718b(0x1e1)];console[_0x2b718b(0x210)]('\x20\x20'+_0x56d806),console['error']('\x20\x20'+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1f2))),this[_0x2b718b(0x273)](_0x296182['columns']),!_0x296182[_0x2b718b(0x24e)]&&console[_0x2b718b(0x210)]('\x20\x20'+a23_0x12ece1[_0x2b718b(0x1e8)](_0x2b718b(0x1ad))+'\x20'+_0x296182[_0x2b718b(0x20d)]);}}[a23_0x5f52b8(0x273)](_0x128c44){const _0x55a2ef=a23_0x5f52b8;for(const _0x5b5de7 of _0x128c44){_0x5b5de7['label']===_0x5b5de7['column']||_0x5b5de7[_0x55a2ef(0x22b)]==='*'?console[_0x55a2ef(0x210)]('\x20\x20\x20\x20-\x20'+_0x5b5de7['label']):console['error']('\x20\x20\x20\x20-\x20'+_0x5b5de7[_0x55a2ef(0x2ba)]+'\x20'+a23_0x12ece1[_0x55a2ef(0x2bf)]('('+_0x5b5de7[_0x55a2ef(0x22b)]+')'));}}[a23_0x5f52b8(0x244)](_0x50e1c3){const _0x25febc=a23_0x5f52b8;console[_0x25febc(0x210)]('─'[_0x25febc(0x1c1)](0x3c));if(_0x50e1c3[_0x25febc(0x285)][_0x25febc(0x255)]>0x0){console[_0x25febc(0x210)]('\x0a'+a23_0x12ece1[_0x25febc(0x1e8)](_0x25febc(0x1e4)));for(const _0x20aea3 of _0x50e1c3[_0x25febc(0x285)]){console['error']('\x20\x20'+a23_0x12ece1['red']('•')+'\x20'+_0x20aea3);}}_0x50e1c3[_0x25febc(0x287)]&&console[_0x25febc(0x210)]('\x0a'+a23_0x12ece1['green']('✔')+_0x25febc(0x2ac));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x289);['description']=a23_0x5f52b8(0x229);async['execute'](_0x1f11cd){const _0x5468c0=a23_0x5f52b8,{options:_0x3136a0,args:_0x38792e,tdx:_0x573914}=_0x1f11cd,_0x156fb1=_0x3136a0,_0x59e035=_0x38792e[0x0]||_0x3136a0[_0x5468c0(0x240)];if(!_0x59e035)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x5468c0(0x1c7)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x5468c0(0x235)+_0x5468c0(0x263)),0x1;if(!_0x156fb1['master']&&!_0x156fb1[_0x5468c0(0x1f6)]&&!_0x156fb1[_0x5468c0(0x1e9)]&&!_0x156fb1[_0x5468c0(0x271)])return console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x5468c0(0x210)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x5468c0(0x210)](_0x5468c0(0x286)),console['error'](_0x5468c0(0x2bd)),console[_0x5468c0(0x210)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x5468c0(0x210)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5468c0(0x210)](_0x5468c0(0x1aa)),0x1;const _0x10b75c=resolveYamlFile(_0x59e035);if(!existsSync(_0x10b75c))return showFileNotFoundError(_0x10b75c,_0x59e035),0x1;_0x156fb1[_0x5468c0(0x1cb)]&&(console[_0x5468c0(0x210)](_0x5468c0(0x1ae)+_0x156fb1[_0x5468c0(0x23b)]),console[_0x5468c0(0x210)](_0x5468c0(0x25d)+_0x10b75c));let _0x12b12c;try{_0x12b12c=readFileSync(_0x10b75c,_0x5468c0(0x232));}catch(_0x182381){const _0x1f420c=_0x182381 instanceof Error?_0x182381[_0x5468c0(0x226)]:String(_0x182381);return console[_0x5468c0(0x210)](_0x5468c0(0x202)+_0x1f420c),0x1;}let _0x487828;try{_0x487828=parseDef(_0x12b12c);}catch(_0x411728){const _0x4f6f1e=_0x411728 instanceof Error?_0x411728[_0x5468c0(0x226)]:String(_0x411728);return console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)](_0x5468c0(0x26f)+_0x4f6f1e)),0x1;}if(_0x156fb1[_0x5468c0(0x1f6)]===!![]||_0x156fb1['attribute']===''){const _0x422779=_0x487828[_0x5468c0(0x1ac)]?.[_0x5468c0(0x1bd)](_0x2cf4b7=>_0x2cf4b7[_0x5468c0(0x26c)])||[];if(_0x422779[_0x5468c0(0x255)]===0x0)console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a23_0x12ece1[_0x5468c0(0x1e8)](_0x5468c0(0x2a2))),console[_0x5468c0(0x210)](_0x5468c0(0x28e));for(const _0x1fac31 of _0x422779){console['error']('\x20\x20'+a23_0x12ece1[_0x5468c0(0x220)](_0x1fac31));}console[_0x5468c0(0x210)](_0x5468c0(0x239)+_0x59e035+_0x5468c0(0x1d4)+_0x422779[0x0]+'\x22');}return 0x1;}if(_0x156fb1[_0x5468c0(0x1e9)]===!![]||_0x156fb1[_0x5468c0(0x1e9)]===''){const _0x2eb687=_0x487828[_0x5468c0(0x2b1)]?.[_0x5468c0(0x1bd)](_0x1ca900=>_0x1ca900[_0x5468c0(0x26c)])||[];if(_0x2eb687['length']===0x0)console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x5468c0(0x210)](a23_0x12ece1['red'](_0x5468c0(0x1d0))),console[_0x5468c0(0x210)]('Available\x20behaviors:');for(const _0x59eb1c of _0x2eb687){console[_0x5468c0(0x210)]('\x20\x20'+a23_0x12ece1[_0x5468c0(0x220)](_0x59eb1c));}console[_0x5468c0(0x210)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x59e035+_0x5468c0(0x1c6)+_0x2eb687[0x0]+'\x22');}return 0x1;}const _0x68c52e=createCommandSpinner(a23_0x12ece1[_0x5468c0(0x2bf)]('Fetching\x20sample\x20data...'),{'verbose':_0x156fb1['verbose']});_0x68c52e['start']();const _0x27c72e={'onProgress':_0x502737=>{_0x68c52e['text']=formatProgressMessage(_0x502737);}};if(_0x156fb1[_0x5468c0(0x26d)])_0x27c72e[_0x5468c0(0x26d)]=!![];if(_0x156fb1[_0x5468c0(0x1f6)]&&typeof _0x156fb1['attribute']===_0x5468c0(0x293))_0x27c72e[_0x5468c0(0x1f6)]=_0x156fb1['attribute'];if(_0x156fb1[_0x5468c0(0x1e9)]&&typeof _0x156fb1['behavior']===_0x5468c0(0x293))_0x27c72e[_0x5468c0(0x1e9)]=_0x156fb1['behavior'];if(_0x156fb1[_0x5468c0(0x271)])_0x27c72e['enriched']=!![];if(_0x156fb1[_0x5468c0(0x28c)])_0x27c72e[_0x5468c0(0x28c)]=_0x156fb1['interval'];let _0x4868cf;try{_0x4868cf=await _0x573914[_0x5468c0(0x222)][_0x5468c0(0x2c5)](_0x12b12c,_0x27c72e),_0x68c52e[_0x5468c0(0x297)]();}catch(_0x122691){_0x68c52e[_0x5468c0(0x297)]();throw _0x122691;}return await this[_0x5468c0(0x1c9)](_0x4868cf,{'master':_0x156fb1[_0x5468c0(0x26d)],'attribute':typeof _0x156fb1[_0x5468c0(0x1f6)]===_0x5468c0(0x293)?_0x156fb1[_0x5468c0(0x1f6)]:undefined,'behavior':typeof _0x156fb1[_0x5468c0(0x1e9)]===_0x5468c0(0x293)?_0x156fb1[_0x5468c0(0x1e9)]:undefined,'enriched':_0x156fb1[_0x5468c0(0x271)]}),_0x4868cf[_0x5468c0(0x287)]?0x0:0x1;}async[a23_0x5f52b8(0x1c9)](_0x4acab8,_0x40a26a){const _0x13bdd6=a23_0x5f52b8;console[_0x13bdd6(0x210)]('\x0a'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x13bdd6(0x2a5))+'\x20'+_0x4acab8[_0x13bdd6(0x26c)]),console[_0x13bdd6(0x210)]('═'['repeat'](0x3c));if(_0x40a26a[_0x13bdd6(0x26d)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x4ac9f9=a23_0x12ece1[_0x13bdd6(0x2bf)](_0x13bdd6(0x1a1))+'\x20'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x4acab8['master'][_0x13bdd6(0x1ed)]+'.'+_0x4acab8[_0x13bdd6(0x26d)]['table']);await this[_0x13bdd6(0x1f9)](_0x4ac9f9,_0x4acab8['sampleData']);}else{if(_0x40a26a[_0x13bdd6(0x1f6)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x3a3ffb=a23_0x12ece1[_0x13bdd6(0x2bf)]('Attribute:')+'\x20'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x40a26a[_0x13bdd6(0x1f6)]);await this[_0x13bdd6(0x1f9)](_0x3a3ffb,_0x4acab8['sampleData']);}else{if(_0x40a26a[_0x13bdd6(0x1e9)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x578331=a23_0x12ece1['dim'](_0x13bdd6(0x1fe))+'\x20'+a23_0x12ece1['bold'](_0x40a26a[_0x13bdd6(0x1e9)]);await this['displaySampleData'](_0x578331,_0x4acab8[_0x13bdd6(0x265)]);}else{if(_0x40a26a[_0x13bdd6(0x271)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x5e384f=a23_0x12ece1['dim'](_0x13bdd6(0x1b5))+'\x20'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x13bdd6(0x248));await this[_0x13bdd6(0x1f9)](_0x5e384f,_0x4acab8[_0x13bdd6(0x265)]);}else!_0x4acab8[_0x13bdd6(0x265)]&&console[_0x13bdd6(0x210)](_0x13bdd6(0x2b2));}}}if(_0x4acab8['errors'][_0x13bdd6(0x255)]>0x0){console[_0x13bdd6(0x210)]('─'[_0x13bdd6(0x1c1)](0x3c)),console[_0x13bdd6(0x210)]('\x0a'+a23_0x12ece1[_0x13bdd6(0x1e8)](_0x13bdd6(0x1e4)));for(const _0x37757e of _0x4acab8[_0x13bdd6(0x285)]){console['error']('\x20\x20'+a23_0x12ece1[_0x13bdd6(0x1e8)]('•')+'\x20'+_0x37757e);}}}async['displaySampleData'](_0x284e8f,_0x3242df){const _0x17b309=a23_0x5f52b8;if(_0x3242df['length']===0x0){console[_0x17b309(0x210)]('\x0a'+_0x284e8f),console[_0x17b309(0x210)](_0x17b309(0x25e));return;}console[_0x17b309(0x210)]('\x0a'+_0x284e8f);const _0x4cbfb3=Object[_0x17b309(0x1b4)](_0x3242df[0x0])[_0x17b309(0x1bd)](_0x43028c=>({'name':_0x43028c,'type':typeof _0x3242df[0x0][_0x43028c]==='number'?_0x17b309(0x24c):_0x17b309(0x2aa)})),_0x10ea68={'queryId':_0x17b309(0x26a),'columns':_0x4cbfb3,'data':_0x3242df,'stats':{'state':_0x17b309(0x268),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3242df[_0x17b309(0x255)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5a6b85=formatAsTable(_0x10ea68,_0x3242df[_0x17b309(0x255)],!![]);await writeOutput(_0x5a6b85,undefined,_0x17b309(0x280));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]='segment:parent:run';[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x1ab);async[a23_0x5f52b8(0x234)](_0x11b94c){const _0x305434=a23_0x5f52b8,{options:_0x21c0b7,args:_0x28dbe2,tdx:_0x5f1b3c}=_0x11b94c,_0xebed47=_0x21c0b7,_0x32a4ca=_0x28dbe2[0x0]||_0x21c0b7['parentSegment'];if(!_0x32a4ca)return showParentSegmentNotSetError(_0x305434(0x1b3)+_0x305434(0x1b1)),0x1;const _0x351718=resolveYamlFile(_0x32a4ca);if(existsSync(_0x351718)){_0xebed47[_0x305434(0x1cb)]&&console[_0x305434(0x210)]('Found\x20YAML\x20file:\x20'+_0x351718);let _0x1597d5;try{_0x1597d5=readFileSync(_0x351718,_0x305434(0x232));}catch(_0x33e522){const _0x1c0ef8=_0x33e522 instanceof Error?_0x33e522[_0x305434(0x226)]:String(_0x33e522);return console[_0x305434(0x210)](_0x305434(0x202)+_0x1c0ef8),0x1;}const _0x51f5bd=await withSpinner(_0x305434(0x257),()=>_0x5f1b3c['segment'][_0x305434(0x2a4)](_0x1597d5),{'verbose':_0xebed47[_0x305434(0x1cb)]}),_0x401a90=_0x51f5bd[_0x305434(0x29c)],{isNew:_0x9e8ad8,name:_0x4e17ec,hasChanges:_0x9468a6,diffFormatted:_0x43ff34}=_0x401a90;if(_0x9468a6){_0x9e8ad8?console['error'](_0x305434(0x25f)+_0x4e17ec+'\x27:'):console[_0x305434(0x210)](_0x305434(0x264)+_0x4e17ec+'\x27:');console[_0x305434(0x210)]('─'[_0x305434(0x1c1)](0x3c)),console['error'](_0x43ff34),console[_0x305434(0x210)]('─'[_0x305434(0x1c1)](0x3c));const _0x33a7c2=_0x9e8ad8?_0x305434(0x1a3)+_0x4e17ec+_0x305434(0x1f0):_0x305434(0x272)+_0x4e17ec+_0x305434(0x1f0);if(!_0xebed47[_0x305434(0x23c)]){const _0x719ea4=await confirmKey(_0x33a7c2);if(!_0x719ea4)return console[_0x305434(0x210)](_0x305434(0x22c)),0x1;}const _0xd995de=_0x9e8ad8?_0x305434(0x219):'Updating';await withSpinner(_0xd995de+_0x305434(0x246)+_0x4e17ec+_0x305434(0x215),()=>_0x401a90[_0x305434(0x281)](),{'verbose':_0xebed47[_0x305434(0x1cb)]});const _0x2813a6=_0x9e8ad8?_0x305434(0x1c3):_0x305434(0x296);console[_0x305434(0x210)]('✔\x20'+_0x2813a6+_0x305434(0x246)+_0x4e17ec+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x4e17ec+_0x305434(0x2ca));}const _0x5d7056=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x32a4ca+_0x305434(0x215),()=>_0x5f1b3c['segment'][_0x305434(0x1a7)](_0x32a4ca),{'verbose':_0xebed47[_0x305434(0x1cb)]}),_0x4bd63b=_0x5d7056[_0x305434(0x29c)],_0x365716=getConsoleUrl(_0xebed47[_0x305434(0x23b)],_0x305434(0x1fc)+_0x4bd63b[_0x305434(0x208)]+_0x305434(0x211)+_0x4bd63b[_0x305434(0x1ea)]+'/attempt/'+_0x4bd63b[_0x305434(0x1d1)]);return console[_0x305434(0x210)](_0x305434(0x200)),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1[_0x305434(0x2bf)](_0x305434(0x2bb))+'\x20'+_0x4bd63b[_0x305434(0x2ab)]),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1[_0x305434(0x2bf)](_0x305434(0x25b))+'\x20'+_0x4bd63b[_0x305434(0x1ef)]),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1[_0x305434(0x2bf)](_0x305434(0x1c4))+'\x20'+_0x4bd63b[_0x305434(0x1ea)]),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1['dim'](_0x305434(0x207))+'\x20'+_0x4bd63b[_0x305434(0x1d1)]),console[_0x305434(0x210)]('\x20\x20'+_0x365716),console[_0x305434(0x210)]('\x0a'+a23_0x12ece1['dim']('To\x20cancel:')+_0x305434(0x1d2)+_0x4bd63b[_0x305434(0x1d1)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x28f);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x251);async['execute'](_0x3d351e){const _0x40250e=a23_0x5f52b8,{options:_0x4cc18e,args:_0x4cadb5,tdx:_0x385745}=_0x3d351e,_0x455c8e=_0x4cadb5[0x0]||_0x4cc18e[_0x40250e(0x240)];if(!_0x455c8e)return showParentSegmentNotSetError(_0x40250e(0x29e)+_0x40250e(0x2a6)),0x1;_0x4cc18e['verbose']&&(console[_0x40250e(0x210)]('Site:\x20'+_0x4cc18e[_0x40250e(0x23b)]),console['error'](_0x40250e(0x295)+_0x455c8e));const _0x2ff2c8=await withSpinner(_0x40250e(0x1ca)+_0x455c8e+_0x40250e(0x215),()=>_0x385745['segment'][_0x40250e(0x238)](_0x455c8e),{'verbose':_0x4cc18e['verbose']}),_0x5f56ca=_0x2ff2c8['data'];console['error']('✔\x20Found\x20'+_0x5f56ca[_0x40250e(0x255)]+'\x20field'+(_0x5f56ca[_0x40250e(0x255)]!==0x1?'s':''));if(_0x4cc18e[_0x40250e(0x1c2)]||_0x4cc18e[_0x40250e(0x291)])return await handleSDKOutput(_0x5f56ca,_0x4cc18e),0x0;return displayFieldsHumanReadable(_0x5f56ca,_0x455c8e),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x2b4);['description']=a23_0x5f52b8(0x279);async[a23_0x5f52b8(0x234)](_0x44d66c){const _0x1e0087=a23_0x5f52b8,{options:_0x6d40,args:_0x425ff8,tdx:_0x3eb7fc}=_0x44d66c,_0x345c0f=_0x6d40,_0x52bc6c=_0x425ff8[0x0]||_0x6d40[_0x1e0087(0x240)];if(!_0x52bc6c)return showParentSegmentNotSetError(_0x1e0087(0x1b9)+_0x1e0087(0x24f)+_0x1e0087(0x1ba)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x6d40[_0x1e0087(0x1cb)]&&(console['error']('Site:\x20'+_0x6d40[_0x1e0087(0x23b)]),console['error'](_0x1e0087(0x295)+_0x52bc6c));const _0x30c9d1=await withSpinner(_0x1e0087(0x2b3)+_0x52bc6c+_0x1e0087(0x215),()=>_0x3eb7fc[_0x1e0087(0x222)][_0x1e0087(0x1cd)](_0x52bc6c),{'verbose':_0x6d40[_0x1e0087(0x1cb)]}),_0x1e931b=_0x30c9d1[_0x1e0087(0x29c)];if(_0x345c0f[_0x1e0087(0x236)]){const _0x5ebff6=getConsoleNextUrl(_0x345c0f[_0x1e0087(0x23b)],_0x1e0087(0x21e)+_0x1e931b['id']);return console[_0x1e0087(0x210)](a23_0x12ece1[_0x1e0087(0x2c4)]('✔')+_0x1e0087(0x260)+a23_0x12ece1['cyan'](_0x5ebff6)),openBrowser(_0x5ebff6),0x0;}return await handleSingleObjectOutput(_0x1e931b,_0x6d40),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x2b7);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x243);async[a23_0x5f52b8(0x234)](_0x556b0c){const _0x39611c=a23_0x5f52b8,{options:_0x4aec48,args:_0x1c62ed,tdx:_0x4b8430}=_0x556b0c,_0x2a6a86=_0x1c62ed[0x0]||_0x4aec48[_0x39611c(0x240)];if(!_0x2a6a86)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x39611c(0x1db)),0x1;_0x4aec48[_0x39611c(0x1cb)]&&(console[_0x39611c(0x210)]('Site:\x20'+_0x4aec48[_0x39611c(0x23b)]),console[_0x39611c(0x210)]('Parent\x20segment:\x20'+_0x2a6a86));const _0x765755=await withSpinner(_0x39611c(0x205)+_0x2a6a86+_0x39611c(0x215),()=>_0x4b8430['segment'][_0x39611c(0x217)](_0x2a6a86),{'verbose':_0x4aec48[_0x39611c(0x1cb)]}),_0x5b1cc4=_0x765755[_0x39611c(0x29c)],_0x20e3b0=await withSpinner(_0x39611c(0x2c9)+_0x2a6a86+'\x27...',()=>_0x4b8430[_0x39611c(0x222)][_0x39611c(0x1c5)](_0x5b1cc4),{'verbose':_0x4aec48[_0x39611c(0x1cb)]}),_0x32a28e=await executeSchemaQuery(_0x20e3b0[_0x39611c(0x29c)],_0x4b8430,_0x4aec48);return await handleQueryOutput(_0x32a28e,_0x4aec48),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a23_0x5f52b8(0x1fd);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x258);async[a23_0x5f52b8(0x234)](_0x1ebb96){const _0x5aafe5=a23_0x5f52b8,{options:_0x3d5d92,args:_0x23664b,tdx:_0x19764c}=_0x1ebb96,_0xc7e205=_0x23664b[0x0]||_0x3d5d92[_0x5aafe5(0x240)];if(!_0xc7e205)return showParentSegmentNotSetError(_0x5aafe5(0x25c)+_0x5aafe5(0x249)),0x1;_0x3d5d92[_0x5aafe5(0x1cb)]&&(console[_0x5aafe5(0x210)](_0x5aafe5(0x1ae)+_0x3d5d92[_0x5aafe5(0x23b)]),console[_0x5aafe5(0x210)](_0x5aafe5(0x295)+_0xc7e205));const _0x155c6c=await withSpinner(_0x5aafe5(0x205)+_0xc7e205+_0x5aafe5(0x215),()=>_0x19764c[_0x5aafe5(0x222)]['resolveParentId'](_0xc7e205),{'verbose':_0x3d5d92[_0x5aafe5(0x1cb)]}),_0x24b44d=_0x155c6c['data'],_0x1456e4=await withSpinner(_0x5aafe5(0x2c9)+_0xc7e205+'\x27...',()=>_0x19764c[_0x5aafe5(0x222)][_0x5aafe5(0x1c5)](_0x24b44d),{'verbose':_0x3d5d92[_0x5aafe5(0x1cb)]}),_0x15801c=_0x1456e4[_0x5aafe5(0x29c)];return _0x3d5d92[_0x5aafe5(0x2c2)]===_0x5aafe5(0x1c2)||_0x3d5d92[_0x5aafe5(0x2c2)]===_0x5aafe5(0x291)?await handleSDKOutput([{'sql':_0x15801c}],_0x3d5d92):console[_0x5aafe5(0x278)](_0x15801c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a23_0x5f52b8(0x2c6);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x1c8);async['execute'](_0x590217){const _0x321f23=a23_0x5f52b8,{options:_0xae10bb,args:_0x10218f,tdx:_0x49da8e}=_0x590217,_0x5caf1b=_0x10218f[0x0]||_0xae10bb['parentSegment'];if(!_0x5caf1b)return showParentSegmentNotSetError(_0x321f23(0x1c0)+_0x321f23(0x253)),0x1;_0xae10bb[_0x321f23(0x1cb)]&&(console['error'](_0x321f23(0x1ae)+_0xae10bb[_0x321f23(0x23b)]),console[_0x321f23(0x210)](_0x321f23(0x295)+_0x5caf1b));const _0x2279d6=await withSpinner(_0x321f23(0x205)+_0x5caf1b+_0x321f23(0x215),()=>_0x49da8e['segment'][_0x321f23(0x217)](_0x5caf1b),{'verbose':_0xae10bb[_0x321f23(0x1cb)]}),_0xcb5883=_0x2279d6['data'],_0x1da526=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5caf1b+_0x321f23(0x215),()=>_0x49da8e['segment']['getParentSQL'](_0xcb5883),{'verbose':_0xae10bb[_0x321f23(0x1cb)]});let _0xb5a681=_0x1da526[_0x321f23(0x29c)];const _0x3e038f=resolveLimit(_0xae10bb[_0x321f23(0x1f5)],DEFAULT_DISPLAY_LIMIT),_0x53d1cb=/\bLIMIT\s+\d+/i[_0x321f23(0x231)](_0xb5a681);!_0x53d1cb&&(_0xb5a681=_0xb5a681[_0x321f23(0x29f)]()['replace'](/;+$/,''),_0xb5a681=_0x321f23(0x1fa)+_0xb5a681+_0x321f23(0x227)+_0x3e038f);_0xae10bb[_0x321f23(0x1cb)]&&console['error'](_0x321f23(0x216)+_0xb5a681);const _0x5dabd6=await withProgressSpinner(_0x321f23(0x267),async _0x537961=>{const _0x5afbba=_0x321f23,_0x4154d2=await _0x49da8e['query'][_0x5afbba(0x234)](_0xb5a681,{'catalog':'td','schema':_0x5afbba(0x27d),'onJobId':_0x4c496b=>{const _0x193a66=_0x5afbba;_0x537961[_0x193a66(0x22f)](_0x4c496b);}});return _0x4154d2;},{'verbose':_0xae10bb['verbose']}),_0x8300f4=_0x5dabd6[_0x321f23(0x29c)],_0x53c881=_0x8300f4[_0x321f23(0x20c)]?'\x20[Job\x20ID:\x20'+_0x8300f4[_0x321f23(0x20c)]+']':'';return console[_0x321f23(0x210)](_0x321f23(0x245)+_0x8300f4['stats'][_0x321f23(0x241)][_0x321f23(0x2a8)]()+'\x20rows\x20'+(_0x321f23(0x1f4)+formatElapsed(_0x8300f4[_0x321f23(0x250)][_0x321f23(0x2a0)])+_0x53c881)),await handleQueryOutput(_0x8300f4,_0xae10bb),0x0;}}
@@ -1 +1 @@
1
- const a24_0x205caa=a24_0x4d45;(function(_0x2ba375,_0xa86f72){const _0x3653be=a24_0x4d45,_0x50c2c4=_0x2ba375();while(!![]){try{const _0x35cf78=-parseInt(_0x3653be(0x205))/0x1+parseInt(_0x3653be(0x209))/0x2*(parseInt(_0x3653be(0x216))/0x3)+parseInt(_0x3653be(0x204))/0x4*(-parseInt(_0x3653be(0x201))/0x5)+parseInt(_0x3653be(0x21f))/0x6+-parseInt(_0x3653be(0x1e0))/0x7+-parseInt(_0x3653be(0x1ea))/0x8+parseInt(_0x3653be(0x228))/0x9;if(_0x35cf78===_0xa86f72)break;else _0x50c2c4['push'](_0x50c2c4['shift']());}catch(_0x1a41e0){_0x50c2c4['push'](_0x50c2c4['shift']());}}}(a24_0x50c7,0xdb0be));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0x5f2b90 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x5bba62 from'prompts';function a24_0x50c7(){const _0x4716a0=['\x27\x20does\x20not\x20exist.','password','log','customSite','Create\x20a\x20new\x20profile','join','\x27\x20created','profile','tdx.json','Default\x20profile\x20set\x20to:\x20','\x20Profile\x20\x27','377607CMQzFe','push','us01','Enter\x20profile\x20name:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','value','\x27\x20requires\x20API\x20key\x20validation.','create','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','3227910CLomOB','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','logLevel','apiKey','\x20\x20-\x20','parent_segment','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Remove\x20a\x20profile','29378223nSYExe','includes','llm_project','\x0aAvailable\x20profiles:','confirm','profile:set','Enter\x20your\x20TD\x20API\x20key:','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20remove','\x20\x20(no\x20profiles\x20found)','Enter\x20custom\x20site','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSetup\x20cancelled','Profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','select','VALID_KEYS','getUserInfo','name','error','\x20\x20tdx\x20--profile\x20','text','Enter\x20site\x20name:','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','site','test','✗\x20Validation\x20failed:\x20','profile:use','Validating\x20API\x20key...','split','red','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>','ERROR','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','session','Site\x20was\x20not\x20changed.','(cleared)','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','trim','eu01','bold','default','7697095yLrzKI','dim','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us\x20\x20\x20-\x20United\x20States','ap02\x20-\x20Korea','/app/mp/ak','findIndex','jp\x20\x20\x20-\x20Japan','execute','yellow','6368600kEyZVR','tdx:\x20profile\x20set','jp01','Failed\x20to\x20remove\x20profile:\x20','database','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','other','(session:\x20','Site\x20name\x20cannot\x20be\x20empty','Set\x20session\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','message','warn','validate','profileName','profile:remove','email','length','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20create','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','green','jobs','11635APTudu','toString','eu\x20\x20\x20-\x20Europe','796dIjnbK','672154xrBLle','Removal\x20cancelled','status','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','2zwtgCt','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.'];a24_0x50c7=function(){return _0x4716a0;};return a24_0x50c7();}import a24_0x5b98b0 from'chalk';function validateProfileName(_0x27d465){const _0xfc8579=a24_0x4d45;if(!_0x27d465||!_0x27d465[_0xfc8579(0x1dc)]())return _0xfc8579(0x1bd);const _0xee8c49=_0x27d465['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0xfc8579(0x1cc)](_0xee8c49))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0xee8c49))return _0xfc8579(0x1bc)+_0xee8c49+_0xfc8579(0x20a);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x205caa(0x220)]=a24_0x205caa(0x20f);async['execute'](_0x266516){const _0x2685bc=a24_0x205caa,{options:_0x2fb768,args:_0x5a74cb}=_0x266516;console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1de)](_0x2685bc(0x1fd)));let _0x5a7eeb;if(_0x5a74cb[_0x2685bc(0x1fb)]>0x0&&_0x5a74cb[0x0]){const _0x1bc143=_0x5a74cb[0x0][_0x2685bc(0x1dc)](),_0x55e10a=validateProfileName(_0x1bc143);if(_0x55e10a!==!![])return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x55e10a)),0x1;_0x5a7eeb=_0x1bc143;}else{const _0x8bd24=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x1f8),'message':_0x2685bc(0x219),'validate':validateProfileName});if(!_0x8bd24[_0x2685bc(0x1f8)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;_0x5a7eeb=_0x8bd24['profileName'][_0x2685bc(0x1dc)]();}const _0x5b694b=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x220),'message':_0x2685bc(0x1c6)}),_0xf28d44=_0x5b694b[_0x2685bc(0x220)]?.['trim']()||undefined,_0x20003b=_0x2fb768[_0x2685bc(0x1cb)]||_0x2685bc(0x218),_0x348e01=[{'title':_0x2685bc(0x1e3),'value':_0x2685bc(0x218)},{'title':_0x2685bc(0x1e7),'value':_0x2685bc(0x1ec)},{'title':_0x2685bc(0x203),'value':_0x2685bc(0x1dd)},{'title':_0x2685bc(0x1e4),'value':'ap02'}];let _0x891e62=_0x348e01[_0x2685bc(0x1e6)](_0x37adcb=>_0x37adcb[_0x2685bc(0x21b)]===_0x20003b);_0x891e62===-0x1&&_0x20003b!==_0x2685bc(0x218)&&(_0x348e01[_0x2685bc(0x217)]({'title':_0x20003b,'value':_0x20003b}),_0x891e62=_0x348e01[_0x2685bc(0x1fb)]-0x1);_0x348e01[_0x2685bc(0x217)]({'title':_0x2685bc(0x1b9),'value':_0x2685bc(0x1f0)});const _0x3f621a=await a24_0x5bba62({'type':_0x2685bc(0x1be),'name':'site','message':_0x2685bc(0x1fe)+_0x5a7eeb+'\x27:','choices':_0x348e01,'initial':_0x891e62>=0x0?_0x891e62:0x0});if(!_0x3f621a[_0x2685bc(0x1cb)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;let _0x3567b1;if(_0x3f621a[_0x2685bc(0x1cb)]===_0x2685bc(0x1f0)){const _0x1d261a=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':'customSite','message':_0x2685bc(0x1c5),'initial':_0x2685bc(0x218),'validate':_0xc5a508=>{const _0x28e780=_0x2685bc;if(!_0xc5a508||!_0xc5a508['trim']())return _0x28e780(0x1f2);if(!/^[a-z0-9-]+$/[_0x28e780(0x1cc)](_0xc5a508['trim']()))return _0x28e780(0x1c9);return!![];}});if(!_0x1d261a['customSite'])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;_0x3567b1=_0x1d261a[_0x2685bc(0x20e)];}else _0x3567b1=_0x3f621a['site'];const _0x13731f=resolveSite(_0x3567b1);console[_0x2685bc(0x20d)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x13731f),console[_0x2685bc(0x20d)](_0x2685bc(0x22f)),console[_0x2685bc(0x20d)]('\x20\x20'+getConsoleUrl(_0x13731f,_0x2685bc(0x1e5)));const _0x2ba9ad=await a24_0x5bba62({'type':_0x2685bc(0x20c),'name':_0x2685bc(0x223),'message':_0x2685bc(0x22e),'validate':_0x50b282=>{const _0x5e584b=_0x2685bc;if(!_0x50b282||!_0x50b282[_0x5e584b(0x1dc)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2ba9ad[_0x2685bc(0x223)])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;const _0x34eea9=_0x2ba9ad[_0x2685bc(0x223)];console[_0x2685bc(0x20d)](_0x2685bc(0x1cf));try{const _0x1ea621=TDX[_0x2685bc(0x21d)]({'site':_0x13731f,'apiKey':_0x34eea9['trim'](),'logLevel':_0x2fb768[_0x2685bc(0x222)]??LogLevel[_0x2685bc(0x1d3)]}),_0x3d3387=await _0x1ea621[_0x2685bc(0x200)]['getUserInfo']();console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d3387[_0x2685bc(0x1fa)]+')');const _0xc7d0b1=await isKeychainAvailable();_0xc7d0b1?(await saveAPIKeyAsync(_0x34eea9[_0x2685bc(0x1dc)](),_0x13731f,_0x5a7eeb),console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+_0x2685bc(0x1ef)+_0x5a7eeb+')')):(console['warn'](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1c8))),console[_0x2685bc(0x1f6)](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1d4))));const _0x38922e={'site':_0x13731f,..._0xf28d44&&{'description':_0xf28d44}};return saveProfileToUserConfig(_0x5a7eeb,_0x38922e),console['log'](a24_0x5b98b0['green']('✓')+'\x20Profile\x20\x27'+_0x5a7eeb+_0x2685bc(0x211)),console[_0x2685bc(0x20d)](),console['log'](_0x2685bc(0x1ca)),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+_0x2685bc(0x1da)),0x0;}catch(_0x2168f3){if(_0x2168f3 instanceof HTTPClientError&&_0x2168f3[_0x2685bc(0x207)]===0x191)return printAuthError(_0x2168f3),0x1;return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x2685bc(0x1cd)+(_0x2168f3 instanceof Error?_0x2168f3[_0x2685bc(0x1f5)]:String(_0x2168f3)))),console[_0x2685bc(0x1c2)](_0x2685bc(0x208)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1f9);[a24_0x205caa(0x220)]=a24_0x205caa(0x227);[a24_0x205caa(0x1f7)](_0x4ceb69){const _0x2c13bc=a24_0x205caa,{args:_0x59ca9f}=_0x4ceb69;if(_0x59ca9f[_0x2c13bc(0x1fb)]===0x0)return _0x2c13bc(0x1d6);return undefined;}async[a24_0x205caa(0x1e8)](_0x2a7928){const _0x334238=a24_0x205caa,{args:_0x341c0b}=_0x2a7928,_0xfda6c3=_0x341c0b[0x0];console['log'](a24_0x5b98b0['bold'](_0x334238(0x230)));if(!profileExists(_0xfda6c3)){console['error'](a24_0x5b98b0['red'](_0x334238(0x1bc)+_0xfda6c3+_0x334238(0x20b))),console[_0x334238(0x20d)](_0x334238(0x22b));const _0x2f80a7=listProfiles();if(_0x2f80a7[_0x334238(0x1fb)]===0x0)console[_0x334238(0x20d)](_0x334238(0x1b8));else for(const _0x10a981 of _0x2f80a7){console[_0x334238(0x20d)]('\x20\x20-\x20'+_0x10a981[_0x334238(0x1c1)]);}return 0x1;}const _0x21e342=await a24_0x5bba62({'type':_0x334238(0x22c),'name':_0x334238(0x22c),'message':_0x334238(0x1ba)+_0xfda6c3+'\x27?','initial':![]});if(!_0x21e342['confirm'])return console[_0x334238(0x20d)](_0x334238(0x206)),0x0;try{removeProfileFromUserConfig(_0xfda6c3),console[_0x334238(0x20d)](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x215)+_0xfda6c3+_0x334238(0x1fc));}catch(_0x407956){return console[_0x334238(0x1c2)](a24_0x5b98b0['red'](_0x334238(0x1ed)+(_0x407956 instanceof Error?_0x407956[_0x334238(0x1f5)]:String(_0x407956)))),0x1;}const _0x1db22d=await isKeychainAvailable();if(_0x1db22d){const _0x231490=await deleteKeychainAPIKey(_0xfda6c3);_0x231490&&console['log'](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x221));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x22d);[a24_0x205caa(0x220)]='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x205caa(0x1bf)]=['site',a24_0x205caa(0x1ee),a24_0x205caa(0x225),a24_0x205caa(0x22a),'llm_agent','description'];[a24_0x205caa(0x1f7)](_0x2d8ce0){const _0x491e4a=a24_0x205caa,{args:_0x32fb7f,options:_0x25e9ba}=_0x2d8ce0,_0x4b47cc=_0x25e9ba[_0x491e4a(0x212)]||getActiveProfile();if(!_0x4b47cc)return _0x491e4a(0x1d2);if(_0x32fb7f[_0x491e4a(0x1fb)]===0x0)return _0x491e4a(0x21e)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const _0x8e921=_0x32fb7f[0x0];if(!_0x8e921[_0x491e4a(0x229)]('='))return _0x491e4a(0x1e2)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const [_0x9a8212]=_0x8e921[_0x491e4a(0x1d0)]('=',0x2);if(!ProfileSetCommand[_0x491e4a(0x1bf)][_0x491e4a(0x229)](_0x9a8212))return'Unknown\x20key\x20\x27'+_0x9a8212+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');return undefined;}async[a24_0x205caa(0x1e8)](_0x3cc1e6){const _0x1f3339=a24_0x205caa,{args:_0x5870f1,options:_0x3f07d7}=_0x3cc1e6,_0x86ef11=_0x3f07d7[_0x1f3339(0x212)]||getActiveProfile(),[_0x6ad09f,..._0x2a3023]=_0x5870f1[0x0][_0x1f3339(0x1d0)]('='),_0x526f92=_0x2a3023[_0x1f3339(0x210)]('=');console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1de)](_0x1f3339(0x1eb)));if(!profileExists(_0x86ef11)){const _0x811cbb=await a24_0x5bba62({'type':_0x1f3339(0x22c),'name':'create','message':_0x1f3339(0x1bc)+_0x86ef11+_0x1f3339(0x1f4),'initial':!![]});if(!_0x811cbb[_0x1f3339(0x21d)])return console[_0x1f3339(0x20d)]('Operation\x20cancelled'),0x1;}const _0x580526=loadProfile(_0x86ef11),_0x27df9e=_0x580526?.[_0x1f3339(0x1db)]||{};if(_0x6ad09f===_0x1f3339(0x1cb)){const _0x57c9b2=resolveSite(_0x526f92);console[_0x1f3339(0x20d)](_0x1f3339(0x1c7)+_0x57c9b2+_0x1f3339(0x21c)),console[_0x1f3339(0x20d)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1f3339(0x20d)]('\x20\x20'+getConsoleUrl(_0x57c9b2,_0x1f3339(0x1e5)));const _0x5e3451=await a24_0x5bba62({'type':_0x1f3339(0x20c),'name':_0x1f3339(0x223),'message':_0x1f3339(0x21a),'validate':_0x20d0de=>{if(!_0x20d0de||!_0x20d0de['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5e3451[_0x1f3339(0x223)])return console[_0x1f3339(0x20d)]('\x0aOperation\x20cancelled'),0x1;console[_0x1f3339(0x20d)](_0x1f3339(0x1cf));try{const _0x32a455=TDX['create']({'site':_0x57c9b2,'apiKey':_0x5e3451['apiKey'][_0x1f3339(0x1dc)](),'logLevel':_0x3f07d7[_0x1f3339(0x222)]??LogLevel['ERROR']}),_0x3c8928=await _0x32a455[_0x1f3339(0x200)][_0x1f3339(0x1c0)]();console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x1d5)+_0x3c8928[_0x1f3339(0x1fa)]+')');const _0x9d7bac=await isKeychainAvailable();_0x9d7bac?(await saveAPIKeyAsync(_0x5e3451['apiKey']['trim'](),_0x57c9b2,_0x86ef11),console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x226))):console[_0x1f3339(0x1f6)](a24_0x5b98b0[_0x1f3339(0x1e9)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x27df9e[_0x1f3339(0x1cb)]=_0x57c9b2;}catch(_0x140676){if(_0x140676 instanceof HTTPClientError&&_0x140676['status']===0x191)return printAuthError(_0x140676),0x1;return console['error'](a24_0x5b98b0[_0x1f3339(0x1d1)](_0x1f3339(0x1cd)+(_0x140676 instanceof Error?_0x140676['message']:String(_0x140676)))),console[_0x1f3339(0x1c2)](_0x1f3339(0x1d8)),0x1;}}else _0x27df9e[_0x6ad09f]=_0x526f92||undefined;return saveProfileToUserConfig(_0x86ef11,_0x27df9e),console['log'](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+'\x20Profile\x20\x27'+_0x86ef11+'\x27\x20updated:\x20'+_0x6ad09f+'='+(_0x526f92||_0x1f3339(0x1d9))),0x0;}}function a24_0x4d45(_0x360aab,_0x51a32e){_0x360aab=_0x360aab-0x1b8;const _0x50c7fd=a24_0x50c7();let _0x4d458f=_0x50c7fd[_0x360aab];return _0x4d458f;}export class ProfileUseCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1ce);[a24_0x205caa(0x220)]=a24_0x205caa(0x1f3);['validate'](_0x5a909f){const _0xd81bac=a24_0x205caa,{args:_0x2c26e0}=_0x5a909f;if(_0x2c26e0[_0xd81bac(0x1fb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x205caa(0x1e8)](_0x2e301c){const _0x4972bc=a24_0x205caa,{args:_0x3980d1,options:_0xc9ebe9}=_0x2e301c,_0x3dc70b=_0x3980d1[0x0],_0x2aac15=_0xc9ebe9[_0x4972bc(0x1df)];cleanExpiredSessions();if(!profileExists(_0x3dc70b)){console[_0x4972bc(0x1c2)](a24_0x5b98b0[_0x4972bc(0x1d1)](_0x4972bc(0x1bc)+_0x3dc70b+_0x4972bc(0x20b))),console[_0x4972bc(0x20d)]('\x0aAvailable\x20profiles:');const _0x189dda=listProfiles();if(_0x189dda[_0x4972bc(0x1fb)]===0x0)console[_0x4972bc(0x20d)](_0x4972bc(0x1b8));else for(const _0x351b01 of _0x189dda){console['log'](_0x4972bc(0x224)+_0x351b01[_0x4972bc(0x1c1)]);}return 0x1;}if(_0x2aac15){const _0x725665=a24_0x5f2b90[_0x4972bc(0x210)](getConfigDir(),_0x4972bc(0x213));return saveActiveProfileToUserConfig(_0x3dc70b),console['log'](_0x4972bc(0x214)+a24_0x5b98b0[_0x4972bc(0x1ff)](_0x3dc70b)),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aSaved\x20to:\x20'+_0x725665)),0x0;}const _0x22a78a=_0xc9ebe9[_0x4972bc(0x1d7)]||getCurrentSessionPID()[_0x4972bc(0x202)]();return saveSessionContext({'profile':_0x3dc70b},_0xc9ebe9[_0x4972bc(0x1d7)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a24_0x5b98b0['green'](_0x3dc70b)+'\x20'+a24_0x5b98b0[_0x4972bc(0x1e1)](_0x4972bc(0x1f1)+_0x22a78a+')')),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3dc70b+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a24_0x4c767c=a24_0xaf30;(function(_0x13afbf,_0x24ede1){const _0x40be76=a24_0xaf30,_0x400794=_0x13afbf();while(!![]){try{const _0x13e3fd=parseInt(_0x40be76(0x16e))/0x1*(-parseInt(_0x40be76(0x1a7))/0x2)+-parseInt(_0x40be76(0x1ac))/0x3*(parseInt(_0x40be76(0x19d))/0x4)+-parseInt(_0x40be76(0x183))/0x5+-parseInt(_0x40be76(0x141))/0x6*(-parseInt(_0x40be76(0x18c))/0x7)+-parseInt(_0x40be76(0x1ae))/0x8*(-parseInt(_0x40be76(0x169))/0x9)+-parseInt(_0x40be76(0x152))/0xa+parseInt(_0x40be76(0x151))/0xb*(parseInt(_0x40be76(0x173))/0xc);if(_0x13e3fd===_0x24ede1)break;else _0x400794['push'](_0x400794['shift']());}catch(_0x33c2c8){_0x400794['push'](_0x400794['shift']());}}}(a24_0x2f72,0xc9273));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a24_0x2f72(){const _0x4fd0a1=['jp\x20\x20\x20-\x20Japan','ap02','description','password','customSite','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Changing\x20site\x20to\x20\x27','530328rnyYyc','profile','tdx.json','other','\x0aOperation\x20cancelled','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','toString','us01','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Site\x20was\x20not\x20changed.','\x0aSetup\x20cancelled','green','text','Enter\x20site\x20name:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:remove','430617AHEKHy','16259450USRnHJ','split','eu01','\x20\x20tdx\x20--profile\x20','\x27\x20does\x20not\x20exist.','You\x20can\x20find\x20your\x20API\x20key\x20at:','session','\x20\x20(no\x20profiles\x20found)','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Session\x20profile\x20set\x20to:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','✗\x20Validation\x20failed:\x20','Site\x20name\x20cannot\x20be\x20empty','log','Create\x20a\x20new\x20profile','default','\x20API\x20key\x20is\x20valid\x20(User:\x20','parent_segment','trim','Enter\x20your\x20TD\x20API\x20key:','create','/app/mp/ak','Validating\x20API\x20key...','63pEttXW','\x0aSaved\x20to:\x20','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','red','72434ncQEXm','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','getUserInfo','email','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','828GaTXmf','message','validate','\x20\x20-\x20','includes','Profile\x20\x27','Default\x20profile\x20set\x20to:\x20','eu\x20\x20\x20-\x20Europe','findIndex','site','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','execute','llm_agent','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','apiKey','710820uunrMg','name','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','config','dim','select','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:create','push','91RcAXAe','length','Profile\x20name\x20cannot\x20be\x20empty','warn','(session:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20profile\x20name:','tdx:\x20profile\x20remove','confirm','llm_project','(cleared)','\x0aAvailable\x20profiles:','VALID_KEYS','profileName','bold','join','\x27\x20updated:\x20','20Wwndvu','jobs','Set\x20a\x20profile\x20configuration\x20value','tdx:\x20profile\x20create','yellow','profile:use','profile:set','Enter\x20custom\x20site','value','Operation\x20cancelled','22tdZbpV','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','status','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','753957izIRYQ','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','908816HSqqgJ','logLevel','ERROR'];a24_0x2f72=function(){return _0x4fd0a1;};return a24_0x2f72();}import*as a24_0x590ba5 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a24_0xaf30(_0x368c0d,_0x50275e){_0x368c0d=_0x368c0d-0x141;const _0x2f721f=a24_0x2f72();let _0xaf302f=_0x2f721f[_0x368c0d];return _0xaf302f;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x2237cf from'prompts';import a24_0x21870b from'chalk';function validateProfileName(_0x369096){const _0x396e88=a24_0xaf30;if(!_0x369096||!_0x369096[_0x396e88(0x164)]())return _0x396e88(0x18e);const _0x55784e=_0x369096['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x55784e))return _0x396e88(0x14f);if(profileExists(_0x55784e))return _0x396e88(0x178)+_0x55784e+_0x396e88(0x1b7);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x4c767c(0x184)]=a24_0x4c767c(0x18a);[a24_0x4c767c(0x1b3)]=a24_0x4c767c(0x160);async[a24_0x4c767c(0x17f)](_0x362722){const _0x4cfab7=a24_0x4c767c,{options:_0x117d59,args:_0x5e102a}=_0x362722;console[_0x4cfab7(0x15f)](a24_0x21870b[_0x4cfab7(0x19a)](_0x4cfab7(0x1a0)));let _0x51de26;if(_0x5e102a[_0x4cfab7(0x18d)]>0x0&&_0x5e102a[0x0]){const _0x49714e=_0x5e102a[0x0][_0x4cfab7(0x164)](),_0x17ea73=validateProfileName(_0x49714e);if(_0x17ea73!==!![])return console[_0x4cfab7(0x17e)](a24_0x21870b[_0x4cfab7(0x16d)](_0x17ea73)),0x1;_0x51de26=_0x49714e;}else{const _0x1c7df3=await a24_0x2237cf({'type':'text','name':_0x4cfab7(0x199),'message':_0x4cfab7(0x192),'validate':validateProfileName});if(!_0x1c7df3[_0x4cfab7(0x199)])return console['log'](_0x4cfab7(0x14b)),0x1;_0x51de26=_0x1c7df3[_0x4cfab7(0x199)][_0x4cfab7(0x164)]();}const _0xfddb90=await a24_0x2237cf({'type':_0x4cfab7(0x14d),'name':_0x4cfab7(0x1b3),'message':'Enter\x20description\x20(optional):'}),_0x1c74af=_0xfddb90[_0x4cfab7(0x1b3)]?.[_0x4cfab7(0x164)]()||undefined,_0x10b8bb=_0x117d59['site']||_0x4cfab7(0x148),_0x41ff8e=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x4cfab7(0x148)},{'title':_0x4cfab7(0x1b1),'value':'jp01'},{'title':_0x4cfab7(0x17a),'value':_0x4cfab7(0x154)},{'title':'ap02\x20-\x20Korea','value':_0x4cfab7(0x1b2)}];let _0x142b79=_0x41ff8e[_0x4cfab7(0x17b)](_0xc9c2e9=>_0xc9c2e9[_0x4cfab7(0x1a5)]===_0x10b8bb);_0x142b79===-0x1&&_0x10b8bb!=='us01'&&(_0x41ff8e[_0x4cfab7(0x18b)]({'title':_0x10b8bb,'value':_0x10b8bb}),_0x142b79=_0x41ff8e[_0x4cfab7(0x18d)]-0x1);_0x41ff8e[_0x4cfab7(0x18b)]({'title':_0x4cfab7(0x1a4),'value':_0x4cfab7(0x144)});const _0x5a099d=await a24_0x2237cf({'type':_0x4cfab7(0x188),'name':_0x4cfab7(0x17c),'message':_0x4cfab7(0x181)+_0x51de26+'\x27:','choices':_0x41ff8e,'initial':_0x142b79>=0x0?_0x142b79:0x0});if(!_0x5a099d[_0x4cfab7(0x17c)])return console[_0x4cfab7(0x15f)](_0x4cfab7(0x14b)),0x1;let _0x394d76;if(_0x5a099d['site']===_0x4cfab7(0x144)){const _0x3b611d=await a24_0x2237cf({'type':_0x4cfab7(0x14d),'name':_0x4cfab7(0x1b5),'message':_0x4cfab7(0x14e),'initial':_0x4cfab7(0x148),'validate':_0x1ed493=>{const _0xcfdaa3=_0x4cfab7;if(!_0x1ed493||!_0x1ed493['trim']())return _0xcfdaa3(0x15e);if(!/^[a-z0-9-]+$/['test'](_0x1ed493[_0xcfdaa3(0x164)]()))return _0xcfdaa3(0x1ad);return!![];}});if(!_0x3b611d['customSite'])return console[_0x4cfab7(0x15f)](_0x4cfab7(0x14b)),0x1;_0x394d76=_0x3b611d[_0x4cfab7(0x1b5)];}else _0x394d76=_0x5a099d[_0x4cfab7(0x17c)];const _0x18a6b7=resolveSite(_0x394d76);console[_0x4cfab7(0x15f)](_0x4cfab7(0x149)+_0x18a6b7),console[_0x4cfab7(0x15f)](_0x4cfab7(0x157)),console[_0x4cfab7(0x15f)]('\x20\x20'+getConsoleUrl(_0x18a6b7,'/app/mp/ak'));const _0x544d4b=await a24_0x2237cf({'type':'password','name':_0x4cfab7(0x182),'message':_0x4cfab7(0x165),'validate':_0x2ed00a=>{const _0x2bf9db=_0x4cfab7;if(!_0x2ed00a||!_0x2ed00a[_0x2bf9db(0x164)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x544d4b['apiKey'])return console[_0x4cfab7(0x15f)]('\x0aSetup\x20cancelled'),0x1;const _0x69a53=_0x544d4b[_0x4cfab7(0x182)];console[_0x4cfab7(0x15f)](_0x4cfab7(0x168));try{const _0x300b98=TDX[_0x4cfab7(0x166)]({'site':_0x18a6b7,'apiKey':_0x69a53[_0x4cfab7(0x164)](),'logLevel':_0x117d59[_0x4cfab7(0x1af)]??LogLevel[_0x4cfab7(0x1b0)]}),_0x50fc83=await _0x300b98[_0x4cfab7(0x19e)][_0x4cfab7(0x170)]();console[_0x4cfab7(0x15f)](a24_0x21870b[_0x4cfab7(0x14c)]('✓')+_0x4cfab7(0x162)+_0x50fc83[_0x4cfab7(0x171)]+')');const _0x1b3045=await isKeychainAvailable();_0x1b3045?(await saveAPIKeyAsync(_0x69a53['trim'](),_0x18a6b7,_0x51de26),console[_0x4cfab7(0x15f)](a24_0x21870b['green']('✓')+_0x4cfab7(0x16f)+_0x51de26+')')):(console[_0x4cfab7(0x18f)](a24_0x21870b['yellow'](_0x4cfab7(0x189))),console[_0x4cfab7(0x18f)](a24_0x21870b['yellow'](_0x4cfab7(0x172))));const _0x1dd622={'site':_0x18a6b7,..._0x1c74af&&{'description':_0x1c74af}};return saveProfileToUserConfig(_0x51de26,_0x1dd622),console[_0x4cfab7(0x15f)](a24_0x21870b[_0x4cfab7(0x14c)]('✓')+_0x4cfab7(0x16c)+_0x51de26+'\x27\x20created'),console[_0x4cfab7(0x15f)](),console[_0x4cfab7(0x15f)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x4cfab7(0x15f)]('\x20\x20tdx\x20--profile\x20'+_0x51de26+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x4cfab7(0x155)+_0x51de26+_0x4cfab7(0x1a8)),0x0;}catch(_0x3d491a){if(_0x3d491a instanceof HTTPClientError&&_0x3d491a[_0x4cfab7(0x1a9)]===0x191)return printAuthError(_0x3d491a),0x1;return console[_0x4cfab7(0x17e)](a24_0x21870b[_0x4cfab7(0x16d)](_0x4cfab7(0x15d)+(_0x3d491a instanceof Error?_0x3d491a[_0x4cfab7(0x174)]:String(_0x3d491a)))),console[_0x4cfab7(0x17e)](_0x4cfab7(0x1aa)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x4c767c(0x184)]=a24_0x4c767c(0x150);[a24_0x4c767c(0x1b3)]='Remove\x20a\x20profile';[a24_0x4c767c(0x175)](_0x515e33){const _0x3de24e=a24_0x4c767c,{args:_0x4f3d83}=_0x515e33;if(_0x4f3d83[_0x3de24e(0x18d)]===0x0)return _0x3de24e(0x146);return undefined;}async[a24_0x4c767c(0x17f)](_0x47c7d4){const _0x224ee0=a24_0x4c767c,{args:_0x5ea7b2}=_0x47c7d4,_0xfcbfb1=_0x5ea7b2[0x0];console['log'](a24_0x21870b[_0x224ee0(0x19a)](_0x224ee0(0x193)));if(!profileExists(_0xfcbfb1)){console[_0x224ee0(0x17e)](a24_0x21870b[_0x224ee0(0x16d)](_0x224ee0(0x178)+_0xfcbfb1+_0x224ee0(0x156))),console[_0x224ee0(0x15f)](_0x224ee0(0x197));const _0x4a555f=listProfiles();if(_0x4a555f[_0x224ee0(0x18d)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x3877a8 of _0x4a555f){console[_0x224ee0(0x15f)](_0x224ee0(0x176)+_0x3877a8[_0x224ee0(0x184)]);}return 0x1;}const _0x323a00=await a24_0x2237cf({'type':_0x224ee0(0x194),'name':_0x224ee0(0x194),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xfcbfb1+'\x27?','initial':![]});if(!_0x323a00[_0x224ee0(0x194)])return console[_0x224ee0(0x15f)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0xfcbfb1),console[_0x224ee0(0x15f)](a24_0x21870b[_0x224ee0(0x14c)]('✓')+_0x224ee0(0x16c)+_0xfcbfb1+'\x27\x20removed\x20from\x20configuration');}catch(_0x5c1170){return console[_0x224ee0(0x17e)](a24_0x21870b[_0x224ee0(0x16d)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x5c1170 instanceof Error?_0x5c1170['message']:String(_0x5c1170)))),0x1;}const _0x3c63de=await isKeychainAvailable();if(_0x3c63de){const _0x505977=await deleteKeychainAPIKey(_0xfcbfb1);_0x505977&&console[_0x224ee0(0x15f)](a24_0x21870b[_0x224ee0(0x14c)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x4c767c(0x184)]=a24_0x4c767c(0x1a3);[a24_0x4c767c(0x1b3)]=a24_0x4c767c(0x19f);static [a24_0x4c767c(0x198)]=[a24_0x4c767c(0x17c),'database',a24_0x4c767c(0x163),a24_0x4c767c(0x195),a24_0x4c767c(0x180),'description'];[a24_0x4c767c(0x175)](_0x2232a0){const _0xf73d5c=a24_0x4c767c,{args:_0x2fe194,options:_0x433dc3}=_0x2232a0,_0x10f3a8=_0x433dc3[_0xf73d5c(0x142)]||getActiveProfile();if(!_0x10f3a8)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2fe194[_0xf73d5c(0x18d)]===0x0)return _0xf73d5c(0x17d)+ProfileSetCommand[_0xf73d5c(0x198)]['join'](',\x20');const _0x5f3a29=_0x2fe194[0x0];if(!_0x5f3a29[_0xf73d5c(0x177)]('='))return _0xf73d5c(0x1ab)+ProfileSetCommand['VALID_KEYS'][_0xf73d5c(0x19b)](',\x20');const [_0x2789fc]=_0x5f3a29[_0xf73d5c(0x153)]('=',0x2);if(!ProfileSetCommand[_0xf73d5c(0x198)][_0xf73d5c(0x177)](_0x2789fc))return'Unknown\x20key\x20\x27'+_0x2789fc+_0xf73d5c(0x16b)+ProfileSetCommand[_0xf73d5c(0x198)]['join'](',\x20');return undefined;}async[a24_0x4c767c(0x17f)](_0x1ba08a){const _0x24a35f=a24_0x4c767c,{args:_0x26c884,options:_0x466b08}=_0x1ba08a,_0x15f87d=_0x466b08[_0x24a35f(0x142)]||getActiveProfile(),[_0x2d098e,..._0x20de9c]=_0x26c884[0x0]['split']('='),_0x464cbe=_0x20de9c[_0x24a35f(0x19b)]('=');console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x19a)]('tdx:\x20profile\x20set'));if(!profileExists(_0x15f87d)){const _0x12863e=await a24_0x2237cf({'type':_0x24a35f(0x194),'name':_0x24a35f(0x166),'message':_0x24a35f(0x178)+_0x15f87d+_0x24a35f(0x191),'initial':!![]});if(!_0x12863e[_0x24a35f(0x166)])return console[_0x24a35f(0x15f)](_0x24a35f(0x1a6)),0x1;}const _0x24faf6=loadProfile(_0x15f87d),_0x533a57=_0x24faf6?.[_0x24a35f(0x186)]||{};if(_0x2d098e===_0x24a35f(0x17c)){const _0x1beee3=resolveSite(_0x464cbe);console[_0x24a35f(0x15f)](_0x24a35f(0x1b8)+_0x1beee3+_0x24a35f(0x1b6)),console[_0x24a35f(0x15f)](_0x24a35f(0x185)),console[_0x24a35f(0x15f)]('\x20\x20'+getConsoleUrl(_0x1beee3,_0x24a35f(0x167)));const _0x293fd4=await a24_0x2237cf({'type':_0x24a35f(0x1b4),'name':_0x24a35f(0x182),'message':_0x24a35f(0x15a),'validate':_0xd1c756=>{const _0x571a8a=_0x24a35f;if(!_0xd1c756||!_0xd1c756[_0x571a8a(0x164)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x293fd4[_0x24a35f(0x182)])return console['log'](_0x24a35f(0x145)),0x1;console[_0x24a35f(0x15f)](_0x24a35f(0x168));try{const _0x128d22=TDX['create']({'site':_0x1beee3,'apiKey':_0x293fd4['apiKey']['trim'](),'logLevel':_0x466b08[_0x24a35f(0x1af)]??LogLevel[_0x24a35f(0x1b0)]}),_0x3ce0f6=await _0x128d22[_0x24a35f(0x19e)][_0x24a35f(0x170)]();console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x14c)]('✓')+_0x24a35f(0x162)+_0x3ce0f6[_0x24a35f(0x171)]+')');const _0x20cf62=await isKeychainAvailable();_0x20cf62?(await saveAPIKeyAsync(_0x293fd4['apiKey']['trim'](),_0x1beee3,_0x15f87d),console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x14c)]('✓')+_0x24a35f(0x15c))):console[_0x24a35f(0x18f)](a24_0x21870b[_0x24a35f(0x1a1)](_0x24a35f(0x189))),_0x533a57[_0x24a35f(0x17c)]=_0x1beee3;}catch(_0x42af78){if(_0x42af78 instanceof HTTPClientError&&_0x42af78[_0x24a35f(0x1a9)]===0x191)return printAuthError(_0x42af78),0x1;return console[_0x24a35f(0x17e)](a24_0x21870b['red']('✗\x20Validation\x20failed:\x20'+(_0x42af78 instanceof Error?_0x42af78[_0x24a35f(0x174)]:String(_0x42af78)))),console[_0x24a35f(0x17e)](_0x24a35f(0x14a)),0x1;}}else _0x533a57[_0x2d098e]=_0x464cbe||undefined;return saveProfileToUserConfig(_0x15f87d,_0x533a57),console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x14c)]('✓')+_0x24a35f(0x16c)+_0x15f87d+_0x24a35f(0x19c)+_0x2d098e+'='+(_0x464cbe||_0x24a35f(0x196))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a24_0x4c767c(0x1a2);['description']='Set\x20session\x20profile';['validate'](_0x4be18d){const _0x2d0e9b=a24_0x4c767c,{args:_0x25d715}=_0x4be18d;if(_0x25d715[_0x2d0e9b(0x18d)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x4c767c(0x17f)](_0xa88516){const _0x3b9763=a24_0x4c767c,{args:_0x57d158,options:_0x56ffc3}=_0xa88516,_0x1ea61f=_0x57d158[0x0],_0x54dc09=_0x56ffc3[_0x3b9763(0x161)];cleanExpiredSessions();if(!profileExists(_0x1ea61f)){console[_0x3b9763(0x17e)](a24_0x21870b[_0x3b9763(0x16d)](_0x3b9763(0x178)+_0x1ea61f+_0x3b9763(0x156))),console[_0x3b9763(0x15f)]('\x0aAvailable\x20profiles:');const _0x3dc716=listProfiles();if(_0x3dc716[_0x3b9763(0x18d)]===0x0)console[_0x3b9763(0x15f)](_0x3b9763(0x159));else for(const _0x566059 of _0x3dc716){console[_0x3b9763(0x15f)]('\x20\x20-\x20'+_0x566059[_0x3b9763(0x184)]);}return 0x1;}if(_0x54dc09){const _0x293e1c=a24_0x590ba5[_0x3b9763(0x19b)](getConfigDir(),_0x3b9763(0x143));return saveActiveProfileToUserConfig(_0x1ea61f),console[_0x3b9763(0x15f)](_0x3b9763(0x179)+a24_0x21870b[_0x3b9763(0x14c)](_0x1ea61f)),console[_0x3b9763(0x15f)](a24_0x21870b[_0x3b9763(0x187)](_0x3b9763(0x16a)+_0x293e1c)),0x0;}const _0x3f4bcd=_0x56ffc3[_0x3b9763(0x158)]||getCurrentSessionPID()[_0x3b9763(0x147)]();return saveSessionContext({'profile':_0x1ea61f},_0x56ffc3[_0x3b9763(0x158)]),console['log'](_0x3b9763(0x15b)+a24_0x21870b[_0x3b9763(0x14c)](_0x1ea61f)+'\x20'+a24_0x21870b[_0x3b9763(0x187)](_0x3b9763(0x190)+_0x3f4bcd+')')),console[_0x3b9763(0x15f)](a24_0x21870b[_0x3b9763(0x187)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x1ea61f+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a25_0x216c0c=a25_0x3ba0;function a25_0x3ba0(_0x97c13b,_0x47f9a5){_0x97c13b=_0x97c13b-0xd8;const _0x1be61c=a25_0x1be6();let _0x3ba077=_0x1be61c[_0x97c13b];return _0x3ba077;}(function(_0x33c8c3,_0xe8fa97){const _0x49e5ad=a25_0x3ba0,_0x4a04dd=_0x33c8c3();while(!![]){try{const _0x333efa=-parseInt(_0x49e5ad(0xdd))/0x1*(parseInt(_0x49e5ad(0xd8))/0x2)+parseInt(_0x49e5ad(0xe2))/0x3+-parseInt(_0x49e5ad(0xe7))/0x4+parseInt(_0x49e5ad(0xe4))/0x5*(-parseInt(_0x49e5ad(0xe6))/0x6)+-parseInt(_0x49e5ad(0xdc))/0x7*(-parseInt(_0x49e5ad(0xe0))/0x8)+parseInt(_0x49e5ad(0xdb))/0x9+parseInt(_0x49e5ad(0xea))/0xa*(parseInt(_0x49e5ad(0xdf))/0xb);if(_0x333efa===_0xe8fa97)break;else _0x4a04dd['push'](_0x4a04dd['shift']());}catch(_0x329f42){_0x4a04dd['push'](_0x4a04dd['shift']());}}}(a25_0x1be6,0x676cb));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a25_0x216c0c(0xec)]=a25_0x216c0c(0xe5);async['execute'](_0x37b531){const _0x1a279e=a25_0x216c0c,{options:_0x52c0d9}=_0x37b531;try{const _0x56b46a=listProfiles(),_0x3eea7f=getActiveProfile();if(_0x56b46a[_0x1a279e(0xeb)]===0x0)return console[_0x1a279e(0xde)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x1a279e(0xed)),console['log'](_0x1a279e(0xe1)),0x0;const _0x2fea1a=_0x56b46a['map'](_0x124688=>{const _0x5b8a88=_0x1a279e,_0x1bbaea=_0x124688[_0x5b8a88(0xe3)]===_0x3eea7f,_0x4fc05a=getProfileParams(_0x124688[_0x5b8a88(0xe9)]);return{'name':_0x124688[_0x5b8a88(0xe3)],'active':_0x1bbaea,'scope':_0x124688[_0x5b8a88(0xe8)],'description':_0x124688[_0x5b8a88(0xe9)][_0x5b8a88(0xec)]||'','params':_0x4fc05a};});return await handleSDKOutput(_0x2fea1a,_0x52c0d9),0x0;}catch(_0x906d4d){return _0x906d4d instanceof Error&&console[_0x1a279e(0xda)]('Error:\x20'+_0x906d4d[_0x1a279e(0xd9)]),0x1;}}}function a25_0x1be6(){const _0x4d75e9=['config','152980jSDnNp','length','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','37010IldXiw','message','error','862983cgceKb','7KixLRh','45jWGOzG','log','1221UbILmI','848440xbgOLX','\x20\x20Global:\x20~/.config/tdx/tdx.json','663255CnYfKK','name','889135LvYCTi','List\x20all\x20available\x20profiles','12XkJsZV','2036396RbTdjY','scope'];a25_0x1be6=function(){return _0x4d75e9;};return a25_0x1be6();}
1
+ function a25_0x5ba9(_0x423c60,_0x2d9b06){_0x423c60=_0x423c60-0x1a8;const _0x138804=a25_0x1388();let _0x5ba99f=_0x138804[_0x423c60];return _0x5ba99f;}const a25_0x209855=a25_0x5ba9;(function(_0x5d390a,_0x1ec3bf){const _0x305bec=a25_0x5ba9,_0x51beec=_0x5d390a();while(!![]){try{const _0x4587df=parseInt(_0x305bec(0x1be))/0x1+-parseInt(_0x305bec(0x1b8))/0x2*(parseInt(_0x305bec(0x1ad))/0x3)+parseInt(_0x305bec(0x1bb))/0x4*(parseInt(_0x305bec(0x1b0))/0x5)+parseInt(_0x305bec(0x1a8))/0x6+-parseInt(_0x305bec(0x1b6))/0x7*(-parseInt(_0x305bec(0x1ae))/0x8)+-parseInt(_0x305bec(0x1b4))/0x9+-parseInt(_0x305bec(0x1b2))/0xa;if(_0x4587df===_0x1ec3bf)break;else _0x51beec['push'](_0x51beec['shift']());}catch(_0x2374d3){_0x51beec['push'](_0x51beec['shift']());}}}(a25_0x1388,0xb2a31));function a25_0x1388(){const _0x3ddfbe=['Error:\x20','8334558RTaeFU','profiles','284732eGVBDH','map','150518hnLSyH','List\x20all\x20available\x20profiles','name','2156cVhoew','\x20\x20Global:\x20~/.config/tdx/tdx.json','length','338900fFHjcf','config','error','3051588iWUDhJ','execute','log','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','message','57gwomcj','232vcGyMt','scope','10135WMDlNo','description','319750ndajbl'];a25_0x1388=function(){return _0x3ddfbe;};return a25_0x1388();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a25_0x209855(0x1ba)]=a25_0x209855(0x1b5);['description']=a25_0x209855(0x1b9);async[a25_0x209855(0x1a9)](_0x343f99){const _0x455f87=a25_0x209855,{options:_0x106771}=_0x343f99;try{const _0x3323b0=listProfiles(),_0x10837f=getActiveProfile();if(_0x3323b0[_0x455f87(0x1bd)]===0x0)return console[_0x455f87(0x1aa)](_0x455f87(0x1ab)),console[_0x455f87(0x1aa)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x455f87(0x1aa)](_0x455f87(0x1bc)),0x0;const _0x123a2f=_0x3323b0[_0x455f87(0x1b7)](_0x82cc51=>{const _0x3b2001=_0x455f87,_0x25193c=_0x82cc51[_0x3b2001(0x1ba)]===_0x10837f,_0x280d74=getProfileParams(_0x82cc51[_0x3b2001(0x1bf)]);return{'name':_0x82cc51[_0x3b2001(0x1ba)],'active':_0x25193c,'scope':_0x82cc51[_0x3b2001(0x1af)],'description':_0x82cc51['config'][_0x3b2001(0x1b1)]||'','params':_0x280d74};});return await handleSDKOutput(_0x123a2f,_0x106771),0x0;}catch(_0x7ca700){return _0x7ca700 instanceof Error&&console[_0x455f87(0x1c0)](_0x455f87(0x1b3)+_0x7ca700[_0x455f87(0x1ac)]),0x1;}}}
@@ -1 +1 @@
1
- const a26_0x4402e4=a26_0x2b6a;(function(_0x554d54,_0x3ff54e){const _0xfcd5c6=a26_0x2b6a,_0x1495a8=_0x554d54();while(!![]){try{const _0x99ba8a=parseInt(_0xfcd5c6(0xe6))/0x1+parseInt(_0xfcd5c6(0xdf))/0x2+-parseInt(_0xfcd5c6(0x101))/0x3*(-parseInt(_0xfcd5c6(0xe9))/0x4)+-parseInt(_0xfcd5c6(0xff))/0x5+parseInt(_0xfcd5c6(0xf2))/0x6+-parseInt(_0xfcd5c6(0xf8))/0x7*(parseInt(_0xfcd5c6(0xdc))/0x8)+parseInt(_0xfcd5c6(0x103))/0x9*(-parseInt(_0xfcd5c6(0xe5))/0xa);if(_0x99ba8a===_0x3ff54e)break;else _0x1495a8['push'](_0x1495a8['shift']());}catch(_0x4042be){_0x1495a8['push'](_0x1495a8['shift']());}}}(a26_0x2cb9,0xaa4f7));function a26_0x2b6a(_0x2504f1,_0x182040){_0x2504f1=_0x2504f1-0xda;const _0x2cb9de=a26_0x2cb9();let _0x2b6ac4=_0x2cb9de[_0x2504f1];return _0x2b6ac4;}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';function a26_0x2cb9(){const _0x4d23ad=['15xPbbVp','\x20[Job\x20ID:\x20','88227PJHOiC','Executing\x20query...','processedRows','error','totalSplits','in\x20','catalog','Executing\x20statement\x20','options','length','jobId','setJobId','7408tmUzfq','Error:\x20','Site:\x20','922800hqupqH','database','\x0aAll\x20results\x20saved\x20to\x20','\x20-\x20','data','file','1010RxtPQR','1057411xLgpQq','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','name','712688MLlEPq','elapsedTimeMillis','args','\x20rows\x20','Schema:\x20','query','Query\x20completed:\x20Processed\x20','Catalog:\x20','execute','4458978KYiIXg','verbose','No\x20SQL\x20provided','Statement\x20','completedSplits','site','7385gdtcTj','SQL:\x20','output','Run\x20Trino\x20queries\x20(streaming)','validate','\x20splits','stats','2441050LoLTuE','push'];a26_0x2cb9=function(){return _0x4d23ad;};return a26_0x2cb9();}export class QueryCommand extends BaseCommand{[a26_0x4402e4(0xe8)]=a26_0x4402e4(0xee);['description']=a26_0x4402e4(0xfb);async[a26_0x4402e4(0xf1)](_0x5073f0){const _0x259bd0=a26_0x4402e4,{options:_0x5e7855,args:_0x278ec9,tdx:_0x3d080d}=_0x5073f0,_0x23ab52=_0x278ec9[0x0],_0x16a31a=_0x5e7855[_0x259bd0(0xe4)];let _0x802af2;try{if(_0x16a31a)_0x802af2=readSqlStatementsFromFile(_0x16a31a);else{if(_0x23ab52==='-')_0x802af2=await readSqlStatementsFromStdin();else{if(_0x23ab52&&isSqlFilePath(_0x23ab52))_0x802af2=readSqlStatementsFromFile(_0x23ab52);else{if(_0x23ab52)_0x802af2=splitSqlStatements(_0x23ab52);else throw new Error(_0x259bd0(0xf4));}}}}catch(_0x4d9ffc){return console[_0x259bd0(0x106)](_0x259bd0(0xdd)+_0x4d9ffc['message']),0x1;}const _0x2dee46=_0x5e7855[_0x259bd0(0xe0)]||'information_schema',_0x2197d6=_0x5e7855[_0x259bd0(0x109)];try{const _0x457641=[],_0x4cd6fa=!!_0x5e7855[_0x259bd0(0xfa)];for(let _0x49d0a0=0x0;_0x49d0a0<_0x802af2[_0x259bd0(0x10c)];_0x49d0a0++){const _0x21d951=_0x802af2[_0x49d0a0],_0x85d2ff=_0x49d0a0+0x1,_0x19573e=_0x802af2[_0x259bd0(0x10c)],_0x6ff6cc=_0x19573e>0x1;_0x5e7855[_0x259bd0(0xf3)]&&(console[_0x259bd0(0x106)]('\x0a'+(_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+':':'')),console[_0x259bd0(0x106)](_0x259bd0(0xde)+_0x5e7855[_0x259bd0(0xf7)]),console[_0x259bd0(0x106)](_0x259bd0(0xf0)+(_0x2197d6||'td')),console['error'](_0x259bd0(0xed)+_0x2dee46),console['error'](_0x259bd0(0xf9)+_0x21d951));const _0x1e6f43=_0x6ff6cc?_0x259bd0(0x10a)+_0x85d2ff+'/'+_0x19573e+'...':_0x259bd0(0x104);try{const _0x4e93b8=await withProgressSpinner(_0x1e6f43,async _0x5d9dc6=>{const _0x4758d0=await _0x3d080d['query']['execute'](_0x21d951,{'catalog':_0x2197d6,'schema':_0x2dee46,'onJobId':_0x4c91bc=>{const _0x817481=a26_0x2b6a;_0x5d9dc6[_0x817481(0xdb)](_0x4c91bc);},'onProgress':_0x5b7a68=>{const _0x460a05=a26_0x2b6a;_0x5d9dc6['setPhase']('Executing\x20query\x20['+_0x5b7a68['state']+']'),_0x5d9dc6['setExtra'](formatRows(_0x5b7a68['processedRows'])+_0x460a05(0xec)+_0x5b7a68[_0x460a05(0xf6)]+'/'+_0x5b7a68[_0x460a05(0x107)]+_0x460a05(0xfd));}});return _0x4758d0;},{'verbose':_0x5e7855[_0x259bd0(0xf3)]}),_0x57eadc=_0x4e93b8[_0x259bd0(0xe3)],_0x52696d=_0x57eadc['jobId']?_0x259bd0(0x102)+_0x57eadc[_0x259bd0(0xda)]+']':'',_0x2fe8f3=_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+_0x259bd0(0xe2):'';console['error']('✔\x20'+_0x2fe8f3+_0x259bd0(0xef)+formatRows(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0x105)])+_0x259bd0(0xec)+(_0x259bd0(0x108)+formatElapsed(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0xea)])+_0x52696d));if(_0x6ff6cc&&_0x4cd6fa){const _0x53a5d6=resolveOutputOptions(_0x5e7855),_0x588a10=await formatQueryOutput(_0x57eadc,_0x53a5d6);_0x457641[_0x259bd0(0x100)](_0x588a10);}else await handleQueryOutput(_0x57eadc,_0x5e7855);}catch(_0x81ecb3){const _0x582818=_0x6ff6cc?'Statement\x20'+_0x85d2ff+'/'+_0x19573e+':\x0a':'',_0xa7cfb6=_0x81ecb3 instanceof SDKError?_0x81ecb3['originalMessage']:_0x81ecb3['message'];return console[_0x259bd0(0x106)](''+_0x582818+_0xa7cfb6),0x1;}}if(_0x802af2[_0x259bd0(0x10c)]>0x1&&_0x4cd6fa&&_0x457641['length']>0x0){const _0x2deea8=_0x457641['join']('\x0a');writeFileSync(_0x5e7855['output'],_0x2deea8),console['error'](_0x259bd0(0xe1)+_0x5e7855[_0x259bd0(0xfa)]);}return 0x0;}catch(_0x493cd6){throw _0x493cd6;}}[a26_0x4402e4(0xfc)](_0xfc7ddc){const _0x68fb88=a26_0x4402e4,_0x29d776=_0xfc7ddc[_0x68fb88(0xeb)][0x0],_0x30bee6=_0xfc7ddc[_0x68fb88(0x10b)][_0x68fb88(0xe4)];if(!_0x29d776&&!_0x30bee6)return _0x68fb88(0xe7);if(_0x29d776&&_0x30bee6)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a26_0x257d7b=a26_0x112f;(function(_0x5556b4,_0x4ba17d){const _0x139641=a26_0x112f,_0x2a08b6=_0x5556b4();while(!![]){try{const _0x11a41c=-parseInt(_0x139641(0x17c))/0x1*(-parseInt(_0x139641(0x16d))/0x2)+-parseInt(_0x139641(0x176))/0x3+-parseInt(_0x139641(0x167))/0x4+-parseInt(_0x139641(0x163))/0x5*(parseInt(_0x139641(0x185))/0x6)+parseInt(_0x139641(0x182))/0x7+parseInt(_0x139641(0x186))/0x8*(-parseInt(_0x139641(0x175))/0x9)+parseInt(_0x139641(0x180))/0xa*(parseInt(_0x139641(0x17f))/0xb);if(_0x11a41c===_0x4ba17d)break;else _0x2a08b6['push'](_0x2a08b6['shift']());}catch(_0x56cd22){_0x2a08b6['push'](_0x2a08b6['shift']());}}}(a26_0x1459,0x3b2cc));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x1459(){const _0x5e991a=['Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','44691yuHnxp','originalMessage','push','11WVgVYg','6021810sUOvxA','state','2125046SMxjcw','file','name','1050306QbKJsZ','16YRiUZk','in\x20','length','Catalog:\x20','stats','information_schema','error','description','join','message','Run\x20Trino\x20queries\x20(streaming)','processedRows','setExtra','Executing\x20query...','\x20rows\x20','10TICvFW','Statement\x20','completedSplits','query','916988jUutwB','validate','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','\x20splits','...','data','2PaOLRO','jobId','setPhase','SQL:\x20','output','options','execute','catalog','41706FJHIwM','358359iUXJdM','Schema:\x20','Site:\x20','verbose','totalSplits'];a26_0x1459=function(){return _0x5e991a;};return a26_0x1459();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a26_0x112f(_0x1aa5b5,_0x2e3de5){_0x1aa5b5=_0x1aa5b5-0x15a;const _0x1459f3=a26_0x1459();let _0x112f3a=_0x1459f3[_0x1aa5b5];return _0x112f3a;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a26_0x257d7b(0x184)]=a26_0x257d7b(0x166);[a26_0x257d7b(0x15b)]=a26_0x257d7b(0x15e);async[a26_0x257d7b(0x173)](_0xad7746){const _0x5e32a0=a26_0x257d7b,{options:_0x17c92f,args:_0x502a36,tdx:_0xf58713}=_0xad7746,_0x1eeb80=_0x502a36[0x0],_0x46e4f7=_0x17c92f[_0x5e32a0(0x183)];let _0x4626b6;try{if(_0x46e4f7)_0x4626b6=readSqlStatementsFromFile(_0x46e4f7);else{if(_0x1eeb80==='-')_0x4626b6=await readSqlStatementsFromStdin();else{if(_0x1eeb80&&isSqlFilePath(_0x1eeb80))_0x4626b6=readSqlStatementsFromFile(_0x1eeb80);else{if(_0x1eeb80)_0x4626b6=splitSqlStatements(_0x1eeb80);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0xf7f0f8){return console['error']('Error:\x20'+_0xf7f0f8[_0x5e32a0(0x15d)]),0x1;}const _0x152e73=_0x17c92f['database']||_0x5e32a0(0x18b),_0x2d59c5=_0x17c92f[_0x5e32a0(0x174)];try{const _0x14f30b=[],_0x22124b=!!_0x17c92f[_0x5e32a0(0x171)];for(let _0x3ad238=0x0;_0x3ad238<_0x4626b6[_0x5e32a0(0x188)];_0x3ad238++){const _0xddcd3e=_0x4626b6[_0x3ad238],_0x5760b3=_0x3ad238+0x1,_0x1d5797=_0x4626b6[_0x5e32a0(0x188)],_0x48cd4f=_0x1d5797>0x1;_0x17c92f[_0x5e32a0(0x179)]&&(console['error']('\x0a'+(_0x48cd4f?'Statement\x20'+_0x5760b3+'/'+_0x1d5797+':':'')),console[_0x5e32a0(0x15a)](_0x5e32a0(0x178)+_0x17c92f['site']),console[_0x5e32a0(0x15a)](_0x5e32a0(0x189)+(_0x2d59c5||'td')),console[_0x5e32a0(0x15a)](_0x5e32a0(0x177)+_0x152e73),console[_0x5e32a0(0x15a)](_0x5e32a0(0x170)+_0xddcd3e));const _0x1b8cb2=_0x48cd4f?'Executing\x20statement\x20'+_0x5760b3+'/'+_0x1d5797+_0x5e32a0(0x16b):_0x5e32a0(0x161);try{const _0x2a25c3=await withProgressSpinner(_0x1b8cb2,async _0x66884d=>{const _0x5ed848=_0x5e32a0,_0x1f829d=await _0xf58713[_0x5ed848(0x166)][_0x5ed848(0x173)](_0xddcd3e,{'catalog':_0x2d59c5,'schema':_0x152e73,'onJobId':_0x510755=>{_0x66884d['setJobId'](_0x510755);},'onProgress':_0x583391=>{const _0x364b3e=_0x5ed848;_0x66884d[_0x364b3e(0x16f)]('Executing\x20query\x20['+_0x583391[_0x364b3e(0x181)]+']'),_0x66884d[_0x364b3e(0x160)](formatRows(_0x583391['processedRows'])+_0x364b3e(0x162)+_0x583391[_0x364b3e(0x165)]+'/'+_0x583391[_0x364b3e(0x17a)]+_0x364b3e(0x16a));}});return _0x1f829d;},{'verbose':_0x17c92f[_0x5e32a0(0x179)]}),_0x14e0eb=_0x2a25c3[_0x5e32a0(0x16c)],_0x2100cf=_0x14e0eb[_0x5e32a0(0x16e)]?'\x20[Job\x20ID:\x20'+_0x14e0eb[_0x5e32a0(0x16e)]+']':'',_0x1a7328=_0x48cd4f?'Statement\x20'+_0x5760b3+'/'+_0x1d5797+'\x20-\x20':'';console[_0x5e32a0(0x15a)]('✔\x20'+_0x1a7328+'Query\x20completed:\x20Processed\x20'+formatRows(_0x14e0eb[_0x5e32a0(0x18a)][_0x5e32a0(0x15f)])+_0x5e32a0(0x162)+(_0x5e32a0(0x187)+formatElapsed(_0x14e0eb[_0x5e32a0(0x18a)]['elapsedTimeMillis'])+_0x2100cf));if(_0x48cd4f&&_0x22124b){const _0x568e16=resolveOutputOptions(_0x17c92f),_0x521ce9=await formatQueryOutput(_0x14e0eb,_0x568e16);_0x14f30b[_0x5e32a0(0x17e)](_0x521ce9);}else await handleQueryOutput(_0x14e0eb,_0x17c92f);}catch(_0x108f62){const _0x520153=_0x48cd4f?_0x5e32a0(0x164)+_0x5760b3+'/'+_0x1d5797+':\x0a':'',_0x15dd13=_0x108f62 instanceof SDKError?_0x108f62[_0x5e32a0(0x17d)]:_0x108f62[_0x5e32a0(0x15d)];return console[_0x5e32a0(0x15a)](''+_0x520153+_0x15dd13),0x1;}}if(_0x4626b6[_0x5e32a0(0x188)]>0x1&&_0x22124b&&_0x14f30b[_0x5e32a0(0x188)]>0x0){const _0x5f6949=_0x14f30b[_0x5e32a0(0x15c)]('\x0a');writeFileSync(_0x17c92f[_0x5e32a0(0x171)],_0x5f6949),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x17c92f['output']);}return 0x0;}catch(_0x37f910){throw _0x37f910;}}[a26_0x257d7b(0x168)](_0x197cbf){const _0x2a6e5f=a26_0x257d7b,_0x48829d=_0x197cbf['args'][0x0],_0x3618bb=_0x197cbf[_0x2a6e5f(0x172)][_0x2a6e5f(0x183)];if(!_0x48829d&&!_0x3618bb)return _0x2a6e5f(0x169);if(_0x48829d&&_0x3618bb)return _0x2a6e5f(0x17b);return undefined;}}