@treasuredata/tdx 0.29.3 → 0.29.5

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 (248) 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 +1 -0
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +1 -1
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands/activations.js +1 -1
  9. package/dist/commands/agent-command.js +1 -1
  10. package/dist/commands/agent-test-command.js +1 -1
  11. package/dist/commands/api-command.js +1 -1
  12. package/dist/commands/auth-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  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/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-command.js.map +1 -1
  29. package/dist/commands/engage-template-pull-command.d.ts +15 -0
  30. package/dist/commands/engage-template-pull-command.d.ts.map +1 -0
  31. package/dist/commands/engage-template-pull-command.js +1 -0
  32. package/dist/commands/engage-template-pull-command.js.map +1 -0
  33. package/dist/commands/engage-template-push-command.d.ts +16 -0
  34. package/dist/commands/engage-template-push-command.d.ts.map +1 -0
  35. package/dist/commands/engage-template-push-command.js +1 -0
  36. package/dist/commands/engage-template-push-command.js.map +1 -0
  37. package/dist/commands/engage-template-validate-command.d.ts +19 -0
  38. package/dist/commands/engage-template-validate-command.d.ts.map +1 -0
  39. package/dist/commands/engage-template-validate-command.js +1 -0
  40. package/dist/commands/engage-template-validate-command.js.map +1 -0
  41. package/dist/commands/job-command.js +1 -1
  42. package/dist/commands/journey-command.js +1 -1
  43. package/dist/commands/journey-validate-command.js +1 -1
  44. package/dist/commands/llm-command.js +1 -1
  45. package/dist/commands/mcp-command.js +1 -1
  46. package/dist/commands/parent-segment-command.js +1 -1
  47. package/dist/commands/profile-command.js +1 -1
  48. package/dist/commands/profiles-command.js +1 -1
  49. package/dist/commands/query-command.d.ts.map +1 -1
  50. package/dist/commands/query-command.js +1 -1
  51. package/dist/commands/query-command.js.map +1 -1
  52. package/dist/commands/schedule-command.js +1 -1
  53. package/dist/commands/segment-command.js +1 -1
  54. package/dist/commands/segment-create-command.js +1 -1
  55. package/dist/commands/segment-fields-command.js +1 -1
  56. package/dist/commands/segment-pull-command.js +1 -1
  57. package/dist/commands/segment-push-command.js +1 -1
  58. package/dist/commands/segment-update-command.js +1 -1
  59. package/dist/commands/segment-use-command.js +1 -1
  60. package/dist/commands/segment-validate-command.js +1 -1
  61. package/dist/commands/segments.js +1 -1
  62. package/dist/commands/show.js +1 -1
  63. package/dist/commands/status-command.js +1 -1
  64. package/dist/commands/tables.js +1 -1
  65. package/dist/commands/unset-command.js +1 -1
  66. package/dist/commands/upgrade-command.js +1 -1
  67. package/dist/commands/use-command.js +1 -1
  68. package/dist/commands/user-command.js +1 -1
  69. package/dist/commands/workflow-command.js +1 -1
  70. package/dist/core/auth.js +1 -1
  71. package/dist/core/command-output.d.ts +6 -0
  72. package/dist/core/command-output.d.ts.map +1 -1
  73. package/dist/core/command-output.js +1 -1
  74. package/dist/core/command-output.js.map +1 -1
  75. package/dist/core/config.js +1 -1
  76. package/dist/core/connection-cache.js +1 -1
  77. package/dist/core/constants.js +1 -1
  78. package/dist/core/credential-cache.js +1 -1
  79. package/dist/core/global-context.js +1 -1
  80. package/dist/core/keychain.js +1 -1
  81. package/dist/core/profile.js +1 -1
  82. package/dist/core/project-config.js +1 -1
  83. package/dist/core/session.js +1 -1
  84. package/dist/core/user-cache.js +1 -1
  85. package/dist/core/version.js +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/mcp/server.js +1 -1
  88. package/dist/mcp/tools/index.js +1 -1
  89. package/dist/mcp/tools/tdx-run.js +1 -1
  90. package/dist/mcp/tools/tdx-search.js +1 -1
  91. package/dist/mcp/utils.js +1 -1
  92. package/dist/proxy/claude-usage-tracker.js +1 -1
  93. package/dist/proxy/passthrough-server.js +1 -1
  94. package/dist/proxy/sse-usage-parser.js +1 -1
  95. package/dist/sdk/agent/agent-config.js +1 -1
  96. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  97. package/dist/sdk/agent/agent-yaml.js +1 -1
  98. package/dist/sdk/agent/test/evaluator.js +1 -1
  99. package/dist/sdk/agent/test/executor.js +1 -1
  100. package/dist/sdk/agent/test/index.js +1 -1
  101. package/dist/sdk/agent/test/output.js +1 -1
  102. package/dist/sdk/agent/test/parser.js +1 -1
  103. package/dist/sdk/agent/tool-target-registry.js +1 -1
  104. package/dist/sdk/api.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.d.ts +9 -0
  108. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  109. package/dist/sdk/client/endpoints.js +1 -1
  110. package/dist/sdk/client/endpoints.js.map +1 -1
  111. package/dist/sdk/client/engage-api-client.js +1 -1
  112. package/dist/sdk/client/http-client.js +1 -1
  113. package/dist/sdk/client/llm-api-client.js +1 -1
  114. package/dist/sdk/client/rate-limiter.js +1 -1
  115. package/dist/sdk/client/td-api-client.js +1 -1
  116. package/dist/sdk/client/trino-api-client.js +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/connection-validator.js +1 -1
  119. package/dist/sdk/connection.js +1 -1
  120. package/dist/sdk/delivery.js +1 -1
  121. package/dist/sdk/engage/campaign-pull.js +1 -1
  122. package/dist/sdk/engage/campaign-push.js +1 -1
  123. package/dist/sdk/engage/campaign-validator.js +1 -1
  124. package/dist/sdk/engage/campaign-yaml.js +1 -1
  125. package/dist/sdk/engage/template-pull.d.ts +73 -0
  126. package/dist/sdk/engage/template-pull.d.ts.map +1 -0
  127. package/dist/sdk/engage/template-pull.js +1 -0
  128. package/dist/sdk/engage/template-pull.js.map +1 -0
  129. package/dist/sdk/engage/template-push.d.ts +99 -0
  130. package/dist/sdk/engage/template-push.d.ts.map +1 -0
  131. package/dist/sdk/engage/template-push.js +1 -0
  132. package/dist/sdk/engage/template-push.js.map +1 -0
  133. package/dist/sdk/engage/template-validator.d.ts +18 -0
  134. package/dist/sdk/engage/template-validator.d.ts.map +1 -0
  135. package/dist/sdk/engage/template-validator.js +1 -0
  136. package/dist/sdk/engage/template-validator.js.map +1 -0
  137. package/dist/sdk/engage/template-yaml.d.ts +69 -0
  138. package/dist/sdk/engage/template-yaml.d.ts.map +1 -0
  139. package/dist/sdk/engage/template-yaml.js +1 -0
  140. package/dist/sdk/engage/template-yaml.js.map +1 -0
  141. package/dist/sdk/engage/types/campaign-def.js +1 -1
  142. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  143. package/dist/sdk/engage/types/template-schema.d.ts +33 -0
  144. package/dist/sdk/engage/types/template-schema.d.ts.map +1 -0
  145. package/dist/sdk/engage/types/template-schema.js +1 -0
  146. package/dist/sdk/engage/types/template-schema.js.map +1 -0
  147. package/dist/sdk/engage.d.ts +1 -0
  148. package/dist/sdk/engage.d.ts.map +1 -1
  149. package/dist/sdk/engage.js +1 -1
  150. package/dist/sdk/engage.js.map +1 -1
  151. package/dist/sdk/errors.js +1 -1
  152. package/dist/sdk/index.js +1 -1
  153. package/dist/sdk/io/index.js +1 -1
  154. package/dist/sdk/io/node-filesystem.js +1 -1
  155. package/dist/sdk/job.js +1 -1
  156. package/dist/sdk/journey.js +1 -1
  157. package/dist/sdk/llm/chat-cache.js +1 -1
  158. package/dist/sdk/llm/index.js +1 -1
  159. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  160. package/dist/sdk/llm/model-factors.js +1 -1
  161. package/dist/sdk/personalization.js +1 -1
  162. package/dist/sdk/query/index.js +1 -1
  163. package/dist/sdk/query/sql-parser.js +1 -1
  164. package/dist/sdk/realtime.js +1 -1
  165. package/dist/sdk/schedule.js +1 -1
  166. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  167. package/dist/sdk/segment/fields-display.js +1 -1
  168. package/dist/sdk/segment/file-discovery.js +1 -1
  169. package/dist/sdk/segment/journey-utils.js +1 -1
  170. package/dist/sdk/segment/journey-validator.js +1 -1
  171. package/dist/sdk/segment/journey-yaml.js +1 -1
  172. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  173. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  174. package/dist/sdk/segment/pull-workflow.js +1 -1
  175. package/dist/sdk/segment/push-recovery.js +1 -1
  176. package/dist/sdk/segment/push-workflow.js +1 -1
  177. package/dist/sdk/segment/resolution-context.js +1 -1
  178. package/dist/sdk/segment/segment-path-parser.js +1 -1
  179. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  180. package/dist/sdk/segment/segment-validator.js +1 -1
  181. package/dist/sdk/segment/target-resolution.js +1 -1
  182. package/dist/sdk/segment/tdx-config.js +1 -1
  183. package/dist/sdk/segment/types/activation-schema.js +1 -1
  184. package/dist/sdk/segment/types/journey-def.js +1 -1
  185. package/dist/sdk/segment/types/journey-schema.js +1 -1
  186. package/dist/sdk/segment/types/segment-def.js +1 -1
  187. package/dist/sdk/segment/types/segment-schema.js +1 -1
  188. package/dist/sdk/segment/validate-files.d.ts +6 -1
  189. package/dist/sdk/segment/validate-files.d.ts.map +1 -1
  190. package/dist/sdk/segment/validate-files.js +1 -1
  191. package/dist/sdk/segment/validate-files.js.map +1 -1
  192. package/dist/sdk/segment/yaml-validator.d.ts +1 -1
  193. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  194. package/dist/sdk/segment/yaml-validator.js +1 -1
  195. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  196. package/dist/sdk/segment.js +1 -1
  197. package/dist/sdk/types/engage.d.ts +2 -0
  198. package/dist/sdk/types/engage.d.ts.map +1 -1
  199. package/dist/sdk/types/index.js +1 -1
  200. package/dist/sdk/types/progress.js +1 -1
  201. package/dist/sdk/user.js +1 -1
  202. package/dist/sdk/util/format-detector.js +1 -1
  203. package/dist/sdk/util/formatters.js +1 -1
  204. package/dist/sdk/util/index.js +1 -1
  205. package/dist/sdk/util/tree-formatter.js +1 -1
  206. package/dist/sdk/workflow/archive-validation.js +1 -1
  207. package/dist/sdk/workflow/clone-workflow.js +1 -1
  208. package/dist/sdk/workflow/index.js +1 -1
  209. package/dist/sdk/workflow/pull-workflow.js +1 -1
  210. package/dist/sdk/workflow/push-workflow.js +1 -1
  211. package/dist/sdk/workflow/tdx-config.js +1 -1
  212. package/dist/sdk/workflow/workflow-utils.js +1 -1
  213. package/dist/test-utils/command-runner.js +1 -1
  214. package/dist/test-utils/factories.js +1 -1
  215. package/dist/test-utils/fixtures.js +1 -1
  216. package/dist/test-utils/http-mock.js +1 -1
  217. package/dist/test-utils/index.js +1 -1
  218. package/dist/utils/async.js +1 -1
  219. package/dist/utils/colors.js +1 -1
  220. package/dist/utils/diff.js +1 -1
  221. package/dist/utils/file-permissions.js +1 -1
  222. package/dist/utils/file-reader.js +1 -1
  223. package/dist/utils/github-releases.d.ts +17 -0
  224. package/dist/utils/github-releases.d.ts.map +1 -0
  225. package/dist/utils/github-releases.js +1 -0
  226. package/dist/utils/github-releases.js.map +1 -0
  227. package/dist/utils/global-cache.js +1 -1
  228. package/dist/utils/json-loader.js +1 -1
  229. package/dist/utils/local-cache.js +1 -1
  230. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  231. package/dist/utils/logger/formatters/index.js +1 -1
  232. package/dist/utils/logger/handlers/console-handler.js +1 -1
  233. package/dist/utils/logger/handlers/file-handler.js +1 -1
  234. package/dist/utils/logger/handlers/index.js +1 -1
  235. package/dist/utils/logger/handlers/null-handler.js +1 -1
  236. package/dist/utils/logger/index.js +1 -1
  237. package/dist/utils/logger/logger.js +1 -1
  238. package/dist/utils/logger/types.js +1 -1
  239. package/dist/utils/option-validation.js +1 -1
  240. package/dist/utils/process.js +1 -1
  241. package/dist/utils/prompt.js +1 -1
  242. package/dist/utils/spinner.js +1 -1
  243. package/dist/utils/sse-parser.js +1 -1
  244. package/dist/utils/string-utils.js +1 -1
  245. package/dist/utils/table-ref-parser.js +1 -1
  246. package/dist/utils/tdx-logger.js +1 -1
  247. package/dist/utils/version-check.js +1 -1
  248. package/package.json +1 -1
@@ -1 +1 @@
1
- const a26_0x159e1d=a26_0x153d;(function(_0x5ea5da,_0x36953f){const _0x28200c=a26_0x153d,_0x2f9498=_0x5ea5da();while(!![]){try{const _0x6be620=-parseInt(_0x28200c(0x1c7))/0x1*(-parseInt(_0x28200c(0x1ac))/0x2)+parseInt(_0x28200c(0x21b))/0x3+parseInt(_0x28200c(0x104))/0x4+-parseInt(_0x28200c(0xfe))/0x5+parseInt(_0x28200c(0x23a))/0x6+parseInt(_0x28200c(0x210))/0x7*(parseInt(_0x28200c(0x224))/0x8)+-parseInt(_0x28200c(0x188))/0x9*(parseInt(_0x28200c(0x218))/0xa);if(_0x6be620===_0x36953f)break;else _0x2f9498['push'](_0x2f9498['shift']());}catch(_0x726c78){_0x2f9498['push'](_0x2f9498['shift']());}}}(a26_0x3c19,0x54492));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x4b5b8b 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,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a26_0x3cea6c 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=a26_0x159e1d(0x17c),LEGACY_PARENT_SEGMENT_DIR=a26_0x159e1d(0x1bc);function openBrowser(_0x2fbecb){const _0x3c7895=a26_0x159e1d,_0x2b08ce=process['platform'],_0x59b60d=_0x2b08ce===_0x3c7895(0x101)?'open':_0x2b08ce===_0x3c7895(0x164)?_0x3c7895(0x107):_0x3c7895(0x1df);spawn(_0x59b60d,[_0x2fbecb],{'detached':!![],'stdio':_0x3c7895(0x1ee)})[_0x3c7895(0x121)]();}function migrateLegacyDirectory(){const _0x19fa07=a26_0x159e1d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58a88d=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58a88d[_0x19fa07(0x112)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x19fa07(0x14c)](a26_0x3cea6c['yellow'](_0x19fa07(0x27a)+LEGACY_PARENT_SEGMENT_DIR+_0x19fa07(0x1b8)+PARENT_SEGMENT_DIR+_0x19fa07(0xfd))),console[_0x19fa07(0x14c)](a26_0x3cea6c[_0x19fa07(0x117)](_0x19fa07(0x20c)+LEGACY_PARENT_SEGMENT_DIR+_0x19fa07(0x106))),![];console[_0x19fa07(0x14c)](a26_0x3cea6c[_0x19fa07(0x1ea)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x19fa07(0x14c)](a26_0x3cea6c[_0x19fa07(0x274)](_0x19fa07(0x134)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x389f22){const _0x1351a0=_0x389f22 instanceof Error?_0x389f22[_0x19fa07(0x26f)]:String(_0x389f22);return console[_0x19fa07(0x14c)](a26_0x3cea6c[_0x19fa07(0x247)](_0x19fa07(0x18f)+_0x1351a0+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x159e1d(0x152)](_0x1c55cc){const _0x31b5cd=a26_0x159e1d;return migrateLegacyDirectory(),super[_0x31b5cd(0x152)](_0x1c55cc);}}function resolveYamlFile(_0x1c994d){const _0x52d1f7=a26_0x159e1d;if(_0x1c994d[_0x52d1f7(0x1d2)]('.yml')||_0x1c994d[_0x52d1f7(0x1d2)](_0x52d1f7(0x228)))return _0x1c994d;return a26_0x4b5b8b[_0x52d1f7(0x1f4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1c994d)+_0x52d1f7(0x115));}function formatProgressMessage(_0x2d0784){const _0x349b98=a26_0x159e1d,_0x1c24aa=_0x2d0784[_0x349b98(0x1e1)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1c24aa){const [,_0x19b6a3,_0x150c4b,_0x245463='']=_0x1c24aa;return a26_0x3cea6c[_0x349b98(0x117)](_0x19b6a3+':')+'\x20'+_0x150c4b+a26_0x3cea6c[_0x349b98(0x117)](_0x245463);}return a26_0x3cea6c[_0x349b98(0x117)](_0x2d0784);}function showFileNotFoundError(_0xf04252,_0x2621bf){const _0x56cc6f=a26_0x159e1d;console['error'](a26_0x3cea6c[_0x56cc6f(0x247)]('Error:\x20File\x20not\x20found:\x20'+_0xf04252+'\x0a')),console[_0x56cc6f(0x14c)](a26_0x3cea6c[_0x56cc6f(0x263)](_0x56cc6f(0x223)+_0x2621bf+_0x56cc6f(0x18d)));}function displayRealtimeValidation(_0x2d3232){const _0x289db8=a26_0x159e1d;if(!_0x2d3232[_0x289db8(0x187)])return;const _0x5081d6=_0x2d3232[_0x289db8(0x187)],_0x4a2fd8=_0x5081d6[_0x289db8(0x16a)]?a26_0x3cea6c[_0x289db8(0x274)](_0x289db8(0x26d)):a26_0x3cea6c[_0x289db8(0x1ea)](_0x289db8(0x239));console['error']('\x0a'+a26_0x3cea6c['dim']('RT\x202.0:')+'\x20'+_0x4a2fd8);if(_0x5081d6[_0x289db8(0x20e)]&&_0x5081d6[_0x289db8(0x20e)][_0x289db8(0x133)]>0x0){console[_0x289db8(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x289db8(0x117)](_0x289db8(0x12e))+'\x20'+_0x5081d6[_0x289db8(0x20e)][_0x289db8(0x133)]+_0x289db8(0x1ae));for(const _0x5c5292 of _0x5081d6[_0x289db8(0x20e)]){const _0x510933=_0x5c5292['sourceTableValid']===![]?a26_0x3cea6c[_0x289db8(0x247)]('✘'):a26_0x3cea6c[_0x289db8(0x274)]('✔');console[_0x289db8(0x14c)](_0x289db8(0x13c)+_0x510933+'\x20'+_0x5c5292[_0x289db8(0x183)]),_0x5c5292[_0x289db8(0x105)]&&console[_0x289db8(0x14c)]('\x20\x20\x20\x20\x20\x20'+a26_0x3cea6c[_0x289db8(0x247)](_0x5c5292[_0x289db8(0x105)]));}}if(_0x5081d6[_0x289db8(0x149)]&&_0x5081d6[_0x289db8(0x149)][_0x289db8(0x133)]>0x0){console['error']('\x20\x20'+a26_0x3cea6c[_0x289db8(0x117)](_0x289db8(0x166))+'\x20'+_0x5081d6[_0x289db8(0x149)]['length']+'\x20configured');for(const _0x500bd0 of _0x5081d6[_0x289db8(0x149)]){const _0x86f1bb=_0x500bd0[_0x289db8(0x167)]?a26_0x3cea6c[_0x289db8(0x274)]('✔'):a26_0x3cea6c[_0x289db8(0x247)]('✘');console['error'](_0x289db8(0x13c)+_0x86f1bb+'\x20'+_0x500bd0[_0x289db8(0x183)]+'\x20'+a26_0x3cea6c[_0x289db8(0x117)]('('+_0x500bd0[_0x289db8(0x125)]+')'));}}if(_0x5081d6[_0x289db8(0x127)]){const _0x252c46=_0x5081d6['idStitching'][_0x289db8(0x173)]?.[_0x289db8(0x133)]?_0x289db8(0x27d)+_0x5081d6[_0x289db8(0x127)][_0x289db8(0x173)][_0x289db8(0x1f4)](',\x20')+']':'';console[_0x289db8(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x289db8(0x117)]('ID\x20Stitching:')+'\x20'+_0x5081d6['idStitching'][_0x289db8(0x226)]+_0x252c46);}if(_0x5081d6[_0x289db8(0x258)]&&_0x5081d6[_0x289db8(0x258)][_0x289db8(0x133)]>0x0){console[_0x289db8(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x289db8(0x117)](_0x289db8(0xff))+'\x20'+_0x5081d6[_0x289db8(0x258)][_0x289db8(0x133)]+_0x289db8(0x251)+(_0x5081d6[_0x289db8(0x258)][_0x289db8(0x133)]!==0x1?'s':''));for(const _0x2333b2 of _0x5081d6[_0x289db8(0x258)]){console[_0x289db8(0x14c)](_0x289db8(0x151)+_0x2333b2[_0x289db8(0x183)]);}}}function showParentSegmentNotSetError(_0xe4cd60){const _0x269fbd=a26_0x159e1d;console[_0x269fbd(0x14c)](a26_0x3cea6c['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x269fbd(0x14c)](_0xe4cd60);}function a26_0x153d(_0x5e8f94,_0x387d6e){_0x5e8f94=_0x5e8f94-0xf5;const _0x3c19da=a26_0x3c19();let _0x153d72=_0x3c19da[_0x5e8f94];return _0x153d72;}export class ParentSegmentListCommand extends BaseCommand{[a26_0x159e1d(0x183)]='segment:parent:list';['description']=a26_0x159e1d(0x17f);async[a26_0x159e1d(0x157)](_0x58c9d3){const _0x549468=a26_0x159e1d,{options:_0x52d02b,args:_0x463f8d,tdx:_0x54a037}=_0x58c9d3,_0x2ffef2=_0x463f8d[0x0];_0x52d02b['verbose']&&(console[_0x549468(0x14c)](_0x549468(0x1d0)+_0x52d02b[_0x549468(0x18e)]),_0x2ffef2&&console[_0x549468(0x14c)](_0x549468(0x1c4)+_0x2ffef2));const _0x1ee87b=await withSpinner(_0x2ffef2?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x2ffef2+'\x27...':'Listing\x20parent\x20segments...',()=>_0x54a037[_0x549468(0x1fc)][_0x549468(0x11e)](),{'verbose':_0x52d02b[_0x549468(0x1e8)]});let _0x392868=_0x1ee87b[_0x549468(0x172)];if(_0x2ffef2){const _0xd3bc6d=_0x2ffef2[_0x549468(0x1f0)](/[.+^${}()|[\]\\]/g,_0x549468(0x12d))[_0x549468(0x1f0)](/\*/g,'.*')[_0x549468(0x1f0)](/\?/g,'.'),_0x9b4da8=new RegExp('^'+_0xd3bc6d+'$','i');_0x392868=_0x392868[_0x549468(0x1e0)](_0x2611a6=>_0x9b4da8[_0x549468(0x1e3)](_0x2611a6['attributes'][_0x549468(0x183)]));}_0x392868['sort']((_0x2664dd,_0x1a4f60)=>_0x2664dd[_0x549468(0x149)][_0x549468(0x183)][_0x549468(0x162)](_0x1a4f60[_0x549468(0x149)]['name'])),console[_0x549468(0x14c)](_0x549468(0x156)+_0x392868[_0x549468(0x133)]+'\x20parent\x20segment'+(_0x392868[_0x549468(0x133)]!==0x1?'s':''));const _0x219ea7=_0x2d289f=>{const _0x3c8c7d=_0x549468;return getConsoleNextUrl(_0x52d02b[_0x3c8c7d(0x18e)],'/app/dw/parentSegments/'+_0x2d289f);};if(_0x52d02b[_0x549468(0x25b)]===_0x549468(0x205)||_0x52d02b[_0x549468(0x25b)]===_0x549468(0x123)){const _0x141ce2=_0x392868[_0x549468(0x195)](_0x4d128f=>({..._0x4d128f,'url':_0x219ea7(_0x4d128f['id'])}));await handleSDKOutput(_0x141ce2,_0x52d02b);}else{if(_0x392868[_0x549468(0x133)]===0x0)_0x2ffef2?console[_0x549468(0x273)](_0x549468(0x233)+_0x2ffef2):console[_0x549468(0x273)](_0x549468(0x13e));else for(const _0x1c0a27 of _0x392868){const _0xd5aec6=_0x1c0a27[_0x549468(0x149)][_0x549468(0x10f)]?a26_0x3cea6c['dim']('\x20('+formatRows(_0x1c0a27[_0x549468(0x149)][_0x549468(0x10f)])+')'):'',_0x18b69d=hyperlink(_0x1c0a27[_0x549468(0x149)][_0x549468(0x183)],_0x219ea7(_0x1c0a27['id']));console[_0x549468(0x273)](_0x549468(0x145)+_0x18b69d+_0xd5aec6);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x11d);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x1f5);async[a26_0x159e1d(0x157)](_0xade435){const _0x371df7=a26_0x159e1d,{options:_0x620743,args:_0x2b46a4,tdx:_0x20783e}=_0xade435;console[_0x371df7(0x14c)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x371df7(0x1ed)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1c9aaa=_0x620743;if(_0x2b46a4[_0x371df7(0x133)]===0x0)return console['error'](a26_0x3cea6c[_0x371df7(0x247)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x371df7(0x14c)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x26bbd2=_0x2b46a4[0x0];if(!_0x1c9aaa[_0x371df7(0x23c)]||!_0x1c9aaa[_0x371df7(0x1d4)])return console[_0x371df7(0x14c)](_0x371df7(0x209)),console[_0x371df7(0x14c)](_0x371df7(0x216)),0x1;_0x1c9aaa[_0x371df7(0x1e8)]&&(console['error'](_0x371df7(0x1d0)+_0x1c9aaa[_0x371df7(0x18e)]),console[_0x371df7(0x14c)](_0x371df7(0x100)+_0x26bbd2),console[_0x371df7(0x14c)](_0x371df7(0x1ef)+_0x1c9aaa[_0x371df7(0x23c)]),console[_0x371df7(0x14c)](_0x371df7(0x176)+_0x1c9aaa[_0x371df7(0x1d4)]));const _0xcdb233=await loadJSONFromOptions(_0x1c9aaa[_0x371df7(0x149)],_0x1c9aaa[_0x371df7(0x1b2)]),_0x4c3678=await loadJSONFromOptions(_0x1c9aaa['behaviors'],_0x1c9aaa[_0x371df7(0x10d)]),_0x2b2d70=await loadJSONFromOptions(_0x1c9aaa[_0x371df7(0x15d)],_0x1c9aaa[_0x371df7(0x1c3)]),_0x5373fb={'name':_0x26bbd2,'description':_0x1c9aaa[_0x371df7(0x1d8)],'scheduleType':_0x1c9aaa['scheduleType'],'scheduleOption':_0x1c9aaa[_0x371df7(0x197)],'timezone':_0x1c9aaa['timezone'],'master':{'parentDatabaseName':_0x1c9aaa[_0x371df7(0x23c)],'parentTableName':_0x1c9aaa[_0x371df7(0x1d4)]},'attributes':_0xcdb233,'behaviors':_0x4c3678,'customerGroup':_0x2b2d70},_0x816aa5=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x26bbd2+_0x371df7(0x11b),()=>_0x20783e['segment'][_0x371df7(0x240)](_0x5373fb),{'verbose':_0x620743[_0x371df7(0x1e8)]}),_0x3ab9d0=_0x816aa5[_0x371df7(0x172)];return console[_0x371df7(0x14c)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x3ab9d0['name']+_0x371df7(0x10b)+_0x3ab9d0['id']),await handleSDKOutput([_0x3ab9d0],_0x620743),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x242);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x21d);async[a26_0x159e1d(0x157)](_0x322edb){const _0x482a09=a26_0x159e1d,{options:_0x391fff,args:_0x3de4b1,tdx:_0x51810e}=_0x322edb;console[_0x482a09(0x14c)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x482a09(0x23d));const _0x4c2f24=_0x391fff;if(_0x3de4b1[_0x482a09(0x133)]===0x0)return console[_0x482a09(0x14c)](a26_0x3cea6c[_0x482a09(0x247)](_0x482a09(0x249))),console[_0x482a09(0x14c)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x2be974=_0x3de4b1[0x0];_0x4c2f24[_0x482a09(0x1e8)]&&(console[_0x482a09(0x14c)](_0x482a09(0x1d0)+_0x4c2f24[_0x482a09(0x18e)]),console[_0x482a09(0x14c)]('Parent\x20segment:\x20'+_0x2be974));const _0x5664e5=await withSpinner(_0x482a09(0x24e)+_0x2be974+_0x482a09(0x11b),()=>_0x51810e[_0x482a09(0x1fc)][_0x482a09(0x1fb)](_0x2be974),{'verbose':_0x4c2f24[_0x482a09(0x1e8)]}),_0x488d55=_0x5664e5[_0x482a09(0x172)],_0x292f01=await loadJSONFromOptions(_0x4c2f24[_0x482a09(0x255)],_0x4c2f24[_0x482a09(0x248)]),_0x40778c=await loadJSONFromOptions(_0x4c2f24[_0x482a09(0x15f)],_0x4c2f24[_0x482a09(0x252)]),_0x354c0f={'name':_0x488d55[_0x482a09(0x183)],'description':_0x4c2f24[_0x482a09(0x1d8)]!==undefined?_0x4c2f24[_0x482a09(0x1d8)]:_0x488d55[_0x482a09(0x1d8)],'scheduleType':_0x4c2f24[_0x482a09(0x21a)]!==undefined?_0x4c2f24['scheduleType']:_0x488d55[_0x482a09(0x21a)],'scheduleOption':_0x4c2f24[_0x482a09(0x197)]!==undefined?_0x4c2f24[_0x482a09(0x197)]:_0x488d55[_0x482a09(0x197)],'timezone':_0x4c2f24['timezone']!==undefined?_0x4c2f24[_0x482a09(0x1c2)]:_0x488d55[_0x482a09(0x1c2)],'master':_0x488d55['master'],'attributes':_0x292f01?[..._0x488d55[_0x482a09(0x149)]||[],..._0x292f01]:_0x488d55[_0x482a09(0x149)],'behaviors':_0x40778c?[..._0x488d55[_0x482a09(0x245)]||[],..._0x40778c]:_0x488d55[_0x482a09(0x245)],'customerGroup':_0x488d55[_0x482a09(0x15d)]},_0x272e70=await withSpinner(_0x482a09(0x1f6)+_0x2be974+_0x482a09(0x11b),()=>_0x51810e[_0x482a09(0x1fc)][_0x482a09(0x1b4)](_0x2be974,_0x354c0f),{'verbose':_0x4c2f24[_0x482a09(0x1e8)]}),_0x495e6e=_0x272e70[_0x482a09(0x172)];return console[_0x482a09(0x14c)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x495e6e['name']+'\x27'),await handleSDKOutput([_0x495e6e],_0x4c2f24),0x0;}}function a26_0x3c19(){const _0x4a3789=['FINISHED','displayBehaviorsStats','\x20\x20Columns:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','data','stitchingKeys','\x20Opening\x20','Master\x20+\x20Attributes','Table:\x20','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','YAML\x20file:\x20','preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:validate','parent_segments','\x20Added\x20personalization\x20template\x20to\x20','runParent','List\x20parent\x20segments','\x20\x20Note:\x20','segment:parent:preview','Updated','name','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','realtime','963HtgpTA','Aborted.','bold','\x20kill','\x20--interval\x20','`\x20to\x20download\x20the\x20configuration\x20first','site','✘\x20Failed\x20to\x20rename\x20directory:\x20','use','true','enriched','trim','\x27\x20is\x20up\x20to\x20date','map','\x20parent\x20segment\x20\x27','scheduleOption','information_schema','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','displaySummary','Behaviors','web','elapsedTimeMillis','Fetching\x20customers\x20schema...','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20rows\x20','page_view','pullParentYaml','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','\x22,\x20\x22type\x22:\x20\x22','/{name}.yml\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','displayPreviewHints','Get\x20SQL\x20query\x20for\x20parent\x20segment','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20to\x20configure\x20your\x20personalization\x20service','single','94YfvGGO','label','\x20configured','displayPreviewResults','Default','ps:rt:validate','attributesFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','updateParent','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','totalEvents','ps:pz:list','/\x20and\x20','toFixed','Status:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','parent_segment','Schema\x20saved\x20to\x20','segment:parent:run','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Fetching\x20behavior\x20list...','Error:','timezone','customerGroupFile','Pattern:\x20','interval','all','11686FOwUEM','/app/workflows/','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','apply','\x20to\x20push\x20the\x20configuration','Options:','Create\x20parent\x20segment\x20\x27','utf-8','Updating','Site:\x20','workflowId','endsWith','Available\x20behaviors:','table','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20--behavior\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','description','No\x20RT-enabled\x20parent\x20segments\x20found','{\x0a\x20\x20\x22database\x22:\x20\x22','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20Tables:\x201\x20customers\x20+\x20','To\x20cancel:','xdg-open','filter','match','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','test','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20--enriched','verbose','Next\x20steps:','yellow','\x20total','\x20\x20No\x20sample\x20data\x20available','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','ignore','Database:\x20','replace','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','sections','\x20RT\x20configuration\x20is\x20valid','join','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Updating\x20parent\x20segment\x20\x27','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','toLowerCase','\x27\x20and\x20run\x20workflow?','master','getParentFull','segment','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x20--attribute\x20\x22','Master:','Parent\x20segment:\x20','\x0a✔\x20Workflow\x20started','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Columns:','realtime_enabled','json','\x20No\x20changes\x20-\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Preview:','Error:\x20--database\x20and\x20--table\x20are\x20required','Listing\x20RT-enabled\x20parent\x20segments...','tdx\x20ps\x20preview\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','segment:parent:sql','events','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','123956lhJliQ','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','workflowAttemptId','\x22\x20}','reduce','stop','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20behaviors','82140qeMSOp','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','scheduleType','760173LoFjtr','\x20\x201.\x20Edit\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','/attempt/','\x20personalization\x20service','errors','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20is\x20already\x20up\x20to\x20date','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','8SWKErL','column','primaryKey','keys','.yaml','joinKey','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Options:\x0a','segment:parent:view','sampleData','indexOf','segment:parent:fields','matchedCount','\x20rows)','No\x20parent\x20segments\x20match\x20pattern:\x20','Validating\x20RT\x20configuration...','/app/dw/parentSegments/','displayColumns','.customers)','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','⚡\x20Not\x20enabled','2849166sLwsvH','Coverage:','database','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Attributes','SELECT\x20*\x20FROM\x20','createParent','\x20Configuration\x20is\x20valid','segment:parent:update','stats','\x0aChanges\x20to\x20apply\x20to\x20\x27','behaviors','tdx\x20ps\x20push\x20','red','addAttributesFile','Error:\x20Parent\x20segment\x20name\x20is\x20required','query','segment:parent:show','formatSchemaJson','\x20section','Fetching\x20current\x20configuration\x20for\x20\x27','Show\x20parent\x20segment\x20details','segment:parent:push','\x20service','addBehaviorsFile','Fetching\x20SQL\x20for\x20\x27','validateParentYaml','addAttributes','✔\x20No\x20changes\x20-\x20\x27','No\x20personalization\x20services\x20configured','personalizationServices','Join:','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','format','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Executing\x20parent\x20segment\x20query...','getParentSQL','\x20--attribute\x20\x22<name>\x22','\x20Context\x20set:\x20','displayAttributesStats','\x20=\x20','cyan','Source:','getBehaviorNames','customersWithEvents','collectSchema','Validating\x20configuration...','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','⚡\x20Enabled','varchar','message','yes','double','behavior','log','green','jobId','Audience\x20ID:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20Database:\x20','displayRealtimeInfo','\x0a⚠️\x20\x20Both\x20','setJobId','Analyzing\x20changes...','\x20+\x20[','last_page_viewed','\x0aError:','\x0aChanges\x20to\x20\x27','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Listing\x20personalization\x20services\x20for\x20\x27','Apply\x20changes\x20to\x20\x27','string','previewParentYaml','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','/\x20directories\x20exist.','2910200vkLXIu','Personalization:','Name:\x20','darwin','Validate:','\x0aNo\x20sample\x20data\x20available','2043880ddRMgX','sourceTableError','/\x20directory.\x0a','start','repeat','toLocaleString','pushParentYaml','\x27\x20with\x20ID:\x20','column_name','behaviorsFile','schemaValid','population','\x20\x20\x20','personalization_services','isDirectory','allValid','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','.yml','RT\x202.0\x20Validate:','dim','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Options\x20(one\x20required):\x0a','\x27...','using\x20the\x20default\x20path:\x20','segment:parent:create','listParents','Fetching\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','unref','\x20--behavior\x20\x22<name>\x22','jsonl','\x0aNew\x20parent\x20segment\x20\x27','type','foreignKey','idStitching','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','output','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','displayMasterInfo','Fetching\x20sample\x20data...','\x5c$&','Events:','/sessions/','column_type','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','customers','length','✔\x20Renamed\x20directory\x20to\x20','displayValidateResults','My\x20Service','\x20service(s)\x20configured','behavior_','Personalization\x20service\x20description','coveragePercent','Customers:','\x20\x20\x20\x20','\x20[Job\x20ID:\x20','No\x20parent\x20segments\x20found','getOutputDatabaseName','displaySampleData','trigger_event','Output\x20file:\x20','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','audienceId','👥\x20','list','Error\x20reading\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','attributes','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','parentSegment','error','session','Attribute:','resolveParentId','ps:rt:list','\x20\x20\x20\x20-\x20','run','\x20field','status','text','✔\x20Found\x20','execute','in\x20','realtime:','customerPercent','attribute','workflowSessionId','customerGroup','\x20Added\x20RT\x202.0\x20template\x20section','addBehaviors','-1d','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','localeCompare','Rows:','win32','columns','Attributes:','valid','<database>.<table>','\x20RT-enabled\x20parent\x20segment','enabled','Creating','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Join\x20on:'];a26_0x3c19=function(){return _0x4a3789;};return a26_0x3c19();}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';['description']=a26_0x159e1d(0x119);async['execute'](_0x54fcee){const _0x45b877=a26_0x159e1d,{options:_0x4413be,args:_0x17161a,tdx:_0x15e8b5}=_0x54fcee,_0x204ca8=_0x4413be,_0x4292ad=_0x17161a[0x0]||_0x4413be['parentSegment'];if(!_0x4292ad)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'+_0x45b877(0x12a)),0x1;if(_0x204ca8[_0x45b877(0x190)]&&_0x204ca8[_0x45b877(0x129)])return console[_0x45b877(0x14c)](a26_0x3cea6c[_0x45b877(0x247)](_0x45b877(0x118))),console[_0x45b877(0x14c)](a26_0x3cea6c[_0x45b877(0x117)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a26_0x3cea6c[_0x45b877(0x117)](_0x45b877(0x11c)+PARENT_SEGMENT_DIR+_0x45b877(0x1a5))),console['error'](a26_0x3cea6c[_0x45b877(0x263)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x190468=_0x204ca8[_0x45b877(0x129)]||a26_0x4b5b8b[_0x45b877(0x1f4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4292ad)+_0x45b877(0x115));_0x204ca8['verbose']&&(console[_0x45b877(0x14c)]('Site:\x20'+_0x204ca8[_0x45b877(0x18e)]),console[_0x45b877(0x14c)](_0x45b877(0x200)+_0x4292ad),console[_0x45b877(0x14c)](_0x45b877(0x142)+_0x190468));const _0x1e0bb9=await withSpinner(_0x45b877(0x11f)+_0x4292ad+_0x45b877(0x11b),()=>_0x15e8b5[_0x45b877(0x1fc)][_0x45b877(0x1a2)](_0x4292ad),{'verbose':_0x204ca8['verbose']}),_0x4e64b0=_0x1e0bb9[_0x45b877(0x172)];if(existsSync(_0x190468)){const _0x45d429=readFileSync(_0x190468,_0x45b877(0x1ce)),_0x374494=generateDiff(_0x45d429,_0x4e64b0);if(!hasChanges(_0x374494))console[_0x45b877(0x14c)](a26_0x3cea6c[_0x45b877(0x274)]('✔')+_0x45b877(0x206)+a26_0x3cea6c[_0x45b877(0x263)](_0x190468)+_0x45b877(0x222));else{console[_0x45b877(0x14c)](_0x45b877(0xf6)+_0x190468+'\x27:'),console['error']('─'[_0x45b877(0x108)](0x3c)),console['error'](formatDiffWithColors(_0x374494)),console['error']('─'['repeat'](0x3c));if(!_0x204ca8['yes']){if(!isInteractive())return console[_0x45b877(0x14c)](a26_0x3cea6c[_0x45b877(0x247)](_0x45b877(0xf5)),_0x45b877(0x1db)),console[_0x45b877(0x14c)](a26_0x3cea6c['dim'](_0x45b877(0x1b5))),0x1;const _0x481d84=await confirmKey('Overwrite\x20\x27'+_0x190468+'\x27?');if(!_0x481d84)return console['error'](a26_0x3cea6c['yellow'](_0x45b877(0x189))),0x1;}writeFileSync(_0x190468,_0x4e64b0,_0x45b877(0x1ce)),console[_0x45b877(0x14c)](a26_0x3cea6c['green']('✔')+_0x45b877(0x277)+a26_0x3cea6c[_0x45b877(0x263)](_0x190468));}}else{const _0x20d6ed=a26_0x4b5b8b[_0x45b877(0x1e5)](_0x190468);!existsSync(_0x20d6ed)&&mkdirSync(_0x20d6ed,{'recursive':!![]}),writeFileSync(_0x190468,_0x4e64b0,_0x45b877(0x1ce)),console['error'](a26_0x3cea6c[_0x45b877(0x274)]('✔')+_0x45b877(0x277)+a26_0x3cea6c[_0x45b877(0x263)](_0x190468));}return saveSessionContext({'parent_segment':_0x4292ad},_0x204ca8[_0x45b877(0x14d)]),console[_0x45b877(0x14c)](a26_0x3cea6c['green']('✔')+_0x45b877(0x260)+a26_0x3cea6c[_0x45b877(0x117)](_0x45b877(0x1bc))+_0x45b877(0x262)+a26_0x3cea6c[_0x45b877(0x263)](_0x4292ad)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x250);[a26_0x159e1d(0x1d8)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x159e1d(0x157)](_0x5c9b88){const _0x4bbcfd=a26_0x159e1d,{options:_0x7ca921,args:_0x5754e7,tdx:_0x36e84f}=_0x5c9b88,_0x346e4c=_0x7ca921,_0x1db2b4=_0x5754e7[0x0]||_0x7ca921[_0x4bbcfd(0x14b)];if(!_0x1db2b4)return showParentSegmentNotSetError(_0x4bbcfd(0x185)+_0x4bbcfd(0x20f)),0x1;const _0x246d7e=resolveYamlFile(_0x1db2b4);if(!existsSync(_0x246d7e))return showFileNotFoundError(_0x246d7e,_0x1db2b4),0x1;_0x346e4c[_0x4bbcfd(0x1e8)]&&(console[_0x4bbcfd(0x14c)]('Site:\x20'+_0x346e4c[_0x4bbcfd(0x18e)]),console[_0x4bbcfd(0x14c)](_0x4bbcfd(0x178)+_0x246d7e));let _0x15e2e3;try{_0x15e2e3=readFileSync(_0x246d7e,_0x4bbcfd(0x1ce));}catch(_0x2f049d){const _0x3b7914=_0x2f049d instanceof Error?_0x2f049d[_0x4bbcfd(0x26f)]:String(_0x2f049d);return console[_0x4bbcfd(0x14c)](_0x4bbcfd(0x147)+_0x3b7914),0x1;}const _0x3e4166=await withSpinner(_0x4bbcfd(0x27c),()=>_0x36e84f[_0x4bbcfd(0x1fc)]['pushParentYaml'](_0x15e2e3),{'verbose':_0x346e4c[_0x4bbcfd(0x1e8)]}),_0x19dadb=_0x3e4166[_0x4bbcfd(0x172)],{isNew:_0x11689f,name:_0xe76891,hasChanges:_0x323adc,diffFormatted:_0x36ccf7}=_0x19dadb;if(!_0x323adc)return console['error'](_0x4bbcfd(0x256)+_0xe76891+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x11689f?console[_0x4bbcfd(0x14c)](_0x4bbcfd(0x124)+_0xe76891+'\x27:'):console[_0x4bbcfd(0x14c)](_0x4bbcfd(0x244)+_0xe76891+'\x27:');console[_0x4bbcfd(0x14c)]('─'[_0x4bbcfd(0x108)](0x3c)),console['error'](_0x36ccf7),console[_0x4bbcfd(0x14c)]('─'[_0x4bbcfd(0x108)](0x3c));const _0xfcfc2e=_0x11689f?_0x4bbcfd(0x1cd)+_0xe76891+'\x27?':_0x4bbcfd(0xf9)+_0xe76891+'\x27?';if(!_0x346e4c[_0x4bbcfd(0x270)]){if(!isInteractive())return console[_0x4bbcfd(0x14c)](a26_0x3cea6c[_0x4bbcfd(0x247)](_0x4bbcfd(0xf5)),_0x4bbcfd(0x1db)),console[_0x4bbcfd(0x14c)](a26_0x3cea6c[_0x4bbcfd(0x117)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x469442=await confirmKey(_0xfcfc2e);if(!_0x469442)return console[_0x4bbcfd(0x14c)](a26_0x3cea6c[_0x4bbcfd(0x1ea)](_0x4bbcfd(0x189))),0x1;}const _0x1c77fc=_0x11689f?_0x4bbcfd(0x16b):_0x4bbcfd(0x1cf),_0x3b9ae8=await withSpinner(_0x1c77fc+_0x4bbcfd(0x196)+_0xe76891+'\x27...',()=>_0x19dadb[_0x4bbcfd(0x1ca)](),{'verbose':_0x346e4c['verbose']}),_0x5ae67c=_0x3b9ae8['data'],_0xccaa9c=getConsoleNextUrl(_0x346e4c[_0x4bbcfd(0x18e)],_0x4bbcfd(0x235)+_0x5ae67c['id']),_0x2bba7e=_0x11689f?'Created':_0x4bbcfd(0x182);return console['error']('✔\x20'+_0x2bba7e+_0x4bbcfd(0x196)+_0x5ae67c[_0x4bbcfd(0x183)]+'\x27'),console['error']('\x20\x20'+_0xccaa9c),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x159e1d(0x17b);['description']=a26_0x159e1d(0x1d5);async[a26_0x159e1d(0x157)](_0x290deb){const _0x4d6f25=a26_0x159e1d,{options:_0x10e233,args:_0x3f0e98,tdx:_0x455b86}=_0x290deb,_0x4ee195=_0x10e233,_0x160f59=_0x3f0e98[0x0]||_0x10e233['parentSegment'];if(!_0x160f59)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'+_0x4d6f25(0x17a)+_0x4d6f25(0x22c)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x190fb0=resolveYamlFile(_0x160f59);if(!existsSync(_0x190fb0))return showFileNotFoundError(_0x190fb0,_0x160f59),0x1;_0x4ee195[_0x4d6f25(0x1e8)]&&(console['error']('Site:\x20'+_0x4ee195[_0x4d6f25(0x18e)]),console[_0x4d6f25(0x14c)]('YAML\x20file:\x20'+_0x190fb0));let _0x5c928d;try{_0x5c928d=readFileSync(_0x190fb0,_0x4d6f25(0x1ce));}catch(_0x573d20){const _0x5824ce=_0x573d20 instanceof Error?_0x573d20['message']:String(_0x573d20);return console[_0x4d6f25(0x14c)](_0x4d6f25(0x147)+_0x5824ce),0x1;}const _0x9a83cc=createCommandSpinner(a26_0x3cea6c[_0x4d6f25(0x117)](_0x4d6f25(0x268)),{'verbose':_0x4ee195[_0x4d6f25(0x1e8)]});_0x9a83cc[_0x4d6f25(0x107)]();const _0x4f8c89={'onProgress':_0x36e0fe=>{const _0x30922a=_0x4d6f25;_0x9a83cc[_0x30922a(0x155)]=formatProgressMessage(_0x36e0fe);}};if(_0x4ee195['master'])_0x4f8c89[_0x4d6f25(0x1fa)]=!![];if(_0x4ee195[_0x4d6f25(0x192)])_0x4f8c89[_0x4d6f25(0x192)]=!![];_0x4ee195[_0x4d6f25(0x15b)]&&(_0x4f8c89[_0x4d6f25(0x15b)]=_0x4ee195[_0x4d6f25(0x15b)]);_0x4ee195[_0x4d6f25(0x272)]&&(_0x4f8c89[_0x4d6f25(0x272)]=_0x4ee195[_0x4d6f25(0x272)]);if(_0x4ee195[_0x4d6f25(0x1c5)])_0x4f8c89[_0x4d6f25(0x1c5)]=_0x4ee195[_0x4d6f25(0x1c5)];let _0x5a34a6;try{_0x5a34a6=await _0x455b86[_0x4d6f25(0x1fc)][_0x4d6f25(0x254)](_0x5c928d,_0x4f8c89),_0x9a83cc['stop']();}catch(_0x2d4d5a){_0x9a83cc[_0x4d6f25(0x215)]();throw _0x2d4d5a;}const _0x2e2d09=_0x4ee195['interval']||_0x4d6f25(0x160);return this[_0x4d6f25(0x135)](_0x5a34a6,_0x4f8c89,_0x190fb0,_0x2e2d09),_0x5a34a6[_0x4d6f25(0x113)]?0x0:0x1;}['displayValidateResults'](_0x13345d,_0x17a7ac,_0x138b0b,_0x3854ba){const _0x1460bf=a26_0x159e1d;console['error']('\x0a'+a26_0x3cea6c[_0x1460bf(0x18a)](_0x1460bf(0x102))+'\x20'+_0x13345d[_0x1460bf(0x183)]),console[_0x1460bf(0x14c)]('═'[_0x1460bf(0x108)](0x3c)),this[_0x1460bf(0x12b)](_0x13345d);if(typeof _0x17a7ac[_0x1460bf(0x15b)]===_0x1460bf(0xfa)){this['displayAttributesStats'](_0x13345d),this[_0x1460bf(0x19a)](_0x13345d),this[_0x1460bf(0x1a7)](_0x138b0b,_0x3854ba,_0x1460bf(0x15b),_0x17a7ac[_0x1460bf(0x15b)]);return;}if(_0x17a7ac[_0x1460bf(0x15b)]===!![]){this[_0x1460bf(0x261)](_0x13345d),this[_0x1460bf(0x19a)](_0x13345d),this[_0x1460bf(0x1a7)](_0x138b0b,_0x3854ba,_0x1460bf(0x149));return;}if(typeof _0x17a7ac['behavior']===_0x1460bf(0xfa)){this['displayBehaviorsStats'](_0x13345d,_0x3854ba),this[_0x1460bf(0x19a)](_0x13345d),this[_0x1460bf(0x1a7)](_0x138b0b,_0x3854ba,_0x1460bf(0x272),_0x17a7ac[_0x1460bf(0x272)]);return;}if(_0x17a7ac[_0x1460bf(0x272)]===!![]){this['displayBehaviorsStats'](_0x13345d,_0x3854ba),this[_0x1460bf(0x19a)](_0x13345d),this[_0x1460bf(0x1a7)](_0x138b0b,_0x3854ba,_0x1460bf(0x245));return;}this[_0x1460bf(0x261)](_0x13345d),this[_0x1460bf(0x16f)](_0x13345d,_0x3854ba),this[_0x1460bf(0x279)](_0x13345d),this[_0x1460bf(0x19a)](_0x13345d),this[_0x1460bf(0x1a7)](_0x138b0b,_0x3854ba,'all');}[a26_0x159e1d(0x279)](_0x546577){displayRealtimeValidation(_0x546577);}[a26_0x159e1d(0x1a7)](_0x7ddddb,_0x22890b,_0x81e074,_0x576b86){const _0x375287=a26_0x159e1d;console['error']('\x0a'+a26_0x3cea6c[_0x375287(0x117)]('To\x20view\x20sample\x20data:'));const _0x398918=_0x22890b!==_0x375287(0x160)?_0x375287(0x18c)+_0x22890b:'';if(_0x81e074==='attribute'&&_0x576b86)console[_0x375287(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x375287(0x117)](_0x375287(0x20b)+_0x7ddddb+_0x375287(0x1fe)+_0x576b86+'\x22'+_0x398918));else{if(_0x81e074===_0x375287(0x272)&&_0x576b86)console['error']('\x20\x20'+a26_0x3cea6c[_0x375287(0x117)](_0x375287(0x20b)+_0x7ddddb+_0x375287(0x1d6)+_0x576b86+'\x22'+_0x398918));else(_0x81e074===_0x375287(0x149)||_0x81e074===_0x375287(0x1c6))&&console['error']('\x20\x20'+a26_0x3cea6c[_0x375287(0x117)]('tdx\x20ps\x20preview\x20'+_0x7ddddb+_0x375287(0x25f)+_0x398918));}(_0x81e074===_0x375287(0x245)||_0x81e074===_0x375287(0x1c6))&&console[_0x375287(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x375287(0x117)](_0x375287(0x20b)+_0x7ddddb+_0x375287(0x122)+_0x398918)),_0x81e074===_0x375287(0x1c6)&&console[_0x375287(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x375287(0x117)]('tdx\x20ps\x20preview\x20'+_0x7ddddb+_0x375287(0x1e7)+_0x398918));}[a26_0x159e1d(0x12b)](_0x557cd4){const _0x16acce=a26_0x159e1d,{master:_0x17d4df}=_0x557cd4,_0x174561=_0x17d4df[_0x16acce(0x10e)]?a26_0x3cea6c[_0x16acce(0x274)]('✔'):a26_0x3cea6c['red']('✘');console['error']('\x0a'+a26_0x3cea6c[_0x16acce(0x117)]('Master\x20Table')),console[_0x16acce(0x14c)](_0x174561+'\x20'+a26_0x3cea6c[_0x16acce(0x18a)](_0x17d4df[_0x16acce(0x23c)]+'.'+_0x17d4df['table'])),_0x17d4df[_0x16acce(0x10e)]?_0x17d4df['rowCount']!==undefined&&console[_0x16acce(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x16acce(0x117)](_0x16acce(0x163))+'\x20'+a26_0x3cea6c[_0x16acce(0x263)](formatRows(_0x17d4df['rowCount']))):console[_0x16acce(0x14c)]('\x20\x20'+a26_0x3cea6c['red'](_0x16acce(0x1c1))+'\x20'+_0x17d4df['schemaError']);}[a26_0x159e1d(0x261)](_0x246a37){const _0xeaa347=a26_0x159e1d;if(_0x246a37[_0xeaa347(0x149)][_0xeaa347(0x133)]===0x0)return;console[_0xeaa347(0x14c)]('\x0a'+a26_0x3cea6c[_0xeaa347(0x117)](_0xeaa347(0x23e)));for(const _0x1d548d of _0x246a37[_0xeaa347(0x149)]){const _0x37bfd9=_0x1d548d[_0xeaa347(0x10e)]?a26_0x3cea6c[_0xeaa347(0x274)]('✔'):a26_0x3cea6c[_0xeaa347(0x247)]('✘');let _0x4be7c7='';if(_0x1d548d['schemaValid']&&_0x1d548d[_0xeaa347(0x231)]!==undefined&&_0x1d548d[_0xeaa347(0x13a)]!==undefined){const _0x1d4b74=_0x1d548d['coveragePercent'][_0xeaa347(0x1b9)](0x1),_0x5c393a=_0x1d548d[_0xeaa347(0x13a)]>=0x50?a26_0x3cea6c[_0xeaa347(0x274)]:_0x1d548d[_0xeaa347(0x13a)]>=0x32?a26_0x3cea6c[_0xeaa347(0x1ea)]:a26_0x3cea6c[_0xeaa347(0x247)];_0x4be7c7='\x20'+a26_0x3cea6c[_0xeaa347(0x117)](_0xeaa347(0x23b))+'\x20'+_0x5c393a(_0x1d4b74+'%')+'\x20('+formatRows(_0x1d548d[_0xeaa347(0x231)])+_0xeaa347(0x232);}console[_0xeaa347(0x14c)](_0x37bfd9+'\x20'+a26_0x3cea6c[_0xeaa347(0x18a)](_0x1d548d[_0xeaa347(0x183)])+_0x4be7c7),console[_0xeaa347(0x14c)]('\x20\x20'+a26_0x3cea6c[_0xeaa347(0x117)](_0xeaa347(0x264))+'\x20'+a26_0x3cea6c[_0xeaa347(0x18a)](_0x1d548d['database']+'.'+_0x1d548d['table']));const _0x4a3e4c=_0x1d548d[_0xeaa347(0x229)]===_0x1d548d[_0xeaa347(0x126)]?a26_0x3cea6c[_0xeaa347(0x117)](_0xeaa347(0x16d))+'\x20'+_0x1d548d['joinKey']:a26_0x3cea6c[_0xeaa347(0x117)](_0xeaa347(0x259))+'\x20'+_0x1d548d[_0xeaa347(0x229)]+_0xeaa347(0x262)+_0x1d548d[_0xeaa347(0x126)];console[_0xeaa347(0x14c)]('\x20\x20'+_0x4a3e4c),console[_0xeaa347(0x14c)]('\x20\x20'+a26_0x3cea6c['dim'](_0xeaa347(0x203))),this['displayColumns'](_0x1d548d[_0xeaa347(0x165)]),!_0x1d548d[_0xeaa347(0x10e)]&&console[_0xeaa347(0x14c)]('\x20\x20'+a26_0x3cea6c[_0xeaa347(0x247)]('Error:')+'\x20'+_0x1d548d['schemaError']);}}[a26_0x159e1d(0x16f)](_0x18ea83,_0x49bbf5){const _0x55b138=a26_0x159e1d;if(_0x18ea83[_0x55b138(0x245)][_0x55b138(0x133)]===0x0)return;console[_0x55b138(0x14c)]('\x0a'+a26_0x3cea6c[_0x55b138(0x117)](_0x55b138(0x19b))+'\x20'+a26_0x3cea6c[_0x55b138(0x117)]('('+_0x49bbf5+')'));for(const _0x4e0f51 of _0x18ea83[_0x55b138(0x245)]){const _0x509d87=_0x4e0f51[_0x55b138(0x10e)]?a26_0x3cea6c['green']('✔'):a26_0x3cea6c['red']('✘');let _0xfe4f1d='';if(_0x4e0f51['schemaValid']&&_0x4e0f51[_0x55b138(0x266)]!==undefined&&_0x4e0f51[_0x55b138(0x1b6)]!==undefined){const _0x518753=_0x4e0f51[_0x55b138(0x15a)]?.[_0x55b138(0x1b9)](0x1)||'?',_0x26f9ef=(_0x4e0f51[_0x55b138(0x15a)]??0x0)>=0x32?a26_0x3cea6c[_0x55b138(0x274)]:(_0x4e0f51['customerPercent']??0x0)>=0x14?a26_0x3cea6c['yellow']:a26_0x3cea6c[_0x55b138(0x247)];_0xfe4f1d='\x20'+a26_0x3cea6c[_0x55b138(0x117)](_0x55b138(0x13b))+'\x20'+_0x26f9ef(formatRows(_0x4e0f51['customersWithEvents']))+'\x20('+_0x518753+'%)\x20'+a26_0x3cea6c[_0x55b138(0x117)](_0x55b138(0x12e))+'\x20'+a26_0x3cea6c['cyan'](formatRows(_0x4e0f51['totalEvents']));}console[_0x55b138(0x14c)](_0x509d87+'\x20'+a26_0x3cea6c[_0x55b138(0x18a)](_0x4e0f51[_0x55b138(0x183)])+_0xfe4f1d),console['error']('\x20\x20'+a26_0x3cea6c[_0x55b138(0x117)](_0x55b138(0x264))+'\x20'+a26_0x3cea6c[_0x55b138(0x18a)](_0x4e0f51[_0x55b138(0x23c)]+'.'+_0x4e0f51[_0x55b138(0x1d4)]));const _0x388b93=_0x4e0f51[_0x55b138(0x229)]===_0x4e0f51[_0x55b138(0x126)]?a26_0x3cea6c['dim'](_0x55b138(0x16d))+'\x20'+_0x4e0f51['joinKey']:a26_0x3cea6c['dim'](_0x55b138(0x259))+'\x20'+_0x4e0f51[_0x55b138(0x229)]+'\x20=\x20'+_0x4e0f51[_0x55b138(0x126)];console[_0x55b138(0x14c)]('\x20\x20'+_0x388b93),console[_0x55b138(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x55b138(0x117)](_0x55b138(0x203))),this[_0x55b138(0x236)](_0x4e0f51['columns']),!_0x4e0f51[_0x55b138(0x10e)]&&console['error']('\x20\x20'+a26_0x3cea6c[_0x55b138(0x247)](_0x55b138(0x1c1))+'\x20'+_0x4e0f51['schemaError']);}}[a26_0x159e1d(0x236)](_0x547465){const _0x436313=a26_0x159e1d;for(const _0x1c0d4b of _0x547465){_0x1c0d4b[_0x436313(0x1ad)]===_0x1c0d4b[_0x436313(0x225)]||_0x1c0d4b['column']==='*'?console[_0x436313(0x14c)]('\x20\x20\x20\x20-\x20'+_0x1c0d4b[_0x436313(0x1ad)]):console[_0x436313(0x14c)](_0x436313(0x151)+_0x1c0d4b['label']+'\x20'+a26_0x3cea6c[_0x436313(0x117)]('('+_0x1c0d4b[_0x436313(0x225)]+')'));}}['displaySummary'](_0x1cca85){const _0x4bf449=a26_0x159e1d;console['error']('─'[_0x4bf449(0x108)](0x3c));if(_0x1cca85[_0x4bf449(0x220)][_0x4bf449(0x133)]>0x0){console['error']('\x0a'+a26_0x3cea6c[_0x4bf449(0x247)]('Errors:'));for(const _0x3bd8f7 of _0x1cca85['errors']){console['error']('\x20\x20'+a26_0x3cea6c['red']('•')+'\x20'+_0x3bd8f7);}}_0x1cca85[_0x4bf449(0x113)]&&console[_0x4bf449(0x14c)]('\x0a'+a26_0x3cea6c['green']('✔')+_0x4bf449(0x241));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x181);[a26_0x159e1d(0x1d8)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a26_0x159e1d(0x157)](_0x4b0cf7){const _0x2bf2c2=a26_0x159e1d,{options:_0x14aeb9,args:_0x9dd676,tdx:_0x5a968b}=_0x4b0cf7,_0x21e2d0=_0x14aeb9,_0x36376b=_0x9dd676[0x0]||_0x14aeb9['parentSegment'];if(!_0x36376b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x2bf2c2(0x1d7)+_0x2bf2c2(0x11a)+_0x2bf2c2(0x25c)+_0x2bf2c2(0x26b)+_0x2bf2c2(0xfc)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x2bf2c2(0x1bb)),0x1;if(!_0x21e2d0[_0x2bf2c2(0x1fa)]&&!_0x21e2d0[_0x2bf2c2(0x15b)]&&!_0x21e2d0[_0x2bf2c2(0x272)]&&!_0x21e2d0['enriched'])return console['error'](a26_0x3cea6c[_0x2bf2c2(0x247)](_0x2bf2c2(0x199))),console['error'](_0x2bf2c2(0x1e4)),console[_0x2bf2c2(0x14c)](_0x2bf2c2(0x1cc)),console['error'](_0x2bf2c2(0x1f1)),console['error'](_0x2bf2c2(0x1a6)),console[_0x2bf2c2(0x14c)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x2bf2c2(0x14c)](_0x2bf2c2(0x16c)),0x1;const _0x214316=resolveYamlFile(_0x36376b);if(!existsSync(_0x214316))return showFileNotFoundError(_0x214316,_0x36376b),0x1;_0x21e2d0[_0x2bf2c2(0x1e8)]&&(console[_0x2bf2c2(0x14c)](_0x2bf2c2(0x1d0)+_0x21e2d0[_0x2bf2c2(0x18e)]),console[_0x2bf2c2(0x14c)](_0x2bf2c2(0x178)+_0x214316));let _0x12af9f;try{_0x12af9f=readFileSync(_0x214316,_0x2bf2c2(0x1ce));}catch(_0x3f3c51){const _0x2f5aa0=_0x3f3c51 instanceof Error?_0x3f3c51[_0x2bf2c2(0x26f)]:String(_0x3f3c51);return console['error']('Error\x20reading\x20file:\x20'+_0x2f5aa0),0x1;}let _0x25ceb7;try{_0x25ceb7=parseDef(_0x12af9f);}catch(_0x4032f5){const _0x1a6909=_0x4032f5 instanceof Error?_0x4032f5['message']:String(_0x4032f5);return console[_0x2bf2c2(0x14c)](a26_0x3cea6c[_0x2bf2c2(0x247)]('Error\x20parsing\x20YAML:\x20'+_0x1a6909)),0x1;}if(_0x21e2d0[_0x2bf2c2(0x15b)]===!![]||_0x21e2d0[_0x2bf2c2(0x15b)]===''){const _0x3acde6=_0x25ceb7[_0x2bf2c2(0x149)]?.[_0x2bf2c2(0x195)](_0x4884a6=>_0x4884a6[_0x2bf2c2(0x183)])||[];if(_0x3acde6[_0x2bf2c2(0x133)]===0x0)console['error'](a26_0x3cea6c['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x2bf2c2(0x14c)](a26_0x3cea6c[_0x2bf2c2(0x247)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x2bf2c2(0x14c)]('Available\x20attributes:');for(const _0x512ceb of _0x3acde6){console[_0x2bf2c2(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x2bf2c2(0x263)](_0x512ceb));}console[_0x2bf2c2(0x14c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x36376b+_0x2bf2c2(0x1fe)+_0x3acde6[0x0]+'\x22');}return 0x1;}if(_0x21e2d0[_0x2bf2c2(0x272)]===!![]||_0x21e2d0['behavior']===''){const _0x55c878=_0x25ceb7['behaviors']?.[_0x2bf2c2(0x195)](_0x62166b=>_0x62166b[_0x2bf2c2(0x183)])||[];if(_0x55c878[_0x2bf2c2(0x133)]===0x0)console['error'](a26_0x3cea6c[_0x2bf2c2(0x247)](_0x2bf2c2(0x1dc)));else{console[_0x2bf2c2(0x14c)](a26_0x3cea6c[_0x2bf2c2(0x247)](_0x2bf2c2(0x221))),console[_0x2bf2c2(0x14c)](_0x2bf2c2(0x1d3));for(const _0x33ab5f of _0x55c878){console[_0x2bf2c2(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x2bf2c2(0x263)](_0x33ab5f));}console[_0x2bf2c2(0x14c)](_0x2bf2c2(0x207)+_0x36376b+_0x2bf2c2(0x1d6)+_0x55c878[0x0]+'\x22');}return 0x1;}const _0x5091f4=createCommandSpinner(a26_0x3cea6c['dim'](_0x2bf2c2(0x12c)),{'verbose':_0x21e2d0[_0x2bf2c2(0x1e8)]});_0x5091f4['start']();const _0x112ee5={'onProgress':_0x3390c8=>{const _0x4bdfa5=_0x2bf2c2;_0x5091f4[_0x4bdfa5(0x155)]=formatProgressMessage(_0x3390c8);}};if(_0x21e2d0[_0x2bf2c2(0x1fa)])_0x112ee5[_0x2bf2c2(0x1fa)]=!![];if(_0x21e2d0[_0x2bf2c2(0x15b)]&&typeof _0x21e2d0['attribute']===_0x2bf2c2(0xfa))_0x112ee5[_0x2bf2c2(0x15b)]=_0x21e2d0[_0x2bf2c2(0x15b)];if(_0x21e2d0[_0x2bf2c2(0x272)]&&typeof _0x21e2d0[_0x2bf2c2(0x272)]===_0x2bf2c2(0xfa))_0x112ee5['behavior']=_0x21e2d0[_0x2bf2c2(0x272)];if(_0x21e2d0[_0x2bf2c2(0x192)])_0x112ee5['enriched']=!![];if(_0x21e2d0[_0x2bf2c2(0x1c5)])_0x112ee5[_0x2bf2c2(0x1c5)]=_0x21e2d0['interval'];let _0x4603b2;try{_0x4603b2=await _0x5a968b[_0x2bf2c2(0x1fc)][_0x2bf2c2(0xfb)](_0x12af9f,_0x112ee5),_0x5091f4[_0x2bf2c2(0x215)]();}catch(_0x3fc19c){_0x5091f4[_0x2bf2c2(0x215)]();throw _0x3fc19c;}return await this[_0x2bf2c2(0x1af)](_0x4603b2,{'master':_0x21e2d0[_0x2bf2c2(0x1fa)],'attribute':typeof _0x21e2d0[_0x2bf2c2(0x15b)]==='string'?_0x21e2d0[_0x2bf2c2(0x15b)]:undefined,'behavior':typeof _0x21e2d0[_0x2bf2c2(0x272)]===_0x2bf2c2(0xfa)?_0x21e2d0[_0x2bf2c2(0x272)]:undefined,'enriched':_0x21e2d0[_0x2bf2c2(0x192)]}),_0x4603b2[_0x2bf2c2(0x113)]?0x0:0x1;}async[a26_0x159e1d(0x1af)](_0x312d08,_0x328f53){const _0x1f9588=a26_0x159e1d;console[_0x1f9588(0x14c)]('\x0a'+a26_0x3cea6c[_0x1f9588(0x18a)](_0x1f9588(0x208))+'\x20'+_0x312d08[_0x1f9588(0x183)]),console[_0x1f9588(0x14c)]('═'['repeat'](0x3c));if(_0x328f53[_0x1f9588(0x1fa)]&&_0x312d08[_0x1f9588(0x22e)]){const _0x1bc4fd=a26_0x3cea6c[_0x1f9588(0x117)](_0x1f9588(0x1ff))+'\x20'+a26_0x3cea6c[_0x1f9588(0x18a)](_0x312d08[_0x1f9588(0x1fa)][_0x1f9588(0x23c)]+'.'+_0x312d08[_0x1f9588(0x1fa)][_0x1f9588(0x1d4)]);await this['displaySampleData'](_0x1bc4fd,_0x312d08[_0x1f9588(0x22e)]);}else{if(_0x328f53['attribute']&&_0x312d08[_0x1f9588(0x22e)]){const _0x25b32d=a26_0x3cea6c[_0x1f9588(0x117)](_0x1f9588(0x14e))+'\x20'+a26_0x3cea6c['bold'](_0x328f53[_0x1f9588(0x15b)]);await this[_0x1f9588(0x140)](_0x25b32d,_0x312d08[_0x1f9588(0x22e)]);}else{if(_0x328f53[_0x1f9588(0x272)]&&_0x312d08[_0x1f9588(0x22e)]){const _0x19ce37=a26_0x3cea6c[_0x1f9588(0x117)]('Behavior:')+'\x20'+a26_0x3cea6c[_0x1f9588(0x18a)](_0x328f53['behavior']);await this['displaySampleData'](_0x19ce37,_0x312d08['sampleData']);}else{if(_0x328f53['enriched']&&_0x312d08[_0x1f9588(0x22e)]){const _0x577149=a26_0x3cea6c[_0x1f9588(0x117)]('Enriched:')+'\x20'+a26_0x3cea6c['bold'](_0x1f9588(0x175));await this[_0x1f9588(0x140)](_0x577149,_0x312d08[_0x1f9588(0x22e)]);}else!_0x312d08[_0x1f9588(0x22e)]&&console[_0x1f9588(0x14c)](_0x1f9588(0x103));}}}if(_0x312d08['errors'][_0x1f9588(0x133)]>0x0){console[_0x1f9588(0x14c)]('─'['repeat'](0x3c)),console[_0x1f9588(0x14c)]('\x0a'+a26_0x3cea6c[_0x1f9588(0x247)]('Errors:'));for(const _0x53af80 of _0x312d08['errors']){console[_0x1f9588(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x1f9588(0x247)]('•')+'\x20'+_0x53af80);}}}async[a26_0x159e1d(0x140)](_0x1211e8,_0x122c77){const _0x54df61=a26_0x159e1d;if(_0x122c77[_0x54df61(0x133)]===0x0){console[_0x54df61(0x14c)]('\x0a'+_0x1211e8),console[_0x54df61(0x14c)](_0x54df61(0x1ec));return;}console['error']('\x0a'+_0x1211e8);const _0x28e4a0=Object[_0x54df61(0x227)](_0x122c77[0x0])[_0x54df61(0x195)](_0x2f06dc=>({'name':_0x2f06dc,'type':typeof _0x122c77[0x0][_0x2f06dc]==='number'?_0x54df61(0x271):_0x54df61(0x26e)})),_0x50d1d6={'queryId':_0x54df61(0x179),'columns':_0x28e4a0,'data':_0x122c77,'stats':{'state':_0x54df61(0x16e),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x122c77[_0x54df61(0x133)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x16ece7=formatAsTable(_0x50d1d6,_0x122c77[_0x54df61(0x133)],!![]);await writeOutput(_0x16ece7,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x1be);[a26_0x159e1d(0x1d8)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0x5c562f){const _0x3bac1e=a26_0x159e1d,{options:_0x1e70aa,args:_0x8c7a12,tdx:_0x4d9f50}=_0x5c562f,_0xd401dd=_0x1e70aa,_0x4c3f12=_0x8c7a12[0x0]||_0x1e70aa[_0x3bac1e(0x14b)];if(!_0x4c3f12)return showParentSegmentNotSetError(_0x3bac1e(0x120)+_0x3bac1e(0x171)),0x1;const _0x532d55=resolveYamlFile(_0x4c3f12);if(existsSync(_0x532d55)){_0xd401dd[_0x3bac1e(0x1e8)]&&console[_0x3bac1e(0x14c)]('Found\x20YAML\x20file:\x20'+_0x532d55);let _0x2109df;try{_0x2109df=readFileSync(_0x532d55,'utf-8');}catch(_0x267000){const _0x40332c=_0x267000 instanceof Error?_0x267000[_0x3bac1e(0x26f)]:String(_0x267000);return console[_0x3bac1e(0x14c)](_0x3bac1e(0x147)+_0x40332c),0x1;}const _0xa98160=await withSpinner('Analyzing\x20changes...',()=>_0x4d9f50[_0x3bac1e(0x1fc)][_0x3bac1e(0x10a)](_0x2109df),{'verbose':_0xd401dd[_0x3bac1e(0x1e8)]}),_0x2f6fb0=_0xa98160['data'],{isNew:_0x427afb,name:_0x4780c7,hasChanges:_0x171130,diffFormatted:_0x295ee3}=_0x2f6fb0;if(_0x171130){_0x427afb?console[_0x3bac1e(0x14c)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x4780c7+'\x27:'):console[_0x3bac1e(0x14c)](_0x3bac1e(0x244)+_0x4780c7+'\x27:');console[_0x3bac1e(0x14c)]('─'[_0x3bac1e(0x108)](0x3c)),console[_0x3bac1e(0x14c)](_0x295ee3),console[_0x3bac1e(0x14c)]('─'[_0x3bac1e(0x108)](0x3c));const _0x32ddeb=_0x427afb?_0x3bac1e(0x1cd)+_0x4780c7+_0x3bac1e(0x1f9):'Apply\x20changes\x20to\x20\x27'+_0x4780c7+'\x27\x20and\x20run\x20workflow?';if(!_0xd401dd[_0x3bac1e(0x270)]){if(!isInteractive())return console[_0x3bac1e(0x14c)](a26_0x3cea6c['red']('\x0aError:'),_0x3bac1e(0x1db)),console[_0x3bac1e(0x14c)](a26_0x3cea6c['dim'](_0x3bac1e(0x1b5))),0x1;const _0x44ed6a=await confirmKey(_0x32ddeb);if(!_0x44ed6a)return console[_0x3bac1e(0x14c)](a26_0x3cea6c[_0x3bac1e(0x1ea)](_0x3bac1e(0x189))),0x1;}const _0x576f6c=_0x427afb?_0x3bac1e(0x16b):_0x3bac1e(0x1cf);await withSpinner(_0x576f6c+_0x3bac1e(0x196)+_0x4780c7+'\x27...',()=>_0x2f6fb0['apply'](),{'verbose':_0xd401dd['verbose']});const _0x5e48a=_0x427afb?'Created':_0x3bac1e(0x182);console['error']('✔\x20'+_0x5e48a+'\x20parent\x20segment\x20\x27'+_0x4780c7+'\x27');}else console[_0x3bac1e(0x14c)](_0x3bac1e(0x256)+_0x4780c7+_0x3bac1e(0x194));}const _0x459813=await withSpinner(_0x3bac1e(0xf7)+_0x4c3f12+_0x3bac1e(0x11b),()=>_0x4d9f50[_0x3bac1e(0x1fc)][_0x3bac1e(0x17e)](_0x4c3f12),{'verbose':_0xd401dd[_0x3bac1e(0x1e8)]}),_0x5d0607=_0x459813[_0x3bac1e(0x172)],_0x24da94=getConsoleUrl(_0xd401dd['site'],_0x3bac1e(0x1c8)+_0x5d0607[_0x3bac1e(0x1d1)]+_0x3bac1e(0x12f)+_0x5d0607['workflowSessionId']+_0x3bac1e(0x21e)+_0x5d0607[_0x3bac1e(0x212)]);return console[_0x3bac1e(0x14c)](_0x3bac1e(0x201)),console['error']('\x20\x20'+a26_0x3cea6c[_0x3bac1e(0x117)](_0x3bac1e(0x276))+'\x20'+_0x5d0607[_0x3bac1e(0x144)]),console[_0x3bac1e(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x3bac1e(0x117)](_0x3bac1e(0x1ba))+'\x20'+_0x5d0607[_0x3bac1e(0x154)]),console[_0x3bac1e(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x3bac1e(0x117)]('Session:')+'\x20'+_0x5d0607[_0x3bac1e(0x15c)]),console[_0x3bac1e(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x3bac1e(0x117)]('Attempt:')+'\x20'+_0x5d0607[_0x3bac1e(0x212)]),console[_0x3bac1e(0x14c)]('\x20\x20'+_0x24da94),console[_0x3bac1e(0x14c)]('\x0a'+a26_0x3cea6c[_0x3bac1e(0x117)](_0x3bac1e(0x1de))+'\x20tdx\x20wf\x20attempt\x20'+_0x5d0607[_0x3bac1e(0x212)]+_0x3bac1e(0x18b)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x230);[a26_0x159e1d(0x1d8)]='List\x20available\x20fields\x20for\x20segmentation';async[a26_0x159e1d(0x157)](_0x579b80){const _0x11b4a0=a26_0x159e1d,{options:_0x19fbd1,args:_0x187939,tdx:_0x2bcd18}=_0x579b80,_0x1db610=_0x187939[0x0]||_0x19fbd1['parentSegment'];if(!_0x1db610)return showParentSegmentNotSetError(_0x11b4a0(0x211)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x19fbd1[_0x11b4a0(0x1e8)]&&(console['error'](_0x11b4a0(0x1d0)+_0x19fbd1[_0x11b4a0(0x18e)]),console[_0x11b4a0(0x14c)](_0x11b4a0(0x200)+_0x1db610));const _0x2ce0e8=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x1db610+_0x11b4a0(0x11b),()=>_0x2bcd18[_0x11b4a0(0x1fc)]['listFields'](_0x1db610),{'verbose':_0x19fbd1[_0x11b4a0(0x1e8)]}),_0x102661=_0x2ce0e8[_0x11b4a0(0x172)];console[_0x11b4a0(0x14c)](_0x11b4a0(0x156)+_0x102661[_0x11b4a0(0x133)]+_0x11b4a0(0x153)+(_0x102661[_0x11b4a0(0x133)]!==0x1?'s':''));if(_0x19fbd1[_0x11b4a0(0x205)]||_0x19fbd1[_0x11b4a0(0x123)])return await handleSDKOutput(_0x102661,_0x19fbd1),0x0;return displayFieldsHumanReadable(_0x102661,_0x1db610),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x22d);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x24f);async[a26_0x159e1d(0x157)](_0x550351){const _0x2f2e4d=a26_0x159e1d,{options:_0xb7126c,args:_0x128528,tdx:_0x454877}=_0x550351,_0xdf0c7=_0xb7126c,_0x414944=_0x128528[0x0]||_0xb7126c[_0x2f2e4d(0x14b)];if(!_0x414944)return showParentSegmentNotSetError(_0x2f2e4d(0x114)+_0x2f2e4d(0x1e6)+_0x2f2e4d(0x22c)+_0x2f2e4d(0x269)),0x1;_0xb7126c[_0x2f2e4d(0x1e8)]&&(console['error'](_0x2f2e4d(0x1d0)+_0xb7126c[_0x2f2e4d(0x18e)]),console[_0x2f2e4d(0x14c)](_0x2f2e4d(0x200)+_0x414944));const _0x3cecee=await withSpinner(_0x2f2e4d(0x11f)+_0x414944+'\x27...',()=>_0x454877[_0x2f2e4d(0x1fc)][_0x2f2e4d(0x1fb)](_0x414944),{'verbose':_0xb7126c[_0x2f2e4d(0x1e8)]}),_0x4fd566=_0x3cecee['data'];if(_0xdf0c7[_0x2f2e4d(0x19c)]){const _0x49b14d=getConsoleNextUrl(_0xdf0c7[_0x2f2e4d(0x18e)],_0x2f2e4d(0x235)+_0x4fd566['id']);return console[_0x2f2e4d(0x14c)](a26_0x3cea6c['green']('✔')+_0x2f2e4d(0x174)+a26_0x3cea6c[_0x2f2e4d(0x263)](_0x49b14d)),openBrowser(_0x49b14d),0x0;}return await handleSingleObjectOutput(_0x4fd566,_0xb7126c),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x159e1d(0x183)]='segment:parent:desc';[a26_0x159e1d(0x1d8)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a26_0x159e1d(0x157)](_0x468f03){const _0x5cf25a=a26_0x159e1d,{options:_0x19c5dd,args:_0x2cafbc,tdx:_0x3b5116}=_0x468f03,_0x476c84=_0x19c5dd,_0x59e50d=_0x2cafbc[0x0]||_0x19c5dd[_0x5cf25a(0x14b)];if(!_0x59e50d)return showParentSegmentNotSetError(_0x5cf25a(0x161)+_0x5cf25a(0x1b3)+_0x5cf25a(0x22c)+_0x5cf25a(0x128)),0x1;_0x19c5dd[_0x5cf25a(0x1e8)]&&(console[_0x5cf25a(0x14c)](_0x5cf25a(0x1d0)+_0x19c5dd[_0x5cf25a(0x18e)]),console['error'](_0x5cf25a(0x200)+_0x59e50d));const _0x2496f4=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x59e50d+_0x5cf25a(0x11b),()=>_0x3b5116[_0x5cf25a(0x1fc)][_0x5cf25a(0x14f)](_0x59e50d),{'verbose':_0x19c5dd[_0x5cf25a(0x1e8)]}),_0xba5f84=_0x2496f4[_0x5cf25a(0x172)],_0x2e7e39=_0x3b5116[_0x5cf25a(0x1fc)][_0x5cf25a(0x13f)](_0xba5f84);if(_0x476c84['output']){const _0x1e2c07=await this['collectSchema'](_0x468f03,_0x59e50d,_0xba5f84,_0x2e7e39),_0x11a2a1=this[_0x5cf25a(0x24c)](_0x1e2c07);writeFileSync(_0x476c84[_0x5cf25a(0x129)],_0x11a2a1);const _0x25b31c=_0x1e2c07['customers'][_0x5cf25a(0x165)]['length']+_0x1e2c07[_0x5cf25a(0x245)][_0x5cf25a(0x214)]((_0x9b4b28,_0x5e148c)=>_0x9b4b28+_0x5e148c['columns'][_0x5cf25a(0x133)],0x0),_0x244ca2=_0x1e2c07[_0x5cf25a(0x245)]['filter'](_0x55e33e=>_0x55e33e[_0x5cf25a(0x165)][_0x5cf25a(0x133)]===0x0)[_0x5cf25a(0x133)];return console[_0x5cf25a(0x273)](_0x5cf25a(0x1bd)+_0x476c84[_0x5cf25a(0x129)]),console[_0x5cf25a(0x273)](_0x5cf25a(0x278)+_0x2e7e39),console[_0x5cf25a(0x273)](_0x5cf25a(0x1dd)+_0x1e2c07[_0x5cf25a(0x245)][_0x5cf25a(0x133)]+_0x5cf25a(0x217)),console[_0x5cf25a(0x273)](_0x5cf25a(0x170)+_0x25b31c+_0x5cf25a(0x1eb)),_0x244ca2>0x0&&console['log'](_0x5cf25a(0x180)+_0x244ca2+_0x5cf25a(0x238)),0x0;}console['error']('\x0a'+a26_0x3cea6c[_0x5cf25a(0x18a)]('Output\x20Database:')+'\x20'+a26_0x3cea6c[_0x5cf25a(0x263)](_0x2e7e39));const _0x167421=await withSpinner(_0x5cf25a(0x19e),()=>_0x3b5116[_0x5cf25a(0x1fc)][_0x5cf25a(0x25e)](_0xba5f84),{'verbose':_0x19c5dd[_0x5cf25a(0x1e8)]});console['error']('\x0a'+a26_0x3cea6c[_0x5cf25a(0x18a)](_0x5cf25a(0x132))+'\x20'+a26_0x3cea6c[_0x5cf25a(0x117)]('('+_0x2e7e39+_0x5cf25a(0x237)));const _0x50b712=await executeSchemaQuery(_0x167421['data'],_0x3b5116,_0x19c5dd);await handleQueryOutput(_0x50b712,_0x19c5dd);const _0x51dda9=await withSpinner(_0x5cf25a(0x1c0),()=>_0x3b5116[_0x5cf25a(0x1fc)][_0x5cf25a(0x265)](_0xba5f84),{'verbose':_0x19c5dd[_0x5cf25a(0x1e8)]});for(const _0xc00128 of _0x51dda9[_0x5cf25a(0x172)]){const _0x236e8d=_0x5cf25a(0x138)+_0xc00128[_0x5cf25a(0x1f8)]()[_0x5cf25a(0x1f0)](/\s+/g,'_'),_0x1359a6=_0x5cf25a(0x23f)+_0x2e7e39+'.'+_0x236e8d;console[_0x5cf25a(0x14c)]('\x0a'+a26_0x3cea6c['bold'](_0xc00128)+'\x20'+a26_0x3cea6c[_0x5cf25a(0x117)]('('+_0x2e7e39+'.'+_0x236e8d+')'));try{const _0x42ace9=await executeSchemaQuery(_0x1359a6,_0x3b5116,_0x19c5dd);await handleQueryOutput(_0x42ace9,_0x19c5dd);}catch{console[_0x5cf25a(0x14c)](a26_0x3cea6c[_0x5cf25a(0x1ea)](_0x5cf25a(0x143)));}}return 0x0;}async[a26_0x159e1d(0x267)](_0x236071,_0x289517,_0x4473da,_0x16d806){const _0x28aa23=a26_0x159e1d,{options:_0x408b6e,tdx:_0x3b9d5f}=_0x236071,_0x44cf5d=await withSpinner(_0x28aa23(0x19e),()=>_0x3b9d5f[_0x28aa23(0x1fc)]['getParentSQL'](_0x4473da),{'verbose':_0x408b6e['verbose']}),_0x366a30=await executeSchemaQuery(_0x44cf5d[_0x28aa23(0x172)],_0x3b9d5f,_0x408b6e),_0x57f044=_0x366a30[_0x28aa23(0x172)][_0x28aa23(0x195)](_0x45b9f0=>({'name':_0x45b9f0[_0x28aa23(0x10c)],'type':_0x45b9f0[_0x28aa23(0x130)]})),_0x5cba7c=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x3b9d5f[_0x28aa23(0x1fc)][_0x28aa23(0x265)](_0x4473da),{'verbose':_0x408b6e[_0x28aa23(0x1e8)]}),_0xd5f493=[];for(const _0x1e29fa of _0x5cba7c['data']){const _0x42cfb3=_0x28aa23(0x138)+_0x1e29fa[_0x28aa23(0x1f8)]()[_0x28aa23(0x1f0)](/\s+/g,'_'),_0x51a680='SELECT\x20*\x20FROM\x20'+_0x16d806+'.'+_0x42cfb3;let _0x34f1b1=[];try{const _0x3580f8=await executeSchemaQuery(_0x51a680,_0x3b9d5f,_0x408b6e);_0x34f1b1=_0x3580f8['data'][_0x28aa23(0x195)](_0x536955=>({'name':_0x536955[_0x28aa23(0x10c)],'type':_0x536955[_0x28aa23(0x130)]}));}catch{}_0xd5f493['push']({'table':_0x42cfb3,'columns':_0x34f1b1});}return{'database':_0x16d806,'parent_segment':_0x289517,'parent_id':_0x4473da,'customers':{'table':_0x28aa23(0x132),'columns':_0x57f044},'behaviors':_0xd5f493};}[a26_0x159e1d(0x24c)](_0x54e31f){const _0x3ec756=a26_0x159e1d,_0xb79fcf=_0x4b61de=>{const _0x358960=a26_0x153d;if(_0x4b61de[_0x358960(0x133)]===0x0)return'[]';const _0x523f83=_0x4b61de['map'](_0xe62a96=>_0x358960(0x131)+_0xe62a96['name']+_0x358960(0x1a4)+_0xe62a96['type']+_0x358960(0x213));return'[\x0a'+_0x523f83[_0x358960(0x1f4)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x18e27f=_0x54e31f[_0x3ec756(0x245)][_0x3ec756(0x195)](_0x464691=>{const _0x10a00a=_0x3ec756;return _0x10a00a(0x1c9)+_0x464691[_0x10a00a(0x1d4)]+_0x10a00a(0x19f)+_0xb79fcf(_0x464691[_0x10a00a(0x165)])['replace'](/^/gm,'\x20\x20')[_0x10a00a(0x193)]()+'\x0a\x20\x20\x20\x20}';})[_0x3ec756(0x1f4)](',\x0a');return _0x3ec756(0x1da)+_0x54e31f[_0x3ec756(0x23c)]+_0x3ec756(0x14a)+_0x54e31f[_0x3ec756(0x1bc)]+_0x3ec756(0x1a3)+_0x54e31f['parent_id']+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x54e31f[_0x3ec756(0x132)][_0x3ec756(0x1d4)]+_0x3ec756(0x1f7)+_0xb79fcf(_0x54e31f[_0x3ec756(0x132)][_0x3ec756(0x165)])[_0x3ec756(0x1f0)](/^/gm,'\x20\x20')['trim']()+_0x3ec756(0x26c)+_0x18e27f+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x20d);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x1a8);async['execute'](_0x5560f4){const _0x34015b=a26_0x159e1d,{options:_0x52d5af,args:_0xd89a08,tdx:_0x11d111}=_0x5560f4,_0xfd1537=_0xd89a08[0x0]||_0x52d5af[_0x34015b(0x14b)];if(!_0xfd1537)return showParentSegmentNotSetError(_0x34015b(0x1bf)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x52d5af[_0x34015b(0x1e8)]&&(console['error'](_0x34015b(0x1d0)+_0x52d5af[_0x34015b(0x18e)]),console[_0x34015b(0x14c)](_0x34015b(0x200)+_0xfd1537));const _0x27f587=await withSpinner(_0x34015b(0x184)+_0xfd1537+'\x27...',()=>_0x11d111[_0x34015b(0x1fc)][_0x34015b(0x14f)](_0xfd1537),{'verbose':_0x52d5af[_0x34015b(0x1e8)]}),_0x33bf93=_0x27f587[_0x34015b(0x172)],_0x2dae97=await withSpinner(_0x34015b(0x253)+_0xfd1537+_0x34015b(0x11b),()=>_0x11d111['segment'][_0x34015b(0x25e)](_0x33bf93),{'verbose':_0x52d5af['verbose']}),_0x4d10bd=_0x2dae97[_0x34015b(0x172)];return _0x52d5af[_0x34015b(0x25b)]===_0x34015b(0x205)||_0x52d5af[_0x34015b(0x25b)]===_0x34015b(0x123)?await handleSDKOutput([{'sql':_0x4d10bd}],_0x52d5af):console['log'](_0x4d10bd),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x24b);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x202);async[a26_0x159e1d(0x157)](_0x365a4d){const _0x504912=a26_0x159e1d,{options:_0x1fd37e,args:_0x2c02d8,tdx:_0x447526}=_0x365a4d,_0x10e742=_0x2c02d8[0x0]||_0x1fd37e[_0x504912(0x14b)];if(!_0x10e742)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x1fd37e[_0x504912(0x1e8)]&&(console['error'](_0x504912(0x1d0)+_0x1fd37e[_0x504912(0x18e)]),console['error'](_0x504912(0x200)+_0x10e742));const _0x5a605d=await withSpinner(_0x504912(0x184)+_0x10e742+_0x504912(0x11b),()=>_0x447526[_0x504912(0x1fc)]['resolveParentId'](_0x10e742),{'verbose':_0x1fd37e[_0x504912(0x1e8)]}),_0x493815=_0x5a605d[_0x504912(0x172)],_0x2604ae=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x10e742+_0x504912(0x11b),()=>_0x447526[_0x504912(0x1fc)][_0x504912(0x25e)](_0x493815),{'verbose':_0x1fd37e[_0x504912(0x1e8)]});let _0x1e6d0a=_0x2604ae[_0x504912(0x172)];const _0x37ec1=resolveLimit(_0x1fd37e['limit'],DEFAULT_DISPLAY_LIMIT),_0x5be762=/\bLIMIT\s+\d+/i[_0x504912(0x1e3)](_0x1e6d0a);!_0x5be762&&(_0x1e6d0a=_0x1e6d0a[_0x504912(0x193)]()['replace'](/;+$/,''),_0x1e6d0a=_0x504912(0x26a)+_0x1e6d0a+_0x504912(0x1e2)+_0x37ec1);_0x1fd37e[_0x504912(0x1e8)]&&console[_0x504912(0x14c)]('SQL\x20query:\x0a'+_0x1e6d0a);const _0x198dc9=await withProgressSpinner(_0x504912(0x25d),async _0x592c73=>{const _0x57cccd=_0x504912,_0x12cd82=await _0x447526[_0x57cccd(0x24a)][_0x57cccd(0x157)](_0x1e6d0a,{'catalog':'td','schema':_0x57cccd(0x198),'onJobId':_0x26c753=>{const _0x5e3e59=_0x57cccd;_0x592c73[_0x5e3e59(0x27b)](_0x26c753);}});return _0x12cd82;},{'verbose':_0x1fd37e[_0x504912(0x1e8)]}),_0xea4116=_0x198dc9[_0x504912(0x172)],_0x2958df=_0xea4116[_0x504912(0x275)]?_0x504912(0x13d)+_0xea4116[_0x504912(0x275)]+']':'';return console[_0x504912(0x14c)]('✔\x20Query\x20completed:\x20Processed\x20'+_0xea4116[_0x504912(0x243)]['processedRows'][_0x504912(0x109)]()+_0x504912(0x1a0)+(_0x504912(0x158)+formatElapsed(_0xea4116[_0x504912(0x243)][_0x504912(0x19d)])+_0x2958df)),await handleQueryOutput(_0xea4116,_0x1fd37e),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x150);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x177);async[a26_0x159e1d(0x157)](_0x330a53){const _0x5f50eb=a26_0x159e1d,{options:_0x296382,args:_0x4362b1,tdx:_0x7087b9}=_0x330a53,_0x4c0a9d=_0x4362b1[0x0],_0x2c4467=await withSpinner(_0x4c0a9d?_0x5f50eb(0x22a)+_0x4c0a9d+_0x5f50eb(0x11b):_0x5f50eb(0x20a),()=>_0x7087b9['realtime'][_0x5f50eb(0x146)](),{'verbose':_0x296382[_0x5f50eb(0x1e8)]});let _0x5e4571=_0x2c4467[_0x5f50eb(0x172)][_0x5f50eb(0x1e0)](_0x49713d=>_0x49713d[_0x5f50eb(0x204)]);if(_0x4c0a9d){const _0x4de236=_0x4c0a9d['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x235537=new RegExp('^'+_0x4de236+'$','i');_0x5e4571=_0x5e4571['filter'](_0x100719=>_0x235537[_0x5f50eb(0x1e3)](_0x100719[_0x5f50eb(0x183)]));}_0x5e4571['sort']((_0x14e26b,_0x49a15b)=>_0x14e26b[_0x5f50eb(0x183)][_0x5f50eb(0x162)](_0x49a15b[_0x5f50eb(0x183)])),console['error'](_0x5f50eb(0x156)+_0x5e4571['length']+_0x5f50eb(0x169)+(_0x5e4571[_0x5f50eb(0x133)]!==0x1?'s':''));const _0x5c1565=_0x528b0e=>{const _0x38cc38=_0x5f50eb;return getConsoleNextUrl(_0x296382[_0x38cc38(0x18e)],_0x38cc38(0x235)+_0x528b0e);};if(_0x296382[_0x5f50eb(0x25b)]===_0x5f50eb(0x205)||_0x296382[_0x5f50eb(0x25b)]===_0x5f50eb(0x123)){const _0x4c4cd2=_0x5e4571['map'](_0xadc367=>({..._0xadc367,'url':_0x5c1565(_0xadc367['id'])}));await handleSDKOutput(_0x4c4cd2,_0x296382);}else{if(_0x5e4571['length']===0x0)console[_0x5f50eb(0x273)](_0x5f50eb(0x1d9));else for(const _0x23a51c of _0x5e4571){const _0x5b3489=_0x23a51c[_0x5f50eb(0x10f)]?a26_0x3cea6c['dim']('\x20('+formatRows(_0x23a51c[_0x5f50eb(0x10f)])+')'):'',_0x2faf4d=hyperlink(_0x23a51c[_0x5f50eb(0x183)],_0x5c1565(_0x23a51c['id']));console[_0x5f50eb(0x273)]('⚡\x20'+_0x2faf4d+_0x5b3489);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x1b1);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x219);async[a26_0x159e1d(0x157)](_0x1f1e0a){const _0x5900ef=a26_0x159e1d,{options:_0xa6915a,args:_0x3b1997,tdx:_0x3491d4}=_0x1f1e0a,_0x40d7ef=_0x3b1997[0x0]||_0xa6915a[_0x5900ef(0x14b)];if(!_0x40d7ef)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+_0x5900ef(0x186)),0x1;const _0x3cf674=resolveYamlFile(_0x40d7ef);if(!existsSync(_0x3cf674))return showFileNotFoundError(_0x3cf674,_0x40d7ef),0x1;let _0x55b078;try{_0x55b078=readFileSync(_0x3cf674,_0x5900ef(0x1ce));}catch(_0x45b36a){const _0xa6a15f=_0x45b36a instanceof Error?_0x45b36a['message']:String(_0x45b36a);return console[_0x5900ef(0x14c)]('Error\x20reading\x20file:\x20'+_0xa6a15f),0x1;}const _0x5b611d=createCommandSpinner(a26_0x3cea6c['dim'](_0x5900ef(0x234)),{'verbose':_0xa6915a[_0x5900ef(0x1e8)]});_0x5b611d[_0x5900ef(0x107)]();const _0x3b4016={'realtime':!![],'onProgress':_0x83ea6d=>{const _0x19e7e2=_0x5900ef;_0x5b611d[_0x19e7e2(0x155)]=formatProgressMessage(_0x83ea6d);}};let _0x19afcb;try{_0x19afcb=await _0x3491d4[_0x5900ef(0x1fc)][_0x5900ef(0x254)](_0x55b078,_0x3b4016),_0x5b611d[_0x5900ef(0x215)]();}catch(_0x32f5e8){_0x5b611d['stop']();throw _0x32f5e8;}console[_0x5900ef(0x14c)]('\x0a'+a26_0x3cea6c[_0x5900ef(0x18a)](_0x5900ef(0x116))+'\x20'+_0x19afcb[_0x5900ef(0x183)]),console[_0x5900ef(0x14c)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x19afcb),console[_0x5900ef(0x14c)]('─'['repeat'](0x3c));if(_0x19afcb[_0x5900ef(0x220)][_0x5900ef(0x133)]>0x0){console['error']('\x0a'+a26_0x3cea6c['red']('Errors:'));for(const _0x5e96a7 of _0x19afcb[_0x5900ef(0x220)]){console[_0x5900ef(0x14c)]('\x20\x20'+a26_0x3cea6c[_0x5900ef(0x247)]('•')+'\x20'+_0x5e96a7);}}return _0x19afcb[_0x5900ef(0x113)]&&console[_0x5900ef(0x14c)]('\x0a'+a26_0x3cea6c[_0x5900ef(0x274)]('✔')+_0x5900ef(0x1f3)),_0x19afcb['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x159e1d(0x183)]=a26_0x159e1d(0x1b7);[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x1fd);async[a26_0x159e1d(0x157)](_0x5082a4){const _0x35be01=a26_0x159e1d,{options:_0x1128b1,args:_0x1d8848,tdx:_0x34c8af}=_0x5082a4,_0x2190c6=_0x1d8848[0x0]||_0x1128b1[_0x35be01(0x14b)];if(!_0x2190c6)return showParentSegmentNotSetError(_0x35be01(0x25a)+_0x35be01(0x148)),0x1;const _0x2141e1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2190c6+_0x35be01(0x11b),()=>_0x34c8af['segment'][_0x35be01(0x14f)](_0x2190c6),{'verbose':_0x1128b1[_0x35be01(0x1e8)]}),_0x1327c1=_0x2141e1['data'],_0x548793=await withSpinner(_0x35be01(0xf8)+_0x2190c6+_0x35be01(0x11b),()=>_0x34c8af['personalization'][_0x35be01(0x146)](_0x1327c1),{'verbose':_0x1128b1['verbose']}),_0x2c1851=_0x548793[_0x35be01(0x172)];console[_0x35be01(0x14c)]('✔\x20Found\x20'+_0x2c1851[_0x35be01(0x133)]+_0x35be01(0x21f)+(_0x2c1851[_0x35be01(0x133)]!==0x1?'s':''));if(_0x1128b1[_0x35be01(0x25b)]==='json'||_0x1128b1['format']===_0x35be01(0x123))await handleSDKOutput(_0x2c1851,_0x1128b1);else{if(_0x2c1851[_0x35be01(0x133)]===0x0)console['log'](_0x35be01(0x257)),console[_0x35be01(0x14c)](a26_0x3cea6c['cyan']('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x54d0b3 of _0x2c1851){const _0x5963e9=_0x54d0b3[_0x35be01(0x1f2)]?.[_0x35be01(0x133)]||0x0,_0x41d319=_0x54d0b3[_0x35be01(0x141)]?a26_0x3cea6c[_0x35be01(0x117)]('\x20trigger='+_0x54d0b3[_0x35be01(0x141)]):'',_0x21979a=a26_0x3cea6c[_0x35be01(0x117)]('\x20('+_0x5963e9+_0x35be01(0x24d)+(_0x5963e9!==0x1?'s':'')+')');console[_0x35be01(0x273)]('\x20\x20'+_0x54d0b3[_0x35be01(0x183)]+_0x41d319+_0x21979a),_0x54d0b3[_0x35be01(0x1d8)]&&console[_0x35be01(0x273)](_0x35be01(0x13c)+a26_0x3cea6c[_0x35be01(0x117)](_0x54d0b3[_0x35be01(0x1d8)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x159e1d(0x183)]='ps:pz:init';[a26_0x159e1d(0x1d8)]=a26_0x159e1d(0x1a9);async[a26_0x159e1d(0x157)](_0x41fb10){const _0x545d1f=a26_0x159e1d,{options:_0x83c075,args:_0x471b12}=_0x41fb10,_0x13014d=_0x471b12[0x0]||_0x83c075['parentSegment'];if(!_0x13014d)return showParentSegmentNotSetError(_0x545d1f(0x22b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x59ed4f=resolveYamlFile(_0x13014d);if(!existsSync(_0x59ed4f))return showFileNotFoundError(_0x59ed4f,_0x13014d),0x1;let _0x202777;try{_0x202777=readFileSync(_0x59ed4f,_0x545d1f(0x1ce));}catch(_0x10c121){const _0x39e7a1=_0x10c121 instanceof Error?_0x10c121[_0x545d1f(0x26f)]:String(_0x10c121);return console[_0x545d1f(0x14c)](_0x545d1f(0x147)+_0x39e7a1),0x1;}let _0x496043;try{_0x496043=parseDef(_0x202777);}catch(_0x1fa57f){const _0x21173b=_0x1fa57f instanceof Error?_0x1fa57f[_0x545d1f(0x26f)]:String(_0x1fa57f);return console[_0x545d1f(0x14c)](a26_0x3cea6c[_0x545d1f(0x247)]('Error\x20parsing\x20YAML:\x20'+_0x21173b)),0x1;}if(_0x496043['personalization_services']&&_0x496043[_0x545d1f(0x111)][_0x545d1f(0x133)]>0x0)return console['error'](a26_0x3cea6c[_0x545d1f(0x1ea)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x59ed4f)),console[_0x545d1f(0x14c)](a26_0x3cea6c[_0x545d1f(0x117)](_0x545d1f(0x110)+_0x496043['personalization_services']['length']+_0x545d1f(0x137))),0x1;!_0x496043['realtime']&&(_0x496043['realtime']={'events':[{'name':_0x545d1f(0x1a1),'source_table':_0x545d1f(0x168)}],'attributes':[{'name':_0x545d1f(0x27e),'type':_0x545d1f(0x1ab)}],'id_stitching':{'primary_key':_0x496043[_0x545d1f(0x1fa)][_0x545d1f(0x1d4)]===_0x545d1f(0x132)?'td_client_id':'user_id'}});_0x496043['personalization_services']=[{'name':_0x545d1f(0x136),'description':_0x545d1f(0x139),'trigger_event':_0x545d1f(0x1a1),'sections':[{'name':_0x545d1f(0x1b0),'criteria':_0x545d1f(0x191),'attributes':[_0x545d1f(0x27e)]}]}];const _0xa7d00=serializeDef(_0x496043);return writeFileSync(_0x59ed4f,_0xa7d00,'utf-8'),console[_0x545d1f(0x14c)](a26_0x3cea6c[_0x545d1f(0x274)]('✔')+_0x545d1f(0x17d)+a26_0x3cea6c[_0x545d1f(0x263)](_0x59ed4f)),(!_0x496043[_0x545d1f(0x187)]||_0x202777[_0x545d1f(0x22f)](_0x545d1f(0x159))===-0x1)&&console[_0x545d1f(0x14c)](a26_0x3cea6c[_0x545d1f(0x274)]('✔')+_0x545d1f(0x15e)),console[_0x545d1f(0x14c)]('\x0a'+a26_0x3cea6c[_0x545d1f(0x117)](_0x545d1f(0x1e9))),console[_0x545d1f(0x14c)](_0x545d1f(0x21c)+_0x59ed4f+_0x545d1f(0x1aa)),console[_0x545d1f(0x14c)]('\x20\x202.\x20Run\x20'+a26_0x3cea6c[_0x545d1f(0x117)](_0x545d1f(0x246)+_0x13014d)+_0x545d1f(0x1cb)),0x0;}}
1
+ const a29_0x56289a=a29_0x2646;(function(_0x58081c,_0x22024f){const _0x15c014=a29_0x2646,_0x30d65e=_0x58081c();while(!![]){try{const _0x30f2e9=-parseInt(_0x15c014(0x1b1))/0x1+parseInt(_0x15c014(0x231))/0x2+-parseInt(_0x15c014(0x20c))/0x3*(parseInt(_0x15c014(0x238))/0x4)+parseInt(_0x15c014(0x268))/0x5+parseInt(_0x15c014(0x2b9))/0x6*(parseInt(_0x15c014(0x28d))/0x7)+parseInt(_0x15c014(0x289))/0x8*(parseInt(_0x15c014(0x223))/0x9)+parseInt(_0x15c014(0x1df))/0xa*(parseInt(_0x15c014(0x185))/0xb);if(_0x30f2e9===_0x22024f)break;else _0x30d65e['push'](_0x30d65e['shift']());}catch(_0x4e5568){_0x30d65e['push'](_0x30d65e['shift']());}}}(a29_0x521e,0x1f18a));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0xc4a697 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a29_0x521e(){const _0x8269fc=['segment:parent:preview','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','site','sections','realtime:','18072pSytkd','behavior','length','red','ignore','\x20Configuration\x20is\x20valid','idStitching','\x20No\x20changes\x20-\x20','Output\x20Database:','unref','keys','segment:parent:push','\x20parent\x20segment\x20\x27','jobId','Behaviors','/attempt/','\x20to\x20configure\x20your\x20personalization\x20service','\x20Added\x20personalization\x20template\x20to\x20','personalizationServices','\x20RT-enabled\x20parent\x20segment','runParent','apply','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','label','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','\x0aUsage:\x20tdx\x20ps\x20preview\x20','No\x20RT-enabled\x20parent\x20segments\x20found','Available\x20attributes:','Parent\x20segment:\x20','events','ps:rt:validate','repeat','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Site:\x20','toLowerCase','\x20\x20\x20\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Show\x20parent\x20segment\x20details','Behavior:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','cyan','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','customerGroup','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20Created\x20parent\x20segment\x20\x27','FINISHED','77610DuFoga','\x20--enriched','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','audienceId','getParentFull','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Error\x20parsing\x20YAML:\x20','\x20tdx\x20wf\x20attempt\x20','getParentSQL','/app/workflows/','localeCompare','format','\x27\x20is\x20already\x20up\x20to\x20date','✔\x20Query\x20completed:\x20Processed\x20','👥\x20','Customers:','Enriched:','RT\x202.0\x20Validate:','Updated','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','yellow','green','.yaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','getOutputDatabaseName','trim','customers','rowCount','Listing\x20parent\x20segments\x20matching\x20\x27','Apply\x20changes\x20to\x20\x27','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','name','.yml','1176NsUKiZ','segment:parent:desc','displayPreviewResults','RT\x202.0:','54313wgVtRI','using\x20the\x20default\x20path:\x20','master','Listing\x20parent\x20segments...','description','coveragePercent','\x20\x20Tables:\x201\x20customers\x20+\x20','getBehaviorNames','Attempt:','attribute','\x20\x20\x20\x20\x20\x20','Next\x20steps:','\x20rows\x20','single','page_view','\x20to\x20push\x20the\x20configuration','\x20--behavior\x20\x22<name>\x22','start','valid','\x22,\x20\x22type\x22:\x20\x22','displayAttributesStats','\x27...','/\x20directories\x20exist.','\x20kill','\x20rows)','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','stitchingKeys','✔\x20No\x20changes\x20-\x20\x27','table','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','To\x20cancel:','<database>.<table>','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','Options:','scheduleOption','Fetching\x20sample\x20data...','Source:','customersWithEvents','Fetching\x20behavior\x20list...','true','column_type','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','verbose','type','126ILOPny','✔\x20Renamed\x20directory\x20to\x20','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Resolving\x20parent\x20segment\x20\x27','Updating','double','Events:','primaryKey','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20\x20','Personalization:','endsWith','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20--interval\x20','errors','join','number','user_id','Database:\x20','\x20--attribute\x20\x22<name>\x22','toFixed','Validating\x20RT\x20configuration...','/app/dw/parentSegments/','dim','execute','parent_segments','message','resolveParentId','stats','\x20is\x20already\x20up\x20to\x20date','Listing\x20RT-enabled\x20parent\x20segments...','displayRealtimeInfo','✘\x20Failed\x20to\x20rename\x20directory:\x20','stop','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Available\x20behaviors:','workflowSessionId','enabled','behaviors','Join\x20on:','population','Fetching\x20customers\x20schema...','segment:parent:run','Status:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','map','Fetching\x20parent\x20segment\x20\x27','json','\x20\x20\x20\x20-\x20','\x27\x20with\x20ID:\x20','Master:','Attributes','use','\x20Context\x20set:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','column','\x0a\x20\x20]\x0a}\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','segment:parent:pull','addBehaviors','output','indexOf','/\x20→\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x0a\x20\x20\x20\x20]','jsonl','tdx\x20ps\x20preview\x20','\x0a✔\x20Workflow\x20started','ID\x20Stitching:','My\x20Service','addAttributes','run','305723QxcgIH','personalization_services','No\x20parent\x20segments\x20found','Analyzing\x20changes...','Schema\x20saved\x20to\x20','\x20--behavior\x20\x22','yes','customerGroupFile','Preview:','darwin','/{name}.yml\x0a','Fetching\x20SQL\x20for\x20\x27','\x20=\x20','processedRows','preview','sampleData','information_schema','Creating\x20parent\x20segment\x20\x27','⚡\x20Enabled','{\x0a\x20\x20\x22database\x22:\x20\x22','limit','Creating','\x20--attribute\x20\x22','Table:\x20','customerPercent','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','realtime','isDirectory','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','previewParentYaml','data','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','⚡\x20Not\x20enabled','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','matchedCount','string','tdx\x20ps\x20push\x20','\x20Added\x20RT\x202.0\x20template\x20section','\x0a⚠️\x20\x20Migrating:\x20','workflowId','timezone','replace','48594CGLgam','bold','.customers)','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayValidateResults','\x0aError:','\x0aNo\x20sample\x20data\x20available','interval','joinKey','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','log','/\x20and\x20','`\x20to\x20download\x20the\x20configuration\x20first','displaySampleData','list','text','open','displayPreviewHints','Join:','Columns:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','segment','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','sourceTableError','attributes','validateParentYaml','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','parent_segment','segment:parent:show','in\x20','Found\x20YAML\x20file:\x20','push','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','error','attributesFile','Error:\x20File\x20not\x20found:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Options:\x0a','\x27\x20is\x20up\x20to\x20date','\x20[Job\x20ID:\x20','totalEvents','SELECT\x20*\x20FROM\x20(\x0a','\x20section','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','40DhJFwQ','No\x20personalization\x20services\x20configured','\x5c$&','columns','Error\x20reading\x20file:\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','allValid','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20Database:\x20','enriched','SELECT\x20*\x20FROM\x20','schemaError','Created','formatSchemaJson','pushParentYaml','List\x20parent\x20segments','YAML\x20file:\x20','foreignKey','elapsedTimeMillis','\x20\x20Note:\x20','workflowAttemptId','\x22\x20}','displaySummary','schemaValid','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','column_name','\x27\x20and\x20run\x20workflow?','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','td_client_id','sort','To\x20view\x20sample\x20data:','displayBehaviorsStats','Aborted.','last_page_viewed','segment:parent:view','Overwrite\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Create\x20parent\x20segment\x20\x27','Options\x20(one\x20required):\x0a','segment:parent:validate','segment:parent:list','trigger_event','Errors:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','listParents','156egbyoA','List\x20available\x20fields\x20for\x20segmentation','Name:\x20','displayMasterInfo','Attributes:','test','scheduleType','\x20behaviors','addAttributesFile','\x0aNew\x20parent\x20segment\x20\x27','all','database','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','displayColumns','\x20personalization\x20service','ps:rt:list','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','parent_id','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','segment:parent:update','Validating\x20configuration...','2349HIeDfQ','\x20\x20Columns:\x20','behavior_','dirname','\x0a⚠️\x20\x20Both\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','parentSegment','filter','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','utf-8','segment:parent:create','%)\x20','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','collectSchema','165800NldibJ','✔\x20Found\x20'];a29_0x521e=function(){return _0x8269fc;};return a29_0x521e();}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,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a29_0xe68e55 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=a29_0x56289a(0x2db),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x9da9f0){const _0x40f77a=a29_0x56289a,_0x79d305=process['platform'],_0x59a606=_0x79d305===_0x40f77a(0x18e)?_0x40f77a(0x1c1):_0x79d305==='win32'?_0x40f77a(0x29e):'xdg-open';spawn(_0x59a606,[_0x9da9f0],{'detached':!![],'stdio':_0x40f77a(0x23c)})[_0x40f77a(0x241)]();}function migrateLegacyDirectory(){const _0x28790b=a29_0x56289a;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3bdfe1=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3bdfe1[_0x28790b(0x1a1)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x28790b(0x1d2)](a29_0xe68e55[_0x28790b(0x27c)](_0x28790b(0x227)+LEGACY_PARENT_SEGMENT_DIR+_0x28790b(0x1bc)+PARENT_SEGMENT_DIR+_0x28790b(0x2a3))),console['error'](a29_0xe68e55['dim'](_0x28790b(0x1ba)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x28790b(0x1d2)](a29_0xe68e55[_0x28790b(0x27c)](_0x28790b(0x1ad)+LEGACY_PARENT_SEGMENT_DIR+_0x28790b(0x17a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x28790b(0x1d2)](a29_0xe68e55['green'](_0x28790b(0x2ba)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4dd3fc){const _0x414944=_0x4dd3fc instanceof Error?_0x4dd3fc['message']:String(_0x4dd3fc);return console[_0x28790b(0x1d2)](a29_0xe68e55[_0x28790b(0x23b)](_0x28790b(0x2e2)+_0x414944+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x56289a(0x184)](_0x45cc83){const _0x5b1fde=a29_0x56289a;return migrateLegacyDirectory(),super[_0x5b1fde(0x184)](_0x45cc83);}}function resolveYamlFile(_0x589594){const _0xddbdb4=a29_0x56289a;if(_0x589594[_0xddbdb4(0x2cc)]('.yml')||_0x589594[_0xddbdb4(0x2cc)](_0xddbdb4(0x27e)))return _0x589594;return a29_0xc4a697[_0xddbdb4(0x2d1)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x589594)+_0xddbdb4(0x288));}function formatProgressMessage(_0x18e116){const _0x367904=a29_0x56289a,_0x2cac20=_0x18e116['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2cac20){const [,_0xd25144,_0x29e17e,_0x2f0bed='']=_0x2cac20;return a29_0xe68e55[_0x367904(0x2d9)](_0xd25144+':')+'\x20'+_0x29e17e+a29_0xe68e55[_0x367904(0x2d9)](_0x2f0bed);}return a29_0xe68e55['dim'](_0x18e116);}function showFileNotFoundError(_0x1bfdd1,_0x46610a){const _0x1c88f2=a29_0x56289a;console['error'](a29_0xe68e55['red'](_0x1c88f2(0x1d4)+_0x1bfdd1+'\x0a')),console[_0x1c88f2(0x1d2)](a29_0xe68e55[_0x1c88f2(0x262)](_0x1c88f2(0x1e4)+_0x46610a+_0x1c88f2(0x1bd)));}function displayRealtimeValidation(_0x201a54){const _0x1cf497=a29_0x56289a;if(!_0x201a54[_0x1cf497(0x1a0)])return;const _0x137da4=_0x201a54[_0x1cf497(0x1a0)],_0x4407e2=_0x137da4[_0x1cf497(0x2e7)]?a29_0xe68e55[_0x1cf497(0x27d)](_0x1cf497(0x197)):a29_0xe68e55[_0x1cf497(0x27c)](_0x1cf497(0x1a7));console[_0x1cf497(0x1d2)]('\x0a'+a29_0xe68e55[_0x1cf497(0x2d9)](_0x1cf497(0x28c))+'\x20'+_0x4407e2);if(_0x137da4[_0x1cf497(0x255)]&&_0x137da4[_0x1cf497(0x255)]['length']>0x0){console['error']('\x20\x20'+a29_0xe68e55[_0x1cf497(0x2d9)](_0x1cf497(0x2c5))+'\x20'+_0x137da4[_0x1cf497(0x255)][_0x1cf497(0x23a)]+'\x20configured');for(const _0x5eedb5 of _0x137da4[_0x1cf497(0x255)]){const _0x5dc7b3=_0x5eedb5['sourceTableValid']===![]?a29_0xe68e55[_0x1cf497(0x23b)]('✘'):a29_0xe68e55[_0x1cf497(0x27d)]('✔');console[_0x1cf497(0x1d2)](_0x1cf497(0x25d)+_0x5dc7b3+'\x20'+_0x5eedb5['name']),_0x5eedb5[_0x1cf497(0x1c8)]&&console[_0x1cf497(0x1d2)](_0x1cf497(0x297)+a29_0xe68e55[_0x1cf497(0x23b)](_0x5eedb5[_0x1cf497(0x1c8)]));}}if(_0x137da4[_0x1cf497(0x1c9)]&&_0x137da4['attributes'][_0x1cf497(0x23a)]>0x0){console[_0x1cf497(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x1cf497(0x2d9)](_0x1cf497(0x210))+'\x20'+_0x137da4[_0x1cf497(0x1c9)][_0x1cf497(0x23a)]+'\x20configured');for(const _0x54245f of _0x137da4[_0x1cf497(0x1c9)]){const _0x5e727d=_0x54245f[_0x1cf497(0x29f)]?a29_0xe68e55[_0x1cf497(0x27d)]('✔'):a29_0xe68e55[_0x1cf497(0x23b)]('✘');console[_0x1cf497(0x1d2)](_0x1cf497(0x25d)+_0x5e727d+'\x20'+_0x54245f['name']+'\x20'+a29_0xe68e55[_0x1cf497(0x2d9)]('('+_0x54245f['type']+')'));}}if(_0x137da4[_0x1cf497(0x23e)]){const _0x320477=_0x137da4[_0x1cf497(0x23e)][_0x1cf497(0x2a7)]?.[_0x1cf497(0x23a)]?'\x20+\x20['+_0x137da4['idStitching'][_0x1cf497(0x2a7)][_0x1cf497(0x2d1)](',\x20')+']':'';console['error']('\x20\x20'+a29_0xe68e55[_0x1cf497(0x2d9)](_0x1cf497(0x181))+'\x20'+_0x137da4['idStitching'][_0x1cf497(0x2c6)]+_0x320477);}if(_0x137da4[_0x1cf497(0x24a)]&&_0x137da4[_0x1cf497(0x24a)][_0x1cf497(0x23a)]>0x0){console[_0x1cf497(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x1cf497(0x2d9)](_0x1cf497(0x2cb))+'\x20'+_0x137da4[_0x1cf497(0x24a)][_0x1cf497(0x23a)]+'\x20service'+(_0x137da4[_0x1cf497(0x24a)][_0x1cf497(0x23a)]!==0x1?'s':''));for(const _0x4979be of _0x137da4[_0x1cf497(0x24a)]){console[_0x1cf497(0x1d2)](_0x1cf497(0x2f2)+_0x4979be[_0x1cf497(0x287)]);}}}function showParentSegmentNotSetError(_0x113eaf){const _0x137006=a29_0x56289a;console[_0x137006(0x1d2)](a29_0xe68e55[_0x137006(0x27c)](_0x137006(0x25a))),console['error'](_0x113eaf);}function a29_0x2646(_0x13c551,_0x12af59){_0x13c551=_0x13c551-0x170;const _0x521e94=a29_0x521e();let _0x26464e=_0x521e94[_0x13c551];return _0x26464e;}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x56289a(0x207);['description']=a29_0x56289a(0x1ee);async['execute'](_0x5d33aa){const _0x422868=a29_0x56289a,{options:_0x2c5f9d,args:_0x21ca0f,tdx:_0x41dc5c}=_0x5d33aa,_0x518937=_0x21ca0f[0x0];_0x2c5f9d[_0x422868(0x2b7)]&&(console['error'](_0x422868(0x25b)+_0x2c5f9d[_0x422868(0x235)]),_0x518937&&console['error']('Pattern:\x20'+_0x518937));const _0x428605=await withSpinner(_0x518937?_0x422868(0x284)+_0x518937+_0x422868(0x2a2):_0x422868(0x290),()=>_0x41dc5c['segment'][_0x422868(0x20b)](),{'verbose':_0x2c5f9d['verbose']});let _0x9db9ea=_0x428605[_0x422868(0x1a5)];if(_0x518937){const _0xb3a9ef=_0x518937[_0x422868(0x1b0)](/[.+^${}()|[\]\\]/g,_0x422868(0x1e1))['replace'](/\*/g,'.*')[_0x422868(0x1b0)](/\?/g,'.'),_0x49d166=new RegExp('^'+_0xb3a9ef+'$','i');_0x9db9ea=_0x9db9ea[_0x422868(0x22a)](_0x13f3f1=>_0x49d166[_0x422868(0x211)](_0x13f3f1[_0x422868(0x1c9)][_0x422868(0x287)]));}_0x9db9ea['sort']((_0x4b6286,_0x1ed9ae)=>_0x4b6286[_0x422868(0x1c9)]['name']['localeCompare'](_0x1ed9ae[_0x422868(0x1c9)][_0x422868(0x287)])),console[_0x422868(0x1d2)](_0x422868(0x232)+_0x9db9ea['length']+'\x20parent\x20segment'+(_0x9db9ea[_0x422868(0x23a)]!==0x1?'s':''));const _0x59170a=_0x53cdcc=>{const _0x4b25b2=_0x422868;return getConsoleNextUrl(_0x2c5f9d[_0x4b25b2(0x235)],_0x4b25b2(0x2d8)+_0x53cdcc);};if(_0x2c5f9d[_0x422868(0x273)]===_0x422868(0x2f1)||_0x2c5f9d[_0x422868(0x273)]===_0x422868(0x17e)){const _0x3cf399=_0x9db9ea[_0x422868(0x2ef)](_0x520a35=>({..._0x520a35,'url':_0x59170a(_0x520a35['id'])}));await handleSDKOutput(_0x3cf399,_0x2c5f9d);}else{if(_0x9db9ea[_0x422868(0x23a)]===0x0)_0x518937?console[_0x422868(0x1bb)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x518937):console[_0x422868(0x1bb)](_0x422868(0x187));else for(const _0x568f9d of _0x9db9ea){const _0x2ccddf=_0x568f9d[_0x422868(0x1c9)][_0x422868(0x2ea)]?a29_0xe68e55[_0x422868(0x2d9)]('\x20('+formatRows(_0x568f9d[_0x422868(0x1c9)]['population'])+')'):'',_0x519bb9=hyperlink(_0x568f9d[_0x422868(0x1c9)][_0x422868(0x287)],_0x59170a(_0x568f9d['id']));console[_0x422868(0x1bb)](_0x422868(0x276)+_0x519bb9+_0x2ccddf);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x22d);['description']=a29_0x56289a(0x2c7);async[a29_0x56289a(0x2da)](_0x21b1ed){const _0x11fd30=a29_0x56289a,{options:_0x50a200,args:_0x5b8878,tdx:_0x5b4d06}=_0x21b1ed;console[_0x11fd30(0x1d2)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x11fd30(0x203));const _0x5f51a4=_0x50a200;if(_0x5b8878[_0x11fd30(0x23a)]===0x0)return console[_0x11fd30(0x1d2)](a29_0xe68e55[_0x11fd30(0x23b)](_0x11fd30(0x265))),console[_0x11fd30(0x1d2)](_0x11fd30(0x22b)),0x1;const _0x53a8fb=_0x5b8878[0x0];if(!_0x5f51a4[_0x11fd30(0x217)]||!_0x5f51a4['table'])return console[_0x11fd30(0x1d2)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x11fd30(0x1d2)](_0x11fd30(0x22b)),0x1;_0x5f51a4[_0x11fd30(0x2b7)]&&(console[_0x11fd30(0x1d2)](_0x11fd30(0x25b)+_0x5f51a4[_0x11fd30(0x235)]),console['error'](_0x11fd30(0x20e)+_0x53a8fb),console['error'](_0x11fd30(0x2d4)+_0x5f51a4[_0x11fd30(0x217)]),console[_0x11fd30(0x1d2)](_0x11fd30(0x19c)+_0x5f51a4[_0x11fd30(0x2a9)]));const _0x3d5685=await loadJSONFromOptions(_0x5f51a4[_0x11fd30(0x1c9)],_0x5f51a4[_0x11fd30(0x1d3)]),_0xeeac58=await loadJSONFromOptions(_0x5f51a4['behaviors'],_0x5f51a4['behaviorsFile']),_0x168497=await loadJSONFromOptions(_0x5f51a4[_0x11fd30(0x264)],_0x5f51a4[_0x11fd30(0x18c)]),_0x3b2e02={'name':_0x53a8fb,'description':_0x5f51a4[_0x11fd30(0x291)],'scheduleType':_0x5f51a4[_0x11fd30(0x212)],'scheduleOption':_0x5f51a4[_0x11fd30(0x2af)],'timezone':_0x5f51a4[_0x11fd30(0x1af)],'master':{'parentDatabaseName':_0x5f51a4[_0x11fd30(0x217)],'parentTableName':_0x5f51a4[_0x11fd30(0x2a9)]},'attributes':_0x3d5685,'behaviors':_0xeeac58,'customerGroup':_0x168497},_0x596b38=await withSpinner(_0x11fd30(0x196)+_0x53a8fb+_0x11fd30(0x2a2),()=>_0x5b4d06['segment']['createParent'](_0x3b2e02),{'verbose':_0x50a200['verbose']}),_0x234b8a=_0x596b38[_0x11fd30(0x1a5)];return console[_0x11fd30(0x1d2)](_0x11fd30(0x266)+_0x234b8a[_0x11fd30(0x287)]+_0x11fd30(0x2f3)+_0x234b8a['id']),await handleSDKOutput([_0x234b8a],_0x50a200),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x221);['description']=a29_0x56289a(0x26a);async[a29_0x56289a(0x2da)](_0x1556c1){const _0x4d532c=a29_0x56289a,{options:_0x370aae,args:_0x499cf9,tdx:_0x4ae2f6}=_0x1556c1;console['error'](_0x4d532c(0x1d6)+_0x4d532c(0x1f7)+_0x4d532c(0x203));const _0x4d1d80=_0x370aae;if(_0x499cf9['length']===0x0)return console[_0x4d532c(0x1d2)](a29_0xe68e55['red'](_0x4d532c(0x265))),console[_0x4d532c(0x1d2)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x620464=_0x499cf9[0x0];_0x4d1d80[_0x4d532c(0x2b7)]&&(console[_0x4d532c(0x1d2)](_0x4d532c(0x25b)+_0x4d1d80[_0x4d532c(0x235)]),console[_0x4d532c(0x1d2)](_0x4d532c(0x254)+_0x620464));const _0x15b05a=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x620464+_0x4d532c(0x2a2),()=>_0x4ae2f6[_0x4d532c(0x1c6)][_0x4d532c(0x26c)](_0x620464),{'verbose':_0x4d1d80[_0x4d532c(0x2b7)]}),_0x9bc23f=_0x15b05a[_0x4d532c(0x1a5)],_0x4415a1=await loadJSONFromOptions(_0x4d1d80[_0x4d532c(0x183)],_0x4d1d80[_0x4d532c(0x214)]),_0x57c028=await loadJSONFromOptions(_0x4d1d80[_0x4d532c(0x177)],_0x4d1d80['addBehaviorsFile']),_0x597107={'name':_0x9bc23f['name'],'description':_0x4d1d80['description']!==undefined?_0x4d1d80['description']:_0x9bc23f[_0x4d532c(0x291)],'scheduleType':_0x4d1d80[_0x4d532c(0x212)]!==undefined?_0x4d1d80[_0x4d532c(0x212)]:_0x9bc23f[_0x4d532c(0x212)],'scheduleOption':_0x4d1d80[_0x4d532c(0x2af)]!==undefined?_0x4d1d80['scheduleOption']:_0x9bc23f['scheduleOption'],'timezone':_0x4d1d80[_0x4d532c(0x1af)]!==undefined?_0x4d1d80[_0x4d532c(0x1af)]:_0x9bc23f[_0x4d532c(0x1af)],'master':_0x9bc23f['master'],'attributes':_0x4415a1?[..._0x9bc23f[_0x4d532c(0x1c9)]||[],..._0x4415a1]:_0x9bc23f[_0x4d532c(0x1c9)],'behaviors':_0x57c028?[..._0x9bc23f['behaviors']||[],..._0x57c028]:_0x9bc23f[_0x4d532c(0x2e8)],'customerGroup':_0x9bc23f['customerGroup']},_0xabf0ac=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x620464+'\x27...',()=>_0x4ae2f6[_0x4d532c(0x1c6)]['updateParent'](_0x620464,_0x597107),{'verbose':_0x4d1d80['verbose']}),_0x109041=_0xabf0ac[_0x4d532c(0x1a5)];return console[_0x4d532c(0x1d2)](_0x4d532c(0x2c0)+_0x109041['name']+'\x27'),await handleSDKOutput([_0x109041],_0x4d1d80),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x176);[a29_0x56289a(0x291)]=a29_0x56289a(0x21e);async[a29_0x56289a(0x2da)](_0x218d9b){const _0x4c48de=a29_0x56289a,{options:_0x28eed5,args:_0x46fd7a,tdx:_0xcd467c}=_0x218d9b,_0x57dbf1=_0x28eed5,_0x25edb1=_0x46fd7a[0x0]||_0x28eed5[_0x4c48de(0x229)];if(!_0x25edb1)return showParentSegmentNotSetError(_0x4c48de(0x2e4)+_0x4c48de(0x1d5)),0x1;if(_0x57dbf1[_0x4c48de(0x170)]&&_0x57dbf1['output'])return console['error'](a29_0xe68e55[_0x4c48de(0x23b)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x2d9)](_0x4c48de(0x1a3))),console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x2d9)](_0x4c48de(0x28e)+PARENT_SEGMENT_DIR+_0x4c48de(0x18f))),console['error'](a29_0xe68e55[_0x4c48de(0x262)](_0x4c48de(0x228))),0x1;const _0x17d989=_0x57dbf1[_0x4c48de(0x178)]||a29_0xc4a697['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x25edb1)+_0x4c48de(0x288));_0x57dbf1[_0x4c48de(0x2b7)]&&(console[_0x4c48de(0x1d2)]('Site:\x20'+_0x57dbf1[_0x4c48de(0x235)]),console[_0x4c48de(0x1d2)]('Parent\x20segment:\x20'+_0x25edb1),console[_0x4c48de(0x1d2)]('Output\x20file:\x20'+_0x17d989));const _0x42f2cf=await withSpinner(_0x4c48de(0x2f0)+_0x25edb1+_0x4c48de(0x2a2),()=>_0xcd467c[_0x4c48de(0x1c6)]['pullParentYaml'](_0x25edb1),{'verbose':_0x57dbf1[_0x4c48de(0x2b7)]}),_0x3f28b1=_0x42f2cf['data'];if(existsSync(_0x17d989)){const _0x2fb2de=readFileSync(_0x17d989,_0x4c48de(0x22c)),_0x19f371=generateDiff(_0x2fb2de,_0x3f28b1);if(!hasChanges(_0x19f371))console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x27d)]('✔')+_0x4c48de(0x23f)+a29_0xe68e55[_0x4c48de(0x262)](_0x17d989)+_0x4c48de(0x2df));else{console[_0x4c48de(0x1d2)]('\x0aChanges\x20to\x20\x27'+_0x17d989+'\x27:'),console['error']('─'[_0x4c48de(0x257)](0x3c)),console[_0x4c48de(0x1d2)](formatDiffWithColors(_0x19f371)),console[_0x4c48de(0x1d2)]('─'['repeat'](0x3c));if(!_0x57dbf1[_0x4c48de(0x18b)]){if(!isInteractive())return console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x23b)](_0x4c48de(0x1b6)),_0x4c48de(0x19f)),console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x2d9)](_0x4c48de(0x2bd))),0x1;const _0x29b293=await confirmKey(_0x4c48de(0x202)+_0x17d989+'\x27?');if(!_0x29b293)return console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x27c)](_0x4c48de(0x1ff))),0x1;}writeFileSync(_0x17d989,_0x3f28b1,_0x4c48de(0x22c)),console[_0x4c48de(0x1d2)](a29_0xe68e55[_0x4c48de(0x27d)]('✔')+_0x4c48de(0x261)+a29_0xe68e55[_0x4c48de(0x262)](_0x17d989));}}else{const _0x1a575b=a29_0xc4a697[_0x4c48de(0x226)](_0x17d989);!existsSync(_0x1a575b)&&mkdirSync(_0x1a575b,{'recursive':!![]}),writeFileSync(_0x17d989,_0x3f28b1,_0x4c48de(0x22c)),console['error'](a29_0xe68e55[_0x4c48de(0x27d)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a29_0xe68e55[_0x4c48de(0x262)](_0x17d989));}return saveSessionContext({'parent_segment':_0x25edb1},_0x57dbf1['session']),console['error'](a29_0xe68e55[_0x4c48de(0x27d)]('✔')+_0x4c48de(0x171)+a29_0xe68e55[_0x4c48de(0x2d9)](_0x4c48de(0x1cc))+'\x20=\x20'+a29_0xe68e55[_0x4c48de(0x262)](_0x25edb1)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x243);[a29_0x56289a(0x291)]=a29_0x56289a(0x1cb);async[a29_0x56289a(0x2da)](_0x4e1331){const _0x5886e8=a29_0x56289a,{options:_0x2a641e,args:_0x3d9e39,tdx:_0x36d7d0}=_0x4e1331,_0x25d213=_0x2a641e,_0xd08535=_0x3d9e39[0x0]||_0x2a641e['parentSegment'];if(!_0xd08535)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x5886e8(0x259)),0x1;const _0x26803d=resolveYamlFile(_0xd08535);if(!existsSync(_0x26803d))return showFileNotFoundError(_0x26803d,_0xd08535),0x1;_0x25d213[_0x5886e8(0x2b7)]&&(console[_0x5886e8(0x1d2)](_0x5886e8(0x25b)+_0x25d213['site']),console['error'](_0x5886e8(0x1ef)+_0x26803d));let _0x3b1aab;try{_0x3b1aab=readFileSync(_0x26803d,_0x5886e8(0x22c));}catch(_0x3dc277){const _0x531be7=_0x3dc277 instanceof Error?_0x3dc277[_0x5886e8(0x2dc)]:String(_0x3dc277);return console[_0x5886e8(0x1d2)](_0x5886e8(0x1e3)+_0x531be7),0x1;}const _0x731c4f=await withSpinner(_0x5886e8(0x188),()=>_0x36d7d0['segment'][_0x5886e8(0x1ed)](_0x3b1aab),{'verbose':_0x25d213[_0x5886e8(0x2b7)]}),_0xc73008=_0x731c4f[_0x5886e8(0x1a5)],{isNew:_0x3f5712,name:_0x5ce449,hasChanges:_0x1e79ae,diffFormatted:_0x259b0d}=_0xc73008;if(!_0x1e79ae)return console[_0x5886e8(0x1d2)](_0x5886e8(0x2a8)+_0x5ce449+_0x5886e8(0x274)),0x0;_0x3f5712?console[_0x5886e8(0x1d2)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x5ce449+'\x27:'):console[_0x5886e8(0x1d2)](_0x5886e8(0x1dd)+_0x5ce449+'\x27:');console[_0x5886e8(0x1d2)]('─'[_0x5886e8(0x257)](0x3c)),console[_0x5886e8(0x1d2)](_0x259b0d),console[_0x5886e8(0x1d2)]('─'[_0x5886e8(0x257)](0x3c));const _0x7f6485=_0x3f5712?_0x5886e8(0x204)+_0x5ce449+'\x27?':_0x5886e8(0x285)+_0x5ce449+'\x27?';if(!_0x25d213[_0x5886e8(0x18b)]){if(!isInteractive())return console[_0x5886e8(0x1d2)](a29_0xe68e55[_0x5886e8(0x23b)]('\x0aError:'),_0x5886e8(0x19f)),console[_0x5886e8(0x1d2)](a29_0xe68e55[_0x5886e8(0x2d9)](_0x5886e8(0x2bd))),0x1;const _0x48e5c8=await confirmKey(_0x7f6485);if(!_0x48e5c8)return console[_0x5886e8(0x1d2)](a29_0xe68e55[_0x5886e8(0x27c)]('Aborted.')),0x1;}const _0x3d48cd=_0x3f5712?_0x5886e8(0x19a):_0x5886e8(0x2c3),_0x241957=await withSpinner(_0x3d48cd+_0x5886e8(0x244)+_0x5ce449+_0x5886e8(0x2a2),()=>_0xc73008[_0x5886e8(0x24d)](),{'verbose':_0x25d213[_0x5886e8(0x2b7)]}),_0x5f4387=_0x241957[_0x5886e8(0x1a5)],_0x55b99d=getConsoleNextUrl(_0x25d213['site'],_0x5886e8(0x2d8)+_0x5f4387['id']),_0x3686df=_0x3f5712?_0x5886e8(0x1eb):_0x5886e8(0x27a);return console[_0x5886e8(0x1d2)]('✔\x20'+_0x3686df+'\x20parent\x20segment\x20\x27'+_0x5f4387[_0x5886e8(0x287)]+'\x27'),console['error']('\x20\x20'+_0x55b99d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x206);[a29_0x56289a(0x291)]=a29_0x56289a(0x1e6);async[a29_0x56289a(0x2da)](_0x2cb3bd){const _0x1709e8=a29_0x56289a,{options:_0x4333a4,args:_0x57692f,tdx:_0x6674c5}=_0x2cb3bd,_0x337fff=_0x4333a4,_0x1d0078=_0x57692f[0x0]||_0x4333a4[_0x1709e8(0x229)];if(!_0x1d0078)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'+_0x1709e8(0x2c8)+_0x1709e8(0x1d7)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x1709e8(0x286)+_0x1709e8(0x1b4)),0x1;const _0x2c7694=resolveYamlFile(_0x1d0078);if(!existsSync(_0x2c7694))return showFileNotFoundError(_0x2c7694,_0x1d0078),0x1;_0x337fff[_0x1709e8(0x2b7)]&&(console[_0x1709e8(0x1d2)](_0x1709e8(0x25b)+_0x337fff[_0x1709e8(0x235)]),console['error']('YAML\x20file:\x20'+_0x2c7694));let _0x557128;try{_0x557128=readFileSync(_0x2c7694,_0x1709e8(0x22c));}catch(_0x2e3c22){const _0x623ea1=_0x2e3c22 instanceof Error?_0x2e3c22['message']:String(_0x2e3c22);return console[_0x1709e8(0x1d2)](_0x1709e8(0x1e3)+_0x623ea1),0x1;}const _0x467c0a=createCommandSpinner(a29_0xe68e55[_0x1709e8(0x2d9)](_0x1709e8(0x222)),{'verbose':_0x337fff[_0x1709e8(0x2b7)]});_0x467c0a[_0x1709e8(0x29e)]();const _0x49b0db={'onProgress':_0x4595bb=>{const _0x5e08f9=_0x1709e8;_0x467c0a[_0x5e08f9(0x1c0)]=formatProgressMessage(_0x4595bb);}};if(_0x337fff[_0x1709e8(0x28f)])_0x49b0db[_0x1709e8(0x28f)]=!![];if(_0x337fff['enriched'])_0x49b0db[_0x1709e8(0x1e8)]=!![];_0x337fff['attribute']&&(_0x49b0db[_0x1709e8(0x296)]=_0x337fff[_0x1709e8(0x296)]);_0x337fff['behavior']&&(_0x49b0db['behavior']=_0x337fff['behavior']);if(_0x337fff[_0x1709e8(0x1b8)])_0x49b0db[_0x1709e8(0x1b8)]=_0x337fff[_0x1709e8(0x1b8)];let _0x5492aa;try{_0x5492aa=await _0x6674c5['segment']['validateParentYaml'](_0x557128,_0x49b0db),_0x467c0a[_0x1709e8(0x2e3)]();}catch(_0x2d2ef7){_0x467c0a[_0x1709e8(0x2e3)]();throw _0x2d2ef7;}const _0x631bef=_0x337fff['interval']||'-1d';return this[_0x1709e8(0x1b5)](_0x5492aa,_0x49b0db,_0x2c7694,_0x631bef),_0x5492aa[_0x1709e8(0x1e5)]?0x0:0x1;}['displayValidateResults'](_0x4dd964,_0x4667ef,_0x5835bf,_0x3ab1f6){const _0x163877=a29_0x56289a;console[_0x163877(0x1d2)]('\x0a'+a29_0xe68e55[_0x163877(0x1b2)]('Validate:')+'\x20'+_0x4dd964[_0x163877(0x287)]),console['error']('═'[_0x163877(0x257)](0x3c)),this[_0x163877(0x20f)](_0x4dd964);if(typeof _0x4667ef['attribute']===_0x163877(0x1aa)){this['displayAttributesStats'](_0x4dd964),this[_0x163877(0x1f5)](_0x4dd964),this['displayPreviewHints'](_0x5835bf,_0x3ab1f6,_0x163877(0x296),_0x4667ef[_0x163877(0x296)]);return;}if(_0x4667ef['attribute']===!![]){this[_0x163877(0x2a1)](_0x4dd964),this['displaySummary'](_0x4dd964),this[_0x163877(0x1c2)](_0x5835bf,_0x3ab1f6,'attributes');return;}if(typeof _0x4667ef['behavior']===_0x163877(0x1aa)){this[_0x163877(0x1fe)](_0x4dd964,_0x3ab1f6),this[_0x163877(0x1f5)](_0x4dd964),this[_0x163877(0x1c2)](_0x5835bf,_0x3ab1f6,_0x163877(0x239),_0x4667ef[_0x163877(0x239)]);return;}if(_0x4667ef['behavior']===!![]){this[_0x163877(0x1fe)](_0x4dd964,_0x3ab1f6),this[_0x163877(0x1f5)](_0x4dd964),this[_0x163877(0x1c2)](_0x5835bf,_0x3ab1f6,_0x163877(0x2e8));return;}this[_0x163877(0x2a1)](_0x4dd964),this[_0x163877(0x1fe)](_0x4dd964,_0x3ab1f6),this['displayRealtimeInfo'](_0x4dd964),this[_0x163877(0x1f5)](_0x4dd964),this[_0x163877(0x1c2)](_0x5835bf,_0x3ab1f6,_0x163877(0x216));}[a29_0x56289a(0x2e1)](_0x56aa32){displayRealtimeValidation(_0x56aa32);}['displayPreviewHints'](_0x39eb37,_0x502bbe,_0x562374,_0xf0f32d){const _0x3e16bb=a29_0x56289a;console['error']('\x0a'+a29_0xe68e55[_0x3e16bb(0x2d9)](_0x3e16bb(0x1fd)));const _0xf0be09=_0x502bbe!=='-1d'?_0x3e16bb(0x2cf)+_0x502bbe:'';if(_0x562374===_0x3e16bb(0x296)&&_0xf0f32d)console[_0x3e16bb(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x3e16bb(0x2d9)]('tdx\x20ps\x20preview\x20'+_0x39eb37+_0x3e16bb(0x19b)+_0xf0f32d+'\x22'+_0xf0be09));else{if(_0x562374==='behavior'&&_0xf0f32d)console['error']('\x20\x20'+a29_0xe68e55[_0x3e16bb(0x2d9)](_0x3e16bb(0x17f)+_0x39eb37+'\x20--behavior\x20\x22'+_0xf0f32d+'\x22'+_0xf0be09));else(_0x562374===_0x3e16bb(0x1c9)||_0x562374==='all')&&console['error']('\x20\x20'+a29_0xe68e55['dim'](_0x3e16bb(0x17f)+_0x39eb37+_0x3e16bb(0x2d5)+_0xf0be09));}(_0x562374===_0x3e16bb(0x2e8)||_0x562374==='all')&&console[_0x3e16bb(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x3e16bb(0x2d9)](_0x3e16bb(0x17f)+_0x39eb37+_0x3e16bb(0x29d)+_0xf0be09)),_0x562374==='all'&&console[_0x3e16bb(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x3e16bb(0x2d9)](_0x3e16bb(0x17f)+_0x39eb37+_0x3e16bb(0x269)+_0xf0be09));}[a29_0x56289a(0x20f)](_0x1639a8){const _0x438020=a29_0x56289a,{master:_0x18a40f}=_0x1639a8,_0x3e242e=_0x18a40f[_0x438020(0x1f6)]?a29_0xe68e55[_0x438020(0x27d)]('✔'):a29_0xe68e55[_0x438020(0x23b)]('✘');console['error']('\x0a'+a29_0xe68e55[_0x438020(0x2d9)]('Master\x20Table')),console[_0x438020(0x1d2)](_0x3e242e+'\x20'+a29_0xe68e55[_0x438020(0x1b2)](_0x18a40f[_0x438020(0x217)]+'.'+_0x18a40f['table'])),_0x18a40f[_0x438020(0x1f6)]?_0x18a40f[_0x438020(0x283)]!==undefined&&console[_0x438020(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x438020(0x2d9)]('Rows:')+'\x20'+a29_0xe68e55[_0x438020(0x262)](formatRows(_0x18a40f[_0x438020(0x283)]))):console['error']('\x20\x20'+a29_0xe68e55[_0x438020(0x23b)]('Error:')+'\x20'+_0x18a40f['schemaError']);}[a29_0x56289a(0x2a1)](_0x34aa8e){const _0x30ea17=a29_0x56289a;if(_0x34aa8e['attributes'][_0x30ea17(0x23a)]===0x0)return;console[_0x30ea17(0x1d2)]('\x0a'+a29_0xe68e55['dim'](_0x30ea17(0x2f5)));for(const _0x33fe05 of _0x34aa8e[_0x30ea17(0x1c9)]){const _0x4a0d0a=_0x33fe05[_0x30ea17(0x1f6)]?a29_0xe68e55[_0x30ea17(0x27d)]('✔'):a29_0xe68e55['red']('✘');let _0x2807f1='';if(_0x33fe05[_0x30ea17(0x1f6)]&&_0x33fe05[_0x30ea17(0x1a9)]!==undefined&&_0x33fe05[_0x30ea17(0x292)]!==undefined){const _0x3f997b=_0x33fe05[_0x30ea17(0x292)][_0x30ea17(0x2d6)](0x1),_0x4131a1=_0x33fe05['coveragePercent']>=0x50?a29_0xe68e55[_0x30ea17(0x27d)]:_0x33fe05[_0x30ea17(0x292)]>=0x32?a29_0xe68e55['yellow']:a29_0xe68e55['red'];_0x2807f1='\x20'+a29_0xe68e55[_0x30ea17(0x2d9)]('Coverage:')+'\x20'+_0x4131a1(_0x3f997b+'%')+'\x20('+formatRows(_0x33fe05[_0x30ea17(0x1a9)])+_0x30ea17(0x2a5);}console['error'](_0x4a0d0a+'\x20'+a29_0xe68e55[_0x30ea17(0x1b2)](_0x33fe05[_0x30ea17(0x287)])+_0x2807f1),console[_0x30ea17(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x30ea17(0x2d9)](_0x30ea17(0x2b1))+'\x20'+a29_0xe68e55[_0x30ea17(0x1b2)](_0x33fe05[_0x30ea17(0x217)]+'.'+_0x33fe05['table']));const _0x452883=_0x33fe05['joinKey']===_0x33fe05[_0x30ea17(0x1f0)]?a29_0xe68e55[_0x30ea17(0x2d9)](_0x30ea17(0x2e9))+'\x20'+_0x33fe05[_0x30ea17(0x1b9)]:a29_0xe68e55[_0x30ea17(0x2d9)](_0x30ea17(0x1c3))+'\x20'+_0x33fe05[_0x30ea17(0x1b9)]+_0x30ea17(0x191)+_0x33fe05[_0x30ea17(0x1f0)];console[_0x30ea17(0x1d2)]('\x20\x20'+_0x452883),console[_0x30ea17(0x1d2)]('\x20\x20'+a29_0xe68e55['dim'](_0x30ea17(0x1c4))),this['displayColumns'](_0x33fe05[_0x30ea17(0x1e2)]),!_0x33fe05['schemaValid']&&console[_0x30ea17(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x30ea17(0x23b)]('Error:')+'\x20'+_0x33fe05[_0x30ea17(0x1ea)]);}}[a29_0x56289a(0x1fe)](_0x2c2950,_0x43af29){const _0x2ea111=a29_0x56289a;if(_0x2c2950[_0x2ea111(0x2e8)][_0x2ea111(0x23a)]===0x0)return;console[_0x2ea111(0x1d2)]('\x0a'+a29_0xe68e55[_0x2ea111(0x2d9)](_0x2ea111(0x246))+'\x20'+a29_0xe68e55[_0x2ea111(0x2d9)]('('+_0x43af29+')'));for(const _0x573c46 of _0x2c2950[_0x2ea111(0x2e8)]){const _0x273660=_0x573c46[_0x2ea111(0x1f6)]?a29_0xe68e55[_0x2ea111(0x27d)]('✔'):a29_0xe68e55[_0x2ea111(0x23b)]('✘');let _0x4dcb12='';if(_0x573c46['schemaValid']&&_0x573c46[_0x2ea111(0x2b2)]!==undefined&&_0x573c46[_0x2ea111(0x1da)]!==undefined){const _0x34ec67=_0x573c46[_0x2ea111(0x19d)]?.['toFixed'](0x1)||'?',_0x66b1c5=(_0x573c46[_0x2ea111(0x19d)]??0x0)>=0x32?a29_0xe68e55['green']:(_0x573c46['customerPercent']??0x0)>=0x14?a29_0xe68e55[_0x2ea111(0x27c)]:a29_0xe68e55[_0x2ea111(0x23b)];_0x4dcb12='\x20'+a29_0xe68e55['dim'](_0x2ea111(0x277))+'\x20'+_0x66b1c5(formatRows(_0x573c46[_0x2ea111(0x2b2)]))+'\x20('+_0x34ec67+_0x2ea111(0x22e)+a29_0xe68e55[_0x2ea111(0x2d9)](_0x2ea111(0x2c5))+'\x20'+a29_0xe68e55[_0x2ea111(0x262)](formatRows(_0x573c46[_0x2ea111(0x1da)]));}console[_0x2ea111(0x1d2)](_0x273660+'\x20'+a29_0xe68e55[_0x2ea111(0x1b2)](_0x573c46[_0x2ea111(0x287)])+_0x4dcb12),console['error']('\x20\x20'+a29_0xe68e55[_0x2ea111(0x2d9)]('Source:')+'\x20'+a29_0xe68e55['bold'](_0x573c46[_0x2ea111(0x217)]+'.'+_0x573c46['table']));const _0x3281e2=_0x573c46[_0x2ea111(0x1b9)]===_0x573c46['foreignKey']?a29_0xe68e55[_0x2ea111(0x2d9)](_0x2ea111(0x2e9))+'\x20'+_0x573c46[_0x2ea111(0x1b9)]:a29_0xe68e55['dim']('Join:')+'\x20'+_0x573c46[_0x2ea111(0x1b9)]+_0x2ea111(0x191)+_0x573c46['foreignKey'];console[_0x2ea111(0x1d2)]('\x20\x20'+_0x3281e2),console[_0x2ea111(0x1d2)]('\x20\x20'+a29_0xe68e55['dim']('Columns:')),this[_0x2ea111(0x219)](_0x573c46['columns']),!_0x573c46['schemaValid']&&console[_0x2ea111(0x1d2)]('\x20\x20'+a29_0xe68e55['red']('Error:')+'\x20'+_0x573c46[_0x2ea111(0x1ea)]);}}[a29_0x56289a(0x219)](_0x23e6d9){const _0x2a5d0e=a29_0x56289a;for(const _0x894d9 of _0x23e6d9){_0x894d9[_0x2a5d0e(0x24f)]===_0x894d9['column']||_0x894d9[_0x2a5d0e(0x173)]==='*'?console[_0x2a5d0e(0x1d2)](_0x2a5d0e(0x2f2)+_0x894d9[_0x2a5d0e(0x24f)]):console[_0x2a5d0e(0x1d2)](_0x2a5d0e(0x2f2)+_0x894d9['label']+'\x20'+a29_0xe68e55['dim']('('+_0x894d9[_0x2a5d0e(0x173)]+')'));}}[a29_0x56289a(0x1f5)](_0x587bf6){const _0x173272=a29_0x56289a;console[_0x173272(0x1d2)]('─'[_0x173272(0x257)](0x3c));if(_0x587bf6[_0x173272(0x2d0)][_0x173272(0x23a)]>0x0){console[_0x173272(0x1d2)]('\x0a'+a29_0xe68e55[_0x173272(0x23b)](_0x173272(0x209)));for(const _0x1bf45d of _0x587bf6[_0x173272(0x2d0)]){console[_0x173272(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x173272(0x23b)]('•')+'\x20'+_0x1bf45d);}}_0x587bf6['allValid']&&console[_0x173272(0x1d2)]('\x0a'+a29_0xe68e55[_0x173272(0x27d)]('✔')+_0x173272(0x23d));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a29_0x56289a(0x233);[a29_0x56289a(0x291)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a29_0x56289a(0x2da)](_0x32ce52){const _0x58aef1=a29_0x56289a,{options:_0x2beb86,args:_0x111290,tdx:_0x3c4bb4}=_0x32ce52,_0x7b36ea=_0x2beb86,_0x5b1eba=_0x111290[0x0]||_0x2beb86['parentSegment'];if(!_0x5b1eba)return showParentSegmentNotSetError(_0x58aef1(0x1a8)+_0x58aef1(0x1d1)+_0x58aef1(0x205)+_0x58aef1(0x1a2)+_0x58aef1(0x1de)+_0x58aef1(0x2c9)+_0x58aef1(0x20a)+_0x58aef1(0x1b4)),0x1;if(!_0x7b36ea[_0x58aef1(0x28f)]&&!_0x7b36ea[_0x58aef1(0x296)]&&!_0x7b36ea['behavior']&&!_0x7b36ea[_0x58aef1(0x1e8)])return console[_0x58aef1(0x1d2)](a29_0xe68e55[_0x58aef1(0x23b)](_0x58aef1(0x17c))),console[_0x58aef1(0x1d2)](_0x58aef1(0x234)),console[_0x58aef1(0x1d2)](_0x58aef1(0x2ae)),console[_0x58aef1(0x1d2)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x58aef1(0x1d2)](_0x58aef1(0x2ee)),console[_0x58aef1(0x1d2)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x58aef1(0x263)),0x1;const _0x5cc9a8=resolveYamlFile(_0x5b1eba);if(!existsSync(_0x5cc9a8))return showFileNotFoundError(_0x5cc9a8,_0x5b1eba),0x1;_0x7b36ea[_0x58aef1(0x2b7)]&&(console[_0x58aef1(0x1d2)](_0x58aef1(0x25b)+_0x7b36ea[_0x58aef1(0x235)]),console['error'](_0x58aef1(0x1ef)+_0x5cc9a8));let _0x2be09c;try{_0x2be09c=readFileSync(_0x5cc9a8,_0x58aef1(0x22c));}catch(_0x526044){const _0x5666a8=_0x526044 instanceof Error?_0x526044[_0x58aef1(0x2dc)]:String(_0x526044);return console[_0x58aef1(0x1d2)](_0x58aef1(0x1e3)+_0x5666a8),0x1;}let _0x2546f3;try{_0x2546f3=parseDef(_0x2be09c);}catch(_0x4bd927){const _0x2f9957=_0x4bd927 instanceof Error?_0x4bd927[_0x58aef1(0x2dc)]:String(_0x4bd927);return console['error'](a29_0xe68e55[_0x58aef1(0x23b)](_0x58aef1(0x26e)+_0x2f9957)),0x1;}if(_0x7b36ea[_0x58aef1(0x296)]===!![]||_0x7b36ea[_0x58aef1(0x296)]===''){const _0xf3a16d=_0x2546f3['attributes']?.['map'](_0x58e1d0=>_0x58e1d0['name'])||[];if(_0xf3a16d[_0x58aef1(0x23a)]===0x0)console[_0x58aef1(0x1d2)](a29_0xe68e55[_0x58aef1(0x23b)](_0x58aef1(0x1c5)));else{console[_0x58aef1(0x1d2)](a29_0xe68e55['red'](_0x58aef1(0x19e))),console['error'](_0x58aef1(0x253));for(const _0x27dd70 of _0xf3a16d){console[_0x58aef1(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x58aef1(0x262)](_0x27dd70));}console['error'](_0x58aef1(0x251)+_0x5b1eba+_0x58aef1(0x19b)+_0xf3a16d[0x0]+'\x22');}return 0x1;}if(_0x7b36ea[_0x58aef1(0x239)]===!![]||_0x7b36ea[_0x58aef1(0x239)]===''){const _0x11ab80=_0x2546f3['behaviors']?.['map'](_0x244ee2=>_0x244ee2[_0x58aef1(0x287)])||[];if(_0x11ab80[_0x58aef1(0x23a)]===0x0)console[_0x58aef1(0x1d2)](a29_0xe68e55[_0x58aef1(0x23b)](_0x58aef1(0x2b6)));else{console[_0x58aef1(0x1d2)](a29_0xe68e55[_0x58aef1(0x23b)](_0x58aef1(0x17b))),console[_0x58aef1(0x1d2)](_0x58aef1(0x2e5));for(const _0x300dcd of _0x11ab80){console[_0x58aef1(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x58aef1(0x262)](_0x300dcd));}console[_0x58aef1(0x1d2)](_0x58aef1(0x251)+_0x5b1eba+_0x58aef1(0x18a)+_0x11ab80[0x0]+'\x22');}return 0x1;}const _0x4f6ea1=createCommandSpinner(a29_0xe68e55[_0x58aef1(0x2d9)](_0x58aef1(0x2b0)),{'verbose':_0x7b36ea[_0x58aef1(0x2b7)]});_0x4f6ea1[_0x58aef1(0x29e)]();const _0x4163a4={'onProgress':_0x10a15c=>{const _0x3f8d2a=_0x58aef1;_0x4f6ea1[_0x3f8d2a(0x1c0)]=formatProgressMessage(_0x10a15c);}};if(_0x7b36ea[_0x58aef1(0x28f)])_0x4163a4[_0x58aef1(0x28f)]=!![];if(_0x7b36ea[_0x58aef1(0x296)]&&typeof _0x7b36ea[_0x58aef1(0x296)]===_0x58aef1(0x1aa))_0x4163a4[_0x58aef1(0x296)]=_0x7b36ea['attribute'];if(_0x7b36ea[_0x58aef1(0x239)]&&typeof _0x7b36ea[_0x58aef1(0x239)]===_0x58aef1(0x1aa))_0x4163a4[_0x58aef1(0x239)]=_0x7b36ea['behavior'];if(_0x7b36ea[_0x58aef1(0x1e8)])_0x4163a4[_0x58aef1(0x1e8)]=!![];if(_0x7b36ea[_0x58aef1(0x1b8)])_0x4163a4[_0x58aef1(0x1b8)]=_0x7b36ea[_0x58aef1(0x1b8)];let _0x101415;try{_0x101415=await _0x3c4bb4['segment'][_0x58aef1(0x1a4)](_0x2be09c,_0x4163a4),_0x4f6ea1[_0x58aef1(0x2e3)]();}catch(_0x26533b){_0x4f6ea1[_0x58aef1(0x2e3)]();throw _0x26533b;}return await this[_0x58aef1(0x28b)](_0x101415,{'master':_0x7b36ea[_0x58aef1(0x28f)],'attribute':typeof _0x7b36ea[_0x58aef1(0x296)]===_0x58aef1(0x1aa)?_0x7b36ea[_0x58aef1(0x296)]:undefined,'behavior':typeof _0x7b36ea['behavior']===_0x58aef1(0x1aa)?_0x7b36ea['behavior']:undefined,'enriched':_0x7b36ea[_0x58aef1(0x1e8)]}),_0x101415[_0x58aef1(0x1e5)]?0x0:0x1;}async['displayPreviewResults'](_0x3a910e,_0x295ee1){const _0x4285c0=a29_0x56289a;console[_0x4285c0(0x1d2)]('\x0a'+a29_0xe68e55[_0x4285c0(0x1b2)](_0x4285c0(0x18d))+'\x20'+_0x3a910e[_0x4285c0(0x287)]),console[_0x4285c0(0x1d2)]('═'[_0x4285c0(0x257)](0x3c));if(_0x295ee1[_0x4285c0(0x28f)]&&_0x3a910e[_0x4285c0(0x194)]){const _0x2e180e=a29_0xe68e55[_0x4285c0(0x2d9)](_0x4285c0(0x2f4))+'\x20'+a29_0xe68e55[_0x4285c0(0x1b2)](_0x3a910e[_0x4285c0(0x28f)]['database']+'.'+_0x3a910e[_0x4285c0(0x28f)]['table']);await this['displaySampleData'](_0x2e180e,_0x3a910e[_0x4285c0(0x194)]);}else{if(_0x295ee1[_0x4285c0(0x296)]&&_0x3a910e[_0x4285c0(0x194)]){const _0x15b136=a29_0xe68e55[_0x4285c0(0x2d9)]('Attribute:')+'\x20'+a29_0xe68e55[_0x4285c0(0x1b2)](_0x295ee1[_0x4285c0(0x296)]);await this[_0x4285c0(0x1be)](_0x15b136,_0x3a910e['sampleData']);}else{if(_0x295ee1[_0x4285c0(0x239)]&&_0x3a910e[_0x4285c0(0x194)]){const _0x1f790c=a29_0xe68e55[_0x4285c0(0x2d9)](_0x4285c0(0x260))+'\x20'+a29_0xe68e55[_0x4285c0(0x1b2)](_0x295ee1[_0x4285c0(0x239)]);await this[_0x4285c0(0x1be)](_0x1f790c,_0x3a910e['sampleData']);}else{if(_0x295ee1[_0x4285c0(0x1e8)]&&_0x3a910e[_0x4285c0(0x194)]){const _0x57ef42=a29_0xe68e55[_0x4285c0(0x2d9)](_0x4285c0(0x278))+'\x20'+a29_0xe68e55[_0x4285c0(0x1b2)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x57ef42,_0x3a910e[_0x4285c0(0x194)]);}else!_0x3a910e[_0x4285c0(0x194)]&&console['error'](_0x4285c0(0x1b7));}}}if(_0x3a910e[_0x4285c0(0x2d0)][_0x4285c0(0x23a)]>0x0){console[_0x4285c0(0x1d2)]('─'[_0x4285c0(0x257)](0x3c)),console[_0x4285c0(0x1d2)]('\x0a'+a29_0xe68e55[_0x4285c0(0x23b)](_0x4285c0(0x209)));for(const _0x1ef995 of _0x3a910e['errors']){console[_0x4285c0(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x4285c0(0x23b)]('•')+'\x20'+_0x1ef995);}}}async[a29_0x56289a(0x1be)](_0x15eb81,_0x9da930){const _0x3c8ac4=a29_0x56289a;if(_0x9da930[_0x3c8ac4(0x23a)]===0x0){console[_0x3c8ac4(0x1d2)]('\x0a'+_0x15eb81),console[_0x3c8ac4(0x1d2)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x3c8ac4(0x1d2)]('\x0a'+_0x15eb81);const _0x42b6b1=Object[_0x3c8ac4(0x242)](_0x9da930[0x0])['map'](_0x593f5b=>({'name':_0x593f5b,'type':typeof _0x9da930[0x0][_0x593f5b]===_0x3c8ac4(0x2d2)?_0x3c8ac4(0x2c4):'varchar'})),_0x355870={'queryId':_0x3c8ac4(0x193),'columns':_0x42b6b1,'data':_0x9da930,'stats':{'state':_0x3c8ac4(0x267),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x9da930[_0x3c8ac4(0x23a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x17afc8=formatAsTable(_0x355870,_0x9da930[_0x3c8ac4(0x23a)],!![]);await writeOutput(_0x17afc8,undefined,_0x3c8ac4(0x2a9));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x2ec);['description']=a29_0x56289a(0x2cd);async[a29_0x56289a(0x2da)](_0x5865ab){const _0x1a2440=a29_0x56289a,{options:_0x3b9b07,args:_0x5bcef5,tdx:_0x3c0577}=_0x5865ab,_0x4adfeb=_0x3b9b07,_0x2ec7a6=_0x5bcef5[0x0]||_0x3b9b07['parentSegment'];if(!_0x2ec7a6)return showParentSegmentNotSetError(_0x1a2440(0x2be)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x6dcef5=resolveYamlFile(_0x2ec7a6);if(existsSync(_0x6dcef5)){_0x4adfeb[_0x1a2440(0x2b7)]&&console[_0x1a2440(0x1d2)](_0x1a2440(0x1cf)+_0x6dcef5);let _0x134eaa;try{_0x134eaa=readFileSync(_0x6dcef5,_0x1a2440(0x22c));}catch(_0x1acf58){const _0x2b67b0=_0x1acf58 instanceof Error?_0x1acf58[_0x1a2440(0x2dc)]:String(_0x1acf58);return console[_0x1a2440(0x1d2)](_0x1a2440(0x1e3)+_0x2b67b0),0x1;}const _0x4c255b=await withSpinner(_0x1a2440(0x188),()=>_0x3c0577['segment'][_0x1a2440(0x1ed)](_0x134eaa),{'verbose':_0x4adfeb[_0x1a2440(0x2b7)]}),_0x40a48c=_0x4c255b[_0x1a2440(0x1a5)],{isNew:_0x16155b,name:_0x114208,hasChanges:_0x1325eb,diffFormatted:_0x254552}=_0x40a48c;if(_0x1325eb){_0x16155b?console[_0x1a2440(0x1d2)](_0x1a2440(0x215)+_0x114208+'\x27:'):console[_0x1a2440(0x1d2)](_0x1a2440(0x1dd)+_0x114208+'\x27:');console[_0x1a2440(0x1d2)]('─'[_0x1a2440(0x257)](0x3c)),console['error'](_0x254552),console['error']('─'['repeat'](0x3c));const _0x23b348=_0x16155b?_0x1a2440(0x204)+_0x114208+_0x1a2440(0x1f9):_0x1a2440(0x285)+_0x114208+_0x1a2440(0x1f9);if(!_0x4adfeb[_0x1a2440(0x18b)]){if(!isInteractive())return console['error'](a29_0xe68e55[_0x1a2440(0x23b)](_0x1a2440(0x1b6)),_0x1a2440(0x19f)),console[_0x1a2440(0x1d2)](a29_0xe68e55['dim'](_0x1a2440(0x2bd))),0x1;const _0x38fc0d=await confirmKey(_0x23b348);if(!_0x38fc0d)return console[_0x1a2440(0x1d2)](a29_0xe68e55[_0x1a2440(0x27c)](_0x1a2440(0x1ff))),0x1;}const _0x2270ed=_0x16155b?'Creating':_0x1a2440(0x2c3);await withSpinner(_0x2270ed+_0x1a2440(0x244)+_0x114208+_0x1a2440(0x2a2),()=>_0x40a48c[_0x1a2440(0x24d)](),{'verbose':_0x4adfeb[_0x1a2440(0x2b7)]});const _0x559a03=_0x16155b?'Created':_0x1a2440(0x27a);console['error']('✔\x20'+_0x559a03+_0x1a2440(0x244)+_0x114208+'\x27');}else console['error'](_0x1a2440(0x2a8)+_0x114208+_0x1a2440(0x1d8));}const _0x309a62=await withSpinner(_0x1a2440(0x220)+_0x2ec7a6+'\x27...',()=>_0x3c0577[_0x1a2440(0x1c6)][_0x1a2440(0x24c)](_0x2ec7a6),{'verbose':_0x4adfeb[_0x1a2440(0x2b7)]}),_0x5a0018=_0x309a62['data'],_0x1b8504=getConsoleUrl(_0x4adfeb[_0x1a2440(0x235)],_0x1a2440(0x271)+_0x5a0018[_0x1a2440(0x1ae)]+'/sessions/'+_0x5a0018[_0x1a2440(0x2e6)]+_0x1a2440(0x247)+_0x5a0018[_0x1a2440(0x1f3)]);return console[_0x1a2440(0x1d2)](_0x1a2440(0x180)),console[_0x1a2440(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x1a2440(0x2d9)]('Audience\x20ID:')+'\x20'+_0x5a0018[_0x1a2440(0x26b)]),console[_0x1a2440(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x1a2440(0x2d9)](_0x1a2440(0x2ed))+'\x20'+_0x5a0018['status']),console[_0x1a2440(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x1a2440(0x2d9)]('Session:')+'\x20'+_0x5a0018['workflowSessionId']),console[_0x1a2440(0x1d2)]('\x20\x20'+a29_0xe68e55[_0x1a2440(0x2d9)](_0x1a2440(0x295))+'\x20'+_0x5a0018[_0x1a2440(0x1f3)]),console['error']('\x20\x20'+_0x1b8504),console[_0x1a2440(0x1d2)]('\x0a'+a29_0xe68e55[_0x1a2440(0x2d9)](_0x1a2440(0x2ab))+_0x1a2440(0x26f)+_0x5a0018[_0x1a2440(0x1f3)]+_0x1a2440(0x2a4)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x56289a(0x287)]='segment:parent:fields';[a29_0x56289a(0x291)]=a29_0x56289a(0x20d);async[a29_0x56289a(0x2da)](_0x5d4ccd){const _0x1b5fa9=a29_0x56289a,{options:_0x3b6fb7,args:_0x47e7c7,tdx:_0x1cc68b}=_0x5d4ccd,_0x30fa20=_0x47e7c7[0x0]||_0x3b6fb7[_0x1b5fa9(0x229)];if(!_0x30fa20)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'+_0x1b5fa9(0x27f)),0x1;_0x3b6fb7[_0x1b5fa9(0x2b7)]&&(console['error'](_0x1b5fa9(0x25b)+_0x3b6fb7[_0x1b5fa9(0x235)]),console[_0x1b5fa9(0x1d2)](_0x1b5fa9(0x254)+_0x30fa20));const _0x2fac8f=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x30fa20+_0x1b5fa9(0x2a2),()=>_0x1cc68b[_0x1b5fa9(0x1c6)]['listFields'](_0x30fa20),{'verbose':_0x3b6fb7[_0x1b5fa9(0x2b7)]}),_0x24c65a=_0x2fac8f[_0x1b5fa9(0x1a5)];console['error'](_0x1b5fa9(0x232)+_0x24c65a['length']+'\x20field'+(_0x24c65a[_0x1b5fa9(0x23a)]!==0x1?'s':''));if(_0x3b6fb7[_0x1b5fa9(0x2f1)]||_0x3b6fb7['jsonl'])return await handleSDKOutput(_0x24c65a,_0x3b6fb7),0x0;return displayFieldsHumanReadable(_0x24c65a,_0x30fa20),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x201);[a29_0x56289a(0x291)]=a29_0x56289a(0x25f);async[a29_0x56289a(0x2da)](_0x56d5c9){const _0xa4912c=a29_0x56289a,{options:_0x662e59,args:_0x56f00a,tdx:_0x33e842}=_0x56d5c9,_0x16f28c=_0x662e59,_0x4a1a22=_0x56f00a[0x0]||_0x662e59[_0xa4912c(0x229)];if(!_0x4a1a22)return showParentSegmentNotSetError(_0xa4912c(0x218)+_0xa4912c(0x26d)+_0xa4912c(0x1d7)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x662e59[_0xa4912c(0x2b7)]&&(console[_0xa4912c(0x1d2)]('Site:\x20'+_0x662e59[_0xa4912c(0x235)]),console[_0xa4912c(0x1d2)](_0xa4912c(0x254)+_0x4a1a22));const _0x34ba32=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x4a1a22+'\x27...',()=>_0x33e842[_0xa4912c(0x1c6)][_0xa4912c(0x26c)](_0x4a1a22),{'verbose':_0x662e59['verbose']}),_0xd14674=_0x34ba32['data'];if(_0x16f28c['web']){const _0x2244a5=getConsoleNextUrl(_0x16f28c[_0xa4912c(0x235)],_0xa4912c(0x2d8)+_0xd14674['id']);return console[_0xa4912c(0x1d2)](a29_0xe68e55[_0xa4912c(0x27d)]('✔')+'\x20Opening\x20'+a29_0xe68e55['cyan'](_0x2244a5)),openBrowser(_0x2244a5),0x0;}return await handleSingleObjectOutput(_0xd14674,_0x662e59),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x28a);[a29_0x56289a(0x291)]=a29_0x56289a(0x2c1);async['execute'](_0x46b461){const _0x3a16a5=a29_0x56289a,{options:_0x9238c8,args:_0x881060,tdx:_0x518a53}=_0x46b461,_0x4cd721=_0x9238c8,_0x2f9d6b=_0x881060[0x0]||_0x9238c8[_0x3a16a5(0x229)];if(!_0x2f9d6b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x9238c8[_0x3a16a5(0x2b7)]&&(console['error'](_0x3a16a5(0x25b)+_0x9238c8[_0x3a16a5(0x235)]),console[_0x3a16a5(0x1d2)]('Parent\x20segment:\x20'+_0x2f9d6b));const _0x12010b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2f9d6b+_0x3a16a5(0x2a2),()=>_0x518a53[_0x3a16a5(0x1c6)][_0x3a16a5(0x2dd)](_0x2f9d6b),{'verbose':_0x9238c8[_0x3a16a5(0x2b7)]}),_0x4bae10=_0x12010b[_0x3a16a5(0x1a5)],_0x2a8ed1=_0x518a53[_0x3a16a5(0x1c6)][_0x3a16a5(0x280)](_0x4bae10);if(_0x4cd721['output']){const _0x4648ed=await this['collectSchema'](_0x46b461,_0x2f9d6b,_0x4bae10,_0x2a8ed1),_0x11a80b=this[_0x3a16a5(0x1ec)](_0x4648ed);writeFileSync(_0x4cd721[_0x3a16a5(0x178)],_0x11a80b);const _0x49ff4f=_0x4648ed['customers'][_0x3a16a5(0x1e2)][_0x3a16a5(0x23a)]+_0x4648ed[_0x3a16a5(0x2e8)]['reduce']((_0x17bf3a,_0x42ea93)=>_0x17bf3a+_0x42ea93[_0x3a16a5(0x1e2)]['length'],0x0),_0x2125c8=_0x4648ed['behaviors'][_0x3a16a5(0x22a)](_0x3207b1=>_0x3207b1['columns']['length']===0x0)[_0x3a16a5(0x23a)];return console['log'](_0x3a16a5(0x189)+_0x4cd721['output']),console['log'](_0x3a16a5(0x1e7)+_0x2a8ed1),console[_0x3a16a5(0x1bb)](_0x3a16a5(0x293)+_0x4648ed[_0x3a16a5(0x2e8)]['length']+_0x3a16a5(0x213)),console[_0x3a16a5(0x1bb)](_0x3a16a5(0x224)+_0x49ff4f+'\x20total'),_0x2125c8>0x0&&console[_0x3a16a5(0x1bb)](_0x3a16a5(0x1f2)+_0x2125c8+_0x3a16a5(0x1c7)),0x0;}console[_0x3a16a5(0x1d2)]('\x0a'+a29_0xe68e55[_0x3a16a5(0x1b2)](_0x3a16a5(0x240))+'\x20'+a29_0xe68e55['cyan'](_0x2a8ed1));const _0x58a9a0=await withSpinner(_0x3a16a5(0x2eb),()=>_0x518a53[_0x3a16a5(0x1c6)][_0x3a16a5(0x270)](_0x4bae10),{'verbose':_0x9238c8[_0x3a16a5(0x2b7)]});console['error']('\x0a'+a29_0xe68e55[_0x3a16a5(0x1b2)](_0x3a16a5(0x282))+'\x20'+a29_0xe68e55[_0x3a16a5(0x2d9)]('('+_0x2a8ed1+_0x3a16a5(0x1b3)));const _0x31c3ef=await executeSchemaQuery(_0x58a9a0['data'],_0x518a53,_0x9238c8);await handleQueryOutput(_0x31c3ef,_0x9238c8);const _0x4ef8e9=await withSpinner(_0x3a16a5(0x2b3),()=>_0x518a53[_0x3a16a5(0x1c6)][_0x3a16a5(0x294)](_0x4bae10),{'verbose':_0x9238c8[_0x3a16a5(0x2b7)]});for(const _0x1b8db1 of _0x4ef8e9[_0x3a16a5(0x1a5)]){const _0x15893a=_0x3a16a5(0x225)+_0x1b8db1[_0x3a16a5(0x25c)]()[_0x3a16a5(0x1b0)](/\s+/g,'_'),_0x5f238d='SELECT\x20*\x20FROM\x20'+_0x2a8ed1+'.'+_0x15893a;console[_0x3a16a5(0x1d2)]('\x0a'+a29_0xe68e55[_0x3a16a5(0x1b2)](_0x1b8db1)+'\x20'+a29_0xe68e55[_0x3a16a5(0x2d9)]('('+_0x2a8ed1+'.'+_0x15893a+')'));try{const _0x477d4c=await executeSchemaQuery(_0x5f238d,_0x518a53,_0x9238c8);await handleQueryOutput(_0x477d4c,_0x9238c8);}catch{console[_0x3a16a5(0x1d2)](a29_0xe68e55[_0x3a16a5(0x27c)](_0x3a16a5(0x22f)));}}return 0x0;}async[a29_0x56289a(0x230)](_0x38234b,_0x5a8230,_0x17b7ac,_0x4009a6){const _0x5c7cd8=a29_0x56289a,{options:_0x5b722c,tdx:_0x39f58a}=_0x38234b,_0xff3ac4=await withSpinner(_0x5c7cd8(0x2eb),()=>_0x39f58a['segment'][_0x5c7cd8(0x270)](_0x17b7ac),{'verbose':_0x5b722c[_0x5c7cd8(0x2b7)]}),_0x3fd0fe=await executeSchemaQuery(_0xff3ac4[_0x5c7cd8(0x1a5)],_0x39f58a,_0x5b722c),_0x2700ae=_0x3fd0fe[_0x5c7cd8(0x1a5)][_0x5c7cd8(0x2ef)](_0x2ebce3=>({'name':_0x2ebce3[_0x5c7cd8(0x1f8)],'type':_0x2ebce3[_0x5c7cd8(0x2b5)]})),_0x171be8=await withSpinner(_0x5c7cd8(0x2b3),()=>_0x39f58a[_0x5c7cd8(0x1c6)]['getBehaviorNames'](_0x17b7ac),{'verbose':_0x5b722c['verbose']}),_0x2a39b9=[];for(const _0x37dd93 of _0x171be8['data']){const _0x5f2258='behavior_'+_0x37dd93[_0x5c7cd8(0x25c)]()[_0x5c7cd8(0x1b0)](/\s+/g,'_'),_0x4113c6=_0x5c7cd8(0x1e9)+_0x4009a6+'.'+_0x5f2258;let _0x20f639=[];try{const _0x457da2=await executeSchemaQuery(_0x4113c6,_0x39f58a,_0x5b722c);_0x20f639=_0x457da2[_0x5c7cd8(0x1a5)][_0x5c7cd8(0x2ef)](_0x4e033f=>({'name':_0x4e033f['column_name'],'type':_0x4e033f[_0x5c7cd8(0x2b5)]}));}catch{}_0x2a39b9[_0x5c7cd8(0x1d0)]({'table':_0x5f2258,'columns':_0x20f639});}return{'database':_0x4009a6,'parent_segment':_0x5a8230,'parent_id':_0x17b7ac,'customers':{'table':_0x5c7cd8(0x282),'columns':_0x2700ae},'behaviors':_0x2a39b9};}[a29_0x56289a(0x1ec)](_0x30eb2b){const _0x5cd260=a29_0x56289a,_0x214144=_0x318217=>{const _0x5c2de8=a29_0x2646;if(_0x318217['length']===0x0)return'[]';const _0x1efd7e=_0x318217['map'](_0x169228=>_0x5c2de8(0x2ce)+_0x169228[_0x5c2de8(0x287)]+_0x5c2de8(0x2a0)+_0x169228[_0x5c2de8(0x2b8)]+_0x5c2de8(0x1f4));return'[\x0a'+_0x1efd7e[_0x5c2de8(0x2d1)](',\x0a')+_0x5c2de8(0x17d);},_0x37dd0c=_0x30eb2b['behaviors']['map'](_0x6fc038=>{const _0x2d26ae=a29_0x2646;return _0x2d26ae(0x1a6)+_0x6fc038['table']+_0x2d26ae(0x25e)+_0x214144(_0x6fc038[_0x2d26ae(0x1e2)])[_0x2d26ae(0x1b0)](/^/gm,'\x20\x20')[_0x2d26ae(0x281)]()+'\x0a\x20\x20\x20\x20}';})[_0x5cd260(0x2d1)](',\x0a');return _0x5cd260(0x198)+_0x30eb2b['database']+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x30eb2b[_0x5cd260(0x1cc)]+_0x5cd260(0x250)+_0x30eb2b[_0x5cd260(0x21d)]+_0x5cd260(0x24e)+_0x30eb2b['customers'][_0x5cd260(0x2a9)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x214144(_0x30eb2b['customers']['columns'])[_0x5cd260(0x1b0)](/^/gm,'\x20\x20')[_0x5cd260(0x281)]()+_0x5cd260(0x1fa)+_0x37dd0c+_0x5cd260(0x174);}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x56289a(0x287)]='segment:parent:sql';['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x332f8f){const _0x5e8b85=a29_0x56289a,{options:_0x5c03f1,args:_0x521051,tdx:_0x2be6a2}=_0x332f8f,_0x21b47c=_0x521051[0x0]||_0x5c03f1[_0x5e8b85(0x229)];if(!_0x21b47c)return showParentSegmentNotSetError(_0x5e8b85(0x175)+_0x5e8b85(0x2bc)),0x1;_0x5c03f1[_0x5e8b85(0x2b7)]&&(console[_0x5e8b85(0x1d2)]('Site:\x20'+_0x5c03f1['site']),console[_0x5e8b85(0x1d2)](_0x5e8b85(0x254)+_0x21b47c));const _0x566fdf=await withSpinner(_0x5e8b85(0x2c2)+_0x21b47c+'\x27...',()=>_0x2be6a2[_0x5e8b85(0x1c6)][_0x5e8b85(0x2dd)](_0x21b47c),{'verbose':_0x5c03f1[_0x5e8b85(0x2b7)]}),_0x286deb=_0x566fdf[_0x5e8b85(0x1a5)],_0x3b5c63=await withSpinner(_0x5e8b85(0x190)+_0x21b47c+_0x5e8b85(0x2a2),()=>_0x2be6a2[_0x5e8b85(0x1c6)][_0x5e8b85(0x270)](_0x286deb),{'verbose':_0x5c03f1[_0x5e8b85(0x2b7)]}),_0x58a749=_0x3b5c63[_0x5e8b85(0x1a5)];return _0x5c03f1[_0x5e8b85(0x273)]===_0x5e8b85(0x2f1)||_0x5c03f1[_0x5e8b85(0x273)]===_0x5e8b85(0x17e)?await handleSDKOutput([{'sql':_0x58a749}],_0x5c03f1):console[_0x5e8b85(0x1bb)](_0x58a749),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a29_0x56289a(0x1cd);[a29_0x56289a(0x291)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x41e798){const _0x225772=a29_0x56289a,{options:_0x3b6468,args:_0x1a8e1e,tdx:_0x2ce785}=_0x41e798,_0x515a14=_0x1a8e1e[0x0]||_0x3b6468['parentSegment'];if(!_0x515a14)return showParentSegmentNotSetError(_0x225772(0x2aa)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x3b6468[_0x225772(0x2b7)]&&(console[_0x225772(0x1d2)](_0x225772(0x25b)+_0x3b6468[_0x225772(0x235)]),console['error'](_0x225772(0x254)+_0x515a14));const _0xd1b0f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x515a14+'\x27...',()=>_0x2ce785['segment'][_0x225772(0x2dd)](_0x515a14),{'verbose':_0x3b6468['verbose']}),_0x36cc8e=_0xd1b0f[_0x225772(0x1a5)],_0x166736=await withSpinner(_0x225772(0x190)+_0x515a14+_0x225772(0x2a2),()=>_0x2ce785[_0x225772(0x1c6)][_0x225772(0x270)](_0x36cc8e),{'verbose':_0x3b6468['verbose']});let _0x2b3b44=_0x166736['data'];const _0x338598=resolveLimit(_0x3b6468[_0x225772(0x199)],DEFAULT_DISPLAY_LIMIT),_0xe4ee1d=/\bLIMIT\s+\d+/i[_0x225772(0x211)](_0x2b3b44);!_0xe4ee1d&&(_0x2b3b44=_0x2b3b44[_0x225772(0x281)]()[_0x225772(0x1b0)](/;+$/,''),_0x2b3b44=_0x225772(0x1db)+_0x2b3b44+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x338598);_0x3b6468[_0x225772(0x2b7)]&&console[_0x225772(0x1d2)]('SQL\x20query:\x0a'+_0x2b3b44);const _0x6427e5=await withProgressSpinner(_0x225772(0x2bb),async _0xa3035b=>{const _0x538458=_0x225772,_0x5c334d=await _0x2ce785['query'][_0x538458(0x2da)](_0x2b3b44,{'catalog':'td','schema':_0x538458(0x195),'onJobId':_0x3abf55=>{_0xa3035b['setJobId'](_0x3abf55);}});return _0x5c334d;},{'verbose':_0x3b6468[_0x225772(0x2b7)]}),_0x47e532=_0x6427e5['data'],_0x48c683=_0x47e532[_0x225772(0x245)]?_0x225772(0x1d9)+_0x47e532[_0x225772(0x245)]+']':'';return console[_0x225772(0x1d2)](_0x225772(0x275)+_0x47e532[_0x225772(0x2de)][_0x225772(0x192)]['toLocaleString']()+_0x225772(0x299)+(_0x225772(0x1ce)+formatElapsed(_0x47e532[_0x225772(0x2de)][_0x225772(0x1f1)])+_0x48c683)),await handleQueryOutput(_0x47e532,_0x3b6468),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a29_0x56289a(0x21b);[a29_0x56289a(0x291)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a29_0x56289a(0x2da)](_0x4fafb1){const _0x5dcb14=a29_0x56289a,{options:_0x6d267d,args:_0x2fc493,tdx:_0x2423ce}=_0x4fafb1,_0x4d6c23=_0x2fc493[0x0],_0x584bb8=await withSpinner(_0x4d6c23?_0x5dcb14(0x258)+_0x4d6c23+_0x5dcb14(0x2a2):_0x5dcb14(0x2e0),()=>_0x2423ce[_0x5dcb14(0x1a0)][_0x5dcb14(0x1bf)](),{'verbose':_0x6d267d[_0x5dcb14(0x2b7)]});let _0x3cb3a2=_0x584bb8[_0x5dcb14(0x1a5)]['filter'](_0x37eff1=>_0x37eff1['realtime_enabled']);if(_0x4d6c23){const _0x128370=_0x4d6c23[_0x5dcb14(0x1b0)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x5dcb14(0x1b0)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4d9adb=new RegExp('^'+_0x128370+'$','i');_0x3cb3a2=_0x3cb3a2[_0x5dcb14(0x22a)](_0x343867=>_0x4d9adb[_0x5dcb14(0x211)](_0x343867[_0x5dcb14(0x287)]));}_0x3cb3a2[_0x5dcb14(0x1fc)]((_0x384081,_0x3abea5)=>_0x384081['name'][_0x5dcb14(0x272)](_0x3abea5['name'])),console['error']('✔\x20Found\x20'+_0x3cb3a2[_0x5dcb14(0x23a)]+_0x5dcb14(0x24b)+(_0x3cb3a2[_0x5dcb14(0x23a)]!==0x1?'s':''));const _0x1e12d4=_0x54af7a=>{const _0xd3af4d=_0x5dcb14;return getConsoleNextUrl(_0x6d267d[_0xd3af4d(0x235)],_0xd3af4d(0x2d8)+_0x54af7a);};if(_0x6d267d[_0x5dcb14(0x273)]===_0x5dcb14(0x2f1)||_0x6d267d['format']===_0x5dcb14(0x17e)){const _0x1bcd8b=_0x3cb3a2[_0x5dcb14(0x2ef)](_0x1a562d=>({..._0x1a562d,'url':_0x1e12d4(_0x1a562d['id'])}));await handleSDKOutput(_0x1bcd8b,_0x6d267d);}else{if(_0x3cb3a2[_0x5dcb14(0x23a)]===0x0)console['log'](_0x5dcb14(0x252));else for(const _0x179452 of _0x3cb3a2){const _0x543fe3=_0x179452['population']?a29_0xe68e55[_0x5dcb14(0x2d9)]('\x20('+formatRows(_0x179452[_0x5dcb14(0x2ea)])+')'):'',_0x4d57d1=hyperlink(_0x179452[_0x5dcb14(0x287)],_0x1e12d4(_0x179452['id']));console[_0x5dcb14(0x1bb)]('⚡\x20'+_0x4d57d1+_0x543fe3);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x56289a(0x287)]=a29_0x56289a(0x256);[a29_0x56289a(0x291)]=a29_0x56289a(0x21c);async[a29_0x56289a(0x2da)](_0x52f8c1){const _0x38cdec=a29_0x56289a,{options:_0x5ef85d,args:_0x41196a,tdx:_0x5e292d}=_0x52f8c1,_0x258780=_0x41196a[0x0]||_0x5ef85d[_0x38cdec(0x229)];if(!_0x258780)return showParentSegmentNotSetError(_0x38cdec(0x2bf)+_0x38cdec(0x21f)),0x1;const _0x11599f=resolveYamlFile(_0x258780);if(!existsSync(_0x11599f))return showFileNotFoundError(_0x11599f,_0x258780),0x1;let _0x1ed8f2;try{_0x1ed8f2=readFileSync(_0x11599f,'utf-8');}catch(_0x134f4a){const _0x27a166=_0x134f4a instanceof Error?_0x134f4a[_0x38cdec(0x2dc)]:String(_0x134f4a);return console[_0x38cdec(0x1d2)](_0x38cdec(0x1e3)+_0x27a166),0x1;}const _0x2207f3=createCommandSpinner(a29_0xe68e55['dim'](_0x38cdec(0x2d7)),{'verbose':_0x5ef85d[_0x38cdec(0x2b7)]});_0x2207f3[_0x38cdec(0x29e)]();const _0x4d8bad={'realtime':!![],'onProgress':_0x45d8de=>{const _0x495faf=_0x38cdec;_0x2207f3[_0x495faf(0x1c0)]=formatProgressMessage(_0x45d8de);}};let _0x3cd9b6;try{_0x3cd9b6=await _0x5e292d[_0x38cdec(0x1c6)][_0x38cdec(0x1ca)](_0x1ed8f2,_0x4d8bad),_0x2207f3['stop']();}catch(_0x10a377){_0x2207f3[_0x38cdec(0x2e3)]();throw _0x10a377;}console[_0x38cdec(0x1d2)]('\x0a'+a29_0xe68e55[_0x38cdec(0x1b2)](_0x38cdec(0x279))+'\x20'+_0x3cd9b6['name']),console[_0x38cdec(0x1d2)]('═'[_0x38cdec(0x257)](0x3c)),displayRealtimeValidation(_0x3cd9b6),console['error']('─'[_0x38cdec(0x257)](0x3c));if(_0x3cd9b6[_0x38cdec(0x2d0)][_0x38cdec(0x23a)]>0x0){console['error']('\x0a'+a29_0xe68e55['red'](_0x38cdec(0x209)));for(const _0x545655 of _0x3cd9b6[_0x38cdec(0x2d0)]){console[_0x38cdec(0x1d2)]('\x20\x20'+a29_0xe68e55['red']('•')+'\x20'+_0x545655);}}return _0x3cd9b6[_0x38cdec(0x1e5)]&&console[_0x38cdec(0x1d2)]('\x0a'+a29_0xe68e55[_0x38cdec(0x27d)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x3cd9b6[_0x38cdec(0x1e5)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x56289a(0x287)]='ps:pz:list';[a29_0x56289a(0x291)]=a29_0x56289a(0x2a6);async['execute'](_0x523ec1){const _0x58384f=a29_0x56289a,{options:_0x76116e,args:_0x5a12fe,tdx:_0xf91391}=_0x523ec1,_0x289d8b=_0x5a12fe[0x0]||_0x76116e[_0x58384f(0x229)];if(!_0x289d8b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+_0x58384f(0x27b)),0x1;const _0x45989b=await withSpinner(_0x58384f(0x2c2)+_0x289d8b+'\x27...',()=>_0xf91391[_0x58384f(0x1c6)]['resolveParentId'](_0x289d8b),{'verbose':_0x76116e['verbose']}),_0x5c47e0=_0x45989b[_0x58384f(0x1a5)],_0x2b83bb=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x289d8b+_0x58384f(0x2a2),()=>_0xf91391['personalization']['list'](_0x5c47e0),{'verbose':_0x76116e[_0x58384f(0x2b7)]}),_0x163206=_0x2b83bb[_0x58384f(0x1a5)];console['error'](_0x58384f(0x232)+_0x163206['length']+_0x58384f(0x21a)+(_0x163206[_0x58384f(0x23a)]!==0x1?'s':''));if(_0x76116e[_0x58384f(0x273)]==='json'||_0x76116e['format']==='jsonl')await handleSDKOutput(_0x163206,_0x76116e);else{if(_0x163206[_0x58384f(0x23a)]===0x0)console['log'](_0x58384f(0x1e0)),console['error'](a29_0xe68e55[_0x58384f(0x262)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x255a72 of _0x163206){const _0x214398=_0x255a72[_0x58384f(0x236)]?.[_0x58384f(0x23a)]||0x0,_0x355999=_0x255a72['trigger_event']?a29_0xe68e55[_0x58384f(0x2d9)]('\x20trigger='+_0x255a72[_0x58384f(0x208)]):'',_0x22c410=a29_0xe68e55['dim']('\x20('+_0x214398+_0x58384f(0x1dc)+(_0x214398!==0x1?'s':'')+')');console[_0x58384f(0x1bb)]('\x20\x20'+_0x255a72[_0x58384f(0x287)]+_0x355999+_0x22c410),_0x255a72[_0x58384f(0x291)]&&console['log'](_0x58384f(0x25d)+a29_0xe68e55['dim'](_0x255a72[_0x58384f(0x291)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a29_0x56289a(0x287)]='ps:pz:init';[a29_0x56289a(0x291)]=a29_0x56289a(0x172);async[a29_0x56289a(0x2da)](_0xbc5424){const _0x40851a=a29_0x56289a,{options:_0x4c25fb,args:_0x231c1a}=_0xbc5424,_0x2d1bbd=_0x231c1a[0x0]||_0x4c25fb[_0x40851a(0x229)];if(!_0x2d1bbd)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a'+_0x40851a(0x2ad)),0x1;const _0x1f3eab=resolveYamlFile(_0x2d1bbd);if(!existsSync(_0x1f3eab))return showFileNotFoundError(_0x1f3eab,_0x2d1bbd),0x1;let _0x50ad97;try{_0x50ad97=readFileSync(_0x1f3eab,_0x40851a(0x22c));}catch(_0x370521){const _0x59189a=_0x370521 instanceof Error?_0x370521['message']:String(_0x370521);return console['error'](_0x40851a(0x1e3)+_0x59189a),0x1;}let _0x1fbf4c;try{_0x1fbf4c=parseDef(_0x50ad97);}catch(_0x193d12){const _0x54605b=_0x193d12 instanceof Error?_0x193d12[_0x40851a(0x2dc)]:String(_0x193d12);return console['error'](a29_0xe68e55[_0x40851a(0x23b)](_0x40851a(0x26e)+_0x54605b)),0x1;}if(_0x1fbf4c['personalization_services']&&_0x1fbf4c['personalization_services'][_0x40851a(0x23a)]>0x0)return console[_0x40851a(0x1d2)](a29_0xe68e55['yellow']('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x1f3eab)),console[_0x40851a(0x1d2)](a29_0xe68e55[_0x40851a(0x2d9)](_0x40851a(0x2ca)+_0x1fbf4c[_0x40851a(0x186)][_0x40851a(0x23a)]+'\x20service(s)\x20configured')),0x1;!_0x1fbf4c['realtime']&&(_0x1fbf4c[_0x40851a(0x1a0)]={'events':[{'name':_0x40851a(0x29b),'source_table':_0x40851a(0x2ac)}],'attributes':[{'name':_0x40851a(0x200),'type':_0x40851a(0x29a)}],'id_stitching':{'primary_key':_0x1fbf4c[_0x40851a(0x28f)][_0x40851a(0x2a9)]===_0x40851a(0x282)?_0x40851a(0x1fb):_0x40851a(0x2d3)}});_0x1fbf4c[_0x40851a(0x186)]=[{'name':_0x40851a(0x182),'description':'Personalization\x20service\x20description','trigger_event':_0x40851a(0x29b),'sections':[{'name':'Default','criteria':_0x40851a(0x2b4),'attributes':['last_page_viewed']}]}];const _0x5beb57=serializeDef(_0x1fbf4c);return writeFileSync(_0x1f3eab,_0x5beb57,_0x40851a(0x22c)),console[_0x40851a(0x1d2)](a29_0xe68e55[_0x40851a(0x27d)]('✔')+_0x40851a(0x249)+a29_0xe68e55['cyan'](_0x1f3eab)),(!_0x1fbf4c[_0x40851a(0x1a0)]||_0x50ad97[_0x40851a(0x179)](_0x40851a(0x237))===-0x1)&&console[_0x40851a(0x1d2)](a29_0xe68e55[_0x40851a(0x27d)]('✔')+_0x40851a(0x1ac)),console[_0x40851a(0x1d2)]('\x0a'+a29_0xe68e55[_0x40851a(0x2d9)](_0x40851a(0x298))),console[_0x40851a(0x1d2)]('\x20\x201.\x20Edit\x20'+_0x1f3eab+_0x40851a(0x248)),console[_0x40851a(0x1d2)]('\x20\x202.\x20Run\x20'+a29_0xe68e55[_0x40851a(0x2d9)](_0x40851a(0x1ab)+_0x2d1bbd)+_0x40851a(0x29c)),0x0;}}
@@ -1 +1 @@
1
- const a27_0x548396=a27_0x98df;(function(_0x2dc71a,_0x1ca7d0){const _0x3da950=a27_0x98df,_0x46cc71=_0x2dc71a();while(!![]){try{const _0x3e2abc=parseInt(_0x3da950(0xf2))/0x1*(-parseInt(_0x3da950(0xd6))/0x2)+-parseInt(_0x3da950(0xd5))/0x3+-parseInt(_0x3da950(0xf1))/0x4*(parseInt(_0x3da950(0x128))/0x5)+parseInt(_0x3da950(0x127))/0x6*(parseInt(_0x3da950(0x124))/0x7)+-parseInt(_0x3da950(0xf9))/0x8+-parseInt(_0x3da950(0x134))/0x9+parseInt(_0x3da950(0xe6))/0xa;if(_0x3e2abc===_0x1ca7d0)break;else _0x46cc71['push'](_0x46cc71['shift']());}catch(_0x2989cb){_0x46cc71['push'](_0x46cc71['shift']());}}}(a27_0x60c7,0x45a52));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 a27_0xd4f9d0 from'node:path';function a27_0x60c7(){const _0x4bf8df=['config','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx:\x20profile\x20create','1143648WNBsAr','2moqPki','join','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','error','green','\x27\x20does\x20not\x20exist.','yellow','validate','length','(session:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20name\x20cannot\x20be\x20empty','status','create','Unknown\x20key\x20\x27','12162220dkbMcU','\x20\x20-\x20','confirm','other','database','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','site','\x20\x20(no\x20profiles\x20found)','Changing\x20site\x20to\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profileName','4nkFuch','113854fDmKoU','Site\x20was\x20not\x20changed.','select','warn','dim','email','API\x20key\x20cannot\x20be\x20empty','585304koEKBJ','(cleared)','VALID_KEYS','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','ERROR','llm_project','\x27\x20updated:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20your\x20TD\x20API\x20key:','Session\x20profile\x20set\x20to:\x20','execute','Set\x20session\x20profile','profile','test','/app/mp/ak','getUserInfo','Profile\x20\x27','session','\x20Profile\x20\x27','\x0aOperation\x20cancelled','tdx:\x20profile\x20remove','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','tdx:\x20profile\x20set','\x20--default\x27\x20to\x20save\x20permanently','profile:use','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','llm_agent','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','password','apiKey','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>','Removal\x20cancelled','log','name','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x0aAvailable\x20profiles:','\x0aSetup\x20cancelled','Create\x20a\x20new\x20profile','bold','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','customSite','7XdajfC','\x27\x20created','us01','106662qZmFhH','1677110uMntra','tdx.json','profile:set','\x27\x20removed\x20from\x20configuration','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','red','jobs','\x27.\x0a\x0aValid\x20keys:\x20','split','✗\x20Validation\x20failed:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Enter\x20description\x20(optional):','405702mDbOMK','\x20\x20tdx\x20--profile\x20','profile:create','includes','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','logLevel','Set\x20a\x20profile\x20configuration\x20value','Validating\x20API\x20key...','trim','profile:remove','Remove\x20a\x20profile','Default\x20profile\x20set\x20to:\x20','description','message','text'];a27_0x60c7=function(){return _0x4bf8df;};return a27_0x60c7();}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a27_0x98df(_0x40b3ce,_0x1a2426){_0x40b3ce=_0x40b3ce-0xd0;const _0x60c780=a27_0x60c7();let _0x98dfb8=_0x60c780[_0x40b3ce];return _0x98dfb8;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0xb3dd34 from'prompts';import a27_0x557307 from'chalk';function validateProfileName(_0x223611){const _0x2df431=a27_0x98df;if(!_0x223611||!_0x223611[_0x2df431(0x13c)]())return _0x2df431(0xe2);const _0x488ef7=_0x223611[_0x2df431(0x13c)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x488ef7))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x488ef7))return _0x2df431(0x10b)+_0x488ef7+_0x2df431(0xfe);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x548396(0x11c)]=a27_0x548396(0x136);[a27_0x548396(0x140)]=a27_0x548396(0x120);async[a27_0x548396(0x105)](_0x183299){const _0xfd713d=a27_0x548396,{options:_0x1585da,args:_0x4df45c}=_0x183299;console[_0xfd713d(0x11b)](a27_0x557307[_0xfd713d(0x121)](_0xfd713d(0xd4)));let _0x1e2ff3;if(_0x4df45c[_0xfd713d(0xdf)]>0x0&&_0x4df45c[0x0]){const _0x58cea6=_0x4df45c[0x0][_0xfd713d(0x13c)](),_0x391b46=validateProfileName(_0x58cea6);if(_0x391b46!==!![])return console[_0xfd713d(0xda)](a27_0x557307[_0xfd713d(0x12d)](_0x391b46)),0x1;_0x1e2ff3=_0x58cea6;}else{const _0x4284cf=await a27_0xb3dd34({'type':_0xfd713d(0xd1),'name':_0xfd713d(0xf0),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x4284cf['profileName'])return console['log'](_0xfd713d(0x11f)),0x1;_0x1e2ff3=_0x4284cf['profileName'][_0xfd713d(0x13c)]();}const _0x8455ef=await a27_0xb3dd34({'type':_0xfd713d(0xd1),'name':_0xfd713d(0x140),'message':_0xfd713d(0x133)}),_0x3c5414=_0x8455ef[_0xfd713d(0x140)]?.[_0xfd713d(0x13c)]()||undefined,_0x412362=_0x1585da[_0xfd713d(0xec)]||_0xfd713d(0x126),{choices:_0x267a94,initialIndex:_0xa64a06}=buildSiteChoices(_0x412362),_0x367893=await a27_0xb3dd34({'type':_0xfd713d(0xf4),'name':_0xfd713d(0xec),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x1e2ff3+'\x27:','choices':_0x267a94,'initial':_0xa64a06});if(!_0x367893[_0xfd713d(0xec)])return console[_0xfd713d(0x11b)](_0xfd713d(0x11f)),0x1;let _0x19870d;if(_0x367893[_0xfd713d(0xec)]===_0xfd713d(0xe9)){const _0x44d2f5=await a27_0xb3dd34({'type':_0xfd713d(0xd1),'name':_0xfd713d(0x123),'message':'Enter\x20site\x20name:','initial':_0xfd713d(0x126),'validate':_0x20324d=>{const _0x2972cb=_0xfd713d;if(!_0x20324d||!_0x20324d[_0x2972cb(0x13c)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x2972cb(0x108)](_0x20324d['trim']()))return _0x2972cb(0x138);return!![];}});if(!_0x44d2f5[_0xfd713d(0x123)])return console[_0xfd713d(0x11b)](_0xfd713d(0x11f)),0x1;_0x19870d=_0x44d2f5[_0xfd713d(0x123)];}else _0x19870d=_0x367893['site'];const _0x5a6671=resolveSite(_0x19870d);console['log'](_0xfd713d(0x132)+_0x5a6671),console[_0xfd713d(0x11b)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xfd713d(0x11b)]('\x20\x20'+getConsoleUrl(_0x5a6671,_0xfd713d(0x109)));const _0x54f234=await a27_0xb3dd34({'type':_0xfd713d(0x117),'name':_0xfd713d(0x118),'message':_0xfd713d(0x103),'validate':_0x4e67a7=>{const _0x5c6f1=_0xfd713d;if(!_0x4e67a7||!_0x4e67a7[_0x5c6f1(0x13c)]())return _0x5c6f1(0xf8);return!![];}});if(!_0x54f234['apiKey'])return console[_0xfd713d(0x11b)](_0xfd713d(0x11f)),0x1;const _0x14500b=_0x54f234[_0xfd713d(0x118)];console[_0xfd713d(0x11b)]('Validating\x20API\x20key...');try{const _0x31ed4c=TDX['create']({'site':_0x5a6671,'apiKey':_0x14500b[_0xfd713d(0x13c)](),'logLevel':_0x1585da['logLevel']??LogLevel[_0xfd713d(0xff)]}),_0x408747=await _0x31ed4c[_0xfd713d(0x12e)][_0xfd713d(0x10a)]();console[_0xfd713d(0x11b)](a27_0x557307['green']('✓')+_0xfd713d(0xd3)+_0x408747[_0xfd713d(0xf7)]+')');const _0x2d2e0b=await isKeychainAvailable();_0x2d2e0b?(await saveAPIKeyAsync(_0x14500b[_0xfd713d(0x13c)](),_0x5a6671,_0x1e2ff3),console[_0xfd713d(0x11b)](a27_0x557307[_0xfd713d(0xdb)]('✓')+_0xfd713d(0x12c)+_0x1e2ff3+')')):(console[_0xfd713d(0xf5)](a27_0x557307[_0xfd713d(0xdd)](_0xfd713d(0xfd))),console[_0xfd713d(0xf5)](a27_0x557307[_0xfd713d(0xdd)](_0xfd713d(0xd9))));const _0x5e4919={'site':_0x5a6671,..._0x3c5414&&{'description':_0x3c5414}};return saveProfileToUserConfig(_0x1e2ff3,_0x5e4919),console['log'](a27_0x557307[_0xfd713d(0xdb)]('✓')+_0xfd713d(0x10d)+_0x1e2ff3+_0xfd713d(0x125)),console[_0xfd713d(0x11b)](),console[_0xfd713d(0x11b)](_0xfd713d(0xfc)),console[_0xfd713d(0x11b)](_0xfd713d(0x135)+_0x1e2ff3+_0xfd713d(0x110)),console[_0xfd713d(0x11b)]('\x20\x20tdx\x20--profile\x20'+_0x1e2ff3+_0xfd713d(0xeb)),0x0;}catch(_0x2b45ea){if(_0x2b45ea instanceof HTTPClientError&&_0x2b45ea[_0xfd713d(0xe3)]===0x191)return printAuthError(_0x2b45ea),0x1;return console[_0xfd713d(0xda)](a27_0x557307[_0xfd713d(0x12d)](_0xfd713d(0x131)+(_0x2b45ea instanceof Error?_0x2b45ea[_0xfd713d(0xd0)]:String(_0x2b45ea)))),console[_0xfd713d(0xda)](_0xfd713d(0xe1)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x548396(0x11c)]=a27_0x548396(0x13d);[a27_0x548396(0x140)]=a27_0x548396(0x13e);[a27_0x548396(0xde)](_0x30f9fe){const _0x7ff4c2=a27_0x548396,{args:_0xf0303f}=_0x30f9fe;if(_0xf0303f[_0x7ff4c2(0xdf)]===0x0)return _0x7ff4c2(0x116);return undefined;}async[a27_0x548396(0x105)](_0x7a17c8){const _0x4b2f9e=a27_0x548396,{args:_0x3ce3d2}=_0x7a17c8,_0x452b91=_0x3ce3d2[0x0];console[_0x4b2f9e(0x11b)](a27_0x557307[_0x4b2f9e(0x121)](_0x4b2f9e(0x10f)));if(!profileExists(_0x452b91)){console[_0x4b2f9e(0xda)](a27_0x557307[_0x4b2f9e(0x12d)]('Profile\x20\x27'+_0x452b91+_0x4b2f9e(0xdc))),console[_0x4b2f9e(0x11b)](_0x4b2f9e(0x11e));const _0x43d0fd=listProfiles();if(_0x43d0fd[_0x4b2f9e(0xdf)]===0x0)console[_0x4b2f9e(0x11b)](_0x4b2f9e(0xed));else for(const _0x375e7a of _0x43d0fd){console[_0x4b2f9e(0x11b)](_0x4b2f9e(0xe7)+_0x375e7a[_0x4b2f9e(0x11c)]);}return 0x1;}const _0x18f735=await a27_0xb3dd34({'type':_0x4b2f9e(0xe8),'name':'confirm','message':_0x4b2f9e(0xef)+_0x452b91+'\x27?','initial':![]});if(!_0x18f735[_0x4b2f9e(0xe8)])return console[_0x4b2f9e(0x11b)](_0x4b2f9e(0x11a)),0x0;try{removeProfileFromUserConfig(_0x452b91),console[_0x4b2f9e(0x11b)](a27_0x557307[_0x4b2f9e(0xdb)]('✓')+_0x4b2f9e(0x10d)+_0x452b91+_0x4b2f9e(0x12b));}catch(_0x5bb0fb){return console['error'](a27_0x557307[_0x4b2f9e(0x12d)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x5bb0fb instanceof Error?_0x5bb0fb[_0x4b2f9e(0xd0)]:String(_0x5bb0fb)))),0x1;}const _0x1db990=await isKeychainAvailable();if(_0x1db990){const _0x3821b7=await deleteKeychainAPIKey(_0x452b91);_0x3821b7&&console[_0x4b2f9e(0x11b)](a27_0x557307[_0x4b2f9e(0xdb)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x548396(0x11c)]=a27_0x548396(0x12a);[a27_0x548396(0x140)]=a27_0x548396(0x13a);static [a27_0x548396(0xfb)]=[a27_0x548396(0xec),a27_0x548396(0xea),'parent_segment',a27_0x548396(0x100),a27_0x548396(0x115),'description'];[a27_0x548396(0xde)](_0x2bcdfc){const _0x51943e=a27_0x548396,{args:_0x133483,options:_0x5c7793}=_0x2bcdfc,_0x5f45dc=_0x5c7793[_0x51943e(0x107)]||getActiveProfile();if(!_0x5f45dc)return _0x51943e(0x119);if(_0x133483[_0x51943e(0xdf)]===0x0)return _0x51943e(0x122)+ProfileSetCommand[_0x51943e(0xfb)][_0x51943e(0xd7)](',\x20');const _0x2b4739=_0x133483[0x0];if(!_0x2b4739['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x51943e(0xd7)](',\x20');const [_0x22b82b]=_0x2b4739[_0x51943e(0x130)]('=',0x2);if(!ProfileSetCommand[_0x51943e(0xfb)][_0x51943e(0x137)](_0x22b82b))return _0x51943e(0xe5)+_0x22b82b+_0x51943e(0x12f)+ProfileSetCommand[_0x51943e(0xfb)]['join'](',\x20');return undefined;}async[a27_0x548396(0x105)](_0x2f7b21){const _0x22923a=a27_0x548396,{args:_0x32f07e,options:_0x2e58f2}=_0x2f7b21,_0x1ce6f1=_0x2e58f2[_0x22923a(0x107)]||getActiveProfile(),[_0x5d1a03,..._0x24c96f]=_0x32f07e[0x0][_0x22923a(0x130)]('='),_0x4e8d9b=_0x24c96f[_0x22923a(0xd7)]('=');console[_0x22923a(0x11b)](a27_0x557307[_0x22923a(0x121)](_0x22923a(0x111)));if(!profileExists(_0x1ce6f1)){const _0x1f258f=await a27_0xb3dd34({'type':_0x22923a(0xe8),'name':'create','message':_0x22923a(0x10b)+_0x1ce6f1+_0x22923a(0xd8),'initial':!![]});if(!_0x1f258f['create'])return console[_0x22923a(0x11b)]('Operation\x20cancelled'),0x1;}const _0x1cf8ff=loadProfile(_0x1ce6f1),_0x34ead3=_0x1cf8ff?.[_0x22923a(0xd2)]||{};if(_0x5d1a03===_0x22923a(0xec)){const _0x3bb080=resolveSite(_0x4e8d9b);console['log'](_0x22923a(0xee)+_0x3bb080+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x22923a(0x11b)](_0x22923a(0x102)),console['log']('\x20\x20'+getConsoleUrl(_0x3bb080,_0x22923a(0x109)));const _0x317888=await a27_0xb3dd34({'type':_0x22923a(0x117),'name':_0x22923a(0x118),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0xf279b1=>{const _0x3cb2fa=_0x22923a;if(!_0xf279b1||!_0xf279b1['trim']())return _0x3cb2fa(0xf8);return!![];}});if(!_0x317888[_0x22923a(0x118)])return console[_0x22923a(0x11b)](_0x22923a(0x10e)),0x1;console['log'](_0x22923a(0x13b));try{const _0x3181bd=TDX[_0x22923a(0xe4)]({'site':_0x3bb080,'apiKey':_0x317888[_0x22923a(0x118)]['trim'](),'logLevel':_0x2e58f2[_0x22923a(0x139)]??LogLevel[_0x22923a(0xff)]}),_0x2a4ab0=await _0x3181bd[_0x22923a(0x12e)][_0x22923a(0x10a)]();console[_0x22923a(0x11b)](a27_0x557307[_0x22923a(0xdb)]('✓')+_0x22923a(0xd3)+_0x2a4ab0[_0x22923a(0xf7)]+')');const _0x25bfbd=await isKeychainAvailable();_0x25bfbd?(await saveAPIKeyAsync(_0x317888[_0x22923a(0x118)]['trim'](),_0x3bb080,_0x1ce6f1),console['log'](a27_0x557307[_0x22923a(0xdb)]('✓')+_0x22923a(0x11d))):console[_0x22923a(0xf5)](a27_0x557307['yellow'](_0x22923a(0xfd))),_0x34ead3[_0x22923a(0xec)]=_0x3bb080;}catch(_0x462124){if(_0x462124 instanceof HTTPClientError&&_0x462124['status']===0x191)return printAuthError(_0x462124),0x1;return console[_0x22923a(0xda)](a27_0x557307[_0x22923a(0x12d)](_0x22923a(0x131)+(_0x462124 instanceof Error?_0x462124[_0x22923a(0xd0)]:String(_0x462124)))),console[_0x22923a(0xda)](_0x22923a(0xf3)),0x1;}}else _0x34ead3[_0x5d1a03]=_0x4e8d9b||undefined;return saveProfileToUserConfig(_0x1ce6f1,_0x34ead3),console[_0x22923a(0x11b)](a27_0x557307[_0x22923a(0xdb)]('✓')+_0x22923a(0x10d)+_0x1ce6f1+_0x22923a(0x101)+_0x5d1a03+'='+(_0x4e8d9b||_0x22923a(0xfa))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x548396(0x11c)]=a27_0x548396(0x113);['description']=a27_0x548396(0x106);[a27_0x548396(0xde)](_0x25e0a3){const {args:_0x923d46}=_0x25e0a3;if(_0x923d46['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x3096b3){const _0x4023de=a27_0x548396,{args:_0x32bdb3,options:_0x3ab45e}=_0x3096b3,_0x1182ba=_0x32bdb3[0x0],_0x234035=_0x3ab45e['default'];cleanExpiredSessions();if(!profileExists(_0x1182ba)){console[_0x4023de(0xda)](a27_0x557307['red'](_0x4023de(0x10b)+_0x1182ba+'\x27\x20does\x20not\x20exist.')),console[_0x4023de(0x11b)](_0x4023de(0x11e));const _0x9c8443=listProfiles();if(_0x9c8443[_0x4023de(0xdf)]===0x0)console[_0x4023de(0x11b)](_0x4023de(0xed));else for(const _0x23949d of _0x9c8443){console[_0x4023de(0x11b)](_0x4023de(0xe7)+_0x23949d['name']);}return 0x1;}if(_0x234035){const _0x2fbd75=a27_0xd4f9d0[_0x4023de(0xd7)](getConfigDir(),_0x4023de(0x129));return saveActiveProfileToUserConfig(_0x1182ba),console[_0x4023de(0x11b)](_0x4023de(0x13f)+a27_0x557307[_0x4023de(0xdb)](_0x1182ba)),console[_0x4023de(0x11b)](a27_0x557307[_0x4023de(0xf6)]('\x0aSaved\x20to:\x20'+_0x2fbd75)),0x0;}const _0x4e9a07=getSessionID(_0x3ab45e[_0x4023de(0x10c)]);return saveSessionContext({'profile':_0x1182ba},_0x3ab45e[_0x4023de(0x10c)]),console[_0x4023de(0x11b)](_0x4023de(0x104)+a27_0x557307[_0x4023de(0xdb)](_0x1182ba)+'\x20'+a27_0x557307['dim'](_0x4023de(0xe0)+_0x4e9a07+')')),console[_0x4023de(0x11b)](a27_0x557307[_0x4023de(0xf6)](_0x4023de(0x114)+_0x1182ba+_0x4023de(0x112))),0x0;}}
1
+ const a30_0x3738e1=a30_0x5cd0;(function(_0x5e3bf2,_0x13bc0e){const _0x43e86d=a30_0x5cd0,_0x443562=_0x5e3bf2();while(!![]){try{const _0x258660=-parseInt(_0x43e86d(0xf5))/0x1*(-parseInt(_0x43e86d(0x108))/0x2)+-parseInt(_0x43e86d(0x10b))/0x3+-parseInt(_0x43e86d(0xdb))/0x4+parseInt(_0x43e86d(0xe3))/0x5*(-parseInt(_0x43e86d(0xef))/0x6)+parseInt(_0x43e86d(0xad))/0x7+-parseInt(_0x43e86d(0xe2))/0x8+parseInt(_0x43e86d(0xce))/0x9;if(_0x258660===_0x13bc0e)break;else _0x443562['push'](_0x443562['shift']());}catch(_0xb9ecfa){_0x443562['push'](_0x443562['shift']());}}}(a30_0x3e39,0x882c4));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 a30_0x4e07a9 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a30_0x3e39(){const _0x1008b3=['⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','VALID_KEYS','60URUOfr','\x20API\x20key\x20removed\x20from\x20system\x20keychain','parent_segment','753279IFvfdV','execute','Enter\x20your\x20TD\x20API\x20key:','jobs','text','message','getUserInfo','status','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20cannot\x20be\x20empty','Validating\x20API\x20key...','\x27\x20does\x20not\x20exist.\x20Create\x20it?','split','profile:remove','440034XJnqJD','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20\x27','\x0aSaved\x20to:\x20','length','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x27.\x0a\x0aValid\x20keys:\x20','API\x20key\x20cannot\x20be\x20empty','\x27\x20requires\x20API\x20key\x20validation.','Enter\x20profile\x20name:','tdx:\x20profile\x20remove','ERROR','confirm','other','includes','Default\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20create','password','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Enter\x20site\x20name:','apiKey','profile:create','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Set\x20session\x20profile','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','✗\x20Validation\x20failed:\x20','join','create','description','\x20--default\x27\x20to\x20save\x20permanently','yellow','16959600UcMzbb','\x0aSetup\x20cancelled','profileName','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','test','\x20Profile\x20\x27','\x27\x20does\x20not\x20exist.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20name\x20cannot\x20be\x20empty','dim','profile','llm_project','green','336084eaDkxb','\x20\x20-\x20','Removal\x20cancelled','email','trim','validate','\x20API\x20key\x20saved\x20to\x20system\x20keychain','7591040qcUtev','60kAOxpm','log','default','name','/app/mp/ak','\x0aAvailable\x20profiles:','(session:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','error','Operation\x20cancelled','You\x20can\x20find\x20your\x20API\x20key\x20at:','site','246462ByupIb','logLevel','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','warn','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','12914feTpit','\x20\x20(no\x20profiles\x20found)','red','customSite','\x27\x20updated:\x20','llm_agent','us01','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20removed\x20from\x20configuration','bold','\x0aOperation\x20cancelled','Unknown\x20key\x20\x27','\x20\x20tdx\x20--profile\x20','session','Failed\x20to\x20remove\x20profile:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','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>'];a30_0x3e39=function(){return _0x1008b3;};return a30_0x3e39();}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 a30_0x57c9dd from'prompts';import a30_0x5b108d from'chalk';function validateProfileName(_0x164486){const _0x5e7207=a30_0x5cd0;if(!_0x164486||!_0x164486[_0x5e7207(0xdf)]())return _0x5e7207(0xd6);const _0x47a951=_0x164486[_0x5e7207(0xdf)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x47a951))return _0x5e7207(0xc5);if(profileExists(_0x47a951))return'Profile\x20\x27'+_0x47a951+_0x5e7207(0xd1);return!![];}export class ProfileCreateCommand extends BaseCommand{[a30_0x3738e1(0xe6)]=a30_0x3738e1(0xc3);[a30_0x3738e1(0xcb)]='Create\x20a\x20new\x20profile';async['execute'](_0x1f422c){const _0x2e690d=a30_0x3738e1,{options:_0x5350c3,args:_0x55408a}=_0x1f422c;console[_0x2e690d(0xe4)](a30_0x5b108d[_0x2e690d(0xfe)](_0x2e690d(0xbd)));let _0x2468c7;if(_0x55408a[_0x2e690d(0xb1)]>0x0&&_0x55408a[0x0]){const _0x2ceba6=_0x55408a[0x0][_0x2e690d(0xdf)](),_0x124f84=validateProfileName(_0x2ceba6);if(_0x124f84!==!![])return console[_0x2e690d(0xeb)](a30_0x5b108d[_0x2e690d(0xf7)](_0x124f84)),0x1;_0x2468c7=_0x2ceba6;}else{const _0xf8883a=await a30_0x57c9dd({'type':_0x2e690d(0x10f),'name':_0x2e690d(0xd0),'message':_0x2e690d(0xb6),'validate':validateProfileName});if(!_0xf8883a[_0x2e690d(0xd0)])return console['log'](_0x2e690d(0xcf)),0x1;_0x2468c7=_0xf8883a[_0x2e690d(0xd0)][_0x2e690d(0xdf)]();}const _0x82f42b=await a30_0x57c9dd({'type':_0x2e690d(0x10f),'name':_0x2e690d(0xcb),'message':'Enter\x20description\x20(optional):'}),_0x43b68f=_0x82f42b['description']?.['trim']()||undefined,_0x32391b=_0x5350c3[_0x2e690d(0xee)]||_0x2e690d(0xfb),{choices:_0x5c1a3b,initialIndex:_0x3e04dc}=buildSiteChoices(_0x32391b),_0x2e30a1=await a30_0x57c9dd({'type':'select','name':_0x2e690d(0xee),'message':_0x2e690d(0xb2)+_0x2468c7+'\x27:','choices':_0x5c1a3b,'initial':_0x3e04dc});if(!_0x2e30a1[_0x2e690d(0xee)])return console[_0x2e690d(0xe4)](_0x2e690d(0xcf)),0x1;let _0x5ce434;if(_0x2e30a1[_0x2e690d(0xee)]===_0x2e690d(0xba)){const _0x34debf=await a30_0x57c9dd({'type':_0x2e690d(0x10f),'name':_0x2e690d(0xf8),'message':_0x2e690d(0xc1),'initial':'us01','validate':_0x460a24=>{const _0x36678f=_0x2e690d;if(!_0x460a24||!_0x460a24[_0x36678f(0xdf)]())return _0x36678f(0xa8);if(!/^[a-z0-9-]+$/[_0x36678f(0xd2)](_0x460a24[_0x36678f(0xdf)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x34debf['customSite'])return console[_0x2e690d(0xe4)](_0x2e690d(0xcf)),0x1;_0x5ce434=_0x34debf[_0x2e690d(0xf8)];}else _0x5ce434=_0x2e30a1[_0x2e690d(0xee)];const _0x3484af=resolveSite(_0x5ce434);console[_0x2e690d(0xe4)](_0x2e690d(0xd5)+_0x3484af),console['log'](_0x2e690d(0xed)),console['log']('\x20\x20'+getConsoleUrl(_0x3484af,_0x2e690d(0xe7)));const _0x313ffc=await a30_0x57c9dd({'type':_0x2e690d(0xbe),'name':'apiKey','message':_0x2e690d(0x10d),'validate':_0x27ef17=>{const _0x1d3f41=_0x2e690d;if(!_0x27ef17||!_0x27ef17[_0x1d3f41(0xdf)]())return _0x1d3f41(0xb4);return!![];}});if(!_0x313ffc[_0x2e690d(0xc2)])return console[_0x2e690d(0xe4)](_0x2e690d(0xcf)),0x1;const _0x3eb587=_0x313ffc['apiKey'];console['log'](_0x2e690d(0xa9));try{const _0x465848=TDX[_0x2e690d(0xca)]({'site':_0x3484af,'apiKey':_0x3eb587[_0x2e690d(0xdf)](),'logLevel':_0x5350c3[_0x2e690d(0xf0)]??LogLevel[_0x2e690d(0xb8)]}),_0x4e635f=await _0x465848['jobs'][_0x2e690d(0xa5)]();console[_0x2e690d(0xe4)](a30_0x5b108d['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4e635f[_0x2e690d(0xde)]+')');const _0x494a2d=await isKeychainAvailable();_0x494a2d?(await saveAPIKeyAsync(_0x3eb587[_0x2e690d(0xdf)](),_0x3484af,_0x2468c7),console[_0x2e690d(0xe4)](a30_0x5b108d['green']('✓')+_0x2e690d(0xc0)+_0x2468c7+')')):(console[_0x2e690d(0xf2)](a30_0x5b108d[_0x2e690d(0xcd)](_0x2e690d(0x106))),console[_0x2e690d(0xf2)](a30_0x5b108d[_0x2e690d(0xcd)](_0x2e690d(0xc4))));const _0x51e5ee={'site':_0x3484af,..._0x43b68f&&{'description':_0x43b68f}};return saveProfileToUserConfig(_0x2468c7,_0x51e5ee),console[_0x2e690d(0xe4)](a30_0x5b108d['green']('✓')+'\x20Profile\x20\x27'+_0x2468c7+'\x27\x20created'),console[_0x2e690d(0xe4)](),console[_0x2e690d(0xe4)](_0x2e690d(0xc7)),console[_0x2e690d(0xe4)](_0x2e690d(0x101)+_0x2468c7+_0x2e690d(0xf1)),console['log'](_0x2e690d(0x101)+_0x2468c7+_0x2e690d(0x104)),0x0;}catch(_0x512db6){if(_0x512db6 instanceof HTTPClientError&&_0x512db6['status']===0x191)return printAuthError(_0x512db6),0x1;return console['error'](a30_0x5b108d[_0x2e690d(0xf7)]('✗\x20Validation\x20failed:\x20'+(_0x512db6 instanceof Error?_0x512db6[_0x2e690d(0x110)]:String(_0x512db6)))),console['error'](_0x2e690d(0xae)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a30_0x3738e1(0xac);[a30_0x3738e1(0xcb)]='Remove\x20a\x20profile';[a30_0x3738e1(0xe0)](_0x58a0f2){const _0x2c68c1=a30_0x3738e1,{args:_0x329117}=_0x58a0f2;if(_0x329117['length']===0x0)return _0x2c68c1(0xa7);return undefined;}async[a30_0x3738e1(0x10c)](_0x576207){const _0x5220fd=a30_0x3738e1,{args:_0x571cab}=_0x576207,_0x18f841=_0x571cab[0x0];console[_0x5220fd(0xe4)](a30_0x5b108d['bold'](_0x5220fd(0xb7)));if(!profileExists(_0x18f841)){console[_0x5220fd(0xeb)](a30_0x5b108d['red']('Profile\x20\x27'+_0x18f841+_0x5220fd(0xd4))),console[_0x5220fd(0xe4)](_0x5220fd(0xe8));const _0xda5c0f=listProfiles();if(_0xda5c0f[_0x5220fd(0xb1)]===0x0)console['log'](_0x5220fd(0xf6));else for(const _0x195546 of _0xda5c0f){console['log'](_0x5220fd(0xdc)+_0x195546[_0x5220fd(0xe6)]);}return 0x1;}const _0x1407d2=await a30_0x57c9dd({'type':'confirm','name':_0x5220fd(0xb9),'message':_0x5220fd(0xf3)+_0x18f841+'\x27?','initial':![]});if(!_0x1407d2['confirm'])return console[_0x5220fd(0xe4)](_0x5220fd(0xdd)),0x0;try{removeProfileFromUserConfig(_0x18f841),console[_0x5220fd(0xe4)](a30_0x5b108d[_0x5220fd(0xda)]('✓')+_0x5220fd(0xd3)+_0x18f841+_0x5220fd(0xfd));}catch(_0x2aeb11){return console[_0x5220fd(0xeb)](a30_0x5b108d[_0x5220fd(0xf7)](_0x5220fd(0x103)+(_0x2aeb11 instanceof Error?_0x2aeb11[_0x5220fd(0x110)]:String(_0x2aeb11)))),0x1;}const _0x325c9a=await isKeychainAvailable();if(_0x325c9a){const _0xb04024=await deleteKeychainAPIKey(_0x18f841);_0xb04024&&console['log'](a30_0x5b108d[_0x5220fd(0xda)]('✓')+_0x5220fd(0x109));}return 0x0;}}function a30_0x5cd0(_0x84d2a5,_0x4074af){_0x84d2a5=_0x84d2a5-0xa5;const _0x3e392e=a30_0x3e39();let _0x5cd063=_0x3e392e[_0x84d2a5];return _0x5cd063;}export class ProfileSetCommand extends BaseCommand{[a30_0x3738e1(0xe6)]='profile:set';[a30_0x3738e1(0xcb)]='Set\x20a\x20profile\x20configuration\x20value';static [a30_0x3738e1(0x107)]=[a30_0x3738e1(0xee),'database',a30_0x3738e1(0x10a),a30_0x3738e1(0xd9),a30_0x3738e1(0xfa),'description'];[a30_0x3738e1(0xe0)](_0x2441b3){const _0x99f05e=a30_0x3738e1,{args:_0x576956,options:_0x2276f1}=_0x2441b3,_0x36f9ea=_0x2276f1[_0x99f05e(0xd8)]||getActiveProfile();if(!_0x36f9ea)return _0x99f05e(0x105);if(_0x576956['length']===0x0)return _0x99f05e(0xfc)+ProfileSetCommand[_0x99f05e(0x107)]['join'](',\x20');const _0x2205b0=_0x576956[0x0];if(!_0x2205b0[_0x99f05e(0xbb)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x99f05e(0x107)]['join'](',\x20');const [_0x527b60]=_0x2205b0[_0x99f05e(0xab)]('=',0x2);if(!ProfileSetCommand[_0x99f05e(0x107)][_0x99f05e(0xbb)](_0x527b60))return _0x99f05e(0x100)+_0x527b60+_0x99f05e(0xb3)+ProfileSetCommand['VALID_KEYS'][_0x99f05e(0xc9)](',\x20');return undefined;}async[a30_0x3738e1(0x10c)](_0x3bb7b7){const _0x13c78b=a30_0x3738e1,{args:_0x5c32c6,options:_0x16e96d}=_0x3bb7b7,_0x3b0014=_0x16e96d[_0x13c78b(0xd8)]||getActiveProfile(),[_0x1b2181,..._0x1a73a8]=_0x5c32c6[0x0]['split']('='),_0x1caba6=_0x1a73a8[_0x13c78b(0xc9)]('=');console[_0x13c78b(0xe4)](a30_0x5b108d[_0x13c78b(0xfe)]('tdx:\x20profile\x20set'));if(!profileExists(_0x3b0014)){const _0x524552=await a30_0x57c9dd({'type':_0x13c78b(0xb9),'name':_0x13c78b(0xca),'message':_0x13c78b(0xaf)+_0x3b0014+_0x13c78b(0xaa),'initial':!![]});if(!_0x524552[_0x13c78b(0xca)])return console[_0x13c78b(0xe4)](_0x13c78b(0xec)),0x1;}const _0x63c358=loadProfile(_0x3b0014),_0x24987f=_0x63c358?.['config']||{};if(_0x1b2181===_0x13c78b(0xee)){const _0x3550c9=resolveSite(_0x1caba6);console[_0x13c78b(0xe4)]('Changing\x20site\x20to\x20\x27'+_0x3550c9+_0x13c78b(0xb5)),console[_0x13c78b(0xe4)](_0x13c78b(0xbf)),console[_0x13c78b(0xe4)]('\x20\x20'+getConsoleUrl(_0x3550c9,'/app/mp/ak'));const _0x280879=await a30_0x57c9dd({'type':_0x13c78b(0xbe),'name':_0x13c78b(0xc2),'message':_0x13c78b(0xea),'validate':_0x304526=>{const _0x19be33=_0x13c78b;if(!_0x304526||!_0x304526[_0x19be33(0xdf)]())return _0x19be33(0xb4);return!![];}});if(!_0x280879['apiKey'])return console[_0x13c78b(0xe4)](_0x13c78b(0xff)),0x1;console[_0x13c78b(0xe4)](_0x13c78b(0xa9));try{const _0x1eb817=TDX[_0x13c78b(0xca)]({'site':_0x3550c9,'apiKey':_0x280879[_0x13c78b(0xc2)][_0x13c78b(0xdf)](),'logLevel':_0x16e96d['logLevel']??LogLevel[_0x13c78b(0xb8)]}),_0xe7be12=await _0x1eb817[_0x13c78b(0x10e)][_0x13c78b(0xa5)]();console['log'](a30_0x5b108d[_0x13c78b(0xda)]('✓')+_0x13c78b(0xf4)+_0xe7be12[_0x13c78b(0xde)]+')');const _0xca195f=await isKeychainAvailable();_0xca195f?(await saveAPIKeyAsync(_0x280879[_0x13c78b(0xc2)][_0x13c78b(0xdf)](),_0x3550c9,_0x3b0014),console['log'](a30_0x5b108d[_0x13c78b(0xda)]('✓')+_0x13c78b(0xe1))):console['warn'](a30_0x5b108d['yellow'](_0x13c78b(0x106))),_0x24987f[_0x13c78b(0xee)]=_0x3550c9;}catch(_0x4334cb){if(_0x4334cb instanceof HTTPClientError&&_0x4334cb[_0x13c78b(0xa6)]===0x191)return printAuthError(_0x4334cb),0x1;return console[_0x13c78b(0xeb)](a30_0x5b108d['red'](_0x13c78b(0xc8)+(_0x4334cb instanceof Error?_0x4334cb[_0x13c78b(0x110)]:String(_0x4334cb)))),console[_0x13c78b(0xeb)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x24987f[_0x1b2181]=_0x1caba6||undefined;return saveProfileToUserConfig(_0x3b0014,_0x24987f),console[_0x13c78b(0xe4)](a30_0x5b108d[_0x13c78b(0xda)]('✓')+_0x13c78b(0xd3)+_0x3b0014+_0x13c78b(0xf9)+_0x1b2181+'='+(_0x1caba6||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']='profile:use';[a30_0x3738e1(0xcb)]=a30_0x3738e1(0xc6);['validate'](_0x25b824){const {args:_0x864a07}=_0x25b824;if(_0x864a07['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a30_0x3738e1(0x10c)](_0x51db5d){const _0x4a025a=a30_0x3738e1,{args:_0x3aeb17,options:_0x317cba}=_0x51db5d,_0x596244=_0x3aeb17[0x0],_0x97197a=_0x317cba[_0x4a025a(0xe5)];cleanExpiredSessions();if(!profileExists(_0x596244)){console['error'](a30_0x5b108d['red'](_0x4a025a(0xaf)+_0x596244+_0x4a025a(0xd4))),console['log']('\x0aAvailable\x20profiles:');const _0x556acb=listProfiles();if(_0x556acb[_0x4a025a(0xb1)]===0x0)console['log'](_0x4a025a(0xf6));else for(const _0x14f19e of _0x556acb){console['log']('\x20\x20-\x20'+_0x14f19e[_0x4a025a(0xe6)]);}return 0x1;}if(_0x97197a){const _0x3538ee=a30_0x4e07a9[_0x4a025a(0xc9)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x596244),console['log'](_0x4a025a(0xbc)+a30_0x5b108d['green'](_0x596244)),console[_0x4a025a(0xe4)](a30_0x5b108d[_0x4a025a(0xd7)](_0x4a025a(0xb0)+_0x3538ee)),0x0;}const _0x8c2b9e=getSessionID(_0x317cba[_0x4a025a(0x102)]);return saveSessionContext({'profile':_0x596244},_0x317cba[_0x4a025a(0x102)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a30_0x5b108d[_0x4a025a(0xda)](_0x596244)+'\x20'+a30_0x5b108d['dim'](_0x4a025a(0xe9)+_0x8c2b9e+')')),console[_0x4a025a(0xe4)](a30_0x5b108d['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x596244+_0x4a025a(0xcc))),0x0;}}
@@ -1 +1 @@
1
- const a28_0x4b13ef=a28_0x3668;(function(_0x47a66c,_0xe4ca9d){const _0xeae7d5=a28_0x3668,_0x5b849d=_0x47a66c();while(!![]){try{const _0x37fe89=-parseInt(_0xeae7d5(0xac))/0x1*(-parseInt(_0xeae7d5(0xad))/0x2)+parseInt(_0xeae7d5(0xa7))/0x3*(parseInt(_0xeae7d5(0xa4))/0x4)+-parseInt(_0xeae7d5(0xa9))/0x5+-parseInt(_0xeae7d5(0x9d))/0x6*(-parseInt(_0xeae7d5(0x98))/0x7)+parseInt(_0xeae7d5(0x9b))/0x8+parseInt(_0xeae7d5(0xae))/0x9+-parseInt(_0xeae7d5(0x9f))/0xa*(parseInt(_0xeae7d5(0xa3))/0xb);if(_0x37fe89===_0xe4ca9d)break;else _0x5b849d['push'](_0x5b849d['shift']());}catch(_0x5f3673){_0x5b849d['push'](_0x5b849d['shift']());}}}(a28_0x225c,0xb8f5e));function a28_0x225c(){const _0x547a1f=['execute','473Knikud','12QDhbpF','config','name','1319583vJLSpn','List\x20all\x20available\x20profiles','6296860LnSOPL','error','description','1020161tZXkko','2xVimNL','11966238wLsICT','3322564lobvou','log','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2850280QfqUKH','length','6nSpvUc','profiles','577510sCzmRz','scope','message'];a28_0x225c=function(){return _0x547a1f;};return a28_0x225c();}function a28_0x3668(_0x78245f,_0x1e7495){_0x78245f=_0x78245f-0x98;const _0x225c10=a28_0x225c();let _0x3668dd=_0x225c10[_0x78245f];return _0x3668dd;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x4b13ef(0xa6)]=a28_0x4b13ef(0x9e);[a28_0x4b13ef(0xab)]=a28_0x4b13ef(0xa8);async[a28_0x4b13ef(0xa2)](_0x2a8e5a){const _0xeaa4c2=a28_0x4b13ef,{options:_0x5db347}=_0x2a8e5a;try{const _0x347ccb=listProfiles(),_0x1239a9=getActiveProfile();if(_0x347ccb[_0xeaa4c2(0x9c)]===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0xeaa4c2(0x9a)),console[_0xeaa4c2(0x99)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x52e006=_0x347ccb['map'](_0x5192f9=>{const _0x58a2fb=_0xeaa4c2,_0x52c052=_0x5192f9[_0x58a2fb(0xa6)]===_0x1239a9,_0x4a1269=getProfileParams(_0x5192f9[_0x58a2fb(0xa5)]);return{'name':_0x5192f9[_0x58a2fb(0xa6)],'active':_0x52c052,'scope':_0x5192f9[_0x58a2fb(0xa0)],'description':_0x5192f9[_0x58a2fb(0xa5)][_0x58a2fb(0xab)]||'','params':_0x4a1269};});return await handleSDKOutput(_0x52e006,_0x5db347),0x0;}catch(_0x2bd3cf){return _0x2bd3cf instanceof Error&&console[_0xeaa4c2(0xaa)]('Error:\x20'+_0x2bd3cf[_0xeaa4c2(0xa1)]),0x1;}}}
1
+ const a31_0x33935c=a31_0x60bb;function a31_0x60bb(_0x1b3c9d,_0x4bb6a0){_0x1b3c9d=_0x1b3c9d-0xd1;const _0x25ea88=a31_0x25ea();let _0x60bb75=_0x25ea88[_0x1b3c9d];return _0x60bb75;}(function(_0x1f5924,_0x237c74){const _0x2f6b5a=a31_0x60bb,_0x5f4125=_0x1f5924();while(!![]){try{const _0x1de8ff=parseInt(_0x2f6b5a(0xe7))/0x1+parseInt(_0x2f6b5a(0xd9))/0x2+parseInt(_0x2f6b5a(0xd6))/0x3*(-parseInt(_0x2f6b5a(0xde))/0x4)+-parseInt(_0x2f6b5a(0xda))/0x5+-parseInt(_0x2f6b5a(0xdf))/0x6*(-parseInt(_0x2f6b5a(0xd1))/0x7)+parseInt(_0x2f6b5a(0xd7))/0x8+parseInt(_0x2f6b5a(0xd2))/0x9*(-parseInt(_0x2f6b5a(0xd4))/0xa);if(_0x1de8ff===_0x237c74)break;else _0x5f4125['push'](_0x5f4125['shift']());}catch(_0x40ba76){_0x5f4125['push'](_0x5f4125['shift']());}}}(a31_0x25ea,0x25606));function a31_0x25ea(){const _0x17ecef=['28wGtZtz','1726752nlwbRd','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Global:\x20~/.config/tdx/tdx.json','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','Error:\x20','length','profiles','12485tAxoOb','error','7aKgTfZ','10467iOzFHu','message','3740vMTpbm','log','19245ybcVeI','822784jCFqoa','name','471844swaqWm','30430miMNfl','description','List\x20all\x20available\x20profiles','execute'];a31_0x25ea=function(){return _0x17ecef;};return a31_0x25ea();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a31_0x33935c(0xd8)]=a31_0x33935c(0xe6);[a31_0x33935c(0xdb)]=a31_0x33935c(0xdc);async[a31_0x33935c(0xdd)](_0x2665e2){const _0x174062=a31_0x33935c,{options:_0x4ca1b8}=_0x2665e2;try{const _0x5574eb=listProfiles(),_0x59790e=getActiveProfile();if(_0x5574eb[_0x174062(0xe5)]===0x0)return console[_0x174062(0xd5)](_0x174062(0xe0)),console[_0x174062(0xd5)](_0x174062(0xe3)),console[_0x174062(0xd5)](_0x174062(0xe1)),0x0;const _0x54d29f=_0x5574eb['map'](_0x387199=>{const _0x12cb40=_0x174062,_0x340597=_0x387199[_0x12cb40(0xd8)]===_0x59790e,_0x54d28a=getProfileParams(_0x387199['config']);return{'name':_0x387199['name'],'active':_0x340597,'scope':_0x387199[_0x12cb40(0xe2)],'description':_0x387199['config'][_0x12cb40(0xdb)]||'','params':_0x54d28a};});return await handleSDKOutput(_0x54d29f,_0x4ca1b8),0x0;}catch(_0x4b95c6){return _0x4b95c6 instanceof Error&&console[_0x174062(0xe8)](_0x174062(0xe4)+_0x4b95c6[_0x174062(0xd3)]),0x1;}}}
@@ -1 +1 @@
1
- {"version":3,"file":"query-command.d.ts","sourceRoot":"","sources":["../../src/commands/query-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAQhE;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,WAAW,mCAAmC;IAEvD;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAwIvD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;CAgBhE"}
1
+ {"version":3,"file":"query-command.d.ts","sourceRoot":"","sources":["../../src/commands/query-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAQhE;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,WAAW,mCAAmC;IAEvD;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAyIvD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;CAgBhE"}
@@ -1 +1 @@
1
- const a29_0x578e4a=a29_0xf7da;(function(_0xf1deab,_0x1ef808){const _0x32fe8a=a29_0xf7da,_0x2ba2b0=_0xf1deab();while(!![]){try{const _0x2d6e35=-parseInt(_0x32fe8a(0x155))/0x1*(parseInt(_0x32fe8a(0x143))/0x2)+parseInt(_0x32fe8a(0x151))/0x3+parseInt(_0x32fe8a(0x15a))/0x4*(-parseInt(_0x32fe8a(0x149))/0x5)+parseInt(_0x32fe8a(0x140))/0x6+parseInt(_0x32fe8a(0x15d))/0x7+-parseInt(_0x32fe8a(0x156))/0x8+parseInt(_0x32fe8a(0x144))/0x9;if(_0x2d6e35===_0x1ef808)break;else _0x2ba2b0['push'](_0x2ba2b0['shift']());}catch(_0x83d6cc){_0x2ba2b0['push'](_0x2ba2b0['shift']());}}}(a29_0x2e52,0x673e0));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a29_0xf7da(_0x3e2a9d,_0xbf7fd8){_0x3e2a9d=_0x3e2a9d-0x12f;const _0x2e52b3=a29_0x2e52();let _0xf7daa3=_0x2e52b3[_0x3e2a9d];return _0xf7daa3;}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 a29_0x2e52(){const _0x3ff92e=['error','\x20splits','setExtra','\x0aAll\x20results\x20saved\x20to\x20','No\x20SQL\x20provided','setPhase','\x20rows\x20','execute','stats','query','1829346uDzPrZ','join','length','989090OKYNhg','17581185JJTlWZ','originalMessage','processedRows','validate','site','4142885IkIubr','verbose','SQL:\x20','Query\x20completed:\x20Processed\x20','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','Schema:\x20','information_schema','data','69711jNPFow','in\x20','message','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','1JnZRnG','5746720HrkNIs','Run\x20Trino\x20queries\x20(streaming)','jobId','Executing\x20statement\x20','4YOItXh','Catalog:\x20','Executing\x20query\x20[','1279243xUNPDl','totalSplits','file','...','args','output','elapsedTimeMillis','Statement\x20','\x20[Job\x20ID:\x20','options','\x20-\x20'];a29_0x2e52=function(){return _0x3ff92e;};return a29_0x2e52();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a29_0x578e4a(0x13f);['description']=a29_0x578e4a(0x157);async['execute'](_0x59ab96){const _0x1806f3=a29_0x578e4a,{options:_0x14f3ef,args:_0xf073ee,tdx:_0x2b9c68}=_0x59ab96,_0x27e708=_0xf073ee[0x0],_0x1b2668=_0x14f3ef[_0x1806f3(0x15f)];let _0x1dd359;try{if(_0x1b2668)_0x1dd359=readSqlStatementsFromFile(_0x1b2668);else{if(_0x27e708==='-')_0x1dd359=await readSqlStatementsFromStdin();else{if(_0x27e708&&isSqlFilePath(_0x27e708))_0x1dd359=readSqlStatementsFromFile(_0x27e708);else{if(_0x27e708)_0x1dd359=splitSqlStatements(_0x27e708);else throw new Error(_0x1806f3(0x13a));}}}}catch(_0x2d3775){return console['error']('Error:\x20'+_0x2d3775[_0x1806f3(0x153)]),0x1;}const _0x56e8dc=_0x14f3ef['database']||_0x1806f3(0x14f),_0x1b0ec1=_0x14f3ef['catalog'];try{const _0x967085=[],_0x1e0cef=!!_0x14f3ef[_0x1806f3(0x130)];for(let _0x4c5ea2=0x0;_0x4c5ea2<_0x1dd359['length'];_0x4c5ea2++){const _0x538d65=_0x1dd359[_0x4c5ea2],_0x4cbe46=_0x4c5ea2+0x1,_0x263702=_0x1dd359['length'],_0x1ffb2f=_0x263702>0x1;_0x14f3ef[_0x1806f3(0x14a)]&&(console['error']('\x0a'+(_0x1ffb2f?_0x1806f3(0x132)+_0x4cbe46+'/'+_0x263702+':':'')),console[_0x1806f3(0x136)]('Site:\x20'+_0x14f3ef[_0x1806f3(0x148)]),console['error'](_0x1806f3(0x15b)+(_0x1b0ec1||'td')),console[_0x1806f3(0x136)](_0x1806f3(0x14e)+_0x56e8dc),console[_0x1806f3(0x136)](_0x1806f3(0x14b)+_0x538d65));const _0x25e31e=_0x1ffb2f?_0x1806f3(0x159)+_0x4cbe46+'/'+_0x263702+_0x1806f3(0x160):'Executing\x20query...';try{const _0x21a826=await withProgressSpinner(_0x25e31e,async _0x1b1685=>{const _0x57ec83=_0x1806f3,_0x357a45=await _0x2b9c68[_0x57ec83(0x13f)][_0x57ec83(0x13d)](_0x538d65,{'catalog':_0x1b0ec1,'schema':_0x56e8dc,'onJobId':_0x47964b=>{_0x1b1685['setJobId'](_0x47964b);},'onProgress':_0x33a8ac=>{const _0x1ab969=_0x57ec83;_0x1b1685[_0x1ab969(0x13b)](_0x1ab969(0x15c)+_0x33a8ac['state']+']'),_0x1b1685[_0x1ab969(0x138)](formatRows(_0x33a8ac[_0x1ab969(0x146)])+_0x1ab969(0x13c)+_0x33a8ac['completedSplits']+'/'+_0x33a8ac[_0x1ab969(0x15e)]+_0x1ab969(0x137));}});return _0x357a45;},{'verbose':_0x14f3ef[_0x1806f3(0x14a)]}),_0x32b75a=_0x21a826[_0x1806f3(0x150)],_0x878c1c=_0x32b75a[_0x1806f3(0x158)]?_0x1806f3(0x133)+_0x32b75a['jobId']+']':'',_0x593d8c=_0x1ffb2f?_0x1806f3(0x132)+_0x4cbe46+'/'+_0x263702+_0x1806f3(0x135):'';console[_0x1806f3(0x136)]('✔\x20'+_0x593d8c+_0x1806f3(0x14c)+formatRows(_0x32b75a[_0x1806f3(0x13e)][_0x1806f3(0x146)])+_0x1806f3(0x13c)+(_0x1806f3(0x152)+formatElapsed(_0x32b75a[_0x1806f3(0x13e)][_0x1806f3(0x131)])+_0x878c1c));if(_0x1ffb2f&&_0x1e0cef){const _0x1521b0=resolveOutputOptions(_0x14f3ef),_0x5bd637=await formatQueryOutput(_0x32b75a,_0x1521b0);_0x967085['push'](_0x5bd637);}else await handleQueryOutput(_0x32b75a,_0x14f3ef);}catch(_0x2ce7a7){const _0x5556a1=_0x1ffb2f?_0x1806f3(0x132)+_0x4cbe46+'/'+_0x263702+':\x0a':'',_0x151281=_0x2ce7a7 instanceof SDKError?_0x2ce7a7[_0x1806f3(0x145)]:_0x2ce7a7[_0x1806f3(0x153)];return console[_0x1806f3(0x136)](''+_0x5556a1+_0x151281),0x1;}}if(_0x1dd359[_0x1806f3(0x142)]>0x1&&_0x1e0cef&&_0x967085['length']>0x0){const _0x5498e0=_0x967085[_0x1806f3(0x141)]('\x0a');writeFileSync(_0x14f3ef[_0x1806f3(0x130)],_0x5498e0),console[_0x1806f3(0x136)](_0x1806f3(0x139)+_0x14f3ef['output']);}return 0x0;}catch(_0x39a45f){throw _0x39a45f;}}[a29_0x578e4a(0x147)](_0x1c4b04){const _0x51a9f2=a29_0x578e4a,_0x41559c=_0x1c4b04[_0x51a9f2(0x12f)][0x0],_0x39780f=_0x1c4b04[_0x51a9f2(0x134)][_0x51a9f2(0x15f)];if(!_0x41559c&&!_0x39780f)return _0x51a9f2(0x14d);if(_0x41559c&&_0x39780f)return _0x51a9f2(0x154);return undefined;}}
1
+ const a32_0x10d53c=a32_0x5091;(function(_0x2d90b0,_0x28a300){const _0x2163ee=a32_0x5091,_0x59d548=_0x2d90b0();while(!![]){try{const _0x27d88c=parseInt(_0x2163ee(0xe5))/0x1+-parseInt(_0x2163ee(0xe4))/0x2*(parseInt(_0x2163ee(0xe0))/0x3)+parseInt(_0x2163ee(0xd3))/0x4*(parseInt(_0x2163ee(0xc0))/0x5)+parseInt(_0x2163ee(0xdb))/0x6*(-parseInt(_0x2163ee(0xb8))/0x7)+-parseInt(_0x2163ee(0xc8))/0x8*(-parseInt(_0x2163ee(0xc9))/0x9)+parseInt(_0x2163ee(0xe7))/0xa+parseInt(_0x2163ee(0xc7))/0xb;if(_0x27d88c===_0x28a300)break;else _0x59d548['push'](_0x59d548['shift']());}catch(_0x1301b6){_0x59d548['push'](_0x59d548['shift']());}}}(a32_0x19f4,0x5bb95));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a32_0x19f4(){const _0x5b86af=['61439jdfRIE','catalog','3512200zXVMjc','state','originalMessage','231RNxGfo','execute','name','validate','totalSplits','elapsedTimeMillis','Executing\x20query...','Site:\x20','30oxSYYC','error','Schema:\x20','jobId','verbose','output','Executing\x20query\x20[','5031499hEuABP','7528atexbJ','1242HyCeEO','push','database','length','processedRows','query','\x0aAll\x20results\x20saved\x20to\x20','SQL:\x20','\x20[Job\x20ID:\x20','description','121252BSgfza','Error:\x20','file','\x20rows\x20','site','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','No\x20SQL\x20provided','Run\x20Trino\x20queries\x20(streaming)','76764KBDnQX','\x20splits','Statement\x20','\x20-\x20','stats','303qHKLXh','Executing\x20statement\x20','setExtra','in\x20','7602YYUIvs'];a32_0x19f4=function(){return _0x5b86af;};return a32_0x19f4();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a32_0x5091(_0x28af27,_0x5d756c){_0x28af27=_0x28af27-0xb8;const _0x19f442=a32_0x19f4();let _0x5091c0=_0x19f442[_0x28af27];return _0x5091c0;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a32_0x10d53c(0xba)]='query';[a32_0x10d53c(0xd2)]=a32_0x10d53c(0xda);async[a32_0x10d53c(0xb9)](_0x5399ec){const _0x7eb596=a32_0x10d53c,{options:_0x140861,args:_0x42ec91,tdx:_0x414549}=_0x5399ec,_0x17e463={..._0x140861,'limitStructuredFormats':!![]},_0x42f509=_0x42ec91[0x0],_0x5d32d5=_0x140861[_0x7eb596(0xd5)];let _0x54ce58;try{if(_0x5d32d5)_0x54ce58=readSqlStatementsFromFile(_0x5d32d5);else{if(_0x42f509==='-')_0x54ce58=await readSqlStatementsFromStdin();else{if(_0x42f509&&isSqlFilePath(_0x42f509))_0x54ce58=readSqlStatementsFromFile(_0x42f509);else{if(_0x42f509)_0x54ce58=splitSqlStatements(_0x42f509);else throw new Error(_0x7eb596(0xd9));}}}}catch(_0x58eccf){return console['error'](_0x7eb596(0xd4)+_0x58eccf['message']),0x1;}const _0x903937=_0x140861[_0x7eb596(0xcb)]||'information_schema',_0xa55714=_0x140861[_0x7eb596(0xe6)];try{const _0x379678=[],_0xe23b37=!!_0x140861['output'];for(let _0x35357d=0x0;_0x35357d<_0x54ce58[_0x7eb596(0xcc)];_0x35357d++){const _0x1db74a=_0x54ce58[_0x35357d],_0x149a39=_0x35357d+0x1,_0x37d541=_0x54ce58[_0x7eb596(0xcc)],_0x1303ae=_0x37d541>0x1;_0x140861[_0x7eb596(0xc4)]&&(console[_0x7eb596(0xc1)]('\x0a'+(_0x1303ae?'Statement\x20'+_0x149a39+'/'+_0x37d541+':':'')),console[_0x7eb596(0xc1)](_0x7eb596(0xbf)+_0x140861[_0x7eb596(0xd7)]),console[_0x7eb596(0xc1)]('Catalog:\x20'+(_0xa55714||'td')),console['error'](_0x7eb596(0xc2)+_0x903937),console[_0x7eb596(0xc1)](_0x7eb596(0xd0)+_0x1db74a));const _0x13654c=_0x1303ae?_0x7eb596(0xe1)+_0x149a39+'/'+_0x37d541+'...':_0x7eb596(0xbe);try{const _0x1560e4=await withProgressSpinner(_0x13654c,async _0x55daf9=>{const _0x18dee6=_0x7eb596,_0x473489=await _0x414549[_0x18dee6(0xce)][_0x18dee6(0xb9)](_0x1db74a,{'catalog':_0xa55714,'schema':_0x903937,'onJobId':_0x347075=>{_0x55daf9['setJobId'](_0x347075);},'onProgress':_0x2a4d32=>{const _0x24c948=_0x18dee6;_0x55daf9['setPhase'](_0x24c948(0xc6)+_0x2a4d32[_0x24c948(0xe8)]+']'),_0x55daf9[_0x24c948(0xe2)](formatRows(_0x2a4d32['processedRows'])+_0x24c948(0xd6)+_0x2a4d32['completedSplits']+'/'+_0x2a4d32[_0x24c948(0xbc)]+_0x24c948(0xdc));}});return _0x473489;},{'verbose':_0x140861[_0x7eb596(0xc4)]}),_0xc985a=_0x1560e4['data'],_0x5c3041=_0xc985a[_0x7eb596(0xc3)]?_0x7eb596(0xd1)+_0xc985a[_0x7eb596(0xc3)]+']':'',_0x20d370=_0x1303ae?'Statement\x20'+_0x149a39+'/'+_0x37d541+_0x7eb596(0xde):'';console[_0x7eb596(0xc1)]('✔\x20'+_0x20d370+'Query\x20completed:\x20Processed\x20'+formatRows(_0xc985a[_0x7eb596(0xdf)][_0x7eb596(0xcd)])+_0x7eb596(0xd6)+(_0x7eb596(0xe3)+formatElapsed(_0xc985a['stats'][_0x7eb596(0xbd)])+_0x5c3041));if(_0x1303ae&&_0xe23b37){const _0x15daf4=resolveOutputOptions(_0x17e463),_0x2e3548=await formatQueryOutput(_0xc985a,_0x15daf4);_0x379678[_0x7eb596(0xca)](_0x2e3548);}else await handleQueryOutput(_0xc985a,_0x17e463);}catch(_0x548534){const _0x41107a=_0x1303ae?_0x7eb596(0xdd)+_0x149a39+'/'+_0x37d541+':\x0a':'',_0x5e6e04=_0x548534 instanceof SDKError?_0x548534[_0x7eb596(0xe9)]:_0x548534['message'];return console[_0x7eb596(0xc1)](''+_0x41107a+_0x5e6e04),0x1;}}if(_0x54ce58[_0x7eb596(0xcc)]>0x1&&_0xe23b37&&_0x379678['length']>0x0){const _0x4e5657=_0x379678['join']('\x0a');writeFileSync(_0x140861[_0x7eb596(0xc5)],_0x4e5657),console['error'](_0x7eb596(0xcf)+_0x140861[_0x7eb596(0xc5)]);}return 0x0;}catch(_0x1a8807){throw _0x1a8807;}}[a32_0x10d53c(0xbb)](_0x3ba3e8){const _0x37ec15=a32_0x10d53c,_0x35a050=_0x3ba3e8['args'][0x0],_0x67fb6f=_0x3ba3e8['options'][_0x37ec15(0xd5)];if(!_0x35a050&&!_0x67fb6f)return'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';if(_0x35a050&&_0x67fb6f)return _0x37ec15(0xd8);return undefined;}}