@treasuredata/tdx 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.d.ts +9 -0
  14. package/dist/commands/claude-command.d.ts.map +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-command.js.map +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/job-command.js +1 -1
  25. package/dist/commands/journey-command.js +1 -1
  26. package/dist/commands/journey-validate-command.js +1 -1
  27. package/dist/commands/llm-command.d.ts +12 -0
  28. package/dist/commands/llm-command.d.ts.map +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-command.js.map +1 -1
  31. package/dist/commands/llm-proxy.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/use-command.js +1 -1
  52. package/dist/commands/user-command.js +1 -1
  53. package/dist/commands/workflow-command.js +1 -1
  54. package/dist/core/auth.js +1 -1
  55. package/dist/core/command-output.js +1 -1
  56. package/dist/core/config.d.ts +5 -0
  57. package/dist/core/config.d.ts.map +1 -1
  58. package/dist/core/config.js +1 -1
  59. package/dist/core/config.js.map +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/anthropic-adapter.js +1 -1
  77. package/dist/proxy/claude-usage-tracker.js +1 -1
  78. package/dist/proxy/context-signature.js +1 -1
  79. package/dist/proxy/conversation-utils.js +1 -1
  80. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  81. package/dist/proxy/passthrough-server.js +1 -1
  82. package/dist/proxy/passthrough-server.js.map +1 -1
  83. package/dist/proxy/server.js +1 -1
  84. package/dist/proxy/session-cache.js +1 -1
  85. package/dist/proxy/sse-usage-parser.js +1 -1
  86. package/dist/sdk/agent/agent-config.js +1 -1
  87. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  88. package/dist/sdk/agent/agent-yaml.js +1 -1
  89. package/dist/sdk/agent/test/evaluator.js +1 -1
  90. package/dist/sdk/agent/test/executor.js +1 -1
  91. package/dist/sdk/agent/test/index.js +1 -1
  92. package/dist/sdk/agent/test/output.js +1 -1
  93. package/dist/sdk/agent/test/parser.js +1 -1
  94. package/dist/sdk/api.js +1 -1
  95. package/dist/sdk/client/cdp-api-client.js +1 -1
  96. package/dist/sdk/client/endpoints.js +1 -1
  97. package/dist/sdk/client/engage-api-client.js +1 -1
  98. package/dist/sdk/client/http-client.js +1 -1
  99. package/dist/sdk/client/llm-api-client.d.ts +7 -1
  100. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  101. package/dist/sdk/client/llm-api-client.js +1 -1
  102. package/dist/sdk/client/llm-api-client.js.map +1 -1
  103. package/dist/sdk/client/rate-limiter.js +1 -1
  104. package/dist/sdk/client/td-api-client.js +1 -1
  105. package/dist/sdk/client/trino-api-client.js +1 -1
  106. package/dist/sdk/client/workflow-client.js +1 -1
  107. package/dist/sdk/connection-validator.js +1 -1
  108. package/dist/sdk/connection.js +1 -1
  109. package/dist/sdk/engage.js +1 -1
  110. package/dist/sdk/errors.js +1 -1
  111. package/dist/sdk/index.js +1 -1
  112. package/dist/sdk/index.js.map +1 -1
  113. package/dist/sdk/io/index.js +1 -1
  114. package/dist/sdk/io/node-filesystem.js +1 -1
  115. package/dist/sdk/job.js +1 -1
  116. package/dist/sdk/journey.js +1 -1
  117. package/dist/sdk/llm/chat-cache.js +1 -1
  118. package/dist/sdk/llm/index.d.ts +15 -1
  119. package/dist/sdk/llm/index.d.ts.map +1 -1
  120. package/dist/sdk/llm/index.js +1 -1
  121. package/dist/sdk/llm/index.js.map +1 -1
  122. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  123. package/dist/sdk/llm/model-aliases.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/query/index.js +1 -1
  126. package/dist/sdk/query/sql-parser.js +1 -1
  127. package/dist/sdk/schedule.js +1 -1
  128. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  129. package/dist/sdk/segment/fields-display.js +1 -1
  130. package/dist/sdk/segment/file-discovery.js +1 -1
  131. package/dist/sdk/segment/journey-utils.js +1 -1
  132. package/dist/sdk/segment/journey-yaml.js +1 -1
  133. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  134. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  135. package/dist/sdk/segment/pull-workflow.js +1 -1
  136. package/dist/sdk/segment/push-workflow.js +1 -1
  137. package/dist/sdk/segment/resolution-context.js +1 -1
  138. package/dist/sdk/segment/segment-path-parser.js +1 -1
  139. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  140. package/dist/sdk/segment/target-resolution.js +1 -1
  141. package/dist/sdk/segment/tdx-config.js +1 -1
  142. package/dist/sdk/segment/validate-files.js +1 -1
  143. package/dist/sdk/segment/yaml-validator.js +1 -1
  144. package/dist/sdk/segment.js +1 -1
  145. package/dist/sdk/types/index.d.ts +1 -1
  146. package/dist/sdk/types/index.d.ts.map +1 -1
  147. package/dist/sdk/types/index.js +1 -1
  148. package/dist/sdk/types/index.js.map +1 -1
  149. package/dist/sdk/types/llm.d.ts +8 -0
  150. package/dist/sdk/types/llm.d.ts.map +1 -1
  151. package/dist/sdk/types/progress.js +1 -1
  152. package/dist/sdk/user.js +1 -1
  153. package/dist/sdk/util/format-detector.js +1 -1
  154. package/dist/sdk/util/formatters.js +1 -1
  155. package/dist/sdk/util/index.js +1 -1
  156. package/dist/sdk/util/tree-formatter.js +1 -1
  157. package/dist/sdk/workflow/archive-validation.js +1 -1
  158. package/dist/sdk/workflow/clone-workflow.js +1 -1
  159. package/dist/sdk/workflow/index.js +1 -1
  160. package/dist/sdk/workflow/pull-workflow.js +1 -1
  161. package/dist/sdk/workflow/push-workflow.js +1 -1
  162. package/dist/sdk/workflow/tdx-config.js +1 -1
  163. package/dist/sdk/workflow/workflow-utils.js +1 -1
  164. package/dist/test-utils/command-runner.js +1 -1
  165. package/dist/test-utils/factories.js +1 -1
  166. package/dist/test-utils/fixtures.js +1 -1
  167. package/dist/test-utils/http-mock.js +1 -1
  168. package/dist/test-utils/index.js +1 -1
  169. package/dist/utils/async.js +1 -1
  170. package/dist/utils/colors.js +1 -1
  171. package/dist/utils/diff.js +1 -1
  172. package/dist/utils/file-permissions.js +1 -1
  173. package/dist/utils/global-cache.js +1 -1
  174. package/dist/utils/json-loader.js +1 -1
  175. package/dist/utils/local-cache.js +1 -1
  176. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  177. package/dist/utils/logger/formatters/index.js +1 -1
  178. package/dist/utils/logger/handlers/console-handler.js +1 -1
  179. package/dist/utils/logger/handlers/file-handler.js +1 -1
  180. package/dist/utils/logger/handlers/index.js +1 -1
  181. package/dist/utils/logger/handlers/null-handler.js +1 -1
  182. package/dist/utils/logger/index.js +1 -1
  183. package/dist/utils/logger/logger.js +1 -1
  184. package/dist/utils/logger/types.js +1 -1
  185. package/dist/utils/option-validation.js +1 -1
  186. package/dist/utils/port.js +1 -1
  187. package/dist/utils/process.d.ts.map +1 -1
  188. package/dist/utils/process.js +1 -1
  189. package/dist/utils/process.js.map +1 -1
  190. package/dist/utils/prompt.js +1 -1
  191. package/dist/utils/spinner.js +1 -1
  192. package/dist/utils/sse-parser.js +1 -1
  193. package/dist/utils/string-utils.js +1 -1
  194. package/dist/utils/table-ref-parser.js +1 -1
  195. package/dist/utils/tdx-logger.js +1 -1
  196. package/dist/utils/version-check.js +1 -1
  197. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x885404=a23_0x58a4;(function(_0x9454b2,_0x2fdc08){const _0x19cd71=a23_0x58a4,_0x317f85=_0x9454b2();while(!![]){try{const _0x1a02b4=-parseInt(_0x19cd71(0x18b))/0x1*(-parseInt(_0x19cd71(0x1c3))/0x2)+parseInt(_0x19cd71(0x1b9))/0x3*(-parseInt(_0x19cd71(0x15d))/0x4)+-parseInt(_0x19cd71(0x14f))/0x5+parseInt(_0x19cd71(0x20b))/0x6*(parseInt(_0x19cd71(0x17b))/0x7)+parseInt(_0x19cd71(0x192))/0x8*(parseInt(_0x19cd71(0x114))/0x9)+parseInt(_0x19cd71(0x123))/0xa+-parseInt(_0x19cd71(0x1a7))/0xb*(parseInt(_0x19cd71(0x15b))/0xc);if(_0x1a02b4===_0x2fdc08)break;else _0x317f85['push'](_0x317f85['shift']());}catch(_0x52f6fa){_0x317f85['push'](_0x317f85['shift']());}}}(a23_0x5213,0xcf14d));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x4dd338 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x3386dc from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x885404(0xfc),LEGACY_PARENT_SEGMENT_DIR=a23_0x885404(0x1a2);function openBrowser(_0x624898){const _0x33fe51=a23_0x885404,_0x1c131a=process[_0x33fe51(0x1dd)],_0x3a8aa7=_0x1c131a===_0x33fe51(0x104)?_0x33fe51(0x1df):_0x1c131a==='win32'?_0x33fe51(0x146):_0x33fe51(0x1bf);spawn(_0x3a8aa7,[_0x624898],{'detached':!![],'stdio':_0x33fe51(0x11d)})['unref']();}function migrateLegacyDirectory(){const _0x5d1716=a23_0x885404;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1ba9ca=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1ba9ca[_0x5d1716(0x139)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5d1716(0x14e)](a23_0x3386dc['yellow'](_0x5d1716(0x205)+LEGACY_PARENT_SEGMENT_DIR+_0x5d1716(0x16c)+PARENT_SEGMENT_DIR+_0x5d1716(0x208))),console[_0x5d1716(0x14e)](a23_0x3386dc[_0x5d1716(0x1f9)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a23_0x3386dc[_0x5d1716(0x1ef)](_0x5d1716(0x1d3)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a23_0x3386dc[_0x5d1716(0x1cd)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x56039c){const _0x32c795=_0x56039c instanceof Error?_0x56039c[_0x5d1716(0x15f)]:String(_0x56039c);return console[_0x5d1716(0x14e)](a23_0x3386dc[_0x5d1716(0x148)](_0x5d1716(0x20d)+_0x32c795+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x885404(0x145)](_0x35d82f){const _0x18fb08=a23_0x885404;return migrateLegacyDirectory(),super[_0x18fb08(0x145)](_0x35d82f);}}function resolveYamlFile(_0x8c7fa4){const _0x4a6a11=a23_0x885404;if(_0x8c7fa4[_0x4a6a11(0x18f)]('.yml')||_0x8c7fa4[_0x4a6a11(0x18f)](_0x4a6a11(0x161)))return _0x8c7fa4;return a23_0x4dd338[_0x4a6a11(0x170)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x8c7fa4)+_0x4a6a11(0x108));}function formatProgressMessage(_0x8b9f){const _0x1088b1=a23_0x885404,_0x4d88ae=_0x8b9f['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4d88ae){const [,_0x545b9f,_0xe10290,_0x11f2f4='']=_0x4d88ae;return a23_0x3386dc[_0x1088b1(0x1f9)](_0x545b9f+':')+'\x20'+_0xe10290+a23_0x3386dc[_0x1088b1(0x1f9)](_0x11f2f4);}return a23_0x3386dc['dim'](_0x8b9f);}function showFileNotFoundError(_0x2767e7,_0x5ef19a){const _0x17b5ac=a23_0x885404;console[_0x17b5ac(0x14e)](a23_0x3386dc['red'](_0x17b5ac(0x10d)+_0x2767e7+'\x0a')),console[_0x17b5ac(0x14e)](a23_0x3386dc['cyan'](_0x17b5ac(0x142)+_0x5ef19a+_0x17b5ac(0x1ac)));}function showParentSegmentNotSetError(_0x460155){const _0x2e6997=a23_0x885404;console[_0x2e6997(0x14e)](a23_0x3386dc[_0x2e6997(0x1ef)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x2e6997(0x14e)](_0x460155);}export class ParentSegmentListCommand extends BaseCommand{['name']=a23_0x885404(0x107);[a23_0x885404(0x1a5)]=a23_0x885404(0xff);async[a23_0x885404(0x11e)](_0x1efb2d){const _0x5c6fdd=a23_0x885404,{options:_0x45320b,args:_0x43be48,tdx:_0x4ebe77}=_0x1efb2d,_0x10a87e=_0x43be48[0x0];_0x45320b[_0x5c6fdd(0xf0)]&&(console[_0x5c6fdd(0x14e)](_0x5c6fdd(0x1d7)+_0x45320b[_0x5c6fdd(0xf4)]),_0x10a87e&&console[_0x5c6fdd(0x14e)](_0x5c6fdd(0xec)+_0x10a87e));const _0x3f2063=await withSpinner(_0x10a87e?_0x5c6fdd(0x174)+_0x10a87e+_0x5c6fdd(0x127):_0x5c6fdd(0x150),()=>_0x4ebe77[_0x5c6fdd(0xee)]['listParents'](),{'verbose':_0x45320b['verbose']});let _0x42ca4d=_0x3f2063[_0x5c6fdd(0xfa)];if(_0x10a87e){const _0x118670=_0x10a87e[_0x5c6fdd(0x1fe)](/[.+^${}()|[\]\\]/g,_0x5c6fdd(0x20e))[_0x5c6fdd(0x1fe)](/\*/g,'.*')[_0x5c6fdd(0x1fe)](/\?/g,'.'),_0x31a544=new RegExp('^'+_0x118670+'$','i');_0x42ca4d=_0x42ca4d[_0x5c6fdd(0x179)](_0x1377a5=>_0x31a544['test'](_0x1377a5[_0x5c6fdd(0x1a4)][_0x5c6fdd(0x20a)]));}_0x42ca4d[_0x5c6fdd(0x169)]((_0xd231a9,_0x2fab33)=>_0xd231a9[_0x5c6fdd(0x1a4)]['name'][_0x5c6fdd(0x217)](_0x2fab33[_0x5c6fdd(0x1a4)][_0x5c6fdd(0x20a)])),console[_0x5c6fdd(0x14e)]('✔\x20Found\x20'+_0x42ca4d[_0x5c6fdd(0x18e)]+'\x20parent\x20segment'+(_0x42ca4d[_0x5c6fdd(0x18e)]!==0x1?'s':''));const _0x5c6e80=_0x3a3b4a=>{const _0x34ef98=_0x5c6fdd;return getConsoleNextUrl(_0x45320b[_0x34ef98(0xf4)],_0x34ef98(0x1fb)+_0x3a3b4a);};if(_0x45320b[_0x5c6fdd(0x12e)]===_0x5c6fdd(0x184)||_0x45320b[_0x5c6fdd(0x12e)]===_0x5c6fdd(0x1f3)){const _0xf96cff=_0x42ca4d['map'](_0x4f04d9=>({..._0x4f04d9,'url':_0x5c6e80(_0x4f04d9['id'])}));await handleSDKOutput(_0xf96cff,_0x45320b);}else{if(_0x42ca4d[_0x5c6fdd(0x18e)]===0x0)_0x10a87e?console[_0x5c6fdd(0x11a)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x10a87e):console[_0x5c6fdd(0x11a)]('No\x20parent\x20segments\x20found');else for(const _0x6e009c of _0x42ca4d){const _0x25218c=_0x6e009c['attributes'][_0x5c6fdd(0x20f)]?a23_0x3386dc[_0x5c6fdd(0x1f9)]('\x20('+formatRows(_0x6e009c[_0x5c6fdd(0x1a4)][_0x5c6fdd(0x20f)])+')'):'',_0xedf0ed=hyperlink(_0x6e009c[_0x5c6fdd(0x1a4)][_0x5c6fdd(0x20a)],_0x5c6e80(_0x6e009c['id']));console['log'](_0x5c6fdd(0x1ff)+_0xedf0ed+_0x25218c);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x885404(0x105);[a23_0x885404(0x1a5)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x18b912){const _0x4496c2=a23_0x885404,{options:_0x16f125,args:_0x497169,tdx:_0x2249d1}=_0x18b912;console[_0x4496c2(0x14e)](_0x4496c2(0x177)+_0x4496c2(0x1c4)+_0x4496c2(0x1d5));const _0x4c6bd0=_0x16f125;if(_0x497169[_0x4496c2(0x18e)]===0x0)return console[_0x4496c2(0x14e)](a23_0x3386dc[_0x4496c2(0x148)](_0x4496c2(0x1e0))),console['error'](_0x4496c2(0x1ad)),0x1;const _0x254da8=_0x497169[0x0];if(!_0x4c6bd0[_0x4496c2(0x211)]||!_0x4c6bd0[_0x4496c2(0x1ee)])return console[_0x4496c2(0x14e)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x4496c2(0x14e)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x4c6bd0[_0x4496c2(0xf0)]&&(console['error']('Site:\x20'+_0x4c6bd0[_0x4496c2(0xf4)]),console['error'](_0x4496c2(0x10b)+_0x254da8),console[_0x4496c2(0x14e)](_0x4496c2(0x197)+_0x4c6bd0[_0x4496c2(0x211)]),console[_0x4496c2(0x14e)](_0x4496c2(0x1f8)+_0x4c6bd0[_0x4496c2(0x1ee)]));const _0x1e89c4=await loadJSONFromOptions(_0x4c6bd0[_0x4496c2(0x1a4)],_0x4c6bd0[_0x4496c2(0x119)]),_0x37881b=await loadJSONFromOptions(_0x4c6bd0[_0x4496c2(0x19f)],_0x4c6bd0['behaviorsFile']),_0x1bfbfa=await loadJSONFromOptions(_0x4c6bd0[_0x4496c2(0x1c6)],_0x4c6bd0[_0x4496c2(0x16d)]),_0x295a3d={'name':_0x254da8,'description':_0x4c6bd0[_0x4496c2(0x1a5)],'scheduleType':_0x4c6bd0[_0x4496c2(0x189)],'scheduleOption':_0x4c6bd0['scheduleOption'],'timezone':_0x4c6bd0[_0x4496c2(0x171)],'master':{'parentDatabaseName':_0x4c6bd0[_0x4496c2(0x211)],'parentTableName':_0x4c6bd0[_0x4496c2(0x1ee)]},'attributes':_0x1e89c4,'behaviors':_0x37881b,'customerGroup':_0x1bfbfa},_0x55cd02=await withSpinner(_0x4496c2(0xeb)+_0x254da8+_0x4496c2(0x127),()=>_0x2249d1[_0x4496c2(0xee)][_0x4496c2(0x196)](_0x295a3d),{'verbose':_0x16f125['verbose']}),_0x3935d1=_0x55cd02[_0x4496c2(0xfa)];return console[_0x4496c2(0x14e)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x3935d1[_0x4496c2(0x20a)]+_0x4496c2(0x115)+_0x3935d1['id']),await handleSDKOutput([_0x3935d1],_0x16f125),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x885404(0x20a)]='segment:parent:update';[a23_0x885404(0x1a5)]=a23_0x885404(0x12b);async[a23_0x885404(0x11e)](_0x127f12){const _0x1d7687=a23_0x885404,{options:_0x2730cc,args:_0x599005,tdx:_0x2771a4}=_0x127f12;console[_0x1d7687(0x14e)](_0x1d7687(0x1cc)+_0x1d7687(0x1c4)+_0x1d7687(0x1d5));const _0x3e501d=_0x2730cc;if(_0x599005[_0x1d7687(0x18e)]===0x0)return console['error'](a23_0x3386dc[_0x1d7687(0x148)](_0x1d7687(0x1e0))),console[_0x1d7687(0x14e)](_0x1d7687(0x1e4)),0x1;const _0x5968d7=_0x599005[0x0];_0x3e501d[_0x1d7687(0xf0)]&&(console[_0x1d7687(0x14e)](_0x1d7687(0x1d7)+_0x3e501d[_0x1d7687(0xf4)]),console['error'](_0x1d7687(0x135)+_0x5968d7));const _0x2b88e7=await withSpinner(_0x1d7687(0xe5)+_0x5968d7+_0x1d7687(0x127),()=>_0x2771a4[_0x1d7687(0xee)][_0x1d7687(0x1b7)](_0x5968d7),{'verbose':_0x3e501d[_0x1d7687(0xf0)]}),_0xa7ec8d=_0x2b88e7[_0x1d7687(0xfa)],_0x3e2346=await loadJSONFromOptions(_0x3e501d[_0x1d7687(0x16a)],_0x3e501d[_0x1d7687(0x120)]),_0x2d3277=await loadJSONFromOptions(_0x3e501d[_0x1d7687(0xea)],_0x3e501d[_0x1d7687(0x1aa)]),_0x4772ca={'name':_0xa7ec8d[_0x1d7687(0x20a)],'description':_0x3e501d[_0x1d7687(0x1a5)]!==undefined?_0x3e501d[_0x1d7687(0x1a5)]:_0xa7ec8d['description'],'scheduleType':_0x3e501d[_0x1d7687(0x189)]!==undefined?_0x3e501d[_0x1d7687(0x189)]:_0xa7ec8d[_0x1d7687(0x189)],'scheduleOption':_0x3e501d[_0x1d7687(0xf2)]!==undefined?_0x3e501d[_0x1d7687(0xf2)]:_0xa7ec8d['scheduleOption'],'timezone':_0x3e501d['timezone']!==undefined?_0x3e501d[_0x1d7687(0x171)]:_0xa7ec8d[_0x1d7687(0x171)],'master':_0xa7ec8d[_0x1d7687(0x176)],'attributes':_0x3e2346?[..._0xa7ec8d[_0x1d7687(0x1a4)]||[],..._0x3e2346]:_0xa7ec8d[_0x1d7687(0x1a4)],'behaviors':_0x2d3277?[..._0xa7ec8d[_0x1d7687(0x19f)]||[],..._0x2d3277]:_0xa7ec8d[_0x1d7687(0x19f)],'customerGroup':_0xa7ec8d[_0x1d7687(0x1c6)]},_0x1829d2=await withSpinner(_0x1d7687(0x1a1)+_0x5968d7+_0x1d7687(0x127),()=>_0x2771a4[_0x1d7687(0xee)][_0x1d7687(0x1e7)](_0x5968d7,_0x4772ca),{'verbose':_0x3e501d[_0x1d7687(0xf0)]}),_0x2d0c53=_0x1829d2[_0x1d7687(0xfa)];return console['error'](_0x1d7687(0xef)+_0x2d0c53['name']+'\x27'),await handleSDKOutput([_0x2d0c53],_0x3e501d),0x0;}}function a23_0x58a4(_0x45ecb4,_0x1892f6){_0x45ecb4=_0x45ecb4-0xe4;const _0x5213c1=a23_0x5213();let _0x58a481=_0x5213c1[_0x45ecb4];return _0x58a481;}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x885404(0x20a)]=a23_0x885404(0x126);[a23_0x885404(0x1a5)]=a23_0x885404(0x18a);async[a23_0x885404(0x11e)](_0x4bae56){const _0x29e6f6=a23_0x885404,{options:_0x2ce351,args:_0x5c52c7,tdx:_0x5a6c79}=_0x4bae56,_0xf6cdf9=_0x2ce351,_0x207baa=_0x5c52c7[0x0]||_0x2ce351[_0x29e6f6(0x124)];if(!_0x207baa)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0xf6cdf9[_0x29e6f6(0x1af)]&&_0xf6cdf9[_0x29e6f6(0x106)])return console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x148)](_0x29e6f6(0x101))),console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x1f9)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x29e6f6(0x14e)](a23_0x3386dc['dim'](_0x29e6f6(0x15a)+PARENT_SEGMENT_DIR+_0x29e6f6(0xe7))),console['error'](a23_0x3386dc[_0x29e6f6(0x164)](_0x29e6f6(0x15e))),0x1;const _0x44a82a=_0xf6cdf9[_0x29e6f6(0x106)]||a23_0x4dd338[_0x29e6f6(0x170)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x207baa)+_0x29e6f6(0x108));_0xf6cdf9[_0x29e6f6(0xf0)]&&(console[_0x29e6f6(0x14e)](_0x29e6f6(0x1d7)+_0xf6cdf9[_0x29e6f6(0xf4)]),console[_0x29e6f6(0x14e)]('Parent\x20segment:\x20'+_0x207baa),console[_0x29e6f6(0x14e)]('Output\x20file:\x20'+_0x44a82a));const _0x1d5ff7=await withSpinner(_0x29e6f6(0x182)+_0x207baa+'\x27...',()=>_0x5a6c79[_0x29e6f6(0xee)][_0x29e6f6(0xe6)](_0x207baa),{'verbose':_0xf6cdf9[_0x29e6f6(0xf0)]}),_0x29faf1=_0x1d5ff7[_0x29e6f6(0xfa)];if(existsSync(_0x44a82a)){const _0x280d26=readFileSync(_0x44a82a,_0x29e6f6(0x186)),_0x48c809=generateDiff(_0x280d26,_0x29faf1);if(!hasChanges(_0x48c809))console['error'](a23_0x3386dc[_0x29e6f6(0x1cd)]('✔')+_0x29e6f6(0x116)+a23_0x3386dc[_0x29e6f6(0x164)](_0x44a82a)+_0x29e6f6(0x17f));else{console[_0x29e6f6(0x14e)](_0x29e6f6(0x17e)+_0x44a82a+'\x27:'),console[_0x29e6f6(0x14e)]('─'[_0x29e6f6(0x178)](0x3c)),console['error'](formatDiffWithColors(_0x48c809)),console['error']('─'['repeat'](0x3c));if(!_0xf6cdf9[_0x29e6f6(0x1a6)]){if(!isInteractive())return console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x148)]('\x0aError:'),_0x29e6f6(0x17c)),console['error'](a23_0x3386dc[_0x29e6f6(0x1f9)](_0x29e6f6(0x13d))),0x1;const _0x2ca742=await confirmKey(_0x29e6f6(0x200)+_0x44a82a+'\x27?');if(!_0x2ca742)return console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x1ef)](_0x29e6f6(0x191))),0x1;}writeFileSync(_0x44a82a,_0x29faf1,_0x29e6f6(0x186)),console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x1cd)]('✔')+_0x29e6f6(0x11b)+a23_0x3386dc[_0x29e6f6(0x164)](_0x44a82a));}}else{const _0x40b0e9=a23_0x4dd338['dirname'](_0x44a82a);!existsSync(_0x40b0e9)&&mkdirSync(_0x40b0e9,{'recursive':!![]}),writeFileSync(_0x44a82a,_0x29faf1,'utf-8'),console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x1cd)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x3386dc['cyan'](_0x44a82a));}return saveSessionContext({'parent_segment':_0x207baa},_0xf6cdf9[_0x29e6f6(0x132)]),console[_0x29e6f6(0x14e)](a23_0x3386dc[_0x29e6f6(0x1cd)]('✔')+_0x29e6f6(0x1f1)+a23_0x3386dc[_0x29e6f6(0x1f9)](_0x29e6f6(0x1a2))+'\x20=\x20'+a23_0x3386dc[_0x29e6f6(0x164)](_0x207baa)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x885404(0x20a)]=a23_0x885404(0x1f6);[a23_0x885404(0x1a5)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x2ce6ef){const _0x29e684=a23_0x885404,{options:_0x2b2e46,args:_0x43182a,tdx:_0x2a2eb5}=_0x2ce6ef,_0x1a8e7=_0x2b2e46,_0x4cd185=_0x43182a[0x0]||_0x2b2e46[_0x29e684(0x124)];if(!_0x4cd185)return showParentSegmentNotSetError(_0x29e684(0x1b1)+_0x29e684(0x15c)),0x1;const _0x44f7bb=resolveYamlFile(_0x4cd185);if(!existsSync(_0x44f7bb))return showFileNotFoundError(_0x44f7bb,_0x4cd185),0x1;_0x1a8e7[_0x29e684(0xf0)]&&(console['error'](_0x29e684(0x1d7)+_0x1a8e7[_0x29e684(0xf4)]),console['error'](_0x29e684(0x1a0)+_0x44f7bb));let _0x5e721c;try{_0x5e721c=readFileSync(_0x44f7bb,_0x29e684(0x186));}catch(_0x342aa6){const _0x5477ad=_0x342aa6 instanceof Error?_0x342aa6[_0x29e684(0x15f)]:String(_0x342aa6);return console[_0x29e684(0x14e)](_0x29e684(0x11c)+_0x5477ad),0x1;}const _0x5aa498=await withSpinner(_0x29e684(0x144),()=>_0x2a2eb5[_0x29e684(0xee)][_0x29e684(0x1db)](_0x5e721c),{'verbose':_0x1a8e7[_0x29e684(0xf0)]}),_0x45810d=_0x5aa498[_0x29e684(0xfa)],{isNew:_0x1734a6,name:_0x2e7ff1,hasChanges:_0x1c29aa,diffFormatted:_0x3e824d}=_0x45810d;if(!_0x1c29aa)return console[_0x29e684(0x14e)](_0x29e684(0x198)+_0x2e7ff1+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x1734a6?console[_0x29e684(0x14e)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x2e7ff1+'\x27:'):console[_0x29e684(0x14e)](_0x29e684(0x1ae)+_0x2e7ff1+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x29e684(0x14e)](_0x3e824d),console[_0x29e684(0x14e)]('─'[_0x29e684(0x178)](0x3c));const _0x4d8bde=_0x1734a6?_0x29e684(0x1d6)+_0x2e7ff1+'\x27?':_0x29e684(0x1d2)+_0x2e7ff1+'\x27?';if(!_0x1a8e7[_0x29e684(0x1a6)]){if(!isInteractive())return console[_0x29e684(0x14e)](a23_0x3386dc[_0x29e684(0x148)](_0x29e684(0x1d8)),_0x29e684(0x17c)),console[_0x29e684(0x14e)](a23_0x3386dc[_0x29e684(0x1f9)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x253241=await confirmKey(_0x4d8bde);if(!_0x253241)return console['error'](a23_0x3386dc[_0x29e684(0x1ef)](_0x29e684(0x191))),0x1;}const _0x5407a3=_0x1734a6?_0x29e684(0x1c1):_0x29e684(0x1f5),_0xcc1520=await withSpinner(_0x5407a3+_0x29e684(0xf3)+_0x2e7ff1+_0x29e684(0x127),()=>_0x45810d[_0x29e684(0x175)](),{'verbose':_0x1a8e7[_0x29e684(0xf0)]}),_0xdd33a4=_0xcc1520[_0x29e684(0xfa)],_0x17751e=getConsoleNextUrl(_0x1a8e7[_0x29e684(0xf4)],'/app/dw/parentSegments/'+_0xdd33a4['id']),_0x3cae7b=_0x1734a6?'Created':_0x29e684(0x202);return console[_0x29e684(0x14e)]('✔\x20'+_0x3cae7b+_0x29e684(0xf3)+_0xdd33a4[_0x29e684(0x20a)]+'\x27'),console[_0x29e684(0x14e)]('\x20\x20'+_0x17751e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x885404(0x20a)]=a23_0x885404(0x165);['description']=a23_0x885404(0x12a);async[a23_0x885404(0x11e)](_0x19ac99){const _0x20aa61=a23_0x885404,{options:_0x376e64,args:_0x3e3ae0,tdx:_0x2bef51}=_0x19ac99,_0x496313=_0x376e64,_0x2797fc=_0x3e3ae0[0x0]||_0x376e64[_0x20aa61(0x124)];if(!_0x2797fc)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x20aa61(0x1de)+_0x20aa61(0x1a3)+_0x20aa61(0x121)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x20aa61(0x163)),0x1;const _0x47757f=resolveYamlFile(_0x2797fc);if(!existsSync(_0x47757f))return showFileNotFoundError(_0x47757f,_0x2797fc),0x1;_0x496313[_0x20aa61(0xf0)]&&(console[_0x20aa61(0x14e)](_0x20aa61(0x1d7)+_0x496313[_0x20aa61(0xf4)]),console['error'](_0x20aa61(0x1a0)+_0x47757f));let _0x284ce8;try{_0x284ce8=readFileSync(_0x47757f,_0x20aa61(0x186));}catch(_0x4fdf68){const _0x412cbe=_0x4fdf68 instanceof Error?_0x4fdf68['message']:String(_0x4fdf68);return console[_0x20aa61(0x14e)](_0x20aa61(0x11c)+_0x412cbe),0x1;}const _0x58c8a7=createCommandSpinner(a23_0x3386dc['dim'](_0x20aa61(0x140)),{'verbose':_0x496313[_0x20aa61(0xf0)]});_0x58c8a7[_0x20aa61(0x146)]();const _0x37afe7={'onProgress':_0x531bdd=>{_0x58c8a7['text']=formatProgressMessage(_0x531bdd);}};if(_0x496313[_0x20aa61(0x176)])_0x37afe7[_0x20aa61(0x176)]=!![];if(_0x496313[_0x20aa61(0x1f0)])_0x37afe7[_0x20aa61(0x1f0)]=!![];_0x496313[_0x20aa61(0x10c)]&&(_0x37afe7['attribute']=_0x496313['attribute']);_0x496313[_0x20aa61(0x102)]&&(_0x37afe7[_0x20aa61(0x102)]=_0x496313[_0x20aa61(0x102)]);if(_0x496313[_0x20aa61(0x206)])_0x37afe7['interval']=_0x496313[_0x20aa61(0x206)];let _0x51375b;try{_0x51375b=await _0x2bef51[_0x20aa61(0xee)][_0x20aa61(0x188)](_0x284ce8,_0x37afe7),_0x58c8a7[_0x20aa61(0x180)]();}catch(_0x932653){_0x58c8a7[_0x20aa61(0x180)]();throw _0x932653;}const _0xe53c4=_0x496313[_0x20aa61(0x206)]||_0x20aa61(0x157);return this[_0x20aa61(0x1ca)](_0x51375b,_0x37afe7,_0x47757f,_0xe53c4),_0x51375b[_0x20aa61(0x19b)]?0x0:0x1;}[a23_0x885404(0x1ca)](_0xa60276,_0x2ddca0,_0x47f696,_0x1e2812){const _0x187e82=a23_0x885404;console[_0x187e82(0x14e)]('\x0a'+a23_0x3386dc[_0x187e82(0x117)](_0x187e82(0x214))+'\x20'+_0xa60276['name']),console['error']('═'[_0x187e82(0x178)](0x3c)),this[_0x187e82(0x1a9)](_0xa60276);if(typeof _0x2ddca0[_0x187e82(0x10c)]==='string'){this[_0x187e82(0x162)](_0xa60276),this[_0x187e82(0x1e5)](_0xa60276),this['displayPreviewHints'](_0x47f696,_0x1e2812,_0x187e82(0x10c),_0x2ddca0[_0x187e82(0x10c)]);return;}if(_0x2ddca0[_0x187e82(0x10c)]===!![]){this['displayAttributesStats'](_0xa60276),this['displaySummary'](_0xa60276),this[_0x187e82(0x137)](_0x47f696,_0x1e2812,'attributes');return;}if(typeof _0x2ddca0[_0x187e82(0x102)]===_0x187e82(0x1fd)){this[_0x187e82(0xf7)](_0xa60276,_0x1e2812),this['displaySummary'](_0xa60276),this[_0x187e82(0x137)](_0x47f696,_0x1e2812,_0x187e82(0x102),_0x2ddca0[_0x187e82(0x102)]);return;}if(_0x2ddca0[_0x187e82(0x102)]===!![]){this[_0x187e82(0xf7)](_0xa60276,_0x1e2812),this[_0x187e82(0x1e5)](_0xa60276),this[_0x187e82(0x137)](_0x47f696,_0x1e2812,_0x187e82(0x19f));return;}this[_0x187e82(0x162)](_0xa60276),this[_0x187e82(0xf7)](_0xa60276,_0x1e2812),this[_0x187e82(0x1e5)](_0xa60276),this['displayPreviewHints'](_0x47f696,_0x1e2812,_0x187e82(0x134));}[a23_0x885404(0x137)](_0x2ddd3c,_0xe06463,_0x35f7c7,_0x3fde39){const _0x31e2b1=a23_0x885404;console[_0x31e2b1(0x14e)]('\x0a'+a23_0x3386dc['dim'](_0x31e2b1(0xe9)));const _0x2fdd9f=_0xe06463!==_0x31e2b1(0x157)?_0x31e2b1(0x1ce)+_0xe06463:'';if(_0x35f7c7==='attribute'&&_0x3fde39)console['error']('\x20\x20'+a23_0x3386dc[_0x31e2b1(0x1f9)](_0x31e2b1(0x207)+_0x2ddd3c+_0x31e2b1(0x113)+_0x3fde39+'\x22'+_0x2fdd9f));else{if(_0x35f7c7===_0x31e2b1(0x102)&&_0x3fde39)console[_0x31e2b1(0x14e)]('\x20\x20'+a23_0x3386dc[_0x31e2b1(0x1f9)](_0x31e2b1(0x207)+_0x2ddd3c+_0x31e2b1(0x172)+_0x3fde39+'\x22'+_0x2fdd9f));else(_0x35f7c7===_0x31e2b1(0x1a4)||_0x35f7c7===_0x31e2b1(0x134))&&console[_0x31e2b1(0x14e)]('\x20\x20'+a23_0x3386dc[_0x31e2b1(0x1f9)](_0x31e2b1(0x207)+_0x2ddd3c+_0x31e2b1(0x159)+_0x2fdd9f));}(_0x35f7c7===_0x31e2b1(0x19f)||_0x35f7c7==='all')&&console['error']('\x20\x20'+a23_0x3386dc[_0x31e2b1(0x1f9)](_0x31e2b1(0x207)+_0x2ddd3c+_0x31e2b1(0x1b0)+_0x2fdd9f)),_0x35f7c7===_0x31e2b1(0x134)&&console[_0x31e2b1(0x14e)]('\x20\x20'+a23_0x3386dc[_0x31e2b1(0x1f9)](_0x31e2b1(0x207)+_0x2ddd3c+_0x31e2b1(0x1be)+_0x2fdd9f));}[a23_0x885404(0x1a9)](_0x2baaa9){const _0x3f92c3=a23_0x885404,{master:_0x1a4594}=_0x2baaa9,_0x5406cb=_0x1a4594[_0x3f92c3(0x118)]?a23_0x3386dc['green']('✔'):a23_0x3386dc['red']('✘');console['error']('\x0a'+a23_0x3386dc[_0x3f92c3(0x1f9)]('Master\x20Table')),console[_0x3f92c3(0x14e)](_0x5406cb+'\x20'+a23_0x3386dc['bold'](_0x1a4594[_0x3f92c3(0x211)]+'.'+_0x1a4594[_0x3f92c3(0x1ee)])),_0x1a4594['schemaValid']?_0x1a4594[_0x3f92c3(0x1bd)]!==undefined&&console[_0x3f92c3(0x14e)]('\x20\x20'+a23_0x3386dc[_0x3f92c3(0x1f9)](_0x3f92c3(0x1ed))+'\x20'+a23_0x3386dc['cyan'](formatRows(_0x1a4594['rowCount']))):console['error']('\x20\x20'+a23_0x3386dc[_0x3f92c3(0x148)](_0x3f92c3(0x203))+'\x20'+_0x1a4594[_0x3f92c3(0x13b)]);}[a23_0x885404(0x162)](_0x431f75){const _0x40cb57=a23_0x885404;if(_0x431f75[_0x40cb57(0x1a4)][_0x40cb57(0x18e)]===0x0)return;console[_0x40cb57(0x14e)]('\x0a'+a23_0x3386dc[_0x40cb57(0x1f9)]('Attributes'));for(const _0xedcdf4 of _0x431f75[_0x40cb57(0x1a4)]){const _0x3f2053=_0xedcdf4[_0x40cb57(0x118)]?a23_0x3386dc[_0x40cb57(0x1cd)]('✔'):a23_0x3386dc[_0x40cb57(0x148)]('✘');let _0x379b03='';if(_0xedcdf4[_0x40cb57(0x118)]&&_0xedcdf4[_0x40cb57(0x112)]!==undefined&&_0xedcdf4[_0x40cb57(0x201)]!==undefined){const _0x4ef742=_0xedcdf4[_0x40cb57(0x201)][_0x40cb57(0x187)](0x1),_0x22dd4a=_0xedcdf4[_0x40cb57(0x201)]>=0x50?a23_0x3386dc[_0x40cb57(0x1cd)]:_0xedcdf4['coveragePercent']>=0x32?a23_0x3386dc[_0x40cb57(0x1ef)]:a23_0x3386dc[_0x40cb57(0x148)];_0x379b03='\x20'+a23_0x3386dc[_0x40cb57(0x1f9)]('Coverage:')+'\x20'+_0x22dd4a(_0x4ef742+'%')+'\x20('+formatRows(_0xedcdf4[_0x40cb57(0x112)])+_0x40cb57(0x218);}console[_0x40cb57(0x14e)](_0x3f2053+'\x20'+a23_0x3386dc[_0x40cb57(0x117)](_0xedcdf4[_0x40cb57(0x20a)])+_0x379b03),console['error']('\x20\x20'+a23_0x3386dc['dim'](_0x40cb57(0x167))+'\x20'+a23_0x3386dc[_0x40cb57(0x117)](_0xedcdf4['database']+'.'+_0xedcdf4[_0x40cb57(0x1ee)]));const _0x2d9ef7=_0xedcdf4[_0x40cb57(0x1b6)]===_0xedcdf4['foreignKey']?a23_0x3386dc[_0x40cb57(0x1f9)]('Join\x20on:')+'\x20'+_0xedcdf4[_0x40cb57(0x1b6)]:a23_0x3386dc['dim'](_0x40cb57(0x12d))+'\x20'+_0xedcdf4[_0x40cb57(0x1b6)]+_0x40cb57(0x1e8)+_0xedcdf4[_0x40cb57(0x13e)];console['error']('\x20\x20'+_0x2d9ef7),console[_0x40cb57(0x14e)]('\x20\x20'+a23_0x3386dc[_0x40cb57(0x1f9)](_0x40cb57(0x219))),this[_0x40cb57(0x190)](_0xedcdf4[_0x40cb57(0xe4)]),!_0xedcdf4[_0x40cb57(0x118)]&&console[_0x40cb57(0x14e)]('\x20\x20'+a23_0x3386dc[_0x40cb57(0x148)]('Error:')+'\x20'+_0xedcdf4[_0x40cb57(0x13b)]);}}['displayBehaviorsStats'](_0xaff7b3,_0x463350){const _0x2f8cac=a23_0x885404;if(_0xaff7b3['behaviors'][_0x2f8cac(0x18e)]===0x0)return;console[_0x2f8cac(0x14e)]('\x0a'+a23_0x3386dc[_0x2f8cac(0x1f9)](_0x2f8cac(0x1b2))+'\x20'+a23_0x3386dc[_0x2f8cac(0x1f9)]('('+_0x463350+')'));for(const _0x9dfec7 of _0xaff7b3[_0x2f8cac(0x19f)]){const _0x5a2682=_0x9dfec7[_0x2f8cac(0x118)]?a23_0x3386dc[_0x2f8cac(0x1cd)]('✔'):a23_0x3386dc[_0x2f8cac(0x148)]('✘');let _0x28fd14='';if(_0x9dfec7[_0x2f8cac(0x118)]&&_0x9dfec7[_0x2f8cac(0x1d9)]!==undefined&&_0x9dfec7['totalEvents']!==undefined){const _0x56d013=_0x9dfec7[_0x2f8cac(0x1bc)]?.['toFixed'](0x1)||'?',_0x5f38e5=(_0x9dfec7['customerPercent']??0x0)>=0x32?a23_0x3386dc[_0x2f8cac(0x1cd)]:(_0x9dfec7[_0x2f8cac(0x1bc)]??0x0)>=0x14?a23_0x3386dc[_0x2f8cac(0x1ef)]:a23_0x3386dc[_0x2f8cac(0x148)];_0x28fd14='\x20'+a23_0x3386dc['dim'](_0x2f8cac(0x160))+'\x20'+_0x5f38e5(formatRows(_0x9dfec7[_0x2f8cac(0x1d9)]))+'\x20('+_0x56d013+_0x2f8cac(0x1f7)+a23_0x3386dc[_0x2f8cac(0x1f9)](_0x2f8cac(0x13a))+'\x20'+a23_0x3386dc[_0x2f8cac(0x164)](formatRows(_0x9dfec7[_0x2f8cac(0x19e)]));}console[_0x2f8cac(0x14e)](_0x5a2682+'\x20'+a23_0x3386dc[_0x2f8cac(0x117)](_0x9dfec7[_0x2f8cac(0x20a)])+_0x28fd14),console[_0x2f8cac(0x14e)]('\x20\x20'+a23_0x3386dc[_0x2f8cac(0x1f9)](_0x2f8cac(0x167))+'\x20'+a23_0x3386dc[_0x2f8cac(0x117)](_0x9dfec7['database']+'.'+_0x9dfec7[_0x2f8cac(0x1ee)]));const _0xcd598a=_0x9dfec7[_0x2f8cac(0x1b6)]===_0x9dfec7[_0x2f8cac(0x13e)]?a23_0x3386dc['dim'](_0x2f8cac(0x185))+'\x20'+_0x9dfec7[_0x2f8cac(0x1b6)]:a23_0x3386dc[_0x2f8cac(0x1f9)](_0x2f8cac(0x12d))+'\x20'+_0x9dfec7['joinKey']+'\x20=\x20'+_0x9dfec7[_0x2f8cac(0x13e)];console[_0x2f8cac(0x14e)]('\x20\x20'+_0xcd598a),console[_0x2f8cac(0x14e)]('\x20\x20'+a23_0x3386dc[_0x2f8cac(0x1f9)]('Columns:')),this[_0x2f8cac(0x190)](_0x9dfec7['columns']),!_0x9dfec7[_0x2f8cac(0x118)]&&console[_0x2f8cac(0x14e)]('\x20\x20'+a23_0x3386dc[_0x2f8cac(0x148)]('Error:')+'\x20'+_0x9dfec7[_0x2f8cac(0x13b)]);}}[a23_0x885404(0x190)](_0x312c32){const _0x5e84ea=a23_0x885404;for(const _0x52bc14 of _0x312c32){_0x52bc14[_0x5e84ea(0x1d0)]===_0x52bc14['column']||_0x52bc14[_0x5e84ea(0x1ba)]==='*'?console[_0x5e84ea(0x14e)]('\x20\x20\x20\x20-\x20'+_0x52bc14['label']):console[_0x5e84ea(0x14e)](_0x5e84ea(0x143)+_0x52bc14[_0x5e84ea(0x1d0)]+'\x20'+a23_0x3386dc[_0x5e84ea(0x1f9)]('('+_0x52bc14[_0x5e84ea(0x1ba)]+')'));}}[a23_0x885404(0x1e5)](_0x4c5f70){const _0x10117d=a23_0x885404;console[_0x10117d(0x14e)]('─'[_0x10117d(0x178)](0x3c));if(_0x4c5f70[_0x10117d(0x1c7)][_0x10117d(0x18e)]>0x0){console[_0x10117d(0x14e)]('\x0a'+a23_0x3386dc[_0x10117d(0x148)](_0x10117d(0x151)));for(const _0x264350 of _0x4c5f70[_0x10117d(0x1c7)]){console[_0x10117d(0x14e)]('\x20\x20'+a23_0x3386dc['red']('•')+'\x20'+_0x264350);}}_0x4c5f70['allValid']&&console[_0x10117d(0x14e)]('\x0a'+a23_0x3386dc['green']('✔')+_0x10117d(0x168));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x885404(0x20a)]=a23_0x885404(0xfd);[a23_0x885404(0x1a5)]=a23_0x885404(0x12c);async[a23_0x885404(0x11e)](_0x54589e){const _0x1770d0=a23_0x885404,{options:_0x5405e6,args:_0x2d33ab,tdx:_0x6bbf2}=_0x54589e,_0x49ba02=_0x5405e6,_0x4dfc69=_0x2d33ab[0x0]||_0x5405e6[_0x1770d0(0x124)];if(!_0x4dfc69)return showParentSegmentNotSetError(_0x1770d0(0x181)+_0x1770d0(0x111)+_0x1770d0(0x1e1)+_0x1770d0(0x130)+_0x1770d0(0x136)+_0x1770d0(0x147)+_0x1770d0(0x215)+_0x1770d0(0x163)),0x1;if(!_0x49ba02['master']&&!_0x49ba02[_0x1770d0(0x10c)]&&!_0x49ba02['behavior']&&!_0x49ba02['enriched'])return console[_0x1770d0(0x14e)](a23_0x3386dc[_0x1770d0(0x148)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x1770d0(0x14e)](_0x1770d0(0x183)),console[_0x1770d0(0x14e)](_0x1770d0(0x216)),console[_0x1770d0(0x14e)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x1770d0(0xe8)),console[_0x1770d0(0x14e)](_0x1770d0(0x18d)),console[_0x1770d0(0x14e)](_0x1770d0(0x213)),0x1;const _0x531c0e=resolveYamlFile(_0x4dfc69);if(!existsSync(_0x531c0e))return showFileNotFoundError(_0x531c0e,_0x4dfc69),0x1;_0x49ba02[_0x1770d0(0xf0)]&&(console['error'](_0x1770d0(0x1d7)+_0x49ba02[_0x1770d0(0xf4)]),console['error'](_0x1770d0(0x1a0)+_0x531c0e));let _0x5ad409;try{_0x5ad409=readFileSync(_0x531c0e,_0x1770d0(0x186));}catch(_0x1abcb3){const _0x201984=_0x1abcb3 instanceof Error?_0x1abcb3['message']:String(_0x1abcb3);return console[_0x1770d0(0x14e)]('Error\x20reading\x20file:\x20'+_0x201984),0x1;}let _0x300d74;try{_0x300d74=parseDef(_0x5ad409);}catch(_0x47443e){const _0x307c33=_0x47443e instanceof Error?_0x47443e[_0x1770d0(0x15f)]:String(_0x47443e);return console[_0x1770d0(0x14e)](a23_0x3386dc['red'](_0x1770d0(0x13c)+_0x307c33)),0x1;}if(_0x49ba02['attribute']===!![]||_0x49ba02['attribute']===''){const _0x2f7cd8=_0x300d74['attributes']?.[_0x1770d0(0x1b8)](_0x5546a9=>_0x5546a9[_0x1770d0(0x20a)])||[];if(_0x2f7cd8[_0x1770d0(0x18e)]===0x0)console[_0x1770d0(0x14e)](a23_0x3386dc['red'](_0x1770d0(0x1f2)));else{console[_0x1770d0(0x14e)](a23_0x3386dc[_0x1770d0(0x148)](_0x1770d0(0x141))),console['error'](_0x1770d0(0x20c));for(const _0x331d2a of _0x2f7cd8){console[_0x1770d0(0x14e)]('\x20\x20'+a23_0x3386dc[_0x1770d0(0x164)](_0x331d2a));}console[_0x1770d0(0x14e)](_0x1770d0(0x149)+_0x4dfc69+_0x1770d0(0x113)+_0x2f7cd8[0x0]+'\x22');}return 0x1;}if(_0x49ba02[_0x1770d0(0x102)]===!![]||_0x49ba02[_0x1770d0(0x102)]===''){const _0x28a36e=_0x300d74['behaviors']?.['map'](_0x4fb159=>_0x4fb159['name'])||[];if(_0x28a36e[_0x1770d0(0x18e)]===0x0)console['error'](a23_0x3386dc[_0x1770d0(0x148)](_0x1770d0(0xed)));else{console[_0x1770d0(0x14e)](a23_0x3386dc[_0x1770d0(0x148)](_0x1770d0(0x16e))),console['error']('Available\x20behaviors:');for(const _0x257415 of _0x28a36e){console[_0x1770d0(0x14e)]('\x20\x20'+a23_0x3386dc['cyan'](_0x257415));}console[_0x1770d0(0x14e)](_0x1770d0(0x149)+_0x4dfc69+'\x20--behavior\x20\x22'+_0x28a36e[0x0]+'\x22');}return 0x1;}const _0x467a01=createCommandSpinner(a23_0x3386dc['dim']('Fetching\x20sample\x20data...'),{'verbose':_0x49ba02[_0x1770d0(0xf0)]});_0x467a01['start']();const _0x264baf={'onProgress':_0x522bdd=>{const _0x571826=_0x1770d0;_0x467a01[_0x571826(0x209)]=formatProgressMessage(_0x522bdd);}};if(_0x49ba02[_0x1770d0(0x176)])_0x264baf[_0x1770d0(0x176)]=!![];if(_0x49ba02[_0x1770d0(0x10c)]&&typeof _0x49ba02[_0x1770d0(0x10c)]===_0x1770d0(0x1fd))_0x264baf['attribute']=_0x49ba02[_0x1770d0(0x10c)];if(_0x49ba02[_0x1770d0(0x102)]&&typeof _0x49ba02['behavior']===_0x1770d0(0x1fd))_0x264baf[_0x1770d0(0x102)]=_0x49ba02[_0x1770d0(0x102)];if(_0x49ba02[_0x1770d0(0x1f0)])_0x264baf[_0x1770d0(0x1f0)]=!![];if(_0x49ba02[_0x1770d0(0x206)])_0x264baf[_0x1770d0(0x206)]=_0x49ba02[_0x1770d0(0x206)];let _0x491756;try{_0x491756=await _0x6bbf2['segment'][_0x1770d0(0x16b)](_0x5ad409,_0x264baf),_0x467a01[_0x1770d0(0x180)]();}catch(_0x5c8a20){_0x467a01[_0x1770d0(0x180)]();throw _0x5c8a20;}return await this[_0x1770d0(0x1c9)](_0x491756,{'master':_0x49ba02[_0x1770d0(0x176)],'attribute':typeof _0x49ba02[_0x1770d0(0x10c)]===_0x1770d0(0x1fd)?_0x49ba02[_0x1770d0(0x10c)]:undefined,'behavior':typeof _0x49ba02['behavior']===_0x1770d0(0x1fd)?_0x49ba02[_0x1770d0(0x102)]:undefined,'enriched':_0x49ba02[_0x1770d0(0x1f0)]}),_0x491756[_0x1770d0(0x19b)]?0x0:0x1;}async[a23_0x885404(0x1c9)](_0x503ade,_0x4d89d0){const _0xa19354=a23_0x885404;console[_0xa19354(0x14e)]('\x0a'+a23_0x3386dc['bold'](_0xa19354(0x193))+'\x20'+_0x503ade['name']),console['error']('═'[_0xa19354(0x178)](0x3c));if(_0x4d89d0[_0xa19354(0x176)]&&_0x503ade[_0xa19354(0x12f)]){const _0x5b043e=a23_0x3386dc['dim'](_0xa19354(0x14d))+'\x20'+a23_0x3386dc[_0xa19354(0x117)](_0x503ade[_0xa19354(0x176)]['database']+'.'+_0x503ade['master'][_0xa19354(0x1ee)]);await this[_0xa19354(0x17a)](_0x5b043e,_0x503ade['sampleData']);}else{if(_0x4d89d0[_0xa19354(0x10c)]&&_0x503ade[_0xa19354(0x12f)]){const _0x5744bf=a23_0x3386dc['dim'](_0xa19354(0x1f4))+'\x20'+a23_0x3386dc[_0xa19354(0x117)](_0x4d89d0['attribute']);await this[_0xa19354(0x17a)](_0x5744bf,_0x503ade[_0xa19354(0x12f)]);}else{if(_0x4d89d0[_0xa19354(0x102)]&&_0x503ade[_0xa19354(0x12f)]){const _0x330088=a23_0x3386dc[_0xa19354(0x1f9)](_0xa19354(0x19a))+'\x20'+a23_0x3386dc[_0xa19354(0x117)](_0x4d89d0[_0xa19354(0x102)]);await this[_0xa19354(0x17a)](_0x330088,_0x503ade[_0xa19354(0x12f)]);}else{if(_0x4d89d0[_0xa19354(0x1f0)]&&_0x503ade[_0xa19354(0x12f)]){const _0x5db68a=a23_0x3386dc[_0xa19354(0x1f9)](_0xa19354(0xf8))+'\x20'+a23_0x3386dc[_0xa19354(0x117)](_0xa19354(0x11f));await this[_0xa19354(0x17a)](_0x5db68a,_0x503ade['sampleData']);}else!_0x503ade[_0xa19354(0x12f)]&&console['error'](_0xa19354(0x1e3));}}}if(_0x503ade['errors']['length']>0x0){console[_0xa19354(0x14e)]('─'[_0xa19354(0x178)](0x3c)),console[_0xa19354(0x14e)]('\x0a'+a23_0x3386dc[_0xa19354(0x148)](_0xa19354(0x151)));for(const _0x2ff245 of _0x503ade[_0xa19354(0x1c7)]){console[_0xa19354(0x14e)]('\x20\x20'+a23_0x3386dc[_0xa19354(0x148)]('•')+'\x20'+_0x2ff245);}}}async['displaySampleData'](_0x4c9d8c,_0x309a69){const _0x285896=a23_0x885404;if(_0x309a69['length']===0x0){console[_0x285896(0x14e)]('\x0a'+_0x4c9d8c),console[_0x285896(0x14e)](_0x285896(0x10f));return;}console[_0x285896(0x14e)]('\x0a'+_0x4c9d8c);const _0x552af9=Object[_0x285896(0x16f)](_0x309a69[0x0])[_0x285896(0x1b8)](_0x101561=>({'name':_0x101561,'type':typeof _0x309a69[0x0][_0x101561]==='number'?'double':_0x285896(0x1a8)})),_0x41f688={'queryId':'preview','columns':_0x552af9,'data':_0x309a69,'stats':{'state':_0x285896(0x1eb),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x309a69[_0x285896(0x18e)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0xfdb5c9=formatAsTable(_0x41f688,_0x309a69[_0x285896(0x18e)],!![]);await writeOutput(_0xfdb5c9,undefined,_0x285896(0x1ee));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x885404(0x20a)]=a23_0x885404(0x155);[a23_0x885404(0x1a5)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0xe19e9d){const _0x169105=a23_0x885404,{options:_0x220aa3,args:_0x3227d7,tdx:_0x11bfda}=_0xe19e9d,_0x21ddf7=_0x220aa3,_0x50686b=_0x3227d7[0x0]||_0x220aa3['parentSegment'];if(!_0x50686b)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'+_0x169105(0x1d4)),0x1;const _0x1fd3fa=resolveYamlFile(_0x50686b);if(existsSync(_0x1fd3fa)){_0x21ddf7['verbose']&&console[_0x169105(0x14e)](_0x169105(0xf1)+_0x1fd3fa);let _0x22beb5;try{_0x22beb5=readFileSync(_0x1fd3fa,_0x169105(0x186));}catch(_0x3f74b4){const _0x439749=_0x3f74b4 instanceof Error?_0x3f74b4[_0x169105(0x15f)]:String(_0x3f74b4);return console[_0x169105(0x14e)](_0x169105(0x11c)+_0x439749),0x1;}const _0x55bc84=await withSpinner(_0x169105(0x144),()=>_0x11bfda[_0x169105(0xee)][_0x169105(0x1db)](_0x22beb5),{'verbose':_0x21ddf7['verbose']}),_0x207e54=_0x55bc84[_0x169105(0xfa)],{isNew:_0x46a23a,name:_0xb597ff,hasChanges:_0x49c34a,diffFormatted:_0x4f53b2}=_0x207e54;if(_0x49c34a){_0x46a23a?console[_0x169105(0x14e)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xb597ff+'\x27:'):console[_0x169105(0x14e)](_0x169105(0x1ae)+_0xb597ff+'\x27:');console[_0x169105(0x14e)]('─'[_0x169105(0x178)](0x3c)),console['error'](_0x4f53b2),console[_0x169105(0x14e)]('─'['repeat'](0x3c));const _0x30fa3c=_0x46a23a?_0x169105(0x1d6)+_0xb597ff+_0x169105(0x156):_0x169105(0x1d2)+_0xb597ff+'\x27\x20and\x20run\x20workflow?';if(!_0x21ddf7[_0x169105(0x1a6)]){if(!isInteractive())return console['error'](a23_0x3386dc[_0x169105(0x148)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x169105(0x14e)](a23_0x3386dc['dim'](_0x169105(0x13d))),0x1;const _0x3e8c6f=await confirmKey(_0x30fa3c);if(!_0x3e8c6f)return console[_0x169105(0x14e)](a23_0x3386dc[_0x169105(0x1ef)](_0x169105(0x191))),0x1;}const _0x1c4639=_0x46a23a?_0x169105(0x1c1):_0x169105(0x1f5);await withSpinner(_0x1c4639+_0x169105(0xf3)+_0xb597ff+_0x169105(0x127),()=>_0x207e54[_0x169105(0x175)](),{'verbose':_0x21ddf7[_0x169105(0xf0)]});const _0x4a5bcf=_0x46a23a?_0x169105(0x1dc):'Updated';console[_0x169105(0x14e)]('✔\x20'+_0x4a5bcf+_0x169105(0xf3)+_0xb597ff+'\x27');}else console['error'](_0x169105(0x198)+_0xb597ff+_0x169105(0x122));}const _0x434a37=await withSpinner(_0x169105(0x1e6)+_0x50686b+_0x169105(0x127),()=>_0x11bfda[_0x169105(0xee)]['runParent'](_0x50686b),{'verbose':_0x21ddf7[_0x169105(0xf0)]}),_0xc917df=_0x434a37[_0x169105(0xfa)],_0x3d9759=getConsoleUrl(_0x21ddf7[_0x169105(0xf4)],_0x169105(0x1da)+_0xc917df[_0x169105(0x1b5)]+_0x169105(0x18c)+_0xc917df[_0x169105(0x1cf)]+_0x169105(0x109)+_0xc917df[_0x169105(0x100)]);return console[_0x169105(0x14e)](_0x169105(0x1ec)),console[_0x169105(0x14e)]('\x20\x20'+a23_0x3386dc['dim'](_0x169105(0x1b3))+'\x20'+_0xc917df[_0x169105(0x21a)]),console['error']('\x20\x20'+a23_0x3386dc['dim'](_0x169105(0x173))+'\x20'+_0xc917df['status']),console[_0x169105(0x14e)]('\x20\x20'+a23_0x3386dc[_0x169105(0x1f9)]('Session:')+'\x20'+_0xc917df['workflowSessionId']),console['error']('\x20\x20'+a23_0x3386dc[_0x169105(0x1f9)](_0x169105(0x1bb))+'\x20'+_0xc917df['workflowAttemptId']),console[_0x169105(0x14e)]('\x20\x20'+_0x3d9759),console[_0x169105(0x14e)]('\x0a'+a23_0x3386dc[_0x169105(0x1f9)](_0x169105(0xf9))+_0x169105(0x212)+_0xc917df[_0x169105(0x100)]+_0x169105(0x210)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a23_0x885404(0x110);[a23_0x885404(0x1a5)]=a23_0x885404(0x1c8);async[a23_0x885404(0x11e)](_0x28ea87){const _0x4c7501=a23_0x885404,{options:_0x5b9ddc,args:_0x503141,tdx:_0x1acf2d}=_0x28ea87,_0x447a9b=_0x503141[0x0]||_0x5b9ddc['parentSegment'];if(!_0x447a9b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x4c7501(0xfe)),0x1;_0x5b9ddc[_0x4c7501(0xf0)]&&(console[_0x4c7501(0x14e)](_0x4c7501(0x1d7)+_0x5b9ddc[_0x4c7501(0xf4)]),console['error'](_0x4c7501(0x135)+_0x447a9b));const _0x5528d6=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x447a9b+_0x4c7501(0x127),()=>_0x1acf2d['segment'][_0x4c7501(0x1b4)](_0x447a9b),{'verbose':_0x5b9ddc[_0x4c7501(0xf0)]}),_0x393fe6=_0x5528d6['data'];console['error'](_0x4c7501(0x158)+_0x393fe6[_0x4c7501(0x18e)]+_0x4c7501(0x17d)+(_0x393fe6['length']!==0x1?'s':''));if(_0x5b9ddc[_0x4c7501(0x184)]||_0x5b9ddc['jsonl'])return await handleSDKOutput(_0x393fe6,_0x5b9ddc),0x0;return displayFieldsHumanReadable(_0x393fe6,_0x447a9b),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x885404(0x20a)]=a23_0x885404(0x204);['description']=a23_0x885404(0x1d1);async[a23_0x885404(0x11e)](_0x5813dd){const _0xb39423=a23_0x885404,{options:_0xe5d993,args:_0x23e0c1,tdx:_0x5ed44d}=_0x5813dd,_0x22d90c=_0xe5d993,_0x26b198=_0x23e0c1[0x0]||_0xe5d993['parentSegment'];if(!_0x26b198)return showParentSegmentNotSetError(_0xb39423(0xf5)+_0xb39423(0xf6)+'Options:\x0a'+_0xb39423(0x128)),0x1;_0xe5d993[_0xb39423(0xf0)]&&(console[_0xb39423(0x14e)](_0xb39423(0x1d7)+_0xe5d993[_0xb39423(0xf4)]),console[_0xb39423(0x14e)](_0xb39423(0x135)+_0x26b198));const _0x29b904=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x26b198+'\x27...',()=>_0x5ed44d[_0xb39423(0xee)][_0xb39423(0x1b7)](_0x26b198),{'verbose':_0xe5d993[_0xb39423(0xf0)]}),_0x5078a8=_0x29b904[_0xb39423(0xfa)];if(_0x22d90c[_0xb39423(0x1c5)]){const _0x28efda=getConsoleNextUrl(_0x22d90c['site'],_0xb39423(0x1fb)+_0x5078a8['id']);return console[_0xb39423(0x14e)](a23_0x3386dc['green']('✔')+'\x20Opening\x20'+a23_0x3386dc[_0xb39423(0x164)](_0x28efda)),openBrowser(_0x28efda),0x0;}return await handleSingleObjectOutput(_0x5078a8,_0xe5d993),0x0;}}function a23_0x5213(){const _0x43d050=['\x20--attribute\x20\x22','27jEjhoG','\x27\x20with\x20ID:\x20','\x20No\x20changes\x20-\x20','bold','schemaValid','attributesFile','log','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error\x20reading\x20file:\x20','ignore','execute','Master\x20+\x20Attributes','addAttributesFile','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x27\x20is\x20up\x20to\x20date','6356570NZVopG','parentSegment','jobId','segment:parent:pull','\x27...','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','in\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Join:','format','sampleData','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','trim','session','getParentSQL','all','Parent\x20segment:\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','displayPreviewHints','Fetching\x20SQL\x20for\x20\x27','isDirectory','Events:','schemaError','Error\x20parsing\x20YAML:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','foreignKey','stats','Validating\x20configuration...','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20\x20\x20-\x20','Analyzing\x20changes...','run','start','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','red','\x0aUsage:\x20tdx\x20ps\x20preview\x20','test','elapsedTimeMillis','Executing\x20parent\x20segment\x20query...','Master:','error','3506200rpnmhf','Listing\x20parent\x20segments...','Errors:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','resolveParentId','segment:parent:run','\x27\x20and\x20run\x20workflow?','-1d','✔\x20Found\x20','\x20--attribute\x20\x22<name>\x22','using\x20the\x20default\x20path:\x20','48aJsMxR','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','72ixTkyC','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','message','Customers:','.yaml','displayAttributesStats','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','cyan','segment:parent:validate','SQL\x20query:\x0a','Source:','\x20Configuration\x20is\x20valid','sort','addAttributes','previewParentYaml','/\x20and\x20','customerGroupFile','Error:\x20--behavior\x20requires\x20a\x20name\x0a','keys','join','timezone','\x20--behavior\x20\x22','Status:','Listing\x20parent\x20segments\x20matching\x20\x27','apply','master','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','repeat','filter','displaySampleData','532742SkonEo','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20field','\x0aChanges\x20to\x20\x27','\x20is\x20already\x20up\x20to\x20date','stop','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Fetching\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','json','Join\x20on:','utf-8','toFixed','validateParentYaml','scheduleType','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','1ukmgBG','/sessions/','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','length','endsWith','displayColumns','Aborted.','3453336EJEzfc','Preview:','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:sql','createParent','Database:\x20','✔\x20No\x20changes\x20-\x20\x27','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Behavior:','allValid','processedRows','setJobId','totalEvents','behaviors','YAML\x20file:\x20','Updating\x20parent\x20segment\x20\x27','parent_segment','Options:\x0a','attributes','description','yes','3507614hXJVRQ','varchar','displayMasterInfo','addBehaviorsFile','toLocaleString','`\x20to\x20download\x20the\x20configuration\x20first','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x0aChanges\x20to\x20apply\x20to\x20\x27','use','\x20--behavior\x20\x22<name>\x22','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Behaviors','Audience\x20ID:','listFields','workflowId','joinKey','getParentFull','map','260328LJgDVM','column','Attempt:','customerPercent','rowCount','\x20--enriched','xdg-open','\x20[Job\x20ID:\x20','Creating','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','2172686PaQMZx','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','web','customerGroup','errors','List\x20available\x20fields\x20for\x20segmentation','displayPreviewResults','displayValidateResults','Resolving\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','green','\x20--interval\x20','workflowSessionId','label','Show\x20parent\x20segment\x20details','Apply\x20changes\x20to\x20\x27','\x0a⚠️\x20\x20Migrating:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Create\x20parent\x20segment\x20\x27','Site:\x20','\x0aError:','customersWithEvents','/app/workflows/','pushParentYaml','Created','platform','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','open','Error:\x20Parent\x20segment\x20name\x20is\x20required','Options\x20(one\x20required):\x0a','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x0aNo\x20sample\x20data\x20available','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','displaySummary','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','updateParent','\x20=\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','✔\x20Query\x20completed:\x20Processed\x20','FINISHED','\x0a✔\x20Workflow\x20started','Rows:','table','yellow','enriched','\x20Context\x20set:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','jsonl','Attribute:','Updating','segment:parent:push','%)\x20','Table:\x20','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','/app/dw/parentSegments/','segment:parent:show','string','replace','👥\x20','Overwrite\x20\x27','coveragePercent','Updated','Error:','segment:parent:view','\x0a⚠️\x20\x20Both\x20','interval','tdx\x20segment\x20parent\x20preview\x20','/\x20directories\x20exist.','text','name','108bdEtNG','Available\x20attributes:','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x5c$&','population','\x20kill','database','\x20tdx\x20wf\x20attempt\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Validate:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Options:','localeCompare','\x20rows)','Columns:','audienceId','columns','Fetching\x20current\x20configuration\x20for\x20\x27','pullParentYaml','/{name}.yml\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','To\x20view\x20sample\x20data:','addBehaviors','Creating\x20parent\x20segment\x20\x27','Pattern:\x20','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment','✔\x20Updated\x20parent\x20segment\x20\x27','verbose','Found\x20YAML\x20file:\x20','scheduleOption','\x20parent\x20segment\x20\x27','site','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','displayBehaviorsStats','Enriched:','To\x20cancel:','data','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','parent_segments','segment:parent:preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','List\x20parent\x20segments','workflowAttemptId','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','behavior','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','darwin','segment:parent:create','output','segment:parent:list','.yml','/attempt/','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Name:\x20','attribute','Error:\x20File\x20not\x20found:\x20','query','\x20\x20No\x20sample\x20data\x20available','segment:parent:fields','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','matchedCount'];a23_0x5213=function(){return _0x43d050;};return a23_0x5213();}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x885404(0x20a)]='segment:parent:desc';[a23_0x885404(0x1a5)]=a23_0x885404(0x1e2);async[a23_0x885404(0x11e)](_0x406d92){const _0x10337e=a23_0x885404,{options:_0x46c1d3,args:_0x1ab83d,tdx:_0x3f5c8f}=_0x406d92,_0x50f21d=_0x1ab83d[0x0]||_0x46c1d3[_0x10337e(0x124)];if(!_0x50f21d)return showParentSegmentNotSetError(_0x10337e(0x199)+_0x10337e(0x152)),0x1;_0x46c1d3[_0x10337e(0xf0)]&&(console[_0x10337e(0x14e)](_0x10337e(0x1d7)+_0x46c1d3[_0x10337e(0xf4)]),console[_0x10337e(0x14e)]('Parent\x20segment:\x20'+_0x50f21d));const _0x5ece1f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x50f21d+_0x10337e(0x127),()=>_0x3f5c8f[_0x10337e(0xee)][_0x10337e(0x154)](_0x50f21d),{'verbose':_0x46c1d3[_0x10337e(0xf0)]}),_0x49368c=_0x5ece1f['data'],_0xa40cf=await withSpinner(_0x10337e(0x138)+_0x50f21d+_0x10337e(0x127),()=>_0x3f5c8f['segment'][_0x10337e(0x133)](_0x49368c),{'verbose':_0x46c1d3[_0x10337e(0xf0)]}),_0x1ef4ee=await executeSchemaQuery(_0xa40cf['data'],_0x3f5c8f,_0x46c1d3);return await handleQueryOutput(_0x1ef4ee,_0x46c1d3),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x885404(0x20a)]=a23_0x885404(0x195);[a23_0x885404(0x1a5)]=a23_0x885404(0x1e9);async[a23_0x885404(0x11e)](_0x3db2b5){const _0x2a364c=a23_0x885404,{options:_0x2cc2d5,args:_0x43a1e3,tdx:_0x3827ce}=_0x3db2b5,_0x4c8e24=_0x43a1e3[0x0]||_0x2cc2d5[_0x2a364c(0x124)];if(!_0x4c8e24)return showParentSegmentNotSetError(_0x2a364c(0x103)+_0x2a364c(0x1fa)),0x1;_0x2cc2d5[_0x2a364c(0xf0)]&&(console[_0x2a364c(0x14e)](_0x2a364c(0x1d7)+_0x2cc2d5[_0x2a364c(0xf4)]),console['error'](_0x2a364c(0x135)+_0x4c8e24));const _0x202f65=await withSpinner(_0x2a364c(0x1cb)+_0x4c8e24+_0x2a364c(0x127),()=>_0x3827ce['segment'][_0x2a364c(0x154)](_0x4c8e24),{'verbose':_0x2cc2d5[_0x2a364c(0xf0)]}),_0x138300=_0x202f65[_0x2a364c(0xfa)],_0x116061=await withSpinner(_0x2a364c(0x138)+_0x4c8e24+_0x2a364c(0x127),()=>_0x3827ce[_0x2a364c(0xee)][_0x2a364c(0x133)](_0x138300),{'verbose':_0x2cc2d5['verbose']}),_0x491e4f=_0x116061[_0x2a364c(0xfa)];return _0x2cc2d5[_0x2a364c(0x12e)]===_0x2a364c(0x184)||_0x2cc2d5[_0x2a364c(0x12e)]===_0x2a364c(0x1f3)?await handleSDKOutput([{'sql':_0x491e4f}],_0x2cc2d5):console[_0x2a364c(0x11a)](_0x491e4f),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a23_0x885404(0x1fc);[a23_0x885404(0x1a5)]=a23_0x885404(0x1c2);async[a23_0x885404(0x11e)](_0x48d4de){const _0xc03649=a23_0x885404,{options:_0x2b9267,args:_0x43799a,tdx:_0x5dd687}=_0x48d4de,_0x2e65ce=_0x43799a[0x0]||_0x2b9267[_0xc03649(0x124)];if(!_0x2e65ce)return showParentSegmentNotSetError(_0xc03649(0x10a)+_0xc03649(0x153)),0x1;_0x2b9267[_0xc03649(0xf0)]&&(console[_0xc03649(0x14e)](_0xc03649(0x1d7)+_0x2b9267[_0xc03649(0xf4)]),console['error'](_0xc03649(0x135)+_0x2e65ce));const _0x4a2e55=await withSpinner(_0xc03649(0x1cb)+_0x2e65ce+'\x27...',()=>_0x5dd687[_0xc03649(0xee)]['resolveParentId'](_0x2e65ce),{'verbose':_0x2b9267[_0xc03649(0xf0)]}),_0x1b0454=_0x4a2e55[_0xc03649(0xfa)],_0x89bf4b=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2e65ce+_0xc03649(0x127),()=>_0x5dd687[_0xc03649(0xee)][_0xc03649(0x133)](_0x1b0454),{'verbose':_0x2b9267[_0xc03649(0xf0)]});let _0x1fa0ac=_0x89bf4b[_0xc03649(0xfa)];const _0xb0e89e=resolveLimit(_0x2b9267['limit'],DEFAULT_DISPLAY_LIMIT),_0x4d1fe1=/\bLIMIT\s+\d+/i[_0xc03649(0x14a)](_0x1fa0ac);!_0x4d1fe1&&(_0x1fa0ac=_0x1fa0ac[_0xc03649(0x131)]()['replace'](/;+$/,''),_0x1fa0ac=_0xc03649(0x194)+_0x1fa0ac+_0xc03649(0xfb)+_0xb0e89e);_0x2b9267[_0xc03649(0xf0)]&&console[_0xc03649(0x14e)](_0xc03649(0x166)+_0x1fa0ac);const _0x3515d9=await withProgressSpinner(_0xc03649(0x14c),async _0xd1a331=>{const _0xda1115=_0xc03649,_0x41309d=await _0x5dd687[_0xda1115(0x10e)][_0xda1115(0x11e)](_0x1fa0ac,{'catalog':'td','schema':'information_schema','onJobId':_0x5ae42e=>{const _0x4458c3=_0xda1115;_0xd1a331[_0x4458c3(0x19d)](_0x5ae42e);}});return _0x41309d;},{'verbose':_0x2b9267['verbose']}),_0x1ab703=_0x3515d9[_0xc03649(0xfa)],_0x450798=_0x1ab703[_0xc03649(0x125)]?_0xc03649(0x1c0)+_0x1ab703[_0xc03649(0x125)]+']':'';return console['error'](_0xc03649(0x1ea)+_0x1ab703['stats'][_0xc03649(0x19c)][_0xc03649(0x1ab)]()+'\x20rows\x20'+(_0xc03649(0x129)+formatElapsed(_0x1ab703[_0xc03649(0x13f)][_0xc03649(0x14b)])+_0x450798)),await handleQueryOutput(_0x1ab703,_0x2b9267),0x0;}}
1
+ const a23_0x256744=a23_0x1cce;(function(_0x584bf2,_0x1d03d9){const _0x5785f2=a23_0x1cce,_0x2cb331=_0x584bf2();while(!![]){try{const _0x1ab42d=-parseInt(_0x5785f2(0x19c))/0x1+-parseInt(_0x5785f2(0x1c1))/0x2*(parseInt(_0x5785f2(0x217))/0x3)+parseInt(_0x5785f2(0x145))/0x4*(parseInt(_0x5785f2(0x226))/0x5)+parseInt(_0x5785f2(0x21d))/0x6+parseInt(_0x5785f2(0x176))/0x7+parseInt(_0x5785f2(0x1a1))/0x8*(-parseInt(_0x5785f2(0x1f3))/0x9)+parseInt(_0x5785f2(0x229))/0xa;if(_0x1ab42d===_0x1d03d9)break;else _0x2cb331['push'](_0x2cb331['shift']());}catch(_0x53400a){_0x2cb331['push'](_0x2cb331['shift']());}}}(a23_0x1d30,0xc5b70));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x40454a from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x3bbb99 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x256744(0x1e2),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x31824e){const _0x11c382=a23_0x256744,_0x569c1f=process[_0x11c382(0x1ef)],_0x59c0da=_0x569c1f==='darwin'?_0x11c382(0x218):_0x569c1f===_0x11c382(0x1bf)?_0x11c382(0x119):_0x11c382(0x184);spawn(_0x59c0da,[_0x31824e],{'detached':!![],'stdio':_0x11c382(0xf9)})['unref']();}function migrateLegacyDirectory(){const _0xfe00d3=a23_0x256744;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x461fe3=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x461fe3[_0xfe00d3(0x231)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xfe00d3(0x11d)](a23_0x3bbb99['yellow'](_0xfe00d3(0x227)+LEGACY_PARENT_SEGMENT_DIR+_0xfe00d3(0x191)+PARENT_SEGMENT_DIR+_0xfe00d3(0x1f1))),console['error'](a23_0x3bbb99['dim'](_0xfe00d3(0x1a0)+LEGACY_PARENT_SEGMENT_DIR+_0xfe00d3(0x1e3))),![];console[_0xfe00d3(0x11d)](a23_0x3bbb99[_0xfe00d3(0x208)](_0xfe00d3(0x1f4)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0xfe00d3(0x11d)](a23_0x3bbb99[_0xfe00d3(0x1c7)](_0xfe00d3(0x199)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x5e2d3e){const _0x567e11=_0x5e2d3e instanceof Error?_0x5e2d3e[_0xfe00d3(0x125)]:String(_0x5e2d3e);return console['error'](a23_0x3bbb99[_0xfe00d3(0x133)](_0xfe00d3(0x1c8)+_0x567e11+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x164e45){const _0x3fbea8=a23_0x256744;return migrateLegacyDirectory(),super[_0x3fbea8(0x165)](_0x164e45);}}function resolveYamlFile(_0x466412){const _0x73ceff=a23_0x256744;if(_0x466412['endsWith'](_0x73ceff(0x12e))||_0x466412[_0x73ceff(0x1ae)](_0x73ceff(0x123)))return _0x466412;return a23_0x40454a[_0x73ceff(0x156)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x466412)+_0x73ceff(0x12e));}function a23_0x1cce(_0x5ac3a7,_0x1b125c){_0x5ac3a7=_0x5ac3a7-0xf8;const _0x1d3052=a23_0x1d30();let _0x1cced3=_0x1d3052[_0x5ac3a7];return _0x1cced3;}function formatProgressMessage(_0x294a6a){const _0x57deb6=a23_0x256744,_0x32d565=_0x294a6a[_0x57deb6(0x1e4)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x32d565){const [,_0x4ee758,_0x312c45,_0x4a1e35='']=_0x32d565;return a23_0x3bbb99[_0x57deb6(0xfc)](_0x4ee758+':')+'\x20'+_0x312c45+a23_0x3bbb99['dim'](_0x4a1e35);}return a23_0x3bbb99[_0x57deb6(0xfc)](_0x294a6a);}function showFileNotFoundError(_0x435a2e,_0x31f6bd){const _0x977d37=a23_0x256744;console[_0x977d37(0x11d)](a23_0x3bbb99['red']('Error:\x20File\x20not\x20found:\x20'+_0x435a2e+'\x0a')),console['error'](a23_0x3bbb99[_0x977d37(0x172)](_0x977d37(0x1bb)+_0x31f6bd+_0x977d37(0x15e)));}function a23_0x1d30(){const _0x1e0cca=['length','Customers:','Fetching\x20parent\x20segment\x20\x27','jsonl','.yml','Events:','Columns:','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','runParent','red','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','createParent','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20tdx\x20wf\x20attempt\x20','Error\x20reading\x20file:\x20','\x20field','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','workflowSessionId','test','/{name}.yml\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x0aNo\x20sample\x20data\x20available','segment:parent:run','Parent\x20segment:\x20','56hArNSK','previewParentYaml','Error:','\x5c$&','session','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','in\x20','output','customersWithEvents','utf-8','Resolving\x20parent\x20segment\x20\x27','totalEvents','workflowAttemptId','setJobId','foreignKey','displayAttributesStats','web','join','allValid','jobId','query','behaviorsFile','number','Status:','stop','`\x20to\x20download\x20the\x20configuration\x20first','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Attribute:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','errors','/app/workflows/','SQL\x20query:\x0a','run','✔\x20Updated\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','To\x20view\x20sample\x20data:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','customerGroup','\x20--attribute\x20\x22<name>\x22','addBehaviorsFile','\x0aChanges\x20to\x20\x27','attributesFile','addAttributesFile','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','text','cyan','Error\x20parsing\x20YAML:\x20','bold','string','11008340liGQup','updateParent','segment:parent:view','✔\x20Found\x20','\x0aNew\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Error:\x20--attribute\x20requires\x20a\x20name\x0a','displayBehaviorsStats','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20--enriched','SELECT\x20*\x20FROM\x20(\x0a','listFields','segment:parent:update','behaviors','xdg-open','YAML\x20file:\x20','\x27\x20with\x20ID:\x20','Apply\x20changes\x20to\x20\x27','pullParentYaml','segment:parent:create','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','table','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','attribute','listParents','\x20--behavior\x20\x22','\x20=\x20','/\x20and\x20','Validate:','Show\x20parent\x20segment\x20details','segment','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x27...','\x27\x20is\x20already\x20up\x20to\x20date','Join:','✔\x20Renamed\x20directory\x20to\x20','Executing\x20parent\x20segment\x20query...','Updated','395216pvzGpJ','/attempt/','\x20Configuration\x20is\x20valid','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','72VNsnFN','addBehaviors','rowCount','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20parent\x20segment','stats','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','✔\x20No\x20changes\x20-\x20\x27','all','processedRows','\x20\x20No\x20sample\x20data\x20available','enriched','endsWith','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','customerPercent','\x20is\x20already\x20up\x20to\x20date','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0aUsage:\x20tdx\x20ps\x20preview\x20','sampleData','audienceId','\x20rows)','database','displayPreviewResults','\x20parent\x20segment\x20\x27','scheduleType','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Found\x20YAML\x20file:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','segment:parent:validate','win32','segment:parent:sql','349756CFlRYi','Coverage:','resolveParentId','✔\x20Created\x20parent\x20segment\x20\x27','double','List\x20available\x20fields\x20for\x20segmentation','green','✘\x20Failed\x20to\x20rename\x20directory:\x20','format','Preview:','Attributes','execute','Behavior:','coveragePercent','Rows:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','behavior','Master:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','schemaValid','No\x20parent\x20segments\x20match\x20pattern:\x20','site','varchar','\x20rows\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Join\x20on:','Fetching\x20SQL\x20for\x20\x27','data','Options:\x0a','segment:parent:push','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x27\x20is\x20up\x20to\x20date','parent_segments','/\x20directory.\x0a','match','Listing\x20parent\x20segments...','Behaviors','repeat','parentSegment','name','Fetching\x20sample\x20data...','Available\x20attributes:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Enriched:','description','platform','Audience\x20ID:','/\x20directories\x20exist.','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','1406385ZZbJWk','\x0a⚠️\x20\x20Migrating:\x20','getParentFull','Session:','interval','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','displayPreviewHints','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x27\x20and\x20run\x20workflow?','addAttributes','scheduleOption','schemaError','Attempt:','/sessions/','Errors:','Database:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','displayMasterInfo','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Master\x20Table','yellow','column','\x20No\x20changes\x20-\x20','parent_segment','workflowId','json','Get\x20SQL\x20query\x20for\x20parent\x20segment','filter','Name:\x20','pushParentYaml','Analyzing\x20changes...','information_schema','matchedCount','log','FINISHED','27ZyHPgs','open','-1d','segment:parent:preview','Source:','Site:\x20','4860726ERuMYO','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','limit','yes','status','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','apply','/app/dw/parentSegments/','Listing\x20parent\x20segments\x20matching\x20\x27','264565aiGStG','\x0a⚠️\x20\x20Both\x20','To\x20cancel:','10618200SkBlmk','attributes','timezone','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','keys','Updating\x20parent\x20segment\x20\x27','dirname','population','isDirectory','joinKey','use','\x20--interval\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','getParentSQL','ignore','displaySampleData','displaySummary','dim','Updating','preview','label','Created','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20Opening\x20','toFixed','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','toLocaleString','Fetching\x20current\x20configuration\x20for\x20\x27','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Output\x20file:\x20','\x20--attribute\x20\x22','segment:parent:pull','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:fields','replace','tdx\x20segment\x20parent\x20preview\x20','List\x20parent\x20segments','\x0aError:','displayColumns','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Aborted.','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','map','displayValidateResults','👥\x20','start','sort','segment:parent:desc','\x20\x20\x20\x20-\x20','error','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','verbose','\x20Context\x20set:\x20','Creating','.yaml','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','message','master','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Available\x20behaviors:','No\x20parent\x20segments\x20found'];a23_0x1d30=function(){return _0x1e0cca;};return a23_0x1d30();}function showParentSegmentNotSetError(_0x3e92d3){const _0x509a1d=a23_0x256744;console[_0x509a1d(0x11d)](a23_0x3bbb99[_0x509a1d(0x208)](_0x509a1d(0x1a8))),console[_0x509a1d(0x11d)](_0x3e92d3);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x256744(0x1e9)]='segment:parent:list';['description']=a23_0x256744(0x110);async['execute'](_0x2f57c7){const _0x550abc=a23_0x256744,{options:_0x5745b1,args:_0x3b16ed,tdx:_0xfc997d}=_0x2f57c7,_0x49e8d1=_0x3b16ed[0x0];_0x5745b1[_0x550abc(0x120)]&&(console[_0x550abc(0x11d)]('Site:\x20'+_0x5745b1[_0x550abc(0x1d7)]),_0x49e8d1&&console[_0x550abc(0x11d)]('Pattern:\x20'+_0x49e8d1));const _0xe9d300=await withSpinner(_0x49e8d1?_0x550abc(0x225)+_0x49e8d1+'\x27...':_0x550abc(0x1e5),()=>_0xfc997d[_0x550abc(0x194)][_0x550abc(0x18e)](),{'verbose':_0x5745b1[_0x550abc(0x120)]});let _0x4a7892=_0xe9d300[_0x550abc(0x1dd)];if(_0x49e8d1){const _0x4c1a1d=_0x49e8d1[_0x550abc(0x10e)](/[.+^${}()|[\]\\]/g,_0x550abc(0x148))[_0x550abc(0x10e)](/\*/g,'.*')[_0x550abc(0x10e)](/\?/g,'.'),_0x36fc8d=new RegExp('^'+_0x4c1a1d+'$','i');_0x4a7892=_0x4a7892[_0x550abc(0x20f)](_0x12c7e4=>_0x36fc8d['test'](_0x12c7e4[_0x550abc(0x22a)][_0x550abc(0x1e9)]));}_0x4a7892[_0x550abc(0x11a)]((_0x1f1b7c,_0x24044f)=>_0x1f1b7c[_0x550abc(0x22a)][_0x550abc(0x1e9)]['localeCompare'](_0x24044f[_0x550abc(0x22a)][_0x550abc(0x1e9)])),console[_0x550abc(0x11d)]('✔\x20Found\x20'+_0x4a7892[_0x550abc(0x12a)]+_0x550abc(0x1a5)+(_0x4a7892[_0x550abc(0x12a)]!==0x1?'s':''));const _0x57e1c8=_0x81d4eb=>{const _0x5a2a11=_0x550abc;return getConsoleNextUrl(_0x5745b1[_0x5a2a11(0x1d7)],_0x5a2a11(0x224)+_0x81d4eb);};if(_0x5745b1['format']===_0x550abc(0x20d)||_0x5745b1[_0x550abc(0x1c9)]===_0x550abc(0x12d)){const _0x2c600f=_0x4a7892['map'](_0xe71415=>({..._0xe71415,'url':_0x57e1c8(_0xe71415['id'])}));await handleSDKOutput(_0x2c600f,_0x5745b1);}else{if(_0x4a7892[_0x550abc(0x12a)]===0x0)_0x49e8d1?console['log'](_0x550abc(0x1d6)+_0x49e8d1):console[_0x550abc(0x215)](_0x550abc(0x129));else for(const _0xb93ec8 of _0x4a7892){const _0x20317d=_0xb93ec8[_0x550abc(0x22a)]['population']?a23_0x3bbb99['dim']('\x20('+formatRows(_0xb93ec8['attributes'][_0x550abc(0x230)])+')'):'',_0x55145a=hyperlink(_0xb93ec8[_0x550abc(0x22a)][_0x550abc(0x1e9)],_0x57e1c8(_0xb93ec8['id']));console['log'](_0x550abc(0x118)+_0x55145a+_0x20317d);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x189);[a23_0x256744(0x1ee)]=a23_0x256744(0x1bd);async[a23_0x256744(0x1cc)](_0xc471a2){const _0x4b329e=a23_0x256744,{options:_0x441f6c,args:_0x176db4,tdx:_0x8b4d1d}=_0xc471a2;console[_0x4b329e(0x11d)](_0x4b329e(0x102)+_0x4b329e(0x141)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x4b9aad=_0x441f6c;if(_0x176db4['length']===0x0)return console['error'](a23_0x3bbb99[_0x4b329e(0x133)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x4b329e(0x139)),0x1;const _0x4b3a11=_0x176db4[0x0];if(!_0x4b9aad['database']||!_0x4b9aad[_0x4b329e(0x18b)])return console[_0x4b329e(0x11d)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x4b329e(0x11d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x4b9aad[_0x4b329e(0x120)]&&(console[_0x4b329e(0x11d)](_0x4b329e(0x21c)+_0x4b9aad[_0x4b329e(0x1d7)]),console['error'](_0x4b329e(0x210)+_0x4b3a11),console[_0x4b329e(0x11d)](_0x4b329e(0x203)+_0x4b9aad[_0x4b329e(0x1b7)]),console['error']('Table:\x20'+_0x4b9aad[_0x4b329e(0x18b)]));const _0x9031f=await loadJSONFromOptions(_0x4b9aad['attributes'],_0x4b9aad[_0x4b329e(0x16e)]),_0x2e8490=await loadJSONFromOptions(_0x4b9aad[_0x4b329e(0x183)],_0x4b9aad[_0x4b329e(0x15a)]),_0x33c5db=await loadJSONFromOptions(_0x4b9aad[_0x4b329e(0x16a)],_0x4b9aad['customerGroupFile']),_0x1e5bc6={'name':_0x4b3a11,'description':_0x4b9aad['description'],'scheduleType':_0x4b9aad[_0x4b329e(0x1ba)],'scheduleOption':_0x4b9aad[_0x4b329e(0x1fe)],'timezone':_0x4b9aad['timezone'],'master':{'parentDatabaseName':_0x4b9aad[_0x4b329e(0x1b7)],'parentTableName':_0x4b9aad[_0x4b329e(0x18b)]},'attributes':_0x9031f,'behaviors':_0x2e8490,'customerGroup':_0x33c5db},_0x3b40e0=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x4b3a11+_0x4b329e(0x196),()=>_0x8b4d1d[_0x4b329e(0x194)][_0x4b329e(0x136)](_0x1e5bc6),{'verbose':_0x441f6c[_0x4b329e(0x120)]}),_0x353d8f=_0x3b40e0[_0x4b329e(0x1dd)];return console[_0x4b329e(0x11d)](_0x4b329e(0x1c4)+_0x353d8f[_0x4b329e(0x1e9)]+_0x4b329e(0x186)+_0x353d8f['id']),await handleSDKOutput([_0x353d8f],_0x441f6c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x182);[a23_0x256744(0x1ee)]=a23_0x256744(0x1ec);async[a23_0x256744(0x1cc)](_0x4d82e3){const _0x3d5ad2=a23_0x256744,{options:_0x364de9,args:_0x5cd63d,tdx:_0x2f9bad}=_0x4d82e3;console[_0x3d5ad2(0x11d)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x3d5ad2(0x141)+_0x3d5ad2(0x134));const _0x29cb17=_0x364de9;if(_0x5cd63d[_0x3d5ad2(0x12a)]===0x0)return console[_0x3d5ad2(0x11d)](a23_0x3bbb99['red'](_0x3d5ad2(0x204))),console[_0x3d5ad2(0x11d)](_0x3d5ad2(0x222)),0x1;const _0x1b614f=_0x5cd63d[0x0];_0x29cb17[_0x3d5ad2(0x120)]&&(console[_0x3d5ad2(0x11d)]('Site:\x20'+_0x29cb17['site']),console[_0x3d5ad2(0x11d)](_0x3d5ad2(0x144)+_0x1b614f));const _0x4205ac=await withSpinner(_0x3d5ad2(0x107)+_0x1b614f+_0x3d5ad2(0x196),()=>_0x2f9bad[_0x3d5ad2(0x194)]['getParentFull'](_0x1b614f),{'verbose':_0x29cb17['verbose']}),_0x5aa545=_0x4205ac[_0x3d5ad2(0x1dd)],_0x8cb792=await loadJSONFromOptions(_0x29cb17[_0x3d5ad2(0x1fd)],_0x29cb17[_0x3d5ad2(0x16f)]),_0x535cb2=await loadJSONFromOptions(_0x29cb17[_0x3d5ad2(0x1a2)],_0x29cb17[_0x3d5ad2(0x16c)]),_0x2e5640={'name':_0x5aa545[_0x3d5ad2(0x1e9)],'description':_0x29cb17[_0x3d5ad2(0x1ee)]!==undefined?_0x29cb17[_0x3d5ad2(0x1ee)]:_0x5aa545[_0x3d5ad2(0x1ee)],'scheduleType':_0x29cb17[_0x3d5ad2(0x1ba)]!==undefined?_0x29cb17[_0x3d5ad2(0x1ba)]:_0x5aa545[_0x3d5ad2(0x1ba)],'scheduleOption':_0x29cb17[_0x3d5ad2(0x1fe)]!==undefined?_0x29cb17[_0x3d5ad2(0x1fe)]:_0x5aa545[_0x3d5ad2(0x1fe)],'timezone':_0x29cb17[_0x3d5ad2(0x22b)]!==undefined?_0x29cb17[_0x3d5ad2(0x22b)]:_0x5aa545[_0x3d5ad2(0x22b)],'master':_0x5aa545['master'],'attributes':_0x8cb792?[..._0x5aa545[_0x3d5ad2(0x22a)]||[],..._0x8cb792]:_0x5aa545[_0x3d5ad2(0x22a)],'behaviors':_0x535cb2?[..._0x5aa545['behaviors']||[],..._0x535cb2]:_0x5aa545[_0x3d5ad2(0x183)],'customerGroup':_0x5aa545[_0x3d5ad2(0x16a)]},_0x4cdff0=await withSpinner(_0x3d5ad2(0x22e)+_0x1b614f+_0x3d5ad2(0x196),()=>_0x2f9bad['segment'][_0x3d5ad2(0x177)](_0x1b614f,_0x2e5640),{'verbose':_0x29cb17[_0x3d5ad2(0x120)]}),_0x4a9608=_0x4cdff0[_0x3d5ad2(0x1dd)];return console[_0x3d5ad2(0x11d)](_0x3d5ad2(0x166)+_0x4a9608['name']+'\x27'),await handleSDKOutput([_0x4a9608],_0x29cb17),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x10b);[a23_0x256744(0x1ee)]=a23_0x256744(0x101);async[a23_0x256744(0x1cc)](_0x5489d3){const _0x18fada=a23_0x256744,{options:_0x9d0fd3,args:_0x3e357a,tdx:_0x34ca75}=_0x5489d3,_0x16f745=_0x9d0fd3,_0x30fd2a=_0x3e357a[0x0]||_0x9d0fd3[_0x18fada(0x1e8)];if(!_0x30fd2a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x16f745[_0x18fada(0x233)]&&_0x16f745[_0x18fada(0x14c)])return console[_0x18fada(0x11d)](a23_0x3bbb99['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0xfc)](_0x18fada(0x170))),console[_0x18fada(0x11d)](a23_0x3bbb99['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x18fada(0x140))),console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0x172)](_0x18fada(0x161))),0x1;const _0x3d0220=_0x16f745['output']||a23_0x40454a[_0x18fada(0x156)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x30fd2a)+_0x18fada(0x12e));_0x16f745[_0x18fada(0x120)]&&(console[_0x18fada(0x11d)]('Site:\x20'+_0x16f745[_0x18fada(0x1d7)]),console[_0x18fada(0x11d)](_0x18fada(0x144)+_0x30fd2a),console['error'](_0x18fada(0x109)+_0x3d0220));const _0x3d6a19=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x30fd2a+_0x18fada(0x196),()=>_0x34ca75[_0x18fada(0x194)][_0x18fada(0x188)](_0x30fd2a),{'verbose':_0x16f745[_0x18fada(0x120)]}),_0x7f550e=_0x3d6a19[_0x18fada(0x1dd)];if(existsSync(_0x3d0220)){const _0x550681=readFileSync(_0x3d0220,_0x18fada(0x14e)),_0x5d6f3b=generateDiff(_0x550681,_0x7f550e);if(!hasChanges(_0x5d6f3b))console['error'](a23_0x3bbb99['green']('✔')+_0x18fada(0x20a)+a23_0x3bbb99[_0x18fada(0x172)](_0x3d0220)+_0x18fada(0x1b1));else{console['error'](_0x18fada(0x16d)+_0x3d0220+'\x27:'),console['error']('─'[_0x18fada(0x1e7)](0x3c)),console['error'](formatDiffWithColors(_0x5d6f3b)),console['error']('─'[_0x18fada(0x1e7)](0x3c));if(!_0x16f745['yes']){if(!isInteractive())return console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0x133)](_0x18fada(0x111)),_0x18fada(0x1d0)),console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0xfc)](_0x18fada(0x14a))),0x1;const _0x111532=await confirmKey('Overwrite\x20\x27'+_0x3d0220+'\x27?');if(!_0x111532)return console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0x208)]('Aborted.')),0x1;}writeFileSync(_0x3d0220,_0x7f550e,_0x18fada(0x14e)),console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0x1c7)]('✔')+_0x18fada(0x113)+a23_0x3bbb99[_0x18fada(0x172)](_0x3d0220));}}else{const _0xb09256=a23_0x40454a[_0x18fada(0x22f)](_0x3d0220);!existsSync(_0xb09256)&&mkdirSync(_0xb09256,{'recursive':!![]}),writeFileSync(_0x3d0220,_0x7f550e,_0x18fada(0x14e)),console['error'](a23_0x3bbb99[_0x18fada(0x1c7)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x3bbb99['cyan'](_0x3d0220));}return saveSessionContext({'parent_segment':_0x30fd2a},_0x16f745[_0x18fada(0x149)]),console[_0x18fada(0x11d)](a23_0x3bbb99[_0x18fada(0x1c7)]('✔')+_0x18fada(0x121)+a23_0x3bbb99[_0x18fada(0xfc)](_0x18fada(0x20b))+_0x18fada(0x190)+a23_0x3bbb99[_0x18fada(0x172)](_0x30fd2a)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x1df);[a23_0x256744(0x1ee)]=a23_0x256744(0x135);async[a23_0x256744(0x1cc)](_0x41765f){const _0x13d4af=a23_0x256744,{options:_0x16f848,args:_0x1ab709,tdx:_0x1781da}=_0x41765f,_0x2f2ec4=_0x16f848,_0x188a27=_0x1ab709[0x0]||_0x16f848['parentSegment'];if(!_0x188a27)return showParentSegmentNotSetError(_0x13d4af(0x18c)+_0x13d4af(0x18a)),0x1;const _0xa72def=resolveYamlFile(_0x188a27);if(!existsSync(_0xa72def))return showFileNotFoundError(_0xa72def,_0x188a27),0x1;_0x2f2ec4[_0x13d4af(0x120)]&&(console[_0x13d4af(0x11d)](_0x13d4af(0x21c)+_0x2f2ec4[_0x13d4af(0x1d7)]),console[_0x13d4af(0x11d)](_0x13d4af(0x185)+_0xa72def));let _0x196a55;try{_0x196a55=readFileSync(_0xa72def,_0x13d4af(0x14e));}catch(_0x23ead6){const _0x4fcf5b=_0x23ead6 instanceof Error?_0x23ead6[_0x13d4af(0x125)]:String(_0x23ead6);return console[_0x13d4af(0x11d)]('Error\x20reading\x20file:\x20'+_0x4fcf5b),0x1;}const _0x2a8209=await withSpinner(_0x13d4af(0x212),()=>_0x1781da['segment'][_0x13d4af(0x211)](_0x196a55),{'verbose':_0x2f2ec4['verbose']}),_0x4b467e=_0x2a8209[_0x13d4af(0x1dd)],{isNew:_0x3ea0bf,name:_0x6f3b38,hasChanges:_0x4fbdec,diffFormatted:_0x475331}=_0x4b467e;if(!_0x4fbdec)return console['error'](_0x13d4af(0x1a9)+_0x6f3b38+_0x13d4af(0x197)),0x0;_0x3ea0bf?console['error'](_0x13d4af(0x17a)+_0x6f3b38+'\x27:'):console[_0x13d4af(0x11d)](_0x13d4af(0x137)+_0x6f3b38+'\x27:');console[_0x13d4af(0x11d)]('─'[_0x13d4af(0x1e7)](0x3c)),console[_0x13d4af(0x11d)](_0x475331),console[_0x13d4af(0x11d)]('─'['repeat'](0x3c));const _0x4b9f7c=_0x3ea0bf?_0x13d4af(0x167)+_0x6f3b38+'\x27?':_0x13d4af(0x187)+_0x6f3b38+'\x27?';if(!_0x2f2ec4['yes']){if(!isInteractive())return console[_0x13d4af(0x11d)](a23_0x3bbb99['red']('\x0aError:'),_0x13d4af(0x1d0)),console[_0x13d4af(0x11d)](a23_0x3bbb99['dim'](_0x13d4af(0x14a))),0x1;const _0x370726=await confirmKey(_0x4b9f7c);if(!_0x370726)return console[_0x13d4af(0x11d)](a23_0x3bbb99['yellow'](_0x13d4af(0x114))),0x1;}const _0x20b456=_0x3ea0bf?_0x13d4af(0x122):_0x13d4af(0xfd),_0x5c1bb6=await withSpinner(_0x20b456+'\x20parent\x20segment\x20\x27'+_0x6f3b38+_0x13d4af(0x196),()=>_0x4b467e[_0x13d4af(0x223)](),{'verbose':_0x2f2ec4['verbose']}),_0x1c8ac0=_0x5c1bb6[_0x13d4af(0x1dd)],_0x4d9e46=getConsoleNextUrl(_0x2f2ec4[_0x13d4af(0x1d7)],_0x13d4af(0x224)+_0x1c8ac0['id']),_0x575bb1=_0x3ea0bf?_0x13d4af(0x100):'Updated';return console[_0x13d4af(0x11d)]('✔\x20'+_0x575bb1+_0x13d4af(0x1b9)+_0x1c8ac0['name']+'\x27'),console[_0x13d4af(0x11d)]('\x20\x20'+_0x4d9e46),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x1be);[a23_0x256744(0x1ee)]=a23_0x256744(0x17b);async['execute'](_0x150666){const _0x56927c=a23_0x256744,{options:_0x4914b1,args:_0x1f9147,tdx:_0x498c18}=_0x150666,_0x9f1cef=_0x4914b1,_0xb6bdfb=_0x1f9147[0x0]||_0x4914b1[_0x56927c(0x1e8)];if(!_0xb6bdfb)return showParentSegmentNotSetError(_0x56927c(0x1af)+_0x56927c(0x13d)+_0x56927c(0x1de)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x56927c(0x1fb)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x2f27d5=resolveYamlFile(_0xb6bdfb);if(!existsSync(_0x2f27d5))return showFileNotFoundError(_0x2f27d5,_0xb6bdfb),0x1;_0x9f1cef[_0x56927c(0x120)]&&(console[_0x56927c(0x11d)]('Site:\x20'+_0x9f1cef[_0x56927c(0x1d7)]),console[_0x56927c(0x11d)](_0x56927c(0x185)+_0x2f27d5));let _0x4beec6;try{_0x4beec6=readFileSync(_0x2f27d5,_0x56927c(0x14e));}catch(_0x1a025d){const _0x2db705=_0x1a025d instanceof Error?_0x1a025d['message']:String(_0x1a025d);return console[_0x56927c(0x11d)](_0x56927c(0x13b)+_0x2db705),0x1;}const _0x32b4a2=createCommandSpinner(a23_0x3bbb99['dim']('Validating\x20configuration...'),{'verbose':_0x9f1cef[_0x56927c(0x120)]});_0x32b4a2[_0x56927c(0x119)]();const _0x39a2bb={'onProgress':_0x4ecf02=>{const _0x1cb38f=_0x56927c;_0x32b4a2[_0x1cb38f(0x171)]=formatProgressMessage(_0x4ecf02);}};if(_0x9f1cef[_0x56927c(0x126)])_0x39a2bb[_0x56927c(0x126)]=!![];if(_0x9f1cef['enriched'])_0x39a2bb[_0x56927c(0x1ad)]=!![];_0x9f1cef['attribute']&&(_0x39a2bb['attribute']=_0x9f1cef[_0x56927c(0x18d)]);_0x9f1cef[_0x56927c(0x1d2)]&&(_0x39a2bb[_0x56927c(0x1d2)]=_0x9f1cef[_0x56927c(0x1d2)]);if(_0x9f1cef[_0x56927c(0x1f7)])_0x39a2bb[_0x56927c(0x1f7)]=_0x9f1cef['interval'];let _0x469a4a;try{_0x469a4a=await _0x498c18[_0x56927c(0x194)]['validateParentYaml'](_0x4beec6,_0x39a2bb),_0x32b4a2[_0x56927c(0x15d)]();}catch(_0x209df8){_0x32b4a2[_0x56927c(0x15d)]();throw _0x209df8;}const _0x15dd11=_0x9f1cef['interval']||_0x56927c(0x219);return this[_0x56927c(0x117)](_0x469a4a,_0x39a2bb,_0x2f27d5,_0x15dd11),_0x469a4a[_0x56927c(0x157)]?0x0:0x1;}[a23_0x256744(0x117)](_0x1ab717,_0x547e1e,_0x4e3253,_0x524d5f){const _0x2d1df0=a23_0x256744;console[_0x2d1df0(0x11d)]('\x0a'+a23_0x3bbb99[_0x2d1df0(0x174)](_0x2d1df0(0x192))+'\x20'+_0x1ab717[_0x2d1df0(0x1e9)]),console[_0x2d1df0(0x11d)]('═'[_0x2d1df0(0x1e7)](0x3c)),this[_0x2d1df0(0x205)](_0x1ab717);if(typeof _0x547e1e[_0x2d1df0(0x18d)]===_0x2d1df0(0x175)){this[_0x2d1df0(0x154)](_0x1ab717),this[_0x2d1df0(0xfb)](_0x1ab717),this[_0x2d1df0(0x1fa)](_0x4e3253,_0x524d5f,_0x2d1df0(0x18d),_0x547e1e[_0x2d1df0(0x18d)]);return;}if(_0x547e1e[_0x2d1df0(0x18d)]===!![]){this[_0x2d1df0(0x154)](_0x1ab717),this[_0x2d1df0(0xfb)](_0x1ab717),this[_0x2d1df0(0x1fa)](_0x4e3253,_0x524d5f,'attributes');return;}if(typeof _0x547e1e[_0x2d1df0(0x1d2)]===_0x2d1df0(0x175)){this[_0x2d1df0(0x17d)](_0x1ab717,_0x524d5f),this[_0x2d1df0(0xfb)](_0x1ab717),this[_0x2d1df0(0x1fa)](_0x4e3253,_0x524d5f,_0x2d1df0(0x1d2),_0x547e1e['behavior']);return;}if(_0x547e1e[_0x2d1df0(0x1d2)]===!![]){this[_0x2d1df0(0x17d)](_0x1ab717,_0x524d5f),this[_0x2d1df0(0xfb)](_0x1ab717),this[_0x2d1df0(0x1fa)](_0x4e3253,_0x524d5f,_0x2d1df0(0x183));return;}this[_0x2d1df0(0x154)](_0x1ab717),this[_0x2d1df0(0x17d)](_0x1ab717,_0x524d5f),this[_0x2d1df0(0xfb)](_0x1ab717),this[_0x2d1df0(0x1fa)](_0x4e3253,_0x524d5f,_0x2d1df0(0x1aa));}[a23_0x256744(0x1fa)](_0x1ef1d3,_0x3af2af,_0x242b70,_0x30095b){const _0x365ed5=a23_0x256744;console[_0x365ed5(0x11d)]('\x0a'+a23_0x3bbb99[_0x365ed5(0xfc)](_0x365ed5(0x168)));const _0x506da0=_0x3af2af!==_0x365ed5(0x219)?_0x365ed5(0x234)+_0x3af2af:'';if(_0x242b70===_0x365ed5(0x18d)&&_0x30095b)console['error']('\x20\x20'+a23_0x3bbb99[_0x365ed5(0xfc)](_0x365ed5(0x10f)+_0x1ef1d3+_0x365ed5(0x10a)+_0x30095b+'\x22'+_0x506da0));else{if(_0x242b70===_0x365ed5(0x1d2)&&_0x30095b)console[_0x365ed5(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x365ed5(0xfc)](_0x365ed5(0x10f)+_0x1ef1d3+_0x365ed5(0x18f)+_0x30095b+'\x22'+_0x506da0));else(_0x242b70===_0x365ed5(0x22a)||_0x242b70==='all')&&console[_0x365ed5(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x365ed5(0xfc)](_0x365ed5(0x10f)+_0x1ef1d3+_0x365ed5(0x16b)+_0x506da0));}(_0x242b70===_0x365ed5(0x183)||_0x242b70===_0x365ed5(0x1aa))&&console['error']('\x20\x20'+a23_0x3bbb99['dim'](_0x365ed5(0x10f)+_0x1ef1d3+'\x20--behavior\x20\x22<name>\x22'+_0x506da0)),_0x242b70===_0x365ed5(0x1aa)&&console[_0x365ed5(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x365ed5(0xfc)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1ef1d3+_0x365ed5(0x17f)+_0x506da0));}['displayMasterInfo'](_0x57b65a){const _0x20e1c2=a23_0x256744,{master:_0x25c409}=_0x57b65a,_0x777f3a=_0x25c409[_0x20e1c2(0x1d5)]?a23_0x3bbb99[_0x20e1c2(0x1c7)]('✔'):a23_0x3bbb99[_0x20e1c2(0x133)]('✘');console['error']('\x0a'+a23_0x3bbb99[_0x20e1c2(0xfc)](_0x20e1c2(0x207))),console[_0x20e1c2(0x11d)](_0x777f3a+'\x20'+a23_0x3bbb99['bold'](_0x25c409[_0x20e1c2(0x1b7)]+'.'+_0x25c409[_0x20e1c2(0x18b)])),_0x25c409['schemaValid']?_0x25c409[_0x20e1c2(0x1a3)]!==undefined&&console[_0x20e1c2(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x20e1c2(0xfc)](_0x20e1c2(0x1cf))+'\x20'+a23_0x3bbb99[_0x20e1c2(0x172)](formatRows(_0x25c409[_0x20e1c2(0x1a3)]))):console[_0x20e1c2(0x11d)]('\x20\x20'+a23_0x3bbb99['red']('Error:')+'\x20'+_0x25c409[_0x20e1c2(0x1ff)]);}[a23_0x256744(0x154)](_0x57c5ef){const _0x105935=a23_0x256744;if(_0x57c5ef[_0x105935(0x22a)][_0x105935(0x12a)]===0x0)return;console[_0x105935(0x11d)]('\x0a'+a23_0x3bbb99['dim'](_0x105935(0x1cb)));for(const _0x17983a of _0x57c5ef[_0x105935(0x22a)]){const _0x16a99c=_0x17983a[_0x105935(0x1d5)]?a23_0x3bbb99[_0x105935(0x1c7)]('✔'):a23_0x3bbb99[_0x105935(0x133)]('✘');let _0x335245='';if(_0x17983a['schemaValid']&&_0x17983a[_0x105935(0x214)]!==undefined&&_0x17983a[_0x105935(0x1ce)]!==undefined){const _0x2f5c5e=_0x17983a[_0x105935(0x1ce)]['toFixed'](0x1),_0x6e668=_0x17983a[_0x105935(0x1ce)]>=0x50?a23_0x3bbb99[_0x105935(0x1c7)]:_0x17983a['coveragePercent']>=0x32?a23_0x3bbb99[_0x105935(0x208)]:a23_0x3bbb99[_0x105935(0x133)];_0x335245='\x20'+a23_0x3bbb99[_0x105935(0xfc)](_0x105935(0x1c2))+'\x20'+_0x6e668(_0x2f5c5e+'%')+'\x20('+formatRows(_0x17983a['matchedCount'])+_0x105935(0x1b6);}console[_0x105935(0x11d)](_0x16a99c+'\x20'+a23_0x3bbb99['bold'](_0x17983a['name'])+_0x335245),console[_0x105935(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x105935(0xfc)]('Source:')+'\x20'+a23_0x3bbb99[_0x105935(0x174)](_0x17983a['database']+'.'+_0x17983a[_0x105935(0x18b)]));const _0x18a078=_0x17983a['joinKey']===_0x17983a[_0x105935(0x153)]?a23_0x3bbb99['dim']('Join\x20on:')+'\x20'+_0x17983a[_0x105935(0x232)]:a23_0x3bbb99[_0x105935(0xfc)](_0x105935(0x198))+'\x20'+_0x17983a['joinKey']+_0x105935(0x190)+_0x17983a['foreignKey'];console[_0x105935(0x11d)]('\x20\x20'+_0x18a078),console[_0x105935(0x11d)]('\x20\x20'+a23_0x3bbb99['dim'](_0x105935(0x130))),this[_0x105935(0x112)](_0x17983a['columns']),!_0x17983a[_0x105935(0x1d5)]&&console['error']('\x20\x20'+a23_0x3bbb99[_0x105935(0x133)](_0x105935(0x147))+'\x20'+_0x17983a[_0x105935(0x1ff)]);}}[a23_0x256744(0x17d)](_0x2a424c,_0x432bdc){const _0x1699f3=a23_0x256744;if(_0x2a424c[_0x1699f3(0x183)][_0x1699f3(0x12a)]===0x0)return;console[_0x1699f3(0x11d)]('\x0a'+a23_0x3bbb99[_0x1699f3(0xfc)](_0x1699f3(0x1e6))+'\x20'+a23_0x3bbb99['dim']('('+_0x432bdc+')'));for(const _0x4ed5c2 of _0x2a424c[_0x1699f3(0x183)]){const _0x4c60a1=_0x4ed5c2[_0x1699f3(0x1d5)]?a23_0x3bbb99[_0x1699f3(0x1c7)]('✔'):a23_0x3bbb99[_0x1699f3(0x133)]('✘');let _0x3ef2b6='';if(_0x4ed5c2['schemaValid']&&_0x4ed5c2[_0x1699f3(0x14d)]!==undefined&&_0x4ed5c2[_0x1699f3(0x150)]!==undefined){const _0x55a855=_0x4ed5c2[_0x1699f3(0x1b0)]?.[_0x1699f3(0x104)](0x1)||'?',_0x64395=(_0x4ed5c2[_0x1699f3(0x1b0)]??0x0)>=0x32?a23_0x3bbb99['green']:(_0x4ed5c2[_0x1699f3(0x1b0)]??0x0)>=0x14?a23_0x3bbb99[_0x1699f3(0x208)]:a23_0x3bbb99['red'];_0x3ef2b6='\x20'+a23_0x3bbb99[_0x1699f3(0xfc)](_0x1699f3(0x12b))+'\x20'+_0x64395(formatRows(_0x4ed5c2['customersWithEvents']))+'\x20('+_0x55a855+'%)\x20'+a23_0x3bbb99['dim'](_0x1699f3(0x12f))+'\x20'+a23_0x3bbb99[_0x1699f3(0x172)](formatRows(_0x4ed5c2[_0x1699f3(0x150)]));}console[_0x1699f3(0x11d)](_0x4c60a1+'\x20'+a23_0x3bbb99[_0x1699f3(0x174)](_0x4ed5c2[_0x1699f3(0x1e9)])+_0x3ef2b6),console[_0x1699f3(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x1699f3(0xfc)](_0x1699f3(0x21b))+'\x20'+a23_0x3bbb99[_0x1699f3(0x174)](_0x4ed5c2['database']+'.'+_0x4ed5c2[_0x1699f3(0x18b)]));const _0xa9425c=_0x4ed5c2['joinKey']===_0x4ed5c2[_0x1699f3(0x153)]?a23_0x3bbb99[_0x1699f3(0xfc)](_0x1699f3(0x1db))+'\x20'+_0x4ed5c2[_0x1699f3(0x232)]:a23_0x3bbb99[_0x1699f3(0xfc)]('Join:')+'\x20'+_0x4ed5c2[_0x1699f3(0x232)]+_0x1699f3(0x190)+_0x4ed5c2[_0x1699f3(0x153)];console['error']('\x20\x20'+_0xa9425c),console[_0x1699f3(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x1699f3(0xfc)](_0x1699f3(0x130))),this[_0x1699f3(0x112)](_0x4ed5c2['columns']),!_0x4ed5c2[_0x1699f3(0x1d5)]&&console[_0x1699f3(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x1699f3(0x133)](_0x1699f3(0x147))+'\x20'+_0x4ed5c2[_0x1699f3(0x1ff)]);}}[a23_0x256744(0x112)](_0x516bb7){const _0x23448f=a23_0x256744;for(const _0x15a2c4 of _0x516bb7){_0x15a2c4[_0x23448f(0xff)]===_0x15a2c4[_0x23448f(0x209)]||_0x15a2c4[_0x23448f(0x209)]==='*'?console[_0x23448f(0x11d)](_0x23448f(0x11c)+_0x15a2c4['label']):console[_0x23448f(0x11d)]('\x20\x20\x20\x20-\x20'+_0x15a2c4[_0x23448f(0xff)]+'\x20'+a23_0x3bbb99['dim']('('+_0x15a2c4['column']+')'));}}[a23_0x256744(0xfb)](_0x6d710d){const _0x1f502f=a23_0x256744;console[_0x1f502f(0x11d)]('─'[_0x1f502f(0x1e7)](0x3c));if(_0x6d710d[_0x1f502f(0x162)][_0x1f502f(0x12a)]>0x0){console[_0x1f502f(0x11d)]('\x0a'+a23_0x3bbb99[_0x1f502f(0x133)](_0x1f502f(0x202)));for(const _0x49d105 of _0x6d710d[_0x1f502f(0x162)]){console[_0x1f502f(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x1f502f(0x133)]('•')+'\x20'+_0x49d105);}}_0x6d710d['allValid']&&console[_0x1f502f(0x11d)]('\x0a'+a23_0x3bbb99[_0x1f502f(0x1c7)]('✔')+_0x1f502f(0x19e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x21a);[a23_0x256744(0x1ee)]=a23_0x256744(0x1b2);async['execute'](_0x48b8e6){const _0x4a0c6e=a23_0x256744,{options:_0x2190f0,args:_0x42f569,tdx:_0x5666e7}=_0x48b8e6,_0x12b8da=_0x2190f0,_0x338c70=_0x42f569[0x0]||_0x2190f0[_0x4a0c6e(0x1e8)];if(!_0x338c70)return showParentSegmentNotSetError(_0x4a0c6e(0x11e)+_0x4a0c6e(0x11f)+'Options\x20(one\x20required):\x0a'+_0x4a0c6e(0x1d1)+_0x4a0c6e(0x1a4)+_0x4a0c6e(0x1d4)+_0x4a0c6e(0x206)+_0x4a0c6e(0x17e)),0x1;if(!_0x12b8da[_0x4a0c6e(0x126)]&&!_0x12b8da[_0x4a0c6e(0x18d)]&&!_0x12b8da[_0x4a0c6e(0x1d2)]&&!_0x12b8da['enriched'])return console[_0x4a0c6e(0x11d)](a23_0x3bbb99[_0x4a0c6e(0x133)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x4a0c6e(0x11d)](_0x4a0c6e(0x131)),console[_0x4a0c6e(0x11d)]('Options:'),console[_0x4a0c6e(0x11d)](_0x4a0c6e(0x1a7)),console['error'](_0x4a0c6e(0x195)),console[_0x4a0c6e(0x11d)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x4dca12=resolveYamlFile(_0x338c70);if(!existsSync(_0x4dca12))return showFileNotFoundError(_0x4dca12,_0x338c70),0x1;_0x12b8da['verbose']&&(console['error'](_0x4a0c6e(0x21c)+_0x12b8da['site']),console[_0x4a0c6e(0x11d)](_0x4a0c6e(0x185)+_0x4dca12));let _0x4071c2;try{_0x4071c2=readFileSync(_0x4dca12,_0x4a0c6e(0x14e));}catch(_0x45f930){const _0x90fd58=_0x45f930 instanceof Error?_0x45f930[_0x4a0c6e(0x125)]:String(_0x45f930);return console['error']('Error\x20reading\x20file:\x20'+_0x90fd58),0x1;}let _0x15e544;try{_0x15e544=parseDef(_0x4071c2);}catch(_0x1ca690){const _0x545092=_0x1ca690 instanceof Error?_0x1ca690[_0x4a0c6e(0x125)]:String(_0x1ca690);return console[_0x4a0c6e(0x11d)](a23_0x3bbb99[_0x4a0c6e(0x133)](_0x4a0c6e(0x173)+_0x545092)),0x1;}if(_0x12b8da[_0x4a0c6e(0x18d)]===!![]||_0x12b8da[_0x4a0c6e(0x18d)]===''){const _0x1cbe13=_0x15e544[_0x4a0c6e(0x22a)]?.[_0x4a0c6e(0x116)](_0x35f2ff=>_0x35f2ff[_0x4a0c6e(0x1e9)])||[];if(_0x1cbe13[_0x4a0c6e(0x12a)]===0x0)console[_0x4a0c6e(0x11d)](a23_0x3bbb99[_0x4a0c6e(0x133)](_0x4a0c6e(0x105)));else{console[_0x4a0c6e(0x11d)](a23_0x3bbb99[_0x4a0c6e(0x133)](_0x4a0c6e(0x17c))),console['error'](_0x4a0c6e(0x1eb));for(const _0x2a83d0 of _0x1cbe13){console['error']('\x20\x20'+a23_0x3bbb99[_0x4a0c6e(0x172)](_0x2a83d0));}console[_0x4a0c6e(0x11d)](_0x4a0c6e(0x1b3)+_0x338c70+_0x4a0c6e(0x10a)+_0x1cbe13[0x0]+'\x22');}return 0x1;}if(_0x12b8da[_0x4a0c6e(0x1d2)]===!![]||_0x12b8da[_0x4a0c6e(0x1d2)]===''){const _0xa4a084=_0x15e544['behaviors']?.['map'](_0x14dbfe=>_0x14dbfe[_0x4a0c6e(0x1e9)])||[];if(_0xa4a084[_0x4a0c6e(0x12a)]===0x0)console[_0x4a0c6e(0x11d)](a23_0x3bbb99[_0x4a0c6e(0x133)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x4a0c6e(0x11d)](a23_0x3bbb99[_0x4a0c6e(0x133)](_0x4a0c6e(0x108))),console[_0x4a0c6e(0x11d)](_0x4a0c6e(0x128));for(const _0x118cfe of _0xa4a084){console[_0x4a0c6e(0x11d)]('\x20\x20'+a23_0x3bbb99['cyan'](_0x118cfe));}console[_0x4a0c6e(0x11d)](_0x4a0c6e(0x1b3)+_0x338c70+_0x4a0c6e(0x18f)+_0xa4a084[0x0]+'\x22');}return 0x1;}const _0x5033eb=createCommandSpinner(a23_0x3bbb99[_0x4a0c6e(0xfc)](_0x4a0c6e(0x1ea)),{'verbose':_0x12b8da[_0x4a0c6e(0x120)]});_0x5033eb[_0x4a0c6e(0x119)]();const _0x438a40={'onProgress':_0x3b1755=>{const _0x3f102e=_0x4a0c6e;_0x5033eb[_0x3f102e(0x171)]=formatProgressMessage(_0x3b1755);}};if(_0x12b8da[_0x4a0c6e(0x126)])_0x438a40[_0x4a0c6e(0x126)]=!![];if(_0x12b8da[_0x4a0c6e(0x18d)]&&typeof _0x12b8da[_0x4a0c6e(0x18d)]===_0x4a0c6e(0x175))_0x438a40[_0x4a0c6e(0x18d)]=_0x12b8da['attribute'];if(_0x12b8da[_0x4a0c6e(0x1d2)]&&typeof _0x12b8da[_0x4a0c6e(0x1d2)]===_0x4a0c6e(0x175))_0x438a40[_0x4a0c6e(0x1d2)]=_0x12b8da[_0x4a0c6e(0x1d2)];if(_0x12b8da['enriched'])_0x438a40[_0x4a0c6e(0x1ad)]=!![];if(_0x12b8da[_0x4a0c6e(0x1f7)])_0x438a40[_0x4a0c6e(0x1f7)]=_0x12b8da[_0x4a0c6e(0x1f7)];let _0x2b7625;try{_0x2b7625=await _0x5666e7[_0x4a0c6e(0x194)][_0x4a0c6e(0x146)](_0x4071c2,_0x438a40),_0x5033eb['stop']();}catch(_0x4a0d75){_0x5033eb['stop']();throw _0x4a0d75;}return await this[_0x4a0c6e(0x1b8)](_0x2b7625,{'master':_0x12b8da[_0x4a0c6e(0x126)],'attribute':typeof _0x12b8da['attribute']===_0x4a0c6e(0x175)?_0x12b8da[_0x4a0c6e(0x18d)]:undefined,'behavior':typeof _0x12b8da[_0x4a0c6e(0x1d2)]===_0x4a0c6e(0x175)?_0x12b8da[_0x4a0c6e(0x1d2)]:undefined,'enriched':_0x12b8da[_0x4a0c6e(0x1ad)]}),_0x2b7625['allValid']?0x0:0x1;}async[a23_0x256744(0x1b8)](_0xa4998a,_0x358943){const _0x2942d2=a23_0x256744;console[_0x2942d2(0x11d)]('\x0a'+a23_0x3bbb99[_0x2942d2(0x174)](_0x2942d2(0x1ca))+'\x20'+_0xa4998a[_0x2942d2(0x1e9)]),console[_0x2942d2(0x11d)]('═'[_0x2942d2(0x1e7)](0x3c));if(_0x358943[_0x2942d2(0x126)]&&_0xa4998a['sampleData']){const _0x171f80=a23_0x3bbb99[_0x2942d2(0xfc)](_0x2942d2(0x1d3))+'\x20'+a23_0x3bbb99[_0x2942d2(0x174)](_0xa4998a[_0x2942d2(0x126)][_0x2942d2(0x1b7)]+'.'+_0xa4998a[_0x2942d2(0x126)][_0x2942d2(0x18b)]);await this[_0x2942d2(0xfa)](_0x171f80,_0xa4998a[_0x2942d2(0x1b4)]);}else{if(_0x358943['attribute']&&_0xa4998a['sampleData']){const _0xc5b2f4=a23_0x3bbb99[_0x2942d2(0xfc)](_0x2942d2(0x160))+'\x20'+a23_0x3bbb99[_0x2942d2(0x174)](_0x358943[_0x2942d2(0x18d)]);await this[_0x2942d2(0xfa)](_0xc5b2f4,_0xa4998a[_0x2942d2(0x1b4)]);}else{if(_0x358943[_0x2942d2(0x1d2)]&&_0xa4998a['sampleData']){const _0x25cd06=a23_0x3bbb99[_0x2942d2(0xfc)](_0x2942d2(0x1cd))+'\x20'+a23_0x3bbb99[_0x2942d2(0x174)](_0x358943['behavior']);await this[_0x2942d2(0xfa)](_0x25cd06,_0xa4998a['sampleData']);}else{if(_0x358943[_0x2942d2(0x1ad)]&&_0xa4998a[_0x2942d2(0x1b4)]){const _0x1be18a=a23_0x3bbb99['dim'](_0x2942d2(0x1ed))+'\x20'+a23_0x3bbb99[_0x2942d2(0x174)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x1be18a,_0xa4998a[_0x2942d2(0x1b4)]);}else!_0xa4998a[_0x2942d2(0x1b4)]&&console[_0x2942d2(0x11d)](_0x2942d2(0x142));}}}if(_0xa4998a['errors']['length']>0x0){console[_0x2942d2(0x11d)]('─'[_0x2942d2(0x1e7)](0x3c)),console[_0x2942d2(0x11d)]('\x0a'+a23_0x3bbb99[_0x2942d2(0x133)](_0x2942d2(0x202)));for(const _0x266385 of _0xa4998a[_0x2942d2(0x162)]){console[_0x2942d2(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x2942d2(0x133)]('•')+'\x20'+_0x266385);}}}async['displaySampleData'](_0x4b7f6d,_0x49cc23){const _0x4d08fc=a23_0x256744;if(_0x49cc23[_0x4d08fc(0x12a)]===0x0){console[_0x4d08fc(0x11d)]('\x0a'+_0x4b7f6d),console['error'](_0x4d08fc(0x1ac));return;}console['error']('\x0a'+_0x4b7f6d);const _0x3faf35=Object[_0x4d08fc(0x22d)](_0x49cc23[0x0])[_0x4d08fc(0x116)](_0x35da25=>({'name':_0x35da25,'type':typeof _0x49cc23[0x0][_0x35da25]===_0x4d08fc(0x15b)?_0x4d08fc(0x1c5):_0x4d08fc(0x1d8)})),_0x23a902={'queryId':_0x4d08fc(0xfe),'columns':_0x3faf35,'data':_0x49cc23,'stats':{'state':_0x4d08fc(0x216),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x49cc23[_0x4d08fc(0x12a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1e75c7=formatAsTable(_0x23a902,_0x49cc23[_0x4d08fc(0x12a)],!![]);await writeOutput(_0x1e75c7,undefined,_0x4d08fc(0x18b));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x143);['description']=a23_0x256744(0x19f);async['execute'](_0x3005f0){const _0x4104ff=a23_0x256744,{options:_0x3b7712,args:_0xd2f4a,tdx:_0x156b76}=_0x3005f0,_0x501e70=_0x3b7712,_0x43c4a9=_0xd2f4a[0x0]||_0x3b7712[_0x4104ff(0x1e8)];if(!_0x43c4a9)return showParentSegmentNotSetError(_0x4104ff(0x235)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x148168=resolveYamlFile(_0x43c4a9);if(existsSync(_0x148168)){_0x501e70[_0x4104ff(0x120)]&&console[_0x4104ff(0x11d)](_0x4104ff(0x1bc)+_0x148168);let _0x52e2db;try{_0x52e2db=readFileSync(_0x148168,_0x4104ff(0x14e));}catch(_0x1036fa){const _0x44cfff=_0x1036fa instanceof Error?_0x1036fa[_0x4104ff(0x125)]:String(_0x1036fa);return console[_0x4104ff(0x11d)](_0x4104ff(0x13b)+_0x44cfff),0x1;}const _0xfaaff2=await withSpinner('Analyzing\x20changes...',()=>_0x156b76['segment'][_0x4104ff(0x211)](_0x52e2db),{'verbose':_0x501e70[_0x4104ff(0x120)]}),_0x5e398a=_0xfaaff2[_0x4104ff(0x1dd)],{isNew:_0x3d9554,name:_0x40abbc,hasChanges:_0x15931b,diffFormatted:_0xec66d6}=_0x5e398a;if(_0x15931b){_0x3d9554?console[_0x4104ff(0x11d)](_0x4104ff(0x17a)+_0x40abbc+'\x27:'):console[_0x4104ff(0x11d)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x40abbc+'\x27:');console[_0x4104ff(0x11d)]('─'[_0x4104ff(0x1e7)](0x3c)),console['error'](_0xec66d6),console[_0x4104ff(0x11d)]('─'[_0x4104ff(0x1e7)](0x3c));const _0x5d8242=_0x3d9554?_0x4104ff(0x167)+_0x40abbc+'\x27\x20and\x20run\x20workflow?':_0x4104ff(0x187)+_0x40abbc+_0x4104ff(0x1fc);if(!_0x501e70[_0x4104ff(0x220)]){if(!isInteractive())return console[_0x4104ff(0x11d)](a23_0x3bbb99['red'](_0x4104ff(0x111)),_0x4104ff(0x1d0)),console[_0x4104ff(0x11d)](a23_0x3bbb99[_0x4104ff(0xfc)](_0x4104ff(0x14a))),0x1;const _0x3608fa=await confirmKey(_0x5d8242);if(!_0x3608fa)return console[_0x4104ff(0x11d)](a23_0x3bbb99[_0x4104ff(0x208)](_0x4104ff(0x114))),0x1;}const _0x1febbe=_0x3d9554?_0x4104ff(0x122):_0x4104ff(0xfd);await withSpinner(_0x1febbe+_0x4104ff(0x1b9)+_0x40abbc+'\x27...',()=>_0x5e398a[_0x4104ff(0x223)](),{'verbose':_0x501e70[_0x4104ff(0x120)]});const _0x2b8227=_0x3d9554?_0x4104ff(0x100):_0x4104ff(0x19b);console[_0x4104ff(0x11d)]('✔\x20'+_0x2b8227+_0x4104ff(0x1b9)+_0x40abbc+'\x27');}else console[_0x4104ff(0x11d)]('✔\x20No\x20changes\x20-\x20\x27'+_0x40abbc+_0x4104ff(0x1e1));}const _0x2fba93=await withSpinner(_0x4104ff(0x22c)+_0x43c4a9+'\x27...',()=>_0x156b76[_0x4104ff(0x194)][_0x4104ff(0x132)](_0x43c4a9),{'verbose':_0x501e70[_0x4104ff(0x120)]}),_0x4aadba=_0x2fba93[_0x4104ff(0x1dd)],_0x310348=getConsoleUrl(_0x501e70['site'],_0x4104ff(0x163)+_0x4aadba[_0x4104ff(0x20c)]+_0x4104ff(0x201)+_0x4aadba[_0x4104ff(0x13e)]+_0x4104ff(0x19d)+_0x4aadba[_0x4104ff(0x151)]);return console['error']('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a23_0x3bbb99[_0x4104ff(0xfc)](_0x4104ff(0x1f0))+'\x20'+_0x4aadba[_0x4104ff(0x1b5)]),console[_0x4104ff(0x11d)]('\x20\x20'+a23_0x3bbb99[_0x4104ff(0xfc)](_0x4104ff(0x15c))+'\x20'+_0x4aadba[_0x4104ff(0x221)]),console['error']('\x20\x20'+a23_0x3bbb99[_0x4104ff(0xfc)](_0x4104ff(0x1f6))+'\x20'+_0x4aadba['workflowSessionId']),console['error']('\x20\x20'+a23_0x3bbb99['dim'](_0x4104ff(0x200))+'\x20'+_0x4aadba[_0x4104ff(0x151)]),console['error']('\x20\x20'+_0x310348),console[_0x4104ff(0x11d)]('\x0a'+a23_0x3bbb99[_0x4104ff(0xfc)](_0x4104ff(0x228))+_0x4104ff(0x13a)+_0x4aadba[_0x4104ff(0x151)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x10d);[a23_0x256744(0x1ee)]=a23_0x256744(0x1c6);async['execute'](_0x1d6906){const _0x5abb8c=a23_0x256744,{options:_0x3fbd32,args:_0x1c0f8b,tdx:_0x22ac79}=_0x1d6906,_0x2ce5c0=_0x1c0f8b[0x0]||_0x3fbd32[_0x5abb8c(0x1e8)];if(!_0x2ce5c0)return showParentSegmentNotSetError(_0x5abb8c(0x15f)+_0x5abb8c(0x169)),0x1;_0x3fbd32[_0x5abb8c(0x120)]&&(console[_0x5abb8c(0x11d)]('Site:\x20'+_0x3fbd32[_0x5abb8c(0x1d7)]),console[_0x5abb8c(0x11d)](_0x5abb8c(0x144)+_0x2ce5c0));const _0x2bc561=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x2ce5c0+_0x5abb8c(0x196),()=>_0x22ac79['segment'][_0x5abb8c(0x181)](_0x2ce5c0),{'verbose':_0x3fbd32['verbose']}),_0x4d79c2=_0x2bc561[_0x5abb8c(0x1dd)];console[_0x5abb8c(0x11d)](_0x5abb8c(0x179)+_0x4d79c2['length']+_0x5abb8c(0x13c)+(_0x4d79c2[_0x5abb8c(0x12a)]!==0x1?'s':''));if(_0x3fbd32[_0x5abb8c(0x20d)]||_0x3fbd32[_0x5abb8c(0x12d)])return await handleSDKOutput(_0x4d79c2,_0x3fbd32),0x0;return displayFieldsHumanReadable(_0x4d79c2,_0x2ce5c0),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a23_0x256744(0x178);[a23_0x256744(0x1ee)]=a23_0x256744(0x193);async[a23_0x256744(0x1cc)](_0x2fa7c2){const _0x3f217=a23_0x256744,{options:_0x23e34c,args:_0x2dc811,tdx:_0xaf3ef}=_0x2fa7c2,_0x526607=_0x23e34c,_0x3ee069=_0x2dc811[0x0]||_0x23e34c[_0x3f217(0x1e8)];if(!_0x3ee069)return showParentSegmentNotSetError(_0x3f217(0x124)+_0x3f217(0x1da)+_0x3f217(0x1de)+_0x3f217(0x10c)),0x1;_0x23e34c['verbose']&&(console[_0x3f217(0x11d)]('Site:\x20'+_0x23e34c[_0x3f217(0x1d7)]),console['error'](_0x3f217(0x144)+_0x3ee069));const _0x1e197d=await withSpinner(_0x3f217(0x12c)+_0x3ee069+_0x3f217(0x196),()=>_0xaf3ef[_0x3f217(0x194)][_0x3f217(0x1f5)](_0x3ee069),{'verbose':_0x23e34c[_0x3f217(0x120)]}),_0x237377=_0x1e197d[_0x3f217(0x1dd)];if(_0x526607[_0x3f217(0x155)]){const _0x4788ac=getConsoleNextUrl(_0x526607[_0x3f217(0x1d7)],'/app/dw/parentSegments/'+_0x237377['id']);return console[_0x3f217(0x11d)](a23_0x3bbb99[_0x3f217(0x1c7)]('✔')+_0x3f217(0x103)+a23_0x3bbb99[_0x3f217(0x172)](_0x4788ac)),openBrowser(_0x4788ac),0x0;}return await handleSingleObjectOutput(_0x237377,_0x23e34c),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a23_0x256744(0x11b);[a23_0x256744(0x1ee)]=a23_0x256744(0x1e0);async[a23_0x256744(0x1cc)](_0x20bd80){const _0x285588=a23_0x256744,{options:_0x41309e,args:_0x31d24a,tdx:_0x1352a3}=_0x20bd80,_0x6146db=_0x31d24a[0x0]||_0x41309e[_0x285588(0x1e8)];if(!_0x6146db)return showParentSegmentNotSetError(_0x285588(0x1f8)+_0x285588(0x115)),0x1;_0x41309e[_0x285588(0x120)]&&(console['error'](_0x285588(0x21c)+_0x41309e[_0x285588(0x1d7)]),console['error'](_0x285588(0x144)+_0x6146db));const _0xdd10e8=await withSpinner(_0x285588(0x14f)+_0x6146db+_0x285588(0x196),()=>_0x1352a3[_0x285588(0x194)][_0x285588(0x1c3)](_0x6146db),{'verbose':_0x41309e[_0x285588(0x120)]}),_0x42c491=_0xdd10e8[_0x285588(0x1dd)],_0x7d07eb=await withSpinner(_0x285588(0x1dc)+_0x6146db+_0x285588(0x196),()=>_0x1352a3['segment'][_0x285588(0xf8)](_0x42c491),{'verbose':_0x41309e[_0x285588(0x120)]}),_0x50eb10=await executeSchemaQuery(_0x7d07eb[_0x285588(0x1dd)],_0x1352a3,_0x41309e);return await handleQueryOutput(_0x50eb10,_0x41309e),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x256744(0x1e9)]=a23_0x256744(0x1c0);[a23_0x256744(0x1ee)]=a23_0x256744(0x20e);async[a23_0x256744(0x1cc)](_0x5567d6){const _0x4aee31=a23_0x256744,{options:_0x4f74ad,args:_0x5bd679,tdx:_0x2809fc}=_0x5567d6,_0x585595=_0x5bd679[0x0]||_0x4f74ad['parentSegment'];if(!_0x585595)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'+_0x4aee31(0x127)),0x1;_0x4f74ad[_0x4aee31(0x120)]&&(console[_0x4aee31(0x11d)](_0x4aee31(0x21c)+_0x4f74ad[_0x4aee31(0x1d7)]),console['error']('Parent\x20segment:\x20'+_0x585595));const _0x11ca6b=await withSpinner(_0x4aee31(0x14f)+_0x585595+_0x4aee31(0x196),()=>_0x2809fc[_0x4aee31(0x194)][_0x4aee31(0x1c3)](_0x585595),{'verbose':_0x4f74ad['verbose']}),_0x27c908=_0x11ca6b[_0x4aee31(0x1dd)],_0x2b63f8=await withSpinner(_0x4aee31(0x1dc)+_0x585595+_0x4aee31(0x196),()=>_0x2809fc['segment']['getParentSQL'](_0x27c908),{'verbose':_0x4f74ad[_0x4aee31(0x120)]}),_0x5a6e3d=_0x2b63f8['data'];return _0x4f74ad['format']===_0x4aee31(0x20d)||_0x4f74ad[_0x4aee31(0x1c9)]===_0x4aee31(0x12d)?await handleSDKOutput([{'sql':_0x5a6e3d}],_0x4f74ad):console[_0x4aee31(0x215)](_0x5a6e3d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x256744(0x1e9)]='segment:parent:show';[a23_0x256744(0x1ee)]=a23_0x256744(0x1f9);async['execute'](_0x55e52d){const _0x438275=a23_0x256744,{options:_0x47400b,args:_0x6d9446,tdx:_0xca391a}=_0x55e52d,_0x25dfe9=_0x6d9446[0x0]||_0x47400b['parentSegment'];if(!_0x25dfe9)return showParentSegmentNotSetError(_0x438275(0x138)+_0x438275(0x1f2)),0x1;_0x47400b[_0x438275(0x120)]&&(console[_0x438275(0x11d)](_0x438275(0x21c)+_0x47400b[_0x438275(0x1d7)]),console[_0x438275(0x11d)]('Parent\x20segment:\x20'+_0x25dfe9));const _0x27a621=await withSpinner(_0x438275(0x14f)+_0x25dfe9+_0x438275(0x196),()=>_0xca391a[_0x438275(0x194)]['resolveParentId'](_0x25dfe9),{'verbose':_0x47400b[_0x438275(0x120)]}),_0x471ec4=_0x27a621['data'],_0x44a961=await withSpinner(_0x438275(0x1dc)+_0x25dfe9+_0x438275(0x196),()=>_0xca391a[_0x438275(0x194)]['getParentSQL'](_0x471ec4),{'verbose':_0x47400b['verbose']});let _0x30bc97=_0x44a961[_0x438275(0x1dd)];const _0x30388c=resolveLimit(_0x47400b[_0x438275(0x21f)],DEFAULT_DISPLAY_LIMIT),_0x5562c3=/\bLIMIT\s+\d+/i[_0x438275(0x13f)](_0x30bc97);!_0x5562c3&&(_0x30bc97=_0x30bc97['trim']()[_0x438275(0x10e)](/;+$/,''),_0x30bc97=_0x438275(0x180)+_0x30bc97+_0x438275(0x21e)+_0x30388c);_0x47400b['verbose']&&console['error'](_0x438275(0x164)+_0x30bc97);const _0x55bdfe=await withProgressSpinner(_0x438275(0x19a),async _0x345c20=>{const _0x222018=_0x438275,_0x186020=await _0xca391a[_0x222018(0x159)][_0x222018(0x1cc)](_0x30bc97,{'catalog':'td','schema':_0x222018(0x213),'onJobId':_0xc96201=>{const _0x49c84a=_0x222018;_0x345c20[_0x49c84a(0x152)](_0xc96201);}});return _0x186020;},{'verbose':_0x47400b[_0x438275(0x120)]}),_0x22fa67=_0x55bdfe[_0x438275(0x1dd)],_0x14b6d8=_0x22fa67[_0x438275(0x158)]?'\x20[Job\x20ID:\x20'+_0x22fa67[_0x438275(0x158)]+']':'';return console[_0x438275(0x11d)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x22fa67[_0x438275(0x1a6)][_0x438275(0x1ab)][_0x438275(0x106)]()+_0x438275(0x1d9)+(_0x438275(0x14b)+formatElapsed(_0x22fa67[_0x438275(0x1a6)]['elapsedTimeMillis'])+_0x14b6d8)),await handleQueryOutput(_0x22fa67,_0x47400b),0x0;}}
@@ -1 +1 @@
1
- const a24_0x4eb162=a24_0x5c5b;(function(_0x476c6a,_0x326b30){const _0x507f14=a24_0x5c5b,_0x2c5b28=_0x476c6a();while(!![]){try{const _0x4b7a0b=parseInt(_0x507f14(0xec))/0x1*(parseInt(_0x507f14(0x90))/0x2)+-parseInt(_0x507f14(0xe9))/0x3+-parseInt(_0x507f14(0xb4))/0x4+parseInt(_0x507f14(0xa9))/0x5*(parseInt(_0x507f14(0xa5))/0x6)+-parseInt(_0x507f14(0x92))/0x7*(-parseInt(_0x507f14(0x9e))/0x8)+parseInt(_0x507f14(0x9c))/0x9+parseInt(_0x507f14(0xe6))/0xa;if(_0x4b7a0b===_0x326b30)break;else _0x2c5b28['push'](_0x2c5b28['shift']());}catch(_0x973b4a){_0x2c5b28['push'](_0x2c5b28['shift']());}}}(a24_0xc7cf,0x7e80e));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_0x4e0bd8 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';function a24_0xc7cf(){const _0xf7ea68=['log','(session:\x20','length','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','Failed\x20to\x20remove\x20profile:\x20','193024FwTAbs','split','2807994bKQpqZ','database','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Profile\x20\x27','description','includes','Set\x20a\x20profile\x20configuration\x20value','\x27\x20removed\x20from\x20configuration','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','VALID_KEYS','4127850PofyeB','\x20\x20tdx\x20--profile\x20','16gdeckv','text','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetup\x20cancelled','\x0aAvailable\x20profiles:','profile:create','llm_agent','120AGrPgU','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20\x20-\x20','execute','108635MOhGKm','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','logLevel','site','session','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx:\x20profile\x20create','Set\x20session\x20profile','profile:remove','Enter\x20profile\x20name:','/app/mp/ak','4045172fJDOLm','tdx:\x20profile\x20set','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20created','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>','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x0aSaved\x20to:\x20','yellow','API\x20key\x20cannot\x20be\x20empty','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','other','✗\x20Validation\x20failed:\x20','apiKey','profile:set','confirm','\x20API\x20key\x20saved\x20to\x20system\x20keychain','name','validate','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','message','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Session\x20profile\x20set\x20to:\x20','\x27\x20updated:\x20','Removal\x20cancelled','dim','Site\x20name\x20cannot\x20be\x20empty','status','warn','red','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','tdx:\x20profile\x20remove','green','Enter\x20your\x20TD\x20API\x20key:','trim','Operation\x20cancelled','bold','email','us01','\x27\x20does\x20not\x20exist.','toString','ERROR','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','(cleared)','\x20Profile\x20\x27','parent_segment','error','profile','\x20\x20(no\x20profiles\x20found)','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','812550HRLNzZ','profile:use','Site\x20was\x20not\x20changed.','2479050ySmuMD','customSite','Remove\x20a\x20profile','6giGTwS','jobs','profileName','Default\x20profile\x20set\x20to:\x20','test','Changing\x20site\x20to\x20\x27','Validating\x20API\x20key...','\x20API\x20key\x20removed\x20from\x20system\x20keychain','join','create','Unknown\x20key\x20\x27'];a24_0xc7cf=function(){return _0xf7ea68;};return a24_0xc7cf();}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a24_0x5c5b(_0x25f25e,_0x5ad8b3){_0x25f25e=_0x25f25e-0x87;const _0xc7cfd=a24_0xc7cf();let _0x5c5bd4=_0xc7cfd[_0x25f25e];return _0x5c5bd4;}import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x196c29 from'prompts';import a24_0x4c7166 from'chalk';function validateProfileName(_0x11e61e){const _0x5d4962=a24_0x5c5b;if(!_0x11e61e||!_0x11e61e['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x185d3a=_0x11e61e[_0x5d4962(0xd5)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5d4962(0xf0)](_0x185d3a))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x185d3a))return _0x5d4962(0x95)+_0x185d3a+_0x5d4962(0xb9);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x4eb162(0xc4)]=a24_0x4eb162(0xa3);['description']='Create\x20a\x20new\x20profile';async['execute'](_0x1721b3){const _0x5b5d37=a24_0x4eb162,{options:_0x34f67c,args:_0xc2100e}=_0x1721b3;console[_0x5b5d37(0x89)](a24_0x4c7166[_0x5b5d37(0xd7)](_0x5b5d37(0xaf)));let _0x56ef61;if(_0xc2100e['length']>0x0&&_0xc2100e[0x0]){const _0x1ae640=_0xc2100e[0x0]['trim'](),_0x490bac=validateProfileName(_0x1ae640);if(_0x490bac!==!![])return console[_0x5b5d37(0xe1)](a24_0x4c7166[_0x5b5d37(0xd0)](_0x490bac)),0x1;_0x56ef61=_0x1ae640;}else{const _0x584f30=await a24_0x196c29({'type':_0x5b5d37(0x9f),'name':_0x5b5d37(0xee),'message':_0x5b5d37(0xb2),'validate':validateProfileName});if(!_0x584f30[_0x5b5d37(0xee)])return console[_0x5b5d37(0x89)](_0x5b5d37(0xa1)),0x1;_0x56ef61=_0x584f30[_0x5b5d37(0xee)][_0x5b5d37(0xd5)]();}const _0x25c18a=await a24_0x196c29({'type':_0x5b5d37(0x9f),'name':'description','message':'Enter\x20description\x20(optional):'}),_0xfe9a02=_0x25c18a[_0x5b5d37(0x96)]?.[_0x5b5d37(0xd5)]()||undefined,_0x328b08=_0x34f67c[_0x5b5d37(0xac)]||'us01',{choices:_0x40fd84,initialIndex:_0x1f3c84}=buildSiteChoices(_0x328b08),_0x73b25f=await a24_0x196c29({'type':'select','name':_0x5b5d37(0xac),'message':_0x5b5d37(0xe5)+_0x56ef61+'\x27:','choices':_0x40fd84,'initial':_0x1f3c84});if(!_0x73b25f['site'])return console[_0x5b5d37(0x89)]('\x0aSetup\x20cancelled'),0x1;let _0x32ee5a;if(_0x73b25f[_0x5b5d37(0xac)]===_0x5b5d37(0xbe)){const _0x282ad1=await a24_0x196c29({'type':'text','name':'customSite','message':'Enter\x20site\x20name:','initial':_0x5b5d37(0xd9),'validate':_0x4bd4d8=>{const _0x414b30=_0x5b5d37;if(!_0x4bd4d8||!_0x4bd4d8[_0x414b30(0xd5)]())return _0x414b30(0xcd);if(!/^[a-z0-9-]+$/['test'](_0x4bd4d8[_0x414b30(0xd5)]()))return _0x414b30(0xdd);return!![];}});if(!_0x282ad1[_0x5b5d37(0xea)])return console['log'](_0x5b5d37(0xa1)),0x1;_0x32ee5a=_0x282ad1[_0x5b5d37(0xea)];}else _0x32ee5a=_0x73b25f[_0x5b5d37(0xac)];const _0x42e97b=resolveSite(_0x32ee5a);console[_0x5b5d37(0x89)](_0x5b5d37(0xc6)+_0x42e97b),console[_0x5b5d37(0x89)](_0x5b5d37(0xa0)),console[_0x5b5d37(0x89)]('\x20\x20'+getConsoleUrl(_0x42e97b,'/app/mp/ak'));const _0xe570bf=await a24_0x196c29({'type':'password','name':_0x5b5d37(0xc0),'message':_0x5b5d37(0xd4),'validate':_0x3bbce6=>{const _0x3f268b=_0x5b5d37;if(!_0x3bbce6||!_0x3bbce6[_0x3f268b(0xd5)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xe570bf[_0x5b5d37(0xc0)])return console['log'](_0x5b5d37(0xa1)),0x1;const _0x4dd7c9=_0xe570bf[_0x5b5d37(0xc0)];console[_0x5b5d37(0x89)](_0x5b5d37(0xf2));try{const _0x480a6f=TDX[_0x5b5d37(0x87)]({'site':_0x42e97b,'apiKey':_0x4dd7c9[_0x5b5d37(0xd5)](),'logLevel':_0x34f67c['logLevel']??LogLevel[_0x5b5d37(0xdc)]}),_0x3f6559=await _0x480a6f[_0x5b5d37(0xed)]['getUserInfo']();console[_0x5b5d37(0x89)](a24_0x4c7166[_0x5b5d37(0xd3)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3f6559['email']+')');const _0x5beea1=await isKeychainAvailable();_0x5beea1?(await saveAPIKeyAsync(_0x4dd7c9['trim'](),_0x42e97b,_0x56ef61),console[_0x5b5d37(0x89)](a24_0x4c7166[_0x5b5d37(0xd3)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x56ef61+')')):(console[_0x5b5d37(0xcf)](a24_0x4c7166[_0x5b5d37(0xbb)](_0x5b5d37(0xb6))),console['warn'](a24_0x4c7166['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x58288b={'site':_0x42e97b,..._0xfe9a02&&{'description':_0xfe9a02}};return saveProfileToUserConfig(_0x56ef61,_0x58288b),console['log'](a24_0x4c7166[_0x5b5d37(0xd3)]('✓')+_0x5b5d37(0xdf)+_0x56ef61+_0x5b5d37(0xb7)),console['log'](),console[_0x5b5d37(0x89)](_0x5b5d37(0xa6)),console[_0x5b5d37(0x89)](_0x5b5d37(0x9d)+_0x56ef61+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x5b5d37(0x9d)+_0x56ef61+_0x5b5d37(0xbd)),0x0;}catch(_0x4b56e4){if(_0x4b56e4 instanceof HTTPClientError&&_0x4b56e4[_0x5b5d37(0xce)]===0x191)return printAuthError(_0x4b56e4),0x1;return console['error'](a24_0x4c7166[_0x5b5d37(0xd0)](_0x5b5d37(0xbf)+(_0x4b56e4 instanceof Error?_0x4b56e4[_0x5b5d37(0xc7)]:String(_0x4b56e4)))),console[_0x5b5d37(0xe1)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x4eb162(0xb1);[a24_0x4eb162(0x96)]=a24_0x4eb162(0xeb);[a24_0x4eb162(0xc5)](_0x185404){const _0x12aa03=a24_0x4eb162,{args:_0x5d7d74}=_0x185404;if(_0x5d7d74[_0x12aa03(0x8b)]===0x0)return _0x12aa03(0xaa);return undefined;}async[a24_0x4eb162(0xa8)](_0x40fa20){const _0x3fb3da=a24_0x4eb162,{args:_0x5b2e94}=_0x40fa20,_0x4a0efb=_0x5b2e94[0x0];console['log'](a24_0x4c7166['bold'](_0x3fb3da(0xd2)));if(!profileExists(_0x4a0efb)){console[_0x3fb3da(0xe1)](a24_0x4c7166[_0x3fb3da(0xd0)]('Profile\x20\x27'+_0x4a0efb+'\x27\x20does\x20not\x20exist.')),console[_0x3fb3da(0x89)](_0x3fb3da(0xa2));const _0x2b97e4=listProfiles();if(_0x2b97e4[_0x3fb3da(0x8b)]===0x0)console[_0x3fb3da(0x89)](_0x3fb3da(0xe3));else for(const _0x25281e of _0x2b97e4){console[_0x3fb3da(0x89)](_0x3fb3da(0xa7)+_0x25281e[_0x3fb3da(0xc4)]);}return 0x1;}const _0x33eb7e=await a24_0x196c29({'type':_0x3fb3da(0xc2),'name':_0x3fb3da(0xc2),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x4a0efb+'\x27?','initial':![]});if(!_0x33eb7e[_0x3fb3da(0xc2)])return console[_0x3fb3da(0x89)](_0x3fb3da(0xcb)),0x0;try{removeProfileFromUserConfig(_0x4a0efb),console['log'](a24_0x4c7166[_0x3fb3da(0xd3)]('✓')+'\x20Profile\x20\x27'+_0x4a0efb+_0x3fb3da(0x99));}catch(_0x4d8179){return console[_0x3fb3da(0xe1)](a24_0x4c7166['red'](_0x3fb3da(0x8f)+(_0x4d8179 instanceof Error?_0x4d8179['message']:String(_0x4d8179)))),0x1;}const _0x4063ee=await isKeychainAvailable();if(_0x4063ee){const _0x50829c=await deleteKeychainAPIKey(_0x4a0efb);_0x50829c&&console[_0x3fb3da(0x89)](a24_0x4c7166[_0x3fb3da(0xd3)]('✓')+_0x3fb3da(0xf3));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x4eb162(0xc4)]=a24_0x4eb162(0xc1);[a24_0x4eb162(0x96)]=a24_0x4eb162(0x98);static ['VALID_KEYS']=[a24_0x4eb162(0xac),a24_0x4eb162(0x93),a24_0x4eb162(0xe0),'llm_project',a24_0x4eb162(0xa4),a24_0x4eb162(0x96)];[a24_0x4eb162(0xc5)](_0x58bb99){const _0x4a69ed=a24_0x4eb162,{args:_0x5f2354,options:_0x4e97e9}=_0x58bb99,_0x39fbc3=_0x4e97e9[_0x4a69ed(0xe2)]||getActiveProfile();if(!_0x39fbc3)return _0x4a69ed(0xb8);if(_0x5f2354[_0x4a69ed(0x8b)]===0x0)return _0x4a69ed(0xc8)+ProfileSetCommand[_0x4a69ed(0x9b)][_0x4a69ed(0xf4)](',\x20');const _0xa4ef55=_0x5f2354[0x0];if(!_0xa4ef55['includes']('='))return _0x4a69ed(0x9a)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x5c1861]=_0xa4ef55[_0x4a69ed(0x91)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x4a69ed(0x97)](_0x5c1861))return _0x4a69ed(0x88)+_0x5c1861+_0x4a69ed(0x8d)+ProfileSetCommand[_0x4a69ed(0x9b)]['join'](',\x20');return undefined;}async[a24_0x4eb162(0xa8)](_0x27898f){const _0x14c1bd=a24_0x4eb162,{args:_0x8ee52c,options:_0x75d738}=_0x27898f,_0x466503=_0x75d738[_0x14c1bd(0xe2)]||getActiveProfile(),[_0x5ab2bc,..._0x187955]=_0x8ee52c[0x0][_0x14c1bd(0x91)]('='),_0x541b70=_0x187955[_0x14c1bd(0xf4)]('=');console['log'](a24_0x4c7166['bold'](_0x14c1bd(0xb5)));if(!profileExists(_0x466503)){const _0x84d14a=await a24_0x196c29({'type':_0x14c1bd(0xc2),'name':_0x14c1bd(0x87),'message':_0x14c1bd(0x95)+_0x466503+_0x14c1bd(0x8c),'initial':!![]});if(!_0x84d14a['create'])return console[_0x14c1bd(0x89)](_0x14c1bd(0xd6)),0x1;}const _0x1ec7f8=loadProfile(_0x466503),_0x2d2648=_0x1ec7f8?.['config']||{};if(_0x5ab2bc==='site'){const _0xb47ddc=resolveSite(_0x541b70);console[_0x14c1bd(0x89)](_0x14c1bd(0xf1)+_0xb47ddc+_0x14c1bd(0x8e)),console['log'](_0x14c1bd(0xe4)),console['log']('\x20\x20'+getConsoleUrl(_0xb47ddc,_0x14c1bd(0xb3)));const _0x129603=await a24_0x196c29({'type':'password','name':_0x14c1bd(0xc0),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x1d430c=>{const _0x257094=_0x14c1bd;if(!_0x1d430c||!_0x1d430c[_0x257094(0xd5)]())return _0x257094(0xbc);return!![];}});if(!_0x129603[_0x14c1bd(0xc0)])return console[_0x14c1bd(0x89)]('\x0aOperation\x20cancelled'),0x1;console[_0x14c1bd(0x89)]('Validating\x20API\x20key...');try{const _0x170e58=TDX[_0x14c1bd(0x87)]({'site':_0xb47ddc,'apiKey':_0x129603[_0x14c1bd(0xc0)][_0x14c1bd(0xd5)](),'logLevel':_0x75d738[_0x14c1bd(0xab)]??LogLevel[_0x14c1bd(0xdc)]}),_0x3c165b=await _0x170e58[_0x14c1bd(0xed)]['getUserInfo']();console[_0x14c1bd(0x89)](a24_0x4c7166[_0x14c1bd(0xd3)]('✓')+_0x14c1bd(0xae)+_0x3c165b[_0x14c1bd(0xd8)]+')');const _0x5d5c95=await isKeychainAvailable();_0x5d5c95?(await saveAPIKeyAsync(_0x129603['apiKey'][_0x14c1bd(0xd5)](),_0xb47ddc,_0x466503),console[_0x14c1bd(0x89)](a24_0x4c7166['green']('✓')+_0x14c1bd(0xc3))):console[_0x14c1bd(0xcf)](a24_0x4c7166[_0x14c1bd(0xbb)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x2d2648[_0x14c1bd(0xac)]=_0xb47ddc;}catch(_0x2ec4da){if(_0x2ec4da instanceof HTTPClientError&&_0x2ec4da[_0x14c1bd(0xce)]===0x191)return printAuthError(_0x2ec4da),0x1;return console['error'](a24_0x4c7166[_0x14c1bd(0xd0)]('✗\x20Validation\x20failed:\x20'+(_0x2ec4da instanceof Error?_0x2ec4da[_0x14c1bd(0xc7)]:String(_0x2ec4da)))),console[_0x14c1bd(0xe1)](_0x14c1bd(0xe8)),0x1;}}else _0x2d2648[_0x5ab2bc]=_0x541b70||undefined;return saveProfileToUserConfig(_0x466503,_0x2d2648),console['log'](a24_0x4c7166[_0x14c1bd(0xd3)]('✓')+_0x14c1bd(0xdf)+_0x466503+_0x14c1bd(0xca)+_0x5ab2bc+'='+(_0x541b70||_0x14c1bd(0xde))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x4eb162(0xc4)]=a24_0x4eb162(0xe7);['description']=a24_0x4eb162(0xb0);[a24_0x4eb162(0xc5)](_0x39b57a){const _0x83e3ff=a24_0x4eb162,{args:_0x141521}=_0x39b57a;if(_0x141521['length']===0x0)return _0x83e3ff(0x94);return undefined;}async['execute'](_0x22c2dc){const _0x569c5e=a24_0x4eb162,{args:_0x422a61,options:_0x200b4f}=_0x22c2dc,_0xe05c44=_0x422a61[0x0],_0x56b326=_0x200b4f['default'];cleanExpiredSessions();if(!profileExists(_0xe05c44)){console[_0x569c5e(0xe1)](a24_0x4c7166[_0x569c5e(0xd0)](_0x569c5e(0x95)+_0xe05c44+_0x569c5e(0xda))),console[_0x569c5e(0x89)](_0x569c5e(0xa2));const _0x16b658=listProfiles();if(_0x16b658[_0x569c5e(0x8b)]===0x0)console[_0x569c5e(0x89)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x422bfe of _0x16b658){console['log'](_0x569c5e(0xa7)+_0x422bfe[_0x569c5e(0xc4)]);}return 0x1;}if(_0x56b326){const _0x4d7eff=a24_0x4e0bd8[_0x569c5e(0xf4)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0xe05c44),console['log'](_0x569c5e(0xef)+a24_0x4c7166[_0x569c5e(0xd3)](_0xe05c44)),console[_0x569c5e(0x89)](a24_0x4c7166[_0x569c5e(0xcc)](_0x569c5e(0xba)+_0x4d7eff)),0x0;}const _0x47e767=_0x200b4f[_0x569c5e(0xad)]||getCurrentSessionPID()[_0x569c5e(0xdb)]();return saveSessionContext({'profile':_0xe05c44},_0x200b4f[_0x569c5e(0xad)]),console[_0x569c5e(0x89)](_0x569c5e(0xc9)+a24_0x4c7166[_0x569c5e(0xd3)](_0xe05c44)+'\x20'+a24_0x4c7166[_0x569c5e(0xcc)](_0x569c5e(0x8a)+_0x47e767+')')),console[_0x569c5e(0x89)](a24_0x4c7166['dim'](_0x569c5e(0xd1)+_0xe05c44+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a24_0x504ca3=a24_0x5bf4;(function(_0x3e0f49,_0x4782b6){const _0x233e6c=a24_0x5bf4,_0x2bdd63=_0x3e0f49();while(!![]){try{const _0x4a14d0=parseInt(_0x233e6c(0x18f))/0x1+-parseInt(_0x233e6c(0x1dd))/0x2*(-parseInt(_0x233e6c(0x19b))/0x3)+parseInt(_0x233e6c(0x190))/0x4*(parseInt(_0x233e6c(0x193))/0x5)+-parseInt(_0x233e6c(0x1bf))/0x6*(parseInt(_0x233e6c(0x1e6))/0x7)+parseInt(_0x233e6c(0x1db))/0x8*(-parseInt(_0x233e6c(0x1a8))/0x9)+parseInt(_0x233e6c(0x1a1))/0xa*(-parseInt(_0x233e6c(0x1de))/0xb)+-parseInt(_0x233e6c(0x19a))/0xc*(-parseInt(_0x233e6c(0x1c7))/0xd);if(_0x4a14d0===_0x4782b6)break;else _0x2bdd63['push'](_0x2bdd63['shift']());}catch(_0x5648fc){_0x2bdd63['push'](_0x2bdd63['shift']());}}}(a24_0x1439,0x4dfc5));function a24_0x5bf4(_0x16a341,_0x34108f){_0x16a341=_0x16a341-0x17a;const _0x14390b=a24_0x1439();let _0x5bf479=_0x14390b[_0x16a341];return _0x5bf479;}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_0xd9f0d6 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{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x4ecbc0 from'prompts';import a24_0x330825 from'chalk';function validateProfileName(_0x198e69){const _0x2cda87=a24_0x5bf4;if(!_0x198e69||!_0x198e69[_0x2cda87(0x1ac)]())return _0x2cda87(0x1ce);const _0x5c4630=_0x198e69[_0x2cda87(0x1ac)]();if(!/^[a-zA-Z0-9_-]+$/[_0x2cda87(0x1ca)](_0x5c4630))return _0x2cda87(0x1e1);if(profileExists(_0x5c4630))return _0x2cda87(0x183)+_0x5c4630+_0x2cda87(0x17b);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x504ca3(0x1c8)]=a24_0x504ca3(0x1cf);[a24_0x504ca3(0x182)]='Create\x20a\x20new\x20profile';async[a24_0x504ca3(0x1a4)](_0x4445a8){const _0x615e3d=a24_0x504ca3,{options:_0x4020f1,args:_0x83080e}=_0x4445a8;console[_0x615e3d(0x1da)](a24_0x330825[_0x615e3d(0x194)](_0x615e3d(0x1d9)));let _0x4f05ec;if(_0x83080e[_0x615e3d(0x1ba)]>0x0&&_0x83080e[0x0]){const _0x550fea=_0x83080e[0x0][_0x615e3d(0x1ac)](),_0x383059=validateProfileName(_0x550fea);if(_0x383059!==!![])return console[_0x615e3d(0x17f)](a24_0x330825['red'](_0x383059)),0x1;_0x4f05ec=_0x550fea;}else{const _0x57f6cf=await a24_0x4ecbc0({'type':'text','name':_0x615e3d(0x1e7),'message':_0x615e3d(0x189),'validate':validateProfileName});if(!_0x57f6cf[_0x615e3d(0x1e7)])return console[_0x615e3d(0x1da)](_0x615e3d(0x1d4)),0x1;_0x4f05ec=_0x57f6cf[_0x615e3d(0x1e7)][_0x615e3d(0x1ac)]();}const _0x2e3224=await a24_0x4ecbc0({'type':'text','name':_0x615e3d(0x182),'message':_0x615e3d(0x1bb)}),_0x3a5b56=_0x2e3224['description']?.[_0x615e3d(0x1ac)]()||undefined,_0xbcd7d9=_0x4020f1[_0x615e3d(0x185)]||'us01',{choices:_0x516ded,initialIndex:_0x30650f}=buildSiteChoices(_0xbcd7d9),_0x253b44=await a24_0x4ecbc0({'type':_0x615e3d(0x198),'name':_0x615e3d(0x185),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x4f05ec+'\x27:','choices':_0x516ded,'initial':_0x30650f});if(!_0x253b44['site'])return console[_0x615e3d(0x1da)](_0x615e3d(0x1d4)),0x1;let _0x34d640;if(_0x253b44[_0x615e3d(0x185)]===_0x615e3d(0x1e9)){const _0x1d93c1=await a24_0x4ecbc0({'type':_0x615e3d(0x1c0),'name':_0x615e3d(0x17c),'message':_0x615e3d(0x1bc),'initial':'us01','validate':_0x3a6d0b=>{const _0x20a55a=_0x615e3d;if(!_0x3a6d0b||!_0x3a6d0b['trim']())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x20a55a(0x1ca)](_0x3a6d0b[_0x20a55a(0x1ac)]()))return _0x20a55a(0x1cd);return!![];}});if(!_0x1d93c1[_0x615e3d(0x17c)])return console[_0x615e3d(0x1da)]('\x0aSetup\x20cancelled'),0x1;_0x34d640=_0x1d93c1['customSite'];}else _0x34d640=_0x253b44['site'];const _0x45f340=resolveSite(_0x34d640);console[_0x615e3d(0x1da)](_0x615e3d(0x1ae)+_0x45f340),console[_0x615e3d(0x1da)](_0x615e3d(0x1d6)),console[_0x615e3d(0x1da)]('\x20\x20'+getConsoleUrl(_0x45f340,_0x615e3d(0x18c)));const _0x27c65a=await a24_0x4ecbc0({'type':_0x615e3d(0x1c1),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x2d445b=>{const _0x63e67e=_0x615e3d;if(!_0x2d445b||!_0x2d445b[_0x63e67e(0x1ac)]())return _0x63e67e(0x1ab);return!![];}});if(!_0x27c65a[_0x615e3d(0x1be)])return console[_0x615e3d(0x1da)](_0x615e3d(0x1d4)),0x1;const _0x12a3ce=_0x27c65a[_0x615e3d(0x1be)];console[_0x615e3d(0x1da)](_0x615e3d(0x18a));try{const _0x13340b=TDX[_0x615e3d(0x180)]({'site':_0x45f340,'apiKey':_0x12a3ce['trim'](),'logLevel':_0x4020f1[_0x615e3d(0x1b0)]??LogLevel[_0x615e3d(0x188)]}),_0x4a7775=await _0x13340b[_0x615e3d(0x1df)][_0x615e3d(0x186)]();console[_0x615e3d(0x1da)](a24_0x330825['green']('✓')+_0x615e3d(0x1a6)+_0x4a7775[_0x615e3d(0x1eb)]+')');const _0x2aeb96=await isKeychainAvailable();_0x2aeb96?(await saveAPIKeyAsync(_0x12a3ce['trim'](),_0x45f340,_0x4f05ec),console[_0x615e3d(0x1da)](a24_0x330825[_0x615e3d(0x1c6)]('✓')+_0x615e3d(0x1b5)+_0x4f05ec+')')):(console[_0x615e3d(0x18e)](a24_0x330825[_0x615e3d(0x1d8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x615e3d(0x18e)](a24_0x330825[_0x615e3d(0x1d8)](_0x615e3d(0x1b9))));const _0x5ce66d={'site':_0x45f340,..._0x3a5b56&&{'description':_0x3a5b56}};return saveProfileToUserConfig(_0x4f05ec,_0x5ce66d),console[_0x615e3d(0x1da)](a24_0x330825[_0x615e3d(0x1c6)]('✓')+_0x615e3d(0x1e8)+_0x4f05ec+_0x615e3d(0x1d3)),console[_0x615e3d(0x1da)](),console[_0x615e3d(0x1da)](_0x615e3d(0x184)),console[_0x615e3d(0x1da)](_0x615e3d(0x191)+_0x4f05ec+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x615e3d(0x1da)](_0x615e3d(0x191)+_0x4f05ec+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x315d1c){if(_0x315d1c instanceof HTTPClientError&&_0x315d1c['status']===0x191)return printAuthError(_0x315d1c),0x1;return console[_0x615e3d(0x17f)](a24_0x330825[_0x615e3d(0x1e3)](_0x615e3d(0x1a5)+(_0x315d1c instanceof Error?_0x315d1c[_0x615e3d(0x1b4)]:String(_0x315d1c)))),console['error'](_0x615e3d(0x1ad)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x504ca3(0x1c8)]=a24_0x504ca3(0x1c3);[a24_0x504ca3(0x182)]='Remove\x20a\x20profile';[a24_0x504ca3(0x199)](_0x28f189){const _0x43dde4=a24_0x504ca3,{args:_0x5d31d2}=_0x28f189;if(_0x5d31d2[_0x43dde4(0x1ba)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a24_0x504ca3(0x1a4)](_0x22552e){const _0xc1f5eb=a24_0x504ca3,{args:_0x458b6f}=_0x22552e,_0x4d0646=_0x458b6f[0x0];console[_0xc1f5eb(0x1da)](a24_0x330825['bold']('tdx:\x20profile\x20remove'));if(!profileExists(_0x4d0646)){console[_0xc1f5eb(0x17f)](a24_0x330825['red'](_0xc1f5eb(0x183)+_0x4d0646+_0xc1f5eb(0x1d1))),console[_0xc1f5eb(0x1da)](_0xc1f5eb(0x1e4));const _0x18d515=listProfiles();if(_0x18d515[_0xc1f5eb(0x1ba)]===0x0)console[_0xc1f5eb(0x1da)](_0xc1f5eb(0x1cb));else for(const _0xca6e90 of _0x18d515){console[_0xc1f5eb(0x1da)](_0xc1f5eb(0x1bd)+_0xca6e90['name']);}return 0x1;}const _0x8514a9=await a24_0x4ecbc0({'type':_0xc1f5eb(0x1a9),'name':'confirm','message':_0xc1f5eb(0x192)+_0x4d0646+'\x27?','initial':![]});if(!_0x8514a9[_0xc1f5eb(0x1a9)])return console[_0xc1f5eb(0x1da)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x4d0646),console[_0xc1f5eb(0x1da)](a24_0x330825[_0xc1f5eb(0x1c6)]('✓')+_0xc1f5eb(0x1e8)+_0x4d0646+_0xc1f5eb(0x1a0));}catch(_0x26f6d8){return console[_0xc1f5eb(0x17f)](a24_0x330825['red'](_0xc1f5eb(0x19c)+(_0x26f6d8 instanceof Error?_0x26f6d8[_0xc1f5eb(0x1b4)]:String(_0x26f6d8)))),0x1;}const _0x557c08=await isKeychainAvailable();if(_0x557c08){const _0x1476e3=await deleteKeychainAPIKey(_0x4d0646);_0x1476e3&&console[_0xc1f5eb(0x1da)](a24_0x330825['green']('✓')+_0xc1f5eb(0x19e));}return 0x0;}}function a24_0x1439(){const _0x53bfeb=['length','Enter\x20description\x20(optional):','Enter\x20site\x20name:','\x20\x20-\x20','apiKey','2928984IHuMJv','text','password','default','profile:remove','(cleared)','status','green','91WSvOcs','name','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','test','\x20\x20(no\x20profiles\x20found)','Set\x20session\x20profile','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Profile\x20name\x20cannot\x20be\x20empty','profile:create','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27\x20does\x20not\x20exist.','Set\x20a\x20profile\x20configuration\x20value','\x27\x20created','\x0aSetup\x20cancelled','Changing\x20site\x20to\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','(session:\x20','yellow','tdx:\x20profile\x20create','log','8McCwcY','VALID_KEYS','484bbvDga','3619SADhgm','jobs','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','tdx:\x20profile\x20set','red','\x0aAvailable\x20profiles:','profile:set','7ekbuWg','profileName','\x20Profile\x20\x27','other','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','email','Operation\x20cancelled','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','customSite','\x20--default\x27\x20to\x20save\x20permanently','tdx.json','error','create','session','description','Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','site','getUserInfo','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','ERROR','Enter\x20profile\x20name:','Validating\x20API\x20key...','join','/app/mp/ak','parent_segment','warn','401626HslpvX','444XPuOlD','\x20\x20tdx\x20--profile\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','20085mcatoC','bold','database','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>','split','select','validate','273684wmFwVS','3714KjIAtP','Failed\x20to\x20remove\x20profile:\x20','dim','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20updated:\x20','\x27\x20removed\x20from\x20configuration','5230xMTkHI','toString','includes','execute','✗\x20Validation\x20failed:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSaved\x20to:\x20','2943882zKkRgB','confirm','Default\x20profile\x20set\x20to:\x20','API\x20key\x20cannot\x20be\x20empty','trim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profile:use','logLevel','\x27.\x0a\x0aValid\x20keys:\x20','llm_project','Session\x20profile\x20set\x20to:\x20','message','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Unknown\x20key\x20\x27','llm_agent','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.'];a24_0x1439=function(){return _0x53bfeb;};return a24_0x1439();}export class ProfileSetCommand extends BaseCommand{[a24_0x504ca3(0x1c8)]=a24_0x504ca3(0x1e5);['description']=a24_0x504ca3(0x1d2);static [a24_0x504ca3(0x1dc)]=[a24_0x504ca3(0x185),a24_0x504ca3(0x195),a24_0x504ca3(0x18d),a24_0x504ca3(0x1b2),a24_0x504ca3(0x1b8),'description'];[a24_0x504ca3(0x199)](_0xe990bd){const _0x5e3203=a24_0x504ca3,{args:_0x1d9df7,options:_0x36fa06}=_0xe990bd,_0x494db9=_0x36fa06['profile']||getActiveProfile();if(!_0x494db9)return _0x5e3203(0x196);if(_0x1d9df7[_0x5e3203(0x1ba)]===0x0)return _0x5e3203(0x1ea)+ProfileSetCommand[_0x5e3203(0x1dc)][_0x5e3203(0x18b)](',\x20');const _0x340b81=_0x1d9df7[0x0];if(!_0x340b81[_0x5e3203(0x1a3)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5e3203(0x1dc)][_0x5e3203(0x18b)](',\x20');const [_0x4ac141]=_0x340b81['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x5e3203(0x1a3)](_0x4ac141))return _0x5e3203(0x1b7)+_0x4ac141+_0x5e3203(0x1b1)+ProfileSetCommand['VALID_KEYS'][_0x5e3203(0x18b)](',\x20');return undefined;}async[a24_0x504ca3(0x1a4)](_0x1f2619){const _0x386984=a24_0x504ca3,{args:_0x5a5e70,options:_0x1626a4}=_0x1f2619,_0x54a820=_0x1626a4['profile']||getActiveProfile(),[_0x316d2f,..._0x107a78]=_0x5a5e70[0x0][_0x386984(0x197)]('='),_0x4a02fe=_0x107a78[_0x386984(0x18b)]('=');console['log'](a24_0x330825['bold'](_0x386984(0x1e2)));if(!profileExists(_0x54a820)){const _0x3a3b81=await a24_0x4ecbc0({'type':_0x386984(0x1a9),'name':'create','message':_0x386984(0x183)+_0x54a820+_0x386984(0x1b6),'initial':!![]});if(!_0x3a3b81[_0x386984(0x180)])return console[_0x386984(0x1da)](_0x386984(0x17a)),0x1;}const _0x3135b9=loadProfile(_0x54a820),_0x4f61ba=_0x3135b9?.['config']||{};if(_0x316d2f===_0x386984(0x185)){const _0x595b24=resolveSite(_0x4a02fe);console[_0x386984(0x1da)](_0x386984(0x1d5)+_0x595b24+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x386984(0x1da)](_0x386984(0x187)),console['log']('\x20\x20'+getConsoleUrl(_0x595b24,'/app/mp/ak'));const _0x4601f7=await a24_0x4ecbc0({'type':_0x386984(0x1c1),'name':_0x386984(0x1be),'message':_0x386984(0x1e0),'validate':_0x3403b5=>{const _0x34e34c=_0x386984;if(!_0x3403b5||!_0x3403b5['trim']())return _0x34e34c(0x1ab);return!![];}});if(!_0x4601f7['apiKey'])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x386984(0x1da)](_0x386984(0x18a));try{const _0x123cad=TDX[_0x386984(0x180)]({'site':_0x595b24,'apiKey':_0x4601f7[_0x386984(0x1be)][_0x386984(0x1ac)](),'logLevel':_0x1626a4['logLevel']??LogLevel['ERROR']}),_0x5203eb=await _0x123cad['jobs'][_0x386984(0x186)]();console[_0x386984(0x1da)](a24_0x330825[_0x386984(0x1c6)]('✓')+_0x386984(0x1a6)+_0x5203eb[_0x386984(0x1eb)]+')');const _0x4a7704=await isKeychainAvailable();_0x4a7704?(await saveAPIKeyAsync(_0x4601f7[_0x386984(0x1be)][_0x386984(0x1ac)](),_0x595b24,_0x54a820),console[_0x386984(0x1da)](a24_0x330825[_0x386984(0x1c6)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console['warn'](a24_0x330825[_0x386984(0x1d8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x4f61ba['site']=_0x595b24;}catch(_0x62d39b){if(_0x62d39b instanceof HTTPClientError&&_0x62d39b[_0x386984(0x1c5)]===0x191)return printAuthError(_0x62d39b),0x1;return console['error'](a24_0x330825['red'](_0x386984(0x1a5)+(_0x62d39b instanceof Error?_0x62d39b['message']:String(_0x62d39b)))),console[_0x386984(0x17f)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x4f61ba[_0x316d2f]=_0x4a02fe||undefined;return saveProfileToUserConfig(_0x54a820,_0x4f61ba),console['log'](a24_0x330825[_0x386984(0x1c6)]('✓')+'\x20Profile\x20\x27'+_0x54a820+_0x386984(0x19f)+_0x316d2f+'='+(_0x4a02fe||_0x386984(0x1c4))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x504ca3(0x1c8)]=a24_0x504ca3(0x1af);[a24_0x504ca3(0x182)]=a24_0x504ca3(0x1cc);[a24_0x504ca3(0x199)](_0x1fac04){const _0xe31442=a24_0x504ca3,{args:_0x39c201}=_0x1fac04;if(_0x39c201[_0xe31442(0x1ba)]===0x0)return _0xe31442(0x1d0);return undefined;}async[a24_0x504ca3(0x1a4)](_0x38d2d1){const _0x5cc890=a24_0x504ca3,{args:_0x255fa3,options:_0x5b3486}=_0x38d2d1,_0x546230=_0x255fa3[0x0],_0x1dca31=_0x5b3486[_0x5cc890(0x1c2)];cleanExpiredSessions();if(!profileExists(_0x546230)){console[_0x5cc890(0x17f)](a24_0x330825[_0x5cc890(0x1e3)]('Profile\x20\x27'+_0x546230+'\x27\x20does\x20not\x20exist.')),console[_0x5cc890(0x1da)]('\x0aAvailable\x20profiles:');const _0x58167d=listProfiles();if(_0x58167d[_0x5cc890(0x1ba)]===0x0)console[_0x5cc890(0x1da)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x244dcd of _0x58167d){console[_0x5cc890(0x1da)](_0x5cc890(0x1bd)+_0x244dcd[_0x5cc890(0x1c8)]);}return 0x1;}if(_0x1dca31){const _0x591000=a24_0xd9f0d6[_0x5cc890(0x18b)](getConfigDir(),_0x5cc890(0x17e));return saveActiveProfileToUserConfig(_0x546230),console[_0x5cc890(0x1da)](_0x5cc890(0x1aa)+a24_0x330825[_0x5cc890(0x1c6)](_0x546230)),console['log'](a24_0x330825[_0x5cc890(0x19d)](_0x5cc890(0x1a7)+_0x591000)),0x0;}const _0x5e918e=_0x5b3486[_0x5cc890(0x181)]||getCurrentSessionPID()[_0x5cc890(0x1a2)]();return saveSessionContext({'profile':_0x546230},_0x5b3486[_0x5cc890(0x181)]),console[_0x5cc890(0x1da)](_0x5cc890(0x1b3)+a24_0x330825[_0x5cc890(0x1c6)](_0x546230)+'\x20'+a24_0x330825[_0x5cc890(0x19d)](_0x5cc890(0x1d7)+_0x5e918e+')')),console['log'](a24_0x330825[_0x5cc890(0x19d)](_0x5cc890(0x1c9)+_0x546230+_0x5cc890(0x17d))),0x0;}}
@@ -1 +1 @@
1
- const a25_0xc9ecec=a25_0x2d34;function a25_0x28e4(){const _0xffb7b3=['2316ZWjCSl','List\x20all\x20available\x20profiles','3650589bHuUzF','execute','message','72gkOPJF','map','8aVcjQr','name','Error:\x20','2RNxLwY','\x20\x20Global:\x20~/.config/tdx/tdx.json','5864DZjQUa','log','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','8292508RRfbVd','profiles','5468KztvVu','11154550tMuPEf','5135478wBwysZ','1389817zdIVDp','5cLNmIb','length','config'];a25_0x28e4=function(){return _0xffb7b3;};return a25_0x28e4();}(function(_0x140971,_0x1b9e9c){const _0x3d429e=a25_0x2d34,_0xc897ad=_0x140971();while(!![]){try{const _0x4ec4fb=-parseInt(_0x3d429e(0x100))/0x1*(-parseInt(_0x3d429e(0xfe))/0x2)+-parseInt(_0x3d429e(0x10c))/0x3*(-parseInt(_0x3d429e(0x105))/0x4)+parseInt(_0x3d429e(0x109))/0x5*(parseInt(_0x3d429e(0x107))/0x6)+parseInt(_0x3d429e(0x103))/0x7+parseInt(_0x3d429e(0x113))/0x8*(-parseInt(_0x3d429e(0x10e))/0x9)+-parseInt(_0x3d429e(0x106))/0xa+parseInt(_0x3d429e(0x108))/0xb*(-parseInt(_0x3d429e(0x111))/0xc);if(_0x4ec4fb===_0x1b9e9c)break;else _0xc897ad['push'](_0xc897ad['shift']());}catch(_0x24f66b){_0xc897ad['push'](_0xc897ad['shift']());}}}(a25_0x28e4,0xc8d3b));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x2d34(_0x4e2d01,_0x4c4097){_0x4e2d01=_0x4e2d01-0xfc;const _0x28e42c=a25_0x28e4();let _0x2d34d5=_0x28e42c[_0x4e2d01];return _0x2d34d5;}export class ProfilesCommand extends BaseCommand{[a25_0xc9ecec(0xfc)]=a25_0xc9ecec(0x104);['description']=a25_0xc9ecec(0x10d);async[a25_0xc9ecec(0x10f)](_0xb404f){const _0x47de88=a25_0xc9ecec,{options:_0xe41194}=_0xb404f;try{const _0x1c4dbc=listProfiles(),_0x5982cb=getActiveProfile();if(_0x1c4dbc[_0x47de88(0x10a)]===0x0)return console[_0x47de88(0x101)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x47de88(0x101)](_0x47de88(0x102)),console[_0x47de88(0x101)](_0x47de88(0xff)),0x0;const _0x485d23=_0x1c4dbc[_0x47de88(0x112)](_0x4e56df=>{const _0x5a0b18=_0x47de88,_0x11158b=_0x4e56df[_0x5a0b18(0xfc)]===_0x5982cb,_0x30b2fe=getProfileParams(_0x4e56df[_0x5a0b18(0x10b)]);return{'name':_0x4e56df[_0x5a0b18(0xfc)],'active':_0x11158b,'scope':_0x4e56df['scope'],'description':_0x4e56df['config']['description']||'','params':_0x30b2fe};});return await handleSDKOutput(_0x485d23,_0xe41194),0x0;}catch(_0x5c04af){return _0x5c04af instanceof Error&&console['error'](_0x47de88(0xfd)+_0x5c04af[_0x47de88(0x110)]),0x1;}}}
1
+ const a25_0x4f279f=a25_0x76d6;(function(_0x2481f5,_0xa07eef){const _0x54c323=a25_0x76d6,_0x4479a8=_0x2481f5();while(!![]){try{const _0x2d3f94=-parseInt(_0x54c323(0x190))/0x1+-parseInt(_0x54c323(0x197))/0x2+-parseInt(_0x54c323(0x193))/0x3+parseInt(_0x54c323(0x196))/0x4*(parseInt(_0x54c323(0x195))/0x5)+parseInt(_0x54c323(0x194))/0x6+-parseInt(_0x54c323(0x18d))/0x7+-parseInt(_0x54c323(0x198))/0x8*(-parseInt(_0x54c323(0x191))/0x9);if(_0x2d3f94===_0xa07eef)break;else _0x4479a8['push'](_0x4479a8['shift']());}catch(_0x4cd3e4){_0x4479a8['push'](_0x4479a8['shift']());}}}(a25_0x1fdd,0xe9223));import{BaseCommand}from'./command.js';function a25_0x1fdd(){const _0x40b03e=['1632636AHufng','error','3185589ktQQaH','1001142hqyNdJ','103100KylDVi','272ZMKnTB','1705758IbvXRR','176XapRoS','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','Error:\x20','execute','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','config','7684558kaqLdr','scope','name','1592454OfDWzt'];a25_0x1fdd=function(){return _0x40b03e;};return a25_0x1fdd();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x76d6(_0x434d1b,_0x5bda41){_0x434d1b=_0x434d1b-0x18d;const _0x1fdde9=a25_0x1fdd();let _0x76d607=_0x1fdde9[_0x434d1b];return _0x76d607;}export class ProfilesCommand extends BaseCommand{[a25_0x4f279f(0x18f)]='profiles';['description']='List\x20all\x20available\x20profiles';async[a25_0x4f279f(0x19c)](_0x3c4337){const _0x31a917=a25_0x4f279f,{options:_0x29e747}=_0x3c4337;try{const _0x4e84c9=listProfiles(),_0x9b66b2=getActiveProfile();if(_0x4e84c9[_0x31a917(0x199)]===0x0)return console[_0x31a917(0x19e)](_0x31a917(0x19a)),console['log'](_0x31a917(0x19d)),console[_0x31a917(0x19e)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2b481a=_0x4e84c9['map'](_0x1885fd=>{const _0x3bace2=_0x31a917,_0x51fd99=_0x1885fd[_0x3bace2(0x18f)]===_0x9b66b2,_0x30e48d=getProfileParams(_0x1885fd['config']);return{'name':_0x1885fd['name'],'active':_0x51fd99,'scope':_0x1885fd[_0x3bace2(0x18e)],'description':_0x1885fd[_0x3bace2(0x19f)]['description']||'','params':_0x30e48d};});return await handleSDKOutput(_0x2b481a,_0x29e747),0x0;}catch(_0x3f8af1){return _0x3f8af1 instanceof Error&&console[_0x31a917(0x192)](_0x31a917(0x19b)+_0x3f8af1['message']),0x1;}}}
@@ -1 +1 @@
1
- const a26_0x5e7d9a=a26_0x5746;(function(_0x5549a2,_0x259269){const _0x35ca19=a26_0x5746,_0x14192e=_0x5549a2();while(!![]){try{const _0x4960af=parseInt(_0x35ca19(0x177))/0x1*(parseInt(_0x35ca19(0x16b))/0x2)+parseInt(_0x35ca19(0x175))/0x3+parseInt(_0x35ca19(0x173))/0x4*(parseInt(_0x35ca19(0x15e))/0x5)+parseInt(_0x35ca19(0x182))/0x6+-parseInt(_0x35ca19(0x169))/0x7+parseInt(_0x35ca19(0x176))/0x8+-parseInt(_0x35ca19(0x16e))/0x9;if(_0x4960af===_0x259269)break;else _0x14192e['push'](_0x14192e['shift']());}catch(_0x5c1c7b){_0x14192e['push'](_0x14192e['shift']());}}}(a26_0x374a,0x43b65));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';function a26_0x5746(_0x5ccf89,_0x547e10){_0x5ccf89=_0x5ccf89-0x14f;const _0x374a15=a26_0x374a();let _0x5746b8=_0x374a15[_0x5ccf89];return _0x5746b8;}function a26_0x374a(){const _0x4b8a07=['540012vFHsdp','query','completedSplits','totalSplits','Site:\x20','\x20splits','\x0aAll\x20results\x20saved\x20to\x20','setJobId','Statement\x20','Schema:\x20','verbose','jobId','join','Catalog:\x20','in\x20','Executing\x20query\x20[','403050ATSVGV','database','push','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','originalMessage','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20rows\x20','Executing\x20statement\x20','Executing\x20query...','\x20-\x20','setExtra','2049558wSMIoe','execute','22aswJpB','error','message','2534751WrXBnF','name','...','validate','output','8oboYKg','state','51294ThVDhL','4134592SiSbtQ','6058VifdNd','No\x20SQL\x20provided','description','processedRows','data','SQL:\x20','\x20[Job\x20ID:\x20','stats','file','options','Run\x20Trino\x20queries\x20(streaming)'];a26_0x374a=function(){return _0x4b8a07;};return a26_0x374a();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a26_0x5e7d9a(0x16f)]=a26_0x5e7d9a(0x14f);[a26_0x5e7d9a(0x179)]=a26_0x5e7d9a(0x181);async['execute'](_0x38aa14){const _0x5328ab=a26_0x5e7d9a,{options:_0x374eb2,args:_0x96fa0f,tdx:_0x561d81}=_0x38aa14,_0x3e5e16=_0x96fa0f[0x0],_0x198315=_0x374eb2[_0x5328ab(0x17f)];let _0x8649f1;try{if(_0x198315)_0x8649f1=readSqlStatementsFromFile(_0x198315);else{if(_0x3e5e16==='-')_0x8649f1=await readSqlStatementsFromStdin();else{if(_0x3e5e16&&isSqlFilePath(_0x3e5e16))_0x8649f1=readSqlStatementsFromFile(_0x3e5e16);else{if(_0x3e5e16)_0x8649f1=splitSqlStatements(_0x3e5e16);else throw new Error(_0x5328ab(0x178));}}}}catch(_0x2f841b){return console[_0x5328ab(0x16c)]('Error:\x20'+_0x2f841b[_0x5328ab(0x16d)]),0x1;}const _0xbe4166=_0x374eb2[_0x5328ab(0x15f)]||'information_schema',_0x2c4f00=_0x374eb2['catalog'];try{const _0x2b2815=[],_0x1b2260=!!_0x374eb2[_0x5328ab(0x172)];for(let _0x4fbe7d=0x0;_0x4fbe7d<_0x8649f1['length'];_0x4fbe7d++){const _0x41c14e=_0x8649f1[_0x4fbe7d],_0x270fb9=_0x4fbe7d+0x1,_0x4cced1=_0x8649f1['length'],_0x16146a=_0x4cced1>0x1;_0x374eb2[_0x5328ab(0x158)]&&(console[_0x5328ab(0x16c)]('\x0a'+(_0x16146a?'Statement\x20'+_0x270fb9+'/'+_0x4cced1+':':'')),console[_0x5328ab(0x16c)](_0x5328ab(0x152)+_0x374eb2['site']),console[_0x5328ab(0x16c)](_0x5328ab(0x15b)+(_0x2c4f00||'td')),console[_0x5328ab(0x16c)](_0x5328ab(0x157)+_0xbe4166),console['error'](_0x5328ab(0x17c)+_0x41c14e));const _0x17ed31=_0x16146a?_0x5328ab(0x165)+_0x270fb9+'/'+_0x4cced1+_0x5328ab(0x170):_0x5328ab(0x166);try{const _0x4322dc=await withProgressSpinner(_0x17ed31,async _0x36d387=>{const _0x6ff9a2=_0x5328ab,_0x20dfb9=await _0x561d81[_0x6ff9a2(0x14f)][_0x6ff9a2(0x16a)](_0x41c14e,{'catalog':_0x2c4f00,'schema':_0xbe4166,'onJobId':_0x54a656=>{const _0x59ac85=_0x6ff9a2;_0x36d387[_0x59ac85(0x155)](_0x54a656);},'onProgress':_0x246456=>{const _0x37664b=_0x6ff9a2;_0x36d387['setPhase'](_0x37664b(0x15d)+_0x246456[_0x37664b(0x174)]+']'),_0x36d387[_0x37664b(0x168)](formatRows(_0x246456[_0x37664b(0x17a)])+_0x37664b(0x164)+_0x246456[_0x37664b(0x150)]+'/'+_0x246456[_0x37664b(0x151)]+_0x37664b(0x153));}});return _0x20dfb9;},{'verbose':_0x374eb2[_0x5328ab(0x158)]}),_0x15264a=_0x4322dc[_0x5328ab(0x17b)],_0x5315d8=_0x15264a[_0x5328ab(0x159)]?_0x5328ab(0x17d)+_0x15264a[_0x5328ab(0x159)]+']':'',_0x1bc7b9=_0x16146a?_0x5328ab(0x156)+_0x270fb9+'/'+_0x4cced1+_0x5328ab(0x167):'';console[_0x5328ab(0x16c)]('✔\x20'+_0x1bc7b9+'Query\x20completed:\x20Processed\x20'+formatRows(_0x15264a['stats'][_0x5328ab(0x17a)])+'\x20rows\x20'+(_0x5328ab(0x15c)+formatElapsed(_0x15264a[_0x5328ab(0x17e)]['elapsedTimeMillis'])+_0x5315d8));if(_0x16146a&&_0x1b2260){const _0x4f0e54=resolveOutputOptions(_0x374eb2),_0x414458=await formatQueryOutput(_0x15264a,_0x4f0e54);_0x2b2815[_0x5328ab(0x160)](_0x414458);}else await handleQueryOutput(_0x15264a,_0x374eb2);}catch(_0x1addd3){const _0x5e8f6f=_0x16146a?'Statement\x20'+_0x270fb9+'/'+_0x4cced1+':\x0a':'',_0x3bd7c2=_0x1addd3 instanceof SDKError?_0x1addd3[_0x5328ab(0x162)]:_0x1addd3['message'];return console[_0x5328ab(0x16c)](''+_0x5e8f6f+_0x3bd7c2),0x1;}}if(_0x8649f1['length']>0x1&&_0x1b2260&&_0x2b2815['length']>0x0){const _0x174198=_0x2b2815[_0x5328ab(0x15a)]('\x0a');writeFileSync(_0x374eb2[_0x5328ab(0x172)],_0x174198),console[_0x5328ab(0x16c)](_0x5328ab(0x154)+_0x374eb2['output']);}return 0x0;}catch(_0x1731c1){throw _0x1731c1;}}[a26_0x5e7d9a(0x171)](_0x113310){const _0x48e735=a26_0x5e7d9a,_0x3208a6=_0x113310['args'][0x0],_0xc00b84=_0x113310[_0x48e735(0x180)]['file'];if(!_0x3208a6&&!_0xc00b84)return _0x48e735(0x161);if(_0x3208a6&&_0xc00b84)return _0x48e735(0x163);return undefined;}}
1
+ const a26_0x1d4f30=a26_0x59f6;function a26_0x1631(){const _0x411973=['12GcHcsg','Catalog:\x20','5627580qEroRb','Executing\x20query...','length','Executing\x20statement\x20','1605185tzmJxo','...','\x20splits','jobId','processedRows','totalSplits','originalMessage','description','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','join','Schema:\x20','validate','SQL:\x20','args','Error:\x20','output','489339XhwQHE','state','push','Executing\x20query\x20[','1424288CglWed','\x0aAll\x20results\x20saved\x20to\x20','15ryFWnj','information_schema','site','Query\x20completed:\x20Processed\x20','file','Statement\x20','635803ZnvdwG','error','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','No\x20SQL\x20provided','message','execute','\x20-\x20','database','Run\x20Trino\x20queries\x20(streaming)','setJobId','Site:\x20','elapsedTimeMillis','\x20rows\x20','verbose','88LmBrRD','stats','11271100EgBbed','query','718364VhTLXN'];a26_0x1631=function(){return _0x411973;};return a26_0x1631();}(function(_0x3345dc,_0x5f4182){const _0x3df2da=a26_0x59f6,_0x41a0a2=_0x3345dc();while(!![]){try{const _0xb44882=-parseInt(_0x3df2da(0xd6))/0x1+parseInt(_0x3df2da(0x103))/0x2+parseInt(_0x3df2da(0x105))/0x3*(parseInt(_0x3df2da(0xe8))/0x4)+-parseInt(_0x3df2da(0xef))/0x5*(parseInt(_0x3df2da(0xe9))/0x6)+parseInt(_0x3df2da(0xeb))/0x7+parseInt(_0x3df2da(0xe4))/0x8*(parseInt(_0x3df2da(0xff))/0x9)+-parseInt(_0x3df2da(0xe6))/0xa;if(_0xb44882===_0x5f4182)break;else _0x41a0a2['push'](_0x41a0a2['shift']());}catch(_0x3c2fe8){_0x41a0a2['push'](_0x41a0a2['shift']());}}}(a26_0x1631,0x9439d));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';function a26_0x59f6(_0x4e71df,_0x5a5db0){_0x4e71df=_0x4e71df-0xd4;const _0x163180=a26_0x1631();let _0x59f67e=_0x163180[_0x4e71df];return _0x59f67e;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x1d4f30(0xe7);[a26_0x1d4f30(0xf6)]=a26_0x1d4f30(0xde);async['execute'](_0x26ffd8){const _0x77905b=a26_0x1d4f30,{options:_0x3bd951,args:_0x8dcf17,tdx:_0x1368b0}=_0x26ffd8,_0x2c40a6=_0x8dcf17[0x0],_0xfd9ba3=_0x3bd951[_0x77905b(0xd4)];let _0x1a56e7;try{if(_0xfd9ba3)_0x1a56e7=readSqlStatementsFromFile(_0xfd9ba3);else{if(_0x2c40a6==='-')_0x1a56e7=await readSqlStatementsFromStdin();else{if(_0x2c40a6&&isSqlFilePath(_0x2c40a6))_0x1a56e7=readSqlStatementsFromFile(_0x2c40a6);else{if(_0x2c40a6)_0x1a56e7=splitSqlStatements(_0x2c40a6);else throw new Error(_0x77905b(0xd9));}}}}catch(_0x3b485e){return console[_0x77905b(0xd7)](_0x77905b(0xfd)+_0x3b485e[_0x77905b(0xda)]),0x1;}const _0xe09744=_0x3bd951[_0x77905b(0xdd)]||_0x77905b(0x106),_0x2d25d4=_0x3bd951['catalog'];try{const _0x4937e1=[],_0x547cf8=!!_0x3bd951[_0x77905b(0xfe)];for(let _0x584d65=0x0;_0x584d65<_0x1a56e7['length'];_0x584d65++){const _0x349783=_0x1a56e7[_0x584d65],_0x30e111=_0x584d65+0x1,_0x4f17b2=_0x1a56e7[_0x77905b(0xed)],_0x219d0a=_0x4f17b2>0x1;_0x3bd951[_0x77905b(0xe3)]&&(console[_0x77905b(0xd7)]('\x0a'+(_0x219d0a?'Statement\x20'+_0x30e111+'/'+_0x4f17b2+':':'')),console[_0x77905b(0xd7)](_0x77905b(0xe0)+_0x3bd951[_0x77905b(0x107)]),console['error'](_0x77905b(0xea)+(_0x2d25d4||'td')),console[_0x77905b(0xd7)](_0x77905b(0xf9)+_0xe09744),console[_0x77905b(0xd7)](_0x77905b(0xfb)+_0x349783));const _0x450aef=_0x219d0a?_0x77905b(0xee)+_0x30e111+'/'+_0x4f17b2+_0x77905b(0xf0):_0x77905b(0xec);try{const _0x14b93f=await withProgressSpinner(_0x450aef,async _0x9269df=>{const _0xe24991=_0x77905b,_0x5bfa1a=await _0x1368b0[_0xe24991(0xe7)][_0xe24991(0xdb)](_0x349783,{'catalog':_0x2d25d4,'schema':_0xe09744,'onJobId':_0x1ac4dd=>{const _0x29ddfd=_0xe24991;_0x9269df[_0x29ddfd(0xdf)](_0x1ac4dd);},'onProgress':_0x31737f=>{const _0xd9ac5f=_0xe24991;_0x9269df['setPhase'](_0xd9ac5f(0x102)+_0x31737f[_0xd9ac5f(0x100)]+']'),_0x9269df['setExtra'](formatRows(_0x31737f['processedRows'])+_0xd9ac5f(0xe2)+_0x31737f['completedSplits']+'/'+_0x31737f[_0xd9ac5f(0xf4)]+_0xd9ac5f(0xf1));}});return _0x5bfa1a;},{'verbose':_0x3bd951[_0x77905b(0xe3)]}),_0x4e6c0f=_0x14b93f['data'],_0x450b91=_0x4e6c0f['jobId']?'\x20[Job\x20ID:\x20'+_0x4e6c0f[_0x77905b(0xf2)]+']':'',_0xbbeaea=_0x219d0a?_0x77905b(0xd5)+_0x30e111+'/'+_0x4f17b2+_0x77905b(0xdc):'';console['error']('✔\x20'+_0xbbeaea+_0x77905b(0x108)+formatRows(_0x4e6c0f[_0x77905b(0xe5)][_0x77905b(0xf3)])+_0x77905b(0xe2)+('in\x20'+formatElapsed(_0x4e6c0f[_0x77905b(0xe5)][_0x77905b(0xe1)])+_0x450b91));if(_0x219d0a&&_0x547cf8){const _0x5bee6e=resolveOutputOptions(_0x3bd951),_0x33f13e=await formatQueryOutput(_0x4e6c0f,_0x5bee6e);_0x4937e1[_0x77905b(0x101)](_0x33f13e);}else await handleQueryOutput(_0x4e6c0f,_0x3bd951);}catch(_0x2c0eee){const _0x31ed52=_0x219d0a?_0x77905b(0xd5)+_0x30e111+'/'+_0x4f17b2+':\x0a':'',_0x5f13e4=_0x2c0eee instanceof SDKError?_0x2c0eee[_0x77905b(0xf5)]:_0x2c0eee[_0x77905b(0xda)];return console[_0x77905b(0xd7)](''+_0x31ed52+_0x5f13e4),0x1;}}if(_0x1a56e7[_0x77905b(0xed)]>0x1&&_0x547cf8&&_0x4937e1[_0x77905b(0xed)]>0x0){const _0x4cc343=_0x4937e1[_0x77905b(0xf8)]('\x0a');writeFileSync(_0x3bd951['output'],_0x4cc343),console[_0x77905b(0xd7)](_0x77905b(0x104)+_0x3bd951[_0x77905b(0xfe)]);}return 0x0;}catch(_0x2efe20){throw _0x2efe20;}}[a26_0x1d4f30(0xfa)](_0x47c68f){const _0x20fca9=a26_0x1d4f30,_0x566872=_0x47c68f[_0x20fca9(0xfc)][0x0],_0xcb03c2=_0x47c68f['options'][_0x20fca9(0xd4)];if(!_0x566872&&!_0xcb03c2)return _0x20fca9(0xd8);if(_0x566872&&_0xcb03c2)return _0x20fca9(0xf7);return undefined;}}
@@ -1 +1 @@
1
- const a27_0x1736b9=a27_0x3960;(function(_0x40da4d,_0xdbafb2){const _0xf1a4e8=a27_0x3960,_0x3e5a75=_0x40da4d();while(!![]){try{const _0x4dd091=parseInt(_0xf1a4e8(0x1f5))/0x1*(parseInt(_0xf1a4e8(0x1d1))/0x2)+parseInt(_0xf1a4e8(0x222))/0x3*(parseInt(_0xf1a4e8(0x207))/0x4)+parseInt(_0xf1a4e8(0x1e7))/0x5+parseInt(_0xf1a4e8(0x1de))/0x6*(parseInt(_0xf1a4e8(0x19d))/0x7)+-parseInt(_0xf1a4e8(0x1b6))/0x8*(-parseInt(_0xf1a4e8(0x210))/0x9)+parseInt(_0xf1a4e8(0x1a3))/0xa+-parseInt(_0xf1a4e8(0x1d4))/0xb;if(_0x4dd091===_0xdbafb2)break;else _0x3e5a75['push'](_0x3e5a75['shift']());}catch(_0x10773e){_0x3e5a75['push'](_0x3e5a75['shift']());}}}(a27_0x28ff,0x31ddf));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a27_0x3960(_0x1f281b,_0x53af4a){_0x1f281b=_0x1f281b-0x199;const _0x28ff1d=a27_0x28ff();let _0x3960a0=_0x28ff1d[_0x1f281b];return _0x3960a0;}import a27_0x177291 from'chalk';function formatRelativeTime(_0x4e71c5){const _0x59619c=a27_0x3960,_0x48aab6=new Date(_0x4e71c5),_0x52da2c=new Date(),_0x25b881=_0x48aab6[_0x59619c(0x20b)]()-_0x52da2c[_0x59619c(0x20b)](),_0x1fd215=Math[_0x59619c(0x1ec)](_0x25b881)/0x3e8,_0x230d55=_0x25b881<0x0;if(_0x1fd215<0x3c)return _0x230d55?_0x59619c(0x1ce):'soon';else{if(_0x1fd215<0xe10){const _0x37f107=Math[_0x59619c(0x1bc)](_0x1fd215/0x3c);return _0x230d55?_0x37f107+_0x59619c(0x20e):'in\x20'+_0x37f107+'m';}else{if(_0x1fd215<0x15180){const _0x1a634d=Math[_0x59619c(0x1bc)](_0x1fd215/0xe10);return _0x230d55?_0x1a634d+_0x59619c(0x1f0):_0x59619c(0x1c5)+_0x1a634d+'h';}else{if(_0x1fd215<0x93a80){const _0x28e85f=Math[_0x59619c(0x1bc)](_0x1fd215/0x15180);return _0x230d55?_0x28e85f+_0x59619c(0x1bd):_0x59619c(0x1c5)+_0x28e85f+'d';}else return _0x48aab6['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]='schedule:list';[a27_0x1736b9(0x22a)]='List\x20scheduled\x20queries';async[a27_0x1736b9(0x1be)](_0x3ef781){const _0x3fad4f=a27_0x1736b9,{options:_0x3f0243,args:_0x4f6d26,tdx:_0x5aebcf}=_0x3ef781,_0x5a4ecf=resolveLimit(_0x3f0243[_0x3fad4f(0x1a1)],DEFAULT_DISPLAY_LIMIT),_0x3face7=_0x4f6d26[0x0],_0x193c52=_0x3face7?_0x3fad4f(0x1ff)+_0x3face7+_0x3fad4f(0x1f7):'Listing\x20scheduled\x20queries...',_0x56276b=await withSpinner(_0x193c52,()=>_0x5aebcf[_0x3fad4f(0x1f1)][_0x3fad4f(0x1c3)]({'limit':_0x5a4ecf,'scheduled':!![],'pattern':_0x3face7}),{'verbose':_0x3f0243[_0x3fad4f(0x1df)]}),_0x250281=_0x56276b[_0x3fad4f(0x1dc)]['queries'],_0x12d2e7=_0x56276b[_0x3fad4f(0x1dc)][_0x3fad4f(0x1e5)][_0x3fad4f(0x228)],_0x21ddde=_0x3face7?_0x3fad4f(0x1e0)+_0x3face7+'\x22':'';_0x12d2e7?console[_0x3fad4f(0x1ba)](_0x3fad4f(0x21c)+_0x250281[_0x3fad4f(0x220)]+_0x3fad4f(0x1b8)+_0x21ddde+_0x3fad4f(0x1f9)):console[_0x3fad4f(0x1ba)](_0x3fad4f(0x1f8)+_0x250281[_0x3fad4f(0x220)]+_0x3fad4f(0x1e2)+(_0x250281[_0x3fad4f(0x220)]!==0x1?_0x3fad4f(0x1c8):'y')+_0x21ddde);if(_0x3f0243[_0x3fad4f(0x1fb)]===_0x3fad4f(0x1e8)||_0x3f0243[_0x3fad4f(0x1fb)]===_0x3fad4f(0x199)||_0x3f0243['format']===_0x3fad4f(0x1d9)||_0x3f0243[_0x3fad4f(0x1fb)]==='tsv'){const _0xae6e9c=_0x250281[_0x3fad4f(0x202)](_0x32dc87=>({'id':_0x32dc87['id'],'name':_0x32dc87[_0x3fad4f(0x1ab)],'cron':_0x32dc87['cron'],'database':_0x32dc87['database']?.['name'],'type':_0x32dc87[_0x3fad4f(0x1aa)],'timezone':_0x32dc87['time_zone'],'user_name':_0x32dc87[_0x3fad4f(0x223)]?.[_0x3fad4f(0x1ab)],'updated_at':_0x32dc87['updated_at'],'next_run_at':_0x32dc87[_0x3fad4f(0x1c2)],'last_job_status':_0x32dc87[_0x3fad4f(0x1ed)]?.[_0x3fad4f(0x1e1)]}));await handleSDKOutput(_0xae6e9c,_0x3f0243);}else{if(_0x250281[_0x3fad4f(0x220)]===0x0)console[_0x3fad4f(0x1ac)]('No\x20scheduled\x20queries\x20found');else{const _0x102645=_0x3f0243[_0x3fad4f(0x219)],_0x522517=_0x250281[_0x3fad4f(0x202)](_0x5f2d73=>{const _0x3eb663=_0x3fad4f,_0x298c2a=_0x5f2d73[_0x3eb663(0x1ed)]?.[_0x3eb663(0x1e1)]?_0x5f2d73['last_job'][_0x3eb663(0x1e1)]===_0x3eb663(0x1ca)?'✓':'✗':'-',_0x49d5f2=_0x5f2d73[_0x3eb663(0x1ed)]?.[_0x3eb663(0x218)]?formatRelativeTime(_0x5f2d73['last_job']['ended_at']):_0x3eb663(0x216),_0x421e2b=_0x5f2d73[_0x3eb663(0x1c2)]?formatRelativeTime(_0x5f2d73['next_run_at']):'-',_0x36a328=_0x5f2d73[_0x3eb663(0x214)]||'',_0x5eca17=_0x5f2d73[_0x3eb663(0x1ab)]||_0x3eb663(0x20a),_0x5ebe49=getConsoleUrl(_0x102645,_0x3eb663(0x20f)+_0x5f2d73['id']);return{'statusIcon':_0x298c2a,'lastRun':_0x49d5f2,'nextRun':_0x421e2b,'cron':_0x36a328,'name':_0x5eca17,'queryUrl':_0x5ebe49,'status':_0x5f2d73[_0x3eb663(0x1ed)]?.[_0x3eb663(0x1e1)]};}),_0x24113b=Math[_0x3fad4f(0x1bf)](..._0x522517[_0x3fad4f(0x202)](_0x183201=>_0x183201[_0x3fad4f(0x221)][_0x3fad4f(0x220)])),_0x5c60bf=Math['max'](..._0x522517[_0x3fad4f(0x202)](_0x4a4038=>_0x4a4038[_0x3fad4f(0x1b1)]['length'])),_0x21f90a=Math[_0x3fad4f(0x1bf)](..._0x522517[_0x3fad4f(0x202)](_0x1e5954=>_0x1e5954[_0x3fad4f(0x214)][_0x3fad4f(0x220)])),_0x18c2a1=_0x522517[_0x3fad4f(0x202)](_0x1430b6=>{const _0x2d4e3a=_0x3fad4f,_0x43a427=_0x1430b6[_0x2d4e3a(0x1e1)]===_0x2d4e3a(0x1ca)?a27_0x177291[_0x2d4e3a(0x1cc)](_0x1430b6[_0x2d4e3a(0x217)]):_0x1430b6['status']==='error'?a27_0x177291[_0x2d4e3a(0x1e3)](_0x1430b6[_0x2d4e3a(0x217)]):a27_0x177291[_0x2d4e3a(0x1a2)](_0x1430b6[_0x2d4e3a(0x217)]),_0x47abac=_0x1430b6[_0x2d4e3a(0x221)][_0x2d4e3a(0x21a)](_0x24113b),_0x368ef7=_0x1430b6[_0x2d4e3a(0x1b1)]['padEnd'](_0x5c60bf),_0x2df3f8=_0x1430b6[_0x2d4e3a(0x214)]?a27_0x177291[_0x2d4e3a(0x204)](_0x1430b6[_0x2d4e3a(0x214)][_0x2d4e3a(0x21a)](_0x21f90a)):'\x20'['repeat'](_0x21f90a),_0x55dd90=hyperlink(_0x1430b6[_0x2d4e3a(0x1ab)],_0x1430b6[_0x2d4e3a(0x1da)]);return'📅\x20'+_0x43a427+'\x20'+_0x47abac+_0x2d4e3a(0x1c7)+_0x368ef7+'\x20\x20'+_0x2df3f8+'\x20\x20'+_0x55dd90;});await writeOutput(_0x18c2a1[_0x3fad4f(0x1d2)]('\x0a'),_0x3f0243[_0x3fad4f(0x1c9)],_0x3fad4f(0x1b5));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]=a27_0x1736b9(0x1a8);['description']='Show\x20schedule\x20details';[a27_0x1736b9(0x206)](_0x16d7ed){const _0xe8201f=a27_0x1736b9,_0xe56411=_0x16d7ed[_0xe8201f(0x1db)][0x0];if(!_0xe56411)return _0xe8201f(0x1d7);return undefined;}async['execute'](_0x5800a0){const _0x278845=a27_0x1736b9,{options:_0x393d6e,args:_0x548b89,tdx:_0x5b3e7f}=_0x5800a0,_0x16759c=_0x548b89[0x0],_0x4a97ff=await withSpinner('Getting\x20schedule\x20details...',()=>_0x5b3e7f[_0x278845(0x1f1)][_0x278845(0x1b9)](_0x16759c),{'verbose':_0x393d6e['verbose']}),_0x19c903=_0x4a97ff[_0x278845(0x1dc)],_0x4eed5d={'name':_0x19c903[_0x278845(0x1ab)],'cron':_0x19c903[_0x278845(0x214)],'database':_0x19c903['database'],'type':_0x19c903['type'],'timezone':_0x19c903[_0x278845(0x201)],'user_name':_0x19c903['user_name'],'created_at':_0x19c903['created_at'],'engine_version':_0x19c903[_0x278845(0x1d8)],'executing_user_id':_0x19c903[_0x278845(0x1cf)],'query':_0x19c903[_0x278845(0x1a0)],'delay':_0x19c903[_0x278845(0x1ae)],'priority':_0x19c903[_0x278845(0x209)],'retry_limit':_0x19c903[_0x278845(0x1ad)],..._0x19c903[_0x278845(0x1fd)]&&{'result':_0x19c903['result']}};return await handleSingleObjectOutput(_0x4eed5d,_0x393d6e),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]=a27_0x1736b9(0x1ef);[a27_0x1736b9(0x22a)]=a27_0x1736b9(0x229);[a27_0x1736b9(0x206)](_0x2f6737){const _0x5cb28c=a27_0x1736b9,_0xc855e4=_0x2f6737[_0x5cb28c(0x1db)][0x0];if(!_0xc855e4)return _0x5cb28c(0x19b);return undefined;}async[a27_0x1736b9(0x1be)](_0x4003b4){const _0x50d622=a27_0x1736b9,{options:_0x20bb03,args:_0x19adb8,tdx:_0x3e5013}=_0x4003b4,_0x22bffa=_0x19adb8[0x0],_0x4d3d1d=_0x20bb03,_0x4ae37e=_0x4d3d1d['database'],_0xbbe74=_0x4d3d1d[_0x50d622(0x19c)],_0x5ab150=_0x4d3d1d[_0x50d622(0x1aa)]||_0x50d622(0x1c4);let _0x1a8303;try{_0x1a8303=readFileSync(_0xbbe74,_0x50d622(0x1a5))[_0x50d622(0x1dd)]();}catch(_0x3305f4){throw new SDKError(ErrorCode[_0x50d622(0x1e6)],_0x50d622(0x1fa)+_0xbbe74,_0x3305f4 instanceof Error?_0x3305f4:undefined);}if(!_0x1a8303)throw new SDKError(ErrorCode[_0x50d622(0x1e6)],_0x50d622(0x1ee));const _0x4165f1={'database':_0x4ae37e,'query':_0x1a8303,'type':_0x5ab150};if(_0x4d3d1d['cron'])_0x4165f1[_0x50d622(0x214)]=_0x4d3d1d[_0x50d622(0x214)];if(_0x4d3d1d[_0x50d622(0x201)])_0x4165f1['timezone']=_0x4d3d1d[_0x50d622(0x201)];if(_0x4d3d1d['delay']!==undefined)_0x4165f1['delay']=Number(_0x4d3d1d[_0x50d622(0x1ae)]);if(_0x4d3d1d[_0x50d622(0x209)]!==undefined)_0x4165f1['priority']=Number(_0x4d3d1d['priority']);if(_0x4d3d1d['retryLimit']!==undefined)_0x4165f1[_0x50d622(0x1ad)]=Number(_0x4d3d1d[_0x50d622(0x21d)]);if(_0x4d3d1d[_0x50d622(0x1ea)])_0x4165f1[_0x50d622(0x1d8)]=_0x4d3d1d[_0x50d622(0x1ea)];if(_0x4d3d1d[_0x50d622(0x1fd)])_0x4165f1[_0x50d622(0x1fd)]=_0x4d3d1d[_0x50d622(0x1fd)];if(_0x20bb03[_0x50d622(0x1df)]){console[_0x50d622(0x1ba)]('Creating\x20schedule:\x20'+_0x22bffa),console[_0x50d622(0x1ba)](_0x50d622(0x1b2)+_0x4ae37e),console[_0x50d622(0x1ba)]('\x20\x20Type:\x20'+_0x5ab150);if(_0x4165f1[_0x50d622(0x214)])console[_0x50d622(0x1ba)](_0x50d622(0x1c1)+_0x4165f1[_0x50d622(0x214)]);if(_0x4165f1[_0x50d622(0x201)])console[_0x50d622(0x1ba)](_0x50d622(0x21e)+_0x4165f1[_0x50d622(0x201)]);}const _0x1cea68=await withSpinner(_0x50d622(0x1eb),()=>_0x3e5013['schedules'][_0x50d622(0x200)](_0x22bffa,_0x4165f1),{'verbose':_0x20bb03[_0x50d622(0x1df)]});return console[_0x50d622(0x1ba)](_0x50d622(0x1fc)+_0x1cea68['data'][_0x50d622(0x1ab)]),await handleSingleObjectOutput(_0x1cea68[_0x50d622(0x1dc)],_0x20bb03),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]=a27_0x1736b9(0x227);[a27_0x1736b9(0x22a)]=a27_0x1736b9(0x213);['validate'](_0x367ad3){const _0x3ea62c=_0x367ad3['args'][0x0];if(!_0x3ea62c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a27_0x1736b9(0x1be)](_0x459a18){const _0x23c3b8=a27_0x1736b9,{options:_0x1b1b00,args:_0x572d55,tdx:_0x87e90f}=_0x459a18,_0x272276=_0x572d55[0x0],_0xa667d1=_0x1b1b00,_0x51e822={};if(_0xa667d1[_0x23c3b8(0x1a6)])_0x51e822[_0x23c3b8(0x1a6)]=_0xa667d1[_0x23c3b8(0x1a6)];if(_0xa667d1['type'])_0x51e822[_0x23c3b8(0x1aa)]=_0xa667d1[_0x23c3b8(0x1aa)];if(_0xa667d1[_0x23c3b8(0x214)])_0x51e822['cron']=_0xa667d1['cron'];if(_0xa667d1[_0x23c3b8(0x201)])_0x51e822[_0x23c3b8(0x201)]=_0xa667d1['timezone'];if(_0xa667d1[_0x23c3b8(0x1ae)]!==undefined)_0x51e822[_0x23c3b8(0x1ae)]=Number(_0xa667d1[_0x23c3b8(0x1ae)]);if(_0xa667d1[_0x23c3b8(0x209)]!==undefined)_0x51e822['priority']=Number(_0xa667d1[_0x23c3b8(0x209)]);if(_0xa667d1[_0x23c3b8(0x21d)]!==undefined)_0x51e822[_0x23c3b8(0x1ad)]=Number(_0xa667d1['retryLimit']);if(_0xa667d1[_0x23c3b8(0x1ea)])_0x51e822[_0x23c3b8(0x1d8)]=_0xa667d1['engineVersion'];if(_0xa667d1[_0x23c3b8(0x1fd)])_0x51e822[_0x23c3b8(0x1fd)]=_0xa667d1[_0x23c3b8(0x1fd)];if(_0xa667d1['file'])try{_0x51e822[_0x23c3b8(0x1a0)]=readFileSync(_0xa667d1[_0x23c3b8(0x19c)],'utf-8')[_0x23c3b8(0x1dd)]();}catch(_0x373030){throw new SDKError(ErrorCode[_0x23c3b8(0x1e6)],'Failed\x20to\x20read\x20file:\x20'+_0xa667d1['file'],_0x373030 instanceof Error?_0x373030:undefined);}if(Object[_0x23c3b8(0x1f2)](_0x51e822)[_0x23c3b8(0x220)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x23c3b8(0x1d0));if(_0x1b1b00['verbose']){console[_0x23c3b8(0x1ba)](_0x23c3b8(0x21f)+_0x272276);for(const [_0x38f5a8,_0x225af9]of Object['entries'](_0x51e822)){_0x38f5a8===_0x23c3b8(0x1a0)?console[_0x23c3b8(0x1ba)]('\x20\x20'+_0x38f5a8+':\x20'+_0x225af9[_0x23c3b8(0x1f4)](0x0,0x32)+_0x23c3b8(0x226)):console[_0x23c3b8(0x1ba)]('\x20\x20'+_0x38f5a8+':\x20'+_0x225af9);}}const _0x5476d9=await withSpinner(_0x23c3b8(0x1a7),()=>_0x87e90f[_0x23c3b8(0x1f1)][_0x23c3b8(0x225)](_0x272276,_0x51e822),{'verbose':_0x1b1b00[_0x23c3b8(0x1df)]});return console[_0x23c3b8(0x1ba)]('Schedule\x20updated:\x20'+_0x5476d9[_0x23c3b8(0x1dc)][_0x23c3b8(0x1ab)]),await handleSingleObjectOutput(_0x5476d9[_0x23c3b8(0x1dc)],_0x1b1b00),0x0;}}function a27_0x28ff(){const _0x108867=['green','Getting\x20schedule\x20history...','just\x20now','executing_user_id','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','8QLidqI','join','\x20job','11065450vIXOJe','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','schedule:delete','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','engine_version','table','queryUrl','args','data','trim','37752PczMTn','verbose','\x20matching\x20\x22','status','\x20scheduled\x20quer','red','\x20\x20Num:\x20','pagination','INVALID_ARGUMENT','989365gHExvk','json','Deleting\x20schedule...','engineVersion','Creating\x20schedule...','abs','last_job','Query\x20file\x20is\x20empty','schedule:create','h\x20ago','schedules','keys','history','substring','2749ZLMiia','Running\x20schedule:\x20','\x22...','Found\x20','\x20(use\x20--limit\x20to\x20see\x20more)','Failed\x20to\x20read\x20file:\x20','format','Schedule\x20created:\x20','result','time','Searching\x20scheduled\x20queries\x20matching\x20\x22','create','timezone','map','from','cyan','\x20execution','validate','164tbnGWA','end_at','priority','(unnamed)','getTime','Cancelled','run','m\x20ago','/app/queries/editor?queryId=','99ueYqdI','job_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Update\x20a\x20scheduled\x20query','cron','\x20created','never','statusIcon','ended_at','site','padEnd','Show\x20schedule\x20execution\x20history','Showing\x20first\x20','retryLimit','\x20\x20Timezone:\x20','Updating\x20schedule:\x20','length','lastRun','10356vYXHoH','user','Running\x20schedule...','update','...','schedule:update','has_next_page','Create\x20a\x20scheduled\x20query','description','\x20\x20Time:\x20','jsonl','\x20\x20Job\x20ID:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','file','322HuyhnL','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20(showing\x20','query','limit','dim','2242020UpclvA','created_at','utf-8','database','Updating\x20schedule...','schedule:show','Delete\x20a\x20scheduled\x20query','type','name','log','retry_limit','delay','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','scheduled_at','nextRun','\x20\x20Database:\x20','jobs','delete','list','251760ALRwcJ','schedule:run','\x20schedules','show','error','start_at','round','d\x20ago','execute','max','yes','\x20\x20Cron:\x20','next_run_at','listQueries','trino','in\x20','num','\x20\x20→\x20','ies','output','success','Schedule\x20deleted:\x20'];a27_0x28ff=function(){return _0x108867;};return a27_0x28ff();}export class ScheduleDeleteCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]=a27_0x1736b9(0x1d6);[a27_0x1736b9(0x22a)]=a27_0x1736b9(0x1a9);['validate'](_0x18fc39){const _0x2d66ac=a27_0x1736b9,_0x30a130=_0x18fc39[_0x2d66ac(0x1db)][0x0];if(!_0x30a130)return _0x2d66ac(0x1af);return undefined;}async['execute'](_0x2dd781){const _0x161aeb=a27_0x1736b9,{options:_0x26a560,args:_0x2ff87a,tdx:_0x2fbc84}=_0x2dd781,_0x5e34a9=_0x2ff87a[0x0];if(!_0x26a560[_0x161aeb(0x1c0)]){const _0x5c9bb1=await confirm(_0x161aeb(0x1d5)+_0x5e34a9+'\x22?');if(!_0x5c9bb1)return console[_0x161aeb(0x1ba)](_0x161aeb(0x20c)),0x0;}const _0x51ce45=await withSpinner(_0x161aeb(0x1e9),()=>_0x2fbc84['schedules'][_0x161aeb(0x1b4)](_0x5e34a9),{'verbose':_0x26a560[_0x161aeb(0x1df)]});return console[_0x161aeb(0x1ba)](_0x161aeb(0x1cb)+_0x51ce45[_0x161aeb(0x1dc)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]=a27_0x1736b9(0x1b7);[a27_0x1736b9(0x22a)]='Run\x20a\x20scheduled\x20query\x20immediately';[a27_0x1736b9(0x206)](_0x357107){const _0x2fc355=a27_0x1736b9,_0x144d74=_0x357107[_0x2fc355(0x1db)][0x0];if(!_0x144d74)return _0x2fc355(0x19e);return undefined;}async[a27_0x1736b9(0x1be)](_0x596acb){const _0x536aba=a27_0x1736b9,{options:_0x393882,args:_0x117df7,tdx:_0x4bb9ac}=_0x596acb,_0x591a4b=_0x117df7[0x0],_0x1c9b65=_0x393882,_0x3358f6=_0x1c9b65[_0x536aba(0x1fe)],_0x2f9f65=_0x1c9b65['num']!==undefined?Number(_0x1c9b65[_0x536aba(0x1c6)]):undefined;if(_0x393882[_0x536aba(0x1df)]){console[_0x536aba(0x1ba)](_0x536aba(0x1f6)+_0x591a4b);if(_0x3358f6)console[_0x536aba(0x1ba)](_0x536aba(0x22b)+_0x3358f6);if(_0x2f9f65)console[_0x536aba(0x1ba)](_0x536aba(0x1e4)+_0x2f9f65);}const _0xedbd58=await withSpinner(_0x536aba(0x224),()=>_0x4bb9ac[_0x536aba(0x1f1)][_0x536aba(0x20d)](_0x591a4b,{'time':_0x3358f6,'num':_0x2f9f65}),{'verbose':_0x393882[_0x536aba(0x1df)]}),_0xb1f598=_0xedbd58[_0x536aba(0x1dc)][_0x536aba(0x1b3)];console[_0x536aba(0x1ba)]('Schedule\x20run\x20submitted:\x20'+_0xb1f598[_0x536aba(0x220)]+_0x536aba(0x1d3)+(_0xb1f598[_0x536aba(0x220)]!==0x1?'s':'')+_0x536aba(0x215));for(const _0x77c9a1 of _0xb1f598){console[_0x536aba(0x1ba)](_0x536aba(0x19a)+_0x77c9a1[_0x536aba(0x211)]);}return await handleSDKOutput(_0xb1f598,_0x393882),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a27_0x1736b9(0x1ab)]='schedule:history';[a27_0x1736b9(0x22a)]=a27_0x1736b9(0x21b);[a27_0x1736b9(0x206)](_0x5a0261){const _0x8da350=a27_0x1736b9,_0x28ba16=_0x5a0261[_0x8da350(0x1db)][0x0];if(!_0x28ba16)return _0x8da350(0x212);return undefined;}async[a27_0x1736b9(0x1be)](_0x1dee3b){const _0x5286a6=a27_0x1736b9,{options:_0x44b2e5,args:_0x5c16bb,tdx:_0x8443ef}=_0x1dee3b,_0x3f13a3=_0x5c16bb[0x0],_0x2904ca=_0x44b2e5,_0x2746ba=_0x2904ca[_0x5286a6(0x203)]!==undefined?Number(_0x2904ca[_0x5286a6(0x203)]):undefined,_0x1a2e59=_0x2904ca['to']!==undefined?Number(_0x2904ca['to']):undefined,_0x2fa60b=await withSpinner(_0x5286a6(0x1cd),()=>_0x8443ef[_0x5286a6(0x1f1)][_0x5286a6(0x1f3)](_0x3f13a3,{'from':_0x2746ba,'to':_0x1a2e59}),{'verbose':_0x44b2e5[_0x5286a6(0x1df)]}),_0x2aaec2=_0x2fa60b[_0x5286a6(0x1dc)];console['error'](_0x5286a6(0x1f8)+_0x2aaec2['count']+_0x5286a6(0x205)+(_0x2aaec2['count']!==0x1?'s':'')+_0x5286a6(0x19f)+_0x2aaec2['from']+'-'+_0x2aaec2['to']+')');const _0x1578dd=_0x2aaec2[_0x5286a6(0x1f3)][_0x5286a6(0x202)](_0x2fe60b=>({'job_id':_0x2fe60b[_0x5286a6(0x211)],'type':_0x2fe60b[_0x5286a6(0x1aa)],'status':_0x2fe60b[_0x5286a6(0x1e1)],'scheduled_at':_0x2fe60b[_0x5286a6(0x1b0)],'created_at':_0x2fe60b[_0x5286a6(0x1a4)],'start_at':_0x2fe60b[_0x5286a6(0x1bb)],'end_at':_0x2fe60b[_0x5286a6(0x208)]}));return await handleSDKOutput(_0x1578dd,_0x44b2e5),0x0;}}
1
+ const a27_0x5ecf36=a27_0x1d34;(function(_0x18c54a,_0x3369d4){const _0x21bf66=a27_0x1d34,_0x3e0619=_0x18c54a();while(!![]){try{const _0x32e556=parseInt(_0x21bf66(0xb3))/0x1*(-parseInt(_0x21bf66(0xf8))/0x2)+-parseInt(_0x21bf66(0xb4))/0x3*(-parseInt(_0x21bf66(0xba))/0x4)+-parseInt(_0x21bf66(0xc4))/0x5*(parseInt(_0x21bf66(0xa9))/0x6)+-parseInt(_0x21bf66(0xf0))/0x7+-parseInt(_0x21bf66(0xfd))/0x8*(-parseInt(_0x21bf66(0xf2))/0x9)+parseInt(_0x21bf66(0xf9))/0xa+-parseInt(_0x21bf66(0xc3))/0xb*(-parseInt(_0x21bf66(0x9f))/0xc);if(_0x32e556===_0x3369d4)break;else _0x3e0619['push'](_0x3e0619['shift']());}catch(_0x301f58){_0x3e0619['push'](_0x3e0619['shift']());}}}(a27_0x55bb,0x3ec94));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a27_0x55bb(){const _0x57eba3=['utf-8','update','\x20scheduled\x20quer','statusIcon','output','args','\x20(use\x20--limit\x20to\x20see\x20more)','\x20\x20Job\x20ID:\x20','getTime','Schedule\x20created:\x20','Running\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','json','schedule:create','...','result','limit','delete','List\x20scheduled\x20queries','repeat','in\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','lastRun','\x20created','run','user_name','round','12cbCSiI','from','just\x20now','dim','nextRun','max','green','verbose','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','174PZXBQZ','Schedule\x20deleted:\x20','file','\x22...','soon','cron','execute','name','queryUrl','padEnd','5023VCVBtR','1788dtjycW','engine_version','priority','cyan','schedule:run','time_zone','292RZeSHt','engineVersion','\x20(showing\x20','\x20\x20Cron:\x20','red','Schedule\x20updated:\x20','success','num','retry_limit','5250234SujxEZ','68070BUyCVs','No\x20scheduled\x20queries\x20found','delay','type','history','database','status','schedule:history','created_at','timezone','Run\x20a\x20scheduled\x20query\x20immediately','pagination','abs','join','\x20schedules','\x20matching\x20\x22','retryLimit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','keys','Failed\x20to\x20read\x20file:\x20','Running\x20schedule:\x20','jsonl','schedules','start_at','Updating\x20schedule:\x20','\x20job','error','site','yes','Getting\x20schedule\x20details...','last_job','\x20\x20Database:\x20','description','time','Show\x20schedule\x20execution\x20history','format','INVALID_ARGUMENT','job_id','data','schedule:list','Getting\x20schedule\x20history...','Creating\x20schedule...','toLocaleDateString','\x20\x20Time:\x20','1283037zgRcGQ','log','166860QBROuK','next_run_at','Delete\x20a\x20scheduled\x20query','(unnamed)','Found\x20','length','94jJnzsw','4022280ojNjAC','list','has_next_page','scheduled_at','64SKgFiU','show','m\x20ago','query','end_at','count','Showing\x20first\x20','queries','Update\x20a\x20scheduled\x20query','map','validate','create','Creating\x20schedule:\x20','Create\x20a\x20scheduled\x20query','Deleting\x20schedule...','listQueries','trim','d\x20ago','\x20\x20Num:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','📅\x20','substring','Show\x20schedule\x20details'];a27_0x55bb=function(){return _0x57eba3;};return a27_0x55bb();}import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a27_0x3c6fc7 from'chalk';function formatRelativeTime(_0x412895){const _0x3db9cb=a27_0x1d34,_0x322f40=new Date(_0x412895),_0x49fc62=new Date(),_0x2c41dc=_0x322f40['getTime']()-_0x49fc62[_0x3db9cb(0x8c)](),_0x4a3397=Math[_0x3db9cb(0xd0)](_0x2c41dc)/0x3e8,_0xa9896f=_0x2c41dc<0x0;if(_0x4a3397<0x3c)return _0xa9896f?_0x3db9cb(0xa1):_0x3db9cb(0xad);else{if(_0x4a3397<0xe10){const _0x10abda=Math[_0x3db9cb(0x9e)](_0x4a3397/0x3c);return _0xa9896f?_0x10abda+_0x3db9cb(0xff):_0x3db9cb(0x98)+_0x10abda+'m';}else{if(_0x4a3397<0x15180){const _0x5fbfa=Math[_0x3db9cb(0x9e)](_0x4a3397/0xe10);return _0xa9896f?_0x5fbfa+'h\x20ago':_0x3db9cb(0x98)+_0x5fbfa+'h';}else{if(_0x4a3397<0x93a80){const _0x3f453f=Math[_0x3db9cb(0x9e)](_0x4a3397/0x15180);return _0xa9896f?_0x3f453f+_0x3db9cb(0x7e):'in\x20'+_0x3f453f+'d';}else return _0x322f40[_0x3db9cb(0xee)]();}}}}export class ScheduleListCommand extends BaseCommand{[a27_0x5ecf36(0xb0)]=a27_0x5ecf36(0xeb);[a27_0x5ecf36(0xe4)]=a27_0x5ecf36(0x96);async[a27_0x5ecf36(0xaf)](_0x1b78a8){const _0x2d68db=a27_0x5ecf36,{options:_0x1371e0,args:_0x5a8d6a,tdx:_0x313cf2}=_0x1b78a8,_0x447973=resolveLimit(_0x1371e0[_0x2d68db(0x94)],DEFAULT_DISPLAY_LIMIT),_0x7cf815=_0x5a8d6a[0x0],_0x4e2c36=_0x7cf815?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x7cf815+_0x2d68db(0xac):'Listing\x20scheduled\x20queries...',_0x98591d=await withSpinner(_0x4e2c36,()=>_0x313cf2['schedules'][_0x2d68db(0x7c)]({'limit':_0x447973,'scheduled':!![],'pattern':_0x7cf815}),{'verbose':_0x1371e0[_0x2d68db(0xa6)]}),_0x155f26=_0x98591d[_0x2d68db(0xea)][_0x2d68db(0x74)],_0x20d518=_0x98591d[_0x2d68db(0xea)][_0x2d68db(0xcf)][_0x2d68db(0xfb)],_0x5a280e=_0x7cf815?_0x2d68db(0xd3)+_0x7cf815+'\x22':'';_0x20d518?console['error'](_0x2d68db(0x73)+_0x155f26[_0x2d68db(0xf7)]+_0x2d68db(0xd2)+_0x5a280e+_0x2d68db(0x8a)):console[_0x2d68db(0xde)](_0x2d68db(0xf6)+_0x155f26['length']+_0x2d68db(0x86)+(_0x155f26[_0x2d68db(0xf7)]!==0x1?'ies':'y')+_0x5a280e);if(_0x1371e0[_0x2d68db(0xe7)]===_0x2d68db(0x90)||_0x1371e0[_0x2d68db(0xe7)]===_0x2d68db(0xd9)||_0x1371e0[_0x2d68db(0xe7)]==='table'||_0x1371e0[_0x2d68db(0xe7)]==='tsv'){const _0x339436=_0x155f26[_0x2d68db(0x76)](_0x3e4ed7=>({'id':_0x3e4ed7['id'],'name':_0x3e4ed7['name'],'cron':_0x3e4ed7['cron'],'database':_0x3e4ed7['database']?.[_0x2d68db(0xb0)],'type':_0x3e4ed7[_0x2d68db(0xc7)],'timezone':_0x3e4ed7[_0x2d68db(0xb9)],'user_name':_0x3e4ed7['user']?.[_0x2d68db(0xb0)],'updated_at':_0x3e4ed7['updated_at'],'next_run_at':_0x3e4ed7[_0x2d68db(0xf3)],'last_job_status':_0x3e4ed7['last_job']?.[_0x2d68db(0xca)]}));await handleSDKOutput(_0x339436,_0x1371e0);}else{if(_0x155f26['length']===0x0)console[_0x2d68db(0xf1)](_0x2d68db(0xc5));else{const _0x1488a5=_0x1371e0[_0x2d68db(0xdf)],_0x4a2c3a=_0x155f26['map'](_0x401864=>{const _0x1a3222=_0x2d68db,_0x35dd66=_0x401864[_0x1a3222(0xe2)]?.[_0x1a3222(0xca)]?_0x401864[_0x1a3222(0xe2)][_0x1a3222(0xca)]===_0x1a3222(0xc0)?'✓':'✗':'-',_0x544e64=_0x401864['last_job']?.['ended_at']?formatRelativeTime(_0x401864['last_job']['ended_at']):'never',_0x269d74=_0x401864[_0x1a3222(0xf3)]?formatRelativeTime(_0x401864[_0x1a3222(0xf3)]):'-',_0x3a2646=_0x401864[_0x1a3222(0xae)]||'',_0x37054a=_0x401864[_0x1a3222(0xb0)]||_0x1a3222(0xf5),_0x5a0906=getConsoleUrl(_0x1488a5,'/app/queries/editor?queryId='+_0x401864['id']);return{'statusIcon':_0x35dd66,'lastRun':_0x544e64,'nextRun':_0x269d74,'cron':_0x3a2646,'name':_0x37054a,'queryUrl':_0x5a0906,'status':_0x401864[_0x1a3222(0xe2)]?.[_0x1a3222(0xca)]};}),_0x3e618b=Math[_0x2d68db(0xa4)](..._0x4a2c3a[_0x2d68db(0x76)](_0x569c44=>_0x569c44[_0x2d68db(0x9a)]['length'])),_0x38b97d=Math[_0x2d68db(0xa4)](..._0x4a2c3a[_0x2d68db(0x76)](_0x233a7f=>_0x233a7f['nextRun'][_0x2d68db(0xf7)])),_0x4069de=Math[_0x2d68db(0xa4)](..._0x4a2c3a[_0x2d68db(0x76)](_0x16a13d=>_0x16a13d['cron'][_0x2d68db(0xf7)])),_0x13fea0=_0x4a2c3a[_0x2d68db(0x76)](_0x2f5a58=>{const _0x36eaf2=_0x2d68db,_0x3f479b=_0x2f5a58[_0x36eaf2(0xca)]===_0x36eaf2(0xc0)?a27_0x3c6fc7[_0x36eaf2(0xa5)](_0x2f5a58[_0x36eaf2(0x87)]):_0x2f5a58['status']==='error'?a27_0x3c6fc7[_0x36eaf2(0xbe)](_0x2f5a58[_0x36eaf2(0x87)]):a27_0x3c6fc7[_0x36eaf2(0xa2)](_0x2f5a58['statusIcon']),_0x166d1d=_0x2f5a58[_0x36eaf2(0x9a)][_0x36eaf2(0xb2)](_0x3e618b),_0x51d48a=_0x2f5a58[_0x36eaf2(0xa3)]['padEnd'](_0x38b97d),_0x3c03c5=_0x2f5a58['cron']?a27_0x3c6fc7[_0x36eaf2(0xb7)](_0x2f5a58[_0x36eaf2(0xae)][_0x36eaf2(0xb2)](_0x4069de)):'\x20'[_0x36eaf2(0x97)](_0x4069de),_0x37bb06=hyperlink(_0x2f5a58[_0x36eaf2(0xb0)],_0x2f5a58[_0x36eaf2(0xb1)]);return _0x36eaf2(0x81)+_0x3f479b+'\x20'+_0x166d1d+'\x20\x20→\x20'+_0x51d48a+'\x20\x20'+_0x3c03c5+'\x20\x20'+_0x37bb06;});await writeOutput(_0x13fea0[_0x2d68db(0xd1)]('\x0a'),_0x1371e0[_0x2d68db(0x88)],_0x2d68db(0xfa));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a27_0x5ecf36(0xb0)]='schedule:show';['description']=a27_0x5ecf36(0x83);[a27_0x5ecf36(0x77)](_0x588d7e){const _0x2394ed=_0x588d7e['args'][0x0];if(!_0x2394ed)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a27_0x5ecf36(0xaf)](_0x3de4ff){const _0x51d634=a27_0x5ecf36,{options:_0x251cf8,args:_0x43261b,tdx:_0xefe709}=_0x3de4ff,_0x2bbd67=_0x43261b[0x0],_0x2e44fd=await withSpinner(_0x51d634(0xe1),()=>_0xefe709[_0x51d634(0xda)][_0x51d634(0xfe)](_0x2bbd67),{'verbose':_0x251cf8[_0x51d634(0xa6)]}),_0x369a79=_0x2e44fd[_0x51d634(0xea)],_0x2a3223={'name':_0x369a79['name'],'cron':_0x369a79[_0x51d634(0xae)],'database':_0x369a79['database'],'type':_0x369a79[_0x51d634(0xc7)],'timezone':_0x369a79[_0x51d634(0xcd)],'user_name':_0x369a79[_0x51d634(0x9d)],'created_at':_0x369a79[_0x51d634(0xcc)],'engine_version':_0x369a79[_0x51d634(0xb5)],'executing_user_id':_0x369a79['executing_user_id'],'query':_0x369a79[_0x51d634(0x100)],'delay':_0x369a79[_0x51d634(0xc6)],'priority':_0x369a79[_0x51d634(0xb6)],'retry_limit':_0x369a79['retry_limit'],..._0x369a79[_0x51d634(0x93)]&&{'result':_0x369a79[_0x51d634(0x93)]}};return await handleSingleObjectOutput(_0x2a3223,_0x251cf8),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a27_0x5ecf36(0x91);[a27_0x5ecf36(0xe4)]=a27_0x5ecf36(0x7a);['validate'](_0x4dda28){const _0x3856bd=a27_0x5ecf36,_0xb70f50=_0x4dda28['args'][0x0];if(!_0xb70f50)return _0x3856bd(0x80);return undefined;}async['execute'](_0x141534){const _0x5704c0=a27_0x5ecf36,{options:_0x23bca1,args:_0x448a7a,tdx:_0xc6f1a8}=_0x141534,_0x335b94=_0x448a7a[0x0],_0x135f31=_0x23bca1,_0x14e7b2=_0x135f31[_0x5704c0(0xc9)],_0x399889=_0x135f31[_0x5704c0(0xab)],_0x31033e=_0x135f31[_0x5704c0(0xc7)]||'trino';let _0x3e4ce5;try{_0x3e4ce5=readFileSync(_0x399889,_0x5704c0(0x84))[_0x5704c0(0x7d)]();}catch(_0x29f3){throw new SDKError(ErrorCode[_0x5704c0(0xe8)],_0x5704c0(0xd7)+_0x399889,_0x29f3 instanceof Error?_0x29f3:undefined);}if(!_0x3e4ce5)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x45899a={'database':_0x14e7b2,'query':_0x3e4ce5,'type':_0x31033e};if(_0x135f31[_0x5704c0(0xae)])_0x45899a['cron']=_0x135f31[_0x5704c0(0xae)];if(_0x135f31[_0x5704c0(0xcd)])_0x45899a[_0x5704c0(0xcd)]=_0x135f31['timezone'];if(_0x135f31[_0x5704c0(0xc6)]!==undefined)_0x45899a['delay']=Number(_0x135f31[_0x5704c0(0xc6)]);if(_0x135f31['priority']!==undefined)_0x45899a[_0x5704c0(0xb6)]=Number(_0x135f31[_0x5704c0(0xb6)]);if(_0x135f31[_0x5704c0(0xd4)]!==undefined)_0x45899a[_0x5704c0(0xc2)]=Number(_0x135f31[_0x5704c0(0xd4)]);if(_0x135f31[_0x5704c0(0xbb)])_0x45899a[_0x5704c0(0xb5)]=_0x135f31[_0x5704c0(0xbb)];if(_0x135f31[_0x5704c0(0x93)])_0x45899a[_0x5704c0(0x93)]=_0x135f31[_0x5704c0(0x93)];if(_0x23bca1[_0x5704c0(0xa6)]){console[_0x5704c0(0xde)](_0x5704c0(0x79)+_0x335b94),console[_0x5704c0(0xde)](_0x5704c0(0xe3)+_0x14e7b2),console[_0x5704c0(0xde)]('\x20\x20Type:\x20'+_0x31033e);if(_0x45899a[_0x5704c0(0xae)])console[_0x5704c0(0xde)](_0x5704c0(0xbd)+_0x45899a['cron']);if(_0x45899a['timezone'])console[_0x5704c0(0xde)]('\x20\x20Timezone:\x20'+_0x45899a[_0x5704c0(0xcd)]);}const _0x32d28d=await withSpinner(_0x5704c0(0xed),()=>_0xc6f1a8[_0x5704c0(0xda)][_0x5704c0(0x78)](_0x335b94,_0x45899a),{'verbose':_0x23bca1[_0x5704c0(0xa6)]});return console[_0x5704c0(0xde)](_0x5704c0(0x8d)+_0x32d28d[_0x5704c0(0xea)]['name']),await handleSingleObjectOutput(_0x32d28d[_0x5704c0(0xea)],_0x23bca1),0x0;}}function a27_0x1d34(_0x5315cd,_0xebadf7){_0x5315cd=_0x5315cd-0x71;const _0x55bbb1=a27_0x55bb();let _0x1d3470=_0x55bbb1[_0x5315cd];return _0x1d3470;}export class ScheduleUpdateCommand extends BaseCommand{[a27_0x5ecf36(0xb0)]='schedule:update';['description']=a27_0x5ecf36(0x75);[a27_0x5ecf36(0x77)](_0x2d3da3){const _0xd58f09=a27_0x5ecf36,_0x162c3e=_0x2d3da3[_0xd58f09(0x89)][0x0];if(!_0x162c3e)return _0xd58f09(0xa8);return undefined;}async[a27_0x5ecf36(0xaf)](_0x545594){const _0x3c510f=a27_0x5ecf36,{options:_0x4027ba,args:_0x2bb41f,tdx:_0x4af9c7}=_0x545594,_0xbb9d8e=_0x2bb41f[0x0],_0x22516d=_0x4027ba,_0x356c79={};if(_0x22516d[_0x3c510f(0xc9)])_0x356c79[_0x3c510f(0xc9)]=_0x22516d[_0x3c510f(0xc9)];if(_0x22516d['type'])_0x356c79['type']=_0x22516d['type'];if(_0x22516d[_0x3c510f(0xae)])_0x356c79[_0x3c510f(0xae)]=_0x22516d[_0x3c510f(0xae)];if(_0x22516d[_0x3c510f(0xcd)])_0x356c79['timezone']=_0x22516d[_0x3c510f(0xcd)];if(_0x22516d[_0x3c510f(0xc6)]!==undefined)_0x356c79['delay']=Number(_0x22516d[_0x3c510f(0xc6)]);if(_0x22516d['priority']!==undefined)_0x356c79[_0x3c510f(0xb6)]=Number(_0x22516d[_0x3c510f(0xb6)]);if(_0x22516d[_0x3c510f(0xd4)]!==undefined)_0x356c79[_0x3c510f(0xc2)]=Number(_0x22516d[_0x3c510f(0xd4)]);if(_0x22516d[_0x3c510f(0xbb)])_0x356c79[_0x3c510f(0xb5)]=_0x22516d[_0x3c510f(0xbb)];if(_0x22516d[_0x3c510f(0x93)])_0x356c79[_0x3c510f(0x93)]=_0x22516d['result'];if(_0x22516d['file'])try{_0x356c79[_0x3c510f(0x100)]=readFileSync(_0x22516d['file'],_0x3c510f(0x84))['trim']();}catch(_0x230ad1){throw new SDKError(ErrorCode[_0x3c510f(0xe8)],'Failed\x20to\x20read\x20file:\x20'+_0x22516d['file'],_0x230ad1 instanceof Error?_0x230ad1:undefined);}if(Object[_0x3c510f(0xd6)](_0x356c79)['length']===0x0)throw new SDKError(ErrorCode[_0x3c510f(0xe8)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x4027ba['verbose']){console[_0x3c510f(0xde)](_0x3c510f(0xdc)+_0xbb9d8e);for(const [_0x3d4abb,_0x305b0e]of Object['entries'](_0x356c79)){_0x3d4abb===_0x3c510f(0x100)?console[_0x3c510f(0xde)]('\x20\x20'+_0x3d4abb+':\x20'+_0x305b0e[_0x3c510f(0x82)](0x0,0x32)+_0x3c510f(0x92)):console[_0x3c510f(0xde)]('\x20\x20'+_0x3d4abb+':\x20'+_0x305b0e);}}const _0x2ca5e5=await withSpinner('Updating\x20schedule...',()=>_0x4af9c7[_0x3c510f(0xda)][_0x3c510f(0x85)](_0xbb9d8e,_0x356c79),{'verbose':_0x4027ba[_0x3c510f(0xa6)]});return console[_0x3c510f(0xde)](_0x3c510f(0xbf)+_0x2ca5e5[_0x3c510f(0xea)]['name']),await handleSingleObjectOutput(_0x2ca5e5[_0x3c510f(0xea)],_0x4027ba),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a27_0x5ecf36(0xb0)]='schedule:delete';[a27_0x5ecf36(0xe4)]=a27_0x5ecf36(0xf4);['validate'](_0x20f205){const _0x5abf1a=a27_0x5ecf36,_0xfa432b=_0x20f205[_0x5abf1a(0x89)][0x0];if(!_0xfa432b)return _0x5abf1a(0x8f);return undefined;}async[a27_0x5ecf36(0xaf)](_0x193896){const _0x26f6e6=a27_0x5ecf36,{options:_0x4a9526,args:_0x33dab9,tdx:_0x610d04}=_0x193896,_0x15c72a=_0x33dab9[0x0];if(!_0x4a9526[_0x26f6e6(0xe0)]){const _0x4dba45=await confirm(_0x26f6e6(0x99)+_0x15c72a+'\x22?');if(!_0x4dba45)return console['error']('Cancelled'),0x0;}const _0x5ddaa0=await withSpinner(_0x26f6e6(0x7b),()=>_0x610d04['schedules'][_0x26f6e6(0x95)](_0x15c72a),{'verbose':_0x4a9526['verbose']});return console[_0x26f6e6(0xde)](_0x26f6e6(0xaa)+_0x5ddaa0['data'][_0x26f6e6(0xb0)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a27_0x5ecf36(0xb0)]=a27_0x5ecf36(0xb8);['description']=a27_0x5ecf36(0xce);['validate'](_0xa7d3c0){const _0x2ac588=a27_0x5ecf36,_0x3c26bd=_0xa7d3c0[_0x2ac588(0x89)][0x0];if(!_0x3c26bd)return _0x2ac588(0xd5);return undefined;}async[a27_0x5ecf36(0xaf)](_0x1431d2){const _0x15c952=a27_0x5ecf36,{options:_0x3767c4,args:_0xee1663,tdx:_0xb12a}=_0x1431d2,_0x4d78bc=_0xee1663[0x0],_0xcfd401=_0x3767c4,_0x35241d=_0xcfd401[_0x15c952(0xe5)],_0x5771a6=_0xcfd401[_0x15c952(0xc1)]!==undefined?Number(_0xcfd401[_0x15c952(0xc1)]):undefined;if(_0x3767c4[_0x15c952(0xa6)]){console[_0x15c952(0xde)](_0x15c952(0xd8)+_0x4d78bc);if(_0x35241d)console[_0x15c952(0xde)](_0x15c952(0xef)+_0x35241d);if(_0x5771a6)console['error'](_0x15c952(0x7f)+_0x5771a6);}const _0x1ee961=await withSpinner(_0x15c952(0x8e),()=>_0xb12a[_0x15c952(0xda)][_0x15c952(0x9c)](_0x4d78bc,{'time':_0x35241d,'num':_0x5771a6}),{'verbose':_0x3767c4[_0x15c952(0xa6)]}),_0x32260f=_0x1ee961['data']['jobs'];console[_0x15c952(0xde)]('Schedule\x20run\x20submitted:\x20'+_0x32260f[_0x15c952(0xf7)]+_0x15c952(0xdd)+(_0x32260f['length']!==0x1?'s':'')+_0x15c952(0x9b));for(const _0x24741f of _0x32260f){console['error'](_0x15c952(0x8b)+_0x24741f[_0x15c952(0xe9)]);}return await handleSDKOutput(_0x32260f,_0x3767c4),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a27_0x5ecf36(0xcb);[a27_0x5ecf36(0xe4)]=a27_0x5ecf36(0xe6);['validate'](_0x44c2c7){const _0xb248b4=a27_0x5ecf36,_0x31e29d=_0x44c2c7[_0xb248b4(0x89)][0x0];if(!_0x31e29d)return _0xb248b4(0xa7);return undefined;}async['execute'](_0x38f335){const _0x16a850=a27_0x5ecf36,{options:_0x583535,args:_0x29684,tdx:_0x3a20dd}=_0x38f335,_0x1a617f=_0x29684[0x0],_0x514e54=_0x583535,_0x1a48f1=_0x514e54[_0x16a850(0xa0)]!==undefined?Number(_0x514e54[_0x16a850(0xa0)]):undefined,_0x4b0da7=_0x514e54['to']!==undefined?Number(_0x514e54['to']):undefined,_0x1c9150=await withSpinner(_0x16a850(0xec),()=>_0x3a20dd[_0x16a850(0xda)][_0x16a850(0xc8)](_0x1a617f,{'from':_0x1a48f1,'to':_0x4b0da7}),{'verbose':_0x583535[_0x16a850(0xa6)]}),_0xc20834=_0x1c9150['data'];console[_0x16a850(0xde)](_0x16a850(0xf6)+_0xc20834[_0x16a850(0x72)]+'\x20execution'+(_0xc20834['count']!==0x1?'s':'')+_0x16a850(0xbc)+_0xc20834[_0x16a850(0xa0)]+'-'+_0xc20834['to']+')');const _0x21d426=_0xc20834[_0x16a850(0xc8)][_0x16a850(0x76)](_0x53cacf=>({'job_id':_0x53cacf['job_id'],'type':_0x53cacf[_0x16a850(0xc7)],'status':_0x53cacf[_0x16a850(0xca)],'scheduled_at':_0x53cacf[_0x16a850(0xfc)],'created_at':_0x53cacf['created_at'],'start_at':_0x53cacf[_0x16a850(0xdb)],'end_at':_0x53cacf[_0x16a850(0x71)]}));return await handleSDKOutput(_0x21d426,_0x583535),0x0;}}