@treasuredata/tdx 0.16.1 → 0.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/unset-command.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/user-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/command-output.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.js +1 -1
  48. package/dist/core/constants.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/core/version.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/mcp/server.js +1 -1
  59. package/dist/mcp/tools/index.js +1 -1
  60. package/dist/mcp/tools/tdx-run.js +1 -1
  61. package/dist/mcp/tools/tdx-search.js +1 -1
  62. package/dist/mcp/utils.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/server.js +1 -1
  69. package/dist/proxy/session-cache.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/claude-agent/claude-agent-client.d.ts +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.js +1 -1
  85. package/dist/sdk/claude-agent/index.js +1 -1
  86. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  87. package/dist/sdk/claude-agent/types.d.ts +26 -0
  88. package/dist/sdk/claude-agent/types.d.ts.map +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.js +1 -1
  94. package/dist/sdk/client/rate-limiter.js +1 -1
  95. package/dist/sdk/client/td-api-client.js +1 -1
  96. package/dist/sdk/client/trino-api-client.js +1 -1
  97. package/dist/sdk/client/workflow-client.js +1 -1
  98. package/dist/sdk/connection-validator.js +1 -1
  99. package/dist/sdk/connection.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-aliases.js +1 -1
  111. package/dist/sdk/llm/model-factors.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  115. package/dist/sdk/segment/fields-display.js +1 -1
  116. package/dist/sdk/segment/file-discovery.js +1 -1
  117. package/dist/sdk/segment/journey-utils.js +1 -1
  118. package/dist/sdk/segment/journey-yaml.js +1 -1
  119. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  120. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  121. package/dist/sdk/segment/pull-workflow.js +1 -1
  122. package/dist/sdk/segment/push-workflow.js +1 -1
  123. package/dist/sdk/segment/resolution-context.js +1 -1
  124. package/dist/sdk/segment/segment-path-parser.js +1 -1
  125. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  126. package/dist/sdk/segment/target-resolution.js +1 -1
  127. package/dist/sdk/segment/tdx-config.js +1 -1
  128. package/dist/sdk/segment/validate-files.js +1 -1
  129. package/dist/sdk/segment/yaml-validator.js +1 -1
  130. package/dist/sdk/segment.js +1 -1
  131. package/dist/sdk/types/index.js +1 -1
  132. package/dist/sdk/types/progress.js +1 -1
  133. package/dist/sdk/user.js +1 -1
  134. package/dist/sdk/util/format-detector.js +1 -1
  135. package/dist/sdk/util/formatters.js +1 -1
  136. package/dist/sdk/util/index.js +1 -1
  137. package/dist/sdk/util/tree-formatter.js +1 -1
  138. package/dist/sdk/workflow/clone-workflow.js +1 -1
  139. package/dist/sdk/workflow/index.js +1 -1
  140. package/dist/sdk/workflow/pull-workflow.js +1 -1
  141. package/dist/sdk/workflow/push-workflow.js +1 -1
  142. package/dist/sdk/workflow/tdx-config.js +1 -1
  143. package/dist/sdk/workflow/workflow-utils.js +1 -1
  144. package/dist/utils/async.js +1 -1
  145. package/dist/utils/colors.js +1 -1
  146. package/dist/utils/diff.js +1 -1
  147. package/dist/utils/file-permissions.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/option-validation.js +1 -1
  150. package/dist/utils/port.js +1 -1
  151. package/dist/utils/process.js +1 -1
  152. package/dist/utils/prompt.js +1 -1
  153. package/dist/utils/spinner.js +1 -1
  154. package/dist/utils/sse-parser.js +1 -1
  155. package/dist/utils/string-utils.js +1 -1
  156. package/dist/utils/table-ref-parser.js +1 -1
  157. package/dist/utils/tdx-logger.js +1 -1
  158. package/dist/utils/version-check.js +1 -1
  159. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_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_0x277f3c=a23_0x31ab;(function(_0x4fe195,_0x496ce4){const _0x101050=a23_0x31ab,_0x17277e=_0x4fe195();while(!![]){try{const _0x566d80=-parseInt(_0x101050(0x1fe))/0x1+parseInt(_0x101050(0x1ec))/0x2*(-parseInt(_0x101050(0x259))/0x3)+parseInt(_0x101050(0x24e))/0x4*(-parseInt(_0x101050(0x1d1))/0x5)+parseInt(_0x101050(0x2c5))/0x6+-parseInt(_0x101050(0x2e1))/0x7*(parseInt(_0x101050(0x201))/0x8)+parseInt(_0x101050(0x2b5))/0x9*(-parseInt(_0x101050(0x29e))/0xa)+parseInt(_0x101050(0x2f5))/0xb;if(_0x566d80===_0x496ce4)break;else _0x17277e['push'](_0x17277e['shift']());}catch(_0x125bad){_0x17277e['push'](_0x17277e['shift']());}}}(a23_0x1c37,0x4c7c8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x52e31e from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x3b54b8 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x1c37(){const _0x11c654=['parent_segment','\x20\x20\x20\x20-\x20','Updating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','message','✔\x20No\x20changes\x20-\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','web','displaySampleData','database','yes','scheduleType','18qGoCIp','darwin','\x20Opening\x20','data','localeCompare','resolveParentId','\x20\x20No\x20sample\x20data\x20available','varchar','getParentFull','stop','\x0aNo\x20sample\x20data\x20available','Enriched:','/\x20directories\x20exist.','red','parentSegment','schemaValid','3243426NLkJju','runParent','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','displayAttributesStats','unref','enriched','createParent','\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Available\x20attributes:','Source:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','apply','tdx\x20segment\x20parent\x20preview\x20','segment:parent:push','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','output','run','customerGroupFile','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','ignore','\x0aChanges\x20to\x20apply\x20to\x20\x27','customerGroup','segment:parent:validate','description','joinKey','119JFwqfy','name','\x0a⚠️\x20\x20Migrating:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','preview','Customers:','To\x20view\x20sample\x20data:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','addBehaviorsFile','text','table','/\x20directory.\x0a','Preview:','string','errors','all','pushParentYaml','10556139sLdBYG','segment:parent:show','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','repeat','displayPreviewResults','totalEvents','\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','toFixed','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0a✔\x20Workflow\x20started','workflowSessionId','\x0aUsage:\x20tdx\x20ps\x20preview\x20','sampleData','attribute','👥\x20','allValid','behavior','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','✔\x20Query\x20completed:\x20Processed\x20','map','2255vRiDHT','Listing\x20parent\x20segments\x20matching\x20\x27','\x27...','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','dim','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment','\x5c$&','log','verbose','`\x20to\x20download\x20the\x20configuration\x20first','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Join:','match','listFields','displayValidateResults','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20Configuration\x20is\x20valid','Executing\x20parent\x20segment\x20query...','Updating','cyan','Database:\x20','segment:parent:fields','customerPercent','start','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','29938SzLZQQ','Creating\x20parent\x20segment\x20\x27','\x20kill','displaySummary','FINISHED','session','Master\x20Table','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20--behavior\x20\x22<name>\x22','✔\x20Created\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','use','length','bold','\x0aNew\x20parent\x20segment\x20\x27','utf-8','\x20No\x20changes\x20-\x20','279201wtiPJN','Site:\x20','/app/workflows/','142744YSqDyj','Errors:','dirname','attributes','query','\x20rows\x20','displayMasterInfo','Error:','validateParentYaml','\x27\x20and\x20run\x20workflow?','Error:\x20--attribute\x20requires\x20a\x20name\x0a','displayBehaviorsStats','\x20tdx\x20wf\x20attempt\x20','columns','addAttributes','label','jobId','✔\x20Updated\x20parent\x20segment\x20\x27','Resolving\x20parent\x20segment\x20\x27','Table:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20=\x20','Coverage:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20--interval\x20','Attributes','-1d','setJobId','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','execute','Updated','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','SQL\x20query:\x0a','Aborted.','\x20rows)','customersWithEvents','using\x20the\x20default\x20path:\x20','processedRows','win32','Analyzing\x20changes...','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Apply\x20changes\x20to\x20\x27','stats','json','sort','error','scheduleOption','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Fetching\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Fetching\x20SQL\x20for\x20\x27','\x20--enriched','schemaError','\x20--attribute\x20\x22','No\x20parent\x20segments\x20found','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Audience\x20ID:','coveragePercent','/\x20→\x20','displayPreviewHints','\x0a⚠️\x20\x20Both\x20','segment:parent:desc','Creating','Master\x20+\x20Attributes','✔\x20Renamed\x20directory\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','behaviorsFile','listParents','behaviors','Columns:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Error\x20reading\x20file:\x20','pullParentYaml','Listing\x20parent\x20segments...','1732CsSbjA','%)\x20','Validating\x20configuration...','Error:\x20Parent\x20segment\x20name\x20is\x20required','Events:','\x27\x20with\x20ID:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','.yml','To\x20cancel:','xdg-open','audienceId','45mzCsvS','\x20--behavior\x20\x22','\x20[Job\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','isDirectory','yellow','Found\x20YAML\x20file:\x20','status','Show\x20parent\x20segment\x20details','platform','foreignKey','green','attributesFile','segment:parent:sql','keys','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','jsonl','test','/app/dw/parentSegments/','Master:','workflowAttemptId','Fetching\x20sample\x20data...','segment:parent:preview','Get\x20SQL\x20query\x20for\x20parent\x20segment','List\x20parent\x20segments','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','timezone','\x0aChanges\x20to\x20\x27','updateParent','segment:parent:list','site','number','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:view','/sessions/','format','Error\x20parsing\x20YAML:\x20','elapsedTimeMillis','YAML\x20file:\x20','Listing\x20fields\x20for\x20\x27','in\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Options:\x0a','Error:\x20File\x20not\x20found:\x20','matchedCount','Attribute:','Pattern:\x20','displayColumns','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/attempt/','segment:parent:pull','\x20field','addBehaviors','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20is\x20already\x20up\x20to\x20date','rowCount','Status:','endsWith','Behaviors','filter','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Rows:','Validate:','Join\x20on:','population','replace','column','922910hGnNxR','getParentSQL','segment:parent:create','Show\x20parent\x20segment\x20schema\x20(column\x20types)','interval','join','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','master','segment:parent:update','Error:\x20--behavior\x20requires\x20a\x20name\x0a','open'];a23_0x1c37=function(){return _0x11c654;};return a23_0x1c37();}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x277f3c(0x2a9);function openBrowser(_0x414ff3){const _0x1309d9=a23_0x277f3c,_0xba7e14=process[_0x1309d9(0x262)],_0x43da76=_0xba7e14===_0x1309d9(0x2b6)?_0x1309d9(0x2a8):_0xba7e14===_0x1309d9(0x228)?_0x1309d9(0x1ea):_0x1309d9(0x257);spawn(_0x43da76,[_0x414ff3],{'detached':!![],'stdio':_0x1309d9(0x2db)})[_0x1309d9(0x2ca)]();}function migrateLegacyDirectory(){const _0x478c58=a23_0x277f3c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58b68e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58b68e[_0x478c58(0x25d)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x25e)](_0x478c58(0x23e)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x478c58(0x2c1))),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x1d6)](_0x478c58(0x254)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x2ef))),![];console['error'](a23_0x3b54b8['yellow'](_0x478c58(0x2e3)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x23c)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x264)](_0x478c58(0x242)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x640844){const _0x2dcb85=_0x640844 instanceof Error?_0x640844[_0x478c58(0x2ad)]:String(_0x640844);return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x2c2)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x2dcb85+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x5981f8){const _0x4a63d4=a23_0x277f3c;return migrateLegacyDirectory(),super[_0x4a63d4(0x2d8)](_0x5981f8);}}function resolveYamlFile(_0x289d82){const _0x3334d7=a23_0x277f3c;if(_0x289d82[_0x3334d7(0x294)](_0x3334d7(0x255))||_0x289d82[_0x3334d7(0x294)]('.yaml'))return _0x289d82;return a23_0x52e31e[_0x3334d7(0x2a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x289d82)+_0x3334d7(0x255));}function formatProgressMessage(_0x27f356){const _0x132f8d=a23_0x277f3c,_0x37488c=_0x27f356[_0x132f8d(0x1df)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x37488c){const [,_0x4b7772,_0x577082,_0x36bb16='']=_0x37488c;return a23_0x3b54b8['dim'](_0x4b7772+':')+'\x20'+_0x577082+a23_0x3b54b8['dim'](_0x36bb16);}return a23_0x3b54b8[_0x132f8d(0x1d6)](_0x27f356);}function showFileNotFoundError(_0x2481e9,_0x1c908b){const _0x59aeea=a23_0x277f3c;console[_0x59aeea(0x22f)](a23_0x3b54b8['red'](_0x59aeea(0x286)+_0x2481e9+'\x0a')),console[_0x59aeea(0x22f)](a23_0x3b54b8[_0x59aeea(0x1e6)](_0x59aeea(0x221)+_0x1c908b+_0x59aeea(0x1dc)));}function showParentSegmentNotSetError(_0x10ac32){const _0x2a0080=a23_0x277f3c;console[_0x2a0080(0x22f)](a23_0x3b54b8['yellow'](_0x2a0080(0x219))),console[_0x2a0080(0x22f)](_0x10ac32);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x277);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x272);async[a23_0x277f3c(0x21f)](_0x1d4640){const _0xd62cf6=a23_0x277f3c,{options:_0x224229,args:_0x322358,tdx:_0xa65b7c}=_0x1d4640,_0x22d475=_0x322358[0x0];_0x224229[_0xd62cf6(0x1db)]&&(console[_0xd62cf6(0x22f)](_0xd62cf6(0x1ff)+_0x224229[_0xd62cf6(0x278)]),_0x22d475&&console[_0xd62cf6(0x22f)](_0xd62cf6(0x289)+_0x22d475));const _0x3e226f=await withSpinner(_0x22d475?_0xd62cf6(0x1d2)+_0x22d475+_0xd62cf6(0x1d3):_0xd62cf6(0x24d),()=>_0xa65b7c[_0xd62cf6(0x1d8)][_0xd62cf6(0x246)](),{'verbose':_0x224229[_0xd62cf6(0x1db)]});let _0x368362=_0x3e226f['data'];if(_0x22d475){const _0x4f31f5=_0x22d475[_0xd62cf6(0x29c)](/[.+^${}()|[\]\\]/g,_0xd62cf6(0x1d9))['replace'](/\*/g,'.*')[_0xd62cf6(0x29c)](/\?/g,'.'),_0x825b39=new RegExp('^'+_0x4f31f5+'$','i');_0x368362=_0x368362[_0xd62cf6(0x296)](_0x332084=>_0x825b39[_0xd62cf6(0x26b)](_0x332084['attributes'][_0xd62cf6(0x2e2)]));}_0x368362[_0xd62cf6(0x22e)]((_0x4938f2,_0x2bf406)=>_0x4938f2[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)][_0xd62cf6(0x2b9)](_0x2bf406[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)])),console[_0xd62cf6(0x22f)]('✔\x20Found\x20'+_0x368362[_0xd62cf6(0x1f9)]+_0xd62cf6(0x2fc)+(_0x368362['length']!==0x1?'s':''));const _0x57927d=_0x203f16=>{const _0x3f0a95=_0xd62cf6;return getConsoleNextUrl(_0x224229[_0x3f0a95(0x278)],'/app/dw/parentSegments/'+_0x203f16);};if(_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x22d)||_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x26a)){const _0x335c45=_0x368362[_0xd62cf6(0x1d0)](_0x37fd9c=>({..._0x37fd9c,'url':_0x57927d(_0x37fd9c['id'])}));await handleSDKOutput(_0x335c45,_0x224229);}else{if(_0x368362[_0xd62cf6(0x1f9)]===0x0)_0x22d475?console[_0xd62cf6(0x1da)](_0xd62cf6(0x284)+_0x22d475):console[_0xd62cf6(0x1da)](_0xd62cf6(0x238));else for(const _0x5a13ed of _0x368362){const _0x282f37=_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)]?a23_0x3b54b8[_0xd62cf6(0x1d6)]('\x20('+formatRows(_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)])+')'):'',_0x42a743=hyperlink(_0x5a13ed['attributes']['name'],_0x57927d(_0x5a13ed['id']));console[_0xd62cf6(0x1da)](_0xd62cf6(0x305)+_0x42a743+_0x282f37);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x277f3c(0x2a0);['description']=a23_0x277f3c(0x27a);async[a23_0x277f3c(0x21f)](_0x27f2b0){const _0x1e9f26=a23_0x277f3c,{options:_0x1e77bb,args:_0x42c79d,tdx:_0x37ac33}=_0x27f2b0;console[_0x1e9f26(0x22f)](_0x1e9f26(0x2f8)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x18b4c7=_0x1e77bb;if(_0x42c79d[_0x1e9f26(0x1f9)]===0x0)return console['error'](a23_0x3b54b8[_0x1e9f26(0x2c2)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x1e9f26(0x22f)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2825c1=_0x42c79d[0x0];if(!_0x18b4c7['database']||!_0x18b4c7[_0x1e9f26(0x2ee)])return console[_0x1e9f26(0x22f)](_0x1e9f26(0x290)),console[_0x1e9f26(0x22f)](_0x1e9f26(0x2e9)),0x1;_0x18b4c7['verbose']&&(console[_0x1e9f26(0x22f)]('Site:\x20'+_0x18b4c7[_0x1e9f26(0x278)]),console['error']('Name:\x20'+_0x2825c1),console['error'](_0x1e9f26(0x1e7)+_0x18b4c7[_0x1e9f26(0x2b2)]),console[_0x1e9f26(0x22f)](_0x1e9f26(0x214)+_0x18b4c7[_0x1e9f26(0x2ee)]));const _0x34a25a=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x204)],_0x18b4c7[_0x1e9f26(0x265)]),_0x15ecdf=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x247)],_0x18b4c7[_0x1e9f26(0x245)]),_0x3f39ae=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x2dd)],_0x18b4c7[_0x1e9f26(0x2d9)]),_0xd70850={'name':_0x2825c1,'description':_0x18b4c7[_0x1e9f26(0x2df)],'scheduleType':_0x18b4c7[_0x1e9f26(0x2b4)],'scheduleOption':_0x18b4c7[_0x1e9f26(0x230)],'timezone':_0x18b4c7[_0x1e9f26(0x274)],'master':{'parentDatabaseName':_0x18b4c7[_0x1e9f26(0x2b2)],'parentTableName':_0x18b4c7[_0x1e9f26(0x2ee)]},'attributes':_0x34a25a,'behaviors':_0x15ecdf,'customerGroup':_0x3f39ae},_0x3b69eb=await withSpinner(_0x1e9f26(0x1ed)+_0x2825c1+_0x1e9f26(0x1d3),()=>_0x37ac33['segment'][_0x1e9f26(0x2cc)](_0xd70850),{'verbose':_0x1e77bb[_0x1e9f26(0x1db)]}),_0x1615c8=_0x3b69eb[_0x1e9f26(0x2b8)];return console[_0x1e9f26(0x22f)](_0x1e9f26(0x1f5)+_0x1615c8[_0x1e9f26(0x2e2)]+_0x1e9f26(0x253)+_0x1615c8['id']),await handleSDKOutput([_0x1615c8],_0x1e77bb),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2a6);[a23_0x277f3c(0x2df)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x2a0716){const _0x21546e=a23_0x277f3c,{options:_0x3e9548,args:_0x14c809,tdx:_0x10d13c}=_0x2a0716;console[_0x21546e(0x22f)](_0x21546e(0x22a)+_0x21546e(0x1d7)+_0x21546e(0x28b));const _0x325916=_0x3e9548;if(_0x14c809[_0x21546e(0x1f9)]===0x0)return console[_0x21546e(0x22f)](a23_0x3b54b8[_0x21546e(0x2c2)](_0x21546e(0x251))),console['error'](_0x21546e(0x2fd)),0x1;const _0x39b2fc=_0x14c809[0x0];_0x325916['verbose']&&(console[_0x21546e(0x22f)](_0x21546e(0x1ff)+_0x325916[_0x21546e(0x278)]),console[_0x21546e(0x22f)](_0x21546e(0x2eb)+_0x39b2fc));const _0x52ddea=await withSpinner(_0x21546e(0x2e4)+_0x39b2fc+'\x27...',()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x2bd)](_0x39b2fc),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x5bbc25=_0x52ddea['data'],_0x313f86=await loadJSONFromOptions(_0x325916[_0x21546e(0x20f)],_0x325916['addAttributesFile']),_0x59d36c=await loadJSONFromOptions(_0x325916[_0x21546e(0x28f)],_0x325916[_0x21546e(0x2ec)]),_0x129343={'name':_0x5bbc25['name'],'description':_0x325916[_0x21546e(0x2df)]!==undefined?_0x325916[_0x21546e(0x2df)]:_0x5bbc25[_0x21546e(0x2df)],'scheduleType':_0x325916['scheduleType']!==undefined?_0x325916[_0x21546e(0x2b4)]:_0x5bbc25[_0x21546e(0x2b4)],'scheduleOption':_0x325916['scheduleOption']!==undefined?_0x325916[_0x21546e(0x230)]:_0x5bbc25[_0x21546e(0x230)],'timezone':_0x325916['timezone']!==undefined?_0x325916['timezone']:_0x5bbc25[_0x21546e(0x274)],'master':_0x5bbc25['master'],'attributes':_0x313f86?[..._0x5bbc25[_0x21546e(0x204)]||[],..._0x313f86]:_0x5bbc25[_0x21546e(0x204)],'behaviors':_0x59d36c?[..._0x5bbc25[_0x21546e(0x247)]||[],..._0x59d36c]:_0x5bbc25[_0x21546e(0x247)],'customerGroup':_0x5bbc25['customerGroup']},_0x89bdf6=await withSpinner(_0x21546e(0x2ab)+_0x39b2fc+_0x21546e(0x1d3),()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x276)](_0x39b2fc,_0x129343),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x26effa=_0x89bdf6[_0x21546e(0x2b8)];return console[_0x21546e(0x22f)](_0x21546e(0x212)+_0x26effa['name']+'\x27'),await handleSDKOutput([_0x26effa],_0x325916),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x28d);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a23_0x277f3c(0x21f)](_0x50d7ce){const _0x3fd43c=a23_0x277f3c,{options:_0x18bdaa,args:_0x358510,tdx:_0x5bcacf}=_0x50d7ce,_0x1a9d38=_0x18bdaa,_0x12ae17=_0x358510[0x0]||_0x18bdaa['parentSegment'];if(!_0x12ae17)return showParentSegmentNotSetError(_0x3fd43c(0x297)+_0x3fd43c(0x2ce)),0x1;if(_0x1a9d38[_0x3fd43c(0x1f8)]&&_0x1a9d38[_0x3fd43c(0x2d7)])return console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x2c2)](_0x3fd43c(0x2d5))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x1d4))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x226)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x3fd43c(0x21e))),0x1;const _0x2fd56b=_0x1a9d38['output']||a23_0x52e31e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x12ae17)+_0x3fd43c(0x255));_0x1a9d38[_0x3fd43c(0x1db)]&&(console['error'](_0x3fd43c(0x1ff)+_0x1a9d38[_0x3fd43c(0x278)]),console['error'](_0x3fd43c(0x2eb)+_0x12ae17),console[_0x3fd43c(0x22f)]('Output\x20file:\x20'+_0x2fd56b));const _0x284b66=await withSpinner(_0x3fd43c(0x232)+_0x12ae17+'\x27...',()=>_0x5bcacf['segment'][_0x3fd43c(0x24c)](_0x12ae17),{'verbose':_0x1a9d38[_0x3fd43c(0x1db)]}),_0x13fc2d=_0x284b66['data'];if(existsSync(_0x2fd56b)){const _0x5606a0=readFileSync(_0x2fd56b,_0x3fd43c(0x1fc)),_0x586a63=generateDiff(_0x5606a0,_0x13fc2d);if(!hasChanges(_0x586a63))console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x1fd)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b)+_0x3fd43c(0x291));else{console[_0x3fd43c(0x22f)](_0x3fd43c(0x275)+_0x2fd56b+'\x27:'),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c)),console[_0x3fd43c(0x22f)](formatDiffWithColors(_0x586a63)),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c));if(!_0x1a9d38['yes']){const _0x49f496=await confirmKey('Overwrite\x20\x27'+_0x2fd56b+'\x27?');if(!_0x49f496)return console['error'](_0x3fd43c(0x223)),0x1;}writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8['green']('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}}else{const _0x4d528e=a23_0x52e31e[_0x3fd43c(0x203)](_0x2fd56b);!existsSync(_0x4d528e)&&mkdirSync(_0x4d528e,{'recursive':!![]}),writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}return saveSessionContext({'parent_segment':_0x12ae17},_0x1a9d38[_0x3fd43c(0x1f1)]),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+'\x20Context\x20set:\x20'+a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x2a9))+_0x3fd43c(0x217)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x12ae17)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x2d4);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1d5);async[a23_0x277f3c(0x21f)](_0x4a9cff){const _0x200437=a23_0x277f3c,{options:_0x4e4636,args:_0x366f24,tdx:_0x4a2ac2}=_0x4a9cff,_0x2b1fdd=_0x4e4636,_0x25a964=_0x366f24[0x0]||_0x4e4636[_0x200437(0x2c3)];if(!_0x25a964)return showParentSegmentNotSetError(_0x200437(0x2f7)+_0x200437(0x243)),0x1;const _0x4cc23c=resolveYamlFile(_0x25a964);if(!existsSync(_0x4cc23c))return showFileNotFoundError(_0x4cc23c,_0x25a964),0x1;_0x2b1fdd[_0x200437(0x1db)]&&(console[_0x200437(0x22f)]('Site:\x20'+_0x2b1fdd['site']),console[_0x200437(0x22f)](_0x200437(0x281)+_0x4cc23c));let _0x230e43;try{_0x230e43=readFileSync(_0x4cc23c,'utf-8');}catch(_0x19667c){const _0x3c6840=_0x19667c instanceof Error?_0x19667c[_0x200437(0x2ad)]:String(_0x19667c);return console[_0x200437(0x22f)]('Error\x20reading\x20file:\x20'+_0x3c6840),0x1;}const _0x4b9080=await withSpinner(_0x200437(0x229),()=>_0x4a2ac2[_0x200437(0x1d8)]['pushParentYaml'](_0x230e43),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0xddb794=_0x4b9080['data'],{isNew:_0x23a8eb,name:_0x5b5818,hasChanges:_0x579c74,diffFormatted:_0x4a2261}=_0xddb794;if(!_0x579c74)return console[_0x200437(0x22f)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5b5818+_0x200437(0x308)),0x0;_0x23a8eb?console[_0x200437(0x22f)](_0x200437(0x1fb)+_0x5b5818+'\x27:'):console[_0x200437(0x22f)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x5b5818+'\x27:');console[_0x200437(0x22f)]('─'[_0x200437(0x2f9)](0x3c)),console[_0x200437(0x22f)](_0x4a2261),console['error']('─'[_0x200437(0x2f9)](0x3c));const _0x37c4c9=_0x23a8eb?'Create\x20parent\x20segment\x20\x27'+_0x5b5818+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x5b5818+'\x27?';if(!_0x2b1fdd[_0x200437(0x2b3)]){const _0x1ff5f6=await confirmKey(_0x37c4c9);if(!_0x1ff5f6)return console['error'](_0x200437(0x223)),0x1;}const _0x27d873=_0x23a8eb?'Creating':_0x200437(0x1e5),_0x5dd550=await withSpinner(_0x27d873+_0x200437(0x2cd)+_0x5b5818+_0x200437(0x1d3),()=>_0xddb794[_0x200437(0x2d2)](),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0x4283a6=_0x5dd550['data'],_0x349836=getConsoleNextUrl(_0x2b1fdd[_0x200437(0x278)],_0x200437(0x26c)+_0x4283a6['id']),_0x36fbd0=_0x23a8eb?'Created':_0x200437(0x220);return console[_0x200437(0x22f)]('✔\x20'+_0x36fbd0+'\x20parent\x20segment\x20\x27'+_0x4283a6[_0x200437(0x2e2)]+'\x27'),console[_0x200437(0x22f)]('\x20\x20'+_0x349836),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2de);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x233);async[a23_0x277f3c(0x21f)](_0x2ebe0a){const _0x1c402e=a23_0x277f3c,{options:_0x187c28,args:_0x21ad54,tdx:_0xc96090}=_0x2ebe0a,_0x1f3687=_0x187c28,_0xe076f9=_0x21ad54[0x0]||_0x187c28['parentSegment'];if(!_0xe076f9)return showParentSegmentNotSetError(_0x1c402e(0x2af)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x1c402e(0x2da)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1fbef2=resolveYamlFile(_0xe076f9);if(!existsSync(_0x1fbef2))return showFileNotFoundError(_0x1fbef2,_0xe076f9),0x1;_0x1f3687[_0x1c402e(0x1db)]&&(console[_0x1c402e(0x22f)](_0x1c402e(0x1ff)+_0x1f3687[_0x1c402e(0x278)]),console[_0x1c402e(0x22f)](_0x1c402e(0x281)+_0x1fbef2));let _0xf13f0b;try{_0xf13f0b=readFileSync(_0x1fbef2,'utf-8');}catch(_0x4cbc49){const _0x26816b=_0x4cbc49 instanceof Error?_0x4cbc49[_0x1c402e(0x2ad)]:String(_0x4cbc49);return console[_0x1c402e(0x22f)]('Error\x20reading\x20file:\x20'+_0x26816b),0x1;}const _0xc3651c=createCommandSpinner(a23_0x3b54b8[_0x1c402e(0x1d6)](_0x1c402e(0x250)),{'verbose':_0x1f3687[_0x1c402e(0x1db)]});_0xc3651c[_0x1c402e(0x1ea)]();const _0x33dcf8={'onProgress':_0x2f5369=>{const _0x5e09e9=_0x1c402e;_0xc3651c[_0x5e09e9(0x2ed)]=formatProgressMessage(_0x2f5369);}};if(_0x1f3687[_0x1c402e(0x2a5)])_0x33dcf8[_0x1c402e(0x2a5)]=!![];if(_0x1f3687['enriched'])_0x33dcf8[_0x1c402e(0x2cb)]=!![];_0x1f3687[_0x1c402e(0x304)]&&(_0x33dcf8[_0x1c402e(0x304)]=_0x1f3687[_0x1c402e(0x304)]);_0x1f3687['behavior']&&(_0x33dcf8[_0x1c402e(0x307)]=_0x1f3687[_0x1c402e(0x307)]);if(_0x1f3687[_0x1c402e(0x2a2)])_0x33dcf8[_0x1c402e(0x2a2)]=_0x1f3687[_0x1c402e(0x2a2)];let _0x28dc86;try{_0x28dc86=await _0xc96090['segment'][_0x1c402e(0x209)](_0xf13f0b,_0x33dcf8),_0xc3651c['stop']();}catch(_0x5f01e0){_0xc3651c['stop']();throw _0x5f01e0;}const _0x47c733=_0x1f3687[_0x1c402e(0x2a2)]||_0x1c402e(0x21c);return this[_0x1c402e(0x1e1)](_0x28dc86,_0x33dcf8,_0x1fbef2,_0x47c733),_0x28dc86[_0x1c402e(0x306)]?0x0:0x1;}[a23_0x277f3c(0x1e1)](_0x264efe,_0x3fc4d1,_0x37e1d4,_0x702b80){const _0x2e7c13=a23_0x277f3c;console[_0x2e7c13(0x22f)]('\x0a'+a23_0x3b54b8[_0x2e7c13(0x1fa)](_0x2e7c13(0x299))+'\x20'+_0x264efe[_0x2e7c13(0x2e2)]),console['error']('═'[_0x2e7c13(0x2f9)](0x3c)),this[_0x2e7c13(0x207)](_0x264efe);if(typeof _0x3fc4d1[_0x2e7c13(0x304)]==='string'){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this['displayPreviewHints'](_0x37e1d4,_0x702b80,'attribute',_0x3fc4d1[_0x2e7c13(0x304)]);return;}if(_0x3fc4d1[_0x2e7c13(0x304)]===!![]){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'attributes');return;}if(typeof _0x3fc4d1[_0x2e7c13(0x307)]===_0x2e7c13(0x2f1)){this['displayBehaviorsStats'](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'behavior',_0x3fc4d1[_0x2e7c13(0x307)]);return;}if(_0x3fc4d1['behavior']===!![]){this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x247));return;}this[_0x2e7c13(0x2c9)](_0x264efe),this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x2f3));}[a23_0x277f3c(0x23d)](_0x43bdb8,_0x3934c4,_0x15ea74,_0x475367){const _0x285412=a23_0x277f3c;console[_0x285412(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x285412(0x2e7)));const _0x28bc99=_0x3934c4!==_0x285412(0x21c)?_0x285412(0x21a)+_0x3934c4:'';if(_0x15ea74===_0x285412(0x304)&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x237)+_0x475367+'\x22'+_0x28bc99));else{if(_0x15ea74==='behavior'&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x25a)+_0x475367+'\x22'+_0x28bc99));else(_0x15ea74===_0x285412(0x204)||_0x15ea74===_0x285412(0x2f3))&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x1f6)+_0x28bc99));}(_0x15ea74==='behaviors'||_0x15ea74==='all')&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x1f4)+_0x28bc99)),_0x15ea74===_0x285412(0x2f3)&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x235)+_0x28bc99));}[a23_0x277f3c(0x207)](_0x38a838){const _0xeca59c=a23_0x277f3c,{master:_0x371a11}=_0x38a838,_0x3ee99b=_0x371a11[_0xeca59c(0x2c4)]?a23_0x3b54b8[_0xeca59c(0x264)]('✔'):a23_0x3b54b8[_0xeca59c(0x2c2)]('✘');console[_0xeca59c(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0xeca59c(0x1f2))),console[_0xeca59c(0x22f)](_0x3ee99b+'\x20'+a23_0x3b54b8['bold'](_0x371a11['database']+'.'+_0x371a11[_0xeca59c(0x2ee)])),_0x371a11[_0xeca59c(0x2c4)]?_0x371a11['rowCount']!==undefined&&console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8[_0xeca59c(0x1d6)](_0xeca59c(0x298))+'\x20'+a23_0x3b54b8['cyan'](formatRows(_0x371a11[_0xeca59c(0x292)]))):console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8['red']('Error:')+'\x20'+_0x371a11['schemaError']);}[a23_0x277f3c(0x2c9)](_0x48e6c1){const _0x1e5927=a23_0x277f3c;if(_0x48e6c1[_0x1e5927(0x204)][_0x1e5927(0x1f9)]===0x0)return;console[_0x1e5927(0x22f)]('\x0a'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x21b)));for(const _0x1bed6e of _0x48e6c1['attributes']){const _0x3ef676=_0x1bed6e['schemaValid']?a23_0x3b54b8[_0x1e5927(0x264)]('✔'):a23_0x3b54b8[_0x1e5927(0x2c2)]('✘');let _0x575b1a='';if(_0x1bed6e[_0x1e5927(0x2c4)]&&_0x1bed6e[_0x1e5927(0x287)]!==undefined&&_0x1bed6e[_0x1e5927(0x23b)]!==undefined){const _0x200ab9=_0x1bed6e[_0x1e5927(0x23b)]['toFixed'](0x1),_0x9a359b=_0x1bed6e['coveragePercent']>=0x50?a23_0x3b54b8[_0x1e5927(0x264)]:_0x1bed6e[_0x1e5927(0x23b)]>=0x32?a23_0x3b54b8[_0x1e5927(0x25e)]:a23_0x3b54b8[_0x1e5927(0x2c2)];_0x575b1a='\x20'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x218))+'\x20'+_0x9a359b(_0x200ab9+'%')+'\x20('+formatRows(_0x1bed6e['matchedCount'])+_0x1e5927(0x224);}console[_0x1e5927(0x22f)](_0x3ef676+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e['name'])+_0x575b1a),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x2d0))+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e[_0x1e5927(0x2b2)]+'.'+_0x1bed6e[_0x1e5927(0x2ee)]));const _0x2ed294=_0x1bed6e[_0x1e5927(0x2e0)]===_0x1bed6e[_0x1e5927(0x263)]?a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x29a))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]:a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x1de))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]+_0x1e5927(0x217)+_0x1bed6e[_0x1e5927(0x263)];console['error']('\x20\x20'+_0x2ed294),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x248))),this[_0x1e5927(0x28a)](_0x1bed6e['columns']),!_0x1bed6e[_0x1e5927(0x2c4)]&&console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x1e5927(0x2c2)]('Error:')+'\x20'+_0x1bed6e[_0x1e5927(0x236)]);}}[a23_0x277f3c(0x20c)](_0x425190,_0x1c0406){const _0x5d38e8=a23_0x277f3c;if(_0x425190[_0x5d38e8(0x247)][_0x5d38e8(0x1f9)]===0x0)return;console[_0x5d38e8(0x22f)]('\x0a'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x295))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)]('('+_0x1c0406+')'));for(const _0x2d9791 of _0x425190[_0x5d38e8(0x247)]){const _0xb3007b=_0x2d9791[_0x5d38e8(0x2c4)]?a23_0x3b54b8[_0x5d38e8(0x264)]('✔'):a23_0x3b54b8[_0x5d38e8(0x2c2)]('✘');let _0x5b3ad7='';if(_0x2d9791[_0x5d38e8(0x2c4)]&&_0x2d9791[_0x5d38e8(0x225)]!==undefined&&_0x2d9791[_0x5d38e8(0x2fb)]!==undefined){const _0x2c2071=_0x2d9791['customerPercent']?.[_0x5d38e8(0x2fe)](0x1)||'?',_0x181639=(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x32?a23_0x3b54b8['green']:(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x14?a23_0x3b54b8[_0x5d38e8(0x25e)]:a23_0x3b54b8['red'];_0x5b3ad7='\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2e6))+'\x20'+_0x181639(formatRows(_0x2d9791[_0x5d38e8(0x225)]))+'\x20('+_0x2c2071+_0x5d38e8(0x24f)+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x252))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1e6)](formatRows(_0x2d9791[_0x5d38e8(0x2fb)]));}console[_0x5d38e8(0x22f)](_0xb3007b+'\x20'+a23_0x3b54b8['bold'](_0x2d9791[_0x5d38e8(0x2e2)])+_0x5b3ad7),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2d0))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1fa)](_0x2d9791['database']+'.'+_0x2d9791[_0x5d38e8(0x2ee)]));const _0x522c66=_0x2d9791[_0x5d38e8(0x2e0)]===_0x2d9791['foreignKey']?a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x29a))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]:a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x1de))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]+_0x5d38e8(0x217)+_0x2d9791[_0x5d38e8(0x263)];console[_0x5d38e8(0x22f)]('\x20\x20'+_0x522c66),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x248))),this[_0x5d38e8(0x28a)](_0x2d9791[_0x5d38e8(0x20e)]),!_0x2d9791[_0x5d38e8(0x2c4)]&&console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8['red'](_0x5d38e8(0x208))+'\x20'+_0x2d9791[_0x5d38e8(0x236)]);}}[a23_0x277f3c(0x28a)](_0x4c8728){const _0xe8889a=a23_0x277f3c;for(const _0x4971be of _0x4c8728){_0x4971be[_0xe8889a(0x210)]===_0x4971be[_0xe8889a(0x29d)]||_0x4971be['column']==='*'?console[_0xe8889a(0x22f)]('\x20\x20\x20\x20-\x20'+_0x4971be[_0xe8889a(0x210)]):console[_0xe8889a(0x22f)](_0xe8889a(0x2aa)+_0x4971be[_0xe8889a(0x210)]+'\x20'+a23_0x3b54b8[_0xe8889a(0x1d6)]('('+_0x4971be[_0xe8889a(0x29d)]+')'));}}[a23_0x277f3c(0x1ef)](_0x1905c7){const _0x3742f4=a23_0x277f3c;console[_0x3742f4(0x22f)]('─'[_0x3742f4(0x2f9)](0x3c));if(_0x1905c7[_0x3742f4(0x2f2)]['length']>0x0){console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x2c2)](_0x3742f4(0x202)));for(const _0x334761 of _0x1905c7[_0x3742f4(0x2f2)]){console[_0x3742f4(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x3742f4(0x2c2)]('•')+'\x20'+_0x334761);}}_0x1905c7['allValid']&&console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x264)]('✔')+_0x3742f4(0x1e3));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x270);['description']=a23_0x277f3c(0x2c7);async['execute'](_0xbeabdf){const _0x4b6d18=a23_0x277f3c,{options:_0x3d9887,args:_0xe6830c,tdx:_0x3835dc}=_0xbeabdf,_0x398804=_0x3d9887,_0x590d04=_0xe6830c[0x0]||_0x3d9887[_0x4b6d18(0x2c3)];if(!_0x590d04)return showParentSegmentNotSetError(_0x4b6d18(0x2d6)+_0x4b6d18(0x244)+'Options\x20(one\x20required):\x0a'+_0x4b6d18(0x1ce)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4b6d18(0x2ff)+_0x4b6d18(0x231)+_0x4b6d18(0x2e8)),0x1;if(!_0x398804[_0x4b6d18(0x2a5)]&&!_0x398804[_0x4b6d18(0x304)]&&!_0x398804[_0x4b6d18(0x307)]&&!_0x398804[_0x4b6d18(0x2cb)])return console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2d1))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x216)),console['error']('Options:'),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2c8)),console['error'](_0x4b6d18(0x24a)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1e2)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1f7)),0x1;const _0x291d19=resolveYamlFile(_0x590d04);if(!existsSync(_0x291d19))return showFileNotFoundError(_0x291d19,_0x590d04),0x1;_0x398804['verbose']&&(console[_0x4b6d18(0x22f)](_0x4b6d18(0x1ff)+_0x398804[_0x4b6d18(0x278)]),console[_0x4b6d18(0x22f)]('YAML\x20file:\x20'+_0x291d19));let _0x24d62e;try{_0x24d62e=readFileSync(_0x291d19,'utf-8');}catch(_0x3f7e17){const _0x4679de=_0x3f7e17 instanceof Error?_0x3f7e17[_0x4b6d18(0x2ad)]:String(_0x3f7e17);return console['error'](_0x4b6d18(0x24b)+_0x4679de),0x1;}let _0x2b1820;try{_0x2b1820=parseDef(_0x24d62e);}catch(_0x4ac699){const _0x3868fb=_0x4ac699 instanceof Error?_0x4ac699[_0x4b6d18(0x2ad)]:String(_0x4ac699);return console[_0x4b6d18(0x22f)](a23_0x3b54b8['red'](_0x4b6d18(0x27f)+_0x3868fb)),0x1;}if(_0x398804[_0x4b6d18(0x304)]===!![]||_0x398804['attribute']===''){const _0x557b15=_0x2b1820[_0x4b6d18(0x204)]?.[_0x4b6d18(0x1d0)](_0x71f6f8=>_0x71f6f8[_0x4b6d18(0x2e2)])||[];if(_0x557b15['length']===0x0)console[_0x4b6d18(0x22f)](a23_0x3b54b8['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x20b))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2cf));for(const _0x5e7366 of _0x557b15){console['error']('\x20\x20'+a23_0x3b54b8['cyan'](_0x5e7366));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+_0x4b6d18(0x237)+_0x557b15[0x0]+'\x22');}return 0x1;}if(_0x398804['behavior']===!![]||_0x398804[_0x4b6d18(0x307)]===''){const _0x4476b1=_0x2b1820[_0x4b6d18(0x247)]?.[_0x4b6d18(0x1d0)](_0x4b3f68=>_0x4b3f68[_0x4b6d18(0x2e2)])||[];if(_0x4476b1['length']===0x0)console['error'](a23_0x3b54b8[_0x4b6d18(0x2c2)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2a7))),console[_0x4b6d18(0x22f)]('Available\x20behaviors:');for(const _0x534227 of _0x4476b1){console[_0x4b6d18(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x4b6d18(0x1e6)](_0x534227));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+'\x20--behavior\x20\x22'+_0x4476b1[0x0]+'\x22');}return 0x1;}const _0x47c4c4=createCommandSpinner(a23_0x3b54b8['dim'](_0x4b6d18(0x26f)),{'verbose':_0x398804['verbose']});_0x47c4c4[_0x4b6d18(0x1ea)]();const _0x1f1afc={'onProgress':_0x5e02bd=>{const _0x2e73f8=_0x4b6d18;_0x47c4c4[_0x2e73f8(0x2ed)]=formatProgressMessage(_0x5e02bd);}};if(_0x398804[_0x4b6d18(0x2a5)])_0x1f1afc['master']=!![];if(_0x398804['attribute']&&typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x304)]=_0x398804[_0x4b6d18(0x304)];if(_0x398804['behavior']&&typeof _0x398804[_0x4b6d18(0x307)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x307)]=_0x398804['behavior'];if(_0x398804['enriched'])_0x1f1afc[_0x4b6d18(0x2cb)]=!![];if(_0x398804[_0x4b6d18(0x2a2)])_0x1f1afc[_0x4b6d18(0x2a2)]=_0x398804[_0x4b6d18(0x2a2)];let _0x501333;try{_0x501333=await _0x3835dc[_0x4b6d18(0x1d8)]['previewParentYaml'](_0x24d62e,_0x1f1afc),_0x47c4c4[_0x4b6d18(0x2be)]();}catch(_0x432416){_0x47c4c4['stop']();throw _0x432416;}return await this[_0x4b6d18(0x2fa)](_0x501333,{'master':_0x398804[_0x4b6d18(0x2a5)],'attribute':typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1)?_0x398804['attribute']:undefined,'behavior':typeof _0x398804['behavior']===_0x4b6d18(0x2f1)?_0x398804['behavior']:undefined,'enriched':_0x398804['enriched']}),_0x501333['allValid']?0x0:0x1;}async[a23_0x277f3c(0x2fa)](_0x8515c0,_0x3805dd){const _0x124290=a23_0x277f3c;console['error']('\x0a'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x2f0))+'\x20'+_0x8515c0[_0x124290(0x2e2)]),console[_0x124290(0x22f)]('═'[_0x124290(0x2f9)](0x3c));if(_0x3805dd[_0x124290(0x2a5)]&&_0x8515c0[_0x124290(0x303)]){const _0x5e6337=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x26d))+'\x20'+a23_0x3b54b8['bold'](_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2b2)]+'.'+_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2ee)]);await this[_0x124290(0x2b1)](_0x5e6337,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x304)]&&_0x8515c0[_0x124290(0x303)]){const _0x862f70=a23_0x3b54b8['dim'](_0x124290(0x288))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd['attribute']);await this['displaySampleData'](_0x862f70,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x307)]&&_0x8515c0[_0x124290(0x303)]){const _0x131dd5=a23_0x3b54b8['dim']('Behavior:')+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd[_0x124290(0x307)]);await this[_0x124290(0x2b1)](_0x131dd5,_0x8515c0['sampleData']);}else{if(_0x3805dd[_0x124290(0x2cb)]&&_0x8515c0[_0x124290(0x303)]){const _0x27c49c=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x2c0))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x241));await this['displaySampleData'](_0x27c49c,_0x8515c0[_0x124290(0x303)]);}else!_0x8515c0[_0x124290(0x303)]&&console[_0x124290(0x22f)](_0x124290(0x2bf));}}}if(_0x8515c0[_0x124290(0x2f2)][_0x124290(0x1f9)]>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a23_0x3b54b8['red'](_0x124290(0x202)));for(const _0x1eb15f of _0x8515c0[_0x124290(0x2f2)]){console[_0x124290(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x124290(0x2c2)]('•')+'\x20'+_0x1eb15f);}}}async[a23_0x277f3c(0x2b1)](_0x533a2c,_0x419571){const _0x52d459=a23_0x277f3c;if(_0x419571[_0x52d459(0x1f9)]===0x0){console[_0x52d459(0x22f)]('\x0a'+_0x533a2c),console[_0x52d459(0x22f)](_0x52d459(0x2bb));return;}console[_0x52d459(0x22f)]('\x0a'+_0x533a2c);const _0x3e2b17=Object[_0x52d459(0x267)](_0x419571[0x0])['map'](_0x4f34f0=>({'name':_0x4f34f0,'type':typeof _0x419571[0x0][_0x4f34f0]===_0x52d459(0x279)?'double':_0x52d459(0x2bc)})),_0x7583fc={'queryId':_0x52d459(0x2e5),'columns':_0x3e2b17,'data':_0x419571,'stats':{'state':_0x52d459(0x1f0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x419571['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2d677c=formatAsTable(_0x7583fc,_0x419571[_0x52d459(0x1f9)],!![]);await writeOutput(_0x2d677c,undefined,_0x52d459(0x2ee));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]='segment:parent:run';[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1dd);async[a23_0x277f3c(0x21f)](_0xea5fcf){const _0x52ad0b=a23_0x277f3c,{options:_0x39e032,args:_0x4d92ed,tdx:_0x431850}=_0xea5fcf,_0x51f29e=_0x39e032,_0x5ab105=_0x4d92ed[0x0]||_0x39e032[_0x52ad0b(0x2c3)];if(!_0x5ab105)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x52ad0b(0x215)),0x1;const _0x2a1ea3=resolveYamlFile(_0x5ab105);if(existsSync(_0x2a1ea3)){_0x51f29e[_0x52ad0b(0x1db)]&&console[_0x52ad0b(0x22f)](_0x52ad0b(0x25f)+_0x2a1ea3);let _0x155efc;try{_0x155efc=readFileSync(_0x2a1ea3,_0x52ad0b(0x1fc));}catch(_0x5a4842){const _0x3aac89=_0x5a4842 instanceof Error?_0x5a4842[_0x52ad0b(0x2ad)]:String(_0x5a4842);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x24b)+_0x3aac89),0x1;}const _0x342bf0=await withSpinner(_0x52ad0b(0x229),()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2f4)](_0x155efc),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x25bd73=_0x342bf0['data'],{isNew:_0x19e178,name:_0x1758dc,hasChanges:_0x125ca3,diffFormatted:_0x57dc0b}=_0x25bd73;if(_0x125ca3){_0x19e178?console[_0x52ad0b(0x22f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x1758dc+'\x27:'):console[_0x52ad0b(0x22f)](_0x52ad0b(0x2dc)+_0x1758dc+'\x27:');console['error']('─'[_0x52ad0b(0x2f9)](0x3c)),console[_0x52ad0b(0x22f)](_0x57dc0b),console['error']('─'[_0x52ad0b(0x2f9)](0x3c));const _0x2406e9=_0x19e178?'Create\x20parent\x20segment\x20\x27'+_0x1758dc+_0x52ad0b(0x20a):_0x52ad0b(0x22b)+_0x1758dc+'\x27\x20and\x20run\x20workflow?';if(!_0x51f29e[_0x52ad0b(0x2b3)]){const _0x13de14=await confirmKey(_0x2406e9);if(!_0x13de14)return console['error'](_0x52ad0b(0x223)),0x1;}const _0x52c765=_0x19e178?_0x52ad0b(0x240):_0x52ad0b(0x1e5);await withSpinner(_0x52c765+_0x52ad0b(0x2cd)+_0x1758dc+'\x27...',()=>_0x25bd73[_0x52ad0b(0x2d2)](),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]});const _0x34ba22=_0x19e178?'Created':_0x52ad0b(0x220);console[_0x52ad0b(0x22f)]('✔\x20'+_0x34ba22+_0x52ad0b(0x2cd)+_0x1758dc+'\x27');}else console['error'](_0x52ad0b(0x2ae)+_0x1758dc+_0x52ad0b(0x269));}const _0xf8e14d=await withSpinner(_0x52ad0b(0x273)+_0x5ab105+'\x27...',()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2c6)](_0x5ab105),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x1b7fb1=_0xf8e14d['data'],_0x122ed8=getConsoleUrl(_0x51f29e[_0x52ad0b(0x278)],_0x52ad0b(0x200)+_0x1b7fb1['workflowId']+_0x52ad0b(0x27d)+_0x1b7fb1[_0x52ad0b(0x301)]+_0x52ad0b(0x28c)+_0x1b7fb1[_0x52ad0b(0x26e)]);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x300)),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)](_0x52ad0b(0x23a))+'\x20'+_0x1b7fb1[_0x52ad0b(0x258)]),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x52ad0b(0x293))+'\x20'+_0x1b7fb1[_0x52ad0b(0x260)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Session:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x301)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Attempt:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x26e)]),console[_0x52ad0b(0x22f)]('\x20\x20'+_0x122ed8),console[_0x52ad0b(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x52ad0b(0x256))+_0x52ad0b(0x20d)+_0x1b7fb1[_0x52ad0b(0x26e)]+_0x52ad0b(0x1ee)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a23_0x277f3c(0x1e8);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2ea);async[a23_0x277f3c(0x21f)](_0x3daa06){const _0x54d191=a23_0x277f3c,{options:_0x278015,args:_0x1152b2,tdx:_0x1c5bd7}=_0x3daa06,_0x4e1bf4=_0x1152b2[0x0]||_0x278015[_0x54d191(0x2c3)];if(!_0x4e1bf4)return showParentSegmentNotSetError(_0x54d191(0x2ac)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x278015[_0x54d191(0x1db)]&&(console[_0x54d191(0x22f)](_0x54d191(0x1ff)+_0x278015['site']),console[_0x54d191(0x22f)]('Parent\x20segment:\x20'+_0x4e1bf4));const _0x41d0d2=await withSpinner(_0x54d191(0x282)+_0x4e1bf4+_0x54d191(0x1d3),()=>_0x1c5bd7['segment'][_0x54d191(0x1e0)](_0x4e1bf4),{'verbose':_0x278015[_0x54d191(0x1db)]}),_0x3247d4=_0x41d0d2[_0x54d191(0x2b8)];console[_0x54d191(0x22f)]('✔\x20Found\x20'+_0x3247d4[_0x54d191(0x1f9)]+_0x54d191(0x28e)+(_0x3247d4[_0x54d191(0x1f9)]!==0x1?'s':''));if(_0x278015['json']||_0x278015['jsonl'])return await handleSDKOutput(_0x3247d4,_0x278015),0x0;return displayFieldsHumanReadable(_0x3247d4,_0x4e1bf4),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x27c);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x261);async[a23_0x277f3c(0x21f)](_0x341dd3){const _0xa70fde=a23_0x277f3c,{options:_0x39f364,args:_0x52f6ff,tdx:_0x4a335c}=_0x341dd3,_0x4eefc9=_0x39f364,_0x4bbf8f=_0x52f6ff[0x0]||_0x39f364[_0xa70fde(0x2c3)];if(!_0x4bbf8f)return showParentSegmentNotSetError(_0xa70fde(0x1eb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0xa70fde(0x285)+_0xa70fde(0x249)),0x1;_0x39f364['verbose']&&(console[_0xa70fde(0x22f)](_0xa70fde(0x1ff)+_0x39f364[_0xa70fde(0x278)]),console['error'](_0xa70fde(0x2eb)+_0x4bbf8f));const _0x2bbc05=await withSpinner(_0xa70fde(0x232)+_0x4bbf8f+'\x27...',()=>_0x4a335c[_0xa70fde(0x1d8)][_0xa70fde(0x2bd)](_0x4bbf8f),{'verbose':_0x39f364[_0xa70fde(0x1db)]}),_0x497869=_0x2bbc05[_0xa70fde(0x2b8)];if(_0x4eefc9[_0xa70fde(0x2b0)]){const _0x400641=getConsoleNextUrl(_0x4eefc9[_0xa70fde(0x278)],_0xa70fde(0x26c)+_0x497869['id']);return console[_0xa70fde(0x22f)](a23_0x3b54b8[_0xa70fde(0x264)]('✔')+_0xa70fde(0x2b7)+a23_0x3b54b8[_0xa70fde(0x1e6)](_0x400641)),openBrowser(_0x400641),0x0;}return await handleSingleObjectOutput(_0x497869,_0x39f364),0x0;}}function a23_0x31ab(_0x241fd4,_0x5cf95b){_0x241fd4=_0x241fd4-0x1ce;const _0x1c3770=a23_0x1c37();let _0x31ab54=_0x1c3770[_0x241fd4];return _0x31ab54;}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x23f);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2a1);async[a23_0x277f3c(0x21f)](_0x49e697){const _0x3a5ac9=a23_0x277f3c,{options:_0xbce695,args:_0x1833ac,tdx:_0x177ab6}=_0x49e697,_0x5c8981=_0x1833ac[0x0]||_0xbce695[_0x3a5ac9(0x2c3)];if(!_0x5c8981)return showParentSegmentNotSetError(_0x3a5ac9(0x1f3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0xbce695['verbose']&&(console[_0x3a5ac9(0x22f)](_0x3a5ac9(0x1ff)+_0xbce695[_0x3a5ac9(0x278)]),console[_0x3a5ac9(0x22f)]('Parent\x20segment:\x20'+_0x5c8981));const _0x8d97f5=await withSpinner(_0x3a5ac9(0x213)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6['segment'][_0x3a5ac9(0x2ba)](_0x5c8981),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0xff61bd=_0x8d97f5['data'],_0x495d4c=await withSpinner(_0x3a5ac9(0x234)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6[_0x3a5ac9(0x1d8)]['getParentSQL'](_0xff61bd),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0x1e31f2=await executeSchemaQuery(_0x495d4c['data'],_0x177ab6,_0xbce695);return await handleQueryOutput(_0x1e31f2,_0xbce695),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x266);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x271);async['execute'](_0x5cd95c){const _0x1e9126=a23_0x277f3c,{options:_0x10bc91,args:_0x527a9f,tdx:_0xa18cbe}=_0x5cd95c,_0x2bf3c3=_0x527a9f[0x0]||_0x10bc91[_0x1e9126(0x2c3)];if(!_0x2bf3c3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x10bc91['verbose']&&(console[_0x1e9126(0x22f)](_0x1e9126(0x1ff)+_0x10bc91[_0x1e9126(0x278)]),console['error'](_0x1e9126(0x2eb)+_0x2bf3c3));const _0x35212f=await withSpinner(_0x1e9126(0x213)+_0x2bf3c3+_0x1e9126(0x1d3),()=>_0xa18cbe['segment'][_0x1e9126(0x2ba)](_0x2bf3c3),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x23ec4a=_0x35212f[_0x1e9126(0x2b8)],_0xa868b4=await withSpinner(_0x1e9126(0x234)+_0x2bf3c3+'\x27...',()=>_0xa18cbe[_0x1e9126(0x1d8)][_0x1e9126(0x29f)](_0x23ec4a),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x46cdf2=_0xa868b4[_0x1e9126(0x2b8)];return _0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x22d)||_0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x26a)?await handleSDKOutput([{'sql':_0x46cdf2}],_0x10bc91):console[_0x1e9126(0x1da)](_0x46cdf2),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2f6);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x239);async[a23_0x277f3c(0x21f)](_0xa6d296){const _0x27885f=a23_0x277f3c,{options:_0x1ca982,args:_0x376c8e,tdx:_0x42c33a}=_0xa6d296,_0x5c30be=_0x376c8e[0x0]||_0x1ca982['parentSegment'];if(!_0x5c30be)return showParentSegmentNotSetError(_0x27885f(0x268)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x1ca982[_0x27885f(0x1db)]&&(console['error'](_0x27885f(0x1ff)+_0x1ca982[_0x27885f(0x278)]),console[_0x27885f(0x22f)](_0x27885f(0x2eb)+_0x5c30be));const _0x47c22e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c30be+_0x27885f(0x1d3),()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x2ba)](_0x5c30be),{'verbose':_0x1ca982[_0x27885f(0x1db)]}),_0x52dca3=_0x47c22e['data'],_0x530267=await withSpinner(_0x27885f(0x234)+_0x5c30be+'\x27...',()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x29f)](_0x52dca3),{'verbose':_0x1ca982[_0x27885f(0x1db)]});let _0x3459d9=_0x530267['data'];const _0xe9946c=resolveLimit(_0x1ca982['limit'],DEFAULT_DISPLAY_LIMIT),_0x896dc1=/\bLIMIT\s+\d+/i[_0x27885f(0x26b)](_0x3459d9);!_0x896dc1&&(_0x3459d9=_0x3459d9['trim']()[_0x27885f(0x29c)](/;+$/,''),_0x3459d9=_0x27885f(0x27b)+_0x3459d9+_0x27885f(0x25c)+_0xe9946c);_0x1ca982[_0x27885f(0x1db)]&&console[_0x27885f(0x22f)](_0x27885f(0x222)+_0x3459d9);const _0x51bb1e=await withProgressSpinner(_0x27885f(0x1e4),async _0x321a57=>{const _0x5d5586=_0x27885f,_0x487dff=await _0x42c33a[_0x5d5586(0x205)][_0x5d5586(0x21f)](_0x3459d9,{'catalog':'td','schema':'information_schema','onJobId':_0x347d53=>{const _0x836db6=_0x5d5586;_0x321a57[_0x836db6(0x21d)](_0x347d53);}});return _0x487dff;},{'verbose':_0x1ca982['verbose']}),_0x4c7b1d=_0x51bb1e[_0x27885f(0x2b8)],_0x20c28c=_0x4c7b1d[_0x27885f(0x211)]?_0x27885f(0x25b)+_0x4c7b1d[_0x27885f(0x211)]+']':'';return console[_0x27885f(0x22f)](_0x27885f(0x1cf)+_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x227)]['toLocaleString']()+_0x27885f(0x206)+(_0x27885f(0x283)+formatElapsed(_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x280)])+_0x20c28c)),await handleQueryOutput(_0x4c7b1d,_0x1ca982),0x0;}}
@@ -1 +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_0x205caa=a24_0x4d45;(function(_0x2ba375,_0xa86f72){const _0x3653be=a24_0x4d45,_0x50c2c4=_0x2ba375();while(!![]){try{const _0x35cf78=-parseInt(_0x3653be(0x205))/0x1+parseInt(_0x3653be(0x209))/0x2*(parseInt(_0x3653be(0x216))/0x3)+parseInt(_0x3653be(0x204))/0x4*(-parseInt(_0x3653be(0x201))/0x5)+parseInt(_0x3653be(0x21f))/0x6+-parseInt(_0x3653be(0x1e0))/0x7+-parseInt(_0x3653be(0x1ea))/0x8+parseInt(_0x3653be(0x228))/0x9;if(_0x35cf78===_0xa86f72)break;else _0x50c2c4['push'](_0x50c2c4['shift']());}catch(_0x1a41e0){_0x50c2c4['push'](_0x50c2c4['shift']());}}}(a24_0x50c7,0xdb0be));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0x5f2b90 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x5bba62 from'prompts';function a24_0x50c7(){const _0x4716a0=['\x27\x20does\x20not\x20exist.','password','log','customSite','Create\x20a\x20new\x20profile','join','\x27\x20created','profile','tdx.json','Default\x20profile\x20set\x20to:\x20','\x20Profile\x20\x27','377607CMQzFe','push','us01','Enter\x20profile\x20name:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','value','\x27\x20requires\x20API\x20key\x20validation.','create','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','3227910CLomOB','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','logLevel','apiKey','\x20\x20-\x20','parent_segment','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Remove\x20a\x20profile','29378223nSYExe','includes','llm_project','\x0aAvailable\x20profiles:','confirm','profile:set','Enter\x20your\x20TD\x20API\x20key:','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20remove','\x20\x20(no\x20profiles\x20found)','Enter\x20custom\x20site','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSetup\x20cancelled','Profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','select','VALID_KEYS','getUserInfo','name','error','\x20\x20tdx\x20--profile\x20','text','Enter\x20site\x20name:','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','site','test','✗\x20Validation\x20failed:\x20','profile:use','Validating\x20API\x20key...','split','red','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','ERROR','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','session','Site\x20was\x20not\x20changed.','(cleared)','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','trim','eu01','bold','default','7697095yLrzKI','dim','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us\x20\x20\x20-\x20United\x20States','ap02\x20-\x20Korea','/app/mp/ak','findIndex','jp\x20\x20\x20-\x20Japan','execute','yellow','6368600kEyZVR','tdx:\x20profile\x20set','jp01','Failed\x20to\x20remove\x20profile:\x20','database','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','other','(session:\x20','Site\x20name\x20cannot\x20be\x20empty','Set\x20session\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','message','warn','validate','profileName','profile:remove','email','length','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20create','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','green','jobs','11635APTudu','toString','eu\x20\x20\x20-\x20Europe','796dIjnbK','672154xrBLle','Removal\x20cancelled','status','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','2zwtgCt','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.'];a24_0x50c7=function(){return _0x4716a0;};return a24_0x50c7();}import a24_0x5b98b0 from'chalk';function validateProfileName(_0x27d465){const _0xfc8579=a24_0x4d45;if(!_0x27d465||!_0x27d465[_0xfc8579(0x1dc)]())return _0xfc8579(0x1bd);const _0xee8c49=_0x27d465['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0xfc8579(0x1cc)](_0xee8c49))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0xee8c49))return _0xfc8579(0x1bc)+_0xee8c49+_0xfc8579(0x20a);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x205caa(0x220)]=a24_0x205caa(0x20f);async['execute'](_0x266516){const _0x2685bc=a24_0x205caa,{options:_0x2fb768,args:_0x5a74cb}=_0x266516;console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1de)](_0x2685bc(0x1fd)));let _0x5a7eeb;if(_0x5a74cb[_0x2685bc(0x1fb)]>0x0&&_0x5a74cb[0x0]){const _0x1bc143=_0x5a74cb[0x0][_0x2685bc(0x1dc)](),_0x55e10a=validateProfileName(_0x1bc143);if(_0x55e10a!==!![])return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x55e10a)),0x1;_0x5a7eeb=_0x1bc143;}else{const _0x8bd24=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x1f8),'message':_0x2685bc(0x219),'validate':validateProfileName});if(!_0x8bd24[_0x2685bc(0x1f8)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;_0x5a7eeb=_0x8bd24['profileName'][_0x2685bc(0x1dc)]();}const _0x5b694b=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x220),'message':_0x2685bc(0x1c6)}),_0xf28d44=_0x5b694b[_0x2685bc(0x220)]?.['trim']()||undefined,_0x20003b=_0x2fb768[_0x2685bc(0x1cb)]||_0x2685bc(0x218),_0x348e01=[{'title':_0x2685bc(0x1e3),'value':_0x2685bc(0x218)},{'title':_0x2685bc(0x1e7),'value':_0x2685bc(0x1ec)},{'title':_0x2685bc(0x203),'value':_0x2685bc(0x1dd)},{'title':_0x2685bc(0x1e4),'value':'ap02'}];let _0x891e62=_0x348e01[_0x2685bc(0x1e6)](_0x37adcb=>_0x37adcb[_0x2685bc(0x21b)]===_0x20003b);_0x891e62===-0x1&&_0x20003b!==_0x2685bc(0x218)&&(_0x348e01[_0x2685bc(0x217)]({'title':_0x20003b,'value':_0x20003b}),_0x891e62=_0x348e01[_0x2685bc(0x1fb)]-0x1);_0x348e01[_0x2685bc(0x217)]({'title':_0x2685bc(0x1b9),'value':_0x2685bc(0x1f0)});const _0x3f621a=await a24_0x5bba62({'type':_0x2685bc(0x1be),'name':'site','message':_0x2685bc(0x1fe)+_0x5a7eeb+'\x27:','choices':_0x348e01,'initial':_0x891e62>=0x0?_0x891e62:0x0});if(!_0x3f621a[_0x2685bc(0x1cb)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;let _0x3567b1;if(_0x3f621a[_0x2685bc(0x1cb)]===_0x2685bc(0x1f0)){const _0x1d261a=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':'customSite','message':_0x2685bc(0x1c5),'initial':_0x2685bc(0x218),'validate':_0xc5a508=>{const _0x28e780=_0x2685bc;if(!_0xc5a508||!_0xc5a508['trim']())return _0x28e780(0x1f2);if(!/^[a-z0-9-]+$/[_0x28e780(0x1cc)](_0xc5a508['trim']()))return _0x28e780(0x1c9);return!![];}});if(!_0x1d261a['customSite'])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;_0x3567b1=_0x1d261a[_0x2685bc(0x20e)];}else _0x3567b1=_0x3f621a['site'];const _0x13731f=resolveSite(_0x3567b1);console[_0x2685bc(0x20d)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x13731f),console[_0x2685bc(0x20d)](_0x2685bc(0x22f)),console[_0x2685bc(0x20d)]('\x20\x20'+getConsoleUrl(_0x13731f,_0x2685bc(0x1e5)));const _0x2ba9ad=await a24_0x5bba62({'type':_0x2685bc(0x20c),'name':_0x2685bc(0x223),'message':_0x2685bc(0x22e),'validate':_0x50b282=>{const _0x5e584b=_0x2685bc;if(!_0x50b282||!_0x50b282[_0x5e584b(0x1dc)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2ba9ad[_0x2685bc(0x223)])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;const _0x34eea9=_0x2ba9ad[_0x2685bc(0x223)];console[_0x2685bc(0x20d)](_0x2685bc(0x1cf));try{const _0x1ea621=TDX[_0x2685bc(0x21d)]({'site':_0x13731f,'apiKey':_0x34eea9['trim'](),'logLevel':_0x2fb768[_0x2685bc(0x222)]??LogLevel[_0x2685bc(0x1d3)]}),_0x3d3387=await _0x1ea621[_0x2685bc(0x200)]['getUserInfo']();console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d3387[_0x2685bc(0x1fa)]+')');const _0xc7d0b1=await isKeychainAvailable();_0xc7d0b1?(await saveAPIKeyAsync(_0x34eea9[_0x2685bc(0x1dc)](),_0x13731f,_0x5a7eeb),console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+_0x2685bc(0x1ef)+_0x5a7eeb+')')):(console['warn'](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1c8))),console[_0x2685bc(0x1f6)](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1d4))));const _0x38922e={'site':_0x13731f,..._0xf28d44&&{'description':_0xf28d44}};return saveProfileToUserConfig(_0x5a7eeb,_0x38922e),console['log'](a24_0x5b98b0['green']('✓')+'\x20Profile\x20\x27'+_0x5a7eeb+_0x2685bc(0x211)),console[_0x2685bc(0x20d)](),console['log'](_0x2685bc(0x1ca)),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+_0x2685bc(0x1da)),0x0;}catch(_0x2168f3){if(_0x2168f3 instanceof HTTPClientError&&_0x2168f3[_0x2685bc(0x207)]===0x191)return printAuthError(_0x2168f3),0x1;return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x2685bc(0x1cd)+(_0x2168f3 instanceof Error?_0x2168f3[_0x2685bc(0x1f5)]:String(_0x2168f3)))),console[_0x2685bc(0x1c2)](_0x2685bc(0x208)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1f9);[a24_0x205caa(0x220)]=a24_0x205caa(0x227);[a24_0x205caa(0x1f7)](_0x4ceb69){const _0x2c13bc=a24_0x205caa,{args:_0x59ca9f}=_0x4ceb69;if(_0x59ca9f[_0x2c13bc(0x1fb)]===0x0)return _0x2c13bc(0x1d6);return undefined;}async[a24_0x205caa(0x1e8)](_0x2a7928){const _0x334238=a24_0x205caa,{args:_0x341c0b}=_0x2a7928,_0xfda6c3=_0x341c0b[0x0];console['log'](a24_0x5b98b0['bold'](_0x334238(0x230)));if(!profileExists(_0xfda6c3)){console['error'](a24_0x5b98b0['red'](_0x334238(0x1bc)+_0xfda6c3+_0x334238(0x20b))),console[_0x334238(0x20d)](_0x334238(0x22b));const _0x2f80a7=listProfiles();if(_0x2f80a7[_0x334238(0x1fb)]===0x0)console[_0x334238(0x20d)](_0x334238(0x1b8));else for(const _0x10a981 of _0x2f80a7){console[_0x334238(0x20d)]('\x20\x20-\x20'+_0x10a981[_0x334238(0x1c1)]);}return 0x1;}const _0x21e342=await a24_0x5bba62({'type':_0x334238(0x22c),'name':_0x334238(0x22c),'message':_0x334238(0x1ba)+_0xfda6c3+'\x27?','initial':![]});if(!_0x21e342['confirm'])return console[_0x334238(0x20d)](_0x334238(0x206)),0x0;try{removeProfileFromUserConfig(_0xfda6c3),console[_0x334238(0x20d)](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x215)+_0xfda6c3+_0x334238(0x1fc));}catch(_0x407956){return console[_0x334238(0x1c2)](a24_0x5b98b0['red'](_0x334238(0x1ed)+(_0x407956 instanceof Error?_0x407956[_0x334238(0x1f5)]:String(_0x407956)))),0x1;}const _0x1db22d=await isKeychainAvailable();if(_0x1db22d){const _0x231490=await deleteKeychainAPIKey(_0xfda6c3);_0x231490&&console['log'](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x221));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x22d);[a24_0x205caa(0x220)]='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x205caa(0x1bf)]=['site',a24_0x205caa(0x1ee),a24_0x205caa(0x225),a24_0x205caa(0x22a),'llm_agent','description'];[a24_0x205caa(0x1f7)](_0x2d8ce0){const _0x491e4a=a24_0x205caa,{args:_0x32fb7f,options:_0x25e9ba}=_0x2d8ce0,_0x4b47cc=_0x25e9ba[_0x491e4a(0x212)]||getActiveProfile();if(!_0x4b47cc)return _0x491e4a(0x1d2);if(_0x32fb7f[_0x491e4a(0x1fb)]===0x0)return _0x491e4a(0x21e)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const _0x8e921=_0x32fb7f[0x0];if(!_0x8e921[_0x491e4a(0x229)]('='))return _0x491e4a(0x1e2)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const [_0x9a8212]=_0x8e921[_0x491e4a(0x1d0)]('=',0x2);if(!ProfileSetCommand[_0x491e4a(0x1bf)][_0x491e4a(0x229)](_0x9a8212))return'Unknown\x20key\x20\x27'+_0x9a8212+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');return undefined;}async[a24_0x205caa(0x1e8)](_0x3cc1e6){const _0x1f3339=a24_0x205caa,{args:_0x5870f1,options:_0x3f07d7}=_0x3cc1e6,_0x86ef11=_0x3f07d7[_0x1f3339(0x212)]||getActiveProfile(),[_0x6ad09f,..._0x2a3023]=_0x5870f1[0x0][_0x1f3339(0x1d0)]('='),_0x526f92=_0x2a3023[_0x1f3339(0x210)]('=');console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1de)](_0x1f3339(0x1eb)));if(!profileExists(_0x86ef11)){const _0x811cbb=await a24_0x5bba62({'type':_0x1f3339(0x22c),'name':'create','message':_0x1f3339(0x1bc)+_0x86ef11+_0x1f3339(0x1f4),'initial':!![]});if(!_0x811cbb[_0x1f3339(0x21d)])return console[_0x1f3339(0x20d)]('Operation\x20cancelled'),0x1;}const _0x580526=loadProfile(_0x86ef11),_0x27df9e=_0x580526?.[_0x1f3339(0x1db)]||{};if(_0x6ad09f===_0x1f3339(0x1cb)){const _0x57c9b2=resolveSite(_0x526f92);console[_0x1f3339(0x20d)](_0x1f3339(0x1c7)+_0x57c9b2+_0x1f3339(0x21c)),console[_0x1f3339(0x20d)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1f3339(0x20d)]('\x20\x20'+getConsoleUrl(_0x57c9b2,_0x1f3339(0x1e5)));const _0x5e3451=await a24_0x5bba62({'type':_0x1f3339(0x20c),'name':_0x1f3339(0x223),'message':_0x1f3339(0x21a),'validate':_0x20d0de=>{if(!_0x20d0de||!_0x20d0de['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5e3451[_0x1f3339(0x223)])return console[_0x1f3339(0x20d)]('\x0aOperation\x20cancelled'),0x1;console[_0x1f3339(0x20d)](_0x1f3339(0x1cf));try{const _0x32a455=TDX['create']({'site':_0x57c9b2,'apiKey':_0x5e3451['apiKey'][_0x1f3339(0x1dc)](),'logLevel':_0x3f07d7[_0x1f3339(0x222)]??LogLevel['ERROR']}),_0x3c8928=await _0x32a455[_0x1f3339(0x200)][_0x1f3339(0x1c0)]();console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x1d5)+_0x3c8928[_0x1f3339(0x1fa)]+')');const _0x9d7bac=await isKeychainAvailable();_0x9d7bac?(await saveAPIKeyAsync(_0x5e3451['apiKey']['trim'](),_0x57c9b2,_0x86ef11),console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x226))):console[_0x1f3339(0x1f6)](a24_0x5b98b0[_0x1f3339(0x1e9)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x27df9e[_0x1f3339(0x1cb)]=_0x57c9b2;}catch(_0x140676){if(_0x140676 instanceof HTTPClientError&&_0x140676['status']===0x191)return printAuthError(_0x140676),0x1;return console['error'](a24_0x5b98b0[_0x1f3339(0x1d1)](_0x1f3339(0x1cd)+(_0x140676 instanceof Error?_0x140676['message']:String(_0x140676)))),console[_0x1f3339(0x1c2)](_0x1f3339(0x1d8)),0x1;}}else _0x27df9e[_0x6ad09f]=_0x526f92||undefined;return saveProfileToUserConfig(_0x86ef11,_0x27df9e),console['log'](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+'\x20Profile\x20\x27'+_0x86ef11+'\x27\x20updated:\x20'+_0x6ad09f+'='+(_0x526f92||_0x1f3339(0x1d9))),0x0;}}function a24_0x4d45(_0x360aab,_0x51a32e){_0x360aab=_0x360aab-0x1b8;const _0x50c7fd=a24_0x50c7();let _0x4d458f=_0x50c7fd[_0x360aab];return _0x4d458f;}export class ProfileUseCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1ce);[a24_0x205caa(0x220)]=a24_0x205caa(0x1f3);['validate'](_0x5a909f){const _0xd81bac=a24_0x205caa,{args:_0x2c26e0}=_0x5a909f;if(_0x2c26e0[_0xd81bac(0x1fb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x205caa(0x1e8)](_0x2e301c){const _0x4972bc=a24_0x205caa,{args:_0x3980d1,options:_0xc9ebe9}=_0x2e301c,_0x3dc70b=_0x3980d1[0x0],_0x2aac15=_0xc9ebe9[_0x4972bc(0x1df)];cleanExpiredSessions();if(!profileExists(_0x3dc70b)){console[_0x4972bc(0x1c2)](a24_0x5b98b0[_0x4972bc(0x1d1)](_0x4972bc(0x1bc)+_0x3dc70b+_0x4972bc(0x20b))),console[_0x4972bc(0x20d)]('\x0aAvailable\x20profiles:');const _0x189dda=listProfiles();if(_0x189dda[_0x4972bc(0x1fb)]===0x0)console[_0x4972bc(0x20d)](_0x4972bc(0x1b8));else for(const _0x351b01 of _0x189dda){console['log'](_0x4972bc(0x224)+_0x351b01[_0x4972bc(0x1c1)]);}return 0x1;}if(_0x2aac15){const _0x725665=a24_0x5f2b90[_0x4972bc(0x210)](getConfigDir(),_0x4972bc(0x213));return saveActiveProfileToUserConfig(_0x3dc70b),console['log'](_0x4972bc(0x214)+a24_0x5b98b0[_0x4972bc(0x1ff)](_0x3dc70b)),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aSaved\x20to:\x20'+_0x725665)),0x0;}const _0x22a78a=_0xc9ebe9[_0x4972bc(0x1d7)]||getCurrentSessionPID()[_0x4972bc(0x202)]();return saveSessionContext({'profile':_0x3dc70b},_0xc9ebe9[_0x4972bc(0x1d7)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a24_0x5b98b0['green'](_0x3dc70b)+'\x20'+a24_0x5b98b0[_0x4972bc(0x1e1)](_0x4972bc(0x1f1)+_0x22a78a+')')),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3dc70b+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +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
+ const a25_0x216c0c=a25_0x3ba0;function a25_0x3ba0(_0x97c13b,_0x47f9a5){_0x97c13b=_0x97c13b-0xd8;const _0x1be61c=a25_0x1be6();let _0x3ba077=_0x1be61c[_0x97c13b];return _0x3ba077;}(function(_0x33c8c3,_0xe8fa97){const _0x49e5ad=a25_0x3ba0,_0x4a04dd=_0x33c8c3();while(!![]){try{const _0x333efa=-parseInt(_0x49e5ad(0xdd))/0x1*(parseInt(_0x49e5ad(0xd8))/0x2)+parseInt(_0x49e5ad(0xe2))/0x3+-parseInt(_0x49e5ad(0xe7))/0x4+parseInt(_0x49e5ad(0xe4))/0x5*(-parseInt(_0x49e5ad(0xe6))/0x6)+-parseInt(_0x49e5ad(0xdc))/0x7*(-parseInt(_0x49e5ad(0xe0))/0x8)+parseInt(_0x49e5ad(0xdb))/0x9+parseInt(_0x49e5ad(0xea))/0xa*(parseInt(_0x49e5ad(0xdf))/0xb);if(_0x333efa===_0xe8fa97)break;else _0x4a04dd['push'](_0x4a04dd['shift']());}catch(_0x329f42){_0x4a04dd['push'](_0x4a04dd['shift']());}}}(a25_0x1be6,0x676cb));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a25_0x216c0c(0xec)]=a25_0x216c0c(0xe5);async['execute'](_0x37b531){const _0x1a279e=a25_0x216c0c,{options:_0x52c0d9}=_0x37b531;try{const _0x56b46a=listProfiles(),_0x3eea7f=getActiveProfile();if(_0x56b46a[_0x1a279e(0xeb)]===0x0)return console[_0x1a279e(0xde)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x1a279e(0xed)),console['log'](_0x1a279e(0xe1)),0x0;const _0x2fea1a=_0x56b46a['map'](_0x124688=>{const _0x5b8a88=_0x1a279e,_0x1bbaea=_0x124688[_0x5b8a88(0xe3)]===_0x3eea7f,_0x4fc05a=getProfileParams(_0x124688[_0x5b8a88(0xe9)]);return{'name':_0x124688[_0x5b8a88(0xe3)],'active':_0x1bbaea,'scope':_0x124688[_0x5b8a88(0xe8)],'description':_0x124688[_0x5b8a88(0xe9)][_0x5b8a88(0xec)]||'','params':_0x4fc05a};});return await handleSDKOutput(_0x2fea1a,_0x52c0d9),0x0;}catch(_0x906d4d){return _0x906d4d instanceof Error&&console[_0x1a279e(0xda)]('Error:\x20'+_0x906d4d[_0x1a279e(0xd9)]),0x1;}}}function a25_0x1be6(){const _0x4d75e9=['config','152980jSDnNp','length','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','37010IldXiw','message','error','862983cgceKb','7KixLRh','45jWGOzG','log','1221UbILmI','848440xbgOLX','\x20\x20Global:\x20~/.config/tdx/tdx.json','663255CnYfKK','name','889135LvYCTi','List\x20all\x20available\x20profiles','12XkJsZV','2036396RbTdjY','scope'];a25_0x1be6=function(){return _0x4d75e9;};return a25_0x1be6();}
@@ -1 +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_0x4402e4=a26_0x2b6a;(function(_0x554d54,_0x3ff54e){const _0xfcd5c6=a26_0x2b6a,_0x1495a8=_0x554d54();while(!![]){try{const _0x99ba8a=parseInt(_0xfcd5c6(0xe6))/0x1+parseInt(_0xfcd5c6(0xdf))/0x2+-parseInt(_0xfcd5c6(0x101))/0x3*(-parseInt(_0xfcd5c6(0xe9))/0x4)+-parseInt(_0xfcd5c6(0xff))/0x5+parseInt(_0xfcd5c6(0xf2))/0x6+-parseInt(_0xfcd5c6(0xf8))/0x7*(parseInt(_0xfcd5c6(0xdc))/0x8)+parseInt(_0xfcd5c6(0x103))/0x9*(-parseInt(_0xfcd5c6(0xe5))/0xa);if(_0x99ba8a===_0x3ff54e)break;else _0x1495a8['push'](_0x1495a8['shift']());}catch(_0x4042be){_0x1495a8['push'](_0x1495a8['shift']());}}}(a26_0x2cb9,0xaa4f7));function a26_0x2b6a(_0x2504f1,_0x182040){_0x2504f1=_0x2504f1-0xda;const _0x2cb9de=a26_0x2cb9();let _0x2b6ac4=_0x2cb9de[_0x2504f1];return _0x2b6ac4;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a26_0x2cb9(){const _0x4d23ad=['15xPbbVp','\x20[Job\x20ID:\x20','88227PJHOiC','Executing\x20query...','processedRows','error','totalSplits','in\x20','catalog','Executing\x20statement\x20','options','length','jobId','setJobId','7408tmUzfq','Error:\x20','Site:\x20','922800hqupqH','database','\x0aAll\x20results\x20saved\x20to\x20','\x20-\x20','data','file','1010RxtPQR','1057411xLgpQq','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','name','712688MLlEPq','elapsedTimeMillis','args','\x20rows\x20','Schema:\x20','query','Query\x20completed:\x20Processed\x20','Catalog:\x20','execute','4458978KYiIXg','verbose','No\x20SQL\x20provided','Statement\x20','completedSplits','site','7385gdtcTj','SQL:\x20','output','Run\x20Trino\x20queries\x20(streaming)','validate','\x20splits','stats','2441050LoLTuE','push'];a26_0x2cb9=function(){return _0x4d23ad;};return a26_0x2cb9();}export class QueryCommand extends BaseCommand{[a26_0x4402e4(0xe8)]=a26_0x4402e4(0xee);['description']=a26_0x4402e4(0xfb);async[a26_0x4402e4(0xf1)](_0x5073f0){const _0x259bd0=a26_0x4402e4,{options:_0x5e7855,args:_0x278ec9,tdx:_0x3d080d}=_0x5073f0,_0x23ab52=_0x278ec9[0x0],_0x16a31a=_0x5e7855[_0x259bd0(0xe4)];let _0x802af2;try{if(_0x16a31a)_0x802af2=readSqlStatementsFromFile(_0x16a31a);else{if(_0x23ab52==='-')_0x802af2=await readSqlStatementsFromStdin();else{if(_0x23ab52&&isSqlFilePath(_0x23ab52))_0x802af2=readSqlStatementsFromFile(_0x23ab52);else{if(_0x23ab52)_0x802af2=splitSqlStatements(_0x23ab52);else throw new Error(_0x259bd0(0xf4));}}}}catch(_0x4d9ffc){return console[_0x259bd0(0x106)](_0x259bd0(0xdd)+_0x4d9ffc['message']),0x1;}const _0x2dee46=_0x5e7855[_0x259bd0(0xe0)]||'information_schema',_0x2197d6=_0x5e7855[_0x259bd0(0x109)];try{const _0x457641=[],_0x4cd6fa=!!_0x5e7855[_0x259bd0(0xfa)];for(let _0x49d0a0=0x0;_0x49d0a0<_0x802af2[_0x259bd0(0x10c)];_0x49d0a0++){const _0x21d951=_0x802af2[_0x49d0a0],_0x85d2ff=_0x49d0a0+0x1,_0x19573e=_0x802af2[_0x259bd0(0x10c)],_0x6ff6cc=_0x19573e>0x1;_0x5e7855[_0x259bd0(0xf3)]&&(console[_0x259bd0(0x106)]('\x0a'+(_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+':':'')),console[_0x259bd0(0x106)](_0x259bd0(0xde)+_0x5e7855[_0x259bd0(0xf7)]),console[_0x259bd0(0x106)](_0x259bd0(0xf0)+(_0x2197d6||'td')),console['error'](_0x259bd0(0xed)+_0x2dee46),console['error'](_0x259bd0(0xf9)+_0x21d951));const _0x1e6f43=_0x6ff6cc?_0x259bd0(0x10a)+_0x85d2ff+'/'+_0x19573e+'...':_0x259bd0(0x104);try{const _0x4e93b8=await withProgressSpinner(_0x1e6f43,async _0x5d9dc6=>{const _0x4758d0=await _0x3d080d['query']['execute'](_0x21d951,{'catalog':_0x2197d6,'schema':_0x2dee46,'onJobId':_0x4c91bc=>{const _0x817481=a26_0x2b6a;_0x5d9dc6[_0x817481(0xdb)](_0x4c91bc);},'onProgress':_0x5b7a68=>{const _0x460a05=a26_0x2b6a;_0x5d9dc6['setPhase']('Executing\x20query\x20['+_0x5b7a68['state']+']'),_0x5d9dc6['setExtra'](formatRows(_0x5b7a68['processedRows'])+_0x460a05(0xec)+_0x5b7a68[_0x460a05(0xf6)]+'/'+_0x5b7a68[_0x460a05(0x107)]+_0x460a05(0xfd));}});return _0x4758d0;},{'verbose':_0x5e7855[_0x259bd0(0xf3)]}),_0x57eadc=_0x4e93b8[_0x259bd0(0xe3)],_0x52696d=_0x57eadc['jobId']?_0x259bd0(0x102)+_0x57eadc[_0x259bd0(0xda)]+']':'',_0x2fe8f3=_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+_0x259bd0(0xe2):'';console['error']('✔\x20'+_0x2fe8f3+_0x259bd0(0xef)+formatRows(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0x105)])+_0x259bd0(0xec)+(_0x259bd0(0x108)+formatElapsed(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0xea)])+_0x52696d));if(_0x6ff6cc&&_0x4cd6fa){const _0x53a5d6=resolveOutputOptions(_0x5e7855),_0x588a10=await formatQueryOutput(_0x57eadc,_0x53a5d6);_0x457641[_0x259bd0(0x100)](_0x588a10);}else await handleQueryOutput(_0x57eadc,_0x5e7855);}catch(_0x81ecb3){const _0x582818=_0x6ff6cc?'Statement\x20'+_0x85d2ff+'/'+_0x19573e+':\x0a':'',_0xa7cfb6=_0x81ecb3 instanceof SDKError?_0x81ecb3['originalMessage']:_0x81ecb3['message'];return console[_0x259bd0(0x106)](''+_0x582818+_0xa7cfb6),0x1;}}if(_0x802af2[_0x259bd0(0x10c)]>0x1&&_0x4cd6fa&&_0x457641['length']>0x0){const _0x2deea8=_0x457641['join']('\x0a');writeFileSync(_0x5e7855['output'],_0x2deea8),console['error'](_0x259bd0(0xe1)+_0x5e7855[_0x259bd0(0xfa)]);}return 0x0;}catch(_0x493cd6){throw _0x493cd6;}}[a26_0x4402e4(0xfc)](_0xfc7ddc){const _0x68fb88=a26_0x4402e4,_0x29d776=_0xfc7ddc[_0x68fb88(0xeb)][0x0],_0x30bee6=_0xfc7ddc[_0x68fb88(0x10b)][_0x68fb88(0xe4)];if(!_0x29d776&&!_0x30bee6)return _0x68fb88(0xe7);if(_0x29d776&&_0x30bee6)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}