@treasuredata/tdx 0.16.1 → 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 (162) 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 +19 -1
  81. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  82. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  83. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  84. package/dist/sdk/claude-agent/environment.d.ts +9 -0
  85. package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
  86. package/dist/sdk/claude-agent/environment.js +1 -1
  87. package/dist/sdk/claude-agent/environment.js.map +1 -1
  88. package/dist/sdk/claude-agent/index.js +1 -1
  89. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  90. package/dist/sdk/claude-agent/types.d.ts +26 -0
  91. package/dist/sdk/claude-agent/types.d.ts.map +1 -1
  92. package/dist/sdk/client/cdp-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/rate-limiter.js +1 -1
  98. package/dist/sdk/client/td-api-client.js +1 -1
  99. package/dist/sdk/client/trino-api-client.js +1 -1
  100. package/dist/sdk/client/workflow-client.js +1 -1
  101. package/dist/sdk/connection-validator.js +1 -1
  102. package/dist/sdk/connection.js +1 -1
  103. package/dist/sdk/engage.js +1 -1
  104. package/dist/sdk/errors.js +1 -1
  105. package/dist/sdk/index.js +1 -1
  106. package/dist/sdk/io/index.js +1 -1
  107. package/dist/sdk/io/node-filesystem.js +1 -1
  108. package/dist/sdk/job.js +1 -1
  109. package/dist/sdk/journey.js +1 -1
  110. package/dist/sdk/llm/chat-cache.js +1 -1
  111. package/dist/sdk/llm/index.js +1 -1
  112. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  113. package/dist/sdk/llm/model-aliases.js +1 -1
  114. package/dist/sdk/llm/model-factors.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/fields-display.js +1 -1
  119. package/dist/sdk/segment/file-discovery.js +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-yaml.js +1 -1
  122. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  123. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  124. package/dist/sdk/segment/pull-workflow.js +1 -1
  125. package/dist/sdk/segment/push-workflow.js +1 -1
  126. package/dist/sdk/segment/resolution-context.js +1 -1
  127. package/dist/sdk/segment/segment-path-parser.js +1 -1
  128. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  129. package/dist/sdk/segment/target-resolution.js +1 -1
  130. package/dist/sdk/segment/tdx-config.js +1 -1
  131. package/dist/sdk/segment/validate-files.js +1 -1
  132. package/dist/sdk/segment/yaml-validator.js +1 -1
  133. package/dist/sdk/segment.js +1 -1
  134. package/dist/sdk/types/index.js +1 -1
  135. package/dist/sdk/types/progress.js +1 -1
  136. package/dist/sdk/user.js +1 -1
  137. package/dist/sdk/util/format-detector.js +1 -1
  138. package/dist/sdk/util/formatters.js +1 -1
  139. package/dist/sdk/util/index.js +1 -1
  140. package/dist/sdk/util/tree-formatter.js +1 -1
  141. package/dist/sdk/workflow/clone-workflow.js +1 -1
  142. package/dist/sdk/workflow/index.js +1 -1
  143. package/dist/sdk/workflow/pull-workflow.js +1 -1
  144. package/dist/sdk/workflow/push-workflow.js +1 -1
  145. package/dist/sdk/workflow/tdx-config.js +1 -1
  146. package/dist/sdk/workflow/workflow-utils.js +1 -1
  147. package/dist/utils/async.js +1 -1
  148. package/dist/utils/colors.js +1 -1
  149. package/dist/utils/diff.js +1 -1
  150. package/dist/utils/file-permissions.js +1 -1
  151. package/dist/utils/json-loader.js +1 -1
  152. package/dist/utils/option-validation.js +1 -1
  153. package/dist/utils/port.js +1 -1
  154. package/dist/utils/process.js +1 -1
  155. package/dist/utils/prompt.js +1 -1
  156. package/dist/utils/spinner.js +1 -1
  157. package/dist/utils/sse-parser.js +1 -1
  158. package/dist/utils/string-utils.js +1 -1
  159. package/dist/utils/table-ref-parser.js +1 -1
  160. package/dist/utils/tdx-logger.js +1 -1
  161. package/dist/utils/version-check.js +1 -1
  162. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x139023=a23_0x1de8;(function(_0x766c72,_0xe0e8cc){const _0x40e3e6=a23_0x1de8,_0x14c7b9=_0x766c72();while(!![]){try{const _0x55df3c=-parseInt(_0x40e3e6(0x279))/0x1*(parseInt(_0x40e3e6(0x1e1))/0x2)+-parseInt(_0x40e3e6(0x2c2))/0x3*(parseInt(_0x40e3e6(0x276))/0x4)+parseInt(_0x40e3e6(0x28a))/0x5+parseInt(_0x40e3e6(0x2d7))/0x6+parseInt(_0x40e3e6(0x2e1))/0x7+parseInt(_0x40e3e6(0x278))/0x8*(parseInt(_0x40e3e6(0x2f4))/0x9)+-parseInt(_0x40e3e6(0x29e))/0xa;if(_0x55df3c===_0xe0e8cc)break;else _0x14c7b9['push'](_0x14c7b9['shift']());}catch(_0x38aebb){_0x14c7b9['push'](_0x14c7b9['shift']());}}}(a23_0x10e2,0xdacba));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x37e68e 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_0x223cba from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x139023(0x2ed);function openBrowser(_0x578eb0){const _0x163dae=a23_0x139023,_0x74806e=process[_0x163dae(0x250)],_0xe6b4de=_0x74806e==='darwin'?'open':_0x74806e===_0x163dae(0x254)?_0x163dae(0x308):_0x163dae(0x1f1);spawn(_0xe6b4de,[_0x578eb0],{'detached':!![],'stdio':_0x163dae(0x232)})[_0x163dae(0x307)]();}function migrateLegacyDirectory(){const _0x95f7fe=a23_0x139023;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1dcb6f=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1dcb6f[_0x95f7fe(0x2cd)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x95f7fe(0x2db)](a23_0x223cba[_0x95f7fe(0x20f)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x95f7fe(0x25e)+PARENT_SEGMENT_DIR+_0x95f7fe(0x227))),console[_0x95f7fe(0x2db)](a23_0x223cba['dim'](_0x95f7fe(0x288)+LEGACY_PARENT_SEGMENT_DIR+_0x95f7fe(0x2a7))),![];console[_0x95f7fe(0x2db)](a23_0x223cba['yellow'](_0x95f7fe(0x267)+LEGACY_PARENT_SEGMENT_DIR+_0x95f7fe(0x25f)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x95f7fe(0x2db)](a23_0x223cba[_0x95f7fe(0x23b)](_0x95f7fe(0x25d)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3a078f){const _0x315651=_0x3a078f instanceof Error?_0x3a078f[_0x95f7fe(0x2a2)]:String(_0x3a078f);return console[_0x95f7fe(0x2db)](a23_0x223cba['red'](_0x95f7fe(0x2b1)+_0x315651+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x429fb6){return migrateLegacyDirectory(),super['run'](_0x429fb6);}}function resolveYamlFile(_0x372304){const _0x173873=a23_0x139023;if(_0x372304['endsWith'](_0x173873(0x2e4))||_0x372304[_0x173873(0x211)](_0x173873(0x209)))return _0x372304;return a23_0x37e68e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x372304)+_0x173873(0x2e4));}function formatProgressMessage(_0x13ecab){const _0x5d85b4=a23_0x139023,_0x14162b=_0x13ecab[_0x5d85b4(0x229)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x14162b){const [,_0x3c17ef,_0x44d0cb,_0x1379a5='']=_0x14162b;return a23_0x223cba[_0x5d85b4(0x2ba)](_0x3c17ef+':')+'\x20'+_0x44d0cb+a23_0x223cba[_0x5d85b4(0x2ba)](_0x1379a5);}return a23_0x223cba[_0x5d85b4(0x2ba)](_0x13ecab);}function showFileNotFoundError(_0x39ddae,_0x52164c){const _0x3a0707=a23_0x139023;console[_0x3a0707(0x2db)](a23_0x223cba[_0x3a0707(0x2ac)](_0x3a0707(0x2fb)+_0x39ddae+'\x0a')),console[_0x3a0707(0x2db)](a23_0x223cba['cyan'](_0x3a0707(0x2fc)+_0x52164c+_0x3a0707(0x21a)));}function showParentSegmentNotSetError(_0x4aaccd){const _0x89f95c=a23_0x139023;console[_0x89f95c(0x2db)](a23_0x223cba[_0x89f95c(0x20f)](_0x89f95c(0x2b7))),console['error'](_0x4aaccd);}function a23_0x1de8(_0x282f98,_0x1757ac){_0x282f98=_0x282f98-0x1df;const _0x10e2a3=a23_0x10e2();let _0x1de891=_0x10e2a3[_0x282f98];return _0x1de891;}export class ParentSegmentListCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x24d);[a23_0x139023(0x304)]=a23_0x139023(0x25a);async[a23_0x139023(0x262)](_0x2fae81){const _0x532906=a23_0x139023,{options:_0x223f97,args:_0x2dbb74,tdx:_0x2caec2}=_0x2fae81,_0x1393e5=_0x2dbb74[0x0];_0x223f97[_0x532906(0x2c0)]&&(console['error'](_0x532906(0x22b)+_0x223f97[_0x532906(0x205)]),_0x1393e5&&console[_0x532906(0x2db)](_0x532906(0x1f3)+_0x1393e5));const _0x37b872=await withSpinner(_0x1393e5?_0x532906(0x1e3)+_0x1393e5+_0x532906(0x294):_0x532906(0x2a5),()=>_0x2caec2[_0x532906(0x27a)]['listParents'](),{'verbose':_0x223f97['verbose']});let _0x197be9=_0x37b872[_0x532906(0x259)];if(_0x1393e5){const _0x2d133b=_0x1393e5['replace'](/[.+^${}()|[\]\\]/g,_0x532906(0x2fa))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x27c365=new RegExp('^'+_0x2d133b+'$','i');_0x197be9=_0x197be9[_0x532906(0x221)](_0x26c838=>_0x27c365['test'](_0x26c838['attributes'][_0x532906(0x28c)]));}_0x197be9[_0x532906(0x26f)]((_0x506403,_0x3c6eed)=>_0x506403[_0x532906(0x24a)]['name'][_0x532906(0x2a9)](_0x3c6eed[_0x532906(0x24a)]['name'])),console[_0x532906(0x2db)](_0x532906(0x2bc)+_0x197be9['length']+'\x20parent\x20segment'+(_0x197be9[_0x532906(0x1ef)]!==0x1?'s':''));const _0x2b89ba=_0x3e52e0=>{const _0x5993d4=_0x532906;return getConsoleNextUrl(_0x223f97[_0x5993d4(0x205)],_0x5993d4(0x23c)+_0x3e52e0);};if(_0x223f97[_0x532906(0x22f)]===_0x532906(0x24b)||_0x223f97[_0x532906(0x22f)]===_0x532906(0x222)){const _0x54f6a7=_0x197be9[_0x532906(0x23a)](_0x9163e9=>({..._0x9163e9,'url':_0x2b89ba(_0x9163e9['id'])}));await handleSDKOutput(_0x54f6a7,_0x223f97);}else{if(_0x197be9[_0x532906(0x1ef)]===0x0)_0x1393e5?console[_0x532906(0x216)](_0x532906(0x2d1)+_0x1393e5):console['log']('No\x20parent\x20segments\x20found');else for(const _0x48f1fe of _0x197be9){const _0x5d25d0=_0x48f1fe[_0x532906(0x24a)]['population']?a23_0x223cba[_0x532906(0x2ba)]('\x20('+formatRows(_0x48f1fe[_0x532906(0x24a)][_0x532906(0x29d)])+')'):'',_0x31fe49=hyperlink(_0x48f1fe[_0x532906(0x24a)]['name'],_0x2b89ba(_0x48f1fe['id']));console[_0x532906(0x216)]('👥\x20'+_0x31fe49+_0x5d25d0);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x2e0);[a23_0x139023(0x304)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x3eb400){const _0x35fbc9=a23_0x139023,{options:_0x223aab,args:_0x219550,tdx:_0x51cf97}=_0x3eb400;console[_0x35fbc9(0x2db)](_0x35fbc9(0x1eb)+_0x35fbc9(0x2c7)+_0x35fbc9(0x272));const _0x4b6ff3=_0x223aab;if(_0x219550[_0x35fbc9(0x1ef)]===0x0)return console['error'](a23_0x223cba[_0x35fbc9(0x2ac)](_0x35fbc9(0x218))),console[_0x35fbc9(0x2db)](_0x35fbc9(0x2cb)),0x1;const _0x2b6ae0=_0x219550[0x0];if(!_0x4b6ff3[_0x35fbc9(0x235)]||!_0x4b6ff3[_0x35fbc9(0x2ee)])return console[_0x35fbc9(0x2db)](_0x35fbc9(0x27b)),console[_0x35fbc9(0x2db)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x4b6ff3[_0x35fbc9(0x2c0)]&&(console[_0x35fbc9(0x2db)](_0x35fbc9(0x22b)+_0x4b6ff3[_0x35fbc9(0x205)]),console[_0x35fbc9(0x2db)]('Name:\x20'+_0x2b6ae0),console[_0x35fbc9(0x2db)](_0x35fbc9(0x28b)+_0x4b6ff3[_0x35fbc9(0x235)]),console[_0x35fbc9(0x2db)](_0x35fbc9(0x1e2)+_0x4b6ff3['table']));const _0x3b5d30=await loadJSONFromOptions(_0x4b6ff3[_0x35fbc9(0x24a)],_0x4b6ff3['attributesFile']),_0x34841d=await loadJSONFromOptions(_0x4b6ff3[_0x35fbc9(0x2d0)],_0x4b6ff3[_0x35fbc9(0x2e8)]),_0xce16c6=await loadJSONFromOptions(_0x4b6ff3[_0x35fbc9(0x256)],_0x4b6ff3[_0x35fbc9(0x255)]),_0x5f5b43={'name':_0x2b6ae0,'description':_0x4b6ff3[_0x35fbc9(0x304)],'scheduleType':_0x4b6ff3[_0x35fbc9(0x228)],'scheduleOption':_0x4b6ff3[_0x35fbc9(0x2c8)],'timezone':_0x4b6ff3[_0x35fbc9(0x233)],'master':{'parentDatabaseName':_0x4b6ff3[_0x35fbc9(0x235)],'parentTableName':_0x4b6ff3[_0x35fbc9(0x2ee)]},'attributes':_0x3b5d30,'behaviors':_0x34841d,'customerGroup':_0xce16c6},_0x30c621=await withSpinner(_0x35fbc9(0x257)+_0x2b6ae0+_0x35fbc9(0x294),()=>_0x51cf97['segment'][_0x35fbc9(0x2dd)](_0x5f5b43),{'verbose':_0x223aab['verbose']}),_0x13c8bb=_0x30c621['data'];return console[_0x35fbc9(0x2db)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x13c8bb['name']+'\x27\x20with\x20ID:\x20'+_0x13c8bb['id']),await handleSDKOutput([_0x13c8bb],_0x223aab),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x139023(0x28c)]='segment:parent:update';[a23_0x139023(0x304)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x139023(0x262)](_0x298c6f){const _0x205ea3=a23_0x139023,{options:_0x473c10,args:_0x4ba128,tdx:_0x4ef0cd}=_0x298c6f;console[_0x205ea3(0x2db)](_0x205ea3(0x25c)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x205ea3(0x272));const _0x21dec2=_0x473c10;if(_0x4ba128[_0x205ea3(0x1ef)]===0x0)return console[_0x205ea3(0x2db)](a23_0x223cba[_0x205ea3(0x2ac)](_0x205ea3(0x218))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x47de17=_0x4ba128[0x0];_0x21dec2[_0x205ea3(0x2c0)]&&(console[_0x205ea3(0x2db)](_0x205ea3(0x22b)+_0x21dec2[_0x205ea3(0x205)]),console[_0x205ea3(0x2db)](_0x205ea3(0x28f)+_0x47de17));const _0xb33fed=await withSpinner(_0x205ea3(0x231)+_0x47de17+_0x205ea3(0x294),()=>_0x4ef0cd[_0x205ea3(0x27a)]['getParentFull'](_0x47de17),{'verbose':_0x21dec2['verbose']}),_0x45ffd7=_0xb33fed[_0x205ea3(0x259)],_0x4ef70f=await loadJSONFromOptions(_0x21dec2[_0x205ea3(0x1f2)],_0x21dec2[_0x205ea3(0x1e5)]),_0x975c3f=await loadJSONFromOptions(_0x21dec2[_0x205ea3(0x264)],_0x21dec2[_0x205ea3(0x2e9)]),_0x38d590={'name':_0x45ffd7['name'],'description':_0x21dec2[_0x205ea3(0x304)]!==undefined?_0x21dec2[_0x205ea3(0x304)]:_0x45ffd7[_0x205ea3(0x304)],'scheduleType':_0x21dec2['scheduleType']!==undefined?_0x21dec2[_0x205ea3(0x228)]:_0x45ffd7[_0x205ea3(0x228)],'scheduleOption':_0x21dec2[_0x205ea3(0x2c8)]!==undefined?_0x21dec2['scheduleOption']:_0x45ffd7[_0x205ea3(0x2c8)],'timezone':_0x21dec2[_0x205ea3(0x233)]!==undefined?_0x21dec2['timezone']:_0x45ffd7['timezone'],'master':_0x45ffd7[_0x205ea3(0x2dc)],'attributes':_0x4ef70f?[..._0x45ffd7['attributes']||[],..._0x4ef70f]:_0x45ffd7['attributes'],'behaviors':_0x975c3f?[..._0x45ffd7[_0x205ea3(0x2d0)]||[],..._0x975c3f]:_0x45ffd7[_0x205ea3(0x2d0)],'customerGroup':_0x45ffd7[_0x205ea3(0x256)]},_0xd0f872=await withSpinner(_0x205ea3(0x29a)+_0x47de17+'\x27...',()=>_0x4ef0cd[_0x205ea3(0x27a)][_0x205ea3(0x24e)](_0x47de17,_0x38d590),{'verbose':_0x21dec2[_0x205ea3(0x2c0)]}),_0x3b7479=_0xd0f872['data'];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x3b7479[_0x205ea3(0x28c)]+'\x27'),await handleSDKOutput([_0x3b7479],_0x21dec2),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x305);[a23_0x139023(0x304)]=a23_0x139023(0x2b6);async[a23_0x139023(0x262)](_0x54bf6b){const _0x1ea696=a23_0x139023,{options:_0x2497df,args:_0x35ac12,tdx:_0x38a7ec}=_0x54bf6b,_0x4cb2cd=_0x2497df,_0x24fb22=_0x35ac12[0x0]||_0x2497df['parentSegment'];if(!_0x24fb22)return showParentSegmentNotSetError(_0x1ea696(0x2e2)+_0x1ea696(0x21f)),0x1;if(_0x4cb2cd[_0x1ea696(0x2f6)]&&_0x4cb2cd[_0x1ea696(0x23d)])return console['error'](a23_0x223cba['red'](_0x1ea696(0x284))),console[_0x1ea696(0x2db)](a23_0x223cba['dim'](_0x1ea696(0x270))),console[_0x1ea696(0x2db)](a23_0x223cba[_0x1ea696(0x2ba)](_0x1ea696(0x249)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a23_0x223cba[_0x1ea696(0x252)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x252f0c=_0x4cb2cd[_0x1ea696(0x23d)]||a23_0x37e68e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x24fb22)+_0x1ea696(0x2e4));_0x4cb2cd[_0x1ea696(0x2c0)]&&(console[_0x1ea696(0x2db)](_0x1ea696(0x22b)+_0x4cb2cd[_0x1ea696(0x205)]),console[_0x1ea696(0x2db)](_0x1ea696(0x28f)+_0x24fb22),console[_0x1ea696(0x2db)](_0x1ea696(0x2d3)+_0x252f0c));const _0xd2ba80=await withSpinner(_0x1ea696(0x1ec)+_0x24fb22+_0x1ea696(0x294),()=>_0x38a7ec[_0x1ea696(0x27a)][_0x1ea696(0x300)](_0x24fb22),{'verbose':_0x4cb2cd[_0x1ea696(0x2c0)]}),_0x1f946e=_0xd2ba80['data'];if(existsSync(_0x252f0c)){const _0x33879f=readFileSync(_0x252f0c,'utf-8'),_0x2d733d=generateDiff(_0x33879f,_0x1f946e);if(!hasChanges(_0x2d733d))console['error'](a23_0x223cba[_0x1ea696(0x23b)]('✔')+'\x20No\x20changes\x20-\x20'+a23_0x223cba[_0x1ea696(0x252)](_0x252f0c)+_0x1ea696(0x21b));else{console[_0x1ea696(0x2db)](_0x1ea696(0x274)+_0x252f0c+'\x27:'),console['error']('─'[_0x1ea696(0x29b)](0x3c)),console['error'](formatDiffWithColors(_0x2d733d)),console[_0x1ea696(0x2db)]('─'['repeat'](0x3c));if(!_0x4cb2cd[_0x1ea696(0x251)]){const _0x48dd87=await confirmKey('Overwrite\x20\x27'+_0x252f0c+'\x27?');if(!_0x48dd87)return console[_0x1ea696(0x2db)](_0x1ea696(0x281)),0x1;}writeFileSync(_0x252f0c,_0x1f946e,_0x1ea696(0x269)),console[_0x1ea696(0x2db)](a23_0x223cba[_0x1ea696(0x23b)]('✔')+_0x1ea696(0x2c6)+a23_0x223cba['cyan'](_0x252f0c));}}else{const _0x23287c=a23_0x37e68e[_0x1ea696(0x2b0)](_0x252f0c);!existsSync(_0x23287c)&&mkdirSync(_0x23287c,{'recursive':!![]}),writeFileSync(_0x252f0c,_0x1f946e,'utf-8'),console[_0x1ea696(0x2db)](a23_0x223cba[_0x1ea696(0x23b)]('✔')+_0x1ea696(0x2c6)+a23_0x223cba[_0x1ea696(0x252)](_0x252f0c));}return saveSessionContext({'parent_segment':_0x24fb22},_0x4cb2cd['session']),console['error'](a23_0x223cba[_0x1ea696(0x23b)]('✔')+_0x1ea696(0x1fb)+a23_0x223cba[_0x1ea696(0x2ba)](_0x1ea696(0x2ed))+'\x20=\x20'+a23_0x223cba[_0x1ea696(0x252)](_0x24fb22)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x20c);[a23_0x139023(0x304)]=a23_0x139023(0x2e6);async[a23_0x139023(0x262)](_0x215209){const _0x2b64a9=a23_0x139023,{options:_0xceed99,args:_0x1beaa6,tdx:_0x1c954a}=_0x215209,_0x2bc24f=_0xceed99,_0x4f1b11=_0x1beaa6[0x0]||_0xceed99[_0x2b64a9(0x301)];if(!_0x4f1b11)return showParentSegmentNotSetError(_0x2b64a9(0x2af)+_0x2b64a9(0x2be)),0x1;const _0x111523=resolveYamlFile(_0x4f1b11);if(!existsSync(_0x111523))return showFileNotFoundError(_0x111523,_0x4f1b11),0x1;_0x2bc24f['verbose']&&(console[_0x2b64a9(0x2db)](_0x2b64a9(0x22b)+_0x2bc24f[_0x2b64a9(0x205)]),console['error'](_0x2b64a9(0x21c)+_0x111523));let _0x30d266;try{_0x30d266=readFileSync(_0x111523,'utf-8');}catch(_0x15b545){const _0x48cd87=_0x15b545 instanceof Error?_0x15b545[_0x2b64a9(0x2a2)]:String(_0x15b545);return console[_0x2b64a9(0x2db)]('Error\x20reading\x20file:\x20'+_0x48cd87),0x1;}const _0x3234fb=await withSpinner('Analyzing\x20changes...',()=>_0x1c954a['segment'][_0x2b64a9(0x1f8)](_0x30d266),{'verbose':_0x2bc24f['verbose']}),_0x14cccc=_0x3234fb[_0x2b64a9(0x259)],{isNew:_0x3046a0,name:_0x43628d,hasChanges:_0x3117c9,diffFormatted:_0x5e449f}=_0x14cccc;if(!_0x3117c9)return console['error'](_0x2b64a9(0x22d)+_0x43628d+_0x2b64a9(0x220)),0x0;_0x3046a0?console[_0x2b64a9(0x2db)](_0x2b64a9(0x230)+_0x43628d+'\x27:'):console[_0x2b64a9(0x2db)](_0x2b64a9(0x204)+_0x43628d+'\x27:');console['error']('─'[_0x2b64a9(0x29b)](0x3c)),console['error'](_0x5e449f),console[_0x2b64a9(0x2db)]('─'['repeat'](0x3c));const _0xbcef9e=_0x3046a0?'Create\x20parent\x20segment\x20\x27'+_0x43628d+'\x27?':_0x2b64a9(0x2f0)+_0x43628d+'\x27?';if(!_0x2bc24f['yes']){const _0x20f858=await confirmKey(_0xbcef9e);if(!_0x20f858)return console['error'](_0x2b64a9(0x281)),0x1;}const _0x62a6ce=_0x3046a0?_0x2b64a9(0x2cf):_0x2b64a9(0x1ee),_0x5819fa=await withSpinner(_0x62a6ce+_0x2b64a9(0x299)+_0x43628d+_0x2b64a9(0x294),()=>_0x14cccc[_0x2b64a9(0x291)](),{'verbose':_0x2bc24f[_0x2b64a9(0x2c0)]}),_0x339aaf=_0x5819fa[_0x2b64a9(0x259)],_0x424370=getConsoleNextUrl(_0x2bc24f[_0x2b64a9(0x205)],_0x2b64a9(0x23c)+_0x339aaf['id']),_0x1eb5a7=_0x3046a0?_0x2b64a9(0x2c3):_0x2b64a9(0x247);return console[_0x2b64a9(0x2db)]('✔\x20'+_0x1eb5a7+_0x2b64a9(0x299)+_0x339aaf[_0x2b64a9(0x28c)]+'\x27'),console[_0x2b64a9(0x2db)]('\x20\x20'+_0x424370),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x139023(0x2d9);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a23_0x139023(0x262)](_0x44f1f3){const _0x6e1739=a23_0x139023,{options:_0x559877,args:_0x3479d6,tdx:_0x1e2869}=_0x44f1f3,_0x5197d6=_0x559877,_0x2253e9=_0x3479d6[0x0]||_0x559877[_0x6e1739(0x301)];if(!_0x2253e9)return showParentSegmentNotSetError(_0x6e1739(0x213)+'\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'+_0x6e1739(0x248)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x3c8477=resolveYamlFile(_0x2253e9);if(!existsSync(_0x3c8477))return showFileNotFoundError(_0x3c8477,_0x2253e9),0x1;_0x5197d6[_0x6e1739(0x2c0)]&&(console[_0x6e1739(0x2db)](_0x6e1739(0x22b)+_0x5197d6[_0x6e1739(0x205)]),console[_0x6e1739(0x2db)]('YAML\x20file:\x20'+_0x3c8477));let _0x5d61b5;try{_0x5d61b5=readFileSync(_0x3c8477,_0x6e1739(0x269));}catch(_0x28ded2){const _0x1fc92a=_0x28ded2 instanceof Error?_0x28ded2[_0x6e1739(0x2a2)]:String(_0x28ded2);return console[_0x6e1739(0x2db)]('Error\x20reading\x20file:\x20'+_0x1fc92a),0x1;}const _0x4266e7=createCommandSpinner(a23_0x223cba['dim']('Validating\x20configuration...'),{'verbose':_0x5197d6[_0x6e1739(0x2c0)]});_0x4266e7[_0x6e1739(0x308)]();const _0x44576a={'onProgress':_0x5dc6d6=>{_0x4266e7['text']=formatProgressMessage(_0x5dc6d6);}};if(_0x5197d6[_0x6e1739(0x2dc)])_0x44576a[_0x6e1739(0x2dc)]=!![];if(_0x5197d6['enriched'])_0x44576a['enriched']=!![];_0x5197d6[_0x6e1739(0x29c)]&&(_0x44576a[_0x6e1739(0x29c)]=_0x5197d6[_0x6e1739(0x29c)]);_0x5197d6[_0x6e1739(0x2a8)]&&(_0x44576a[_0x6e1739(0x2a8)]=_0x5197d6['behavior']);if(_0x5197d6[_0x6e1739(0x2de)])_0x44576a[_0x6e1739(0x2de)]=_0x5197d6[_0x6e1739(0x2de)];let _0x15db8e;try{_0x15db8e=await _0x1e2869['segment'][_0x6e1739(0x290)](_0x5d61b5,_0x44576a),_0x4266e7[_0x6e1739(0x212)]();}catch(_0x4f1908){_0x4266e7[_0x6e1739(0x212)]();throw _0x4f1908;}const _0x2ed9c4=_0x5197d6[_0x6e1739(0x2de)]||_0x6e1739(0x1ff);return this[_0x6e1739(0x2ea)](_0x15db8e,_0x44576a,_0x3c8477,_0x2ed9c4),_0x15db8e[_0x6e1739(0x2ad)]?0x0:0x1;}[a23_0x139023(0x2ea)](_0xff90cb,_0x13f8d2,_0x102dda,_0x33820a){const _0x50b51a=a23_0x139023;console['error']('\x0a'+a23_0x223cba[_0x50b51a(0x282)](_0x50b51a(0x200))+'\x20'+_0xff90cb[_0x50b51a(0x28c)]),console[_0x50b51a(0x2db)]('═'['repeat'](0x3c)),this[_0x50b51a(0x214)](_0xff90cb);if(typeof _0x13f8d2['attribute']===_0x50b51a(0x27d)){this['displayAttributesStats'](_0xff90cb),this['displaySummary'](_0xff90cb),this['displayPreviewHints'](_0x102dda,_0x33820a,_0x50b51a(0x29c),_0x13f8d2[_0x50b51a(0x29c)]);return;}if(_0x13f8d2[_0x50b51a(0x29c)]===!![]){this[_0x50b51a(0x1f9)](_0xff90cb),this[_0x50b51a(0x246)](_0xff90cb),this['displayPreviewHints'](_0x102dda,_0x33820a,'attributes');return;}if(typeof _0x13f8d2[_0x50b51a(0x2a8)]==='string'){this[_0x50b51a(0x302)](_0xff90cb,_0x33820a),this['displaySummary'](_0xff90cb),this['displayPreviewHints'](_0x102dda,_0x33820a,_0x50b51a(0x2a8),_0x13f8d2[_0x50b51a(0x2a8)]);return;}if(_0x13f8d2[_0x50b51a(0x2a8)]===!![]){this[_0x50b51a(0x302)](_0xff90cb,_0x33820a),this['displaySummary'](_0xff90cb),this[_0x50b51a(0x2e3)](_0x102dda,_0x33820a,_0x50b51a(0x2d0));return;}this[_0x50b51a(0x1f9)](_0xff90cb),this[_0x50b51a(0x302)](_0xff90cb,_0x33820a),this[_0x50b51a(0x246)](_0xff90cb),this[_0x50b51a(0x2e3)](_0x102dda,_0x33820a,_0x50b51a(0x2bf));}[a23_0x139023(0x2e3)](_0x36bafb,_0x88d6d5,_0x284c78,_0x441045){const _0x26eda4=a23_0x139023;console[_0x26eda4(0x2db)]('\x0a'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x2aa)));const _0x1b6541=_0x88d6d5!==_0x26eda4(0x1ff)?_0x26eda4(0x238)+_0x88d6d5:'';if(_0x284c78===_0x26eda4(0x29c)&&_0x441045)console[_0x26eda4(0x2db)]('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x20a)+_0x36bafb+'\x20--attribute\x20\x22'+_0x441045+'\x22'+_0x1b6541));else{if(_0x284c78===_0x26eda4(0x2a8)&&_0x441045)console[_0x26eda4(0x2db)]('\x20\x20'+a23_0x223cba['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x36bafb+_0x26eda4(0x2a6)+_0x441045+'\x22'+_0x1b6541));else(_0x284c78==='attributes'||_0x284c78===_0x26eda4(0x2bf))&&console['error']('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x20a)+_0x36bafb+_0x26eda4(0x26b)+_0x1b6541));}(_0x284c78===_0x26eda4(0x2d0)||_0x284c78===_0x26eda4(0x2bf))&&console['error']('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x20a)+_0x36bafb+_0x26eda4(0x29f)+_0x1b6541)),_0x284c78===_0x26eda4(0x2bf)&&console[_0x26eda4(0x2db)]('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)]('tdx\x20segment\x20parent\x20preview\x20'+_0x36bafb+_0x26eda4(0x27c)+_0x1b6541));}[a23_0x139023(0x214)](_0x58e18a){const _0x4139ec=a23_0x139023,{master:_0x5cfae3}=_0x58e18a,_0x481332=_0x5cfae3['schemaValid']?a23_0x223cba[_0x4139ec(0x23b)]('✔'):a23_0x223cba['red']('✘');console[_0x4139ec(0x2db)]('\x0a'+a23_0x223cba[_0x4139ec(0x2ba)](_0x4139ec(0x2bb))),console['error'](_0x481332+'\x20'+a23_0x223cba[_0x4139ec(0x282)](_0x5cfae3[_0x4139ec(0x235)]+'.'+_0x5cfae3[_0x4139ec(0x2ee)])),_0x5cfae3[_0x4139ec(0x2f2)]?_0x5cfae3[_0x4139ec(0x293)]!==undefined&&console['error']('\x20\x20'+a23_0x223cba[_0x4139ec(0x2ba)](_0x4139ec(0x275))+'\x20'+a23_0x223cba[_0x4139ec(0x252)](formatRows(_0x5cfae3['rowCount']))):console[_0x4139ec(0x2db)]('\x20\x20'+a23_0x223cba[_0x4139ec(0x2ac)]('Error:')+'\x20'+_0x5cfae3['schemaError']);}['displayAttributesStats'](_0x3f2675){const _0x28674a=a23_0x139023;if(_0x3f2675[_0x28674a(0x24a)][_0x28674a(0x1ef)]===0x0)return;console[_0x28674a(0x2db)]('\x0a'+a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x22a)));for(const _0xeee223 of _0x3f2675[_0x28674a(0x24a)]){const _0x2fd933=_0xeee223[_0x28674a(0x2f2)]?a23_0x223cba[_0x28674a(0x23b)]('✔'):a23_0x223cba[_0x28674a(0x2ac)]('✘');let _0x5ccd0c='';if(_0xeee223[_0x28674a(0x2f2)]&&_0xeee223[_0x28674a(0x1f0)]!==undefined&&_0xeee223[_0x28674a(0x2b8)]!==undefined){const _0x4bfd90=_0xeee223[_0x28674a(0x2b8)][_0x28674a(0x2a1)](0x1),_0x4225e5=_0xeee223[_0x28674a(0x2b8)]>=0x50?a23_0x223cba[_0x28674a(0x23b)]:_0xeee223[_0x28674a(0x2b8)]>=0x32?a23_0x223cba['yellow']:a23_0x223cba[_0x28674a(0x2ac)];_0x5ccd0c='\x20'+a23_0x223cba[_0x28674a(0x2ba)]('Coverage:')+'\x20'+_0x4225e5(_0x4bfd90+'%')+'\x20('+formatRows(_0xeee223[_0x28674a(0x1f0)])+_0x28674a(0x2f7);}console[_0x28674a(0x2db)](_0x2fd933+'\x20'+a23_0x223cba['bold'](_0xeee223[_0x28674a(0x28c)])+_0x5ccd0c),console['error']('\x20\x20'+a23_0x223cba[_0x28674a(0x2ba)]('Source:')+'\x20'+a23_0x223cba[_0x28674a(0x282)](_0xeee223[_0x28674a(0x235)]+'.'+_0xeee223['table']));const _0x6dd073=_0xeee223[_0x28674a(0x2f1)]===_0xeee223[_0x28674a(0x253)]?a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x283))+'\x20'+_0xeee223[_0x28674a(0x2f1)]:a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x26a))+'\x20'+_0xeee223[_0x28674a(0x2f1)]+_0x28674a(0x2e7)+_0xeee223[_0x28674a(0x253)];console['error']('\x20\x20'+_0x6dd073),console[_0x28674a(0x2db)]('\x20\x20'+a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x24f))),this[_0x28674a(0x1e7)](_0xeee223['columns']),!_0xeee223[_0x28674a(0x2f2)]&&console[_0x28674a(0x2db)]('\x20\x20'+a23_0x223cba[_0x28674a(0x2ac)]('Error:')+'\x20'+_0xeee223[_0x28674a(0x268)]);}}[a23_0x139023(0x302)](_0x32e609,_0x37bbf1){const _0x281cb6=a23_0x139023;if(_0x32e609[_0x281cb6(0x2d0)][_0x281cb6(0x1ef)]===0x0)return;console[_0x281cb6(0x2db)]('\x0a'+a23_0x223cba[_0x281cb6(0x2ba)](_0x281cb6(0x26d))+'\x20'+a23_0x223cba[_0x281cb6(0x2ba)]('('+_0x37bbf1+')'));for(const _0x2f72eb of _0x32e609[_0x281cb6(0x2d0)]){const _0x182829=_0x2f72eb[_0x281cb6(0x2f2)]?a23_0x223cba[_0x281cb6(0x23b)]('✔'):a23_0x223cba[_0x281cb6(0x2ac)]('✘');let _0x108a43='';if(_0x2f72eb[_0x281cb6(0x2f2)]&&_0x2f72eb['customersWithEvents']!==undefined&&_0x2f72eb[_0x281cb6(0x1e4)]!==undefined){const _0x247fd8=_0x2f72eb[_0x281cb6(0x2b3)]?.['toFixed'](0x1)||'?',_0x4b34cd=(_0x2f72eb[_0x281cb6(0x2b3)]??0x0)>=0x32?a23_0x223cba[_0x281cb6(0x23b)]:(_0x2f72eb[_0x281cb6(0x2b3)]??0x0)>=0x14?a23_0x223cba['yellow']:a23_0x223cba[_0x281cb6(0x2ac)];_0x108a43='\x20'+a23_0x223cba['dim'](_0x281cb6(0x20b))+'\x20'+_0x4b34cd(formatRows(_0x2f72eb[_0x281cb6(0x2bd)]))+'\x20('+_0x247fd8+_0x281cb6(0x258)+a23_0x223cba['dim'](_0x281cb6(0x2ab))+'\x20'+a23_0x223cba[_0x281cb6(0x252)](formatRows(_0x2f72eb[_0x281cb6(0x1e4)]));}console[_0x281cb6(0x2db)](_0x182829+'\x20'+a23_0x223cba[_0x281cb6(0x282)](_0x2f72eb[_0x281cb6(0x28c)])+_0x108a43),console[_0x281cb6(0x2db)]('\x20\x20'+a23_0x223cba[_0x281cb6(0x2ba)](_0x281cb6(0x239))+'\x20'+a23_0x223cba[_0x281cb6(0x282)](_0x2f72eb[_0x281cb6(0x235)]+'.'+_0x2f72eb['table']));const _0x511833=_0x2f72eb[_0x281cb6(0x2f1)]===_0x2f72eb[_0x281cb6(0x253)]?a23_0x223cba['dim'](_0x281cb6(0x283))+'\x20'+_0x2f72eb['joinKey']:a23_0x223cba[_0x281cb6(0x2ba)]('Join:')+'\x20'+_0x2f72eb[_0x281cb6(0x2f1)]+_0x281cb6(0x2e7)+_0x2f72eb[_0x281cb6(0x253)];console[_0x281cb6(0x2db)]('\x20\x20'+_0x511833),console[_0x281cb6(0x2db)]('\x20\x20'+a23_0x223cba[_0x281cb6(0x2ba)](_0x281cb6(0x24f))),this[_0x281cb6(0x1e7)](_0x2f72eb[_0x281cb6(0x2cc)]),!_0x2f72eb['schemaValid']&&console[_0x281cb6(0x2db)]('\x20\x20'+a23_0x223cba[_0x281cb6(0x2ac)]('Error:')+'\x20'+_0x2f72eb[_0x281cb6(0x268)]);}}[a23_0x139023(0x1e7)](_0x187186){const _0x5b95e0=a23_0x139023;for(const _0x5424f8 of _0x187186){_0x5424f8[_0x5b95e0(0x206)]===_0x5424f8[_0x5b95e0(0x2b9)]||_0x5424f8[_0x5b95e0(0x2b9)]==='*'?console[_0x5b95e0(0x2db)](_0x5b95e0(0x27e)+_0x5424f8[_0x5b95e0(0x206)]):console[_0x5b95e0(0x2db)]('\x20\x20\x20\x20-\x20'+_0x5424f8['label']+'\x20'+a23_0x223cba[_0x5b95e0(0x2ba)]('('+_0x5424f8[_0x5b95e0(0x2b9)]+')'));}}[a23_0x139023(0x246)](_0x1c3d96){const _0x54f9e3=a23_0x139023;console[_0x54f9e3(0x2db)]('─'[_0x54f9e3(0x29b)](0x3c));if(_0x1c3d96[_0x54f9e3(0x1fe)][_0x54f9e3(0x1ef)]>0x0){console[_0x54f9e3(0x2db)]('\x0a'+a23_0x223cba['red']('Errors:'));for(const _0x13c2c3 of _0x1c3d96[_0x54f9e3(0x1fe)]){console[_0x54f9e3(0x2db)]('\x20\x20'+a23_0x223cba[_0x54f9e3(0x2ac)]('•')+'\x20'+_0x13c2c3);}}_0x1c3d96[_0x54f9e3(0x2ad)]&&console['error']('\x0a'+a23_0x223cba[_0x54f9e3(0x23b)]('✔')+_0x54f9e3(0x28e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x139023(0x28c)]='segment:parent:preview';[a23_0x139023(0x304)]=a23_0x139023(0x217);async[a23_0x139023(0x262)](_0x3c4758){const _0x21a33a=a23_0x139023,{options:_0x40d09e,args:_0x10abff,tdx:_0x5e6b40}=_0x3c4758,_0xcc32e5=_0x40d09e,_0x28ec63=_0x10abff[0x0]||_0x40d09e['parentSegment'];if(!_0x28ec63)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'+_0x21a33a(0x2da)+_0x21a33a(0x202)+_0x21a33a(0x306)+_0x21a33a(0x2b4)+_0x21a33a(0x261)+_0x21a33a(0x2a3)+_0x21a33a(0x271)),0x1;if(!_0xcc32e5['master']&&!_0xcc32e5[_0x21a33a(0x29c)]&&!_0xcc32e5[_0x21a33a(0x2a8)]&&!_0xcc32e5[_0x21a33a(0x2d5)])return console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x298))),console[_0x21a33a(0x2db)](_0x21a33a(0x234)),console['error'](_0x21a33a(0x2df)),console[_0x21a33a(0x2db)](_0x21a33a(0x26c)),console['error'](_0x21a33a(0x219)),console[_0x21a33a(0x2db)](_0x21a33a(0x2fd)),console[_0x21a33a(0x2db)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3f3d09=resolveYamlFile(_0x28ec63);if(!existsSync(_0x3f3d09))return showFileNotFoundError(_0x3f3d09,_0x28ec63),0x1;_0xcc32e5[_0x21a33a(0x2c0)]&&(console[_0x21a33a(0x2db)](_0x21a33a(0x22b)+_0xcc32e5[_0x21a33a(0x205)]),console[_0x21a33a(0x2db)]('YAML\x20file:\x20'+_0x3f3d09));let _0xc9c7d7;try{_0xc9c7d7=readFileSync(_0x3f3d09,_0x21a33a(0x269));}catch(_0x1a9bdc){const _0x46ab8d=_0x1a9bdc instanceof Error?_0x1a9bdc[_0x21a33a(0x2a2)]:String(_0x1a9bdc);return console['error'](_0x21a33a(0x20e)+_0x46ab8d),0x1;}let _0x515f96;try{_0x515f96=parseDef(_0xc9c7d7);}catch(_0x1d83c7){const _0x40f3e8=_0x1d83c7 instanceof Error?_0x1d83c7[_0x21a33a(0x2a2)]:String(_0x1d83c7);return console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x243)+_0x40f3e8)),0x1;}if(_0xcc32e5[_0x21a33a(0x29c)]===!![]||_0xcc32e5[_0x21a33a(0x29c)]===''){const _0xd9d1ad=_0x515f96['attributes']?.[_0x21a33a(0x23a)](_0x43f8f9=>_0x43f8f9[_0x21a33a(0x28c)])||[];if(_0xd9d1ad['length']===0x0)console['error'](a23_0x223cba[_0x21a33a(0x2ac)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x297))),console[_0x21a33a(0x2db)]('Available\x20attributes:');for(const _0x4abf4c of _0xd9d1ad){console[_0x21a33a(0x2db)]('\x20\x20'+a23_0x223cba['cyan'](_0x4abf4c));}console['error'](_0x21a33a(0x237)+_0x28ec63+_0x21a33a(0x22c)+_0xd9d1ad[0x0]+'\x22');}return 0x1;}if(_0xcc32e5[_0x21a33a(0x2a8)]===!![]||_0xcc32e5['behavior']===''){const _0x1dd57b=_0x515f96[_0x21a33a(0x2d0)]?.[_0x21a33a(0x23a)](_0x1cc1f0=>_0x1cc1f0[_0x21a33a(0x28c)])||[];if(_0x1dd57b[_0x21a33a(0x1ef)]===0x0)console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x309)));else{console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x265))),console[_0x21a33a(0x2db)](_0x21a33a(0x1f6));for(const _0x3588f5 of _0x1dd57b){console[_0x21a33a(0x2db)]('\x20\x20'+a23_0x223cba['cyan'](_0x3588f5));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x28ec63+_0x21a33a(0x2a6)+_0x1dd57b[0x0]+'\x22');}return 0x1;}const _0x43e96b=createCommandSpinner(a23_0x223cba[_0x21a33a(0x2ba)](_0x21a33a(0x277)),{'verbose':_0xcc32e5[_0x21a33a(0x2c0)]});_0x43e96b[_0x21a33a(0x308)]();const _0x9a1b84={'onProgress':_0x4b3fcb=>{const _0x47381b=_0x21a33a;_0x43e96b[_0x47381b(0x2d8)]=formatProgressMessage(_0x4b3fcb);}};if(_0xcc32e5[_0x21a33a(0x2dc)])_0x9a1b84['master']=!![];if(_0xcc32e5['attribute']&&typeof _0xcc32e5[_0x21a33a(0x29c)]===_0x21a33a(0x27d))_0x9a1b84[_0x21a33a(0x29c)]=_0xcc32e5[_0x21a33a(0x29c)];if(_0xcc32e5[_0x21a33a(0x2a8)]&&typeof _0xcc32e5[_0x21a33a(0x2a8)]===_0x21a33a(0x27d))_0x9a1b84[_0x21a33a(0x2a8)]=_0xcc32e5[_0x21a33a(0x2a8)];if(_0xcc32e5[_0x21a33a(0x2d5)])_0x9a1b84[_0x21a33a(0x2d5)]=!![];if(_0xcc32e5['interval'])_0x9a1b84[_0x21a33a(0x2de)]=_0xcc32e5['interval'];let _0x70f5c8;try{_0x70f5c8=await _0x5e6b40[_0x21a33a(0x27a)][_0x21a33a(0x2ff)](_0xc9c7d7,_0x9a1b84),_0x43e96b[_0x21a33a(0x212)]();}catch(_0x1be3de){_0x43e96b['stop']();throw _0x1be3de;}return await this[_0x21a33a(0x27f)](_0x70f5c8,{'master':_0xcc32e5[_0x21a33a(0x2dc)],'attribute':typeof _0xcc32e5[_0x21a33a(0x29c)]===_0x21a33a(0x27d)?_0xcc32e5[_0x21a33a(0x29c)]:undefined,'behavior':typeof _0xcc32e5[_0x21a33a(0x2a8)]===_0x21a33a(0x27d)?_0xcc32e5[_0x21a33a(0x2a8)]:undefined,'enriched':_0xcc32e5['enriched']}),_0x70f5c8[_0x21a33a(0x2ad)]?0x0:0x1;}async[a23_0x139023(0x27f)](_0x2bf62d,_0x8e79a1){const _0x2b86dd=a23_0x139023;console[_0x2b86dd(0x2db)]('\x0a'+a23_0x223cba['bold']('Preview:')+'\x20'+_0x2bf62d[_0x2b86dd(0x28c)]),console[_0x2b86dd(0x2db)]('═'[_0x2b86dd(0x29b)](0x3c));if(_0x8e79a1['master']&&_0x2bf62d[_0x2b86dd(0x28d)]){const _0x35a6cb=a23_0x223cba[_0x2b86dd(0x2ba)]('Master:')+'\x20'+a23_0x223cba['bold'](_0x2bf62d[_0x2b86dd(0x2dc)][_0x2b86dd(0x235)]+'.'+_0x2bf62d[_0x2b86dd(0x2dc)][_0x2b86dd(0x2ee)]);await this[_0x2b86dd(0x2fe)](_0x35a6cb,_0x2bf62d[_0x2b86dd(0x28d)]);}else{if(_0x8e79a1[_0x2b86dd(0x29c)]&&_0x2bf62d[_0x2b86dd(0x28d)]){const _0xb36c39=a23_0x223cba[_0x2b86dd(0x2ba)](_0x2b86dd(0x2c5))+'\x20'+a23_0x223cba[_0x2b86dd(0x282)](_0x8e79a1[_0x2b86dd(0x29c)]);await this['displaySampleData'](_0xb36c39,_0x2bf62d[_0x2b86dd(0x28d)]);}else{if(_0x8e79a1['behavior']&&_0x2bf62d[_0x2b86dd(0x28d)]){const _0x5616cf=a23_0x223cba[_0x2b86dd(0x2ba)](_0x2b86dd(0x286))+'\x20'+a23_0x223cba['bold'](_0x8e79a1['behavior']);await this[_0x2b86dd(0x2fe)](_0x5616cf,_0x2bf62d[_0x2b86dd(0x28d)]);}else{if(_0x8e79a1[_0x2b86dd(0x2d5)]&&_0x2bf62d['sampleData']){const _0x59c11e=a23_0x223cba[_0x2b86dd(0x2ba)]('Enriched:')+'\x20'+a23_0x223cba[_0x2b86dd(0x282)](_0x2b86dd(0x24c));await this[_0x2b86dd(0x2fe)](_0x59c11e,_0x2bf62d[_0x2b86dd(0x28d)]);}else!_0x2bf62d[_0x2b86dd(0x28d)]&&console[_0x2b86dd(0x2db)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x2bf62d[_0x2b86dd(0x1fe)][_0x2b86dd(0x1ef)]>0x0){console[_0x2b86dd(0x2db)]('─'[_0x2b86dd(0x29b)](0x3c)),console[_0x2b86dd(0x2db)]('\x0a'+a23_0x223cba['red'](_0x2b86dd(0x2f5)));for(const _0xd499d3 of _0x2bf62d[_0x2b86dd(0x1fe)]){console[_0x2b86dd(0x2db)]('\x20\x20'+a23_0x223cba[_0x2b86dd(0x2ac)]('•')+'\x20'+_0xd499d3);}}}async[a23_0x139023(0x2fe)](_0xd61247,_0x37b901){const _0x34f003=a23_0x139023;if(_0x37b901[_0x34f003(0x1ef)]===0x0){console[_0x34f003(0x2db)]('\x0a'+_0xd61247),console[_0x34f003(0x2db)](_0x34f003(0x1e8));return;}console[_0x34f003(0x2db)]('\x0a'+_0xd61247);const _0x41e913=Object['keys'](_0x37b901[0x0])[_0x34f003(0x23a)](_0x9c7584=>({'name':_0x9c7584,'type':typeof _0x37b901[0x0][_0x9c7584]===_0x34f003(0x241)?_0x34f003(0x26e):_0x34f003(0x21e)})),_0xb2931={'queryId':'preview','columns':_0x41e913,'data':_0x37b901,'stats':{'state':_0x34f003(0x223),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x37b901[_0x34f003(0x1ef)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1f0e5b=formatAsTable(_0xb2931,_0x37b901[_0x34f003(0x1ef)],!![]);await writeOutput(_0x1f0e5b,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a23_0x139023(0x23e);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a23_0x139023(0x262)](_0x561ea2){const _0x455ad5=a23_0x139023,{options:_0x123127,args:_0x576852,tdx:_0x26e95b}=_0x561ea2,_0x509df9=_0x123127,_0x4aa76a=_0x576852[0x0]||_0x123127['parentSegment'];if(!_0x4aa76a)return showParentSegmentNotSetError(_0x455ad5(0x303)+_0x455ad5(0x2f3)),0x1;const _0x3c29b4=resolveYamlFile(_0x4aa76a);if(existsSync(_0x3c29b4)){_0x509df9[_0x455ad5(0x2c0)]&&console[_0x455ad5(0x2db)](_0x455ad5(0x295)+_0x3c29b4);let _0x510ee4;try{_0x510ee4=readFileSync(_0x3c29b4,_0x455ad5(0x269));}catch(_0x2581bc){const _0x15d533=_0x2581bc instanceof Error?_0x2581bc['message']:String(_0x2581bc);return console[_0x455ad5(0x2db)]('Error\x20reading\x20file:\x20'+_0x15d533),0x1;}const _0x244313=await withSpinner(_0x455ad5(0x23f),()=>_0x26e95b[_0x455ad5(0x27a)][_0x455ad5(0x1f8)](_0x510ee4),{'verbose':_0x509df9[_0x455ad5(0x2c0)]}),_0x5dc556=_0x244313[_0x455ad5(0x259)],{isNew:_0x4eaa65,name:_0x5e1306,hasChanges:_0x3f3eb5,diffFormatted:_0x43768c}=_0x5dc556;if(_0x3f3eb5){_0x4eaa65?console[_0x455ad5(0x2db)](_0x455ad5(0x230)+_0x5e1306+'\x27:'):console[_0x455ad5(0x2db)](_0x455ad5(0x204)+_0x5e1306+'\x27:');console[_0x455ad5(0x2db)]('─'['repeat'](0x3c)),console['error'](_0x43768c),console['error']('─'['repeat'](0x3c));const _0x34365a=_0x4eaa65?_0x455ad5(0x2ca)+_0x5e1306+_0x455ad5(0x1fc):'Apply\x20changes\x20to\x20\x27'+_0x5e1306+'\x27\x20and\x20run\x20workflow?';if(!_0x509df9['yes']){const _0xa5a0ec=await confirmKey(_0x34365a);if(!_0xa5a0ec)return console[_0x455ad5(0x2db)]('Aborted.'),0x1;}const _0x491ea4=_0x4eaa65?_0x455ad5(0x2cf):_0x455ad5(0x1ee);await withSpinner(_0x491ea4+_0x455ad5(0x299)+_0x5e1306+'\x27...',()=>_0x5dc556[_0x455ad5(0x291)](),{'verbose':_0x509df9[_0x455ad5(0x2c0)]});const _0x58ae5e=_0x4eaa65?_0x455ad5(0x2c3):_0x455ad5(0x247);console[_0x455ad5(0x2db)]('✔\x20'+_0x58ae5e+'\x20parent\x20segment\x20\x27'+_0x5e1306+'\x27');}else console['error'](_0x455ad5(0x22d)+_0x5e1306+'\x27\x20is\x20up\x20to\x20date');}const _0x5e1726=await withSpinner(_0x455ad5(0x2f8)+_0x4aa76a+'\x27...',()=>_0x26e95b[_0x455ad5(0x27a)][_0x455ad5(0x201)](_0x4aa76a),{'verbose':_0x509df9[_0x455ad5(0x2c0)]}),_0x311ba1=_0x5e1726[_0x455ad5(0x259)],_0x427c66=getConsoleUrl(_0x509df9[_0x455ad5(0x205)],'/app/workflows/'+_0x311ba1[_0x455ad5(0x2ce)]+'/sessions/'+_0x311ba1[_0x455ad5(0x215)]+_0x455ad5(0x273)+_0x311ba1[_0x455ad5(0x1ed)]);return console[_0x455ad5(0x2db)](_0x455ad5(0x2ec)),console[_0x455ad5(0x2db)]('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2ae))+'\x20'+_0x311ba1[_0x455ad5(0x1e6)]),console[_0x455ad5(0x2db)]('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2d2))+'\x20'+_0x311ba1[_0x455ad5(0x2b5)]),console[_0x455ad5(0x2db)]('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2b2))+'\x20'+_0x311ba1[_0x455ad5(0x215)]),console['error']('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)]('Attempt:')+'\x20'+_0x311ba1[_0x455ad5(0x1ed)]),console[_0x455ad5(0x2db)]('\x20\x20'+_0x427c66),console['error']('\x0a'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2a4))+_0x455ad5(0x236)+_0x311ba1[_0x455ad5(0x1ed)]+_0x455ad5(0x263)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x266);['description']=a23_0x139023(0x292);async[a23_0x139023(0x262)](_0x3749a8){const _0x2ad144=a23_0x139023,{options:_0x3a0463,args:_0x17108c,tdx:_0xb7be93}=_0x3749a8,_0x3a8a59=_0x17108c[0x0]||_0x3a0463['parentSegment'];if(!_0x3a8a59)return showParentSegmentNotSetError(_0x2ad144(0x289)+_0x2ad144(0x224)),0x1;_0x3a0463[_0x2ad144(0x2c0)]&&(console[_0x2ad144(0x2db)](_0x2ad144(0x22b)+_0x3a0463[_0x2ad144(0x205)]),console[_0x2ad144(0x2db)](_0x2ad144(0x28f)+_0x3a8a59));const _0x398558=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3a8a59+_0x2ad144(0x294),()=>_0xb7be93[_0x2ad144(0x27a)]['listFields'](_0x3a8a59),{'verbose':_0x3a0463[_0x2ad144(0x2c0)]}),_0x4cfba3=_0x398558[_0x2ad144(0x259)];console['error'](_0x2ad144(0x2bc)+_0x4cfba3[_0x2ad144(0x1ef)]+'\x20field'+(_0x4cfba3[_0x2ad144(0x1ef)]!==0x1?'s':''));if(_0x3a0463[_0x2ad144(0x24b)]||_0x3a0463[_0x2ad144(0x222)])return await handleSDKOutput(_0x4cfba3,_0x3a0463),0x0;return displayFieldsHumanReadable(_0x4cfba3,_0x3a8a59),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a23_0x139023(0x2eb);[a23_0x139023(0x304)]=a23_0x139023(0x1df);async[a23_0x139023(0x262)](_0xe262d4){const _0x43c19d=a23_0x139023,{options:_0x59e35e,args:_0x9c3c2e,tdx:_0x45fcd6}=_0xe262d4,_0x559620=_0x59e35e,_0x114c4b=_0x9c3c2e[0x0]||_0x59e35e['parentSegment'];if(!_0x114c4b)return showParentSegmentNotSetError(_0x43c19d(0x20d)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x43c19d(0x296)+_0x43c19d(0x1e9)),0x1;_0x59e35e['verbose']&&(console[_0x43c19d(0x2db)](_0x43c19d(0x22b)+_0x59e35e[_0x43c19d(0x205)]),console['error'](_0x43c19d(0x28f)+_0x114c4b));const _0x5d3dbc=await withSpinner(_0x43c19d(0x1ec)+_0x114c4b+_0x43c19d(0x294),()=>_0x45fcd6[_0x43c19d(0x27a)][_0x43c19d(0x207)](_0x114c4b),{'verbose':_0x59e35e[_0x43c19d(0x2c0)]}),_0x4e2f9e=_0x5d3dbc[_0x43c19d(0x259)];if(_0x559620[_0x43c19d(0x287)]){const _0x1c76fd=getConsoleNextUrl(_0x559620['site'],'/app/dw/parentSegments/'+_0x4e2f9e['id']);return console['error'](a23_0x223cba[_0x43c19d(0x23b)]('✔')+_0x43c19d(0x260)+a23_0x223cba[_0x43c19d(0x252)](_0x1c76fd)),openBrowser(_0x1c76fd),0x0;}return await handleSingleObjectOutput(_0x4e2f9e,_0x59e35e),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x244);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x5e974d){const _0x1e96ea=a23_0x139023,{options:_0x30e4f1,args:_0x8bb19d,tdx:_0x7cd522}=_0x5e974d,_0x298e5b=_0x8bb19d[0x0]||_0x30e4f1[_0x1e96ea(0x301)];if(!_0x298e5b)return showParentSegmentNotSetError(_0x1e96ea(0x2d6)+_0x1e96ea(0x21d)),0x1;_0x30e4f1[_0x1e96ea(0x2c0)]&&(console[_0x1e96ea(0x2db)](_0x1e96ea(0x22b)+_0x30e4f1[_0x1e96ea(0x205)]),console['error'](_0x1e96ea(0x28f)+_0x298e5b));const _0x42fb5b=await withSpinner(_0x1e96ea(0x1ea)+_0x298e5b+_0x1e96ea(0x294),()=>_0x7cd522['segment'][_0x1e96ea(0x225)](_0x298e5b),{'verbose':_0x30e4f1[_0x1e96ea(0x2c0)]}),_0x5e4b58=_0x42fb5b['data'],_0x447759=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x298e5b+_0x1e96ea(0x294),()=>_0x7cd522['segment'][_0x1e96ea(0x2a0)](_0x5e4b58),{'verbose':_0x30e4f1[_0x1e96ea(0x2c0)]}),_0x382e4d=await executeSchemaQuery(_0x447759['data'],_0x7cd522,_0x30e4f1);return await handleQueryOutput(_0x382e4d,_0x30e4f1),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a23_0x139023(0x22e);[a23_0x139023(0x304)]=a23_0x139023(0x1fa);async[a23_0x139023(0x262)](_0x5e80d7){const _0x21b5cf=a23_0x139023,{options:_0x250dcf,args:_0x447c21,tdx:_0x388f5f}=_0x5e80d7,_0x217311=_0x447c21[0x0]||_0x250dcf[_0x21b5cf(0x301)];if(!_0x217311)return showParentSegmentNotSetError(_0x21b5cf(0x285)+_0x21b5cf(0x2c9)),0x1;_0x250dcf['verbose']&&(console[_0x21b5cf(0x2db)]('Site:\x20'+_0x250dcf[_0x21b5cf(0x205)]),console[_0x21b5cf(0x2db)](_0x21b5cf(0x28f)+_0x217311));const _0x39fe74=await withSpinner(_0x21b5cf(0x1ea)+_0x217311+_0x21b5cf(0x294),()=>_0x388f5f[_0x21b5cf(0x27a)]['resolveParentId'](_0x217311),{'verbose':_0x250dcf['verbose']}),_0x3f36d1=_0x39fe74[_0x21b5cf(0x259)],_0x5a06a8=await withSpinner(_0x21b5cf(0x2ef)+_0x217311+'\x27...',()=>_0x388f5f[_0x21b5cf(0x27a)][_0x21b5cf(0x2a0)](_0x3f36d1),{'verbose':_0x250dcf[_0x21b5cf(0x2c0)]}),_0x2ef1a3=_0x5a06a8[_0x21b5cf(0x259)];return _0x250dcf[_0x21b5cf(0x22f)]==='json'||_0x250dcf[_0x21b5cf(0x22f)]==='jsonl'?await handleSDKOutput([{'sql':_0x2ef1a3}],_0x250dcf):console[_0x21b5cf(0x216)](_0x2ef1a3),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x139023(0x28c)]='segment:parent:show';[a23_0x139023(0x304)]=a23_0x139023(0x203);async[a23_0x139023(0x262)](_0x40e36d){const _0x5475dc=a23_0x139023,{options:_0x349384,args:_0x2c86f4,tdx:_0x2566d7}=_0x40e36d,_0x323c8b=_0x2c86f4[0x0]||_0x349384[_0x5475dc(0x301)];if(!_0x323c8b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+'\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;_0x349384[_0x5475dc(0x2c0)]&&(console['error']('Site:\x20'+_0x349384['site']),console[_0x5475dc(0x2db)](_0x5475dc(0x28f)+_0x323c8b));const _0x185e7b=await withSpinner(_0x5475dc(0x1ea)+_0x323c8b+_0x5475dc(0x294),()=>_0x2566d7[_0x5475dc(0x27a)][_0x5475dc(0x225)](_0x323c8b),{'verbose':_0x349384['verbose']}),_0x587206=_0x185e7b['data'],_0x36fb43=await withSpinner(_0x5475dc(0x2ef)+_0x323c8b+_0x5475dc(0x294),()=>_0x2566d7[_0x5475dc(0x27a)][_0x5475dc(0x2a0)](_0x587206),{'verbose':_0x349384[_0x5475dc(0x2c0)]});let _0x50d310=_0x36fb43[_0x5475dc(0x259)];const _0x34735e=resolveLimit(_0x349384[_0x5475dc(0x1fd)],DEFAULT_DISPLAY_LIMIT),_0x44f6c9=/\bLIMIT\s+\d+/i[_0x5475dc(0x208)](_0x50d310);!_0x44f6c9&&(_0x50d310=_0x50d310[_0x5475dc(0x2c1)]()[_0x5475dc(0x2c4)](/;+$/,''),_0x50d310=_0x5475dc(0x25b)+_0x50d310+_0x5475dc(0x2f9)+_0x34735e);_0x349384[_0x5475dc(0x2c0)]&&console['error'](_0x5475dc(0x1f7)+_0x50d310);const _0x286387=await withProgressSpinner(_0x5475dc(0x1e0),async _0x1ec36a=>{const _0xb8a538=_0x5475dc,_0x41c37e=await _0x2566d7[_0xb8a538(0x280)][_0xb8a538(0x262)](_0x50d310,{'catalog':'td','schema':_0xb8a538(0x240),'onJobId':_0x4e993d=>{_0x1ec36a['setJobId'](_0x4e993d);}});return _0x41c37e;},{'verbose':_0x349384['verbose']}),_0x38a954=_0x286387[_0x5475dc(0x259)],_0x31f436=_0x38a954[_0x5475dc(0x1f4)]?_0x5475dc(0x2d4)+_0x38a954['jobId']+']':'';return console[_0x5475dc(0x2db)](_0x5475dc(0x210)+_0x38a954[_0x5475dc(0x226)]['processedRows'][_0x5475dc(0x245)]()+_0x5475dc(0x1f5)+(_0x5475dc(0x2e5)+formatElapsed(_0x38a954[_0x5475dc(0x226)][_0x5475dc(0x242)])+_0x31f436)),await handleQueryOutput(_0x38a954,_0x349384),0x0;}}function a23_0x10e2(){const _0x398ab5=['addAttributes','Pattern:\x20','jobId','\x20rows\x20','Available\x20behaviors:','SQL\x20query:\x0a','pushParentYaml','displayAttributesStats','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20Context\x20set:\x20','\x27\x20and\x20run\x20workflow?','limit','errors','-1d','Validate:','runParent','Options\x20(one\x20required):\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0aChanges\x20to\x20apply\x20to\x20\x27','site','label','getParentFull','test','.yaml','tdx\x20segment\x20parent\x20preview\x20','Customers:','segment:parent:push','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Error\x20reading\x20file:\x20','yellow','✔\x20Query\x20completed:\x20Processed\x20','endsWith','stop','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','displayMasterInfo','workflowSessionId','log','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','`\x20to\x20download\x20the\x20configuration\x20first','\x20is\x20already\x20up\x20to\x20date','YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','varchar','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x27\x20is\x20already\x20up\x20to\x20date','filter','jsonl','FINISHED','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','resolveParentId','stats','/\x20directories\x20exist.','scheduleType','match','Attributes','Site:\x20','\x20--attribute\x20\x22','✔\x20No\x20changes\x20-\x20\x27','segment:parent:sql','format','\x0aNew\x20parent\x20segment\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','ignore','timezone','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','database','\x20tdx\x20wf\x20attempt\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20--interval\x20','Source:','map','green','/app/dw/parentSegments/','output','segment:parent:run','Analyzing\x20changes...','information_schema','number','elapsedTimeMillis','Error\x20parsing\x20YAML:\x20','segment:parent:desc','toLocaleString','displaySummary','Updated','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','using\x20the\x20default\x20path:\x20','attributes','json','Master\x20+\x20Attributes','segment:parent:list','updateParent','Columns:','platform','yes','cyan','foreignKey','win32','customerGroupFile','customerGroup','Creating\x20parent\x20segment\x20\x27','%)\x20','data','List\x20parent\x20segments','SELECT\x20*\x20FROM\x20(\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','✔\x20Renamed\x20directory\x20to\x20','/\x20and\x20','/\x20→\x20','\x20Opening\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','execute','\x20kill','addBehaviors','Error:\x20--behavior\x20requires\x20a\x20name\x0a','segment:parent:fields','\x0a⚠️\x20\x20Migrating:\x20','schemaError','utf-8','Join:','\x20--attribute\x20\x22<name>\x22','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Behaviors','double','sort','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/attempt/','\x0aChanges\x20to\x20\x27','Rows:','1691308QhMjvO','Fetching\x20sample\x20data...','191432QdCdiz','1VaMzej','segment','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20--enriched','string','\x20\x20\x20\x20-\x20','displayPreviewResults','query','Aborted.','bold','Join\x20on:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Behavior:','web','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','1619435gxzCWj','Database:\x20','name','sampleData','\x20Configuration\x20is\x20valid','Parent\x20segment:\x20','validateParentYaml','apply','List\x20available\x20fields\x20for\x20segmentation','rowCount','\x27...','Found\x20YAML\x20file:\x20','Options:\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20parent\x20segment\x20\x27','Updating\x20parent\x20segment\x20\x27','repeat','attribute','population','9857410IvnaSb','\x20--behavior\x20\x22<name>\x22','getParentSQL','toFixed','message','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','To\x20cancel:','Listing\x20parent\x20segments...','\x20--behavior\x20\x22','/\x20directory.\x0a','behavior','localeCompare','To\x20view\x20sample\x20data:','Events:','red','allValid','Audience\x20ID:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','dirname','✘\x20Failed\x20to\x20rename\x20directory:\x20','Session:','customerPercent','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','status','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','coveragePercent','column','dim','Master\x20Table','✔\x20Found\x20','customersWithEvents','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','all','verbose','trim','3AjHgnL','Created','replace','Attribute:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','scheduleOption','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Create\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','columns','isDirectory','workflowId','Creating','behaviors','No\x20parent\x20segments\x20match\x20pattern:\x20','Status:','Output\x20file:\x20','\x20[Job\x20ID:\x20','enriched','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','2092434LeslPN','text','segment:parent:validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','error','master','createParent','interval','Options:','segment:parent:create','11301234GnncSH','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','displayPreviewHints','.yml','in\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20=\x20','behaviorsFile','addBehaviorsFile','displayValidateResults','segment:parent:view','\x0a✔\x20Workflow\x20started','parent_segment','table','Fetching\x20SQL\x20for\x20\x27','Apply\x20changes\x20to\x20\x27','joinKey','schemaValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','9kzEhtK','Errors:','use','\x20rows)','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x5c$&','Error:\x20File\x20not\x20found:\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','displaySampleData','previewParentYaml','pullParentYaml','parentSegment','displayBehaviorsStats','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','description','segment:parent:pull','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','unref','start','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Show\x20parent\x20segment\x20details','Executing\x20parent\x20segment\x20query...','12526fwcopG','Table:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','totalEvents','addAttributesFile','audienceId','displayColumns','\x20\x20No\x20sample\x20data\x20available','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Resolving\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Fetching\x20parent\x20segment\x20\x27','workflowAttemptId','Updating','length','matchedCount','xdg-open'];a23_0x10e2=function(){return _0x398ab5;};return a23_0x10e2();}
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_0x5aa101=a24_0x4b8f;(function(_0x5497a1,_0x2bb0c3){const _0xd0befd=a24_0x4b8f,_0x335db2=_0x5497a1();while(!![]){try{const _0x7bc73d=-parseInt(_0xd0befd(0xf7))/0x1*(parseInt(_0xd0befd(0x116))/0x2)+-parseInt(_0xd0befd(0x108))/0x3+-parseInt(_0xd0befd(0xfd))/0x4+parseInt(_0xd0befd(0x129))/0x5*(parseInt(_0xd0befd(0x101))/0x6)+-parseInt(_0xd0befd(0x10e))/0x7*(-parseInt(_0xd0befd(0x118))/0x8)+-parseInt(_0xd0befd(0x149))/0x9+parseInt(_0xd0befd(0x143))/0xa;if(_0x7bc73d===_0x2bb0c3)break;else _0x335db2['push'](_0x335db2['shift']());}catch(_0x3e6738){_0x335db2['push'](_0x335db2['shift']());}}}(a24_0x58d3,0x34bcd));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_0x142e8f from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a24_0x58d3(){const _0x1fe2aa=['jobs','Enter\x20custom\x20site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profile:remove','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','\x0aAvailable\x20profiles:','customSite','(cleared)','tdx.json','green','(session:\x20','validate','toString','default','profileName','404sPtmDt','ERROR','Removal\x20cancelled','Site\x20was\x20not\x20changed.','profile:use','confirm','1709448mUdcnR','warn','llm_project','✗\x20Validation\x20failed:\x20','2387322gjFJvO','Create\x20a\x20new\x20profile','error','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Remove\x20a\x20profile','test','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','871548TmPCIy','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20(no\x20profiles\x20found)','\x27.\x0a\x0aValid\x20keys:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','61355ZCNTCW','\x20Profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','execute','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','VALID_KEYS','\x27\x20updated:\x20','1906yMAkaI','\x0aOperation\x20cancelled','8sCGqJt','Unknown\x20key\x20\x27','API\x20key\x20cannot\x20be\x20empty','red','\x20\x20-\x20','jp01','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','yellow','profile:set','select','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','message','email','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','value','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','5gzeXel','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20remove','bold','ap02\x20-\x20Korea','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20cannot\x20be\x20empty','Enter\x20profile\x20name:','\x27\x20created','\x20API\x20key\x20is\x20valid\x20(User:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSetup\x20cancelled','tdx:\x20profile\x20create','text','name','profile','password','findIndex','Set\x20session\x20profile','us01','Enter\x20site\x20name:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','create','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','database','site','10893150OYdevK','getUserInfo','status','push','\x0aSaved\x20to:\x20','join','1593576aPforP','split','session','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>','Session\x20profile\x20set\x20to:\x20','includes','trim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','length','eu\x20\x20\x20-\x20Europe','log','apiKey','logLevel','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','other','Validating\x20API\x20key...'];a24_0x58d3=function(){return _0x1fe2aa;};return a24_0x58d3();}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_0x3c204d from'prompts';import a24_0x2a13d2 from'chalk';function a24_0x4b8f(_0x4eb622,_0x38ec32){_0x4eb622=_0x4eb622-0xe8;const _0x58d37a=a24_0x58d3();let _0x4b8f6c=_0x58d37a[_0x4eb622];return _0x4b8f6c;}function validateProfileName(_0x11967c){const _0x4e5098=a24_0x4b8f;if(!_0x11967c||!_0x11967c[_0x4e5098(0x14f)]())return _0x4e5098(0x12f);const _0x305cf3=_0x11967c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x4e5098(0x106)](_0x305cf3))return _0x4e5098(0xe9);if(profileExists(_0x305cf3))return'Profile\x20\x27'+_0x305cf3+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a24_0x5aa101(0x126);[a24_0x5aa101(0xea)]=a24_0x5aa101(0x102);async[a24_0x5aa101(0x112)](_0x23e958){const _0x57b087=a24_0x5aa101,{options:_0x5e70fa,args:_0x5f3514}=_0x23e958;console['log'](a24_0x2a13d2[_0x57b087(0x12c)](_0x57b087(0x135)));let _0x3a73b6;if(_0x5f3514[_0x57b087(0x151)]>0x0&&_0x5f3514[0x0]){const _0x4b6a07=_0x5f3514[0x0][_0x57b087(0x14f)](),_0xa66a2=validateProfileName(_0x4b6a07);if(_0xa66a2!==!![])return console[_0x57b087(0x103)](a24_0x2a13d2['red'](_0xa66a2)),0x1;_0x3a73b6=_0x4b6a07;}else{const _0x4ee62d=await a24_0x3c204d({'type':_0x57b087(0x136),'name':_0x57b087(0xf6),'message':_0x57b087(0x130),'validate':validateProfileName});if(!_0x4ee62d[_0x57b087(0xf6)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;_0x3a73b6=_0x4ee62d[_0x57b087(0xf6)][_0x57b087(0x14f)]();}const _0x417d1d=await a24_0x3c204d({'type':_0x57b087(0x136),'name':_0x57b087(0xea),'message':'Enter\x20description\x20(optional):'}),_0x37db67=_0x417d1d['description']?.[_0x57b087(0x14f)]()||undefined,_0x1c2a73=_0x5e70fa[_0x57b087(0x142)]||_0x57b087(0x13c),_0x2120e8=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x57b087(0x13c)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x57b087(0x11d)},{'title':_0x57b087(0x152),'value':'eu01'},{'title':_0x57b087(0x12d),'value':'ap02'}];let _0x52fd9d=_0x2120e8[_0x57b087(0x13a)](_0x2b835c=>_0x2b835c[_0x57b087(0x127)]===_0x1c2a73);_0x52fd9d===-0x1&&_0x1c2a73!=='us01'&&(_0x2120e8[_0x57b087(0x146)]({'title':_0x1c2a73,'value':_0x1c2a73}),_0x52fd9d=_0x2120e8['length']-0x1);_0x2120e8[_0x57b087(0x146)]({'title':_0x57b087(0x15a),'value':_0x57b087(0x157)});const _0x5d9ff3=await a24_0x3c204d({'type':_0x57b087(0x121),'name':'site','message':_0x57b087(0x13e)+_0x3a73b6+'\x27:','choices':_0x2120e8,'initial':_0x52fd9d>=0x0?_0x52fd9d:0x0});if(!_0x5d9ff3[_0x57b087(0x142)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;let _0x53737a;if(_0x5d9ff3['site']===_0x57b087(0x157)){const _0x322092=await a24_0x3c204d({'type':_0x57b087(0x136),'name':'customSite','message':_0x57b087(0x13d),'initial':_0x57b087(0x13c),'validate':_0x5292d2=>{const _0x5c8d60=_0x57b087;if(!_0x5292d2||!_0x5292d2['trim']())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x5292d2[_0x5c8d60(0x14f)]()))return _0x5c8d60(0x15d);return!![];}});if(!_0x322092[_0x57b087(0xee)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;_0x53737a=_0x322092[_0x57b087(0xee)];}else _0x53737a=_0x5d9ff3[_0x57b087(0x142)];const _0x1c5f85=resolveSite(_0x53737a);console[_0x57b087(0x153)](_0x57b087(0x128)+_0x1c5f85),console[_0x57b087(0x153)](_0x57b087(0x109)),console['log']('\x20\x20'+getConsoleUrl(_0x1c5f85,'/app/mp/ak'));const _0x53fb92=await a24_0x3c204d({'type':'password','name':_0x57b087(0x154),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x58d8e8=>{const _0x52f8c1=_0x57b087;if(!_0x58d8e8||!_0x58d8e8[_0x52f8c1(0x14f)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x53fb92['apiKey'])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;const _0x30a5a3=_0x53fb92['apiKey'];console['log'](_0x57b087(0x158));try{const _0x3f9185=TDX['create']({'site':_0x1c5f85,'apiKey':_0x30a5a3[_0x57b087(0x14f)](),'logLevel':_0x5e70fa[_0x57b087(0x155)]??LogLevel[_0x57b087(0xf8)]}),_0xc5ccdf=await _0x3f9185['jobs'][_0x57b087(0x144)]();console['log'](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+_0x57b087(0x132)+_0xc5ccdf[_0x57b087(0x124)]+')');const _0x299734=await isKeychainAvailable();_0x299734?(await saveAPIKeyAsync(_0x30a5a3[_0x57b087(0x14f)](),_0x1c5f85,_0x3a73b6),console['log'](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3a73b6+')')):(console[_0x57b087(0xfe)](a24_0x2a13d2['yellow'](_0x57b087(0x140))),console['warn'](a24_0x2a13d2[_0x57b087(0x11f)](_0x57b087(0x15b))));const _0x1f3a93={'site':_0x1c5f85,..._0x37db67&&{'description':_0x37db67}};return saveProfileToUserConfig(_0x3a73b6,_0x1f3a93),console[_0x57b087(0x153)](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+_0x57b087(0x10f)+_0x3a73b6+_0x57b087(0x131)),console[_0x57b087(0x153)](),console[_0x57b087(0x153)](_0x57b087(0x122)),console[_0x57b087(0x153)](_0x57b087(0x110)+_0x3a73b6+_0x57b087(0x111)),console[_0x57b087(0x153)]('\x20\x20tdx\x20--profile\x20'+_0x3a73b6+_0x57b087(0x156)),0x0;}catch(_0xc4770){if(_0xc4770 instanceof HTTPClientError&&_0xc4770[_0x57b087(0x145)]===0x191)return printAuthError(_0xc4770),0x1;return console['error'](a24_0x2a13d2[_0x57b087(0x11b)](_0x57b087(0x100)+(_0xc4770 instanceof Error?_0xc4770[_0x57b087(0x123)]:String(_0xc4770)))),console[_0x57b087(0x103)](_0x57b087(0x113)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x5aa101(0xe8);['description']=a24_0x5aa101(0x105);['validate'](_0x107ecf){const _0x282e9e=a24_0x5aa101,{args:_0x1d6ff5}=_0x107ecf;if(_0x1d6ff5['length']===0x0)return _0x282e9e(0x15c);return undefined;}async[a24_0x5aa101(0x112)](_0x1d0f38){const _0x317156=a24_0x5aa101,{args:_0x3d10c3}=_0x1d0f38,_0xae82e9=_0x3d10c3[0x0];console['log'](a24_0x2a13d2[_0x317156(0x12c)](_0x317156(0x12b)));if(!profileExists(_0xae82e9)){console['error'](a24_0x2a13d2[_0x317156(0x11b)](_0x317156(0x10d)+_0xae82e9+'\x27\x20does\x20not\x20exist.')),console['log'](_0x317156(0xed));const _0x54ec68=listProfiles();if(_0x54ec68[_0x317156(0x151)]===0x0)console[_0x317156(0x153)](_0x317156(0x10a));else for(const _0x5c7a2a of _0x54ec68){console[_0x317156(0x153)](_0x317156(0x11c)+_0x5c7a2a[_0x317156(0x137)]);}return 0x1;}const _0x14e7a6=await a24_0x3c204d({'type':'confirm','name':_0x317156(0xfc),'message':_0x317156(0x11e)+_0xae82e9+'\x27?','initial':![]});if(!_0x14e7a6['confirm'])return console[_0x317156(0x153)](_0x317156(0xf9)),0x0;try{removeProfileFromUserConfig(_0xae82e9),console[_0x317156(0x153)](a24_0x2a13d2['green']('✓')+'\x20Profile\x20\x27'+_0xae82e9+'\x27\x20removed\x20from\x20configuration');}catch(_0x19881b){return console[_0x317156(0x103)](a24_0x2a13d2['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x19881b instanceof Error?_0x19881b[_0x317156(0x123)]:String(_0x19881b)))),0x1;}const _0x1f1487=await isKeychainAvailable();if(_0x1f1487){const _0x2406ee=await deleteKeychainAPIKey(_0xae82e9);_0x2406ee&&console[_0x317156(0x153)](a24_0x2a13d2[_0x317156(0xf1)]('✓')+_0x317156(0xeb));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a24_0x5aa101(0x120);[a24_0x5aa101(0xea)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a24_0x5aa101(0x142),a24_0x5aa101(0x141),'parent_segment',a24_0x5aa101(0xff),'llm_agent',a24_0x5aa101(0xea)];[a24_0x5aa101(0xf3)](_0x284cfd){const _0x956da7=a24_0x5aa101,{args:_0x51b3ee,options:_0x1018c5}=_0x284cfd,_0x5dae60=_0x1018c5['profile']||getActiveProfile();if(!_0x5dae60)return _0x956da7(0x14c);if(_0x51b3ee[_0x956da7(0x151)]===0x0)return _0x956da7(0x104)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');const _0x13bb94=_0x51b3ee[0x0];if(!_0x13bb94[_0x956da7(0x14e)]('='))return _0x956da7(0x12a)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');const [_0xf4d4d1]=_0x13bb94[_0x956da7(0x14a)]('=',0x2);if(!ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x14e)](_0xf4d4d1))return _0x956da7(0x119)+_0xf4d4d1+_0x956da7(0x10b)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');return undefined;}async['execute'](_0x2fcb25){const _0x48870b=a24_0x5aa101,{args:_0x20ef05,options:_0x24e7f4}=_0x2fcb25,_0x1cbe69=_0x24e7f4[_0x48870b(0x138)]||getActiveProfile(),[_0x584c3e,..._0x425abc]=_0x20ef05[0x0][_0x48870b(0x14a)]('='),_0x5ceef4=_0x425abc[_0x48870b(0x148)]('=');console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0x12c)]('tdx:\x20profile\x20set'));if(!profileExists(_0x1cbe69)){const _0x25ac28=await a24_0x3c204d({'type':_0x48870b(0xfc),'name':_0x48870b(0x13f),'message':_0x48870b(0x10d)+_0x1cbe69+_0x48870b(0x125),'initial':!![]});if(!_0x25ac28[_0x48870b(0x13f)])return console[_0x48870b(0x153)]('Operation\x20cancelled'),0x1;}const _0x56816e=loadProfile(_0x1cbe69),_0x135875=_0x56816e?.['config']||{};if(_0x584c3e===_0x48870b(0x142)){const _0x453129=resolveSite(_0x5ceef4);console[_0x48870b(0x153)]('Changing\x20site\x20to\x20\x27'+_0x453129+_0x48870b(0x12e)),console['log'](_0x48870b(0x10c)),console[_0x48870b(0x153)]('\x20\x20'+getConsoleUrl(_0x453129,'/app/mp/ak'));const _0xa6097f=await a24_0x3c204d({'type':_0x48870b(0x139),'name':'apiKey','message':_0x48870b(0x133),'validate':_0x55842c=>{const _0x294f02=_0x48870b;if(!_0x55842c||!_0x55842c[_0x294f02(0x14f)]())return _0x294f02(0x11a);return!![];}});if(!_0xa6097f['apiKey'])return console['log'](_0x48870b(0x117)),0x1;console[_0x48870b(0x153)](_0x48870b(0x158));try{const _0x5ed27a=TDX[_0x48870b(0x13f)]({'site':_0x453129,'apiKey':_0xa6097f[_0x48870b(0x154)][_0x48870b(0x14f)](),'logLevel':_0x24e7f4[_0x48870b(0x155)]??LogLevel[_0x48870b(0xf8)]}),_0x4974fa=await _0x5ed27a[_0x48870b(0x159)][_0x48870b(0x144)]();console[_0x48870b(0x153)](a24_0x2a13d2['green']('✓')+_0x48870b(0x132)+_0x4974fa[_0x48870b(0x124)]+')');const _0x932b2e=await isKeychainAvailable();_0x932b2e?(await saveAPIKeyAsync(_0xa6097f['apiKey'][_0x48870b(0x14f)](),_0x453129,_0x1cbe69),console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0xf1)]('✓')+_0x48870b(0x150))):console['warn'](a24_0x2a13d2['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x135875[_0x48870b(0x142)]=_0x453129;}catch(_0x58e249){if(_0x58e249 instanceof HTTPClientError&&_0x58e249[_0x48870b(0x145)]===0x191)return printAuthError(_0x58e249),0x1;return console[_0x48870b(0x103)](a24_0x2a13d2['red'](_0x48870b(0x100)+(_0x58e249 instanceof Error?_0x58e249[_0x48870b(0x123)]:String(_0x58e249)))),console[_0x48870b(0x103)](_0x48870b(0xfa)),0x1;}}else _0x135875[_0x584c3e]=_0x5ceef4||undefined;return saveProfileToUserConfig(_0x1cbe69,_0x135875),console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0xf1)]('✓')+'\x20Profile\x20\x27'+_0x1cbe69+_0x48870b(0x115)+_0x584c3e+'='+(_0x5ceef4||_0x48870b(0xef))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x5aa101(0x137)]=a24_0x5aa101(0xfb);[a24_0x5aa101(0xea)]=a24_0x5aa101(0x13b);[a24_0x5aa101(0xf3)](_0x21185c){const _0x579893=a24_0x5aa101,{args:_0x1b61b8}=_0x21185c;if(_0x1b61b8['length']===0x0)return _0x579893(0x107);return undefined;}async[a24_0x5aa101(0x112)](_0x4e345b){const _0x3ea510=a24_0x5aa101,{args:_0x95c4e3,options:_0xb779f6}=_0x4e345b,_0x1b3e6a=_0x95c4e3[0x0],_0x3e8937=_0xb779f6[_0x3ea510(0xf5)];cleanExpiredSessions();if(!profileExists(_0x1b3e6a)){console['error'](a24_0x2a13d2[_0x3ea510(0x11b)](_0x3ea510(0x10d)+_0x1b3e6a+'\x27\x20does\x20not\x20exist.')),console['log']('\x0aAvailable\x20profiles:');const _0x45c291=listProfiles();if(_0x45c291[_0x3ea510(0x151)]===0x0)console[_0x3ea510(0x153)](_0x3ea510(0x10a));else for(const _0x43b268 of _0x45c291){console['log'](_0x3ea510(0x11c)+_0x43b268[_0x3ea510(0x137)]);}return 0x1;}if(_0x3e8937){const _0x53eccd=a24_0x142e8f[_0x3ea510(0x148)](getConfigDir(),_0x3ea510(0xf0));return saveActiveProfileToUserConfig(_0x1b3e6a),console[_0x3ea510(0x153)](_0x3ea510(0xec)+a24_0x2a13d2['green'](_0x1b3e6a)),console['log'](a24_0x2a13d2['dim'](_0x3ea510(0x147)+_0x53eccd)),0x0;}const _0x42744a=_0xb779f6[_0x3ea510(0x14b)]||getCurrentSessionPID()[_0x3ea510(0xf4)]();return saveSessionContext({'profile':_0x1b3e6a},_0xb779f6[_0x3ea510(0x14b)]),console[_0x3ea510(0x153)](_0x3ea510(0x14d)+a24_0x2a13d2[_0x3ea510(0xf1)](_0x1b3e6a)+'\x20'+a24_0x2a13d2['dim'](_0x3ea510(0xf2)+_0x42744a+')')),console[_0x3ea510(0x153)](a24_0x2a13d2['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x1b3e6a+'\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
- function a25_0x18aa(){const _0x858917=['error','843055DTtjJl','10717xUxepA','548408tysRsR','execute','description','302215HQgfEt','message','profiles','name','2006152RDopLT','2432kwrfaH','map','Error:\x20','449847GWkBVk','log','config','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2278794EIuzQP'];a25_0x18aa=function(){return _0x858917;};return a25_0x18aa();}const a25_0x16e5a5=a25_0x1129;(function(_0x45f223,_0x1f9d0b){const _0x875c76=a25_0x1129,_0x4eee92=_0x45f223();while(!![]){try{const _0x13184f=parseInt(_0x875c76(0x19e))/0x1+parseInt(_0x875c76(0x1ae))/0x2+-parseInt(_0x875c76(0x1a6))/0x3+parseInt(_0x875c76(0x1a2))/0x4+parseInt(_0x875c76(0x1ac))/0x5+-parseInt(_0x875c76(0x1aa))/0x6+parseInt(_0x875c76(0x1ad))/0x7*(-parseInt(_0x875c76(0x1a3))/0x8);if(_0x13184f===_0x1f9d0b)break;else _0x4eee92['push'](_0x4eee92['shift']());}catch(_0x1b90b7){_0x4eee92['push'](_0x4eee92['shift']());}}}(a25_0x18aa,0x3d604));function a25_0x1129(_0x133a56,_0x12cec8){_0x133a56=_0x133a56-0x19e;const _0x18aae1=a25_0x18aa();let _0x1129e9=_0x18aae1[_0x133a56];return _0x1129e9;}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_0x16e5a5(0x1a1)]=a25_0x16e5a5(0x1a0);[a25_0x16e5a5(0x1b0)]='List\x20all\x20available\x20profiles';async[a25_0x16e5a5(0x1af)](_0xf9a84d){const _0x115cb1=a25_0x16e5a5,{options:_0x50f0e9}=_0xf9a84d;try{const _0x44b2c9=listProfiles(),_0x392e8c=getActiveProfile();if(_0x44b2c9['length']===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x115cb1(0x1a7)](_0x115cb1(0x1a9)),console[_0x115cb1(0x1a7)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x3a2e49=_0x44b2c9[_0x115cb1(0x1a4)](_0x2b19fc=>{const _0x57a723=_0x115cb1,_0x5e5c97=_0x2b19fc[_0x57a723(0x1a1)]===_0x392e8c,_0x5cfd70=getProfileParams(_0x2b19fc['config']);return{'name':_0x2b19fc['name'],'active':_0x5e5c97,'scope':_0x2b19fc['scope'],'description':_0x2b19fc[_0x57a723(0x1a8)][_0x57a723(0x1b0)]||'','params':_0x5cfd70};});return await handleSDKOutput(_0x3a2e49,_0x50f0e9),0x0;}catch(_0x4ec6fa){return _0x4ec6fa instanceof Error&&console[_0x115cb1(0x1ab)](_0x115cb1(0x1a5)+_0x4ec6fa[_0x115cb1(0x19f)]),0x1;}}}
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_0x1b370e=a26_0x443d;(function(_0x35e0fc,_0x21cd85){const _0x507ed4=a26_0x443d,_0x362352=_0x35e0fc();while(!![]){try{const _0xea94de=parseInt(_0x507ed4(0x121))/0x1*(parseInt(_0x507ed4(0x128))/0x2)+-parseInt(_0x507ed4(0x132))/0x3+-parseInt(_0x507ed4(0x109))/0x4+-parseInt(_0x507ed4(0x123))/0x5*(parseInt(_0x507ed4(0x126))/0x6)+parseInt(_0x507ed4(0x101))/0x7*(parseInt(_0x507ed4(0x11f))/0x8)+parseInt(_0x507ed4(0x122))/0x9+-parseInt(_0x507ed4(0x115))/0xa*(-parseInt(_0x507ed4(0x130))/0xb);if(_0xea94de===_0x21cd85)break;else _0x362352['push'](_0x362352['shift']());}catch(_0x2bdbae){_0x362352['push'](_0x362352['shift']());}}}(a26_0x3c97,0xac3ce));import{BaseCommand}from'./command.js';function a26_0x3c97(){const _0x29d4fa=['validate','totalSplits','8634cfZalm','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','6hrgMIi','error','\x0aAll\x20results\x20saved\x20to\x20','information_schema','completedSplits','Executing\x20query\x20[','processedRows','SQL:\x20','16159XPFPqO','\x20rows\x20','3745950gkHQOC','stats','data','81893HozVMD','verbose','setExtra','database','output','join','originalMessage','message','2056196SNfGms','jobId','Site:\x20','options','\x20[Job\x20ID:\x20','setPhase','Error:\x20','Executing\x20statement\x20','Executing\x20query...','...','Statement\x20','site','12020dzUKGI','Run\x20Trino\x20queries\x20(streaming)','description','length','push','query','catalog','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20-\x20','execute','824SWKmuY','in\x20','127685elRMML','2118384kUWOEA','3895rYXulQ'];a26_0x3c97=function(){return _0x29d4fa;};return a26_0x3c97();}import{SDKError}from'../sdk/index.js';function a26_0x443d(_0x32db43,_0x5b3350){_0x32db43=_0x32db43-0xff;const _0x3c976d=a26_0x3c97();let _0x443d57=_0x3c976d[_0x32db43];return _0x443d57;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x1b370e(0x11a);[a26_0x1b370e(0x117)]=a26_0x1b370e(0x116);async['execute'](_0x39547d){const _0x4300db=a26_0x1b370e,{options:_0x1a6bef,args:_0x271577,tdx:_0x1166d2}=_0x39547d,_0x36420a=_0x271577[0x0],_0x581fb5=_0x1a6bef['file'];let _0x139ced;try{if(_0x581fb5)_0x139ced=readSqlStatementsFromFile(_0x581fb5);else{if(_0x36420a==='-')_0x139ced=await readSqlStatementsFromStdin();else{if(_0x36420a&&isSqlFilePath(_0x36420a))_0x139ced=readSqlStatementsFromFile(_0x36420a);else{if(_0x36420a)_0x139ced=splitSqlStatements(_0x36420a);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x3594bf){return console[_0x4300db(0x129)](_0x4300db(0x10f)+_0x3594bf['message']),0x1;}const _0x564e00=_0x1a6bef[_0x4300db(0x104)]||_0x4300db(0x12b),_0x398c3d=_0x1a6bef[_0x4300db(0x11b)];try{const _0x1c64a4=[],_0x1ed2ea=!!_0x1a6bef[_0x4300db(0x105)];for(let _0x44d5c0=0x0;_0x44d5c0<_0x139ced[_0x4300db(0x118)];_0x44d5c0++){const _0x480e59=_0x139ced[_0x44d5c0],_0x5a6bdc=_0x44d5c0+0x1,_0x50bbd0=_0x139ced[_0x4300db(0x118)],_0x45f9a7=_0x50bbd0>0x1;_0x1a6bef[_0x4300db(0x102)]&&(console['error']('\x0a'+(_0x45f9a7?_0x4300db(0x113)+_0x5a6bdc+'/'+_0x50bbd0+':':'')),console[_0x4300db(0x129)](_0x4300db(0x10b)+_0x1a6bef[_0x4300db(0x114)]),console['error']('Catalog:\x20'+(_0x398c3d||'td')),console[_0x4300db(0x129)]('Schema:\x20'+_0x564e00),console[_0x4300db(0x129)](_0x4300db(0x12f)+_0x480e59));const _0x5e052c=_0x45f9a7?_0x4300db(0x110)+_0x5a6bdc+'/'+_0x50bbd0+_0x4300db(0x112):_0x4300db(0x111);try{const _0x54ce96=await withProgressSpinner(_0x5e052c,async _0x369e8e=>{const _0x5da0d7=_0x4300db,_0x39801e=await _0x1166d2['query'][_0x5da0d7(0x11e)](_0x480e59,{'catalog':_0x398c3d,'schema':_0x564e00,'onJobId':_0x871de1=>{_0x369e8e['setJobId'](_0x871de1);},'onProgress':_0x43c6e4=>{const _0x53543c=_0x5da0d7;_0x369e8e[_0x53543c(0x10e)](_0x53543c(0x12d)+_0x43c6e4['state']+']'),_0x369e8e[_0x53543c(0x103)](formatRows(_0x43c6e4[_0x53543c(0x12e)])+_0x53543c(0x131)+_0x43c6e4[_0x53543c(0x12c)]+'/'+_0x43c6e4[_0x53543c(0x125)]+'\x20splits');}});return _0x39801e;},{'verbose':_0x1a6bef[_0x4300db(0x102)]}),_0x42efdf=_0x54ce96[_0x4300db(0x100)],_0x2ca288=_0x42efdf[_0x4300db(0x10a)]?_0x4300db(0x10d)+_0x42efdf['jobId']+']':'',_0x68bda8=_0x45f9a7?'Statement\x20'+_0x5a6bdc+'/'+_0x50bbd0+_0x4300db(0x11d):'';console['error']('✔\x20'+_0x68bda8+'Query\x20completed:\x20Processed\x20'+formatRows(_0x42efdf[_0x4300db(0xff)]['processedRows'])+_0x4300db(0x131)+(_0x4300db(0x120)+formatElapsed(_0x42efdf[_0x4300db(0xff)]['elapsedTimeMillis'])+_0x2ca288));if(_0x45f9a7&&_0x1ed2ea){const _0x42fe49=resolveOutputOptions(_0x1a6bef),_0x4980e6=await formatQueryOutput(_0x42efdf,_0x42fe49);_0x1c64a4[_0x4300db(0x119)](_0x4980e6);}else await handleQueryOutput(_0x42efdf,_0x1a6bef);}catch(_0x425b2e){const _0x37330b=_0x45f9a7?_0x4300db(0x113)+_0x5a6bdc+'/'+_0x50bbd0+':\x0a':'',_0x5d71d0=_0x425b2e instanceof SDKError?_0x425b2e[_0x4300db(0x107)]:_0x425b2e[_0x4300db(0x108)];return console['error'](''+_0x37330b+_0x5d71d0),0x1;}}if(_0x139ced[_0x4300db(0x118)]>0x1&&_0x1ed2ea&&_0x1c64a4[_0x4300db(0x118)]>0x0){const _0x2f993b=_0x1c64a4[_0x4300db(0x106)]('\x0a');writeFileSync(_0x1a6bef[_0x4300db(0x105)],_0x2f993b),console[_0x4300db(0x129)](_0x4300db(0x12a)+_0x1a6bef[_0x4300db(0x105)]);}return 0x0;}catch(_0x3bffea){throw _0x3bffea;}}[a26_0x1b370e(0x124)](_0x5562a9){const _0xf5faa6=a26_0x1b370e,_0x2f320c=_0x5562a9['args'][0x0],_0x303f64=_0x5562a9[_0xf5faa6(0x10c)]['file'];if(!_0x2f320c&&!_0x303f64)return _0xf5faa6(0x127);if(_0x2f320c&&_0x303f64)return _0xf5faa6(0x11c);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;}}